The following code adds integers in two arrays whose address

The following code adds integers in two arrays (whose address is in $s0 and $s1) and stores the results back into the first array. $s2 is initialized to 0. $s3 is 100. Assume MIPS processors with a 5-stage pipeline and a not-taken predicator. For each of the following implementation, show the pipeline diagram from the IF stage of I1 to the IF stage of I1 in the next iteration and compute the total number of cycles needed for this loop. When counting the total number of cycles, simply multiply the cycle count for each iteration by the number of iterations. This implementation does not have any forwarding paths. The conditional branch is resolved in the EXE stage and the correct instruction is fetched in the MEM stage of the branch instruction. This implementation has all the forwarding paths needed for better performance. The conditional branch is resolved in the ID stage.

Solution

SUB rd, r1, r2:

PC PC+4

GPR[rd] GPR[r1] - GPR[r2]

LW rd, r1, immediate:

PC PC+4

GPR[rd] mem[ GPR[r1] + immediate ]

SW r1, r2, immediate:

PC PC+4

mem[ GPR[r1] + immediate ] GPR[r2]

BEQZ r1, immediate:

if (GPR[r1]0) then

PC PC+4

else

PC PC+immediate

NOP:

PC PC

 The following code adds integers in two arrays (whose address is in $s0 and $s1) and stores the results back into the first array. $s2 is initialized to 0. $s3

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site