Final answer:
In a five-stage pipeline, each instruction goes through five different stages: instruction fetch, instruction decode, execute, memory access, and write back. Here is how the same four instructions move through each pipeline stage.
Step-by-step explanation:
In a five-stage pipeline, each instruction goes through five different stages: instruction fetch, instruction decode, execute, memory access, and write back. Using the given example:
- I1: add $s1, $s2, $s3
- I2: lw $s4, 4($s4)
- I3: add $s5, $s4, $s1
- I4: sw $s5, 8($s2)
Here is how the same four instructions move through each pipeline stage:
- Instruction Fetch (IF): The first instruction (I1) is fetched.
- Instruction Decode (ID): I1 is decoded in this stage.
- Execute (EX): I1 is executed.
- Memory Access (MEM): I1 accesses memory.
- Write Back (WB): I1 writes back the result.
Similarly, the remaining three instructions (I2, I3, and I4) go through the same stages.