EEM 486 Computer Architecture Homework VI 1. Consider The Following Code Sequence
EEM 486 Computer Architecture Homework VI 1. Consider The Following Code Sequence
Homework VI
lw $3, 0($5)
lw $4, 4($5)
add $7, $7, $3
add $8, $8, $4
add $10, $7, $8
sw $6, 0($5)
Assume that a register read and register write in the same clock cycle is possible.
a. Without any forwarding hardware in the pipelined datapath, how many cycles does
this code sequence take to execute?
b. With forwarding hardware in the pipelined datapath, how many cycles does it take to
execute?
c. With forwarding hardware in the pipelined datapath, reorder the instruction so that it
takes the minimum number of clock cycles.
or
where the ALUop is one of the following: Add, Subtract, And, Or, Load (Rsrc1 ignored),
Store. Rsrc or Rdest are registers. MEM is a base register and offset pair.
Branches use a full compare of two registers and are PC-relative. Assume that this
machine is pipelined so that a new instruction is started every clock cycle. The following
pipeline structure is
The first ALU stage is used for effective address calculation for memory references and
branches. The second ALU cycle is used for operations and branch comparison. RF is
both a decode and register-fetch cycle. Assume that when a register read and a register
write of the same register occur in the same clock the write data is forwarded.
a. Find the number of adders needed, counting any adder or incrementer; show a
combination of instructions and pipe stages that justify this answer. You need only
give one combination that maximizes the adder count.
b. Find the number of register read and write ports and memory read and write ports
required. Show that your answer is correct by showing a combination of instructions
and pipeline stage indicating the instruction and the number of read ports and write
ports required for that instruction.
c. Determine any data forwarding for any ALUs that will be needed. Assume that there
are separate ALUs for the ALU1 and ALU2 pipe stages. Put in all forwarding among
ALUs needed to avoid or reduce stalls. Show the relationship between the two
instructions involved in forwarding using a similar format to the following table.