We now examine in detail how the basic pipeline CPU executes the store instruction.
|
The instruction is encoded as follows:
STORE
-------
Dest Reg P OpCode I Src Reg1 Src Reg2
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
OpCode P: (1 update PSR, 0 do not)
----------------------- I: (1 use Src 2 as constant, 0 reg num)
0 0 Add
0 1 Subtract
1 0 AND
1 1 OR
|
The instruction is encoded as follows:
STORE
-------
Dest Reg P OpCode I Src Reg1 Src Reg2
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
OpCode P: (1 update PSR, 0 do not)
----------------------- I: (1 use Src 2 as constant, 0 reg num)
0 0 Add
0 1 Subtract
1 0 AND
1 1 OR
|
str r1, [r2 + r3] (Store data from reg R1 to memory addr R2+R3)
|
Execution:
|
Slideshow:
|
|
|
|
We use the same solution as in the LOAD instruction:
|
|
In other words: a STORE instruction will not update anything in step 5
(In fact, the STORE instruction is completed in step 4 !!! It wrote the data to the memory in that step !!!)