Proof: STORE Instruction Example
Let's prove the following theorem:
if the following are true:
- instruction #0 is
store src=5 addr=1 imm=0
- the PC at time 0 = 0
- value of cell 1 at time 0 = 3
- value of cell 5 at time 0 = 9
then value of cell 3 at time 1 = 9
The following example shows that when a STORE instruction with src = 5, addr = 1, and imm = 0 is executed, the computer copies the value in memory cell #5 (9) to the location that is stored in memory #1 (3).
Instructions
Memory Cells |
---|
Program Counter | Time |
---|---|
0 | 0 |
LW Computer Simulator
Proof:
Given
1 | instruction #0 is store src=5 addr=1 imm=0 |
---|---|
2 | the PC at time 0 = 0 |
3 | value of cell 1 at time 0 = 3 |
4 | value of cell 5 at time 0 = 9 |
# | Claim | Reason |
---|---|---|
1 | value of cell ((value of cell 1 at time 0) + 0) at time (0 + 1) = value of cell 5 at time 0 | if instruction #0 is store src=5 addr=1 imm=0 and the PC at time 0 = 0, then value of cell ((value of cell 1 at time 0) + 0) at time (0 + 1) = value of cell 5 at time 0 |
2 | 0 + 1 = 1 | 0 + 1 = 1 |
3 | value of cell ((value of cell 1 at time 0) + 0) at time (0 + 1) = value of cell ((value of cell 1 at time 0) + 0) at time 1 | if 0 + 1 = 1, then value of cell ((value of cell 1 at time 0) + 0) at time (0 + 1) = value of cell ((value of cell 1 at time 0) + 0) at time 1 |
4 | (value of cell 1 at time 0) + 0 = 3 + 0 | if value of cell 1 at time 0 = 3, then (value of cell 1 at time 0) + 0 = 3 + 0 |
5 | value of cell ((value of cell 1 at time 0) + 0) at time 1 = value of cell (3 + 0) at time 1 | if (value of cell 1 at time 0) + 0 = 3 + 0, then value of cell ((value of cell 1 at time 0) + 0) at time 1 = value of cell (3 + 0) at time 1 |
6 | 3 + 0 = 3 | 3 + 0 = 3 |
7 | value of cell (3 + 0) at time 1 = value of cell 3 at time 1 | if 3 + 0 = 3, then value of cell (3 + 0) at time 1 = value of cell 3 at time 1 |
8 | value of cell (3 + 0) at time 1 = value of cell 5 at time 0 | if value of cell ((value of cell 1 at time 0) + 0) at time (0 + 1) = value of cell ((value of cell 1 at time 0) + 0) at time 1 and value of cell ((value of cell 1 at time 0) + 0) at time 1 = value of cell (3 + 0) at time 1 and value of cell ((value of cell 1 at time 0) + 0) at time (0 + 1) = value of cell 5 at time 0, then value of cell (3 + 0) at time 1 = value of cell 5 at time 0 |
9 | value of cell (3 + 0) at time 1 = 9 | if value of cell (3 + 0) at time 1 = value of cell 5 at time 0 and value of cell 5 at time 0 = 9, then value of cell (3 + 0) at time 1 = 9 |
10 | value of cell 3 at time 1 = 9 | if value of cell (3 + 0) at time 1 = value of cell 3 at time 1 and value of cell (3 + 0) at time 1 = 9, then value of cell 3 at time 1 = 9 |
Comments
Please log in to add comments