Professional Documents
Culture Documents
ECE4680 Multipath.1
2002-3-31
:
Rt Rs 5 5 Rt
Rd RegDst
Rt Zero ALU
Rs
Rd
busW 32 Clk
MemWr
32 32 WrEn Adr
imm16 Instr<15:0>
16
Data Memory
ALUSrc ExtOp
ECE4680 Multipath.2 2002-3-31
Concepts
instruction
Control
signals
ECE4680 Multipath.3
2002-3-31
30 00 30 1 Mux 0
30 1
0 30 Mux 1 30
Jump
Instruction<31:0>
Branch
Zero
2002-3-31
..
op<5>
<0>
..
op<5>
<0>
..
op<5>
<0>
..
op<5>
<0>
..
op<5>
<0>
..
op<0>
R-type
ori
lw
sw
beq
jump
RegWrite ALUSrc RegDst MemtoReg MemWrite Branch Jump ExtOp ALUop<2> ALUop<1> ALUop<0>
ECE4680 Multipath.5
2002-3-31
Cycle time is much longer than needed for all other instructions. Examples: R-type instructions do not require data memory access Jump does not require ALU operation nor data memory access
ECE4680 Multipath.6
2002-3-31
ECE4680 Multipath.7
2002-3-31
Address
Data Memory
Reg Wr
Rs, Rt, Rd, Op, Func ALUctr ExtOp ALUSrc RegWr busA busB Address busW
ECE4680 Multipath.8
Delay through Control Logic New Value New Value New Value Register File Write Time New Value
2
Old Value Delay through Extender & Mux Old Value Old Value
3
New Value ALU Delay New Value
WrEn Adr
Ideal Memory
Din Dout 32
32
In real life for m-cycle machines: Neither register file nor ideal memory has the clock input The write path is a combinational logic delay path: - Write enable goes to 1 and Din settles down Memory write access delay Din is written into mem[address]
32
Clk
WrEn Adr
Ideal Memory
Din Dout 32
Important: Address and Data must be stable BEFORE Write Enable goes to 1
ECE4680 Multipath.9
32
2002-3-31
This real (no clock input) register file may not work reliably in the single cycle processor because: We cannot guarantee Rw will be stable BEFORE RegWr = 1 There is a race between Rw (address) and RegWr (write enable)
5 5 5 32
Ra RegWr Rb
Reg File 32
busB 32
busA
Rw busW
The real (no clock input) memory may not work reliably in the single cycle processor because: We cannot guarantee Address will be stable BEFORE WrEn = 1 There is a race between Adr and WrEn
32
WrEn Adr
Ideal Memory
Din Dout 32
32
ECE4680 Multipath.10
2002-3-31
ECE4680 Multipath.11
2002-3-31
MemWr
00
RAdr<1:0> <31:2>
Ideal Memory
WrAdr Din Dout 32
32
ECE4680 Multipath.12
2002-3-31
32
MemWr=?
RAdr
ALU
32
Clk
32
Ideal Memory
32 32 WrAdr Din Dout 32
32
Clk
ECE4680 Multipath.13 2002-3-31
PC
32
32
MemWr=0
RAdr
ALU
32
Clk
32
32
Ideal Memory
WrAdr Din Dout
32
32
32
Clk
ECE4680 Multipath.14 2002-3-31
PCWr=1
PCSrc=0 ALUSelA=0
1
BrWr=0 Target
Mux
32
PC
32 32 0
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
ECE4680 Multipath.15
Mux
1
RAdr
Ideal Memory
WrAdr 32 Din Dout
busA 32
32
busB 32
ALUSelB=00
Mux
32
PC Mux
1 32 32
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
ALU Control
6 6
Imm 16
ALUSelB=xx ALUOp=xx
2002-3-31
ECE4680 Multipath.16
PCSrc=x
1
BrWr=1
32
RegDst=x
RegWr=0
ALUSelA=0
Target
Mux
PC
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
32 32
Branch Completion
BrComplete
PCWr=0
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2 Control Op
Func 6 6 Imm 16
ALU Control
Extend
ALUSelB=10
32
ALUOp=Add
2002-3-31
ExtOp=1
PCSrc=1 ALUSelA=1
1
BrWr=0
32
RegDst=x
RegWr=0
Target
Mux
PC
0
Rs 32 Rt Rt 0 Rd 1 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
RAdr
32 32
ECE4680 Multipath.18
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Imm 16
ExtOp=x
2002-3-31
Mux
32
<< 2 Extend
ALU Control
ALUSelB=01
32
ALUOp=Sub
BrWr=1
32
Target
Mux
PC
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
32 32
ECE4680 Multipath.19
R-type Execution
ALU Output busA op busB
PCWr=0
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2 Control Op
Func 6 6 Imm 16
ALU Control
Extend
ALUSelB=10
32
ALUOp=Add
ExtOp=1
2002-3-31
RExec
PCSrc=x ALUSelA=1
1
BrWr=0 Target
RegDst=1
RegWr=0
Mux
32
PC
0
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
RAdr
32 32
ECE4680 Multipath.20
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=x
MemtoReg=x
ALUOp=Rtype ALUSelB=01
2002-3-31
R-type Completion
R[rd] <- ALU Output
Rfinish
PCWr=0
PCSrc=x ALUSelA=1
1
BrWr=0 Target
RegDst=1
RegWr=1
Mux
32
PC
0
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
RAdr
32 32
ECE4680 Multipath.21
IRWr=0
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
ECE4680 Multipath.22
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
0
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=x
MemtoReg=0
ALUOp=Rtype ALUSelB=01
2002-3-31
ALUselA Zero
32
Ra Rb Rw
busA 32
ALU
Reg File
0 1 2 3 32
Mux
32
busW busB 32
ALUselB
ECE4680 Multipath.23
2002-3-31
ALU
Mux
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
Zero
32
Instruction Reg
ECE4680 Multipath.24
Ra Rb Rw
busA 32
ALU
Reg File
0 1 2 3 32
Mux
32
busW busB 32
ALU Control
ALUselB
2002-3-31
Mux
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
Zero
32
Instruction Reg
ECE4680 Multipath.25
Ra Rb Rw
busA 32
ALU
Reg File
0 1 2 3 32
PCWr=0
Mux
32
busW busB 32
ALU Control
ALUselB
2002-3-31
BrWr=1
32
Target
Mux
PC
32 32 0
Rs 32 Rt Rt 0 Rd 1 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Intruction Reg
RAdr
32 32
ECE4680 Multipath.26
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2 Control Op
Func 6 6 Imm 16
ALU Control
Extend
ALUSelB=10
32
ALUOp=Add
ExtOp=1
2002-3-31
Ori Execution
ALU output busA or ZeroExt[Imm16]
PCWr=0
BrWr=0 Target
Mux
32
PC
32 32 0
Rs 32 Rt Rt 0 Rd 1 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
32 32
ECE4680 Multipath.27
Ori Completion
ALUOp=Or
Reg[rt]
PCWr=0
Mux
1 32 0
Ideal Memory
WrAdr 32 Din Dout
Reg File
1 Mux 0
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=0
MemtoReg=x
ALUOp=Or ALUSelB=11
2002-3-31
OriFinish
ALU output
PCSrc=x ALUSelA=1
1
BrWr=0 Target
RegDst=0
RegWr=1
Mux
32
PC Mux
1 32 32 32 32
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=0
ECE4680 Multipath.28
MemtoReg=0
ALUOp=Or ALUSelB=11
2002-3-31
PCWr=0
BrWr=1
32
Target
Mux
PC
0
0 32 0
Zero ALU
Mux
Instruction Reg
Mux
1 32 32
32 32
RAdr
Ideal Memory
WrAdr 32 Din Dout
Reg File
Rw
Mux
32 1 2 3 32
busW busB 32
<< 2 Control Op
Func 6 16 6 Imm
ALU Control
Extend
ALUSelB=10
32
:
ECE4680 Multipath.29
ALUOp=Add
2002-3-31
ExtOp=1
busA + SignExt[Imm16]
AdrCal
BrWr=0 Target
Mux
32
PC
32 32 0
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
32 32
ECE4680 Multipath.30
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=1
MemtoReg=x
ALUOp=Add ALUSelB=11
2002-3-31
busB
BrWr=0
1
RegDst=x
RegWr=0
ALUSelA=1
32
Target
Mux
PC
32 32 0
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
RAdr
32 32
Mux
1 32 0
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=1
MemtoReg=x
ALUOp=Add ALUSelB=11
2002-3-31
mem[ALU output]
BrWr=0 Target
Mux
32
PC
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
RAdr
32 32
ECE4680 Multipath.32
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=1
MemtoReg=x
ALUOp=Add ALUSelB=11
2002-3-31
Mem Dout
LWwr
PCSrc=x ALUSelA=1
1
BrWr=0 Target
RegDst=0
RegWr=1
Mux
32
PC
0
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
RAdr
32 32
ECE4680 Multipath.33
Mux
1 32 0
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ExtOp=1
MemtoReg=1
ALUOp=Add ALUSelB=11
2002-3-31
PCWr
BrWr Target
Mux
32
PC
Rs 32 Rt Rt 0 Rd 1 1 Mux 0 5 5
0 32 0 1 2 3 32
Zero ALU
Mux
Instruction Reg
32 32
RAdr
32 32
ECE4680 Multipath.34
Mux
1
Ideal Memory
WrAdr 32 Din Dout
Reg File
Mux
32
<< 2
ALU Control
Imm 16
Extend
32
ALUOp ALUSelB
2002-3-31
ExtOp
MemtoReg
Summary
Disadvantages of the Single Cycle Processor Long cycle time Cycle time is too long for all instructions except the Load Multiple Cycle Processor: Divide the instructions into smaller steps Execute each step (instead of the entire instruction) in one cycle Do NOT confuse Multiple Cycle Processor with Multiple Cycle Delay Path Multiple Cycle Processor executes each instruction in multiple clock cycles Multiple Cycle Delay Path: a combinational logic path between two storage elements that takes more than one clock cycle to complete It is possible (desirable) to build a MC Processor without MCDP: Use a register to save a signals value whenever a signal is generated in one clock cycle and used in another cycle later
ECE4680 Multipath.35
2002-3-31
Rfetch/Decode
ALUOp=Add 1: BrWr, ExtOp ALUSelB=10 x: RegDst, PCSrc IorD, MemtoReg Others: 0s
BrComplete
beq
lw or sw Rtype
1: ExtOp LWmem ALUSelA, IorD ALUSelB=11 ALUOp=Add lw x: MemtoReg PCSrc 1: ExtOp ALUSelA ALUSelB=11 ALUOp=Add x: MemtoReg PCSrc
Ori OriExec
ALUOp=Or 1: ALUSelA ALUSelB=11 x: MemtoReg IorD, PCSrc
AdrCal
sw LWwr
1: ALUSelA RegWr, ExtOp MemtoReg ALUSelB=11 ALUOp=Add x: PCSrc IorD 1: ExtOp SWMem ALUOp=Rtype MemWr ALUSelA 1: RegDst, RegWr ALUSelB=11 ALUselA ALUOp=Add ALUSelB=01 x: PCSrc,RegDst x: IorD, PCSrc MemtoReg ExtOp
Rfinish
OriFinish
ALUOp=Or x: IorD, PCSrc ALUSelB=11 1: ALUSelA RegWr
ECE4680 Multipath.36
2002-3-31
ECE4680 Multipath.37
2002-3-31