Could you please help on a problem mentioned below Assume we use a pipeline with
ID: 3874440 • Letter: C
Question
Could you please help on a problem mentioned below Assume we use a pipeline with a 5-stage instruction cycle: 1. IF = Instruction Fetch 2. ID = Instruction Decode 3. EX = Execute 4. MEM = Memory access 5. WB = Register write back Consider the following sequence of instructions (the final register in each instruction is where the value computed is stored): *Increment by one, ie +1 to R5 ADD R1, R2, R1 INC* R5, R5 ADD R2, R5, R5 SUB R1, R3, R3 ADD R3, R4, R4 How long does it take for the instruction sequence to complete, please explain it with steps?
Explanation / Answer
The instruction cycle is as follows:
1. Fetch the instruction:
In the first stage of cycle we either get the instruction, fetch the instruction or retrieve the instruction. As we have in our above example
ADD R1,R2
2. Decode the instrution and fetch the operand:
As soon as we fetch the instruction next step is to deocde it. Here we will decode the value stored based on the operation to be performed. Eg: SUB R1, R3
3. Perform ALU operation:
After getting the instruction next step is to perform the operation based on the operands.
Eg: ADD R3,R4 in this instruction we are adding the contents of register r4 to r3 and storing the value in r4.
5. Memory Access and Update the value:
Once the instructions are fetched, decoded next step is to access the ,memory location of the operand.
The output of the ALU is written back to the memory. The two memory access specifiers are LOAD/STORE. Eg: ADD R3,R4,R4 => the contents of r4 is added to r4 and then stored back in register r3.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.