Computer Architecture - Test A, answers Answer 1 addi$1,$zero,1addi$2,$zero,2 addi$3,$zero,3beq$8,$1,c1 beq$8,$2,c2 bne$8,$3,End addi$6,$6,1j End c1:addi.

Slides:



Advertisements
Similar presentations
Adding the Jump Instruction
Advertisements

CMSC 611: Advanced Computer Architecture Pipelining Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted.
Pipeline Computer Organization II 1 Hazards Situations that prevent starting the next instruction in the next cycle Structural hazards – A required resource.
Goal: Describe Pipelining
MIPS Pipelined Datapath
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Pipeline Hazards See: P&H Chapter 4.7.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Pipelined Processor.
Review: MIPS Pipeline Data and Control Paths
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
ENEE350 Ankur Srivastava University of Maryland, College Park Based on Slides from Mary Jane Irwin ( )
EECS 470 Pipeline Hazards Lecture 4 Coverage: Appendix A.
1 Stalling  The easiest solution is to stall the pipeline  We could delay the AND instruction by introducing a one-cycle delay into the pipeline, sometimes.
Goal: Reduce the Penalty of Control Hazards
 The actual result $1 - $3 is computed in clock cycle 3, before it’s needed in cycles 4 and 5  We forward that value to later instructions, to prevent.
Computer ArchitectureFall 2007 © October 31, CS-447– Computer Architecture M,W 10-11:20am Lecture 17 Review.
Computer Organization Lecture Set – 06 Chapter 6 Huei-Yung Lin.
Exp. 6 Solving Data Hazards. Where to find ALU Result Instruction memory Data memory 1010 PC ALU Registers Rd Rt 0101 IF/IDID/EXEX/MEMMEM/WB.
Pipelined Datapath and Control (Lecture #15) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying Computer.
Lecture 28: Chapter 4 Today’s topic –Data Hazards –Forwarding 1.
Computer Architecture - A Pipelined Datapath A Pipelined Datapath  Resisters are used to save data between stages. 1/14.
Lecture 24: CPU Design Today’s topic –Multi-Cycle ALU –Introduction to Pipelining 1.
1 Stalls and flushes  So far, we have discussed data hazards that can occur in pipelined CPUs if some instructions depend upon others that are still executing.
Lecture 15: Pipelining and Hazards CS 2011 Fall 2014, Dr. Rozier.
Memory/Storage Architecture Lab Computer Architecture Pipelining Basics.
Pipeline Data Hazards: Detection and Circumvention Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly.
Chapter 4 CSF 2009 The processor: Pipelining. Performance Issues Longest delay determines clock period – Critical path: load instruction – Instruction.
Pipeline Hazards. CS5513 Fall Pipeline Hazards Situations that prevent the next instructions in the instruction stream from executing during its.
CSE431 L07 Overcoming Data Hazards.1Irwin, PSU, 2005 CSE 431 Computer Architecture Fall 2005 Lecture 07: Overcoming Data Hazards Mary Jane Irwin (
CSIE30300 Computer Architecture Unit 05: Overcoming Data Hazards Hsin-Chou Chi [Adapted from material by and
Adapted from Computer Organization and Design, Patterson & Hennessy, UCB ECE232: Hardware Organization and Design Part 13: Branch prediction (Chapter 4/6)
Introduction to Computer Organization Pipelining.
EECS 370 Discussion 1 Calvin and Hobbes by Bill Watterson.
Pipelining: Implementation CPSC 252 Computer Organization Ellen Walker, Hiram College.
EECS 322 April 10, 2000 EECS 322 Computer Architecture Pipeline Control, Data Hazards and Branch Hazards.
CSE 340 Computer Architecture Spring 2016 Overcoming Data Hazards.
Interstage Buffers 1 Computer Organization II © McQuain Pipeline Timing Issues Consider executing: add $t2, $t1, $t0 sub $t3, $t1, $t0 or.
EECS 370 Discussion smbc-comics.com.
Pipelining. Review TypeDatapathTime (CPI, cycle time) Single-cycleNo reuseCPI=1, cc=big (imem + reg + ALU + dmem) Multi-cycleReuseCPI=3-5, cc=small max(imem,
Pipeline Timing Issues
Computer Organization
Stalling delays the entire pipeline
CSCI206 - Computer Organization & Programming
Test 2 review Lectures 5-10.
Single Clock Datapath With Control
Chapter 4 The Processor Part 4
ECS 154B Computer Architecture II Spring 2009
ECS 154B Computer Architecture II Spring 2009
CDA 3101 Spring 2016 Introduction to Computer Organization
ECE232: Hardware Organization and Design
Test 2 review Lectures 5-10.
Chapter 4 The Processor Part 3
Review: MIPS Pipeline Data and Control Paths
Morgan Kaufmann Publishers The Processor
CSCI206 - Computer Organization & Programming
Pipelining review.
Current Design.
Computer Organization CS224
Lecture 9. MIPS Processor Design – Pipelined Processor Design #2
Computer Architecture
Pipelining in more detail
CSC 4250 Computer Architectures
Computer Architecture
Data Hazards Data Hazard
The Processor Lecture 3.6: Control Hazards
Pipelining (II).
Introduction to Computer Organization and Architecture
Systems Architecture II
Pipelining - 1.
MIPS Pipelined Datapath
Problem ??: (?? marks) Consider executing the following code on the MIPS pipelined datapath: add $t5, $t6, $t8 add $t9, $t5, $t4 lw $t3, 100($t9) sub $t2,
Presentation transcript:

Computer Architecture - Test A, answers Answer 1 addi$1,$zero,1addi$2,$zero,2 addi$3,$zero,3beq$8,$1,c1 beq$8,$2,c2 bne$8,$3,End addi$6,$6,1j End c1:addi $4,$4,1jEnd c2:addi $5,$5,1 End: … The CPI is 7/11 = 0.63 Reordering doesn’t add anything in this case

Computer Architecture - Test A, answers Answers 2,3  The CPI on a Multi-Cycle datapath is: 15%*4 + 11%*5 + 61%*4 + 10%*3 + 3%*2 = = 3.95  On a 5 stage pipelined datapath the number of cycles the program is executed is *1 = 104. On the Multi-Cycle datapath 100 instructions take 395 cycles.  The speedup is 395/104 = 3.79  Answer 3: When more than one instruction in the same cycle needs the same unit and there is only one copy of it.  For instance if there is only 1 multiplier and two multiplication instructions can be issued in the same cycle.

Computer Architecture - Test A, answers Answer 4 for(i=0;i<n;i++){ if(i%2==0)branch A a[i]=a[i]*2; sum = sum + a[i]; if(i%2==1)branch B sum++; }branch C  Assuming that the first time a branch is encountered it is mispredicted then the misprediction rates are 100% for branches A and B and 2/n for branch C. Every iteration the predictions A and B are reversed.  Adding a 2-level (2,1) BHT doesn’t change the rate of branch C but lowers the rates of A and B to 2/n as well.  This is because B is taken if A isn’t and isn’t taken if A is. Ais taken if the former B was and isn’t taken if the former B wasn’t taken.

Computer Architecture - Test A, answers Answer 5,6  CPI = 52%*1 + 16%*1 + 15%*(75%*2 + 25%*1) + 3%*2 + 14%*(20%*2 + 80%+1) = *(1.75) *(1.2) = 1.17  Answer 6: We can’t perform two branches in the same cycle because they both might succeed. Which instruction changes the PC? But if both branch to the same PC it would be possible to execute them at the same cycle.  For example the code if(a==b || a==c) b++; could be translated to: beq $a0,$a1,L1beq$a0,$a2,L1 … L1:addi $a1,$a1,1

Computer Architecture - Test A, answers Answer 7,8  The Forwarding Unit detects data hazards by looking at the register values in the ID/EX, EX/MEM, and MEM/WB registers. If ID/EX.Rs or ID/EX.Rt match EX/MEM.Rd or MEM/WB.Rd there is a data hazard. The EX stage needs a register that hasn't been updated yet. The Forwarding Unit avoids the hazard by "forwarding" the value from the EX/MEM or MEM/WB registers directly into the ALU.  Answer 8: beq : = 1996/4 = 499. j : 80000/4 =  The jump is possible because the 4 MSBs of both the source and target PC are the same.