Upload
aegidius-eberts
View
102
Download
0
Embed Size (px)
Citation preview
Vom HW-Automaten zum Prozessor
Technische Grundlagen der Informatik
Prof. Dr. Michael Löwe(Grundlage: Tanenbaum/Goodman. Computerarchitektur. 1999.)
FHDW Vom HW-Automaten zum Prozessor
2
Inhalt
Hardware-AutomatenSpeicherorganisationProzessoren und SpeicherDatenwegMicro ControllerInstruction Set ArchitectureInstruction Set Architecture Implementation
FHDW Vom HW-Automaten zum Prozessor
3
Hardware-Automaten
Logische Funktion (m+n Bit k+n Bit)Logische Funktion (m+n Bit k+n Bit)
Input(m Bit)
Input(m Bit)
Register (n Bit)Register (n Bit)
Clk
Register (k Bit)Register (k Bit)
Output(k Bit)
Output(k Bit)
LastState
LastState
Next State (n Bit)
FHDW Vom HW-Automaten zum Prozessor
4
Hardware-Automaten: Beispiele
• Ampel
• Bedieneinheit Videorecorder
• Geldautomat
• ..... ?
FHDW Vom HW-Automaten zum Prozessor
5
Hardware-Automaten
Inpu
t(m
Bit
)
Inpu
t(m
Bit
)
Register (n Bit)Register (n Bit)
Clk
Register (k Bit)Register (k Bit)
Output(k Bit)
Output(k Bit)
Las
tS
tate
Las
tS
tate
Next State (n Bit)
Logische Funktion (m+n Bit k+n Bit)
-----------------------------------Speicherbaustein mit
m+n Bit breitem Adressbusk+n Bit breitem Datenbus
Logische Funktion (m+n Bit k+n Bit)
-----------------------------------Speicherbaustein mit
m+n Bit breitem Adressbusk+n Bit breitem Datenbus
Adr
essb
usA
dres
sbus
DatenbusDatenbus
FHDW Vom HW-Automaten zum Prozessor
6
Register
QD
Clk
QD
Clk
QD
Clk
QD
Clk
D1 D2 D3 D4
Q1 Q2 Q3 Q4Clk
FHDW Vom HW-Automaten zum Prozessor
7
Speicherorganisation
QD
Clk
QD
Clk
QD
Clk
QD
Clk
Dekodierer/Multiplexer
IN
Out
A0
A1
WRCS
( Tri-State: IN = Out )
OE
FHDW Vom HW-Automaten zum Prozessor
8
Speicherbausteine
41 Bit
A0
A1
WR CS OE
D
161 Bit
A0
A1
WR CS OE
D
A2
A3
164 Bit
A0
A1
WR CS OE
D0
A2
A3
D1
D2
D3
FHDW Vom HW-Automaten zum Prozessor
9
Speicher aus Bausteinen
Verfügbar: 16 × 4 Bit
Nachgefragt:
• 32 × 4 Bit
• 16 × 8 Bit ?164 Bit
A0
A1
WR CS OE
D0
A2
A3
D1
D2
D3
FHDW Vom HW-Automaten zum Prozessor
10
Speicher aus Bausteinen
164 Bit
A0A1
WR CS OE
D0
A2A3
D1D2D3
164 Bit
A0A1
WR CS OE
D0
A2A3
D1D2D3
DatenBusD0D1D2D3
AdressBusA1A2A3A4
A0
WROE
Schaltungfür
32 4 Bit
FHDW Vom HW-Automaten zum Prozessor
11
Speicher aus Bausteinen
164 Bit
A0A1
WR CS OE
D0
A2A3
D1D2D3
164 Bit
A0A1
WR CS OE
D0
A2A3
D1D2D3
DatenBusD0D1D2D3D4D5D6D7
AdressBus
A0
WR
OE
A1A2A3
CS
Schaltungfür
16 8 Bit
FHDW Vom HW-Automaten zum Prozessor
12
Speicherbausteine
Random Access Memory (RAM)Statische RAMs (SRAM)Dynamische RAMs (DRAM)
Read-Only-Memory (ROM)Vorfabrizierte ROMsProgrammable ROM (PROM)Erasable PROM (EPROM)
Hybride SpeicherbausteineElectrically EPROMs (EEPROM)Flash Memory
FHDW Vom HW-Automaten zum Prozessor
13
Prozessor und Speicher
ProzessorProzessor
Dat
enbu
s
Adr
essb
us
Speicher
Programm
Konstanten
Variablen-Stack
Operanden-Stack
FHDW Vom HW-Automaten zum Prozessor
14
Der DatenwegTypische ALU-Funktionen:C = A + BC = A BC = AC = BC = B + 1C = ShiftLeft(A, 8 Bit)C = -A...
MARMAR
MDRMDR
MBRMBR
PCPC
LVLV
CPPCPP
SPSP
HH
ALUALU
B
A
C
Z
Zum undvom
Speicher
TOSTOS
FHDW Vom HW-Automaten zum Prozessor
15
Micro Controller: ÜbersichtMARMAR
MDRMDR
MBRMBR
PCPC
LVLV
CPPCPP
SPSP
TOSTOS
ALUALU
C
512 32 BitSteuerspeicher
512 32 BitSteuerspeicher
AddrAddr JJ ALUALU CC MM BB
9 2 7 8 3 3
Decode
MPC
B
HHA
2*
read,write,fetch
ZZ1
MIR
FHDW Vom HW-Automaten zum Prozessor
16
Micro InstructionMARMAR
MDRMDR
MBRMBR
PCPC
LVLV
CPPCPP
SPSP
TOSTOS
ALUALU
C
512 32 BitSteuerspeicher
512 32 BitSteuerspeicher
AddrAddr JJ ALUALU CC MM BB
9 2 7 8 3 3
Decode
MPC
B
HHA
2*
read,write,fetch
ZZ1
MIR
AddrAddr JJ ALUALU CC MM BB
9 2 7 8 3 3
Auswahl Register für B-Bus (dekodiert)als zweites Argument für die ALU
Auswahl (mehrerer) Register für C-Bus zur Übernahme des ALU-ResultatsAuswahl der ALU-Operation
Adresse der nächsten auszu-führenden Micro Instruction
Micro-GOTO bedingt und unbedingt
Speichersteuerung(read | write); fetch
FHDW Vom HW-Automaten zum Prozessor
17
Micro Controller: AblaufsteuerungMARMAR
MDRMDR
MBRMBR
PCPC
LVLV
CPPCPP
SPSP
TOSTOS
ALUALU
C
512 32 BitSteuerspeicher
512 32 BitSteuerspeicher
AddrAddr JJ ALUALU CC MM BB
9 2 7 8 3 3
Decode
MPC
B
HHA
2*
read,write,fetch
ZZ1
MIR
1. Laden der nächsten Micro-Instruktion Adresse in MPC
2. Ausbreiten der Signale bis zum B-Bus
3. Ausbreiten der Signale bis zum C-Bus
4. Speichern der Ergebnisse
5. MPC für neuen Zyklus laden
FHDW Vom HW-Automaten zum Prozessor
18
Micro ProgrammeMARMAR
MDRMDR
MBRMBR
PCPC
LVLV
CPPCPP
SPSP
TOSTOS
ALUALU
C
512 32 BitSteuerspeicher
512 32 BitSteuerspeicher
AddrAddr JJ ALUALU CC MM BB
9 2 7 8 3 3
Decode
MPC
B
HHA
2*
read,write,fetch
ZZ1
MIR
Label: R1 =..... = R <op R‘> <;(rd|wr)> <;fetch> <;goto label <;label‘>>
Beispiele:H = MDRH = H + SPH = MBR << 8SP = H or MDR; fetchTOS = MDR; goto Main
FHDW Vom HW-Automaten zum Prozessor
19
Prozessor und Speicher
ProzessorProzessorDat
enbu
s
Adr
essb
us
Speicher
Maschinen Programm
Konstanten
Variablen-Stack
Operanden-Stack
PC (random)
CPP (bottom)
LV (bottom of top)
SP (top)
Adr 0
Adr 65.123.....
FHDW Vom HW-Automaten zum Prozessor
20
Programme und Maschinenprogramme
MaschinenprogrammMaschinenprogramm
C++Programm
C++Programm
PascalProgramm
PascalProgramm
VB6Programm
VB6Programm
C++ CompilerC++ Compiler Pascal CompilerPascal Compiler VB6 CompilerVB6 Compiler
Mikro-programm
Mikro-programm Prozessor Prozessor
SpeicherzustandSpeicherzustand
HW
SW
steuert
inte
rpre
tiert
FHDW Vom HW-Automaten zum Prozessor
21
Typische Instruktionen
Dyadische Operatoren: add, sub, or, ...
Speicherbefehle: store, load (from/on stack)
Sprünge: goto, goto on zero, ...
Prozeduraufruf: call, return
Byte1: Opcode
Byte1: Opcode Byte2 + Byte3:Variable Index
Byte1: Opcode Byte2 + Byte3: Offset vom PC
FHDW Vom HW-Automaten zum Prozessor
22
Micro-ImplementierungB1: add
B1: load B2: Index
B1: goto B2 + B3: Offset vom PC
Main: PC = PC + 1; fetch; goto (MBR)
MARMAR
MDRMDR
MBRMBR
PCPC
LVLV
CPPCPP
SPSP
TOSTOS
ALUALU
C
512 32 BitSteuerspeicher
512 32 BitSteuerspeicher
AddrAddr JJ ALUALU CC MM BB
Decode
MPC
B
HHA
2*
read,write,fetch
ZZ1
MIR
FHDW Vom HW-Automaten zum Prozessor
23
Micro-ImplementierungB1: add
B1: load B2: Index
B1: goto B2 + B3: Offset vom PC
MAR = SP = SP - 1; rdH = TOSMDR = TOS = MDR + H; wr; goto Main
H = LVMAR = MBR + H; rdMAR = SP = SP + 1PC = PC + 1; fetch; wrTOS = MDR; goto Main
MDR = PC - 1PC = PC + 1; fetchH = MBR << 8H = MBR or HPC = MDR + H; fetchwait; goto Main
Main: PC = PC + 1; fetch; goto (MBR)