COMP 4211 Seminar Presentation Based On: Computer Architecture A Quantitative Approach by Hennessey and Patterson Presenter : Feri Danes.

Slides:



Advertisements
Similar presentations
Tor Aamodt EECE 476: Computer Architecture Slide Set #6: Multicycle Operations.
Advertisements

Instruction Set Issues MIPS easy –Instructions are only committed at MEM  WB transition Other architectures are more difficult –Instructions may update.
Lecture 6: Pipelining MIPS R4000 and More Kai Bu
1 IF IDEX MEM L.D F4,0(R2) MUL.D F0, F4, F6 ADD.D F2, F0, F8 L.D F2, 0(R2) WB IF IDM1 MEM WBM2M3M4M5M6M7 stall.
CIS429/529 Winter 2007 Pipelining II- 1 Additional pipelining topics Why pipelining is so hard: exception handling ILP techniques: loop unrolling.
CIS429/529 Winter 2007 Pipelining-1 1 Pipeling RISC/MIPS64 five stage pipeline Basic pipeline performance Pipeline hazards Branch hazards More pipeline.
1 COMP 206: Computer Architecture and Implementation Montek Singh Wed., Sep 24, 2003 Topic: Pipelining -- Intermediate Concepts (Multicycle Operations;
Chapter 12 Pipelining Strategies Performance Hazards.
Instruction Pipelining Review
Pipeline Exceptions & ControlCSCE430/830 Pipeline: Exceptions & Control CSCE430/830 Computer Architecture Lecturer: Prof. Hong Jiang Courtesy of Yifeng.
COMP381 by M. Hamdi 1 Pipelining Control Hazards and Deeper pipelines.
EENG449b/Savvides Lec 4.1 1/22/04 January 22, 2004 Prof. Andreas Savvides Spring EENG 449bG/CPSC 439bG Computer.
The Basics: Pipelining J. Nelson Amaral University of Alberta 1.
ENGS 116 Lecture 61 Pipelining Difficulties and MIPS R4000 Vincent H. Berk October 6, 2008 Reading for today: A.3 – A.4, article: Yeager Reading for Wednesday:
EECC551 - Shaaban #1 Lec # 2 Winter Instruction Pipelining Review Instruction pipelining is CPU implementation technique where multiple.
Appendix A Pipelining: Basic and Intermediate Concepts
Pipelined Datapath and Control (Lecture #15) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
CIS429.S00: Lec12- 1 Miscellaneous pipelining topics Why pipelining is so hard: exception handling Advanced pipelining techniques: loop unrolling.
EECC551 - Shaaban #1 Lec # 4 winter Data Hazards Requiring Stall Cycles In some code sequence cases, potential data hazards cannot be handled.
Instruction Pipelining Review:
Computer Architecture
1 Manchester Mark I, This was the second (the first was a small- scale prototype) machine built at Cambridge. A production version of this computer.
What are Exception and Interrupts? MIPS terminology Exception: any unexpected change in the internal control flow – Invoking an operating system service.
Pipeline Hazard CT101 – Computing Systems. Content Introduction to pipeline hazard Structural Hazard Data Hazard Control Hazard.
Lecture 7: Pipelining Review Kai Bu
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
Lecture 5: Pipelining Implementation Kai Bu
1 Appendix A Pipeline implementation Pipeline hazards, detection and forwarding Multiple-cycle operations MIPS R4000 CDA5155 Spring, 2007, Peir / University.
CSC 4250 Computer Architectures September 26, 2006 Appendix A. Pipelining.
Pipeline Extensions prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University MIPS Extensions1May 2015.
Implementing Precise Interrupts in Pipelined Processors James E. Smith Andrew R.Pleszkun Presented By: Ravikumar Source:
Spring 2003CSE P5481 Precise Interrupts Precise interrupts preserve the model that instructions execute in program-generated order, one at a time If an.
Appendix A. Pipelining: Basic and Intermediate Concept
University of Texas at Austin CS352H - Computer Systems Architecture Fall 2009 Don Fussell CS352H: Computer Systems Architecture Topic 9: MIPS Pipeline.
11 Pipelining Kosarev Nikolay MIPT Oct, Pipelining Implementation technique whereby multiple instructions are overlapped in execution Each pipeline.
LECTURE 10 Pipelining: Advanced ILP. EXCEPTIONS An exception, or interrupt, is an event other than regular transfers of control (branches, jumps, calls,
CSC 4250 Computer Architectures September 22, 2006 Appendix A. Pipelining.
Data Hazards Dependent instructions add %g1, %g2, %g3 sub %l1, %g3, %o0 Forwarding helps, but not all hazards can be avoided.
CMSC 611: Advanced Computer Architecture
Instruction-Level Parallelism
Exceptions Another form of control hazard Could be caused by…
Computer Organization CS224
Lecture 15: Pipelining: Branching & Complications
Lecture 07: Pipelining Multicycle, MIPS R4000, and More
Pipelining Wrapup Brief overview of the rest of chapter 3
Single Clock Datapath With Control
Pipeline Implementation (4.6)
Appendix C Pipeline implementation
Morgan Kaufmann Publishers The Processor
Exceptions & Multi-cycle Operations
Pipelining: Advanced ILP
The processor: Exceptions and Interrupts
Morgan Kaufmann Publishers The Processor
CS 5513 Computer Architecture Pipelining Examples
Lecture 6: Advanced Pipelines
Pipelining Multicycle, MIPS R4000, and More
The processor: Pipelining and Branching
Instruction Pipelining Review:
CSC 4250 Computer Architectures
How to improve (decrease) CPI
Project Instruction Scheduler Assembler for DLX
Overview What are pipeline hazards? Types of hazards
Pipelining Multicycle, MIPS R4000, and More
CS203 – Advanced Computer Architecture
Lecture 4: Advanced Pipelines
Control Hazards Branches (conditional, unconditional, call-return)
Lecture 06: Pipelining Implementation
Interrupts and exceptions
CS 3853 Computer Architecture Pipelining Examples
CMSC 611: Advanced Computer Architecture
Presentation transcript:

COMP 4211 Seminar Presentation Based On: Computer Architecture A Quantitative Approach by Hennessey and Patterson Presenter : Feri Danes

Outline Exceptions Handling Floating Points Operations Case Study: MIPS R4000 Pipeline Case Study: MIPS R4300 Pipeline

What is Exception? I/O device request Invoking an operating system service from a user program Tracing instruction execution Breakpoint (programmer-requested interrupt) Integer arithmetic overflow FP arithmetic anomaly Page Fault( not in main memory ) Misaligned memory access ( if alignment required ) Memory protection violation Using an undefined or unimplemented instruction Hardware malfunctions Power failure

What happens during an exception? An exception occurs Operating system trap Saving the PC where the exception happens Save the operating system state Run exception code Resume the last instruction before it traps or terminate the program

How does this influence the hardware? Unpipelined implementations Occur within instructions Occur within instructions Restartable Restartable Pipelined implementations Preserves the CPU state by stalling the instruction following the exception source Preserves the CPU state by stalling the instruction following the exception source

Exception in Pipelined architecture Force a trap instruction into the pipeline on the next IF Flush the pipeline for the faulting instruction and all instructions that follows After exception handling routine finishes restore the PC of the saved PC and delay branches if exsists

Precise Exceptions “if the pipeline can be stopped so that the instructions just the faulting instruction are completed and the faulting instruction can be restarted from scratch” “if the pipeline can be stopped so that the instructions just the faulting instruction are completed and the faulting instruction can be restarted from scratch”

Exceptions in MIPS Pipeline stageProblem exceptions occurring IF Page fault on IF, misaligned memory access, memory protection violation ID Undefined or illegal opcode EX Arithmetic exception MEM Page fault on data fetch, misaligned memory access, memory violation protection WBNone

Exceptions in MIPS Precise exceptions Exception status vector eg: Data fault on LD Data fault on LD Page fault on DADD Page fault on DADD LDIFIDEXMEMWB ADDIFIDEXMEMWB

Floating Points Operation There are four separate functional units that we can assume to support Function Point operations: Integer Unit FP and integer multiplier FP adder FP and integer divider

Floating Points Operation

Function Point Operations

Hazards Structural hazards on the FP and integer divider Structural hazards on WB WAW because of out of order completion Precise exception is harder to maintain Increase the number of RAW hazards

Structural Hazard Instruction MUL.D F0,F4,F6 IFIDM1M2M3M4M5M6M7MEMWB …………………….IFIDEXMEMWB …………………….IFIDEXMEMWB ADD.D F2,F4,F6 IFIDA1A2A3A4MEM …………………….IFIDEXMEMWB …………………….IFIDEXMEMWB L.D F2,0(R2) IFIDEXMEMWB

Structural Hazard Stall the instruction that can cause structural hazard in the ID stage Stall the instruction when it enters the MEM or WB stage

RAW Hazard Instruction L.D F0F4,F6 IFIDEXMEMWB MUL.D F0,F4,F6 IFIDstallM1M2M3M4M5M6M7MEMWB ADD.D F2,F0,F8 IFstallIDstallstallstallstallStallStallA1A2A3A4MEM S.D F2,0(R2) IFstallStallstallstallStallStallIDEXstallstallstallMEM

WAW Hazard Instruction MUL.D F0,F4,F6 IFIDM1M2M3M4M5M6M7MEMWB ………………….IFIDEXMEMWB …………………IFIDEXMEMWB ADD.D F2,F4,F6 IFIDA1A2A3A4MEMWB …………………IFIDEXMEMWB L.D F2,0(R2) IFIDEXMEMWB

WAW Hazard Delay the issue of Load instruction until the add instruction reach the MEM stage Prevent the add instruction to write back to register

Forwarding Unit Can be implemented by checking the destination register in these following registers: Can be implemented by checking the destination register in these following registers:EX/MEM!4/MEMM7/MEMD/MEMMEM/WB

Maintaining Precise Exceptions Consider the following sequence of code DIV.D F0,F2,F4 DIV.D F0,F2,F4 ADD.D F10,F10,F8 ADD.D F10,F10,F8 SUB.D F12,F12,F14 SUB.D F12,F12,F14 Consider this following scenario ADD.D and SUB.D finish before DIV.D ADD.D and SUB.D finish before DIV.D SUB.D causes floating point exception after ADD.D has been completed but not DIV.D SUB.D causes floating point exception after ADD.D has been completed but not DIV.D Imprecise exception Imprecise exception

Maintaining Precise Exception Ignore buffer the result of an operation until all operation that were issued earlier are complete History file History file future file future file Let exceptions to be imprecise but with state information save the instruction that precede the completed instruction and run those instructions before restarting the execution save the instruction that precede the completed instruction and run those instructions before restarting the execution Guarantee that no instruction that precede the issuing instruction can be completed without exception before issuing that instruction

MIPS FP Performance

Case Study MIPS R4000 Eight stages pipeline Additional pipeline is allocated for cache access Often called as superpipelining

R4000 Pipeline

IF--First half of instruction fetch, PC selection and initiation of instruction cache access IS--Second half instruction fetch, complete instruction cache access RF--Instruction decode and register fetch and instruction cache hit detection EX--Execution includes effective address calculation, ALU operation, branch target calculation and branch condition calculation DF--Data fetch first half DS--Second half data fetch completion of data cache access TC--Tag check, determine whether the data cache access hit WB--Write Back for loads and register-register operation

RAW Hazard

Branch Delay

Branch taken 1 Delay Slot + 2 stall 1 Delay Slot + 2 stall Brach not taken 1 Delay Slot 1 Delay Slot Note : Branch predicted not taken policy is used for the 2 out 3 cycles of branch delay

Floating Point Pipeline Stag e Functional Unit Description A FP Adder Mantissa ADD stage D FP Divider Divide pipeline stage E FP Multiplier Exception test stage M FP Multiplier First stage of multiplier N FP Multiplier Second stage of multiplier R FP Adder Rounding stage S FP Adder Operand shift stage U Unpack FP number

Floating Point Instruction FP Instruction Latency Initiation Interval Pipe stages Add, Subtract 43U,S+A,A+R,R+S Multiply84U,E+M,M,M,M,N,N+A,R Divide3635 U,A,R,D 27,D+A,D+R,D+A,D+R,A,R Square Root U,E,(A+R) 108,A,R Negate21U,S Absolute Value 21U,S FP Compare 32U,A,R

Structural Hazard Operatio n Issue/stall MultiplyIssueUE+MMMNN+AR AddIssueUS+AA+RR+S IssueUS+AA+RR+S StallUS+AA+RR+S StallUS+AA+RR+S IssueUS+AA+RR+S IssueUS+AA+RR+S

Performance Some Definition Load stalls: Delays arising from the use of a load result 1 or 2 cycles after the load Branch stalls: 2 cycle stall on every taken branch plus unfilled or canceled branch delay slots FP result stalls: Stalls because of RAW hazard for an FP operand FP structural stalls: Delays because of issue restrictions arising from conflicts for functional units in the FP pipeline

Performance

MIPS R4300 five-stage pipeline 64-bit processor used in embedded system implementation FP operations by extending the pipeline length in the Ex stage

Bibliography Hennesy,J.L and Patterson,D.A, “Computer Architecture A Quantitative approach”, Appendix A, Morgan Kaufmann Publisher,USA,2003