ECE/CS 552: Microprogramming and Exceptions Instructor: Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by.

Slides:



Advertisements
Similar presentations
1  1998 Morgan Kaufmann Publishers Summary:. 2  1998 Morgan Kaufmann Publishers How many cycles will it take to execute this code? lw $t2, 0($t3) lw.
Advertisements

Computer Organization and Architecture
Computer Organization and Architecture
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
ECE 232 L15.Microprog.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 15 Microprogrammed.
Architectural Support for Operating Systems. Announcements Most office hours are finalized Assignments up every Wednesday, due next week CS 415 section.
Interrupts STOP!!! Do this!!!. CMPE12cGabriel Hugh Elkaim 2 Interrupts Have device tell OS/CPU it is ready Requires hardware to support. OS/CPU can then.
Microprogramming Andreas Klappenecker CPSC321 Computer Architecture.
CSCE 212 Chapter 5 The Processor: Datapath and Control Instructor: Jason D. Bakos.
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
Chapter 16 Control Unit Implemntation. A Basic Computer Model.
Preparation for Midterm Binary Data Storage (integer, char, float pt) and Operations, Logic, Flip Flops, Switch Debouncing, Timing, Synchronous / Asynchronous.
Computer System Organization S H Srinivasan
EENG449b/Savvides Lec 4.1 1/22/04 January 22, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
Chapter 15 IA 64 Architecture Review Predication Predication Registers Speculation Control Data Software Pipelining Prolog, Kernel, & Epilog phases Automatic.
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+
ECE 232 L23.Exceptions.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 23 Exceptions.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Chapter 10 The Stack Stack: An Abstract Data Type An important abstraction that you will encounter in many applications. We will describe two uses:
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Multi-Cycle Processor.
2015/10/22\course\cpeg323-08F\Final-Review F.ppt1 Midterm Review Introduction to Computer Systems Engineering (CPEG 323)
6.004 – Fall /29/0L15 – Building a Beta 1 Building the Beta.
Chapter 16 Micro-programmed Control
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
© 2004, D. J. Foreman 1 Computer Organization. © 2004, D. J. Foreman 2 Basic Architecture Review  Von Neumann ■ Distinct single-ALU & single-Control.
EECS 322: Computer Architecture
1 Computer Organization & Design Microcode for Control Sec. 5.7 (CDROM) Appendix C (CDROM) / / pdf / lec_3a_notes.pdf.
Ted Pedersen – CS 3011 – Chapter 10 1 A brief history of computer architectures CISC – complex instruction set computing –Intel x86, VAX –Evolved from.
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
1 CSE451 Architectural Supports for Operating Systems Autumn 2002 Gary Kimura Lecture #2 October 2, 2002.
Microprogramming and Exceptions Spring 2005 Ilam University.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
CS152 Lec12.1 CS 152 Computer Architecture and Engineering Lecture 12 Multicycle Controller Design Exceptions.
Basic Elements of Processor ALU Registers Internal data pahs External data paths Control Unit.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 16 - Multi-Cycle.
LECTURE 10 Pipelining: Advanced ILP. EXCEPTIONS An exception, or interrupt, is an event other than regular transfers of control (branches, jumps, calls,
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
CDA 3101 Spring 2016 Introduction to Computer Organization Microprogramming and Exceptions 08 March 2016.
ECE/CS 552: Pipeline Hazards © Prof. Mikko Lipasti Lecture notes based in part on slides created by Mark Hill, David Wood, Guri Sohi, John Shen and Jim.
Introduction to Exceptions 1 Introduction to Exceptions ARM Advanced RISC Machines.
Exceptions and Interrupts “Unexpected” events requiring change in flow of control – Different ISAs use the terms differently Exception – Arises within.
CS161 – Design and Architecture of Computer Systems
Exceptions Another form of control hazard Could be caused by…
Computer Organization & Design Microcode for Control Sec. 5
Overview Introduction General Register Organization Stack Organization
Multiple Cycle Implementation of MIPS-Lite CPU
Exceptions & Multi-cycle Operations
Pipelining: Advanced ILP
The processor: Exceptions and Interrupts
CSCE 212 Chapter 5 The Processor: Datapath and Control
Processor: Finite State Machine & Microprogramming
Computer Architecture
Chapter Five The Processor: Datapath and Control
ECE/CS 552: Microprogramming and Exceptions
The Multicycle Implementation
The Multicycle Implementation
Architectural Support for OS
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Control Hazards Branches (conditional, unconditional, call-return)
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
ECE/CS 552: Pipelining and Exceptions
Interrupts and exceptions
CMSC 611: Advanced Computer Architecture
Presentation transcript:

ECE/CS 552: Microprogramming and Exceptions Instructor: Mikko H Lipasti Fall 2010 University of Wisconsin-Madison Lecture notes based on set created by Mark Hill.

Microprogramming Alternative way of specifying control FSM –State – bubble –Control signals in bubble –Next state given by signals on arc –Not a great language for specifying complex events Instead, treat as a programming problem

Microprogramming Datapath remains the same Control is specified differently but does the same Each cycle a microprogram field specifies required control signals LabelAluSrc1Src2RegMemoryPcwriteNext? FetchAddPc4Read pcAlu +1 AddPcExtshftReadDispatch 1 Mem1AddAExtendDispatch 2 Lw2Read alu+1 Write mdrfetch

FSM vs. Microprogramming

Benefits of Microprogramming More disciplined control logic –Easier to debug Enables family of machines with same ISA Enables more complex ISA (benefit?) Writeable control store allows late fixes But, in the late 1980’s –CAD tools and PLAs offer similar discipline –Caches make memory almost as fast as control store

State of the Art Specify control –FSM – does not scale easily –Microprogram – works –VHDL/Verilog – preferred Specify control in VHDL/Verilog –CAD compile to PLA –Could use ROM or RAM

Horizontal vs. Vertical Microcode Horizontal –Fewer and wider micro-instructions –Less encoding –Larger control store – may waste space (control lines) Vertical –More and narrower micro-instructions –Dense encoding –Smaller control store – but may need more steps

Intellectual Heritage Microprogramming seems dead But what if technology shifts: –Control store is faster than caches? Also, “Very Long Instruction Word” or VLIW –Origins in microcode optimization research at Yale Josh Fisher, VLIW startup company: Multiflow Trace Now used in Transmeta Crusoe, Intel IA-64, TI DSP family –Explicitly Parallel Instruction-set Computing (EPIC) Microcode specifies parallel hardware operations Can generalize to express any parallel computation Simple hardware (like microcode engine); complex software Operation 1Operation 2Operation 3Operation 4Branch

Exceptions What happens? –Instruction fetch page fault –Illegal opcode –Privileged opcode –Arithmetic overflow –Data page fault –I/O device status change –Power-on/reset

Exceptions For some, we could test for the condition –Arithmetic overflow –I/O device ready (polling) But most tests uselessly say “no” Solution: –Surprise “procedure call” –Called an exception

Exceptions: Big Picture Two types: –Interrupt (asynchronous) or –Trap (synchronous) Hardware handles initial reaction Then invokes a software exception handler –By convention, at e.g. 0xC00 –O/S kernel provides code at the handler address

Exceptions: Hardware Sets state that identifies cause of exception –MIPS: in exception_code field of Cause register Changes to kernel mode for dangerous work ahead Disables interrupts –MIPS: recorded in status register Saves current PC (MIPS: exception PC) Jumps to specific address (MIPS: 0x ) –Like a surprise JAL – so can’t clobber $31

Exceptions: Software Exception handler: –MIPS:.ktext at 0x Set flag to detect incorrect entry –Nested exception while in handler Save some registers Find exception type –E.g. I/O interrupt or syscall Jump to specific exception handler

Exceptions: Software, cont’d Handle specific exception Jump to clean-up to resume user program Restore registers Reset flag that detects incorrect entry Atomically –Restore previous mode (user vs. supervisor) –Enable interrupts –Jump back to program (using EPC)

Implementing Exceptions We worry only about hardware, not s/w IntCause –0 undefined instruction –1 arithmetic overflow Changes to the datapath –Detect exception –Additional source for next PC –Storage for exception cause, return address, spare register New states in control FSM

FSM With Exceptions

Implementing Exceptions New arcs in FSM just like regular arcs FSM more complex if must add many arcs Critical path may get worse Alternative: vectored interrupts –PC = base = f(cause) –E.g. PC = 0x80 + intcause << 7 # 32 instrs –Faster –More hardware, more space

Review TypeControlDatapathTime (CPI, cycle time) Single- cycle CombinationalNo reuse1 cycle, (imem + reg + ALU + dmem) Multi- cycle Combinational + FSM Reuse[3,5] cycles, Max(imem, reg, ALU, dmem) We want? ??~1 cycle, Max(imem, reg, ALU, dmem We will use pipelining to achieve last row