Answered step by step
Verified Expert Solution
Question
1 Approved Answer
[15] 1. Consider the following MIPS Assembly code 16 lw $20, 7($10) 220 sub $11, $20, $16 24 beg $12, $21, 4 428 add $24,
[15] 1. Consider the following MIPS Assembly code 16 lw $20, 7($10) 220 sub $11, $20, $16 24 beg $12, $21, 4 428 add $24, 80, 82 532 sub $10, $4, $8 636 sub $3, $10, $1 40 and $22, $2 $5 | 44 beq $24, $20, -4 48 add $4, $24, $12 1052 or $26, $5$16 1156 add $4, $14, $12 12 60 lt $5, $26, $7 (a) Identify all the data dependencies in the above code. (Write instruction numbers and register number) [3] (b) Which dependencies are data hazards that will be resolved by forwarding and which dependencies are data hazards that will cause a stall? [3] (c) Write the values of ForwardA and ForwardB for each forwarding. [2] (d) Find the branch targets for both branch instructions. [2] (e) If the branch execution is still in the MEM stage, how many instructions (total) will be flushed, if the branch is taken? Also, write the instruction numbers which will be flushed. [2] (f) If the branch execution is in the ID stage, how many instructions (total) will be flushed, if the branch is taken? Also, write the instruction numbers which will be flushed. [2] (g) Identify error(s) in the preceding code, if any. [1] [15] 1. Consider the following MIPS Assembly code 16 lw $20, 7($10) 220 sub $11, $20, $16 24 beg $12, $21, 4 428 add $24, 80, 82 532 sub $10, $4, $8 636 sub $3, $10, $1 40 and $22, $2 $5 | 44 beq $24, $20, -4 48 add $4, $24, $12 1052 or $26, $5$16 1156 add $4, $14, $12 12 60 lt $5, $26, $7 (a) Identify all the data dependencies in the above code. (Write instruction numbers and register number) [3] (b) Which dependencies are data hazards that will be resolved by forwarding and which dependencies are data hazards that will cause a stall? [3] (c) Write the values of ForwardA and ForwardB for each forwarding. [2] (d) Find the branch targets for both branch instructions. [2] (e) If the branch execution is still in the MEM stage, how many instructions (total) will be flushed, if the branch is taken? Also, write the instruction numbers which will be flushed. [2] (f) If the branch execution is in the ID stage, how many instructions (total) will be flushed, if the branch is taken? Also, write the instruction numbers which will be flushed. [2] (g) Identify error(s) in the preceding code, if any. [1]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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