Chapter 6 Exercises with solutions

Similar documents
ECE260: Fundamentals of Computer Engineering

Lecture Topics. Announcements. Today: Data and Control Hazards (P&H ) Next: continued. Exam #1 returned. Milestone #5 (due 2/27)

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

Processor (II) - pipelining. Hwansoo Han

Chapter 4 The Processor 1. Chapter 4B. The Processor

Full Datapath. Chapter 4 The Processor 2

Pipelined datapath Staging data. CS2504, Spring'2007 Dimitris Nikolopoulos

The Processor (3) Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

ECE473 Computer Architecture and Organization. Pipeline: Data Hazards

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

Pipeline Hazards. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

ELE 655 Microprocessor System Design

EE557--FALL 1999 MIDTERM 1. Closed books, closed notes

CSEE 3827: Fundamentals of Computer Systems

Chapter 4. The Processor

Full Datapath. Chapter 4 The Processor 2

CS 251, Winter 2019, Assignment % of course mark

COMPUTER ORGANIZATION AND DESIGN

Department of Computer and IT Engineering University of Kurdistan. Computer Architecture Pipelining. By: Dr. Alireza Abdollahpouri

Outline Marquette University

ECE Exam II - Solutions November 8 th, 2017

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

COMPUTER ORGANIZATION AND DESIGN

Thomas Polzer Institut für Technische Informatik

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor

LECTURE 3: THE PROCESSOR

CS 2506 Computer Organization II Test 2. Do not start the test until instructed to do so! printed

CS232 Final Exam May 5, 2001

Unresolved data hazards. CS2504, Spring'2007 Dimitris Nikolopoulos

CS 251, Winter 2018, Assignment % of course mark

LECTURE 9. Pipeline Hazards

ECS 154B Computer Architecture II Spring 2009

Computer Architecture Computer Science & Engineering. Chapter 4. The Processor BK TP.HCM

CENG 3420 Lecture 06: Pipeline

Computer Architecture Computer Science & Engineering. Chapter 4. The Processor BK TP.HCM

Determined by ISA and compiler. We will examine two MIPS implementations. A simplified version A more realistic pipelined version

Chapter 4. The Processor

Question 1: (20 points) For this question, refer to the following pipeline architecture.

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

Chapter 4. The Processor

Chapter 4. The Processor

EIE/ENE 334 Microprocessors

14:332:331 Pipelined Datapath

CS/CoE 1541 Mid Term Exam (Fall 2018).

Design a MIPS Processor (2/2)

DEE 1053 Computer Organization Lecture 6: Pipelining

CS/CoE 1541 Exam 1 (Spring 2019).

Chapter 4. The Processor. Jiang Jiang

Chapter 4. The Processor

Pipelined Processor Design

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition. Chapter 4. The Processor

Pipelining is Hazardous!

Midnight Laundry. IC220 Set #19: Laundry, Co-dependency, and other Hazards of Modern (Architecture) Life. Return to Chapter 4

Lecture 9 Pipeline and Cache

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours.

Instruction word R0 R1 R2 R3 R4 R5 R6 R8 R12 R31

ECE 3056: Architecture, Concurrency, and Energy of Computation. Sample Problem Sets: Pipelining

ECE Exam II - Solutions October 30 th, :35 pm 5:55pm

DLX Unpipelined Implementation

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

CS 2506 Computer Organization II Test 2

CS3350B Computer Architecture Quiz 3 March 15, 2018

ECE154A Introduction to Computer Architecture. Homework 4 solution

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

cs470 - Computer Architecture 1 Spring 2002 Final Exam open books, open notes

NATIONAL UNIVERSITY OF SINGAPORE

ECE 313 Computer Organization FINAL EXAM December 13, 2000

COSC121: Computer Systems. ISA and Performance

Lab # 6. Using Subqueries and Set Operators. Eng. Alaa O Shama

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

CENG 3531 Computer Architecture Spring a. T / F A processor can have different CPIs for different programs.

EE557--FALL 1999 MAKE-UP MIDTERM 1. Closed books, closed notes

Pipelining. lecture 15. MIPS data path and control 3. Five stages of a MIPS (CPU) instruction. - factory assembly line (Henry Ford years ago)

Pipelined Processor Design

Advanced Parallel Architecture Lessons 5 and 6. Annalisa Massini /2017

1 Hazards COMP2611 Fall 2015 Pipelined Processor

ECE260: Fundamentals of Computer Engineering

ECE 313 Computer Organization FINAL EXAM December 14, This exam is open book and open notes. You have 2 hours.

Codeword[1] Codeword[0]

Computer Organization and Structure

Final Exam Fall 2008

OPEN BOOK, OPEN NOTES. NO COMPUTERS, OR SOLVING PROBLEMS DIRECTLY USING CALCULATORS.

CSE Quiz 3 - Fall 2009

CSE Lecture 13/14 In Class Handout For all of these problems: HAS NOT CANNOT Add Add Add must wait until $5 written by previous add;

CPE 335 Computer Organization. Basic MIPS Pipelining Part I

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

Basic Instruction Timings. Pipelining 1. How long would it take to execute the following sequence of instructions?

Instruction Frequency CPI. Load-store 55% 5. Arithmetic 30% 4. Branch 15% 4

COMP2611: Computer Organization. The Pipelined Processor

CS232 Final Exam May 5, 2001

Pipeline Data Hazards. Dealing With Data Hazards

CS2100 Computer Organisation Tutorial #10: Pipelining Answers to Selected Questions

Lab # 6. Data Manipulation Language (DML)

Computer and Information Sciences College / Computer Science Department Enhancing Performance with Pipelining

Pipelined Datapath. Reading. Sections Practice Problems: 1, 3, 8, 12

PS Midterm 2. Pipelining

Pipelining. CSC Friday, November 6, 2015

2. [3 marks] Show your work in the computation for the following questions involving CPI and performance.

Computer Architecture CS372 Exam 3

Processor Design Pipelined Processor (II) Hung-Wei Tseng

Transcription:

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 3010: Computer Architecture Discussion Chapter 6 Exercises with solutions Eng. Eman R. Habib December, 2013

2 Computer Architecture Discussion Exercise 1: (6.3 from book) Exercise 2: (6.4 from book) There is a data dependency through $3 between the first instruction and each subsequent instruction. There is a data dependency through $6 between the lw instruction and the last instruction. The data dependencies between the first instruction and each subsequent instruction can be resolved by using forwarding. The data dependency between the load and the last add instruction cannot be resolved by using forwarding, cause a stall.

3 Computer Architecture Discussion Exercise 3: (6.17 from book) At the end of the fifth cycle: instruction 1 finish WB stage, instruction 2 finish MEM stage, instruction 3 finish EX stage, instruction 4 finish ID stage and instruction 5 finish IF stage. Registers are being read after ID stage instruction 4, registers $6 and $1 are being read. Registers are being written after WB stage instruction 1, register $2 is being written. Exercise 4: (6.18 from book) The forwarding unit is seeing if it needs to forward. It is looking at the instructions in the fourth and fifth stages and checking to see whether they intend to write to the register file and whether the register written is being used as an ALU input. Thus, it is comparing: EX/MEM.RegisterRd = ID/EX.RegisterRs? $ 4 = $3? EX/MEM.RegisterRd = ID/EX.RegisterRt?, $4 = $7? MEM/WB.RegisterRd = ID/EX.RegisterRs?, $2 = $3? MEM/WB.RegisterRd = ID/EX.RegisterRt? $2 = $7?

4 Computer Architecture Discussion Exercise 5: (6.19 from book) The hazard detection unit is checking to see whether the instruction in the ALU stage is an lw instruction and whether the instruction in the ID stage is reading the register that the lw will be writing. If it is, it needs to stall. If there is an lw instruction, it checks to see whether: ID/EX.RegisterRt = IF/ID.RegisterRs? $7 = $6? ID/EX.RegisterRt = IF/ID.RegisterRt? $7 = $1? Exercise 6: (6.21 from book) a. There will be a bubble of 1 cycle between a lw and the dependent add since the load value is available after the MEM stage. There is no bubble between an add and the dependent lw since the add result is available after the EX stage and it can be forwarded to the EX stage for the dependent lw. After 2 instructions (add, lw) there is a bubble of 1 cycle, so every 2 instructions need 3 cycles. Therefore, CPI = cycle/instruction 3/2 = 1.5. b. Without forwarding, the value being written into a register can only be read in the same cycle. As a result, there will be a bubble of 2 cycles between an lw and the dependent add since the load value is written to the register after the MEM stage. Similarly, there will be a bubble of 2 cycles between an add and the dependent lw, so every instruction needs 3 cycles. Therefore, CPI 3.

5 Computer Architecture Discussion Exercise 7: (6.22 from book) It will take 8 cycles to execute this code, including a bubble of 1 cycle due to the dependency between the lw and sub instructions. 5 cycles for the lw (five stages) + 1 cycle bubble + 1 cycle for sub + 1 cycle for add = 8 cycles.

6 Computer Architecture Discussion Exercise 8: (6.23 from book) Exercise 9: Add a Forward Unit For load immediately followed by store if (EX/MEM.MemWrite and (MEM/WB. RegWrite) and (MEM/WB.RegisterRt!= 0) and (MEM/WB.RegisterRt = EX/MEM.RegisterRt)) ForwardC = 1

7 Computer Architecture Discussion Exercise 10: Add a Forward Unit For add immediately followed by store if (EX/MEM.MemWrite and (MEM/WB. RegWrite) and (MEM/WB.RegisterRd!= 0) and (MEM/WB.RegisterRd = EX/MEM.RegisterRt)) ForwardC = 1

8 Computer Architecture Discussion The Last Discussion I hope you have benefited from me in this course and I wish you Good luck in your final exams and Good luck in all your life I wish you all the Best my lovely students Best Wishes