Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Esecuzione diretta
(hardware)
Livello 0 Logica digitale
Architettura degli elaboratori
Livelli di astrazione
Livello 1 Microarchitettura
-5-
Procedura passo-passo per il progetto di
un processore
1. L’instruction set fornisce i requisiti per il datapath
2. Scegliere i componenti del datapath
e la metodologia di temporizzazione (clocking)
3. Progettare il datapath in modo da soddisfare i requisiti
4. Analizzare il datapath per identificare i controlli che determinano il
trasferimento tra registri.
5. Progettare la logica di controllo (Control Unit)
-6-
Procedura passo-passo per il progetto di
un processore
1. L’instruction set fornisce i requisiti per il datapath
Semantica delle istruzioni = cosa fanno.
Es. una data istruzione opera sui registri facendo:
R[a] <– R[b] + R[c];
Il datapath deve essere in grado di realizzare ciascuna istruzione
Prendiamo come esempio un Instruction Set reale: il MIPS
vediamo brevemente le sue caratteristiche
-7-
Il formato delle istruzioni MIPS
Tutte le istruzioni sono lunghe 32 bit. Tre formati:
31 26 25 21 20 16 15 11 10 6 5 0
R-type op rs rt rd shamt funct
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
31 26 25 21 20 16 15 0
I-type op rs rt address / immediate
6 bits 5 bits 5 bits 16 bits
31 26 25 0
J-type op target address
6 bits 26 bits
op: codice operativo (quale operazione esegue l’istruzione)
rs, rt, rd: indicano registri degli operandi e del risultato
shamt: shift amount: di quanto shiftare (a dx o sx) il risultato
funct: indica varianti dell’operazione indicata da op
address / immediate: indirizzo (spiazzamento) o valore immediato
target address: indirizzo destinazione di un’istruzione di salto
-8-
Un sottoinsieme delle istruzioni MIPS
oppure: address
-9-
Instruction fetch
R-type
31 26 25 21 20 16 15 11 10 6 5 0
op rs rt rd shamt funct
6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
I-type
31 26 25 21 20 16 15 0
op rs rt address / immediate MEM[PC]
6 bits 5 bits 5 bits 16 bits
J-type
31 26 25 0
op target address
6 bits 26 bits
- 10 -
Semantica delle istruzioni
espressa con «RTL» (Register Transfer Logic)
Istruzione Effetto su registri e memoria Effetto su PC
addu R[rd] ← R[rs] + R[rt] PC ← PC + 4
subu R[rd] ← R[rs] – R[rt] PC ← PC + 4
ori R[rt]
← PC ← PC + 4
R[rs] OR zero_ext(imm16)
lw R[rt] Aggiungere 2
zeri nelle
← PC ← PC + 4 posizioni meno
MEM[R[rs] + sign_ext(imm16)] significative
=
sw MEM[R[rs] + sign_ext(imm16)] moltiplicare x 4.
← PC ← PC + 4 Serve per
indirizzare
R[rt] parole da 32 bit.
beq if(R[rs]==R[rt])
then PC ← PC + 4 +
sign_ext(imm16)||00
else PC ← PC + 4
- 11 -
Sign-extension Vs zero extension
(reminder)
In binario In complemento a 2
Su 4 bit: Su 4 bit,
1101 per i positivi: 0101
denota tredici; denota cinque;
allora su 8 bit allora su 8 bit: 00000101
00001101 denota ancora cinque
denota ancora tredici per i negativi: 1101
(banale) denota meno tre;
allora su 8 bit: 11111101
denota ancora meno tre
- 13 -
Requisiti per l’esecuzione delle istruzioni
Quali blocchi funzionali useremo
Due banchi di memoria distinti
Istruzioni (sola lettura – un solo bus)
Dati (lettura e scrittura – un bus per direzione)
Un register Bank (32x32) per i 32 «user registers»
Due bus di lettura
Un bus di scrittura
Un Program Counter (PC): registro separato (su 30 bit, vedremo)
Blocchi funzionali combinatori:
sommatori, estensori (con scelta fra «in segno» e «con zeri»),
mutex, moltiplicatori di 1 bit …
ALU
due ingressi a 32 bit, e una uscita a 32 bit
in input, anche il codice di operazione
in output, anche i bit di esito (es: uguaglianza)
- 14 -
Requisiti per l’esecuzione delle istruzioni
Memorie
Istruzioni
Dati
Due separate, perché dobbiamo leggere l’istruzione da eseguire e,
nello stesso ciclo di clock, leggere o scrivere dati !
Nota: dalla memoria di istruzioni, non si scrive mai, si legge e basta
(e sempre all’indirizzo indicato dal PC)
Rd/Wr
32
Instruction
Address
Memory
32 32 Data Memory
Instruction
Instruction 32 32
Address
Data In Data Out
- 15 -
Requisiti per l’esecuzione delle istruzioni
Register File
• Register File: 32
32 registri da 32 bit WrEnable Write
5 Data Out A Bus A
Due bus di uscita RA
5
BusA e BusB RB
5
Un bus di input RW 32
BusW Data Out B Bus B
32
Bus W Data In
Ingressi: Clock
Indici RA e RB selezionano i registri da riversare su BusA e BusB
Indice RW seleziona il registro in cui verranno scritti i dati
provenienti da BusW quando Write è 1
Clock: significativo solo in scrittura. In lettura il circuito si comporta
in modo combinatorio: su BusA e BusB ci sono sempre i valori
contenuti nei registri indicati da RA e RB
- 16 -
Requisiti per l’esecuzione delle istruzioni
Program Counter:
un registro speciale in più, separato
E’ preposto ad un unico scopo:
PC
memorizzare l’indice dell’istruzione
corrente (in memoria istruzioni).
Il ciclo delle istruzioni comincia dal
fetch: cioè quando 32 32
il PC assume il valore della prossima Data Data
istruzione, e viene usato per leggerla In PC Out
(nota: la semantica di ogni istruzione
specifica cosa succede al PC
nella prossima istruzione –
di solito, aumenta di 4 unità) Clock
- 17 -
Requisiti per l’esecuzione delle istruzioni
Extender
Ext Zero
Ext Sign
16 32 16 32 16 32
se 0: con zero
EXTENDER se 1: in segno
- 18 -
Requisiti per l’esecuzione delle istruzioni
0 : con zero
1: in segno
- 19 -
Requisiti per l’esecuzione delle istruzioni
Uguale?
32
A
32
ALU
ALU 32
Result
B
7
Codice
operaz.
- 20 -
Requisiti per l’esecuzione delle istruzioni
32
PC
32
Adder
PC+B + Carryin
32
B
CarryIn (0 o 1)
- 21 -
Requisiti per l’esecuzione delle istruzioni
- 22 -
Altri blocchi funzionali (combinatori)
del datapath
MUX:
necessari in tutti i casi in cui è necessario fare delle scelte
Tipicamente, pilotati da segnali di controllo provenienti
dalla Control Unit
Istruzione corrente
op … voglio A
oppure B?
(dato che devo
Control fare op)
Unit
n
possibilità A n
n MUX A oppure B
possibilità B
- 25 -
Altri blocchi funzionali (combinatori)
del datapath
MUX:
necessari in tutti i casi è in cui è necessario fare delle scelte
Nota:
è del tutto ininfluente cosa entra dai cavi della possibilità NON scelta
possiamo comodamente disinteressarcene
(nei disegni che seguono, verranno a volte mostrati in grigio chiaro)
scegli
A
n
possibilità A n
n MUX A
possibilità B
(inutilizzato)
- 26 -
Altri blocchi funzionali (combinatori)
del datapath
Istruzione
corrente
op rs rt rd shamt funct
5 5
RW
MUX
32 32
5 Bus B
Bus W
Clock
- 28 -
Temporizzazione: scelte
- 32 -
Quadro Complessivo a più alto livello
32 Instruction 32
istruzione corrente Memory
Op
Funct
Control Unit
C O M A N D I
Immediate
indirizzi
registri
DataPath
PC
- 33 -
Passo 3
Fetch Istruzione
Decodifica istruzioni e lettura operandi
Esecuzione dell’operazione
Scrittura del risultato
Control Unit
Next
address
32 Cod.op.: Zero o uno
logic (dice se è un (condizione
branch) di salto)
Imm Op
16 6
Code
PC Datapath
32 memory 32 instruction
Clock
- 35 -
Datapath: partenza!
- 36 -
Somma e sottrazione (ADDU, SUBU)
addu rd, rs, rt R[rd] ← R[rs] op R[rt]
31 26 21 16 11 6 0
op rs rt rd shamt funct
(6+6)
12
Abilita
scrittura Unità di
Controllo
Rd Rs Rt
RegWr 5 ALUctr
5 5
32 7
busA Specifica di
Rw Ra Rb eseguire add o
busW
Result
ALU
32x32-bit sub, a seconda di
32 Registers busB
32 32 funct
Clk
Rosso: da Istruz.
Blu: da U.C.
- 37 - Verde: da/per ALU
Operazioni logiche con operando immediato
31 26 21 16 0
op rs rt immediate
6 bits 5 bits 5 bits 16 bits
- 38 -
Prossima operazione da aggiungere:
OR logico con operando immediato
R[rt] = R[rs] OR ZeroExt[imm16]
Datapath fin’ora:
Rd Rs Rt
RegWr 5 5 ALUctr
5 7
busA
Rw Ra Rb
busW 32 Result
32 32-bit
ALU
32 Registers 32
Clk busB
32
Rosso: da Istruz.
Blu: da U.C.
- 39 -
Operazioni logiche con operando immediato
Specifica di Rd Rt
Specifica di
selezionare rt
RegDst eseguire OR
Mux
Rs Rt
RegWr 5 ALUctr
Specifica di 5 5 7
scrivere in Rw busA
Rw Ra Rb
busW 32 Result
32 32-bit
ALU
32 Registers 32
Clk busB
32
Mux
imm16
16 ZeroExt 32
ALUSrc
Specifica di
Rosso: da Istruz. Verde: usato selezionare ingresso
Blu: da U.C. Grigio: non usato immediato esteso
- 40 -
Load (caricamento da memoria)
31 26 21 16 0
op rs rt immediate
6 bits 5 bits 5 bits 16 bits
- 41 -
Prossimo comando da aggiungere: LOAD
R[rt] ← Mem[R[rs] + SignExt[imm16]]
ALU
32x32
32
Registers busB 32
Clk
Mux
WrEn Address
Zero Ext
32
16
imm16 Data
Clk Memory
ALUSrc
- 42 -
Load Word Rosso: da Istruz.
Blu: da U.C.
(caricamento da memoria)
Verde: usato
selezionare Grigio: non usato
0:
Rt «non scrivere»
Rd Rt Carico il dato
MemWr Immette su
RegDst da mem a RT
Mux BusW il valore
Rs
SUM letto da mem
1: scrivere RegWr 5 ALUctr
5 5
7
in Rw busA 32
MemToReg
Rw Ra Rb
busW 32
ALU
32x32
32
Registers busB 32
Clk
Mux
Mux
Extender
32 WrEn Address
16 32
imm16 Data
Clk Memory
ALUSrc
31 26 21 16 0
op rs rt immediate
6 bits 5 bits 5 bits 16 bits
- 44 -
Prossimo comando: STORE
Mem[ R[rs] + SignExt[imm16] ] <- R[rt]
Situazione precedente… Rosso: da Istruz.
Blu: da U.C.
Rd Rt
MemWr
RegDst Mux
Rs Rt ALUctr
RegWr 5 5 5 3
busA 32 MemToReg
Rw Ra Rb
busW 32 32
ALU
32x32
Registers busB 32
Clk
Mux
Mux
Extender
32 WrEn Address
16 32
imm16 In Data Out
Clk Memory
ExtOp ALUSrc
- 45 -
Datapath per istruzione Store
1 Rosso: da Istruz.
“scrivo” Blu: da U.C.
Rd Rt
SUM MemWr
RegDst Mux
Rs Rt ALUctr
RegWr 5 5 5 3
0
busA 32 MemToReg
Rw Ra Rb
busW 32 32
ALU
32x32
Registers busB 32
Clk
Mux
Mux
Extender
32 WrEn Address
16 32
imm16 In Data Out
Clk Memory
ExtOp ALUSrc
sign imm
- 46 -
Istruzione di salto condizionato (branch)
Spiazzamento in parole,
indirizzo in byte
31 26 21 16 0
op rs rt immediate
6 bits 5 bits 5 bits 16 bits
- 48 -
Gestione del PC
30
Clk
Prossimo PC PC
(in words): 30
quello precedente
+1 + X. 30
(se non c’è salto,
X = 0) 1 CIn SUM
30
X
Architettura degli elaboratori - Luigi Lavazza - 49 - Porte logiche
Prossima op: BEQ
if (R[rs] == R[rt]) then PC = PC+4+SignExt(imm16)x4
Out instruction
32 Rosso: da Istruz.
Instruction
Memory Blu: da CU
Rd Rt ALUctr
Adr
MemWr
32 7
RegDst Mux
00 RegWr Rs
30
5 5 5
Clk busA MemToReg
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 Extender WrEn Adr
16 32
0…0 32 Data Out
imm16 In
Clk Memory
ExtOp ALUSrc
- 50 -
Prossima op: BEQ
if (R[rs] == R[rt]) then PC = PC+4+SignExt(imm16)x4
Out Instruction [31:0]
32 alla CU
Instruction
Memory ALUctr
Rt
Adr Rd
MemWr
32 7
RegDst Mux
00 RegWr Rs
30
5 5 5
Clk busA MemToReg
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 32 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk
Memory
- 51 -
Il DATAPATH: quadro complessivo
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 32 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
- 52 -
Procedura passo-passo per il progetto di
un processore
1. L’instruction set fornisce i requisiti per il datapath
2. Scegliere i componenti del datapath e la metodologia di
temporizzazione (clocking)
3. Progettare il datapath in modo da soddisfare i requisiti
4. Analizzare il datapath
per identificare tutti i controlli che determinano il datapath.
5. Progettare la logica di controllo
- 54 -
Dal Datapath all’Unità di Controllo
Instruction[31:0]
Instruction
[21:25]
[16:20]
[11:15]
[0:15]
[26:31]
[0:5]
Memory
Op Fun Rs Rt Rd Imm16
Op
Funct
Control Unit
nPC_sel RegWr RegDst ExtOp ALUSrc ALUctr MemWr MemToReg
7
Rs Equal
Rt
Rd DataPath
Imm
- 55 -
Quadro Complessivo a più alto livello
32 Instruction 32
Memory
Op
Funct Control Unit
nPC_sel RegWr RegDst ExtOp ALUSrc ALUctr MemWr MemToReg
Rs Equal
Rt
Rd DataPath
Imm
PC
- 56 -
Quadro Complessivo a più alto livello
organizzazione in chip di un micropocessore
32 Instruction 32
Memory
CPU
Op Control Unit MemWr
Funct
RegWr ExtOp ALUctr
nPC_sel RegDst ALUSrc MemToReg
7
32
Rs Equal PC In WrEn
32
Rt
Rd
DataPath Out
32
Imm Adr
ALU Data
Memory
- 57 -
Quadro Complessivo a più alto livello:
note
La Control Unit (CU) è un circuito puramente combinatorio
Rs, Rt, Rd e Imm16 sono passati a datapath con un collegamento fisso
Op e Funct sono passati alla Control Unit con un collegamento fisso
La CU produce i controlli che guidano il datapath
La maggior parte di questi dipende solo da Op , ma:
In alcune Op, ALUctr dipende anche da Fun (in altre, Fun non ha effetto)
nPC_sel dipende anche da Equal (che torna dal DataPath)
A causa del formato variabile delle istruzioni MIPS, alcuni bit
dell’istruzione sono replicati in campi diversi contemporaneamente;
per es:
I bit di Rd sono anche la prima parte di Imm16,
I bit di Fun sono anche l’ultima parte di Imm16, etc
…ma i controlli mandati dalla CU fanno sempre in modo che i campi
senza senso (per es Rd in una istruzione di tipo I) non abbiano alcun
effetto (per es siano nella parte ignorata di un Mutex)
- 58 -
Il Microprocessore
- 59 -
Procedura passo-passo per il progetto di
un processore
1. L’instruction set fornisce i requisiti per il datapath
2. Scegliere i componenti del datapath e la metodologia di
temporizzazione (clocking)
3. Progettare il datapath in modo da soddisfare i requisiti
4. Analizzare il datapath per identificare i controlli che determinano il
trasferimento tra registri.
5. Progettare la logica di controllo
- 60 -
Segnali di controllo: ricapitolando
- 61 -
Definizione dei segnali di controllo
rt rd
- 62 -
I segnali di controllo
func 100000 100010 Don’t Care
op 000000 000000 001101 100011 101011 000100 000010
add sub ori lw sw beq jump
RegDst 1 1 0 0 x x x
ALUSrc 0 0 1 1 1 0 x
MemtoReg 0 0 0 1 x x x
RegWrite 1 1 1 1 0 0 0
MemWrite 0 0 0 0 1 0 0
nPCsel 0 0 0 0 0 1 0
Jump 0 0 0 0 0 0 1
ExtOp x x 0 1 1 x x
ALUctr[2:0] Add Sub Or Add Add Sub xxx
31 26 21 16 11 6 0
R-type op rs rt rd shamt funct add, sub
- 63 -
Un sottoinsieme delle istruzioni MIPS
Addr in parole,
indirizzo in byte
31 26 25 0
op addr
6 bits 26 bits
- 64 -
Specifica delle istruzioni in RTL
PC[31..28]
resta immutato
- 65 -
Cammino critico per l’istruzione load
R[rt] ← MEM[R[rs] + sign_ext(imm16)];
Out instruction
32
Instruction alla CU
Memory ALUctr
Rt
Adr Rd
MemWr
32 7
RegDst Mux
00 RegWr Rs
30 5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
- 66 -
Cammino critico per l’istruzione load
R[rt] ← MEM[R[rs] + sign_ext(imm16)]
Out instruction
32
Instruction alla CU
Memory
Rt SUM
ALUctr
Adr Rd
MemWr
32
0
1
RegDst Mux 7
Rs
30 00 1
RegWr
5 5 5
Clk busA 1
WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
0
nPC_sel sign
ExtOp 1
ALUSrc
- 67 -
Cammino critico per l’istruzione load
R[rt] ← MEM[R[rs] + sign_ext(imm16)];
Out instruction
32
Instruction alla CU
Memory ALUctr
Rt
Adr Rd
MemWr
32 7
RegDst Mux
00 RegWr Rs
30 5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
- 68 -
Cammino critico per l’istruzione load
R[rt] ← MEM[R[rs] + sign_ext(imm16)]
Out instruction
32
Instrucntion alla CU
Memory ALUctr
Rt
Adr Rd
MemWr
32 7
RegDst Mux
00 RegWr Rs
30 5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
- 69 -
Cammino critico per l’istruzione load
R[rt] ← MEM[R[rs] + sign_ext(imm16)]
Out instruction
32
Instrucntion alla CU
Memory ALUctr
Rt
Adr Rd
MemWr
32 7
RegDst Mux
00 RegWr Rs
30 5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
*CONTROL Clk Memory
UNIT
- 70 -
Cammino critico per l’istruzione load
R[rt] ← MEM[R[rs] + sign_ext(imm16)]
Out instruction
32
Instrucntion alla CU
Memory ALUctr
Rt
Adr Rd
MemWr
32 7
RegDst Mux
00 RegWr Rs
30 5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
start 30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 end Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
- 71 -
Caso pessimo: tempo di esecuzione dell’istruzione Load
Clk
Clk-to-Q
PC Old Value New Value
Instruction Memory Access Time
Rs, Rt, Rd,
Old Value New Value
Op, Func
Delay through Control Logic
ALUctr Old Value New Value
- 72 -
Caso pessimo: tempo di esecuzione dell’istruzione Load
Clk
Clk-to-Q
1. Il fronte di discesa
PC Old Value New Value del clock ordina
l’aggiornamento dei
Instruction Memory Access Time
Rs, Rt, Rd,
Old Value New Value registri
Op, Func
Delay through Control Logic
ALUctr Old Value New Value
- 73 -
Caso pessimo: tempo di esecuzione dell’istruzione Load
Clk
Clk-to-Q
PC Old Value New Value
Instruction Memory Access Time
Rs, Rt, Rd,
Old Value New Value
Op, Func
Delay through Control Logic
ALUctr Old Value New Value
MemtoReg
Inizia la decodifica
Old Value New Value Register
dell’istruzione Write Occurs
RegWr Old Value New Value
Register File Access Time
busA Old Value New Value
Delay through Extender & Mux
busB Old Value New Value
4. La UC genera i
ALU Delay
Address
segnali di controllo
Old Value New Value
Data Memory Access Time
busW Old Value New
- 74 -
Caso pessimo: tempo di esecuzione dell’istruzione Load
Clk
Clk-to-Q
PC Old Value New Value
Instruction Memory Access Time
Rs, Rt, Rd,
Old Value New Value
Op, Func
Delay through Control Logic
ALUctr Old Value New Value
- 76 -
Caso pessimo: tempo di esecuzione dell’istruzione Load
Clk
Clk-to-Q
PC Old Value New Value
Instruction Memory Access Time
Rs, Rt, Rd,
Op, Func
Old Value New Value 7. Il fronte di discesa ordina
l’aggiornamento
Delay dei registri.
through Control Logic
ALUctr Old Value New Value
Il valore presente su busW
ExtOp Old Value
viene scritto nel registro di
New Value
destinazione.
ALUSrc Old Value New Value
- 77 -
Caso pessimo: tempo di esecuzione dell’istruzione Load
Clk
Clk-to-Q
PC Old Value New Value
Instruction Memory Access Time
Rs, Rt, Rd,
Old Value New Value
Op, Func
Delay through Control Logic
ALUctr Old Value New Value
- 78 -
Cammino critico di Beq (Branch on Equal)
if (R[rs] == R[rt]) then PC = PC+4+SingExt(imm16)x4
Out instruction
32
Instrucntion alla CU
Memory COMPARE
Rt
Adr Rd
0
32 7
RegDst Mux
00 0 Rs
30
5 5 5
Clk busA MemToReg
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk
Memory
1o0 1 0
- 79 -
Cammino critico di Beq (Branch on Equal)
if (R[rs] == R[rt]) then PC = PC+4+SingExt(imm16)x4
Out instruction
32
Instrucntion alla CU
Memory CONTROL
ALUctr
Rt
Adr Rd UNIT
MemWr
32 7
RegDst Mux
start 00 RegWr Rs
30
5 5 5
Clk busA MemToReg
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
end Registers
CIn SUM Clk busB
1
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk
Memory
- 80 -
Cammino critico per l’istruzione StoreW
MEM[R[rs] + sign_ext(imm16)] ← R[rt]
Out instruction
32
Instrucntion alla CU
Memory
Rt SUM
ALUctr
Adr Rd
MemWr
32 7
1
RegDst Mux
Rs
30 00 0
RegWr
5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
0
nPC_sel sign
ExtOp 1
ALUSrc
- 81 -
Cammino critico per l’istruzione StoreW
MEM[R[rs] + sign_ext(imm16)] ← R[rt]
Out instruction
32
Instrucntion alla CU
Memory
Rt SUM
ALUctr
Adr Rd
MemWr
32 7
1
RegDst Mux
start 00 0
RegWr Rs
30 5 5 5
Clk busA WSrc
PC Rw Ra Rb =
busW 32 32 32
ALU
30 30 32x32
Registers busB
1 CIn SUM Clk
Mux
Mux
32
30 30 Extender WrEn Adr
16 32
imm16 32 In Data Out
* Clk Memory
end
0
nPC_sel sign
ExtOp 1
ALUSrc
- 82 -
Non si usano le implementazioni a ciclo singolo
- 83 -
Ricapitolando
5 passi di progetto del processore
Derivare i requisiti per il datapath dall’instruction set
Scegliere i componenti del datapath e la metodologia di
temporizzazione (clocking)
Progettare il datapath in modo da soddisfare i requisiti
Analizzare il datapath per identificare i controlli che determinano il
trasferimento tra registri
Progettare la logica di controllo
Il processore MIPS consente alcune semplificazioni
Tutte le istruzioni hanno la medesima dimensione (32 bit)
L’indicazione dei registri sorgenti ha sempre la stessa posizione
nell’istruzione
I valori immediati hanno la stessa dimensione e posizione
nell’istruzione
Le operazioni sono sempre su registri o valori immediati
Datapath a singolo ciclo => CPI=1, durata del clock lunga
- 84 -