



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Date: October 24, 2003 Name: Student Code: Instructions: This exam is open book and open notes. Allotted time is 90 minutes. Explicitly state all your assumptions. Don’t just give answers, always try to write down the way you were thinking. Even if you can not find a solution, write down the paths you have tried. Problem 1 (20 points) Give assembly language examples for RAW, WAR and WAW hazards. Show the hazards with arrows.
Concisely explain why speculation gives better performance than Tomasulo register renaming.
Consider the following assembly program written for a RISC style 32 bit machine: ld r20, 16000 # load immediate ld r19, 30000 ld r18, 60000 start: add r3, r20, r ld r1, 0(r3) # load into r1 from memory add r4, r20, r ld r2, 0(r4) mult r2, r1, r st 0(r4), r2 # store r2 into memory ld r2, 16 sub r20, r20, r bnez r20, start
a) Write a C, C++ or Java program which corresponds to this assembly program b) Identify the RAW, WAR and WAW conflicts in the assembly program. c) Assume that the program is run on a machine which has a 5 stage pipeline. Rewrite the assembly program by inserting "nop" operations where there will be stalls. d) Unroll the loop in the program 4 times in software (assembly). Transform the program by register renaming such that the number of stalls is minimized.
Suppose that a processor with a load/store architecture executes at a clock rate of 2GHz, with the ideal CPI of 1.5. The typical applications run on this processor contain a mix of 60% arithmetic and logic instructions, 20% load and store instructions and 20% control instructions. The processor accesses the memory through a separate data and instruction cache. An average 2% of the instructions produce an instruction miss, with a penalty of 25 clock cycles. An average of 12% of the data accesses are cache misses. The penalty of a data cache miss is 60 clock cycles. Cache hits do not produce any penalty. (a) What is the real CPI of the architecture? (b) What is the average memory access time (AMAT) of the architecture?