Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your computer system has a 5-stage pipeline (but not super-pipeline) processor (

ID: 3868520 • Letter: Y

Question

Your computer system has a 5-stage pipeline (but not super-pipeline) processor (like the one we discussed in the classroom). We use the five-stage pipeline processor to execute the following loop structure in assembly instructions. How much can this loop structure be faster if we apply loop unrolling and delayed branch using the following assumptions? Show all your work (especially for partial credit). (a) The same number of stalled cycles for each RAW data hazard as we discussed in the classroom (i.e., 3 stalled cycles for each RAW data dependency). (b) The delayed branch slot is 3 cycles. (c) The loop structure repeats exactly 1,000 times. (d) The 5-stage processor has an infinite number of registers (as many registers as you need).

Explanation / Answer

(a) Branch Prediction It addresses control hazards by guessing the outcome of a branch instruction and then speculatively executes the instructions on one side of the branch to keep the pipeline moving. Predictions can be made in hardware or in software by the compiler. (b) Instruction Scheduling It addresses structural hazards and data hazards. It addresses data hazards by either moving instructions that are not dependent on an instruction, say A, before some instructions that depend on A and thus avoiding the stall that would have occurred otherwise. It addresses structural hazards by making sure instructions that use functional units that have limited number of instances are be scheduled far apart from each other and there is no unnecessary stall due to this. It can be done in hardware (superscalar processor) or statically by the compiler (c) delay slots It addresses control hazards. It helps to avoid a stall that would result due branch target identification during the decode stage by scheduling the execution of some other instruction which anyway has to execute irrespective of the branch condition.

Forwarding of the first operand fails. An example of code snippet that would fail is: add $s1, $t0, $t1 add $s1, $s1, $s1 An example of code snippet that will not fail is: add $s1, $t0, $t1 add $s1, $t2, $s1 # Here the second operand is forwarded correctly (3) Jumping to a branch target does not work. Example of code that fails: addi $s1, $zero, 2 addi $s2, $zero, 2 beq $s1, $s2, exit Code that will still work: addi $s1, $zero, 10 addi $s2, $zero, 20 beq $s1, $s2, exit

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote