



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions and exercises for homework 2 of the cs433: computer systems organization course offered in spring 2007. The homework covers topics such as tomasulo’s algorithm, dynamic branch prediction, and speculative execution. Students are required to fill in execution profiles, record branch predictions, and answer short questions related to the given code fragments.
Typology: Assignments
1 / 5
This page cannot be seen from the preview
Don't miss anything!




CS433: Computer Systems Organization Spring 2007 Homework 2 Assigned: 2/ Due in class 2/
Instructions: Please write your name, NetID and an alias on your homework submissions for posting grades (If you don’t want your grades posted, then don’t write an alias). We will use this alias throughout the semester. Homeworks are due in class on the date posted.
Functional Unit Cycles in EX # Functional Units # Reservation Stations Integer 1 1 5 FP add/subtract 4 1 4 FP multiply/divide 15 2 4
Table 1: Functional Unit Specification
Fill in the execution profile for the first two iterations of the above code fragment in Table 2, including
The first cycle is filled in for you.
Instruction Reservation Station IS EX WR Comments (if appropriate) L.D F2, 0(R1) Integer 1 1 L.D F4, 8(R1) DIV.D F6, F2, F MUL.D F8, F6, F ADD.D F6, F2, F MUL.D F10, F6, F S.D F8, 0(R1) S.D F10, 8(R1) DADDI R1, R1, # BNEZ R1, LOOP L.D F2, 0(R1) L.D F4, 8(R1) DIV.D F6, F2, F MUL.D F8, F6, F ADD.D F6, F2, F MUL.D F10, F6, F S.D F8, 0(R1) S.D F10, 8(R1) DADDI R1, R1, # BNEZ R1, LOOP
Table 2: Execution profile using Tomasulo’s Algorithm
Consider the following MIPS code fragment. DADDI R1, R0, # LOOP1: DADDI R2, R1, # LOOP2: DSUBI R2, R2, # BNEZ R3, LOOP2 ; Branch 1 DSUBI R1, R1, # BNEZ R1, LOOP1 ; Branch 2
(a) Assume that 1 bit branch predictors are used. When the processor starts to execute the afore- mentioned code, both predictors contain value N (not taken). What is the number of correct predictions? Use the following tables to record the prediction and action of each branch. [ points]
ADDI R1, R0, # LOOP: BNEZ R1, END ; Branch 1 ANDI R2, R1, # BNEZ R2, ODD ; Branch 2 EVEN: ... J DECR ODD: ... DECR: DSUBI R1, R1 ,# J LOOP END: ... (This is roughly equivalent to)
for (i = 100; i > 0; i--) { // Branch 1 if (i mod 2 == 0) { // Branch 2 ... } else { ... } } ...
(a) For branch 1, would a (2,1) correlating predictor or a 2-bit saturation counter be more appropriate. Why? [3 points] (b) For branch 2, would a (2,1) correlating predictor or a 2-bit saturation counter be more appropriate. Why? [3 points] (c) What would type of branch predictor would be able to handle both branches well? [2 points] (d) What is the branch target buffer and why does it improve performance? [2 points]
Consider the speculative Tomasulo processor shown in Figure 2.9 of the text book. Assume the fol- lowing:
For the following piece of code, completely fill in the execution table but show the ROB contents and history as it would be at the end of the cycle where DSUBI commits. Assume that F8, R1, and R are initialized and that the ROB is initially empty. Because a ROB is implemented as a circular queue, the entry number labels repeat modulo 4 reading down the table. When ROB entries are reallocated during the simulated execution time, write the details of the new allocation in the next available correspondingly numbered table row. In the Value column, write the computed result in algebraic form (ex. F5 - F3). If the result has not been computed yet, write a dash. In the Ready Column, write Yes if the ready bit for this entry was set to Yes, otherwise write No. Use the Commit column to indicate the cycle number when the instruction committed. If the instruction has not committed yet, simply write a dash. The first Cycle is filled in for you.
Execution Table ROB entry Instruction IS EX WR CMT Stall Reason 0 MUL.D F0, F8, F8 1 ADD.D F2, F8, F ADD.D F4, F0, F DSUBI R1, R1, # BNEZ R1, LOOP ADD.D F6, F6, F
Reorder Buffer Entry Instruction Destination Value Ready Commit MUL.D F0 No ADD.D ADD.D DSUBI BNEZ ADD.D
(a) What technique does Tomasulo’s employ to eliminate WAR and WAW hazards? Why does it work? Why doesn’t it also eliminate RAW? [4 points] (b) What is the difference between reservation stations and reorder buffers? [3 points] (c) Reservation stations and reorder buffers both have value fields to store the result of an instructions. Why do we still need this value field in the reservation station if it is available in the reorder buffer? [3 points]