CDA 3101 Spring 2016 Introduction to Computer Organization Microprogramming and Exceptions 08 March 2016.

Slides:



Advertisements
Similar presentations
CS/COE1541: Introduction to Computer Architecture Datapath and Control Review Sangyeun Cho Computer Science Department University of Pittsburgh.
Advertisements

Adding the Jump Instruction
CIS 314 Fall 2005 MIPS Datapath (Single Cycle and Multi-Cycle)
1 Chapter Five The Processor: Datapath and Control.
CS-447– Computer Architecture Lecture 12 Multiple Cycle Datapath
Chapter 5 The Processor: Datapath and Control Basic MIPS Architecture Homework 2 due October 28 th. Project Designs due October 28 th. Project Reports.
Fall 2007 MIPS Datapath (Single Cycle and Multi-Cycle)
Lec 17 Nov 2 Chapter 4 – CPU design data path design control logic design single-cycle CPU performance limitations of single cycle CPU multi-cycle CPU.
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
Advanced Computer Architecture 5MD00 / 5Z033 MIPS Design data path and control Henk Corporaal TUEindhoven 2007.
1 The Processor: Datapath and Control We will design a microprocessor that includes a subset of the MIPS instruction set: –Memory access: load/store word.
Class 9.1 Computer Architecture - HUJI Computer Architecture Class 9 Microprogramming.
S. Barua – CPSC 440 CHAPTER 5 THE PROCESSOR: DATAPATH AND CONTROL Goals – Understand how the various.
The Processor Data Path & Control Chapter 5 Part 4 – Exception Handling N. Guydosh 3/1/04+
Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Computing Systems The Processor: Datapath and Control.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
COSC 3430 L08 Basic MIPS Architecture.1 COSC 3430 Computer Architecture Lecture 08 Processors Single cycle Datapath PH 3: Sections
1 For some program running on machine X, Performance X = 1 / Execution time X "X is n times faster than Y" Performance X / Performance Y = n Problem:
The Processor: Datapath and Control. Outline Goals in processor implementation Brief review of sequential logic design Pieces of the processor implementation.
Computer Architecture Chapter 5 Fall 2005 Department of Computer Science Kent State University.
Chapter 5 Processor Design. Spring 2005 ELEC 5200/6200 From Patterson/Hennessey Slides We're ready to look at an implementation of the MIPS Simplified.
EECS 322: Computer Architecture
1 Computer Organization & Design Microcode for Control Sec. 5.7 (CDROM) Appendix C (CDROM) / / pdf / lec_3a_notes.pdf.
CPE232 Basic MIPS Architecture1 Computer Organization Multi-cycle Approach Dr. Iyad Jafar Adapted from Dr. Gheith Abandah slides
Exam 2 Review Two’s Complement Arithmetic Ripple carry ALU logic and performance Look-ahead techniques Basic multiplication and division ( non- restoring)
CDA 3101 Fall 2013 Introduction to Computer Organization
C HAPTER 5 T HE PROCESSOR : D ATAPATH AND C ONTROL M ULTICYCLE D ESIGN.
CDA 3101 Fall 2013 Introduction to Computer Organization Multicycle Datapath 9 October 2013.
Gary MarsdenSlide 1University of Cape Town Stages.
Multicycle Implementation
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 16 - Multi-Cycle.
Chapter 4 From: Dr. Iyad F. Jafar Basic MIPS Architecture: Multi-Cycle Datapath and Control.
Design a MIPS Processor (II)
CS161 – Design and Architecture of Computer Systems
Exceptions Another form of control hazard Could be caused by…
IT 251 Computer Organization and Architecture
Chapter 5 The Processor: Datapath and Control
/ Computer Architecture and Design
Systems Architecture I
Computer Organization & Design Microcode for Control Sec. 5
Extensions to the Multicycle CPU
CS/COE0447 Computer Organization & Assembly Language
Multiple Cycle Implementation of MIPS-Lite CPU
CS/COE0447 Computer Organization & Assembly Language
CSCE 212 Chapter 5 The Processor: Datapath and Control
Processor: Finite State Machine & Microprogramming
Computer Architecture
Chapter Five The Processor: Datapath and Control
The Multicycle Implementation
Vishwani D. Agrawal James J. Danaher Professor
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
COMS 361 Computer Organization
COSC 2021: Computer Organization Instructor: Dr. Amir Asif
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
Datapath and Control Exceptions
Systems Architecture I
Control Unit (single cycle implementation)
Alternative datapath (book): Multiple Cycle Datapath
Processor: Datapath and Control
CS161 – Design and Architecture of Computer Systems
CS/COE0447 Computer Organization & Assembly Language
Presentation transcript:

CDA 3101 Spring 2016 Introduction to Computer Organization Microprogramming and Exceptions 08 March 2016

Review Multicycle Datapath – 1 cycle per execution step: 1.Instruction Fetch 2.Instruction Decode / Data Fetch 3.ALU op / R-format Execution 4.R-format Completion 5.Memory Access Completion Finite-State Machine -Current State, Next State, Transition Function Finite-State Control -State: Control Signals Asserted -Arc:Requirements for Transition -Can be implemented in hardware (ROM, PLA)

Overview Problems with Finite-State Control - Real processors have Hundreds of States - Thousands of interactions between states - FSC graphical design too small for realistic architectures Solution: Microprogramming - Software-based control design - Control signals => fields in microinstruction - Sequence microinstructions => microprogram Challenges of Microprogramming - Microinstruction design and sequencing - Exception handling

MIPS Microinstruction Format Microinstruction: Abstraction of datapath control FieldSpecifies ALU control ALUop for this clock cycle SRC1Source for first ALU operand SRC2Source for second ALU operand Register ControlRegister read/write, data value written MemoryMemory read/write, data value written Destination register for MemRead PCWrite controlSource for PC (PC+4, BTA, JTA) SequencingHow to choose next microinstruction

Sequencing Modes Specifies how to choose the next microinstruction Incrementation – If current microinstruction at address A, then get the next 32-bit instruction from A + 4 (value = Seq) Branching – Go to the microinstruction that fetches the next MIPS instruction (value = Fetch) Control-Directed Choice – Choose next microinstruction based on control input (value = Dispatch i) Dispatch Tables: Like a jump table in MIPS programming Tell microprogram control where to go to execute a prespecified routine (e.g., a utility program for data fetch)

Instruction Fetch and Decode Microinstructions: Label ALU control SRC1 SRC2 Register control Memory PCWrite Sequencing Fetch Add PC Read PC ALU Seq --- Add PC Extshft Read Dispatch 1 Actions: 1.ALU adds PC+4, puts ALUout in PC, gets next microinstruction 2.ALU adds PC and sign-extended shifted offset to compute BTA, then reads data from register file into buffers A and B

Memory Access Microinstructions: Label ALU control SRC1 SRC2 Register control Memory PCWrite Sequencing Mem1 Add A Extend Dispatch 2 LW Read ALU --- Seq Write MDR Fetch Actions: 1.ALU adds base in A + sign-extended offset => Memory address 2.For load, memory is read at address = ALUout 3.The output of memory is put in the memory data register (MDR) (Store instruction is symmetric)

R-format Execution Microinstructions: Label ALU control SRC1 SRC2 Register control Memory PCWrite Sequencing Rformat1 Func code A B Seq Write ALU Fetch Actions: 1.ALU op specified by funct field of instruction operates on A and B – Result goes to ALUout 2.The result in ALUout is written to the register file and we branch back to the calling point to get the next MIPS instruction

Branch and Jump Microinstructions: Label ALU control SRC1 SRC2 Register control Memory PCWrite Sequencing Beq1 Subt A B ALUout-cond Fetch Jump Jump address Fetch Actions: Branch subtracts A-B in ALU to set Zero output high if A=B, then jumps to BTA computed during instruction decode step Jump transfers control by writing the JTA into the PC Both microinstructions return to the point from which their dispatch table entry was called (e.g., Beq1 or Jump1 call)

Completed Microprogram Dispatch Table 1: Mem1, Rformat1, Beq1, Jump1 Dispatch Table 2: LW2 (load), SW2 (store)

Microprogramming Issues Hardware Implementation - Similar to Finite-State Control - Current State in Register, Transition Function in ROM, PLA - Difference:  prog sequencer uses a c o u n t e r Fallacy: Microprogram is faster - Olden Days: Microprogram store was fast memory - Today: Cache used, no performance advantage - Basis:Easier to modify software than hardware Fallacy: New microinstructions are “free of charge” - Microprogram memory might not be full (at first) - Extra add-on instructions have to be supported in future rev’s.

New Topic: Exceptions Definition: Event causes unexpected transfer of control Types: (1) Exception [overflow] (2) Interrupt [I/O] Difference:Exception generated inside the processor Interrupt associated with external event Challenges: Exception Detection – How to discover exception Exception Handling – What to do MIPS: 2 types – Undefined instruction, Arith. overflow

Exception Detection Undefined Instruction: 1.Add State 10 [Exception] to Finite-State Control 2.Every instruction not lw, sw, beq, R-format, or jump transitions to State 10 Arithmetic Overflow: 1.Recall: ALU has overflow detection logic. So, create a new State 11 in FSC to handle overflow 2.When ALU output Overflow is asserted, then control is transferred to State 11

Exception Handling Two Techniques: EPC/Cause and Vectored Interrupts Vectored Interrupts: 1.Each exception has a distinct address A E associated with it 2.Exception detected => A E for that exception written to PC EPC / Cause: (MIPS practice) 1.Exception detected => Address of instruction saved in $epc Cause register has code for exception 2. Exception handler acts on Cause, tries to restart execution at instruction pointed to by $epc

Mods to MIPS DP for Exceptions 1.New Registers - $epc and Cause (32-bit) 2.New Control Signals – EpcWrite, CauseWrite 3.New Control Line – 0 for undefined instr., 1 for ovflw 4.New Mux Signal for PCsource = 11 2 Old PC inputs: PC+4, BTA, JTA Additional input: A E = C in MIPS Recall: ALU overflow detection already “installed”

New Exception Handling States

New FSC with Exception States

New MIPS Multicycle Datapath

Problems with Exceptions Rollback and Restart - Rollback: Reverse effects of the process - Restart: Do a process or operation over again - Overflow exception detected after ALUout written - This means ALU operation produced an uncorrected error  - Current FSC does not support process restart or rollback How to Fix? - Not easy – Control system design is difficult – Requires much additional HW to do rollback

Conclusions Microprogramming – More tractable for large ISAs Challenge: Getting the fields and signals consistent Pitfall: Microprograms not necessarily faster Pitfall: Add-on microprogram instructions not “for free” Exceptions (internal event) vs. Interrupts (external) – Exception Detection needs Special Hardware – Exception Handling needs more hardware ($$$$)

Lookahead: Next Exam Covers… MIPS programs, Pointers and Arrays Arithmetic/Logic operations, ALUs, MIPS ALU Boolean Arithmetic (signed and unsigned +, -, x, /) Floating Point Operations and Datapath/Pipelining Next Topic: Pipelining !! Have a Happy Spring Break