1 A few words about the quiz Closed book, but you may bring in a page of handwritten notes. –You need to know what the “core” MIPS instructions do. –I.

Slides:



Advertisements
Similar presentations
Morgan Kaufmann Publishers The Processor
Advertisements

Pipeline Exceptions & ControlCSCE430/830 Pipelining in MIPS MIPS architecture was designed to be pipelined –Simple instruction format (makes IF, ID easy)
Lecture Objectives: 1)Define pipelining 2)Calculate the speedup achieved by pipelining for a given number of instructions. 3)Define how pipelining improves.
MIPS Pipelined Datapath
Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University Pipeline Hazards See: P&H Chapter 4.7.
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  2004 Morgan Kaufmann Publishers Chapter Six. 2  2004 Morgan Kaufmann Publishers Pipelining The laundry analogy.
©UCB CS 162 Computer Architecture Lecture 3: Pipelining Contd. Instructor: L.N. Bhuyan
Chapter Six Enhancing Performance with Pipelining
CSCE 212 Quiz 9 – 3/30/11 1.What is the clock cycle time based on for single-cycle and for pipelining? 2.What two actions can be done to resolve data hazards?
Computer Structure - Datapath and Control Goal: Design a Datapath  We will design the datapath of a processor that includes a subset of the MIPS instruction.
ENGS 116 Lecture 51 Pipelining and Hazards Vincent H. Berk September 30, 2005 Reading for today: Chapter A.1 – A.3, article: Patterson&Ditzel Reading for.
Pipeline Data Hazards: Detection and Circumvention Adapted from Computer Organization and Design, Patterson & Hennessy, © 2005, and from slides kindly.
Pipelined Datapath and Control
1 Designing a Pipelined Processor In this Chapter, we will study 1. Pipelined datapath 2. Pipelined control 3. Data Hazards 4. Forwarding 5. Branch Hazards.
CMPE 421 Parallel Computer Architecture Part 2: Hardware Solution: Forwarding.
CECS 440 Pipelining.1(c) 2014 – R. W. Allison [slides adapted from D. Patterson slides with additional credits to M.J. Irwin]
Winter 2002CSE Topic Branch Hazards in the Pipelined Processor.
5/13/99 Ashish Sabharwal1 Pipelining and Hazards n Hazards occur because –Don’t have enough resources (ALU’s, memory,…) Structural Hazard –Need a value.
2/15/02CSE Data Hazzards Data Hazards in the Pipelined Implementation.
1  1998 Morgan Kaufmann Publishers Chapter Six. 2  1998 Morgan Kaufmann Publishers Pipelining Improve perfomance by increasing instruction throughput.
CSIE30300 Computer Architecture Unit 05: Overcoming Data Hazards Hsin-Chou Chi [Adapted from material by and
Introduction to Computer Organization Pipelining.
Pipelining: Implementation CPSC 252 Computer Organization Ellen Walker, Hiram College.
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.
Computer Architecture Lecture 6.  Our implementation of the MIPS is simplified memory-reference instructions: lw, sw arithmetic-logical instructions:
Pipeline Timing Issues
Computer Organization
Single-Cycle Datapath and Control
Note how everything goes left to right, except …
CDA 3101 Spring 2016 Introduction to Computer Organization
CSCI206 - Computer Organization & Programming
Test 2 review Lectures 5-10.
Single Clock Datapath With Control
Pipeline Implementation (4.6)
Test 2 review Lectures 5-10.
Forwarding Now, we’ll introduce some problems that data hazards can cause for our pipelined processor, and show how to handle them with forwarding.
Chapter 4 The Processor Part 3
Review: MIPS Pipeline Data and Control Paths
Pipelining review.
Single-cycle datapath, slightly rearranged
Pipelining Chapter 6.
Current Design.
CSCI206 - Computer Organization & Programming
CS/COE0447 Computer Organization & Assembly Language
CS/COE0447 Computer Organization & Assembly Language
Pipelining in more detail
CSCI206 - Computer Organization & Programming
MIPS Processor.
CSCI206 - Computer Organization & Programming
Data Hazards Data Hazard
Pipeline control unit (highly abstracted)
The Processor Lecture 3.6: Control Hazards
The Processor Lecture 3.2: Building a Datapath with Control
The Processor Lecture 3.5: Data Hazards
Pipeline control unit (highly abstracted)
Pipelining: Basic Concepts
Pipeline Control unit (highly abstracted)
Data Path Diagrams.
Introduction to Computer Organization and Architecture
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,
©2003 Craig Zilles (derived from slides by Howard Huang)
MIPS Processor.
Processor: Datapath and Control
ELEC / Computer Architecture and Design Spring 2015 Pipeline Control and Performance (Chapter 6) Vishwani D. Agrawal James J. Danaher.
Presentation transcript:

1 A few words about the quiz Closed book, but you may bring in a page of handwritten notes. –You need to know what the “core” MIPS instructions do. –I don’t really think of you’ll need notes, but it’s up to you. In “fill in the blank” questions, you will get partial credit for answering “I don’t know” or leaving it blank. (For instance, if there are 3 choices, you will get 1/3 credit for leaving it blank.) The relevant circuit diagrams will be in the test. Pages 3 and 4 are exercises that may be similar to test question. Answers are given on pages 6 and 7.

2 Some information about the MIPS This information will be restated on the test, but it might save you time to read it over beforehand. Some “core” MIPS assembly instructions: –lw = load word –sw = store word –add, sub, and, or, xor = various R-format instructions –beq = branch on equal –j = jump The first argument of MIPS assembly instructions is the target register (except for sw). Note that the arguments don’t appear in the same order as in the machine language instruction format. MemRead = 0 means “don’t read”, MemRead = 1 means “read”. Similarly, MemWrite=0 means “don’t write”, MemWrite = 1 means “write”. The two-bit ALUop signal, which goes from the “control” unit to the “ALU control” unit, has the following possible values: –“00” means “the ALU should add”, –“01” means “the ALU should test for equality” –“10” means “the ALU should execute the operation specified by the funct field (bits 0-5) of the instruction” The mux control signals select the inputs as shown in the diagrams. They may be different from the book or lectures – use what is shown on the test diagrams.

3 Pipelining Exercises Consider the following MIPS assembly code: add $3, $2, $3 lw $4, 100($3) sub $7, $6, $2 xor $6, $4, $3 Assume there is no forwarding or stalling circuitry in a pipelined processor that uses the standard 5-stages (IF, ID, EX, Mem, WB). Instead, we will require the compiler to add no-ops to the code to ensure correct execution. (Assume that if the processor reads and writes to the same register in a given cycle, the value read out will be the new value that is written in.) 1.Rewrite the code to include the no-ops that are needed. Do not change the order of the four statements. Use as few no-ops as possible. 2.Suppose the complier is allowed to change the order of the four statements, provided it doesn’t change the final answer. Is it possible to reduce the number of no-ops needed? Why or why not?

4 Another pipelining exercise Consider (again) the following MIPS assembly code: add $3, $2, $3 lw $4, 100($3) sub $7, $6, $2 xor $6, $4, $3 Assume that there is forwarding and stalling hardware as described in class and the text (the forwarding path is shown in the diagram on the next page). Draw an execution diagram that shows where forwarding and stalling would take place. Use arrows to show forwarding and “bubbles” to show stalls, as in the following (hypothetical) example. IM IDMemWB IFIDMemWB Bubble Ex Cycle This bubble says the ID stage of the lw doesn’t complete until a cycle later. This arrow says the value stored in flip- flops between Mem and WB is forwarded to an ALU input in the Ex stage for the “or”. lw or and IFIDMemWB Ex Here, we forward from the Ex/Mem flip-flops to an ALU input.

5 The pipelined implementation with forwarding (used in the question on the previous page)

6 Solution to 1 & 2 1.Rewrite the code to include the no-ops that are needed. Do not change the order of the four statements. Use as few no-ops as possible. add $3, $2, $3 no-op lw $4, 100($3) sub $7, $6, $2 no-op xor $6, $4, $3 2.Suppose the complier is allowed to change the order of the four statements, provided it doesn’t change the values that are computed. Is it possible to reduce the number of no-ops needed? Why or why not? No. Even though the “sub” instruction can be moved earlier, the “lw” can’t start until three cycles after the “add” starts, and the “xor” can’t start until three cycles after that. Thus, the “xor” can’t start until 6 cycles after the add. The new value of register 3 doesn’t reach the register file until the WB stage of the add instruction, i.e. cycle 5. But the lw instruction needs this value in its ID stage, when it reads register 3 To delay the ID stage of the lw until cycle 5, we need to insert 2 no-ops. The new value of register 4 doesn’t reach the register file until the WB stage of the lw instruction. If we didn’t insert this no-op, the ID stage of the xor would coincide with the Mem stage of the lw. If this were a test, you wouldn’t need to write these explanations; what matters is inserting the no-ops correctly.

7 Solution to “Another pipelining exercise” Consider (again) the following MIPS assembly code: add $3, $2, $3 lw $4, 100($3) sub $7, $6, $2 xor $6, $4, $3 Draw an execution diagram that shows where forwarding and stalling would take place. IFIDMemWB Ex Cycle add lw sub xor IFIDMemWB Ex IFIDMemWB Ex IFIDMemWB Ex