You are on page 1of 1

Thapar University

Department of Electronics and Communication Engineering,


Tutorial Sheet No 6, Computer Architecture (UEC-402)
Q1. Use the following code fragment:
Loop LD
F0, 0(R2)
LD
F4, 0(R3)
MULTD F0, F0, F4
ADDD
F2, F0, F2
ADDI
R2, R2, #8
ADDI
R3, R3, #8
SUB
R5, R4, R2
BNEZ
R5, Loop
i)
Identify the type of hazards in the code when it is executed on a pipelined DLX
machine.
ii)
If Stalls are introduced to remove the hazards, identify their location and
number in the program
iii)
Using pipeline scheduling, how can these be overcome, write the rescheduled
code.
Q2.Assume branch instructions occur 22% of the time and are predicted as not taken, while in
practice they are taken 42% of the time with a penalty of 2 cycles. With forwarding, the load
delay slot is one cycle and can be filled 55% of the time with useful instructions. 21% of the
instructions are loads and 30% of these introduce load delay hazards. What is the increase in CPI
due to load delay slots and branch hazards?
Q3.
Differentiate between the static and dynamic techniques of removing control hazarads.
List all the methods briefly.
Q4. Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600MHz. Computer

B has a CPI of 2.5 and can be run at a clock rate of 750 Mhz. We have a particular program we
wish to run. When compiled for computer A, this program has exactly 100,000 instructions. How
many instructions would the program need to have when compiled for Computer B, in order for
the two computers to have exactly the same execution time for this program?
Q5. For the given code sequence stalls are inserted to remove hazards according to the standard
rule, perform the loop unrolling three times and reschedule it so as to remove any stalls from
the code when it is run on a DLX pipelined machine.
LD F0,6(R1) ;
F0=array element
SUBD F4,F0 ,F2 ;
add scalar in F2
SD 12(R1), F4 ;
store result
SUBI R1,R1,#8 ;
decrement pointer;8 bytes (per DW)
BNEZ R1,Loop

You might also like