Lecture 8: Data Hazard and Resolution. James C. Hoe Department of ECE Carnegie Mellon University
|
|
- Angelina Skinner
- 6 years ago
- Views:
Transcription
1 Lecture 8: Data Hazard and Resolution James C. Hoe Department of ECE Carnegie ellon University S18 L08 S1, James C. Hoe, CU/ECE/CALC, 2018
2 Your goal today Housekeeping detect and resolve data hazards in in order pipelines Notices Lab 2, status check next week, due wk of 2/26 HW 2,due 2/21 **Office Hours: 11~12 and F 1:30~2:30** Readings P&H Ch S18 L08 S2, James C. Hoe, CU/ECE/CALC, 2018
3 Instruction Pipeline Reality Not identical tasks coalescing instruction types into one multifunction pipe external fragmentation (some idle stages) Not uniform suboperations group or sub divide steps into stages to minimize variance internal fragmentation (some too fast stages ) Not independent tasks dependency detection and resolution next lecture(s) Even more messy if not RISC S18 L08 S3, James C. Hoe, CU/ECE/CALC, 2018
4 Data Dependence Data dependence r 3 r op r 2 Read after Write (RAW) r 5 r 3 op r 4 Anti dependence r 3 r op r 2 Write after Read (WAR) r 1 r 4 op r 5 Output dependence r 3 r 1 op r 2 Write after Write (WAW).... r 3 r 6 op r 7 Don t forget memory instructions S18 L08 S4, James C. Hoe, CU/ECE/CALC, 2018
5 RAW Dependency and Hazard addi ra r addi r ra addi r ra addi r ra addi r ra addi r ra t 0 t 1 t 2 t 3 t 4 t 5 IF ID EX E WB IF ID EX E WB IF ID EX E IF ID EX IF ID IF S18 L08 S5, James C. Hoe, CU/ECE/CALC, 2018
6 Register Data Hazard Analysis R/I Type LW SW Bxx Jal Jalr IF ID read RF read RF read RF read RF read RF EX E WB write RF write RF write RF write RF For a given pipeline, when is there a register data hazard between 2 dependent instructions? dependence type: RAW, WAR, WAW? instruction types involved? distance between the two instructions? S18 L08 S6, James C. Hoe, CU/ECE/CALC, 2018
7 Hazard in In order Pipeline j: _ r k RF Read stage X j: r k _ RF Write j: r k _ RF Write stage Y i: r k _ RF Write i: _ r k RF Read i: r k _ RF Write RAW Hazard WAR Hazard WAW Hazard dist dependence (i,j) dist hazard (X,Y)?? Hazard!! dist dependence (i,j) > dist hazard (X,Y)?? Safe S18 L08 S7, James C. Hoe, CU/ECE/CALC, 2018
8 RAW Hazard Analysis Example R/I Type LW SW Bxx Jal Jalr IF ID read RF read RF read RF read RF read RF EX E WB write RF write RF write RF write RF Older I A and younger I B have RAW hazard iff I B (R/I, LW, SW, Bxx or JALR) reads a register written by I A (R/I, LW, or JAL/R) dist(i A, I B ) dist(id, WB) = 3 What about WAW and WAR hazard? What about memory data hazard? S18 L08 S8, James C. Hoe, CU/ECE/CALC, 2018
9 Pipeline Stall: universal hazard resolution t 0 t 1 t 2 t 3 t 4 t 5 Inst h IF ID ALU E WB Inst i i IF ID ALU E WB Inst j j IF ID ALU ID E ALU ID E ALU WB ID E ALU WB Inst k IF ID IF ALU ID IF E ALU ID IF E ALU WB ID Inst l IF ID IF ALU ID IF E ALU ID IF IF ID IF ALU ID IF i: r x _ bubble j: _ r IF ID x dist(i,j)=1 IF j: bubble _ r x dist(i,j)=2 IF j: bubble _ r x dist(i,j)=3 j: _ r x dist(i,j)= S18 L08 S9, James C. Hoe, CU/ECE/CALC, 2018 Stall==make younger instruction wait until hazard passes 1. stop all up stream stages 2. drain all down stream stages
10 What should happen in this case? t 0 t 1 t 2 t 3 t 4 t 5 Inst h IF ID ALU E WB Inst i i IF ID ALU E WB Inst j j IF ID ALU E WB Inst k k IF ID ALU E WB Inst l IF ID ALU E IF ID ALU i: r x _ j: r IF ID y r z k: _ r x dist(i,k)=2 IF S18 L08 S10, James C. Hoe, CU/ECE/CALC, 2018
11 Pipeline Stall t 0 t 1 t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t 10 IF i j k k k k l ID h i j j j j k l EX h i bub bub bub j k l E h i bub bub bub j k l WB h i bub bub bub j k l S18 L08 S11, James C. Hoe, CU/ECE/CALC, 2018 i: rx _ j: _ rx
12 Stall PCSrc 0 u x 1 stall Control ID/EX WB EX/E WB E/WB IF/ID EX WB Add PC PC 4 Address Instruction memory Instruction RegWrite Read register 1 Read data 1 Read register 2 Registers Read Write data 2 register Write data Shift left 2 0 u x 1 Add Add result ALUSrc Zero ALU ALU result Branch Write data emwrite Address Data memory Read data emtoreg 1 u x 0 Instruction [15 0] 16 Sign 32 extend 6 ALU control emread Stall IR disable PC and IR latching setregwrite ID =0 and emwrite ID = S18 L08 S12, James C. Hoe, CU/ECE/CALC, 2018 Instruction [20 16] Instruction [15 11] 0 u x 1 RegDst ALUOp Based on original figure from [P&H CO&D, COPYRIGHT 2004 Elsevier. ALL RIGHTS RESERVED.]
13 Stall Condition Older I A and younger I B have RAW hazard iff I B (R/I, LW, SW, Bxx or JALR) reads a register written by I A (R/I, LW, or JAL/R) dist(i A, I B ) dist(id, WB) = 3 ore plainly, before I B in ID reads a register, I B needs to check if any I A in EX, E or WB is going to update it (if so, value in RF is stale ) S18 L08 S13, James C. Hoe, CU/ECE/CALC, 2018 Watch out for x0!!
14 Stall Condition Helper functions use_rs1(i) returns true if I uses rs1 && rs1!=x0 Stall IF and ID when (rs1 ID ==rd EX ) && use_rs1(ir ID ) && RegWrite EX (rs1 ID ==rd E ) && use_rs1(ir ID ) && RegWrite E (rs1 ID ==rd WB ) && use_rs1(ir ID ) && RegWrite WB (rs2 ID ==rd EX ) && use_rs2(ir ID ) && RegWrite EX (rs2 ID ==rd E ) && use_rs2(ir ID ) && RegWrite E or or or or or (rs2 ID ==rd WB ) && use_rs2(ir ID ) && RegWrite WB S18 L08 S14, James C. Hoe, CU/ECE/CALC, 2018 It is crucial that EX, E and WB continue to advance during stall
15 Impact of Stall on Performance Each stall cycle corresponds to 1 lost ALU cycle A program with N instructions and S stall cycles: average IPC=N/(N+S) S depends on frequency of hazard causing dependencies distance between hazard causing instruction pairs distance between hazard causing dependencies (suppose i 1,i 2 and i 3 all depend on i 0, once i 1 s hazard is resolved by stalling, i 2 and i 3 do not stall) S18 L08 S15, James C. Hoe, CU/ECE/CALC, 2018
16 Sample Assembly [P&H] for (j=i 1; j>=0 && v[j] > v[j+1]; j =1) {... } S18 L08 S16, James C. Hoe, CU/ECE/CALC, 2018 addi $s1, $s0, 1 for2tst: slti $t0, $s1, 0 bne $t0, $zero, exit2 sll $t1, $s1, 2 add $t2, $a0, $t1 lw $t3, 0($t2) lw $t4, 4($t2) slt $t0, $t4, $t3 beq $t0, $zero, exit2... addi $s1, $s1, 1 j for2tst exit2: 3 stalls 3 stalls 3 stalls 3 stalls 3 stalls 3 stalls
17 Data Forwarding (or Register Bypassing) What does ADD rx ry rz mean? Get inputs from RF[ry] and RF[rz] and put result in RF[rx]? But, RF is just a part of an abstraction a way to connect dataflow between instructions inputs to ADD are resulting values of the last instructions to assign to RF[ry] and RF[rz] RF doesn t have to exist as an literal object If only dataflow matters, don t wait for WB... add ra r r IF ID EX E WB addi r ra r IF ID EX ID E ID WB ID S18 L08 S17, James C. Hoe, CU/ECE/CALC, 2018
18 Resolving RAW Hazard by Forwarding A hazard exits Older I A and younger I B have RAW hazard iff I B (R/I, LW, SW, Bxx or JALR) reads a register written by I A (R/I, LW, or JAL/R) dist(i A, I B ) dist(id, WB) = 3 ore plainly, before I B in ID reads a register, I B needs to check if any I A in EX, E or WB is going to update it (if so, value in RF is stale ) Before: I B need to stall for RF to update Now: I B need to stall for I A to produce result retrieve I A result from datapath when ready must retrieve from youngest if multiple hazards S18 L08 S18, James C. Hoe, CU/ECE/CALC, 2018
19 Forwarding Paths (v1) dist(i,j)=3 Registers internal forward? dist(i,j)=3 b. With forwarding ID/EX Rs Rt Rt Rd Rd Rs Rt u x u x ForwardB u x ForwardA ID/EX EX/E EX/E E/WB E/WB ALU ID/EX.RegisterRD Forwarding unit dist(i,j)=1 Data memory EX/E.RegisterRd EX/E.RegisterRD E/WB.RegisterRd E/WB.RegisterRD dist(i,j)=2 u x S18 L08 S19, James C. Hoe, CU/ECE/CALC, 2018 [Based on original figure from P&H CO&D, COPYRIGHT 2004 Elsevier. ALL RIGHTS RESERVED.]
20 Forwarding Paths (v2) dist(i,j)=3 ID/EX EX/E E/WB u x Registers u x ForwardA ALU dist(i,j)=1 Data memory dist(i,j)=2 u x Rs Rt Rt Rd Rd ForwardB u x Forwarding unit EX/E.RegisterRd E/WB.RegisterRd better if EX is the fastest stage S18 L08 S20, James C. Hoe, CU/ECE/CALC, 2018 [Based on original figure from P&H CO&D, COPYRIGHT 2004 Elsevier. ALL RIGHTS RESERVED.]
21 Forwarding Logic (for v1) if (rs1 ID!=0) && (rs1 ID ==rd EX ) && RegWrite EX then forward writeback value from EX // dist=1 else if (rs1 ID!=0) && (rs1 ID ==rd E ) && RegWrite E then forward writeback value from E // dist=2 else if (rs1 ID!=0) && (rs1 ID ==rd WB ) && RegWrite WB then forward writeback value from WB // dist=3 else use A ID // dist > S18 L08 S21, James C. Hoe, CU/ECE/CALC, 2018 ust check in right order Why doesn t use_rs1( ) appear? Isn t it bad to forward from LW in EX?
22 Data Hazard Analysis (with Forwarding) IF R/I Type LW SW Bxx Jal Jalr ID EX use produce use use use produce E produce (use) use produce WB Even with forwarding, RAW dependence on immediate preceding LW results in hazard Stall = { [(rs1 ID ==rd EX ) && use_rs1(ir ID )] S18 L08 S22, James C. Hoe, CU/ECE/CALC, 2018 i.e., op EX =Lx [(rs2 ID ==rd EX ) && use_rs2(ir ID )] } && emread EX
23 IPS Load Delay Slot Feature I 1 : LW ra IF ID EX E WB I 2 : addi r ra r I 3 : addi r ra r IF ID EX E WB IF ID EX E WB R2000 defined LW with arch. latency of 1 inst invalid for I 2 (in LW s delay slot) to ask for LW s result any dependence on LW at least distance 2 Delay slot vs dynamic stalling fill with an independent instruction (no difference) if not, fill with a NOP (no difference) Can t lose on 5 stage... good idea? S18 L08 S23, James C. Hoe, CU/ECE/CALC, 2018 Hint: 1. non atomic instruction; 2. arch influence
24 Sample Assembly [P&H] for (j=i 1; j>=0 && v[j] > v[j+1]; j =1) {... } S18 L08 S24, James C. Hoe, CU/ECE/CALC, 2018 addi $s1, $s0, 1 for2tst: slti $t0, $s1, 0 bne $t0, $zero, exit2 sll $t1, $s1, 2 add $t2, $a0, $t1 lw $t3, 0($t2) lw $t4, 4($t2) slt $t0, $t4, $t3 beq $t0, $zero, exit2... addi $s1, $s1, 1 j for2tst exit2: 1 stall or 1 nop (IPS)
25 Dependency Terminology ordering requirement between instructions Pipeline Hazard: (potential) violation of dependencies Hazard Resolution: static schedule instructions at compile time to avoid hazards dynamic detect hazard and adjust pipeline operation Stall, Flush or Forward Pipeline Interlock (i.e., stall) S18 L08 S25, James C. Hoe, CU/ECE/CALC, 2018
26 Dividing into Stages 200ps 100ps 200ps 200ps 100ps IF: Instruction fetch ux 0 1 ID: Instruction decode/ register file read EX: Execute/ address calculation E: emory access WB: Write back ignore for today Add 4 Shift left 2 Add result Add PC Address Instruction memory Instruction Read register 1 Read data 1 Read register 2 Registers Read data 2 Write register Write data 0 ux 1 Zero ALU ALU result Address Data memory Write data Read data ux 1 0 RF write 16 Sign extend 32 Is this the correct partitioning? Why not 4 or 6 stages? Why not different boundaries S18 L08 S26, James C. Hoe, CU/ECE/CALC, 2018 Based on original figure from [P&H CO&D, COPYRIGHT 2004 Elsevier. ALL RIGHTS RESERVED.]
27 Why not very deep pipelines? With only 5 stages, still plenty of combinational logic between registers Superpipelining increase pipelining such that even intrinsic operations (e.g. ALU, RF access, memory access) require multiple stages What s the problem? Inst 0 : r1 r2 + r3 Inst 1 : r4 r1 + 2 t 0 t 0 t 1 t 1 t 2 t 2 t 3 t 3 t 4 t 4 t 5 t 5 Inst 0 F a F F b D a D D b E a E E b a b W a W b Inst 1 F a F b F D a D b DE a E ba EE ba ba W ba W ba W b F D E W F a F b D a D b DE ab E ab E ba ab W ab W ab W b D b S18 L08 S27, James C. Hoe, CU/ECE/CALC, 2018
28 Intel P4 s Superpipelined Adder Hack A lower B lower 16 bit add S lower A upper B upper 16 bit add S upper EX 1 EX 2 32 bit addition pipelined over 2 stages, BW=1/latency 16 bit add No stall between back to back dependencies S18 L08 S28, James C. Hoe, CU/ECE/CALC, 2018
29 When you can t split a d e A (rate=1/t) d e 0.5T clock B (rate=1/t) T delay 0.5T clock 0.5T clock S18 L08 S29, James C. Hoe, CU/ECE/CALC, 2018
30 Dependencies and Pipelining (architecture vs. microarchitecture) Sequential and atomic instruction semantics i 1 i 2 True dependence between two instructions may only require ordering of certain sub operations i 1 : i 2 : i 3 Defines what is correct; doesn t say do it this way S18 L08 S30, James C. Hoe, CU/ECE/CALC, 2018 i 3 :
Lecture 10: Pipelined Implementations: Hazards and Resolutions. Instruction Pipeline Reality
18-447 Lecture 10: Pipelined Implementations: Hazards and Resolutions S 09 L10-1 James C. Hoe José F. Martínez Electrical and Computer Engineering Carnegie Mellon University February 15, 2010 Instruction
More informationPipelined Datapath. Reading. Sections Practice Problems: 1, 3, 8, 12
Pipelined Datapath Lecture notes from KP, H. H. Lee and S. Yalamanchili Sections 4.5 4. Practice Problems:, 3, 8, 2 ing Note: Appendices A-E in the hardcopy text correspond to chapters 7- in the online
More informationT = I x CPI x C. Both effective CPI and clock cycle C are heavily influenced by CPU design. CPI increased (3-5) bad Shorter cycle good
CPU performance equation: T = I x CPI x C Both effective CPI and clock cycle C are heavily influenced by CPU design. For single-cycle CPU: CPI = 1 good Long cycle time bad On the other hand, for multi-cycle
More informationCS3350B Computer Architecture Quiz 3 March 15, 2018
CS3350B Computer Architecture Quiz 3 March 15, 2018 Student ID number: Student Last Name: Question 1.1 1.2 1.3 2.1 2.2 2.3 Total Marks The quiz consists of two exercises. The expected duration is 30 minutes.
More informationLecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1
Lecture 3: The Processor (Chapter 4 of textbook) Chapter 4.1 Introduction Chapter 4.1 Chapter 4.2 Review: MIPS (RISC) Design Principles Simplicity favors regularity fixed size instructions small number
More informationWhat do we have so far? Multi-Cycle Datapath (Textbook Version)
What do we have so far? ulti-cycle Datapath (Textbook Version) CPI: R-Type = 4, Load = 5, Store 4, Branch = 3 Only one instruction being processed in datapath How to lower CPI further? #1 Lec # 8 Summer2001
More informationPipeline Hazards. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Pipeline Hazards Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Hazards What are hazards? Situations that prevent starting the next instruction
More informationPipelined Datapath. Reading. Sections Practice Problems: 1, 3, 8, 12 (2) Lecture notes from MKP, H. H. Lee and S.
Pipelined Datapath Lecture notes from KP, H. H. Lee and S. Yalamanchili Sections 4.5 4. Practice Problems:, 3, 8, 2 ing (2) Pipeline Performance Assume time for stages is ps for register read or write
More informationLecture 9. Pipeline Hazards. Christos Kozyrakis Stanford University
Lecture 9 Pipeline Hazards Christos Kozyrakis Stanford University http://eeclass.stanford.edu/ee18b 1 Announcements PA-1 is due today Electronic submission Lab2 is due on Tuesday 2/13 th Quiz1 grades will
More informationLecture 7 Pipelining. Peng Liu.
Lecture 7 Pipelining Peng Liu liupeng@zju.edu.cn 1 Review: The Single Cycle Processor 2 Review: Given Datapath,RTL -> Control Instruction Inst Memory Adr Op Fun Rt
More informationECE260: Fundamentals of Computer Engineering
Data Hazards in a Pipelined Datapath James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania Based on Computer Organization and Design, 5th Edition by Patterson & Hennessy Data
More informationChapter 4 The Processor 1. Chapter 4B. The Processor
Chapter 4 The Processor 1 Chapter 4B The Processor Chapter 4 The Processor 2 Control Hazards Branch determines flow of control Fetching next instruction depends on branch outcome Pipeline can t always
More informationChapter 4 (Part II) Sequential Laundry
Chapter 4 (Part II) The Processor Baback Izadi Division of Engineering Programs bai@engr.newpaltz.edu Sequential Laundry 6 P 7 8 9 10 11 12 1 2 A T a s k O r d e r A B C D 30 30 30 30 30 30 30 30 30 30
More informationOutline. A pipelined datapath Pipelined control Data hazards and forwarding Data hazards and stalls Branch (control) hazards Exception
Outline A pipelined datapath Pipelined control Data hazards and forwarding Data hazards and stalls Branch (control) hazards Exception 1 4 Which stage is the branch decision made? Case 1: 0 M u x 1 Add
More informationEECS 322 Computer Architecture Improving Memory Access: the Cache
EECS 322 Computer Architecture Improving emory Access: the Cache Instructor: Francis G. Wolff wolff@eecs.cwru.edu Case Western Reserve University This presentation uses powerpoint animation: please viewshow
More informationLecture Topics. Announcements. Today: Data and Control Hazards (P&H ) Next: continued. Exam #1 returned. Milestone #5 (due 2/27)
Lecture Topics Today: Data and Control Hazards (P&H 4.7-4.8) Next: continued 1 Announcements Exam #1 returned Milestone #5 (due 2/27) Milestone #6 (due 3/13) 2 1 Review: Pipelined Implementations Pipelining
More informationChapter 4 The Processor 1. Chapter 4A. The Processor
Chapter 4 The Processor 1 Chapter 4A The Processor Chapter 4 The Processor 2 Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware
More informationThe University of Alabama in Huntsville Electrical & Computer Engineering Department CPE Test II November 14, 2000
The University of Alabama in Huntsville Electrical & Computer Engineering Department CPE 513 01 Test II November 14, 2000 Name: 1. (5 points) For an eight-stage pipeline, how many cycles does it take to
More informationcs470 - Computer Architecture 1 Spring 2002 Final Exam open books, open notes
1 of 7 ay 13, 2002 v2 Spring 2002 Final Exam open books, open notes Starts: 7:30 pm Ends: 9:30 pm Name: (please print) ID: Problem ax points Your mark Comments 1 10 5+5 2 40 10+5+5+10+10 3 15 5+10 4 10
More informationPipelining Analogy. Pipelined laundry: overlapping execution. Parallelism improves performance. Four loads: Non-stop: Speedup = 8/3.5 = 2.3.
Pipelining Analogy Pipelined laundry: overlapping execution Parallelism improves performance Four loads: Speedup = 8/3.5 = 2.3 Non-stop: Speedup =2n/05n+15 2n/0.5n 1.5 4 = number of stages 4.5 An Overview
More informationLecture 3: Single Cycle Microarchitecture. James C. Hoe Department of ECE Carnegie Mellon University
8 447 Lecture 3: Single Cycle Microarchitecture James C. Hoe Department of ECE Carnegie Mellon University 8 447 S8 L03 S, James C. Hoe, CMU/ECE/CALCM, 208 Your goal today Housekeeping first try at implementing
More informationImprove performance by increasing instruction throughput
Improve performance by increasing instruction throughput Program execution order Time (in instructions) lw $1, 100($0) fetch 2 4 6 8 10 12 14 16 18 ALU Data access lw $2, 200($0) 8ns fetch ALU Data access
More informationDesign of Digital Circuits Lecture 16: Dependence Handling. Prof. Onur Mutlu ETH Zurich Spring April 2017
Design of Digital Circuits Lecture 16: Dependence Handling Prof. Onur Mutlu ETH Zurich Spring 2017 27 April 2017 Agenda for Today & Next Few Lectures! Single-cycle Microarchitectures! Multi-cycle and Microprogrammed
More informationLecture 6: Microprogrammed Multi Cycle Implementation. James C. Hoe Department of ECE Carnegie Mellon University
8 447 Lectre 6: icroprogrammed lti Cycle Implementation James C. Hoe Department of ECE Carnegie ellon University 8 447 S8 L06 S, James C. Hoe, CU/ECE/CALC, 208 Yor goal today Hosekeeping nderstand why
More informationCS 110 Computer Architecture. Pipelining. Guest Lecture: Shu Yin. School of Information Science and Technology SIST
CS 110 Computer Architecture Pipelining Guest Lecture: Shu Yin http://shtech.org/courses/ca/ School of Information Science and Technology SIST ShanghaiTech University Slides based on UC Berkley's CS61C
More informationLecture 4: Review of MIPS. Instruction formats, impl. of control and datapath, pipelined impl.
Lecture 4: Review of MIPS Instruction formats, impl. of control and datapath, pipelined impl. 1 MIPS Instruction Types Data transfer: Load and store Integer arithmetic/logic Floating point arithmetic Control
More informationEC 413 Computer Organization - Fall 2017 Problem Set 3 Problem Set 3 Solution
EC 413 Computer Organization - Fall 2017 Problem Set 3 Problem Set 3 Solution Important guidelines: Always state your assumptions and clearly explain your answers. Please upload your solution document
More informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle
More informationInstruction word R0 R1 R2 R3 R4 R5 R6 R8 R12 R31
4.16 Exercises 419 Exercise 4.11 In this exercise we examine in detail how an instruction is executed in a single-cycle datapath. Problems in this exercise refer to a clock cycle in which the processor
More informationData Hazards Compiler Scheduling Pipeline scheduling or instruction scheduling: Compiler generates code to eliminate hazard
Data Hazards Compiler Scheduling Pipeline scheduling or instruction scheduling: Compiler generates code to eliminate hazard Consider: a = b + c; d = e - f; Assume loads have a latency of one clock cycle:
More informationAssignment 1 solutions
Assignment solutions. The jal instruction does a jump identical to the j instruction (i.e., replacing the low order 28 bits of the with the ress in the instruction) and also writes the value of the + 4
More informationECE473 Computer Architecture and Organization. Pipeline: Data Hazards
Computer Architecture and Organization Pipeline: Data Hazards Lecturer: Prof. Yifeng Zhu Fall, 2015 Portions of these slides are derived from: Dave Patterson UCB Lec 14.1 Pipelining Outline Introduction
More informationECE/CS 552: Pipelining
ECE/CS 552: Pipelining Prof. ikko Lipasti Lecture notes based in part on slides created by ark Hill, David Wood, Guri Sohi, John Shen and Jim Smith Forecast Big Picture Datapath Control Pipelining s Program
More informationProcessor Design Pipelined Processor (II) Hung-Wei Tseng
Processor Design Pipelined Processor (II) Hung-Wei Tseng Recap: Pipelining Break up the logic with pipeline registers into pipeline stages Each pipeline registers is clocked Each pipeline stage takes one
More informationCS 61C: Great Ideas in Computer Architecture Pipelining and Hazards
CS 61C: Great Ideas in Computer Architecture Pipelining and Hazards Instructors: Vladimir Stojanovic and Nicholas Weaver http://inst.eecs.berkeley.edu/~cs61c/sp16 1 Pipelined Execution Representation Time
More informationCOMP2611: Computer Organization. The Pipelined Processor
COMP2611: Computer Organization The 1 2 Background 2 High-Performance Processors 3 Two techniques for designing high-performance processors by exploiting parallelism: Multiprocessing: parallelism among
More informationCSCI 402: Computer Architectures. Fengguang Song Department of Computer & Information Science IUPUI. Today s Content
3/6/8 CSCI 42: Computer Architectures The Processor (2) Fengguang Song Department of Computer & Information Science IUPUI Today s Content We have looked at how to design a Data Path. 4.4, 4.5 We will design
More informationPipeline design. Mehran Rezaei
Pipeline design Mehran Rezaei How Can We Improve the Performance? Exec Time = IC * CPI * CCT Optimization IC CPI CCT Source Level * Compiler * * ISA * * Organization * * Technology * With Pipelining We
More informationCOMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle
More informationProcessor Design CSCE Instructor: Saraju P. Mohanty, Ph. D. NOTE: The figures, text etc included in slides are borrowed
Lecture 3: General Purpose Processor Design CSCE 665 Advanced VLSI Systems Instructor: Saraju P. ohanty, Ph. D. NOTE: The figures, tet etc included in slides are borrowed from various books, websites,
More informationChapter 4. The Processor
Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations A simplified
More informationECE/CS 552: Pipeline Hazards
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 Smith Pipeline Hazards Forecast Program Dependences
More informationEE557--FALL 1999 MAKE-UP MIDTERM 1. Closed books, closed notes
NAME: STUDENT NUMBER: EE557--FALL 1999 MAKE-UP MIDTERM 1 Closed books, closed notes Q1: /1 Q2: /1 Q3: /1 Q4: /1 Q5: /15 Q6: /1 TOTAL: /65 Grade: /25 1 QUESTION 1(Performance evaluation) 1 points We are
More informationThe Processor. Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut. CSE3666: Introduction to Computer Architecture
The Processor Z. Jerry Shi Department of Computer Science and Engineering University of Connecticut CSE3666: Introduction to Computer Architecture Introduction CPU performance factors Instruction count
More informationLecture 6: Pipelining
Lecture 6: Pipelining i CSCE 26 Computer Organization Instructor: Saraju P. ohanty, Ph. D. NOTE: The figures, text etc included in slides are borrowed from various books, websites, authors pages, and other
More informationBinvert Operation (add, and, or) M U X
Exercises 5 - IPS datapath and control Questions 1. In the circuit of the AL back in lecture 4, we included an adder, an AND gate, and an OR gate. A multiplexor was used to select one of these three values.
More informationDEE 1053 Computer Organization Lecture 6: Pipelining
Dept. Electronics Engineering, National Chiao Tung University DEE 1053 Computer Organization Lecture 6: Pipelining Dr. Tian-Sheuan Chang tschang@twins.ee.nctu.edu.tw Dept. Electronics Engineering National
More informationEECS 151/251A Fall 2017 Digital Design and Integrated Circuits. Instructor: John Wawrzynek and Nicholas Weaver. Lecture 13 EE141
EECS 151/251A Fall 2017 Digital Design and Integrated Circuits Instructor: John Wawrzynek and Nicholas Weaver Lecture 13 Project Introduction You will design and optimize a RISC-V processor Phase 1: Design
More informationVery Simple MIPS Implementation
06 1 MIPS Pipelined Implementation 06 1 line: (In this set.) Unpipelined Implementation. (Diagram only.) Pipelined MIPS Implementations: Hardware, notation, hazards. Dependency Definitions. Hazards: Definitions,
More informationCOSC 6385 Computer Architecture - Pipelining
COSC 6385 Computer Architecture - Pipelining Fall 2006 Some of the slides are based on a lecture by David Culler, Instruction Set Architecture Relevant features for distinguishing ISA s Internal storage
More information4. What is the average CPI of a 1.4 GHz machine that executes 12.5 million instructions in 12 seconds?
Chapter 4: Assessing and Understanding Performance 1. Define response (execution) time. 2. Define throughput. 3. Describe why using the clock rate of a processor is a bad way to measure performance. Provide
More informationCSE 378 Midterm 2/12/10 Sample Solution
Question 1. (6 points) (a) Rewrite the instruction sub $v0,$t8,$a2 using absolute register numbers instead of symbolic names (i.e., if the instruction contained $at, you would rewrite that as $1.) sub
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #19: Pipelining II 2005-07-21 Andy Carle CS 61C L19 Pipelining II (1) Review: Datapath for MIPS PC instruction memory rd rs rt registers
More informationECE154A Introduction to Computer Architecture. Homework 4 solution
ECE154A Introduction to Computer Architecture Homework 4 solution 4.16.1 According to Figure 4.65 on the textbook, each register located between two pipeline stages keeps data shown below. Register IF/ID
More informationPS Midterm 2. Pipelining
PS idterm 2 Pipelining Seqential Landry 6 P 7 8 9 idnight Time T a s k O r d e r A B C D 3 4 2 3 4 2 3 4 2 3 4 2 Seqential landry takes 6 hors for 4 loads If they learned pipelining, how long wold landry
More informationFinal Exam Spring 2017
COE 3 / ICS 233 Computer Organization Final Exam Spring 27 Friday, May 9, 27 7:3 AM Computer Engineering Department College of Computer Sciences & Engineering King Fahd University of Petroleum & Minerals
More informationProcessor Architecture. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Processor Architecture Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Moore s Law Gordon Moore @ Intel (1965) 2 Computer Architecture Trends (1)
More informationLECTURE 9. Pipeline Hazards
LECTURE 9 Pipeline Hazards PIPELINED DATAPATH AND CONTROL In the previous lecture, we finalized the pipelined datapath for instruction sequences which do not include hazards of any kind. Remember that
More informationCS232 Final Exam May 5, 2001
CS232 Final Exam May 5, 2 Name: This exam has 4 pages, including this cover. There are six questions, worth a total of 5 points. You have 3 hours. Budget your time! Write clearly and show your work. State
More informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN 5 Edition th The Hardware/Software Interface Chapter 4 The Processor 4.1 Introduction Introduction CPU performance factors Instruction count CPI and Cycle time Determined
More informationVery Simple MIPS Implementation
06 1 MIPS Pipelined Implementation 06 1 line: (In this set.) Unpipelined Implementation. (Diagram only.) Pipelined MIPS Implementations: Hardware, notation, hazards. Dependency Definitions. Hazards: Definitions,
More informationCS420/520 Homework Assignment: Pipelining
CS42/52 Homework Assignment: Pipelining Total: points. 6.2 []: Using a drawing similar to the Figure 6.8 below, show the forwarding paths needed to execute the following three instructions: Add $2, $3,
More informationECE260: Fundamentals of Computer Engineering
ECE260: Fundamentals of Computer Engineering Pipelined Datapath and Control James Moscola Dept. of Engineering & Computer Science York College of Pennsylvania ECE260: Fundamentals of Computer Engineering
More informationFull Datapath. Chapter 4 The Processor 2
Pipelining Full Datapath Chapter 4 The Processor 2 Datapath With Control Chapter 4 The Processor 3 Performance Issues Longest delay determines clock period Critical path: load instruction Instruction memory
More informationLecture 19 Introduction to Pipelining
CSE 30321 Lecture 19 Pipelining (Part 1) 1 Lecture 19 Introduction to Pipelining CSE 30321 Lecture 19 Pipelining (Part 1) Basic pipelining basic := single, in-order issue single issue one instruction at
More informationComputer Architecture. Lecture 6.1: Fundamentals of
CS3350B Computer Architecture Winter 2015 Lecture 6.1: Fundamentals of Instructional Level Parallelism Marc Moreno Maza www.csd.uwo.ca/courses/cs3350b [Adapted from lectures on Computer Organization and
More informationPipelining. Ideal speedup is number of stages in the pipeline. Do we achieve this? 2. Improve performance by increasing instruction throughput ...
CHAPTER 6 1 Pipelining Instruction class Instruction memory ister read ALU Data memory ister write Total (in ps) Load word 200 100 200 200 100 800 Store word 200 100 200 200 700 R-format 200 100 200 100
More informationChapter Six. Dataı access. Reg. Instructionı. fetch. Dataı. Reg. access. Dataı. Reg. access. Dataı. Instructionı fetch. 2 ns 2 ns 2 ns 2 ns 2 ns
Chapter Si Pipelining Improve perfomance by increasing instruction throughput eecutionı Time lw $, ($) 2 6 8 2 6 8 access lw $2, 2($) 8 ns access lw $3, 3($) eecutionı Time lw $, ($) lw $2, 2($) 2 ns 8
More informationInstruction Level Parallelism. Appendix C and Chapter 3, HP5e
Instruction Level Parallelism Appendix C and Chapter 3, HP5e Outline Pipelining, Hazards Branch prediction Static and Dynamic Scheduling Speculation Compiler techniques, VLIW Limits of ILP. Implementation
More informationProcessor (II) - pipelining. Hwansoo Han
Processor (II) - pipelining Hwansoo Han Pipelining Analogy Pipelined laundry: overlapping execution Parallelism improves performance Four loads: Speedup = 8/3.5 =2.3 Non-stop: 2n/0.5n + 1.5 4 = number
More informationThe Processor (3) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University
The Processor (3) Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu Jeong (jinkyu@skku.edu)
More informationProcessor Architecture
Processor Architecture Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationComputer Architecture
Lecture 3: Pipelining Iakovos Mavroidis Computer Science Department University of Crete 1 Previous Lecture Measurements and metrics : Performance, Cost, Dependability, Power Guidelines and principles in
More informationCSEN 601: Computer System Architecture Summer 2014
CSEN 601: Computer System Architecture Summer 2014 Practice Assignment 5 Solutions Exercise 5-1: (Midterm Spring 2013) a. What are the values of the control signals (except ALUOp) for each of the following
More informationPipelined datapath Staging data. CS2504, Spring'2007 Dimitris Nikolopoulos
Pipelined datapath Staging data b 55 Life of a load in the MIPS pipeline Note: both the instruction and the incremented PC value need to be forwarded in the next stage (in case the instruction is a beq)
More informationCS 351 Exam 2 Mon. 11/2/2015
CS 351 Exam 2 Mon. 11/2/2015 Name: Rules and Hints The MIPS cheat sheet and datapath diagram are attached at the end of this exam for your reference. You may use one handwritten 8.5 11 cheat sheet (front
More informationMidnight Laundry. IC220 Set #19: Laundry, Co-dependency, and other Hazards of Modern (Architecture) Life. Return to Chapter 4
IC220 Set #9: Laundry, Co-dependency, and other Hazards of Modern (Architecture) Life Return to Chapter 4 Midnight Laundry Task order A B C D 6 PM 7 8 9 0 2 2 AM 2 Smarty Laundry Task order A B C D 6 PM
More informationChapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor The Processor - Introduction
More informationCOMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition The Processor - Introduction
More informationComputer Organization and Structure
Computer Organization and Structure 1. Assuming the following repeating pattern (e.g., in a loop) of branch outcomes: Branch outcomes a. T, T, NT, T b. T, T, T, NT, NT Homework #4 Due: 2014/12/9 a. What
More informationOutline Marquette University
COEN-4710 Computer Hardware Lecture 4 Processor Part 2: Pipelining (Ch.4) Cristinel Ababei Department of Electrical and Computer Engineering Credits: Slides adapted primarily from presentations from Mike
More informationFull Datapath. CSCI 402: Computer Architectures. The Processor (2) 3/21/19. Fengguang Song Department of Computer & Information Science IUPUI
CSCI 42: Computer Architectures The Processor (2) Fengguang Song Department of Computer & Information Science IUPUI Full Datapath Branch Target Instruction Fetch Immediate 4 Today s Contents We have looked
More informationECE Exam II - Solutions November 8 th, 2017
ECE 3056 Exam II - Solutions November 8 th, 2017 1. (15 pts) To the base pipeline we add data forwarding to EX, data hazard detection and stall generation, and branches implemented in MEM and predicted
More informationLECTURE 3: THE PROCESSOR
LECTURE 3: THE PROCESSOR Abridged version of Patterson & Hennessy (2013):Ch.4 Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU
More information(Basic) Processor Pipeline
(Basic) Processor Pipeline Nima Honarmand Generic Instruction Life Cycle Logical steps in processing an instruction: Instruction Fetch (IF_STEP) Instruction Decode (ID_STEP) Operand Fetch (OF_STEP) Might
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 17: Pipelining Wrapup Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Outline The textbook includes lots of information Focus on
More informationECE473 Computer Architecture and Organization. Processor: Combined Datapath
Computer Architecture and Organization Processor: Combined path Lecturer: Prof. Yifeng Zhu Fall, 2014 Portions of these slides are derived from: Dave Patterson CB 1 Where are we? Want to build a processor
More informationECE 552 / CPS 550 Advanced Computer Architecture I. Lecture 6 Pipelining Part 1
ECE 552 / CPS 550 Advanced Computer Architecture I Lecture 6 Pipelining Part 1 Benjamin Lee Electrical and Computer Engineering Duke University www.duke.edu/~bcl15 www.duke.edu/~bcl15/class/class_ece252fall12.html
More informationELEC 5200/6200 Computer Architecture and Design Spring 2017 Lecture 4: Datapath and Control
ELEC 52/62 Computer Architecture and Design Spring 217 Lecture 4: Datapath and Control Ujjwal Guin, Assistant Professor Department of Electrical and Computer Engineering Auburn University, Auburn, AL 36849
More informationPipelining. lecture 15. MIPS data path and control 3. Five stages of a MIPS (CPU) instruction. - factory assembly line (Henry Ford years ago)
lecture 15 Pipelining MIPS data path and control 3 - factory assembly line (Henry Ford - 100 years ago) - car wash Multicycle model: March 7, 2016 Pipelining - cafeteria -... Main idea: achieve efficiency
More informationProcessor Design Pipelined Processor. Hung-Wei Tseng
Processor Design Pipelined Processor Hung-Wei Tseng Pipelining 7 Pipelining Break up the logic with isters into pipeline stages Each stage can act on different instruction/data States/Control signals of
More informationCS 251, Winter 2018, Assignment % of course mark
CS 251, Winter 2018, Assignment 5.0.4 3% of course mark Due Wednesday, March 21st, 4:30PM Lates accepted until 10:00am March 22nd with a 15% penalty 1. (10 points) The code sequence below executes on a
More informationzhandling Data Hazards The objectives of this module are to discuss how data hazards are handled in general and also in the MIPS architecture.
zhandling Data Hazards The objectives of this module are to discuss how data hazards are handled in general and also in the MIPS architecture. We have already discussed in the previous module that true
More informationECE 3056: Architecture, Concurrency, and Energy of Computation. Sample Problem Sets: Pipelining
ECE 3056: Architecture, Concurrency, and Energy of Computation Sample Problem Sets: Pipelining 1. Consider the following code sequence used often in block copies. This produces a special form of the load
More informationCS 230 Practice Final Exam & Actual Take-home Question. Part I: Assembly and Machine Languages (22 pts)
Part I: Assembly and Machine Languages (22 pts) 1. Assume that assembly code for the following variable definitions has already been generated (and initialization of A and length). int powerof2; /* powerof2
More informationEECS150 - Digital Design Lecture 10- CPU Microarchitecture. Processor Microarchitecture Introduction
EECS150 - Digital Design Lecture 10- CPU Microarchitecture Feb 18, 2010 John Wawrzynek Spring 2010 EECS150 - Lec10-cpu Page 1 Processor Microarchitecture Introduction Microarchitecture: how to implement
More informationPage 1. Pipelining: Its Natural! Chapter 3. Pipelining. Pipelined Laundry Start work ASAP. Sequential Laundry A B C D. 6 PM Midnight
Pipelining: Its Natural! Chapter 3 Pipelining Laundry Example Ann, Brian, Cathy, Dave each have one load of clothes to wash, dry, and fold Washer takes 30 minutes A B C D Dryer takes 40 minutes Folder
More informationAdvanced Computer Architecture Pipelining
Advanced Computer Architecture Pipelining Dr. Shadrokh Samavi Some slides are from the instructors resources which accompany the 6 th and previous editions of the textbook. Some slides are from David Patterson,
More informationDepartment of Computer and IT Engineering University of Kurdistan. Computer Architecture Pipelining. By: Dr. Alireza Abdollahpouri
Department of Computer and IT Engineering University of Kurdistan Computer Architecture Pipelining By: Dr. Alireza Abdollahpouri Pipelined MIPS processor Any instruction set can be implemented in many
More informationTDT4255 Friday the 21st of October. Real world examples of pipelining? How does pipelining influence instruction
Review Friday the 2st of October Real world eamples of pipelining? How does pipelining pp inflence instrction latency? How does pipelining inflence instrction throghpt? What are the three types of hazard
More information