1 EEL-4713 Ann Gordon - Ross EEL-4713 Computer Architecture Designing a Multiple-Cycle Processor.

Slides:



Advertisements
Similar presentations
EEM 486 EEM 486: Computer Architecture Lecture 4 Designing a Multicycle Processor.
Advertisements

CPE 442 pipeline.1 Intro to Computer Architecture CpE 242 Computer Architecture and Engineering Designing a Pipeline Processor.
Pipeline Computer Architecture Lecture 12: Designing a Pipeline Processor.
CS152 Lec9.1 CS152 Computer Architecture and Engineering Lecture 9 Designing Single Cycle Control.
361 multicontroller.1 ECE 361 Computer Architecture Lecture 11: Designing a Multiple Cycle Controller.
EECC550 - Shaaban #1 Lec # 4 Summer Major CPU Design Steps 1Using independent RTN, write the micro- operations required for all target ISA.
361 datapath Computer Architecture Lecture 8: Designing a Single Cycle Datapath.
EECC550 - Shaaban #1 Lec # 5 Winter Major CPU Design Steps 1. Analyze instruction set operations using independent RTN ISA => RTN => datapath.
CS61C L26 Single Cycle CPU Datapath II (1) Garcia © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L26 CPU Design : Designing a Single-Cycle CPU II (1) Garcia, Spring 2007 © UCB 3.6 TB DVDs? Maybe!  Researchers at Harvard have found a way to use.
361 multipath..1 ECE 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor.
CS152 / Kubiatowicz Lec10.1 3/1/99©UCB Spring 1999 Alternative datapath (book): Multiple Cycle Datapath °Miminizes Hardware: 1 memory, 1 adder Ideal Memory.
EECC550 - Shaaban #1 Lec # 5 Winter CPU Design Steps 1. Analyze instruction set operations using independent ISA => RTN => datapath requirements.
Savio Chau Single Cycle Controller Design Last Time: Discussed the Designing of a Single Cycle Datapath Control Datapath Memory Processor (CPU) Input Output.
EECC550 - Shaaban #1 Lec # 5 Winter CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements.
EECC550 - Shaaban #1 Lec # 5 Winter CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements.
EECC550 - Shaaban #1 Lec # 4 Winter CPU Organization Datapath Design: –Capabilities & performance characteristics of principal Functional.
Microprocessor Design
Give qualifications of instructors: DAP
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
ECE 232 L13. Control.1 ©UCB, DAP’ 97 ECE 232 Hardware Organization and Design Lecture 13 Control Design
CS 61C L17 Control (1) A Carle, Summer 2006 © UCB inst.eecs.berkeley.edu/~cs61c/su06 CS61C : Machine Structures Lecture #17: CPU Design II – Control
CS61C L26 CPU Design : Designing a Single-Cycle CPU II (1) Garcia, Fall 2006 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
EECC550 - Shaaban #1 Lec # 4 Winter Major CPU Design Steps 1Using independent RTN, write the micro- operations required for all target.
EEM 486: Computer Architecture Lecture 3 Designing a Single Cycle Datapath.
361 control Computer Architecture Lecture 9: Designing Single Cycle Control.
CS61C L26 CPU Design : Designing a Single-Cycle CPU II (1) Garcia, Spring 2010 © UCB inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures.
EECC550 - Shaaban #1 Lec # 5 Spring CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements.
ECE 232 L12.Datapath.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 12 Datapath.
EECC550 - Shaaban #1 Lec # 5 Spring CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements.
CS61C L27 Single Cycle CPU Control (1) Garcia, Fall 2006 © UCB Wireless High Definition?  Several companies will be working on a “WirelessHD” standard,
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
CS3350B Computer Architecture Winter 2015 Lecture 5.6: Single-Cycle CPU: Datapath Control (Part 1) Marc Moreno Maza [Adapted.
CPE 442 pipeline.1 Intro to Computer Architecture CpE 242 Computer Architecture and Engineering Designing a Pipeline Processor.
Computer Organization CS224 Fall 2012 Lesson 26. Summary of Control Signals addsuborilwswbeqj RegDst ALUSrc MemtoReg RegWrite MemWrite Branch Jump ExtOp.
CASE STUDY OF A MULTYCYCLE DATAPATH. Alternative Multiple Cycle Datapath (In Textbook) Minimizes Hardware: 1 memory, 1 ALU Ideal Memory Din Address 32.
CS/EE 362 multicontroller..1 ©DAP & SIK 1995 CS/EE 362 Hardware Fundamentals Lecture 15: Designing a Multi-Cycle Controller (Chapter 5: Hennessy and Patterson)
CPE 442 multipath..1 Intro. to Computer Architecture CpE 242 Computer Architecture and Engineering Designing a Multiple Cycle Processor.
EEM 486: Computer Architecture Designing Single Cycle Control.
EEM 486: Computer Architecture Designing a Single Cycle Datapath.
CPE 442 single-cycle datapath.1 Intro. To Computer Architecture CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath.
W.S Computer System Design Lecture 4 Wannarat Suntiamorntut.
Datapath and Control Unit Design
CS3350B Computer Architecture Winter 2015 Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2) Marc Moreno Maza [Adapted.
Overview of Control Hardware Development
By Wannarat Computer System Design Lecture 4 Wannarat Suntiamorntut.
Csci 136 Computer Architecture II –Single-Cycle Datapath Xiuzhen Cheng
EEM 486: Computer Architecture Lecture 3 Designing Single Cycle Control.
CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single-Cycle CPU Datapath & Control Part 2 Instructors: Krste Asanovic & Vladimir Stojanovic.
Single Cycle Controller Design
CS/EE 362 multipath..1 ©DAP & SIK 1995 CS/EE 362 Hardware Fundamentals Lecture 14: Designing a Multi-Cycle Datapath (Chapter 5: Hennessy and Patterson)
Design a MIPS Processor (II)
Problem with Single Cycle Processor Design
CpE 442 Designing a Multiple Cycle Controller
(Chapter 5: Hennessy and Patterson) Winter Quarter 1998 Chris Myers
Designing a Multicycle Processor
CS 704 Advanced Computer Architecture
CS 704 Advanced Computer Architecture
CS152 Computer Architecture and Engineering Lecture 8 Designing a Single Cycle Datapath Start: X:40.
CpE 442 Microprogramming and Exceptions
CpE 242 Computer Architecture and Engineering Designing a Multiple Cycle Processor Start X:40.
COMS 361 Computer Organization
EECS 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor Start X:40.
EECS 361 Computer Architecture Lecture 11: Designing a Multiple Cycle Controller Start X:40.
Instructors: Randy H. Katz David A. Patterson
CpE 442 Designing a Multiple Cycle Controller
Alternative datapath (book): Multiple Cycle Datapath
COMS 361 Computer Organization
What You Will Learn In Next Few Sets of Lectures
Processor: Datapath and Control
Presentation transcript:

1 EEL-4713 Ann Gordon - Ross EEL-4713 Computer Architecture Designing a Multiple-Cycle Processor

2 EEL-4713 Ann Gordon - Ross Outline of today’s lecture °Recap and Introduction °Introduction to the Concept of Multiple Cycle Processor °Multiple Cycle Implementation of R-type Instructions °What is a Multiple Cycle Delay Path and Why is it Bad? °Multiple Cycle Implementation of Or Immediate °Multiple Cycle Implementation of Load and Store °Putting it all Together

3 EEL-4713 Ann Gordon - Ross Abstract view of our single cycle processor °looks like an FSM with PC as state PC Next PC Register Fetch ALU Reg. Wrt Mem Access Data Mem Instruction Fetch Result Store ALUctr RegDst ALUSrc ExtOp MemWr Equal nPC_sel RegWr MemWr MemRd Main Control ALU control op fun Ext

4 EEL-4713 Ann Gordon - Ross What’s wrong with our CPI=1 processor? °Long Cycle Time °All instructions take as much time as the slowest °Real memory is not so nice as our idealized memory cannot always get the job done in one (short) cycle PCInst Memory mux ALUData Mem mux PCReg FileInst Memory mux ALU mux PCInst Memory mux ALUData Mem PCInst Memorycmp mux Reg File Arithmetic & Logical Load Store Branch Critical Path Reg File

5 EEL-4713 Ann Gordon - Ross Drawbacks of this single cycle processor °Long cycle time: 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 °Need for multiple functional units Can’t share functional units for multiple operations in the same instruction E.g., instruction/data memory, adders (PC, ALU, branch target, etc.)

6 EEL-4713 Ann Gordon - Ross Overview of a multiple cycle implementation °The root of the single cycle processor’s problems: The cycle time has to be long enough for the slowest instruction °Solution: Break the instruction into smaller steps Execute each step (instead of the entire instruction) in one cycle -Cycle time: time it takes to execute the longest step -All the steps have similar length This is the essence of the multiple cycle processor °The advantages of the multiple cycle processor: Cycle time is much shorter Different instructions take different number of cycles to complete (for now) -Load takes five cycles -Jump only takes three cycles Allows a functional unit to be used more than once per instruction

7 EEL-4713 Ann Gordon - Ross What and when: °When designing multi-cycle implementations, you must think about: What to do on each cycle When results are ready for next cycle °What to do on each cycle: Always need to fetch instruction Always need to decode instruction (know what to do next) Next need to perform actual operation (varies from instruction to instruction) E.g.: -Load will require address calculation, memory read, reg write -Branch will require comparison and PC update -R-type will require ALU operation, reg write

8 EEL-4713 Ann Gordon - Ross Overview: Control State Diagram store in IR PC=PC+4 Fetch and Ifetch operation Decode In busA, busB Register operands Index registers Rfetch/Decode Finish branch Calculate the Target address BrComplete Select mux, Write PC ALU has inputs and control set, can compute RExec Rfinish OriExec OriFinish ALU Computes rs+imm AdrCal Write rt to memory address calc. above SWMem Read mem. with address calculated above LWmem Latch data read from memory in rt LWwr lw or sw lwsw Rtype Ori beq ALU has inputs and control set, can compute Latch ALU computed result in rd Latch ALU computed result in rt

9 EEL-4713 Ann Gordon - Ross Example: the five steps of a Load instruction Clk PC Rs, Rt, Rd, Op, Func Clk-to-Q ALUctr Instruction Memory Access Time Old ValueNew Value RegWrOld ValueNew Value Delay through Control Logic busA Register File Access Time Old ValueNew Value busB ALU Delay Old ValueNew Value Old ValueNew Value Old Value ExtOpOld ValueNew Value ALUSrcOld ValueNew Value AddressOld ValueNew Value busWOld ValueNew Delay through Extender & Mux Data Memory Access Time Instruction FetchInstr Decode / Reg. Fetch AddressReg WrData Memory Register File Write Time

10 EEL-4713 Ann Gordon - Ross Multicycle datapath °Similar to the single-cycle datapath; use latches for instruction and branch target address °Control signals generated for multiple clock cycles per instruction - FSM Target Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Add ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=0 RegDst=x Mux PC Extend ExtOp=1 Mux Imm 32 << 2 ALUSelB=10 Mux Zero PCWrCond=0 PCSrc=xBrWr=1 32 IorD=x Func Op Control 6 6 Beq Rtype Ori Memory :

11 EEL-4713 Ann Gordon - Ross Overview: Control State Diagram store in IR PC=PC+4 Fetch and Ifetch operation Decode In busA, busB Register operands Index registers Rfetch/Decode Finish branch Calculate the Target address BrComplete Select mux, Write PC ALU has inputs and control set, can compute RExec Rfinish OriExec OriFinish ALU Computes rs+imm AdrCal Write rt to memory address calc. above SWMem Read mem. with address calculated above LWmem Latch data read from memory in rt LWwr lw or sw lwsw Rtype Ori beq ALU has inputs and control set, can compute Latch ALU computed result in rd Latch ALU computed result in rt

12 EEL-4713 Ann Gordon - Ross Cycle 1: Fetch 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

13 EEL-4713 Ann Gordon - Ross 1 Instruction fetch cycle: beginning °Every cycle begins right AFTER the clock tick: mem[PC] PC + 4 Ideal Memory WrAdr Din RAdr 32 Dout MemWr=? PC 32 Clk ALU 32 ALUop=? ALU Control 4 Instruction Reg 32 IRWr=? Clk PCWr=? Clk You are here! One “Logic” Clock Cycle Use the main ALU

14 EEL-4713 Ann Gordon - Ross 1 Instruction fetch cycle: end °Every cycle ends AT the next clock tick (storage element updates): IR + 4 Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 PC 32 Clk ALU 32 ALUOp = Add ALU Control 4 00 Instruction Reg 32 IRWr=1 Clk PCWr=1 Clk You are here! One “Logic” Clock Cycle

15 EEL-4713 Ann Gordon - Ross 1 Instruction Fetch Cycle: Overall Picture Target Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Add ALU Control Instruction Reg IRWr=1 32 busA 32busB PCWr=1 ALUSelA=0 Mux PC Mux ALUSelB=00 Mux Zero PCWrCond=xPCSrc=0BrWr=0 32 IorD=0 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1.Latch IR=mem[PC] 2.Set PC=PC+4 store in IR PC=PC+4 Fetch and

16 EEL-4713 Ann Gordon - Ross Cycle 2: Register fetch, decode 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

17 EEL-4713 Ann Gordon - Ross 2 Register Fetch / Instruction Decode °busA <- RegFile[rs] ; busB <- RegFile[rt] ; °ALU can be also be used to compute branch target address (next slide) in this cycle (latch target); register compare done on next cycle Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=xx ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=x RegDst=x Mux PC Mux Imm ALUSelB=xx Mux Zero PCWrCond=0 PCSrc=x 32 IorD=x Func Op Go to the Control 6 6

18 EEL-4713 Ann Gordon - Ross 2 Register Fetch / Instruction Decode (Continue) °busA <- Reg[rs] ; busB <- Reg[rt] ; °Target <- PC + SignExt(Imm16)*4 °Generate control signals Target Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Add ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=0 RegDst=x Mux PC Extend ExtOp=1 Mux Imm 32 << 2 ALUSelB=10 Mux Zero PCWrCond=0 PCSrc=xBrWr=1 32 IorD=x Func Op Control 6 6 Beq Rtype Ori Memory : 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode operation Decode In busA, busB Register operands Index registers

19 EEL-4713 Ann Gordon - Ross Cycle 3: Branch completion 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

20 EEL-4713 Ann Gordon - Ross 3 Branch Completion °if (busA == busB) PC <- Target Target Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Sub ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 RegDst=x Mux PC Extend ExtOp=x Mux Imm 32 << 2 ALUSelB=01 Mux Zero PCWrCond=1 PCSrc=1BrWr=0 32 IorD=x 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc Finish branch Calculate the Target address Select mux, Write PC

21 EEL-4713 Ann Gordon - Ross Cycle 3: Rtype execution 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

22 EEL-4713 Ann Gordon - Ross 3 R-type Execution °ALU Output <- busA op busB Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Rtype ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=1 Mux PC MemtoReg=x Extend ExtOp=x Mux Imm 32 << 2 ALUSelB=01 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec Funct Jump JumpAddr ALU has inputs and control set, can compute

23 EEL-4713 Ann Gordon - Ross Cycle 4: Rtype completion 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

24 EEL-4713 Ann Gordon - Ross 4 R-type Completion °R[rd] <- ALU Output Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Rtype ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=1 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=1 Mux PC MemtoReg=0 Extend ExtOp=x Mux Imm 32 << 2 ALUSelB=01 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish Latch ALU computed result in rd

25 EEL-4713 Ann Gordon - Ross Cycle 3: Ori execution 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

26 EEL-4713 Ann Gordon - Ross 3 Ori Execution °ALU output <- busA or ZeroExt[Imm16] Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Or ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=0 Mux PC MemtoReg=x Extend ExtOp=0 Mux Imm 32 << 2 ALUSelB=11 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg

27 EEL-4713 Ann Gordon - Ross Cycle 4: Ori completion 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

28 EEL-4713 Ann Gordon - Ross 4 Ori Completion °Reg[rt] <- ALU output Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Or ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=1 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=0 Mux PC MemtoReg=0 Extend ExtOp=0 Mux Imm 32 << 2 ALUSelB=11 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish Latch ALU computed result in rt

29 EEL-4713 Ann Gordon - Ross Cycle 3: Address calculation 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

30 EEL-4713 Ann Gordon - Ross 3 Memory Address Calculation °ALU output <- busA + SignExt[Imm16] Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Add ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=x Mux PC MemtoReg=x Extend ExtOp=1 Mux Imm 32 << 2 ALUSelB=11 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALU Computes rs+imm

31 EEL-4713 Ann Gordon - Ross Cycle 4: Memory access, store 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

32 EEL-4713 Ann Gordon - Ross 4 Memory Access for Store °mem[ALU output] <- busB Ideal Memory WrAdr Din RAdr 32 Dout MemWr=1 32 ALU 32 ALUOp=Add ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=x Mux PC MemtoReg=x Extend ExtOp=1 Mux Imm 32 << 2 ALUSelB=11 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWmem Write rt to memory address calc. above

33 EEL-4713 Ann Gordon - Ross Cycle 4: Memory access, load 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

34 EEL-4713 Ann Gordon - Ross 4 Memory Access for Load °Mem Dout <- mem[ALU output] Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Add ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=0 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=0 Mux PC MemtoReg=x Extend ExtOp=1 Mux Imm 32 << 2 ALUSelB=11 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=1 ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem Read mem. with address calculated above

35 EEL-4713 Ann Gordon - Ross Cycle 4: Memory access, load 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

36 EEL-4713 Ann Gordon - Ross 5 Write Back for Load °Reg[rt] <- Mem Dout Ideal Memory WrAdr Din RAdr 32 Dout MemWr=0 32 ALU 32 ALUOp=Add ALU Control Instruction Reg 32 IRWr=0 32 Reg File Ra Rw busW Rb busA 32busB RegWr=1 Rs Rt Mux 0 1 Rt Rd PCWr=0 ALUSelA=1 Mux 01 RegDst=0 Mux PC MemtoReg=1 Extend ExtOp=1 Mux Imm 32 << 2 ALUSelB=11 Mux 1 0 Target 32 Zero PCWrCond=0PCSrc=xBrWr=0 32 IorD=x ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr Latch data read from memory in rt

37 EEL-4713 Ann Gordon - Ross Putting it all together: Multiple Cycle Datapath Ideal Memory WrAdr Din RAdr 32 Dout MemWr 32 ALU 32 ALUOp ALU Control Instruction Reg 32 IRWr 32 Reg File Ra Rw busW Rb busA 32busB RegWr Rs Rt Mux 0 1 Rt Rd PCWr ALUSelA Mux 01 RegDst Mux PC MemtoReg Extend ExtOp Mux Imm 32 << 2 ALUSelB Mux 1 0 Target 32 Zero PCWrCondPCSrcBrWr 32 IorD

38 EEL-4713 Ann Gordon - Ross Putting it all together: Control State Diagram 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq

39 EEL-4713 Ann Gordon - Ross Note: there is a multiple-cycle delay path °There is no register to save the results between: 2) Register Fetch: busA <- Reg[rs] ; busB <- Reg[rt] 3) R-type Execution: ALU output <- busA op busB 4) R-type Completion: Reg[rd] <- ALU output ALU 32 ALU Control Instruction Reg 32 Reg File Ra Rw busW Rb busA 32busB Rs Rt Mux 0 1 Rt Rd Mux Zero IRWr ALUselA ALUselB Register here to save outputs of Rfetch? Register here to save outputs of RExec? ALUOp

40 EEL-4713 Ann Gordon - Ross A Multiple Cycle Delay Path (Continue) °Register is NOT needed to save the outputs of Register Fetch: IRWr = 0: busA and busB will not change after Register Fetch °Register is NOT needed to save the outputs of R-type Execution: busA and busB will not change after Register Fetch Control signals ALUSelA, ALUSelB, and ALUOp will not change after R-type Execution Consequently ALU output will not change after R-type Execution °In theory, you need a register to hold a signal value if: (1) The signal is computed in one clock cycle and used in another. (2) AND the inputs to the functional block that computes this signal can change before the signal is written into a state element. °You can save a register if Cond 1 is true BUT Cond 2 is false: But in practice, this will introduce a multiple cycle delay path: -A logic delay path that takes multiple cycles to propagate from one storage element to the next storage element

41 EEL-4713 Ann Gordon - Ross Pros and Cons of a Multiple Cycle Delay Path °A 3-cycle path example: IR (storage) -> Reg File Read -> ALU -> Reg File Write (storage) °Advantages: Register savings We can share time among cycles: -If ALU takes longer than one cycle, still OK as long as the entire path takes less than 3 cycles to finish ALU 32 ALU Control Instruction Reg 32 Reg File Ra Rw busW Rb busA 32busB Rs Rt Mux 0 1 Rt Rd Mux Zero ALUselB

42 EEL-4713 Ann Gordon - Ross Pros and Cons of a Multiple Cycle Delay Path (Continue) °Disadvantage: Static timing analyzer, which ONLY looks at delay between two storage elements, will report this as a timing violation You have to ignore the static timing analyzer’s warnings ALU 32 ALU Control Instruction Reg 32 Reg File Ra Rw busW Rb busA 32busB Rs Rt Mux 0 1 Rt Rd Mux Zero ALUselB

43 EEL-4713 Ann Gordon - Ross 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 signal’s value whenever a signal is generated in one clock cycle and used in another cycle later

44 EEL-4713 Ann Gordon - Ross Control logic °Review of Finite State Machine (FSM) control °From Finite State Diagrams to Microprogramming

45 EEL-4713 Ann Gordon - Ross Overview °Control may be designed using one of several initial representations. The choice of sequence control, and how logic is represented, can then be determined independently; the control can then be implemented with one of several methods using a structured logic technique. Initial RepresentationFinite State Diagram Microprogram Sequencing ControlExplicit Next State Microprogram counter Function + Dispatch ROMs Logic RepresentationLogic EquationsTruth Tables Implementation TechniquePLAROM “hardwired control”“microprogrammed control”

46 EEL-4713 Ann Gordon - Ross Initial Representation: Finite State Diagram 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq : Jump See Fig C.3.1

47 EEL-4713 Ann Gordon - Ross Sequencing Control: Explicit Next State Function °Next state number is encoded just like datapath controls Opcode State Reg Inputs OutputsOutputs Control Logic and Next State Logic Multicycle Datapath

48 EEL-4713 Ann Gordon - Ross Interface in detail

49 EEL-4713 Ann Gordon - Ross Logic Representation: Logic Equations °Next state from current state State 0 -> State1 State 1 -> S2, S6, S8, S10 State 2 -> S3, S5 State 3 -> State 4 State 4 ->State 0 State 5 -> State 0 State 6 -> State 7 State 7 -> State 0 State 8 -> State 0 State 9-> State 0 State 10 -> State 11 State 11 -> State 0 °Alternatively, prior state & condition S4, S5, S7, S8, S9, S11 -> State0 State 0_____________ -> State 1 State 1 & op = lw|sw -> State 2 State2 & op = lw ____ -> State 3 State 3 ____________ -> State 4 State2 & op = sw ____ -> State 5 State 1 & op = R-type -> State 6 State 6 _____________-> State 7 State 1 & op = beq___ -> State 8 State2 & op = jmp ___-> State 9 State 1& op = ORi__ -> State 10 State 10 __________ -> State 11 See Fig. C.3.3

50 EEL-4713 Ann Gordon - Ross Implementation Technique: Programmed Logic Arrays °Each output line: the logical OR of logical AND of input lines or their complement; AND minterms specified in top AND plane, OR sums specified in bottom OR plane Op5 Op4 Op3 Op2 Op1 Op0 S3 S2 S1 S0 NS3 NS2 NS1 NS0 R = beq = lw = sw = ori = jmp = = = = = = = = = = = = = 0101 S=0 Op=any Next=1

51 EEL-4713 Ann Gordon - Ross Implementation Technique: Programmed Logic Arrays °Each output line the logical OR of logical AND of input lines or their complement: AND minterms specified in top AND plane, OR sums specified in bottom OR plane Op5 Op4 Op3 Op2 Op1 Op0 S3 S2 S1 S0 NS3 NS2 NS1 NS0 lw = sw = R = ori = beq = jmp = = = = = = = = = = = = = 1011

52 EEL-4713 Ann Gordon - Ross Multicycle Control °Given numbers assigned to FSM, can in turn determine next state as function of the inputs and current state °Can turn these into Boolean equations for each bit of the next state lines Implement easily using PLA (programmable logic array) or ROM storing truth tables See Figs. C.3.6 and C.3.8 for tables showing outputs and next state as function of current state and opcode °What if many more states, many more conditions? State machine gets too large; very large ROMs/PLAs °What if need to add a state? May need to increase address for ROM, number of inputs for PLA gates °Or just implement FSM in VHDL

53 EEL-4713 Ann Gordon - Ross °Before: Explicit Next State; Next try variation 1 step from right hand side °Few sequential states in small FSM: suppose added floating point? °Still need to go to non-sequential states: e.g., state 1 => 2, 6, 8, 10 Initial RepresentationFinite State Diagram Microprogram Sequencing ControlExplicit Next State Microprogram counter Function + Dispatch ROMs Logic RepresentationLogic EquationsTruth Tables Implementation TechniquePLAROM Next Iteration: Using Sequencer for Next State “hardwired control”“microprogrammed control”

54 EEL-4713 Ann Gordon - Ross Sequencer-based control unit Opcode State Reg Inputs Outputs Control Logic Multicycle Datapath 1 Address Select Logic Adder A processor on its own Set state to 0 Dispatch (state 1 & 2) Incremented state number (“microPC”) and “micro branches” specify whether to increment or select another state based on opcode

55 EEL-4713 Ann Gordon - Ross Sequencer-based control unit Opcode State Reg Inputs Outputs Control Logic Multicycle Datapath 1 Address Select Logic Adder AddrCtrl control for select logic 0: reset state register (next instruction) 1: select next using next-state ROM for state 1 2: select next using next-state ROM for state 2 3: increment state Fig. C.4.2

56 EEL-4713 Ann Gordon - Ross Sequencer block diagram 0000 – AddrCtrl=3 (fetch) 0001 – AddrCtrl=1 (decode) 0010 – AddrCtrl=2 (lw/sw) 0011 – AddrCtrl=3 (lw) 0100 – AddrCtrl=0 (lw) 0101 – AddrCtrl=0 (sw) 0110 – AddrCtrl=3 (r-type) 0111 – AddrCtrl=0 (r-type) 1000 – AddrCtrl=0 (branch) 1010 – AddrCtrl=3 (ori) 1011 – AddrCtrl=0 (ori) Dispatch ROM 1 (Indexed by opcode) lw -> 0010 sw -> 0010 R-type -> 0110 ori -> 1010 branch -> 1000 ROM2: lw -> 0011 sw -> 0101 Before: 6bit opcode + 4-bit state -> 4-bit NS Now: 4-bit state -> 2-bit AddrCtrl

57 EEL-4713 Ann Gordon - Ross Initial Representation: Finite State Diagram 1: PCWr, IRWr ALUOp=Add Others: 0s x: PCWrCond RegDst, Mem2R Ifetch 1: BrWr, ExtOp ALUOp=Add Others: 0s x: RegDst, PCSrc ALUSelB=10 IorD, MemtoReg Rfetch/Decode 1: PCWrCond ALUOp=Sub x: IorD, Mem2Reg ALUSelB=01 RegDst, ExtOp ALUSelA BrComplete PCSrc 1: RegDst ALUOp=Rtype ALUSelB=01 x: PCSrc, IorD MemtoReg ALUSelA ExtOp RExec 1: RegDst, RegWr ALUOp=Rtype ALUselA x: IorD, PCSrc ALUSelB=01 ExtOp Rfinish ALUOp=Or IorD, PCSrc 1: ALUSelA ALUSelB=11 x: MemtoReg OriExec 1: ALUSelA ALUOp=Or x: IorD, PCSrc RegWr ALUSelB=11 OriFinish ALUOp=Add PCSrc 1: ExtOp ALUSelB=11 x: MemtoReg ALUSelA AdrCal ALUOp=Add x: PCSrc,RegDst 1: ExtOp ALUSelB=11 MemtoReg MemWr ALUSelA SWMem ALUOp=Add x: MemtoReg 1: ExtOp ALUSelB=11 ALUSelA, IorD PCSrc LWmem ALUOp=Add x: PCSrc 1: ALUSelA ALUSelB=11 MemtoReg RegWr, ExtOp IorD LWwr lw or sw lwsw Rtype Ori beq : Jump See Fig C.3.1

58 EEL-4713 Ann Gordon - Ross Initial RepresentationFinite State Diagram Microprogram Sequencing ControlExplicit Next State Microprogram counter Function + Dispatch ROMs Logic RepresentationLogic EquationsTruth Tables Implementation TechniquePLAROM °ROM can be thought of as a sequence of control words °Control word can be thought of as instruction: “microinstruction” Next Iteration: Using Microprogram for Representation “hardwired control”“microprogrammed control”

59 EEL-4713 Ann Gordon - Ross Microprogramming °Control is the hard part of processor design ° Datapath is fairly regular and well-organized ° Memory is highly regular ° Control is irregular and global Microprogramming: -- A particular strategy for implementing the control unit of a processor by "programming" at the level of register transfer operations Microarchitecture: -- Logical structure and functional capabilities of the hardware as seen by the microprogrammer

60 EEL-4713 Ann Gordon - Ross Macroinstruction Interpretation Main Memory execution unit control memory CPU ADD SUB AND DATA User program plus Data this can change! AND microsequence e.g., Fetch Calc Operand Addr Fetch Operand(s) Calculate Save Answer(s) one of these is mapped into one of these

61 EEL-4713 Ann Gordon - Ross Microprogramming Pros and Cons °Ease of design °Flexibility Easy to adapt to changes in organization, timing, technology Can make changes late in design cycle, or even in the field °Can implement very powerful instruction sets (just more control memory) °Generality Can implement multiple instruction sets on same machine. Can tailor instruction set to application. °Compatibility Many organizations, same instruction set °Costly to implement °Slow

62 EEL-4713 Ann Gordon - Ross Summary: Multicycle Control °Microprogramming and hardwired control have many similarities, perhaps biggest difference is initial representation and ease of change of implementation, with ROM generally being easier than PLA Initial RepresentationFinite State Diagram Microprogram Sequencing ControlExplicit Next State Microprogram counter Function + Dispatch ROMs Logic RepresentationLogic EquationsTruth Tables Implementation TechniquePLAROM “hardwired control”“microprogrammed control”