Professional Documents
Culture Documents
Multicycle Approach Part 2
Multicycle Approach Part 2
Multicycle Approach Part 2
2
Processor Design Control for
Multi Cycle
Outline of this lecture
› Break instructions into cycles
› Put cycle sequence together
› Control Signal groups and micro operations
› Control states and signal values
› Control State transitions
Multi Cycle Datapath
2
S
PC + 4 (28-31)
0
2
rs 21-25
rdad1 A
1 1
PC 0 IR
rt 16-20
rdad2
rddata1
ALU
adrs
1 B 3
rddata 0 rddata2 0
write
wrdata RES
rd 11-15 4 2
1 wrdata RF
MEM 1
00-15 0
DR
X
S
2
S
0
1
Break Instruction Execution into Cycles: R-Class
instructions
IR = Mem[PC]
Cycle 1
PC = PC + 4
A =RF[IR[25-21]
Cycle 2
B =RF[IR[20-16]
Cycle 3 Op depends
Res = A op B upon IR 5-0
A =RF[IR[25-21]
Cycle 2 B =RF[IR[20-16]
Cycle 4 MEM[Res] = B
Break Instruction Execution into Cycles: lw
instructions
IR = Mem[PC]
Cycle 1
PC = PC + 4
Cycle 2 A =RF[IR[25-21]
Cycle 4 DR = MEM[Res]
Cycle 5 RF[IR[20-16]] = DR
Break Instruction Execution into Cycles: beq
instructions
IR = Mem[PC]
Cycle 1
PC = PC + 4
A =RF[IR[25-21]
Cycle 2 B = RF[IR[20-16]
Res = PC + s2(sx(IR[15-11]))
2
S
4
PC + 4 (28-31)
+
00-25 t+
max
tI
PC ad inst
IM
Recall… Clock Period in Multi Cycle Design
Clock Period
tI tR tA tR
R-Class
Lw tI tR tA tM tR
Sw tI tR tA tM
Beq tI tR tA
t+ t+
tI t+
j t+
tI
Put Cycle Sequence together
R-Class sw lw beq j
A =RF[IR[25-21]
A =RF[IR[25-21] A =RF[IR[25-21] A =RF[IR[25-21] B = RF[IR[20-16] PC = PC[31-
B =RF[IR[20-16] A =RF[IR[25-21] Res = PC + s2(sx(IR[15-11])) 28] ||
s2(IR[25-0])
Res = A + sx(IR [15-0]
R-Class sw lw beq j
A =RF[IR[25-21]
A =RF[IR[25-21] A =RF[IR[25-21] A =RF[IR[25-21] B = RF[IR[20-16] PC = PC[31-
B =RF[IR[20-16] B =RF[IR[20-16] Res = PC + s2(sx(IR[15-11])) 28] ||
s2(IR[25-0])
Res = A + sx(IR [15-0]
A =RF[IR[25-21]
B = RF[IR[20-16]
Res = PC + s2(sx(IR[15-11]))
R-Class sw lw beq j
DR = MEM[Res]
RF[IR[5-11]] = Res MEM[Res] = B
RF[IR[20-16]] = DR
lw, sw can split after third cycle
IR = Mem[PC]
PC = PC + 4
A =RF[IR[25-21]
B = RF[IR[20-16]
Res = PC + s2(sx(IR[15-11]))
RF[IR[20-16]] = DR
Control Signal in Multicycle DP
2
S
PC + 4 (28-31)
RW ASrc1
PW Z
IorD MR MW AW 0
2
rs 21-25
rdad1 A ReW
1 1
PC 0 IR
rt 16-20
rdad2
rddata1
ALU
adrs
1 B 3
rddata 0 rddata2 0
write
wrdata RES
rd 11-15 4 2
1 wrdata RF BW PSrc
DM 1
Rdst OP
IW 00-15 0
DR
X
S
2
S
0 ASrc2
DW 1
M2R
Micro operations and control Signals – PC Group
Micro operation PWu PWc PSrc
PC = PC + 4 1
PCinc X 0
If (A==B) PC = Res 0
branch 1 0
default nop0 0 X
PW = PWu + Z . PWc
Micro operations and control Signals – Mem Group
Micro operation MW MR IorD IW DW
IR = Mem[PC] 0
fetch 1 0 1 0
Dr = Mem[Res] 0
m_rd 1 1 0 1
Mem[Res] = B m_wr1 0 1 0 0
default nop0 0 X 0 0
Micro operations and control Signals – RF Group
Micro operation MW MR IorD IW DW
A = RF[IR[25-21]] 0
rs2A X X 1 0
B = RF[IR[20-16]] 0
rt2B X X 1 0
RF[IR[15-11]]=Res 0
res2rd X X 0 1
RF[IR[20-16]]= DR 1
mem2rt 1 0 0 0
default nop0 X X 0 0
Micro operations and control Signals – ALU Group
Micro operation opc Asrc1 Asrc2 ReW
PC = PC + 4 0
PCinc 0 1 0
Res = A op B 2
arith 1 0 1
Res = A + sx(IR[15-0]) 0
Maddr 1 2 1
If (A == B) PC = Res branch
1 1 0 0
default nopX X X 0
Control states and micro operations
cs0
Fetch
PCinc
rs2A
cs1 rt2B
Paddr
R-Class sw/lw beq j
cs4
cs8 cs9
sw lw
cs3 res2rd m_wr m_rd cs6
cs5
mem2rt cs7
Control states and Signals values
PC grp Memgrp RF grp ALUgrp
cs2 cs3 x x x x
cs3 cs0 x x x x
cs5 x cs0 x x x
cs6 x x cs7 x x
cs7 x x cs0 x x
cs8 x x x cs0 x
cs9 x x x x cs0
Summary
› Instructions expressed as sequence of micro operations
› Control signals and grouped
› Micro operations define values of control signals of a group
› Control states associated with micro operations
› Control states transitions depend upon opcode