Anti-Inspiration. It s true hard work never killed anybody, but I figure, why take the chance? Ronald Reagan, US President

Similar documents
There are different characteristics for exceptions. They are as follows:

Instruction Level Parallelism. ILP, Loop level Parallelism Dependences, Hazards Speculation, Branch prediction

ECE 486/586. Computer Architecture. Lecture # 12

Instruction Pipelining Review

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

Minimizing Data hazard Stalls by Forwarding Data Hazard Classification Data Hazards Present in Current MIPS Pipeline

Chapter 3. Pipelining. EE511 In-Cheol Park, KAIST

Lecture 7: Pipelining Contd. More pipelining complications: Interrupts and Exceptions

CMCS Mohamed Younis CMCS 611, Advanced Computer Architecture 1

CS4617 Computer Architecture

COSC4201 Pipelining. Prof. Mokhtar Aboelaze York University

Appendix C. Instructor: Josep Torrellas CS433. Copyright Josep Torrellas 1999, 2001, 2002,

Predict Not Taken. Revisiting Branch Hazard Solutions. Filling the delay slot (e.g., in the compiler) Delayed Branch

Instr. execution impl. view

EITF20: Computer Architecture Part2.2.1: Pipeline-1

CISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles

EITF20: Computer Architecture Part2.2.1: Pipeline-1

CISC 662 Graduate Computer Architecture Lecture 7 - Multi-cycles. Interrupts and Exceptions. Device Interrupt (Say, arrival of network message)

COSC 6385 Computer Architecture - Pipelining (II)

Advanced issues in pipelining

POLITECNICO DI MILANO. Exception handling. Donatella Sciuto:

Announcement. ECE475/ECE4420 Computer Architecture L4: Advanced Issues in Pipelining. Edward Suh Computer Systems Laboratory

ECE/CS 552: Pipeline Hazards

Appendix C: Pipelining: Basic and Intermediate Concepts

Outline. A pipelined datapath Pipelined control Data hazards and forwarding Data hazards and stalls Branch (control) hazards Exception

MIPS An ISA for Pipelining

EITF20: Computer Architecture Part2.2.1: Pipeline-1

LECTURE 3: THE PROCESSOR

Appendix A. Overview

Slides for Lecture 15

Computer Systems Architecture I. CSE 560M Lecture 5 Prof. Patrick Crowley

Administrivia. CMSC 411 Computer Systems Architecture Lecture 6. When do MIPS exceptions occur? Review: Exceptions. Answers to HW #1 posted

Overview. Appendix A. Pipelining: Its Natural! Sequential Laundry 6 PM Midnight. Pipelined Laundry: Start work ASAP

CS 252 Graduate Computer Architecture. Lecture 4: Instruction-Level Parallelism

Basic Pipelining Concepts

LECTURE 10. Pipelining: Advanced ILP

CMSC 411 Computer Systems Architecture Lecture 6 Basic Pipelining 3. Complications With Long Instructions

EE 457 Unit 8. Exceptions What Happens When Things Go Wrong

Lecture 11: Interrupt and Exception. James C. Hoe Department of ECE Carnegie Mellon University

ECE154A Introduction to Computer Architecture. Homework 4 solution

Pipelining. Principles of pipelining. Simple pipelining. Structural Hazards. Data Hazards. Control Hazards. Interrupts. Multicycle operations

Pipeline Overview. Dr. Jiang Li. Adapted from the slides provided by the authors. Jiang Li, Ph.D. Department of Computer Science

The Processor Pipeline. Chapter 4, Patterson and Hennessy, 4ed. Section 5.3, 5.4: J P Hayes.

Instruction Pipelining

Computer Architecture

Lecture 9. Pipeline Hazards. Christos Kozyrakis Stanford University

Slide Set 7. for ENCM 501 in Winter Term, Steve Norman, PhD, PEng

Modern Computer Architecture

Data Hazards Compiler Scheduling Pipeline scheduling or instruction scheduling: Compiler generates code to eliminate hazard

Pipelining: Basic and Intermediate Concepts

CMCS Mohamed Younis CMCS 611, Advanced Computer Architecture 1

Instruction Level Parallelism. Appendix C and Chapter 3, HP5e

14:332:331 Pipelined Datapath

EI338: Computer Systems and Engineering (Computer Architecture & Operating Systems)

ECS 154B Computer Architecture II Spring 2009

MIPS pipelined architecture

What are Exceptions? EE 457 Unit 8. Exception Processing. Exception Examples 1. Exceptions What Happens When Things Go Wrong

Chapter 4 The Processor 1. Chapter 4A. The Processor

Chapter3 Pipelining: Basic Concepts

COMP2611: Computer Organization. The Pipelined Processor

(Basic) Processor Pipeline

ECE260: Fundamentals of Computer Engineering

Pipelining Analogy. Pipelined laundry: overlapping execution. Parallelism improves performance. Four loads: Non-stop: Speedup = 8/3.5 = 2.3.

COMP 4211 Seminar Presentation

Full Datapath. Chapter 4 The Processor 2

COSC 6385 Computer Architecture - Pipelining

Pipelining. Pipeline performance

ECE 313 Computer Organization FINAL EXAM December 13, 2000

Lecture 3. Pipelining. Dr. Soner Onder CS 4431 Michigan Technological University 9/23/2009 1

Instruction Pipelining

zhandling Data Hazards The objectives of this module are to discuss how data hazards are handled in general and also in the MIPS architecture.

COMPUTER ORGANIZATION AND DESIGN

Exception Handling. Precise Exception Handling. Exception Types. Exception Handling Terminology

ECEC 355: Pipelining

Unresolved data hazards. CS2504, Spring'2007 Dimitris Nikolopoulos

Very Simple MIPS Implementation

ECE 552 / CPS 550 Advanced Computer Architecture I. Lecture 6 Pipelining Part 1

CSEE 3827: Fundamentals of Computer Systems

CS 152 Computer Architecture and Engineering. Lecture 13 - Out-of-Order Issue and Register Renaming

Complications with long instructions. CMSC 411 Computer Systems Architecture Lecture 6 Basic Pipelining 3. How slow is slow?

Control Hazards - branching causes problems since the pipeline can be filled with the wrong instructions.

Pipeline Complexities. Pipeline Hazards

CISC 662 Graduate Computer Architecture Lecture 6 - Hazards

COSC4201. Prof. Mokhtar Aboelaze York University

Overview of the MIPS Architecture: Part I. CS 161: Lecture 0 1/24/17

Multi-cycle Instructions in the Pipeline (Floating Point)

What is Pipelining? Time per instruction on unpipelined machine Number of pipe stages

Processors. Young W. Lim. May 9, 2016

CMSC 411 Practice Exam 1 w/answers. 1. CPU performance Suppose we have the following instruction mix and clock cycles per instruction.

Improvement: Correlating Predictors

The Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture

Very Simple MIPS Implementation

Advanced Computer Architectures

Processor (II) - pipelining. Hwansoo Han

Hakim Weatherspoon CS 3410 Computer Science Cornell University

ECE 2300 Digital Logic & Computer Organization. Caches

Complex Pipelining COE 501. Computer Architecture Prof. Muhamed Mudawar

Computer Architecture Spring 2016

Outline Marquette University

Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1

Transcription:

Anti-Inspiration From pg. A-78 H&P It s true hard work never killed anybody, but I figure, why take the chance? Ronald Reagan, US President Hard work. Well, that s all right for people who don t know how to do anything else. From The Devil and Daniel Webster Dan Totheroh

Inspiration Genius is one per cent inspiration, ninety-nine per cent perspiration. Thomas Alva Edison (1847 1931), U.S. inventor. Misery loves company. Donald Freed, U.S. screenwriter CS/CE USNews Ranking Course/Text 1/4 Carnegie Mellon University ECE 741/H&P 1/1 Massachusetts Institute of Technology 6.823/H&P 1/2 Stanford University EE282/H&P 1/3 University of California Berkeley CSE502/H&P 5/5 University of Illinois Urbana-Champaign CS333/H&P

Pipeline control We have 5 stages. What needs to be controlled in each stage? Instruction Fetch and PC Increment Instruction Decode / Register Fetch Execution Memory Stage Write Back How would control be handled in a CS Dept? One professor telling everyone what to do? Or maybe a robotic control professor? Should we use a finite state machine?

Pipeline Control Pass control signals along just like the data WB Instruction Control M WB EX M WB IF/ID ID/EX EX/MEM MEM/WB

Data Hazard Types Types of data hazards (Instr i followed by Instr j ) Read After Write (RAW) Instr j tries to read operand before Instr i writes it Write After Read (WAR) Instr j tries to write operand before Instr i reads it Write After Write (WAW) Instr j tries to write operand before Instr i writes it Control must detect data hazards and stall or forward data as needed

Example: Load interlock RAW hazard Implementation must compare source and dest registers Four situations to be handled by control logic ID EX

Implementing Load Interlocks in ID ID EX is called instruction issue Detect data hazards prior to instruction issue Stall prior to issue, identify forwarding Simplifies hw since state update has not occurred LD R1, 45(R2) IF ID EX MEM WB DADD R5, R1, R7 IF ID EX MEM If hazard detected: set ID/EX to no-op and re-circulate IF/ID

Implementing Forwarding in EX

Example Implementation for MIPS Hazard Detection Fast pipeline registers Comparators and combinational logic Enlarged multiplexors for ALU inputs (to by-pass the output)

Interrupts and Exceptions Exceptions or interrupts (names sometimes used synonymously) Events other than branches or jumps that change the normal flow of instruction execution Unexpected event from within the processor Ex: arithmetic overflow, system call, undefined instruction Event that causes an unexpected change in control flow but comes from outside the processor Ex: I/O device request

How to implement exceptions? Nonpipelined implementation Handle undefined instruction and arithmetic overflow 1. Must save address of offending instruction 2. Transfer control to OS at some address 3. OS determines if execution continues OS needs to know 1. Reason for exception Cause register (status reg holding field indicating reason for exception, single entry point for all exceptions - OS decodes reg to find cause) Vectored interrupts (address to which control is transferred determined by cause of exception, OS knows reason by address) 2. Instruction that caused exception (EPC)

Exception/Interrupt Categories Exception/Interrupt Requirements Synchronous (internal) vs. asynchronous (external) Synch instruction triggers exception (assume same data and mem allocation) Ex: page fault, system call, arithmetic overflow Asynch can be handled after current instruction completes Ex: I/O device request, h/w malfunction, power failure User requested vs. coerced User requested always handled after instr completes (system call) Coerced caused by h/w event not under control of user (I/O request, page fault, overflow) User maskable vs. nonmaskable Determines whether h/w responds to exception Maskable: underflow and overflow, misaligned memory accesses Nonmaskable: h/w malfunction, system call, I/O request, memory protection Within vs. between instructions Within usu. Synchronous (overflow, page fault) difficult to implement (restart) Between: system call (synch), I/O request (asynch) Resume vs. terminate Does program execution continue or terminate?

Difficulties in pipelined implementation More difficult to implement interrupts within an instruction (vs. between) Another program must be invoked to save state of executing program correct cause of exception restore the state of the executing program Restartable pipeline Easier to implement interrupts that terminate execution No restart necessary

Safe Pipeline Control Handling exceptions with pipelining 1. Force a trap instruction into the pipeline on next IF 2. Until trap is taken: Turn off all writes for faulting instruction and all succeeding instructions Ensures no state changes from instructions following interrupt 3. Handling routine saves PC of faulting instruction plus one PC for each branch delay slot 4. Return from exception Use special instructions to reload PCs and restart instruction stream

Precise Exception Support Do instructions prior to exception within pipeline complete prior to handling? Necessary when lots of exceptions (e.g. demand paging in virtual memory) Usually supported for integer pipelines since easier to implement Precise exceptions supported by hardware when pipeline can be stopped on interrupt, allowing all instructions prior to interrupt to complete and those after restarted from scratch Complications in precise exception handling performance Floating point multiply taking many cycles Other instruction overwrites original operands for multiply then interrupt occurs Forcing precise mode would cause extreme slow down since operands must be held to restore state if interrupt occurs Solution: allow for toggle in and out of precise mode