ECE 232 L16.Microprog.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 16 Microprogrammed.

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

1 IKI10230 Pengantar Organisasi Komputer Bab 7: Control Unit 28 Mei 2003 Bobby Nazief Qonita Shahab bahan kuliah:
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 (
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 14 - Multi-Cycle.
CS152 / Kubiatowicz Lec10.1 3/1/99©UCB Spring 1999 CS 152 Computer Architecture and Engineering Lecture 10 Multicycle Controller Design (Continued) Mar.
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.
Adapted from the lecture notes of John Kubiatowicz (UCB)
ECE 232 L15.Miulticycle.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 15 Multi-cycle.
ECE 232 L19.Pipeline2.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 19 Pipelining,
Give qualifications of instructors: DAP
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
CS152 / Kubiatowicz Lec /03/01©UCB Fall 2001 CS 152 Computer Architecture and Engineering Lecture 10 Multicycle Controller Design (Continued) October.
Ceg3420 L11.1 RWB Fall 98,  U.CB CEG3420 Computer Design Lecture 11: Multicycle Controller Design.
CS152 Lec11.1 CS 152 Computer Architecture and Engineering Lecture 11 Multicycle Controller Design (Continued)
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
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,
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
EECC550 - Shaaban #1 Lec # 6 Spring Control may be designed using one of several initial representations. The choice of sequence control,
CPSC 321 Computer Architecture and Engineering Lecture 8 Designing a Multicycle Processor Instructor: Rabi Mahapatra & Hank Walker Adapted from the lecture.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Chapter 4 Sections 4.1 – 4.4 Appendix D.1 and D.2 Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
CPE 442 µprog..1 Intro. To Computer Architecture CpE 442 Microprogramming and Exceptions.
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)
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
1 CS/COE0447 Computer Organization & Assembly Language Multi-Cycle Execution.
Exam 2 Review Two’s Complement Arithmetic Ripple carry ALU logic and performance Look-ahead techniques Basic multiplication and division ( non- restoring)
Gary MarsdenSlide 1University of Cape Town Stages.
1 A single-cycle MIPS processor  An instruction set architecture is an interface that defines the hardware operations which are available to software.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
Overview of Control Hardware Development
Multicycle Implementation
CMCS Computer Architecture Lecture 16 Micro-programming & Exceptions April 2, CMSC411.htm Mohamed Younis.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Single-Cycle Datapath and Control.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Design a MIPS Processor (II)
Multi-Cycle Datapath and Control
CS161 – Design and Architecture of Computer Systems
IT 251 Computer Organization and Architecture
/ Computer Architecture and Design
Systems Architecture I
Multi-Cycle CPU.
Multi-Cycle CPU.
CS/COE0447 Computer Organization & Assembly Language
Processor: Finite State Machine & Microprogramming
CS 704 Advanced Computer Architecture
Chapter Five The Processor: Datapath and Control
The Multicycle Implementation
CSCI206 - Computer Organization & Programming
Processor: Datapath and Control (part 2)
Computer Organization Ellen Walker Hiram College
Chapter Five The Processor: Datapath and Control
Rocky K. C. Chang 6 November 2017
The Multicycle Implementation
Systems Architecture I
Vishwani D. Agrawal James J. Danaher Professor
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
Processor: Multi-Cycle Datapath & Control
Multi-Cycle Datapath Lecture notes from MKP, H. H. Lee and S. Yalamanchili.
Systems Architecture I
Alternative datapath (book): Multiple Cycle Datapath
The Processor: Datapath & Control.
Control Implementation Alternatives For Multi-Cycle CPUs
COMS 361 Computer Organization
Processor: Datapath and Control
CS161 – Design and Architecture of Computer Systems
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

ECE 232 L16.Microprog.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 16 Microprogrammed Control Maciej Ciesielski

ECE 232 L16.Microprog.2 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Outline °Review FSM-based control Structured control logic °Microprogramming Basic concept – sequencing control Designing a microinstruction code Variations: horizontal vs. vertical microprogram °Overview of control State machine vs. microprogram

ECE 232 L16.Microprog.3 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers The Big Picture: Where are We Now? °The Five Classic Components of a Computer °Today’s Topics: microprogrammed control Control Datapath Memory Processor Input Output

ECE 232 L16.Microprog.4 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Controller Design °The state diagrams that 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

ECE 232 L16.Microprog.5 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Example: Jump-Counter op-code Map ROM Counter zero inc load 0000 i i+1 i Zero Increment Load

ECE 232 L16.Microprog.6 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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 & Equal BEQ & ~Equal PC <= PC + 4 PC <= PC + SX || 00 SW “instruction fetch” “decode” Execute Memory Write-back inc loadinc zero inc

ECE 232 L16.Microprog.7 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Our Microsequencer op-code Map ROM Micro-PC Z I L Datapath control taken (from IR) Z = zero I = increment L = load (branch)

ECE 232 L16.Microprog.8 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Microprogram Control Specification 0000?inc load 00011inc 0010xzero xzero xinc0 1 fun xzero xinc0 0 or xzero xinc1 0 add xinc xzero xinc1 0 add xzero µPC TakenNext IRPCOpsExecMemWrite-Back en selA B Ex Sr ALU S R W MM-R Wr Dst R: ORi: LW: SW: BEQ

ECE 232 L16.Microprog.9 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers How Effectively are we utilizing our hardware? °Example: memory is used twice, at different times Avg. mem access per inst = 1 + Flw + Fsw ~ 1.3 if CPI is 4.8, Instr-mem utilization = 1/4.8, Data-mem = 0.3/4.8 °We could reduce HW without hurting performance extra control IR <- Mem[PC] A <- R[rs]; B<– R[rt] S <– A + B R[rd] <– S; PC <– PC+4; S <– A + SX M <– Mem[S] R[rd] <– M; PC <– PC+4; S <– A or ZX R[rt] <– S; PC <– PC+4; S <– A + SX Mem[S] <- B PC <– PC+4; PC < PC+4;PC < PC+SX;

ECE 232 L16.Microprog.10 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers “Princeton” Organization (von Neumann) °Single memory for instruction and data access memory utilization -> 1.3/4.8 °In this case our state diagram does not change several additional control signals must ensure each bus is only driven by one source on each cycle Reg File A B A- Bus B Bus IR S W-Bus PCPC next PC ZXSX Mem

ECE 232 L16.Microprog.11 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Alternative datapath (book): Multiple Cycle Datapath °Minimizes hardware: 1 memory, 1 adder

ECE 232 L16.Microprog.12 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Our Controller FSM Spec “instruction fetch” “decode” Write-back IR <= MEM[PC] PC <= PC A <= R[rs] B <= R[rt] 0001 R-type S <= A fun B R[rd] <= S S <= A op ZX R[rt] <= S ORi S <= A + SX R[rt] <= M M <= MEM[S] LW S <= A + SX MEM[S] <= B SW Execute Memory ~EqualEqual BEQ PC <= PC + SX || S <= A - B

ECE 232 L16.Microprog.13 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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 Historical Note: IBM 360 Series first to distinguish between architecture & organization Same instruction set across wide range of implementations, each with different cost/performance

ECE 232 L16.Microprog.14 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers FSM-based Control Unit to Multi-cycle Datapath Next state Inputs Outputs Combinational logic unit Inputs from Instruction Register OPcode field State Reg OP PS NS

ECE 232 L16.Microprog.15 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Sequencer-based Control Unit Multi-cycle Datapath Types of “branching” Set state to 0 Dispatch (state 1) Use incremented state number Opcode State Reg Inputs Outputs Control Logic 1 Address Select Logic Adder

ECE 232 L16.Microprog.16 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers “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) each of these is mapped into one of these

ECE 232 L16.Microprog.17 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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 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

ECE 232 L16.Microprog.18 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Extreme Horizontal input select N3N2 N1N Incr PC ALU control 1 bit for each loadable register enbMAR enbAC... Potential for error: may generate wrong control combinations (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 simultenously; => encode in single bit which is decoded rather than two separate bits NOTE: encoding should be such that parallel actions supported by datapath should be specifiable in a single microinstruction

ECE 232 L16.Microprog.19 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers More Vertical Format src dst DECDEC DECDEC other control fields next statesinputs MUX Some of these may have nothing to do with registers! Multiformat Microcode: condnext address dstsrcalu DECDEC DECDEC Branch Jump Register Xfer Operation

ECE 232 L16.Microprog.20 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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 (RS), destinations, opcodes, etc. Register File RS1DECRS1DEC RS2DECRS2DEC RDDECRDDEC op rs1 rs2rdIR to control enable signals from control

ECE 232 L16.Microprog.21 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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

ECE 232 L16.Microprog.22 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Designing a Microinstruction Set 1.Start with list of control signals 2.Group signals together that make sense: create “fields” 3.Places 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

ECE 232 L16.Microprog.23 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 1+2. Start with list of control signals, grouped into fields Signal name Effect when deasserted Effect when asserted ALUSelA 1st ALU operand = PC1st ALU operand = Reg[rs] RegWrite NoneReg. is written MemtoReg Reg. write data input = ALUReg. write data input = memory RegDst Reg. dest. no. = rtReg. dest. no. = rd TargetWrite NoneTarget reg. = ALU MemRead NoneMemory at address is read MemWrite NoneMemory at address is written IorD Memory address = PCMemory address = ALU IRWrite NoneIR = Memory PCWrite NonePC = PCSource PCWriteCond NoneIF ALUzero then PC = PCSource Single Bit Control ALUOp00ALU adds 01ALU subtracts 10ALU does function code 11ALU does logical OR ALUSelB0002nd ALU input = Reg[rt] 0012nd ALU input = nd ALU input = sign extended IR[15-0] 0112nd ALU input = sign extended, shift left 2 IR[15-0] 1002nd ALU input = zero extended IR[15-0] PCSource00PC = ALU 01PC = Target 10PC = PC+4[29-26] : IR[25–0] << 2 Multiple Bit Control

ECE 232 L16.Microprog.24 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Start with list of control signals, cont’d ° For next state function (next microinstruction address), use sequencer-based control unit Called “microPC” or “µPC” vs. state register µaddress Select Logic Signal Effect 00 next µaddress = 0 01 next µaddress = dispatch ROM 10 next µaddress = µaddress + 1 Opcode microPC 1 Adder ROM Mux Sequencing Datapath Microcode storage (ROM)

ECE 232 L16.Microprog.25 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 3. Microinstruction Format: unencoded vs. encoded fields Field Name WidthControl Signals Set wide narrow ALU Control42ALUOp SRC121ALUSelA SRC253ALUSelB ALU Destination64RegWrite, MemtoReg, RegDst, TargetWr. Memory43MemRead, MemWrite, IorD Memory Register11IRWrite PCWrite Control54PCWrite, PCWriteCond, PCSource Sequencing32AddrCtl Total width3020bits

ECE 232 L16.Microprog.26 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 4. Legend of Fields and Symbolic Names Field Name Field values Field function with specific value ALUAddALU adds Subt. ALU subtracts Func codeALU 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] ALU destinationTargetTarget = ALUout rdReg[rd] = ALUout MemoryRead PCRead memory using PC Read ALURead memory using ALU output Write ALUWrite memory using ALU output Memory registerIRIR = Mem Write rtReg[rt] = Mem Read rtMem = Reg[rt] PC writeALUPC = ALU output Target-cond.IF ALU Zero then PC = Target jump addr.PC = PCSource SequencingSeqGo to sequential µinstruction FetchGo to the first microinstruction DispatchDispatch using ROM.

ECE 232 L16.Microprog.27 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Microprogram it yourself! LabelALU SRC1SRC2ALU Dest.MemoryMem. Reg. PC Write Sequencing FetchAddPC4Read PCIRALUSeq AddPCExtshftTargetDispatch LWAddrsExtend Seq Read ALUWrite rtFetch SWAddrsExtendSeq Write ALURead rtFetch RtypeFuncrsrtSeq rdFetch BEQ1Subt.rsrtTarget– cond.Fetch JUMP1jump addressFetch ORIOrrs Extend0 Seq rdFetch

ECE 232 L16.Microprog.28 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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”

ECE 232 L16.Microprog.29 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers 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

ECE 232 L16.Microprog.30 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers Summary °Specialize state-diagrams easily captured by microsequencer simple increment & “branch” fields datapath control fields °Control design reduces to Microprogramming °Exceptions are the hard part of control – to be discussed later °Need to find convenient place to detect exceptions and to branch to state or microinstruction that saves PC and invokes the operating system °As we get pipelined CPUs that support page faults on memory accesses which means that the instruction cannot complete AND you must be able to restart the program at exactly the instruction with the exception, it gets even harder