Revision Questions 2
Revision Questions 2
$2,
$4,
$5,
$7,
$8,
$3,
$3,
$3,
$6,
$2,
$1
$5
$7
$1
$6
At the end of the fifth cycle of execution, which registers are being read and which register will be
written?
2. With regard to the program in problem 1 above, explain what the forwarding unit is doing
during the fifth cycle of execution. If any comparisons are being made, mention them.
3. Again with regard to the program in problem 1, explain what the hazard detection unit is doing
during the fifth cycle of execution. If any comparisons are being made, mention them.
Figure - I
Pipeline
-
2
(continue)
1. This exercise is intended to help you understand the relationship between
delay slots, control hazards, and branch execution in a pipelined processor. In
this exercise, we assumethat the following MIPS code is executed on a
pipelined processor with a five-stage pipeline,full forwarding and a predict-taken
branchpredictor:
a.
Label1: lw $1,40($6)
:Taken
add $1,$5,$3
Label1: sw $1,0($2)
sw $1, 0($2)
Draw the pipeline execution diagram for this code, assuming there are no delay slots
and that branches execute in the EX stage.
2. Assume that we have a multiple-issue pipelined processor with the following number
of pipeline stages, instructions issued per cycle, stage in which branch outcomes are
resolved, and branch predictor accuracy:
Pipeline
Depth
a. 10
Issue Width
4
Branches execute in
stage
7
Branch Predictor
accuracy
80%
Branches as a % of
instructions
20%
b. 25
17
92%
25%
Control hazards can be eliminated by adding branch delay slots. How many delay slots
must follow each branch if we want to eliminate all control hazards in this processor?
3. This exercise examines how exception handling interacts with branch and load/store
instructions. Problems in this exercise refer to the following branch instruction and the
corresponding delay slot instruction:
Branchanddelayslot
a.
beq$1,$0,Label
sw$6,50($1)
b.
beq$5,$0,Label
nor$5,$4,$3
a.Assumethatthisbranchiscorrectlypredictedastaken, butthentheinstruction
atLabelis anundefinedinstruction.Describewhatisdoneineach pipelinestage
foreachcycle, starting withthecycleinwhichthebranchis decodedupto the
cycleinwhichthefirstinstructionofthe exceptionhandle isfetched.
b. RepeatExercise3.1, butthistimeassumethattheinstructioninthedelayslot
also causesa hardwareerrorexceptionwhenitisinMEMstage.
c. WhatisthevalueintheEPCifthebranchistakenbutthedelayslotcauses
anexception? Whathappensaftertheexecutionoftheexceptionhandleris
completed?
Cache