Vom Automaten zum Prozessor - Prof. Dr. Hellberg EDV Beratung

Werbung
Vom HW-Automaten zum Prozessor
Technische Grundlagen der Informatik
Prof. Dr. Michael Löwe
(Grundlage: Tanenbaum/Goodman. Computerarchitektur. 1999.)
Inhalt
Hardware-Automaten
Speicherorganisation
Prozessoren und Speicher
Datenweg
Micro Controller
Instruction Set Architecture
Instruction Set Architecture Implementation
FHDW
Vom HW-Automaten zum Prozessor
2
Hardware-Automaten
Clk
Register (n Bit)
Input
(m Bit)
Next State
(n Bit)
Last
State
Logische Funktion (m+n Bit  k+n Bit)
Output
(k Bit)
Register (k Bit)
FHDW
Vom HW-Automaten zum Prozessor
3
Hardware-Automaten: Beispiele
•
•
•
•
Ampel
Bedieneinheit Videorecorder
Geldautomat
.....
FHDW
Vom HW-Automaten zum Prozessor
4
Register (n Bit)
Adressbus
Last
State
Input
(m Bit)
Hardware-Automaten
Logische Funktion
(m+n Bit  k+n Bit)
----------------------------------Speicherbaustein mit
m+n Bit breitem Adressbus
k+n Bit breitem Datenbus
Datenbus
Next State
(n Bit)
Output
(k Bit)
Clk
Register (k Bit)
FHDW
Vom HW-Automaten zum Prozessor
5
Register
D1
D
D2
Q D
Clk
Clk
FHDW
D3
Q D
Clk
Q1
D4
Q D
Clk
Q2
Vom HW-Automaten zum Prozessor
Q
Clk
Q3
Q4
6
Speicherorganisation
IN
WR
CS
D
Q
Clk
D
Q
Clk
D
Q
Clk
D
Q
Clk
OE
A0
Dekodierer/
Multiplexer
A1
Out (
FHDW
Tri-State: IN = Out )
Vom HW-Automaten zum Prozessor
7
Speicherbausteine
A0
A1
FHDW
D
A0
A1
A2
A3
D
A0
A1
A2
A3
D0
D1
D2
D3
41 Bit
161 Bit
164 Bit
WR CS OE
WR CS OE
WR CS OE
Vom HW-Automaten zum Prozessor
8
Speicher aus Bausteinen
Verfügbar: 16 × 4 Bit
Nachgefragt:
• 32 × 4 Bit
• 16 × 8 Bit
A0
A1
A2
A3
D0
D1
D2
D3
164 Bit
WR CS OE
FHDW
Vom HW-Automaten zum Prozessor
9
Speicher aus Bausteinen
DatenBus
D0
D1
D2
D3
A0
A1
A2
A3
D0
D1
D2
D3
A0
A1
A2
A3
D0
D1
D2
D3
164 Bit
164 Bit
WR CS OE
WR CS OE
Schaltung
für
32  4 Bit
WR
OE
A0
A1
A2
A3
A4
AdressBus
FHDW
Vom HW-Automaten zum Prozessor
10
Speicher aus Bausteinen
DatenBus
D0
D1
D2
D3
D4
D5
D6
D7
A0
A1
A2
A3
WR
CS
OE
D0
D1
D2
D3
A0
A1
A2
A3
D0
D1
D2
D3
164 Bit
164 Bit
WR CS OE
WR CS OE
A0
A1
A2
A3
Schaltung
für
16  8 Bit
AdressBus
FHDW
Vom HW-Automaten zum Prozessor
11
Speicherbausteine
Random Access Memory (RAM)
Statische RAMs (SRAM)
Dynamische RAMs (DRAM)
Read-Only-Memory (ROM)
Vorfabrizierte ROMs
Programmable ROM (PROM)
Erasable PROM (EPROM)
Hybride Speicherbausteine
Electrically EPROMs (EEPROM)
Flash Memory
FHDW
Vom HW-Automaten zum Prozessor
12
Prozessor und Speicher
Operanden-Stack
Konstanten
Datenbus
Variablen-Stack
Adressbus
Speicher
Prozessor
Programm
FHDW
Vom HW-Automaten zum Prozessor
13
Der Datenweg
MAR
Zum
und
vom
Speicher
MDR
MBR
PC
LV
C
B
CPP
SP
Typische ALU-Funktionen:
C =A+B
C =AB
C =A
C=B
C=B+1
C = ShiftLeft(A, 8 Bit)
C = -A
...
TOS
H
Z
A
ALU
FHDW
Vom HW-Automaten zum Prozessor
14
Micro Controller: Übersicht
read,
write,
fetch
MPC
MAR
MDR
512  32 Bit
Steuerspeicher
MBR
PC
9
LV
C
B
2 7
8 3 3
Addr J ALU C M B
CPP
SP
2*
Decode
TOS
H
A
1
Z
ALU
FHDW
Vom HW-Automaten zum Prozessor
15
MIR
Micro Instruction
read,
write,
fetch
MPC
MAR
MDR
512  32 Bit
Steuerspeicher
MBR
PC
LV
C
CPP
SP
TOS
9
B
2 7
8 3 3
Addr J ALU C M B
Auswahl (mehrerer) Register für C-Bus
Auswahl
der ALU-Operation
zur Übernahme
des ALU-Resultats
2*
9
2
7
8
MIR
3 3
Decode
J ALU
C M B
Z
1
A
Adresse
Auswahl
der nächsten
Register
Micro-GOTO
auszufür
Speichersteuerung
B-Bus (dekodiert)
ALU
führenden
als zweites
Micro
bedingt
Instruction
Argument
(read
und unbedingt
|für
write);
die ALU
fetch
H
FHDW
Addr
Vom HW-Automaten zum Prozessor
16
Micro Controller: Ablaufsteuerung
1. LadenMAR
der nächsten
MDR
Micro-Instruktion
MBR
Adresse in
MPC
MPC
2. Ausbreiten
der
512  32 Bit
Steuerspeicher
Signale
bis zum
9 2 7
8 3 3
B-Bus
PC
C
LV
3. Ausbreiten
der
B
CPP
Signale
bis zum
SP
C-Bus
Addr J ALU C M B
Decode
H
FHDW
MIR
2*
TOS
4. Speichern der
A
Ergebnisse ALU
read,
write,
fetch
1
Z
Vom HW-Automaten zum Prozessor
5. MPC für neuen
Zyklus laden
17
Micro Programme
read,
write,
fetch
MAR
MPC
Label: R1
=.....
= R <op R‘>
<;(rd|wr)>
MDR
512  32 Bit
<;fetch>
MBR<;goto label <;label‘>>
Steuerspeicher
Beispiele:PC
9 2 7
8 3 3
LV
B
Addr J ALU C M B MIR
H =C MDRCPP
H = H + SP
SP
Decode
H = MBRTOS<< 8
H
Z
SP = H orAMDR; fetch
1
ALUgoto Main
TOS = MDR;
2*
FHDW
Vom HW-Automaten zum Prozessor
18
Prozessor und Speicher
Adr 65.123.....
Operanden-Stack
Speicher
Adr 0
FHDW
Datenbus
Konstanten
Adressbus
Variablen-Stack
SP (top)
LV (bottom of top)
Prozessor
Maschinen
Programm
Vom HW-Automaten zum Prozessor
CPP (bottom)
PC (random)
19
Programme und Maschinenprogramme
C++
Programm
Pascal
Programm
VB6
Programm
C++ Compiler
Pascal Compiler
VB6 Compiler
Maschinenprogramm
SW
HW
Prozessor
steuert
Mikroprogramm
Speicherzustand
FHDW
Vom HW-Automaten zum Prozessor
20
Typische Instruktionen
Dyadische Operatoren: add, sub, or, ...
Byte1: Opcode
Speicherbefehle: store, load (from/on stack)
Byte1: Opcode
Byte2 + Byte3:Variable Index
Sprünge: goto, goto on zero, ...
Byte1: Opcode
Byte2 + Byte3: Offset vom PC
Prozeduraufruf: call, return
FHDW
Vom HW-Automaten zum Prozessor
21
Micro-Implementierung
B1: add
Main: PC = PC + 1; fetch; goto (MBR)
B1: load
B2: Index
B1: goto
B2 + B3: Offset vom PC
C
MAR
MDR
MBR
PC
LV
CPP
SP
TOS
H
A
FHDW
ALU
read,
write,
fetch
MPC
512  32 Bit
Steuerspeicher
B
Addr J ALU C M B
MIR
2
*
Decode
1
Z
Vom HW-Automaten zum Prozessor
22
Micro-Implementierung
MAR = SP = SP - 1; rd
H = TOS
MDR = TOS = MDR + H; wr; goto Main
B1: add
H = LV
MAR = MBR + H; rd
MAR = SP = SP + 1
PC = PC + 1; fetch; wr
TOS = MDR; goto Main
B1: load
B2: Index
B1: goto
B2 + B3: Offset vom PC
Main: PC = PC + 1; fetch; goto (MBR)
FHDW
MDR = PC - 1
PC = PC + 1; fetch
H = MBR << 8
H = MBR or H
PC = MDR + H; fetch
wait; goto Main
Vom HW-Automaten zum Prozessor
23
Herunterladen