CS152 Lec11.1 CS 152 Computer Architecture and Engineering Lecture 11 Multicycle Controller Design (Continued)

Slides:



Advertisements
Similar presentations
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 11: Control Unit Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization, ed-5.
Advertisements

ELEN 350 Multi-Cycle Datapath Adapted from the lecture notes of John Kubiatowicz (UCB) and Hank Walker (TAMU)
361 multicontroller.1 ECE 361 Computer Architecture Lecture 11: Designing a Multiple Cycle Controller.
CS 152 Computer Architecture and Engineering Lecture 9 Multiprogramming and Exceptions February 25, 2004 John Kubiatowicz (
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.
CS152 / Kubiatowicz Lec11.1 3/05/03©UCB Spring 2003 CS 152 Computer Architecture and Engineering Lecture 11 Multicycle Controller Design March 5, 2003.
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.
Adapted from the lecture notes of John Kubiatowicz (UCB)
Microprocessor Design
CS152 / Kubiatowicz Lec9.1 2/26/03©UCB Spring 2003 CS 152 Computer Architecture and Engineering Lecture 9 Designing a Multicycle Processor February 26,
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
ECE 232 L13. Control.1 ©UCB, DAP’ 97 ECE 232 Hardware Organization and Design Lecture 13 Control Design
ECE 232 L16.Microprog.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 16 Microprogrammed.
CS152 / Kubiatowicz Lec /03/01©UCB Fall 2001 CS 152 Computer Architecture and Engineering Lecture 10 Multicycle Controller Design (Continued) October.
CS61C L26 CPU Design : Designing a Single-Cycle CPU II (1) Garcia, Fall 2006 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c.
Inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 25 CPU design (of a single-cycle CPU) Intel is prototyping circuits that.
EE30332 Ch5 Ext - DP.1 Ch 5 The Processor: Datapath and Control  The state digrams that arise define the controller for an instruction set processor are.
Class 9.1 Computer Architecture - HUJI Computer Architecture Class 9 Microprogramming.
EECC550 - Shaaban #1 Lec # 6 Winter Control may be designed using one of several initial representations. The choice of sequence control,
EECC550 - Shaaban #1 Lec # 6 Spring Control may be designed using one of several initial representations. The choice of sequence control,
EECC550 - Shaaban #1 Lec # 5 Spring CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements.
CPSC 321 Computer Architecture and Engineering Lecture 8 Designing a Multicycle Processor Instructor: Rabi Mahapatra & Hank Walker Adapted from the lecture.
Major CPU Design Steps 1. Analyze instruction set operations using independent RTN ISA => RTN => datapath requirements. This provides the the required.
EECC550 - Shaaban #1 Lec # 5 Spring CPU Design Steps 1. Analyze instruction set operations using independent RTN => datapath requirements.
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.
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)
ECS154B Computer Architecture Multicycle Controller Design
CS 152 L09 Multicycle (1)Patterson Fall 2003 © UCB CS152 – Computer Architecture and Engineering Lecture 9 – Multicycle Design Dave Patterson.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
EEM 486: Computer Architecture Designing a Single Cycle Datapath.
Exam 2 Review Two’s Complement Arithmetic Ripple carry ALU logic and performance Look-ahead techniques Basic multiplication and division ( non- restoring)
CS3350B Computer Architecture Winter 2015 Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2) Marc Moreno Maza [Adapted.
Overview of Control Hardware Development
CMCS Computer Architecture Lecture 16 Micro-programming & Exceptions April 2, CMSC411.htm Mohamed Younis.
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
1 EEL-4713 Ann Gordon - Ross EEL-4713 Computer Architecture Designing a Multiple-Cycle Processor.
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)
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Design a MIPS Processor (II)
Problem with Single Cycle Processor Design
CS161 – Design and Architecture of Computer Systems
CpE 442 Designing a Multiple Cycle Controller
IT 251 Computer Organization and Architecture
Designing a Multicycle Processor
Designing a Multicycle Processor
CS/COE0447 Computer Organization & Assembly Language
CS 704 Advanced Computer Architecture
The Multicycle Implementation
John Kubiatowicz (http.cs.berkeley.edu/~kubitron)
John Lazzaro ( CS152 – Computer Architecture and Engineering Lecture 8 – Multicycle Design and Microcode John.
The Multicycle Implementation
CS152 Computer Architecture and Engineering Lecture 8 Designing a Single Cycle Datapath Start: X:40.
CpE 442 Microprogramming and Exceptions
EECS 361 Computer Architecture Lecture 11: Designing a Multiple Cycle Controller Start X:40.
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
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
CS161 – Design and Architecture of Computer Systems
Presentation transcript:

CS152 Lec11.1 CS 152 Computer Architecture and Engineering Lecture 11 Multicycle Controller Design (Continued)

CS152 Lec11.2 The Big Picture: Where are We Now? °The Five Classic Components of a Computer °Today’s Topics: Microprogramed control Administrivia Microprogram it yourself Exceptions Control Datapath Memory Processor Input Output

CS152 Lec11.3 Controller Design °The state digrams that arise define the controller for an instruction set processor are highly structured °Use this structure to construct a simple “microsequencer” °Control reduces to programming this very simple device  microprogramming sequencer control datapath control micro-PC sequencer microinstruction

CS152 Lec11.4 Multicycle Datapath PC Next PC Operand Fetch Instruction Fetch nPC_sel IR Reg File Ext ALU Reg. File Mem Acces s Data Mem Result Store RegDst RegWr MemWr MemRd S M MemToReg Equal ALUctr ALUSrc ExtOp A B E

CS152 Lec11.5 State Diagram of Controller IR <= MEM[PC] R-type A <= R[rs] B <= R[rt] S <= A fun B R[rd] <= S PC <= PC + 4 S <= A or ZX R[rt] <= S PC <= PC + 4 ORi S <= A + SX R[rt] <= M PC <= PC + 4 M <= MEM[S] LW S <= A + SX MEM[S] <= B PC <= PC + 4 BEQ PC <= Next(PC) SW “instruction fetch” “decode” Execute Memory Write-back

CS152 Lec11.6 Using a Jump Counter IR <= MEM[PC] R-type A <= R[rs] B <= R[rt] S <= A fun B R[rd] <= S PC <= PC + 4 S <= A or ZX R[rt] <= S PC <= PC + 4 ORi S <= A + SX R[rt] <= M PC <= PC + 4 M <= MEM[S] LW S <= A + SX MEM[S] <= B PC <= PC + 4 BEQ PC <= Next(PC) SW “instruction fetch” “decode” inc load zero inc Execute Memory Write-back

CS152 Lec11.7 Example: Jump-Counter op-code Map ROM Counter zero inc load 0000 i i+1 i None of above: Do nothing (for wait states)

CS152 Lec11.8 Sequencer °Sequencer-based control unit Called “microPC” or “µPC” vs. state register Control ValueEffect 00 Next µaddress = 0 01 Next µaddress = dispatch ROM 10 Next µaddress = µaddress + 1 Dispatch ROM: Opcode microPC 1 µAddress Select Logic Adder Dispatch ROM Mux OpcodeDispatch State R-type BEQ ori LW SW Microprogram

CS152 Lec11.9 Microprogramming (Maurice Wilkes) °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 Historical Note: IBM 360 Series first to distinguish between architecture & organization Same instruction set across wide range of implementations, each with different cost/performance

CS152 Lec11.10 “Macro and micro - instruction” 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

CS152 Lec11.11 Variations on Microprogramming ° “Horizontal” Microcode – control field for each control point in the machine ° “Vertical” Microcode – compact microinstruction format for each class of microoperation – local decode to generate all control points (remember ALU?) branch:µseq-opµadd execute:ALU-opA,B,R memory:mem-opS, D µseq µaddr A-mux B-mux bus enables register enables Horizontal Vertical

CS152 Lec11.12 Extreme Horizontal input select N3N2 N1N Incr PC ALU control 1 bit for each loadable register enbMAR enbAC... Depending on bus organization, many potential control combinations simply wrong, i.e., implies transfers that can never happen at the same time. Makes sense to encode fields to save ROM space Example: mem_to_reg and ALU_to_reg should never happen simultaneously; => encode in single bit which is decoded rather than two separate bits NOTE: the encoding should be only wide enough so that parallel actions that the datapath supports should still be specifiable in a single microinstruction

CS152 Lec11.13 More Vertical Format src dst DECDEC DECDEC other control fields next statesinputs MUX Multiformat Microcode: condnext address 1dstsrcalu DECDEC DECDEC Branch Jump Register Xfer Operation

CS152 Lec11.14 Hybrid Control Not all critical control information is derived from control logic E.g., Instruction Register (IR) contains useful control information, such as register sources, destinations, opcodes, etc. Register File RS1DECRS1DEC RS2DECRS2DEC RDDECRDDEC op rs1 rs2rdIR to control enable signals from control

CS152 Lec11.15 Summary: Horizontal vs. Vertical Microprogramming NOTE: previous organization is not TRUE horizontal microprogramming; register decoders give flavor of encoded microoperations Most microprogramming-based controllers vary between: horizontal organization (1 control bit per control point) vertical organization (fields encoded in the control memory and must be decoded to control something) Horizontal + more control over the potential parallelism of operations in the datapath - uses up lots of control store Vertical + easier to program, not very different from programming a RISC machine in assembly language - extra level of decoding may slow the machine down

CS152 Lec11.16 Microprogramming a multicycle processor °1) Choose datapath and sequencer architecture °2) Assign states and sequence of each (multicycle) instruction (i.e. define the controller FSM) °2) Choose microinstruction format (minimum bits to describe all allowable functions of sequencer and datapath) °3) Map instructions into microinstruction sequences

CS152 Lec11.17 Sequencer °Sequencer-based control unit Called “microPC” or “µPC” vs. state register Control ValueEffect 00 Next µaddress = 0 01 Next µaddress = dispatch ROM 10 Next µaddress = µaddress + 1 Dispatch ROM: Opcode microPC 1 µAddress Select Logic Adder Dispatch ROM Mux OpcodeDispatch State R-type BEQ ori LW SW Microprogram

CS152 Lec11.18 Datapath – single memory, single regfile °Miminizes Hardware: 1 memory, 1 adder Ideal Memory WrAdr Din RAdr 32 Dout MemWr 32 ALU 32 ALUOp ALU Control 32 IRWr Instruction Reg 32 Reg File Ra Rw busW Rb busA 32 busB RegWr Rs Rt Mux 0 1 Rt Rd PCWr ALUSelA Mux 01 RegDst Mux PC MemtoReg Extend ExtOp Mux Imm 32 << 2 ALUSelB Mux Zero PCWrCondPCSrc 32 IorD Mem Data Reg ALU Out B A

CS152 Lec11.19 Finite State Machine (FSM) Spec IR <= MEM[PC] PC <= PC + 4 R-type ALUout <= A fun B R[rd] <= ALUout ALUout <= A or ZX R[rt] <= ALUout ORi ALUout <= A + SX R[rt] <= M M <= MEM[ALUout] LW ALUout <= A + SX MEM[ALUout] <= B SW “instruction fetch” “decode” Execute Memory Write-back BEQ If A = B then PC <= ALUout ALUout <= PC +SX Q: What can we do in state 0001?

CS152 Lec11.20 Finite State Machine (FSM) Spec (improved) IR <= MEM[PC] PC <= PC + 4 R-type ALUout <= A fun B R[rd] <= ALUout ALUout <= A or ZX R[rt] <= ALUout ORi ALUout <= A + SX R[rt] <= M M <= MEM[ALUout] LW ALUout <= A + SX MEM[ALUout] <= B SW “instruction fetch” “decode” BEQ 0010 If A = B then PC <= ALUout ALUout <= PC +SX Execute Memory Write-back

CS152 Lec11.21 Designing a Microinstruction Set 1) Start with list of control signals 2) Group signals together that make sense (vs. random): called “fields” 3) Place fields in some logical order (e.g., ALU operation & ALU operands first and microinstruction sequencing last) 4) Create a symbolic legend for the microinstruction format, showing name of field values and how they set the control signals 5) To minimize the width, encode operations that will never be used at the same time

CS152 Lec ) Start with list of control signals Signal nameEffect when deassertedEffect when asserted ALUSelA1st ALU operand = PC1st ALU operand = Reg[rs] RegWrNoneReg. is written MemtoRegReg. write data input = ALUReg. write data input = memory RegDstReg. dest. no. = rtReg. dest. no. = rd MemRdNoneMemory at address is read, MemWrNoneMemory at address is written IorDMemory address = PCMemory address = S IRWrNoneIR <= Memory PCWrNonePC <= PCSource PCWrCond NoneIF ALUzero then PC <= PCSource PCSrc PCSource = ALU PCSource = ALUout ExtOpZero ExtendedSign Extended Single Bit Control Signal nameValueEffect ALUOp00ALU adds 01ALU subtracts 10ALU does function code 11ALU does logical OR ALUSelB002nd ALU input = 4 012nd ALU input = Reg[rt] 102nd ALU input = extended,shift left 2 112nd ALU input = extended Multiple Bit Control

CS152 Lec ) Group into fields of unrelated signals °Miminizes Hardware: 1 memory, 1 adder Ideal Memory WrAdr Din RAdr 32 Dout MemWr 32 ALU 32 ALUOp ALU Control 32 IRWr Instruction Reg 32 Reg File Ra Rw busW Rb busA 32 busB RegWr Rs Rt Mux 0 1 Rt Rd PCWr ALUSelA Mux 01 RegDst Mux PC MemtoReg Extend ExtOp Mux Imm 32 << 2 ALUSelB Mux Zero PCWrCondPCSrc 32 IorD Mem Data Reg ALU Out B A ALU SRC1 SRC2 MemRd PCWrite

CS152 Lec ,3 & 4 ) Group into fields, order and assign names Field NameValues for FieldFunction of Field with Specific Value ALUAddALU adds Subt. ALU subtracts FuncALU does function code OrALU does logical OR SRC1PC1st ALU input <= PC rs1st ALU input <= Reg[rs] SRC242nd ALU input <= 4 Extend2nd ALU input <= sign ext. IR[15-0] Extend02nd ALU input <= zero ext. IR[15-0] Extshft2nd ALU input <= sign ex., sl IR[15-0] rt2nd ALU input <= Reg[rt] dest(ination)rd ALUReg[rd] <= ALUout rt ALUReg[rt] <= ALUout rt Mem Reg[rt] <= Mem Mem(ory)Read PCRead memory using PC Read ALURead memory using ALUout for addr Write ALUWrite memory using ALUout for addr MemregIRIR <= Mem PCwritePCwrPC <= PCSource PCSrc IF Zero then PCSource <= ALUout else ALU PCWrCond I F Zero then PC <= PCSource Seq(uencing)SeqGo to sequential µinstruction FetchGo to the first microinstruction DispatchDispatch using ROM. ALUSRC 1 SRC 2 DestMemMemregPCwriteSeq

CS152 Lec ) Encode each field Field NameWidthControl Signals Set wide narrow ALU 42ALUOp SRC121ALUSelA SRC253ALUSelB, ExtOp Dest32RegWrite, MemtoReg, RegDst Mem32MemRd, MemWre, IorD Memreg11IRWrite PCWrite31PCWr, PCSrc, PCWrCond Seq32AddrCtl Total width2414bits

CS152 Lec ) Encode each field (cont.) CodeNameRegWriteMemToRegRegDest XX 01rd ALU101 10rt ALU100 11rt MEM110 CodeNameALUSelBExtOp XX X 010rt01X 011ExtShft Extend Extend0110 Dest: SRC2:

CS152 Lec11.27 Finally – Do the microprogram…. Label ALU SRC1SRC2Dest.Memory MemReg. PCWrite Seq Fetch:AddPC4Read PCIRPCwrSeq AddPCExtshftDispatch Rtype:FuncrsrtSeq rd ALUFetch Ori:Orrs Extend0 Seq rt ALUFetch Lw:AddrsExtend Seq Read ALU Seq rt MEM Fetch Sw:AddrsExtendSeq Write ALUFetch Beq:Subt.rsrt PCWrCond.Fetch

CS152 Lec11.28 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

CS152 Lec11.29 Adding a more complex memory model PC Instruction Memory Inst. Reg addr data IR_en InstMem_rd IM_wait Add a wait flag of indeterminate length – IM_wait (due to caching)

CS152 Lec11.30 Controller handles non-ideal memory IR <= MEM[PC] R-type A <= R[rs] B <= R[rt] S <= A fun B R[rd] <= S PC <= PC + 4 S <= A or ZX R[rt] <= S PC <= PC + 4 ORi S <= A + SX R[rt] <= M PC <= PC + 4 M <= MEM[S] LW S <= A + SX MEM[S] <= B BEQ PC <= Next(PC) SW “instruction fetch” “decode / operand fetch” Execute Memory Write-back ~IMwait IMwait ~waitwait PC <= PC + 4 ~wait wait

CS152 Lec11.31 Really Simple Time-State Control instruction fetch decode Execute Memory IR <= MEM[PC] R-type A <= R[rs] B <= R[rt] S <= A fun B R[rd] <= S PC <= PC + 4 S <= A or ZX R[rt] <= S PC <= PC + 4 ORi S <= A + SX R[rt] <= M PC <= PC + 4 M <= MEM[S] LW S <= A + SX MEM[S] <= B BEQ PC <= Next(PC) SW ~IMwait IMwait wait PC <= PC + 4 wait write-back

CS152 Lec11.32 Time-state Control Path °Local decode and control at each stage Exec Reg. File Mem Acces s Data Mem ABSM Reg File Equal PC Next PC IR Inst. Mem Valid IRex Dcd Ctrl IRmem Ex Ctrl IRwb Mem Ctrl WB Ctrl

CS152 Lec11.33 Overview of Control °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 Representation Finite State Diagram Microprogram Sequencing ControlExplicit Next State Microprogram counter Function + Dispatch ROMs Logic RepresentationLogic EquationsTruth Tables Implementation PLAROM Technique “hardwired control”“microprogrammed control”

CS152 Lec11.34 Summary °Specialize state-diagrams easily captured by microsequencer simple increment & “branch” fields datapath control fields °Most microprogramming-based controllers vary between: horizontal organization (1 control bit per control point) vertical organization (fields encoded in the control memory and must be decoded to control something) °Steps: identify control signals, group them, develop “mini language”, then microprogram °Control design reduces to Microprogramming Arbitrarily complicated instructions possible

CS152 Lec11.35 Summary: Microprogramming one inspiration for RISC °If simple instruction could execute at very high clock rate… °If you could even write compilers to produce microinstructions… °If most programs use simple instructions and addressing modes… °If microcode is kept in RAM instead of ROM so as to fix bugs … °If same memory used for control memory could be used instead as cache for “macroinstructions”… °Then why not skip instruction interpretation by a microprogram and simply compile directly into lowest language of machine?