Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume that the following code segment is run on a MIPS processor with hazard detection and forwarding, in order, 5 stages pipeline (F (instruction
Assume that the following code segment is run on a MIPS processor with hazard detection and forwarding, in order, 5 stages pipeline (F (instruction fetch), D (instruction decode), E (execute), M (memory access, W (write-back)), static not taken branch prediction (branches are always predicted as not taken), etc.. Below is the code segment that is running on the processor. #code segment 10: 11: L1: 12: 13: 14: 15: L2: 16: 17: 18: 19: beq $R1, $RO, L2 lw $R5, 100($R4) # M[$R4+100] -> R5 sw $R2, 100($R1) # $R2 -> M[$R1 + 100] shl $R2, $R2, 1 beq $RO, $RO, L3 lw $R2, 100($R1) # M[$R1+100] -> $R2 addi $R2, $R2, 100 lw $R3, 100($R10 #M[$R1+100] -> R3 addi $R3, $R3, 1 beq $RO, $RO, STR L3: END a) How many cycles does this program take? Assume all data and instructions are already in the cache, and that all register values are initially O. The branches are always going to be evaluated as not taken. Note: END is an assembly directive, not an instruction. Activa b) An optimizing compiler is used to re-order the code for faster execution. Given that the branches are always going to be "not taken", and the compiler can eliminate them, how would the new code look like? How many cycles would the code take?
Step by Step Solution
★★★★★
3.34 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
To determine the number of cycles the original code segment takes lets analyze the instructions and their dependencies 10 beq R1 RO L2 11 L1 lw R5 100R4 MR4100 R5 12 sw R2 100R1 R2 MR1100 13 shl R2 R2 ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started