Proof: JAL Instruction Store Example
Let's prove the following theorem:
if the following are true:
- instruction #5 is a JAL instruction with jump to: 1
- the PC at time 2 = 5
then value of cell 2 at time 3 = 6
In this example, the JAL instruction causes the computer to store the current PC value + 1 in memory cell #2.
Instructions
Memory Cells |
---|
Program Counter | Time |
---|---|
0 | 0 |
LW Computer Simulator
Proof:
Given
1 | instruction #5 is a JAL instruction with jump to: 1 |
---|---|
2 | the PC at time 2 = 5 |
# | Claim | Reason |
---|---|---|
1 | value of cell 2 at time (2 + 1) = 5 + 1 | if instruction #5 is a JAL instruction with jump to: 1 and the PC at time 2 = 5, then value of cell 2 at time (2 + 1) = 5 + 1 |
2 | 5 + 1 = 6 | 5 + 1 = 6 |
3 | 2 + 1 = 3 | 2 + 1 = 3 |
4 | value of cell 2 at time (2 + 1) = value of cell 2 at time 3 | if 2 + 1 = 3, then value of cell 2 at time (2 + 1) = value of cell 2 at time 3 |
5 | value of cell 2 at time (2 + 1) = 6 | if value of cell 2 at time (2 + 1) = 5 + 1 and 5 + 1 = 6, then value of cell 2 at time (2 + 1) = 6 |
6 | value of cell 2 at time 3 = 6 | if value of cell 2 at time (2 + 1) = value of cell 2 at time 3 and value of cell 2 at time (2 + 1) = 6, then value of cell 2 at time 3 = 6 |
Comments
Please log in to add comments