ADD R2, R3, R1 R2=11, R3=9, R4=1, R5=8, R6=0, R7=2
ADD R4, R1, R4
ADD R5, R1, R5
ADD R6, R1, R6
ADD R7, R1, R7
...
Also, at start of the CPU cycle, the ID stage selects R4 and R1 to be copied into the A and B registers:
Also, at the end of the CPU cycle, A is updated to R4 (=1) and B is updated to the "current value" of R1 (= 123). This "current" value is a wrong value because there is a more current one on the way....
Also, at the end of the CPU cycle, the instruction (ADD R2, R3, R1) is moved into IR(MEM), ADD R4, R1, R4 is moved into IR(EX) and instruction ADD R5, R1, R5 is fetched into IR(ID)
Also, at start of the CPU cycle, the ID stage selects R1 and the same OLD value of R1 to be copied into the A and B registers.
Also, at the end of the CPU cycle, A is updated to R5 and B is updated to the old value of R1 .
Also, at the end of the CPU cycle, the instruction (ADD R2, R3, R1) is moved into IR(WB), ADD R4, R1, R4 is moved into IR(MEM), instruction ADD R5, R1, R5 is moved into IR(EX) and instruction ADD R6, R1, R6 is fetched into IR(ID)
That is not true, we can make ADD R6,R1,R6 fetch the updated R1 value through the following "trick".
We wired the A, B and D registers in such a way that they are updated when the clock goes from 1-->0.
So sometime after the midpoint (but before the transition from 1-->0), the new value 20 of R1 will arrive at register B:
|