Extensions to the Multicycle CPU

Slides:



Advertisements
Similar presentations
Pipeline Example: cycle 1 lw R10,9(R1) sub R11,R2, R3 and R12,R4, R5 or R13,R6, R7.
Advertisements

Microprocessor Design Multi-cycle Datapath Nia S. Bradley Vijay.
{ CPU Design-Project CPU Design-Project Multicycle Datapath with Finite State Machine as Control Unit N.S.V Ravi Tej Uppu.
1 Chapter Five The Processor: Datapath and Control.
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
EECE476 Lecture 9: Multi-cycle CPU Datapath Chapter 5: Section 5.5 The University of British ColumbiaEECE 476© 2005 Guy Lemieux.
1 5.5 A Multicycle Implementation A single memory unit is used for both instructions and data. There is a single ALU, rather than an ALU and two adders.
©UCB CS 161Computer Architecture Chapter 5 Lecture 11 Instructor: L.N. Bhuyan Adapted from notes by Dave Patterson (http.cs.berkeley.edu/~patterson)
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
Advanced Computer Architecture 5MD00 / 5Z033 MIPS Design data path and control Henk Corporaal TUEindhoven 2007.
331 W10.1Spring :332:331 Computer Architecture and Assembly Language Spring 2005 Week 10 Building a Multi-Cycle Datapath [Adapted from Dave Patterson’s.
CSE431 L05 Basic MIPS Architecture.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 05: Basic MIPS Architecture Review Mary Jane Irwin.
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
CMPE 421 Advanced Computer Architecture Supplementary material for Pipelining PART1.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
Computer Architecture Chapter 5 Fall 2005 Department of Computer Science Kent State University.
Datapath and Control: MultiCycle Implementation. Performance of Single Cycle Machines °Assume following operation times: Memory units : 200 ps ALU and.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
C HAPTER 5 T HE PROCESSOR : D ATAPATH AND C ONTROL M ULTICYCLE D ESIGN.
Gary MarsdenSlide 1University of Cape Town Stages.
1 Processor: Datapath and Control Single cycle processor –Datapath and Control Multicycle processor –Datapath and Control Microprogramming –Vertical and.
Multicycle Implementation
ECE-C355 Computer Structures Winter 2008 The MIPS Datapath Slides have been adapted from Prof. Mary Jane Irwin ( )
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
Fall 2015, Sep ELEC / Lecture 5 1 ELEC / Computer Architecture and Design Fall 2015 Datapath and Control (Chapter.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 16 - Multi-Cycle.
PC Instruction Memory Address Instr. [31-0] 4 Fig 4.6 p 309 Instruction Fetch.
Datapath and Control AddressInstruction Memory Write Data Reg Addr Register File ALU Data Memory Address Write Data Read Data PC Read Data Read Data.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 Part 2.
RegDst 1: RegFile destination No. for the WR Reg. comes from rd field. 0: RegFile destination No. for the WR Reg. comes from rt field.
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 10: Control Design
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Design a MIPS Processor (II)
Single-cycle CPU Control
Access the Instruction from Memory
Single Cycle CPU - Control
Multi-Cycle Datapath and Control
Chapter 5: A Multi-Cycle CPU.
Exceptions Another form of control hazard Could be caused by…
IT 251 Computer Organization and Architecture
ECE/CS 552: Multicycle Data Path
Systems Architecture I
Multi-Cycle CPU.
Single Cycle Processor
D.4 Finite State Diagram for the Multi-cycle processor
Multi-Cycle CPU.
Basic MIPS Architecture
Multiple Cycle Implementation of MIPS-Lite CPU
CSCE 212 Chapter 5 The Processor: Datapath and Control
The Multicycle Implementation
CSCI206 - Computer Organization & Programming
Chapter Five The Processor: Datapath and Control
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.
Chapter Four The Processor: Datapath and Control
Control Unit for Multiple Cycle Implementation
5.5 A Multicycle Implementation
Systems Architecture I
Control Unit for Multiple Cycle Implementation
FloorPlan for Multicycle MIPS
Alternative datapath (book): Multiple Cycle Datapath
The Processor: Datapath & Control.
Processor: Datapath and Control
ELEC / Computer Architecture and Design Spring 2015 Pipeline Control and Performance (Chapter 6) Vishwani D. Agrawal James J. Danaher.
Presentation transcript:

Extensions to the Multicycle CPU Additional Instructions Exceptions

addi No new circuits needed third state (after instruction decode) is the same as for lw/sw add the register and the sign-extended immediate fourth state is similar to R-type write-back but RegDst must be 0 call this new state 10

bne branch off zero line with a not combine this line with the zero line in a MUX send result to AND gate with PCWriteCond control with new control line called bne 0 to select beq, 1 to select bne FSM needs a new state similar to Branch completion add the control bne = 1, call this state 11 in the existing branch completion, set bne = 0

Control A B ALUOp PCWriteCond PCSrc bne PCWrite MemWrite ALUSrcA 31-26 1 2 Shift Left 2 bne PCWrite 25-0 PC 31-28 1 MemWrite Zero ALUSrcA MemRead PC IorD IRWrite RegDst RegWrite 1 1 25-21 Read/Write Addr IR Read Reg 1 Read Data 1 A 20-16 A L U Read Reg 2 ALU Out Memory Registers 1 Read Data 2 B 1 2 3 Mem Data Write Reg 4 Write Data 15-11 Write Data 1 ALUSrcB Mem Data Reg Sign Ext Shift Left 2 15-0 ALU Ctrl MemtoReg 5-0 ALUOp

Finite State Machine with addi, bne Instruction Fetch 0 MemRead IorD = 0 IRWrite ALUSrcA = 0 ALUSrcB = 01 ALUOp = 00 PCSrc = 00 PCWrite Instruction Decode 1 ALUSrcA = 0 ALUSrcB = 11 ALUOp = 00 Start lw or sw or addi R-type j ALUSrcA = 1 ALUSrcB = 10 ALUOp = 00 Memory Address Comp 2 bne beq ALUSrcA = 1 ALUSrcB = 00 ALUOp = 10 PCWrite PCSrc = 10 Execution 6 addi Jump Completion 9 ALUSrcA = 1 ALUSrcB = 00 ALUOp = 01 PCWriteCond PCSrc = 01 bne = 1 lw sw RegDst = 0 RegWrite MemtoReg = 0 Write Back 10 Memory Access lw 3 MemRead IorD = 1 ALUSrcA = 1 ALUSrcB = 00 ALUOp = 01 PCWriteCond PCSrc = 01 bne = 0 MemWrite IorD = 1 RegDst = 1 RegWrite MemtoReg = 0 Memory Access sw 5 Branch Completion 11 Write Back 7 RegWrite MemToReg = 1 RegDst = 0 Write Back 4 Branch Completion 8

Exceptions Unexpected or Unscheduled event which causes a change in the flow of instructions Examples: Internal Non-existent opcode Integer overflow Program request to operating system External Interrupt I/O request Hardware malfunction Requires change in instruction sequence

Exception Handling - Multicycle Detection and Cause non-existent opcode -- control overflow -- signal from ALU I/O request -- external signal set register to record cause Save location in program (address of current instruction) register (EPC), needed Change control to exception handling code enter address of exception code into PC

Exception Circuitry - Multicycle Overflow signal to control to detect overflow Register to save address of current instruction EPC (Exception Program Counter) Register to record the cause of the exception As many bits as needed to record the different types of exception 32 bits in MIPS, but not all bits are used Called Cause register Address of exception code through MUX to PC Selected by PCSrc, choice 11

Control A B ALUOp CauseWrite PCWriteCond PCSrc bne PCWrite MemWrite 31-26 bne 1 2 3 4 PCWrite 25-0 Shift Left 2 PC 31-28 C0000000 1 MemWrite Zero ALUSrcA MemRead EPCWrite PC IorD IRWrite RegDst RegWrite 1 1 25-21 Overflow Read/Write Addr IR Read Reg 1 Read Data 1 A 20-16 A L U EPC Read Reg 2 ALU Out Memory Registers 1 Read Data 2 B 1 2 3 Mem Data Write Reg 4 Write Data 15-11 Write Data IntCause 1 ALUSrcB Mem Data Reg C a u s e 1 1 Sign Ext Shift Left 2 15-0 ALU Ctrl MemtoReg 5-0 ALUOp

IntCause = 0; CauseWrite IntCause = 1; CauseWrite Finite State Machine with exceptions 13 Instruction Fetch 1 ALUOp = 01 ALUSrcA = 0; ALUSrcB = 01 IntCause = 0; CauseWrite EPCWrite; PCWrite PCSrc = 11 Instruction Decode/ Register Fetch Start other Ops lw or sw or addi R-type j rfe Mem Addr Comp or Addi Exe 2 bne beq R-Type Execute 6 PCWrite PCSrc = 100 addi 9 jump completion bne completion lw sw Write-back addi 10 3 Mem Access lw beq completion Mem Access sw Write-back R-Type 5 11 7 14 Write-back 4 8 Overflow ALUOp = 01 ALUSrcA = 0; ALUSrcB = 01 IntCause = 1; CauseWrite EPCWrite; PCWrite PCSrc = 11 12

Exception Code Located a fixed memory location Must first save state (as with any function call) At end must restore state Decodes Cause Register to determine type of exception branches to appropriate code Some exceptions cause program to be aborted print appropriate error message

Exception Code Some exceptions take an action run code to handle input from disk/keyboard/mouse run code to handle output to screen/other device The return control to previous program restore state rfe (return from exception) put the address held in the EPC back into the PC previous program continues from point where it was interrupted