CpE 442. Designing a Multiple Cycle Controller

Similar documents
ECE 361 Computer Architecture Lecture 11: Designing a Multiple Cycle Controller. Review of a Multiple Cycle Implementation

ECE468 Computer Organization and Architecture. Designing a Multiple Cycle Controller

CS152 Computer Architecture and Engineering Lecture 13: Microprogramming and Exceptions. Review of a Multiple Cycle Implementation

361 multipath..1. EECS 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor

Outline of today s lecture. EEL-4713 Computer Architecture Designing a Multiple-Cycle Processor. What s wrong with our CPI=1 processor?

Hardwired Control Unit Ch 14

Hardwired Control Unit Ch 16

Initial Representation Finite State Diagram Microprogram. Sequencing Control Explicit Next State Microprogram counter

ECE4680. Computer Organization and Architecture. Designing a Multiple Cycle Processor

ECE 361 Computer Architecture Lecture 10: Designing a Multiple Cycle Processor

ECE468. Computer Organization and Architecture. Designing a Multiple Cycle Processor

CPU Design Steps. EECC550 - Shaaban

Designing a Multicycle Processor

Lecture 10: Control Unit

Lecture 10: Control Unit

CS152 Computer Architecture and Engineering. Lecture 8 Multicycle Design and Microcode John Lazzaro (

ECE4680. Computer Organization and Architecture. Designing a Multiple Cycle Processor

CS 152 Computer Architecture and Engineering. Lecture 10: Designing a Multicycle Processor

Major CPU Design Steps

CpE242 Computer Architecture and Engineering Designing a Single Cycle Datapath

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

The Big Picture: Where are We Now? CS 152 Computer Architecture and Engineering Lecture 11. The Five Classic Components of a Computer

ECE4680 Computer Organization and Architecture. Designing a Pipeline Processor

361 datapath.1. Computer Architecture EECS 361 Lecture 8: Designing a Single Cycle Datapath

Midterm I October 6, 1999 CS152 Computer Architecture and Engineering

COMP303 - Computer Architecture Lecture 8. Designing a Single Cycle Datapath

Initial Representation Finite State Diagram. Logic Representation Logic Equations

The Big Picture: Where are We Now? EEM 486: Computer Architecture. Lecture 3. Designing a Single Cycle Datapath

ECE468 Computer Organization and Architecture. Designing a Single Cycle Datapath

CS3350B Computer Architecture Winter Lecture 5.7: Single-Cycle CPU: Datapath Control (Part 2)

COMP303 Computer Architecture Lecture 9. Single Cycle Control

CPU Organization (Design)

361 control.1. EECS 361 Computer Architecture Lecture 9: Designing Single Cycle Control

UC Berkeley CS61C : Machine Structures

CS61C : Machine Structures

Midterm I March 12, 2003 CS152 Computer Architecture and Engineering

CS 152 Computer Architecture and Engineering. Lecture 12: Multicycle Controller Design

Recap: A Single Cycle Datapath. CS 152 Computer Architecture and Engineering Lecture 8. Single-Cycle (Con t) Designing a Multicycle Processor

CC 311- Computer Architecture. The Processor - Control

CS 61C: Great Ideas in Computer Architecture. MIPS CPU Datapath, Control Introduction

UC Berkeley CS61C : Machine Structures

Ch 5: Designing a Single Cycle Datapath

CS 110 Computer Architecture Single-Cycle CPU Datapath & Control

Midterm I March 1, 2001 CS152 Computer Architecture and Engineering

Outline. EEL-4713 Computer Architecture Designing a Single Cycle Datapath

CS 61C: Great Ideas in Computer Architecture Datapath. Instructors: John Wawrzynek & Vladimir Stojanovic

Lecture #17: CPU Design II Control

Midterm I SOLUTIONS October 6, 1999 CS152 Computer Architecture and Engineering

MIPS-Lite Single-Cycle Control

CPE 335. Basic MIPS Architecture Part II

How to design a controller to produce signals to control the datapath

EEM 486: Computer Architecture. Lecture 3. Designing Single Cycle Control

UC Berkeley CS61C : Machine Structures

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Single- Cycle CPU Datapath & Control Part 2

Full Datapath. CSCI 402: Computer Architectures. The Processor (2) 3/21/19. Fengguang Song Department of Computer & Information Science IUPUI

CS61C : Machine Structures

Single Cycle CPU Design. Mehran Rezaei

CS 61C: Great Ideas in Computer Architecture (Machine Structures) Lecture 28: Single- Cycle CPU Datapath Control Part 1

Lecture 5 and 6. ICS 152 Computer Systems Architecture. Prof. Juan Luis Aragón

CS61C : Machine Structures

CSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Today s Content

CS359: Computer Architecture. The Processor (A) Yanyan Shen Department of Computer Science and Engineering

Multicycle Approach. Designing MIPS Processor

Chapter 4. The Processor. Computer Architecture and IC Design Lab

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

Implementing the Control. Simple Questions

Multicycle conclusion

Review. N-bit adder-subtractor done using N 1- bit adders with XOR gates on input. Lecture #19 Designing a Single-Cycle CPU

ECE170 Computer Architecture. Single Cycle Control. Review: 3b: Add & Subtract. Review: 3e: Store Operations. Review: 3d: Load Operations

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 19 CPU Design: The Single-Cycle II & Control !

Working on the Pipeline

inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 18 CPU Design: The Single-Cycle I ! Nasty new windows vulnerability!

CS 61C: Great Ideas in Computer Architecture Control and Pipelining

Lecture 6 Datapath and Controller

The Processor: Datapath & Control

CS152 Computer Architecture and Engineering Lecture 10: Designing a Single Cycle Control. Recap: The MIPS Instruction Formats

Micro-programmed Control Ch 15

Machine Instructions vs. Micro-instructions. Micro-programmed Control Ch 15. Machine Instructions vs. Micro-instructions (2) Hardwired Control (4)

Micro-programmed Control Ch 15

CENG 3420 Lecture 06: Datapath

Instructor: Randy H. Katz hcp://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #18. Warehouse Scale Computer

ENE 334 Microprocessors

Mapping Control to Hardware

Adding Support for jal to Single Cycle Datapath (For More Practice Exercise 5.20)

Lets Build a Processor

Review: Abstract Implementation View

Systems Architecture I

Micro-programmed Control Ch 17

Laboratory 5 Processor Datapath

The Processor: Datapath & Control

Hardwired Control (4) Micro-programmed Control Ch 17. Micro-programmed Control (3) Machine Instructions vs. Micro-instructions

The MIPS Processor Datapath

CPU Organization Datapath Design:

Lecture 12: Single-Cycle Control Unit. Spring 2018 Jason Tang

Lecture Topics. Announcements. Today: Single-Cycle Processors (P&H ) Next: continued. Milestone #3 (due 2/9) Milestone #4 (due 2/23)

University of California College of Engineering Computer Science Division -EECS. CS 152 Midterm I

CENG 3420 Computer Organization and Design. Lecture 06: MIPS Processor - I. Bei Yu

Topic #6. Processor Design

ECE369. Chapter 5 ECE369

ELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control

Transcription:

CpE 442 Designing a Multiple Cycle Controller CPE 442 multicontroller..

Outline of Today s Lecture Recap (5 minutes) Review of FSM control (5 minutes) From Finite State Diagrams to Microprogramming (25 minutes) ABCs of microprogramming (25 minutes) CPE 442 multicontroller..2

Review 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 - Keep all the steps to 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 - Load takes five cycles - Jump only takes three cycles Allows a functional unit to be used more than once per instruction CPE 442 multicontroller..3

Review: Instruction Fetch Cycle, In the Beginning Every cycle begins right AFTER the clock tick: mem[pc] PC<3:> + 4 Clk You are here! One Logic Clock Cycle PCWr=? Clk PC MemWr=? RAdr Ideal Memory WrAdr Dout Din IRWr=? Instruction Reg 4 ALUop=? ALU ALU Control CPE 442 multicontroller..4 Clk

Review: Instruction Fetch Cycle, The End Every cycle ends AT the next clock tick (storage element updates): IR <-- mem[pc] PC<3:> <-- PC<3:> + 4 Clk One Logic Clock Cycle PCWr= You are here! Clk PC MemWr= RAdr Ideal Memory WrAdr Din Dout IRWr= Instruction Reg 4 ALUOp = Add ALU ALU Control Clk CPE 442 multicontroller..5

Putting it all together: Multiple Cycle Datapath PCWr PC IorD PCWrCond PCSrc BrWr Zero MemWr IRWr RegDst RegWr ALUSelA Target RAdr Ideal Memory WrAdr Din Dout Instruction Reg Rs Rt Rt Rd 5 5 Ra Rb Reg File Rw busa busw busb << 2 4 2 3 ALU ALU Control Zero Imm 6 ExtOp Extend MemtoReg ALUSelB ALUOp CPE 442 multicontroller..6

PCWr= PC Instruction Fetch Cycle: Overall Picture PCWrCond=x PCSrc= BrWr= Zero IorD= MemWr= IRWr= ALUSelA= Target RAdr Ideal Memory WrAdr Din Dout Instruction Reg Ifetch ALUOp=Add : PCWr, IRWr x: PCWrCond RegDst, Mem2R Others: s busa busb 4 2 3 ALU ALU Control Zero ALUSelB= ALUOp=Add CPE 442 multicontroller..7

Register Fetch / Instruction Decode (Continue) busa <- Reg[rs] ; busb <- Reg[rt] ; Target <- PC + SignExt(Imm6)*4 PCWr= PCWrCond= Zero IorD=x MemWr= PC Beq Rtype Ori Memory : RAdr CPE 442 multicontroller..8 Ideal Memory WrAdr Din Dout Op IRWr= Instruction Reg Control 6 Func 6 RegDst=x Rs Rt Rt Rd Imm 6 ExtOp= 5 5 Extend RegWr= Ra Rb Reg File Rw Rfetch/Decode ALUOp=Add : BrWr, ExtOp ALUSelB= x: RegDst, PCSrc IorD, MemtoReg Others: s busa busw busb ALUSelA= << 2 4 PCSrc=x 2 3 ALUSelB= BrWr= ALU ALU Control Target Zero ALUOp=Add

R-type Execution ALU Output <- busa op busb PCWr= PCWrCond= ExtOp PCSrc=x BrWr= Zero IorD=x MemWr= IRWr= RegDst= RegWr= ALUSelA= Target PC RAdr Ideal Memory WrAdr Din Dout Instruction Reg Rs Rt Rt Rd RExec 5 5 : RegDst ALUSelA ALUSelB= ALUOp=Rtype x: PCSrc, IorD MemtoReg Ra Rb Reg File Rw busa busw busb << 2 4 2 3 ALU ALU Control Zero Imm 6 ExtOp=x Extend MemtoReg=x ALUOp=Rtype ALUSelB= CPE 442 multicontroller..9

R-type Completion R[rd] <- ALU Output PCWr= PCWrCond= ExtOp PCSrc=x BrWr= Zero IorD=x MemWr= IRWr= RegDst= RegWr= ALUSelA= Target PC RAdr Ideal Memory WrAdr Din Dout Instruction Reg Rs Rt Rt Rd Rfinish 5 5 ALUOp=Rtype : RegDst, RegWr ALUselA ALUSelB= x: IorD, PCSrc Ra Rb Reg File Rw busa busw busb << 2 4 2 3 ALU ALU Control Zero Imm 6 ExtOp=x Extend MemtoReg= ALUOp=Rtype ALUSelB= CPE 442 multicontroller..

Outline of Today s Lecture Recap (5 minutes) Review of FSM control (5 minutes) From Finite State Diagrams to Microprogramming (25 minutes) ABCs of microprogramming (25 minutes) CPE 442 multicontroller..

Overview of Next Two Lectures 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 Control Explicit Next State Microprogram counter Function + Dispatch ROMs Logic Representation Logic Equations Truth Tables Implementation Technique PLA ROM hardwired control microprogrammed control CPE 442 multicontroller..2

2 Initial Representation: Finite State Diagram AdrCal 4 lw Ifetch : ExtOp ALUSelA ALUSelB= ALUOp=Add x: MemtoReg PCSrc : ExtOp ALUSelA, IorD ALUSelB= ALUOp=Add x: MemtoReg PCSrc LWwr 3 LWmem ALUOp=Add : PCWr, IRWr x: PCWrCond RegDst, Mem2R Others: s sw : ALUSelA RegWr, ExtOp MemtoReg ALUSelB= ALUOp=Add x: PCSrc IorD 5 lw or sw SWMem : ExtOp MemWr ALUSelA ALUSelB= ALUOp=Add x: PCSrc,RegDst MemtoReg 6 7 Rfetch/Decode 8 ALUOp=Add : BrWr, ExtOp ALUSelB= x: RegDst, PCSrc IorD, MemtoReg Others: s RExec Rfinish Rtype Ori : RegDst ALUSelA ALUSelB= ALUOp=Rtype x: PCSrc, IorD MemtoReg ExtOp beq ALUOp=Rtype : RegDst, RegWr ALUselA ALUSelB= x: IorD, PCSrc ExtOp BrComplete ALUOp=Sub ALUSelB= x: IorD, Mem2Reg RegDst, ExtOp : PCWrCond ALUSelA PCSrc OriExec ALUOp=Or : ALUSelA ALUSelB= x: MemtoReg IorD, PCSrc ALUOp=Or x: IorD, PCSrc ALUSelB= : ALUSelA RegWr OriFinish CPE 442 multicontroller..3

Sequencing Control: Explicit Next State Function Control Logic Inputs O u t p u t s Multicycle Datapath Opcode State Reg Next state number is encoded just like datapath controls CPE 442 multicontroller..4

Logic Representative: Logic Equations Next state from current state State -> State State -> S2, S6, S8, S State 2 -> State 3 -> State 4 ->State State 5 -> State State 6 -> State 7 State 7 -> State State 8 -> State State 9-> State State -> State State -> State Alternatively, prior state & condition S4, S5, S7, S8, S9, S -> State -> State -> State 2 State2 & op = lw -> State 3 -> State 4 State2 & op = sw -> State 5 -> State 6 State 6 -> State 7 -> State 8 State & op = jmp -> State 9 -> State State -> State CPE 442 multicontroller..5

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 Op Op S3 S2 S S = = 2 = 3 = 4 = 5 = 6 = 7 = 8 = 9 = = = CPE 442 multicontroller..6 R = beq = lw = sw = ori = jmp = NS3 NS2 NS NS

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 Op Op S3 S2 S S = = 2 = 3 = 4 = 5 = 6 = 7 = 8 = 9 = = = CPE 442 multicontroller..7 lw = sw = R = ori = beq = jmp = NS3 NS2 NS NS

Multicycle Control Given numbers of FSM, can turn determine next state as function of inputs, including current state Turn these into Boolean equations for each bit of the next state lines Can implement easily using PLA What if many more states, many more conditions? What if need to add a state? CPE 442 multicontroller..8

Outline of Today s Lecture Recap (5 minutes) Review of FSM control (5 minutes) From Finite State Diagrams to Microprogramming ABCs of microprogramming (25 minutes) CPE 442 multicontroller..9

Next Iteration: Using Sequencer for Next State Before Explicit Next State: Next try variation step from right hand side Initial Representation Finite State Diagram Microprogram Sequencing Control Explicit Next State Microprogram counter Function + Dispatch ROMs Logic Representation Logic Equations Truth Tables Implementation Technique PLA ROM hardwired control microprogrammed control CPE 442 multicontroller..2

Sequencer-based control unit Control Logic Outputs To Multicycle Data path Control Signals Adder Inputs State Reg MicroPC Address Select Logic Types of branching Set state to Dispatch (state & 2) Use incremented state number CPE 442 multicontroller..2 Opcode

Sequencer-based control unit details Adder Address Select Logic Control Logic Inputs State Reg 3 2 ROM2 Opcode ROM Dispatch ROM Op Name State Rtype jmp beq ori lw sw Dispatch ROM 2 Op Name State lw sw CPE 442 multicontroller..22

Next Iteration: Using a ROM for implementation Initial Representation Finite State Diagram Microprogram Sequencing Control Explicit Next State Microprogram counter Function + Dispatch ROMs Logic Representation Logic Equations Truth Tables Implementation Technique PLA ROM hardwired control microprogrammed control CPE 442 multicontroller..23

Implementing Control with a ROM Instead of a PLA, use a ROM with one word per state ( Control word ) State number Control Word Bits 8-2 Control Word Bits - 2 3 4 5 6 7 8 9 CPE 442 multicontroller..24

Next Iteration: Using Microprogram for Representation Initial Representation Finite State Diagram Microprogram Sequencing Control Explicit Next State Microprogram counter Function + Dispatch ROMs Logic Representation Logic Equations Truth Tables Implementation Technique PLA ROM hardwired control microprogrammed control ROM can be thought of as a sequence of control words Control word can be thought of as instruction: microinstruction Rather than program in binary, use assembly language CPE 442 multicontroller..25

Outline of Today s Lecture Recap (5 minutes) Review of FSM control (5 minutes) From Finite State Diagrams to Microprogramming (25 minutes) ABCs of microprogramming CPE 442 multicontroller..26

Microprogramming: General Concepts 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 CPE 442 multicontroller..27

Macroinstruction Interpretation Main Memory execution unit ADD SUB AND... DATA The Application Program User program plus Data this can change! one of these is mapped into one of these CPU control memory mem[pc], PC <- PC + 4,cycle Bus A<- R[rs], Bus A<- R[rt], Decode ( e.g. go to ADD) Example Microprogram segment ADD: ALU out<- R[rs] + R[rt] R[rd] <- ALU out CPE 442 multicontroller..28 The Micro Program microsequence e.g., Fetch Calc Operand Addr Fetch Operand(s) Calculate Save Answer(s)

Variations on Microprogramming Horizontal Microcode control field for each control point in the machine µseq µaddr A-mux B-mux bus enables register enables Vertical Microcode compact microinstruction format for each class of microoperation branch: execute: memory: µseq-op µadd ALU-op A,B,R mem-ops, D Vertical Micro Horizontal Micro Instructions Instructions CPE 442 multicontroller..29

Extreme Horizontal... 3 N3 N2 N N input select bit for each loadable register enbmar enbac... Incr PC ALU control Depending on bus organization, many potential control combinations simply not wrong, i.e., implies transfers that can never happen at the same time. Makes sense to encode fields to save ROM space Example: gate Rx and gate Ry to same bus should never happen encoded in single bit which is decoded rather than two separate bits NOTE: encoding should be just sufficient that parallel actions that the datapath supports should still be specifiable in a single microinstruction CPE 442 multicontroller..3

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 ( 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 CPE 442 multicontroller..3

Vax Microinstructions VAX Microarchitecture: 96 bit control store, 3 fields, 496 µinstructions for VAX ISA encodes concurrently executable "microoperations" 95 87 84 68 65 USHF UALU USUB UJMP 63 = left = right... = left3 = A-B- = A+B+ ALU Control = Nop = CALL = RTN Subroutine Control Jump Address ALU Shifter Control CPE 442 multicontroller..

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 CPE 442 multicontroller..33

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? CPE 442 multicontroller..34

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 Representation Finite State Diagram Microprogram Sequencing Control Explicit Next State Microprogram counter Function + Dispatch ROMs Logic Representation Logic Equations Truth Tables Implementation Technique PLA ROM hardwired control microprogrammed control CPE 442 multicontroller..35