ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of...
-
Upload
morgan-goodwin -
Category
Documents
-
view
217 -
download
0
description
Transcript of ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of...
![Page 1: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/1.jpg)
ECE/CS 552: Data Path and ECE/CS 552: Data Path and ControlControl
Instructor:Mikko H Lipasti
Fall 2010University of Wisconsin-Madison
Lecture notes based on set created by Mark Hill.
![Page 2: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/2.jpg)
Processor ImplementationProcessor Implementation Forecast – heart of 552 – key to project
– Sequential logic design review (brief)– Clock methodology (FSD)– Datapath – 1 CPI
Single instruction, 2’s complement, unsigned
– Control– Multiple cycle implementation (information only)– Microprogramming– Exceptions
![Page 3: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/3.jpg)
Review Sequential LogicReview Sequential LogicLogic is combinational if output is solely
function of inputs– E.g. ALU of previous lecture
Logic is sequential or “has state” if output function of:– Past and current inputs– Past inputs remembered in “state”– Of course, no magic
![Page 4: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/4.jpg)
Review Sequential LogicReview Sequential Logic
Clock high, Q = D, ~Q = ~D after prop. Delay Clock low Q, ~Q remain unchanged
– Level-sensitive latch
![Page 5: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/5.jpg)
Review Sequential LogicReview Sequential Logic
E.g. Master/Slave D flip-flop– While clock high, QM follows D, but QS holds
– At falling edge QM propagates to QS
![Page 6: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/6.jpg)
Review Sequential LogicReview Sequential Logic
Can build:Why can this fail for a latch?
D FF +1
![Page 7: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/7.jpg)
Clocking MethologyClocking Methology Motivation
– Design data and control without considering clock– Use Fully Synchronous Design (FSD)
Just a convention to simplify design process Restricts design freedom Eliminates complexity, can guarantee timing correctness Not really feasible in real designs Even in 554 you will violate FSD
![Page 8: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/8.jpg)
Our MethodologyOur MethodologyOnly flip-flopsAll on the same edge (e.g. falling)All with same clock
– No need to draw clock signalsAll logic finishes in one cycle
FFs Logic FFsLogic
![Page 9: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/9.jpg)
Our Methodology, cont’dOur Methodology, cont’dNo clock gating!
– Book has bad examples
Correct design:
state
write AND clock
new current
statecurrent
new
write
01
![Page 10: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/10.jpg)
Delayed Clocks (Gating)Delayed Clocks (Gating)
Problem:– Some flip-flops receive gated clock late– Data signal may violate setup & hold req’t
Clock
Gated clock
X
D DDelay
Delay
Clock
X Y
Y
![Page 11: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/11.jpg)
FSD Clocking RulesFSD Clocking Rules
Tclock = cycle time Tsetup = FF setup time requirement Thold = FF hold time requirement TFF = FF combinational delay Tcomb = Combinational delay FSD Rules:
– Tclock > TFF + Tcombmax + Tsetup
– TFF + Tcombmin > Thold
ClockD D
Delay
Clock
Y
Y
![Page 12: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/12.jpg)
Datapath – 1 CPIDatapath – 1 CPIAssumption: get whole instruction done in
one long cycleInstructions:
– add, sub, and, or slt, lw, sw, & beqTo do
– For each instruction type– Putting it all together
![Page 13: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/13.jpg)
Fetch InstructionsFetch Instructions Fetch instruction,
then increment PC– Same for all types
Assumes– PC updated every
cycle– No branches or jumps
After this instruction fetch next one
![Page 14: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/14.jpg)
ALU InstructionsALU Instructions and $1, $2, $3 # $1 <= $2 & $3
E.g. MIPS R-formatOpcode rs rt rd shamt function6 5 5 5 5 6
![Page 15: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/15.jpg)
Load/Store InstructionsLoad/Store Instructions lw $1, immed($2) # $1 <= M[SE(immed)+$2] E.g. MIPS I-format:
Opcode rt rt immed6 5 5 16
![Page 16: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/16.jpg)
Branch InstructionsBranch Instructions beq $1, $2, addr # if ($1==$2) PC = PC + addr<<2 Actually
newPC = PC + 4target = newPC + addr << 2 # in MIPS offset from newPC
if (($1 - $2) == 0)PC = target
elsePC = newPC
![Page 17: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/17.jpg)
Branch InstructionsBranch Instructions
![Page 18: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/18.jpg)
All TogetherAll Together
![Page 19: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/19.jpg)
Register File?Register File?
![Page 20: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/20.jpg)
Control OverviewControl Overview Single-cycle implementation
– Datapath: combinational logic, I-mem, regs, D-mem, PC Last three written at end of cycle
– Need control – just combinational logic!– Inputs:
Instruction (I-mem out) Zero (for beq)
– Outputs: Control lines for muxes ALUop Write-enables
![Page 21: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/21.jpg)
Control OverviewControl OverviewFast control
– Divide up work on “need to know” basis– Logic with fewer inputs is faster
E.g.– Global control need not know which ALUop
![Page 22: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/22.jpg)
ALU ControlALU ControlAssume ALU uses
000 and001 or010 add110 sub111 slt (set less than)others don’t care
![Page 23: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/23.jpg)
ALU ControlALU Control
ALU-ctrl = f(opcode,function)
Instruction Operation Opcode Function
add add 000000 100000
sub sub 000000 100010
and and 000000 100100
or or 000000 100101
slt slt 000000 101010
![Page 24: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/24.jpg)
But…don’t forgetBut…don’t forget
To simplify ALU-ctrl– ALUop = f(opcode)
2 bits 6 bits
Instruction Operation Opcode functionlw add 100011 xxxxxxsw add 101011 xxxxxxbeq sub 000100 100010
![Page 25: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/25.jpg)
ALU ControlALU Control
ALU-ctrl = f(ALUop, function)3 bits 2 bits 6 bitsRequires only five gates plus inverters
10 add, sub, and, …00 lw, sw01 beq
![Page 26: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/26.jpg)
Control Signals NeededControl Signals Needed
![Page 27: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/27.jpg)
Global ControlGlobal Control R-format: opcode rs rt rd shamt
function6 5 5 5 56
I-format: opcode rs rt address/immediate6 5 5 16
J-format: opcode address6 26
![Page 28: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/28.jpg)
Global ControlGlobal ControlRoute instruction[25:21] as read reg1 specRoute instruction[20:16] are read reg2
specRoute instruction[20:16] (load) and and
instruction[15:11] (others) to– Write reg mux
Call instruction[31:26] op[5:0]
![Page 29: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/29.jpg)
Global ControlGlobal Control Global control outputs
– ALU-ctrl - see above– ALU src - R-format, beq vs. ld/st– MemRead - lw– MemWrite - sw– MemtoReg - lw– RegDst - lw dst in bits 20:16, not 15:11– RegWrite - all but beq and sw– PCSrc - beq taken
![Page 30: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/30.jpg)
Global ControlGlobal ControlGlobal control outputs
– Replace PCsrc withBranch beqPCSrc = Branch * Zero
What are the inputs needed to determine above global control signals?– Just Op[5:0]
![Page 31: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/31.jpg)
Global ControlGlobal Control
RegDst = ~Op[0] ALUSrc = Op[0] RegWrite = ~Op[3] * ~Op[2]
Instruction Opcode RegDst ALUSrcrrr 000000 1 0lw 100011 0 1sw 101011 x 1beq 000100 x 0??? others x x
![Page 32: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/32.jpg)
Global ControlGlobal ControlMore complex with entire MIPS ISA
– Need more systematic structure– Want to share gates between control signals
Common solution: PLA– MIPS opcode space designed to minimize
PLA inputs, minterms, and outputsRefer to MIPS Opcode map
![Page 33: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/33.jpg)
PLAPLA In AND-plane, &
selected inputs to get minterms
In OR-plane, | selected minterms to get outputs
E.g.
![Page 34: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/34.jpg)
Control Signals; Add JumpsControl Signals; Add Jumps
![Page 35: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/35.jpg)
Control Signals w/JumpsControl Signals w/Jumps
![Page 36: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/36.jpg)
What’s wrong with single cycle?What’s wrong with single cycle?
Critical path probably lw:– I-mem, reg-read, alu, d-mem, reg-write
Other instructions faster– E.g. rrr: skip d-mem
Instruction variation much worse for full ISA and real implementation:– FP divide– Cache misses (what the heck is this? – later)
Instructions Cycles Program Instruction
TimeCycle
(code size)
X X
(CPI) (cycle time)
![Page 37: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/37.jpg)
Single Cycle ImplementationSingle Cycle ImplementationSolution
– Variable clock?Too hard to control, design
– Fixed short clockVariable cycles per instruction
![Page 38: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/38.jpg)
Multi-cycle ImplementationMulti-cycle Implementation Clock cycle = max(i-mem,reg-read+reg-write,
ALU, d-mem) Reuse combinational logic on different cycles
– One memory– One ALU without other adders
But– Control is more complex– Need new registers to save values (e.g. IR)
Used again on later cycles Logic that computes signals is reused
![Page 39: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/39.jpg)
High-level Multi-cycle Data-High-level Multi-cycle Data-pathpath Note:
– Instruction register, memory data register– One memory with address bus– One ALU with ALUOut register
![Page 40: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/40.jpg)
Comment on bussesComment on bussesShare wires to reduce #signals
– Distributed multiplexorMultiple sources driving one bus
– Ensure only one is active!
![Page 41: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/41.jpg)
Multi-cycle Ctrl SignalsMulti-cycle Ctrl Signals
![Page 42: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/42.jpg)
Multi-cycle StepsMulti-cycle StepsStep Description Sample ActionsIF Fetch IR=MEM[PC]
PC=PC+4
ID Decode A=RF(IR[25:21])B=RF(IR[20:16])Target=PC+SE(IR[15:0] << 2)
EX Execute ALUout = A + SE(IR[15:0]) # lw/swALUout = A op B # rrrif (A==B) PC = target # beq
Mem Memory MEM[ALUout] = B # swMDR = MEM[ALUout] #lwRF(IR[15:11]) = ALUout # rrr
WB Writeback Reg(IR[20:16]) = MDR # lw
![Page 43: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/43.jpg)
Multi-cycle ControlMulti-cycle Control Function of Op[5:0] and current step Defined as Finite State Machine (FSM) or
– Micro-program or microcode
outputs
NextStateNext
State Fn
Output Fn
Current state
Inputs
![Page 44: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/44.jpg)
Finite State Machine (FSM)Finite State Machine (FSM)For each state, define:
– Control signals for datapath for this cycle– Control signals to determine next state
All instructions start in same IF stateInstructions terminate by making IF next
– After proper PC update, of course
![Page 45: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/45.jpg)
Multi-cycle ExampleMulti-cycle ExampleDatapath (Fig. 5.33 from book)
– Will walk and $1, $2, $3 through datapathLook at control FSM (Fig. 5.42 from
book)– Will walk and $1, $2, $3 through FSM
Will skip– Repeat for lw, sw, beq taken, beq n-t, j
![Page 46: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/46.jpg)
Multi-cycle Multi-cycle Example Example (and)(and)
PCWritePCSource = 10
ALUSrcA = 1ALUSrcB = 00ALUOp = 01PCWriteCondPCSource = 01
ALUSrcA = 1ALUSrcB = 00ALUOp = 10
MemReadIorD = 1
MemWriteIorD = 1
RegDst = 1RegWrite
MemtoReg = 0
RegDst = 0RegWrite
MemtoReg = 1
Start
MemReadALUSrcA=0
IorD = 0IRWrite
ALUSrcB = 01ALUOp = 00
PCWritePCSrc = 00
ALUSrcA = 0ALUSrcB = 11ALUOp = 00
ALUSrcA = 1ALUSrcB = 10ALUOp = 00
LW | SWRRR BEQ
J
LW SW
IF ID
EX
MEM
WB
WB
![Page 47: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/47.jpg)
Multi-cycle Example (and)Multi-cycle Example (and)
![Page 48: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/48.jpg)
Nuts and Bolts--More on FSMsNuts and Bolts--More on FSMs You will be using FSM control for parts of your
processor implementation There are multiple methods for specifying a state
machine– Moore machine (output is function of state only)– Mealy machine (output is function of state/input)
There are different methods of assigning states
![Page 49: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/49.jpg)
FSMs--State AssignmentFSMs--State AssignmentState assignment is converting logical states
to binary representation– Use ECE 352 methods to build real state machine
Is state assignment interesting/important?– Judicious choice of state representation can make
next state fcn/output fcn have fewer gates– Optimal solution is hard, but having intuition is
helpful (CAD tools can also help in practice)
![Page 50: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/50.jpg)
State Assignment--ExampleState Assignment--Example10 states in multicycle control FSM
– Each state can have 1 of 16 (2^4) encodings with “dense” state representation
– Any choice of encoding is fine functionally as long as all states are unique
Appendix C-26 example: RegWrite signal
![Page 51: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/51.jpg)
State Assignment,State Assignment,
RegWrite RegWrite Signal Signal
PCWritePCSource = 10
ALUSrcA = 1ALUSrcB = 00ALUOp = 01PCWriteCondPCSource = 01
ALUSrcA = 1ALUSrcB = 00ALUOp = 10
MemReadIorD = 1
MemWriteIorD = 1
RegDst = 1RegWrite
MemtoReg = 0
RegDst = 0RegWrite
MemtoReg = 1
Start
MemReadALUSrcA=0
IorD = 0IRWrite
ALUSrcB = 01ALUOp = 00
PCWritePCSrc = 00
ALUSrcA = 0ALUSrcB = 11ALUOp = 00
ALUSrcA = 1ALUSrcB = 10ALUOp = 00
LW | SWRRR BEQ
J
LW SW
IF ID
EX
MEM
WB
WB
State 0 State 1
State 2 State 6 State 8 State 9
State 3 State 5State 7 (0111b)
State 4 (0100b)
Original: 2 inverters, 2 and3s, 1 or2State 8 (1000b)
State 4 State 7
State 9 (1001b)
New: No gates--just bit 3!
![Page 52: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/52.jpg)
SummarySummaryProcessor implementation
– Datapath– Control
Single cycle implementationNext: microprogrammingRemaining slides for reference only
![Page 53: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/53.jpg)
Multi-cycle Multi-cycle Example Example (lw)(lw)
PCWritePCSource = 10
ALUSrcA = 1ALUSrcB = 00ALUOp = 01PCWriteCondPCSource = 01
ALUSrcA = 1ALUSrcB = 00ALUOp = 10
MemReadIorD = 1
MemWriteIorD = 1
RegDst = 1RegWrite
MemtoReg = 0
RegDst = 0RegWrite
MemtoReg = 1
Start
MemReadALUSrcA=0
IorD = 0IRWrite
ALUSrcB = 01ALUOp = 00
PCWritePCSrc = 00
ALUSrcA = 0ALUSrcB = 11ALUOp = 00
ALUSrcA = 1ALUSrcB = 10ALUOp = 00
LW | SWRRR BEQ
J
LW SW
IF ID
EX
MEM
WB
WB
![Page 54: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/54.jpg)
Multi-cycle Example (lw)Multi-cycle Example (lw)
![Page 55: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/55.jpg)
Multi-cycle Multi-cycle Example Example (sw)(sw)
PCWritePCSource = 10
ALUSrcA = 1ALUSrcB = 00ALUOp = 01PCWriteCondPCSource = 01
ALUSrcA = 1ALUSrcB = 00ALUOp = 10
MemReadIorD = 1
MemWriteIorD = 1
RegDst = 1RegWrite
MemtoReg = 0
RegDst = 0RegWrite
MemtoReg = 1
Start
MemReadALUSrcA=0
IorD = 0IRWrite
ALUSrcB = 01ALUOp = 00
PCWritePCSrc = 00
ALUSrcA = 0ALUSrcB = 11ALUOp = 00
ALUSrcA = 1ALUSrcB = 10ALUOp = 00
LW | SWRRR BEQ
J
LW SW
IF ID
EX
MEM
WB
WB
![Page 56: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/56.jpg)
Multi-cycle Example (sw)Multi-cycle Example (sw)
![Page 57: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/57.jpg)
Multi-cycle Multi-cycle Example Example (beq T)(beq T)
PCWritePCSource = 10
ALUSrcA = 1ALUSrcB = 00ALUOp = 01PCWriteCondPCSource = 01
ALUSrcA = 1ALUSrcB = 00ALUOp = 10
MemReadIorD = 1
MemWriteIorD = 1
RegDst = 1RegWrite
MemtoReg = 0
RegDst = 0RegWrite
MemtoReg = 1
Start
MemReadALUSrcA=0
IorD = 0IRWrite
ALUSrcB = 01ALUOp = 00
PCWritePCSrc = 00
ALUSrcA = 0ALUSrcB = 11ALUOp = 00
ALUSrcA = 1ALUSrcB = 10ALUOp = 00
LW | SWRRR BEQ
J
LW SW
IF ID
EX
MEM
WB
WB
![Page 58: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/58.jpg)
Multi-cycle Example (beq T)Multi-cycle Example (beq T)
![Page 59: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/59.jpg)
Multi-cycle Example (beq NT)Multi-cycle Example (beq NT)
![Page 60: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/60.jpg)
Multi-cycle Multi-cycle Example Example (j)(j)
PCWritePCSource = 10
ALUSrcA = 1ALUSrcB = 00ALUOp = 01PCWriteCondPCSource = 01
ALUSrcA = 1ALUSrcB = 00ALUOp = 10
MemReadIorD = 1
MemWriteIorD = 1
RegDst = 1RegWrite
MemtoReg = 0
RegDst = 0RegWrite
MemtoReg = 1
Start
MemReadALUSrcA=0
IorD = 0IRWrite
ALUSrcB = 01ALUOp = 00
PCWritePCSrc = 00
ALUSrcA = 0ALUSrcB = 11ALUOp = 00
ALUSrcA = 1ALUSrcB = 10ALUOp = 00
LW | SWRRR BEQ
J
LW SW
IF ID
EX
MEM
WB
WB
![Page 61: ECE/CS 552: Data Path and Control Instructor:Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.](https://reader035.fdocuments.us/reader035/viewer/2022062504/5a4d1b777f8b9ab0599b7bc7/html5/thumbnails/61.jpg)
Multi-cycle Example (j)Multi-cycle Example (j)