Answer the following questions about a pipelined MIPS datapath, using this instr
ID: 663996 • Letter: A
Question
Answer the following questions about a pipelined MIPS datapath, using this instruction sequence:
addi $9, $8, 100
sub $10, $11, $12
add $8, $10, $9
and $11, $9, $12
or $13, $12, $11
a. Identify all of the data dependencies, in the above instruction sequence, which will require forwarding: State which register value(s) will need to be forwarded, and what instructions they are forwarded from and to
b. For each item that requires forwarding from part (a), explain:
i. When the item will be forwarded (i.e. at the end of what cycle number,
assuming that the ADDI instruction begins in cycle 1)
ii. Which pipeline register the item will be forwarded from
iii. Where (to which stage, of which instruction) the item will be forwarded to
Explanation / Answer
dependency 1
sub $10, $11, $12
add $8, $10, $9
caused due to $10 being written with add instruction and being read from add insttruction. WAR hazard.
add $8, $10, $9
and $11, $9, $12
dependency for register 9
and $11, $9, $12
or $13, $12, $11
dependency for register 11 WAR hazard
$10 and $11 values needs to be forwarded to avoid this.
$10 from sub $10, $11, $12
$10 to add $8, $10, $9
$11 from and $11, $9, $12
$11 to or $13, $12, $11
b)
the items will be forwarded in the execute stage (stage 3 of the pipeline) once the results are available to stage 2 where the instruction decoding is happening.
to r10 and r11 registers.
$10 from sub $10, $11, $12
$10 to add $8, $10, $9
when sub is in execute stage the results will be forwareded.
$11 from and $11, $9, $12
$11 to or $13, $12, $11
when and is in execute stage the results will be forwareded.