Question: Rewrite the code of the block copy operation shown below inserting as few nop instructions as needed for proper execution; reorder the instructions, if possible,
Rewrite the code of the block copy operation shown below inserting as few nop instructions as needed for proper execution; reorder the instructions, if possible, to minimize the number of nops while preserving correctness.Do not forget that branches and jumps are actually delayed branches & jumps with their delayed slots needed to be taken care of (filled in) in a pipelined MIPS processor! Another hint: Try to optimize the code (i.e., reduce the number of nops) by changing offset value in memory access instructions (when necessary) while preserving correctness.
LOOP: lw $1, 100 ($2)
addi $1, $1, 1
sw $1, 500 ($2)
addiu $2, $2, 4
bne $2, $10, LOOP

PCSrc IDIEX WB EXMEM ControlM EX IF/ID Add left 2 ALUSrc Read data 1 Zero ALU ALU register 2 Read Instruction Registers ReadH memory data 2 (15-0 6 Sign- 32 ALU extend Instruction 20-16) [15-11 RegDst PCSrc IDIEX WB EXMEM ControlM EX IF/ID Add left 2 ALUSrc Read data 1 Zero ALU ALU register 2 Read Instruction Registers ReadH memory data 2 (15-0 6 Sign- 32 ALU extend Instruction 20-16) [15-11 RegDst
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
