Proof: JAL Instruction 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 the PC at time 3 = 1
In this example, a JAL instruction causes the computer to jump to instruction #1.
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 | the PC at time (2 + 1) = 1 | if instruction #5 is a JAL instruction with jump to: 1 and the PC at time 2 = 5, then the PC at time (2 + 1) = 1 |
| 2 | 2 + 1 = 3 | 2 + 1 = 3 |
| 3 | the PC at time (2 + 1) = the PC at time 3 | if 2 + 1 = 3, then the PC at time (2 + 1) = the PC at time 3 |
| 4 | the PC at time 3 = 1 | if the PC at time (2 + 1) = the PC at time 3 and the PC at time (2 + 1) = 1, then the PC at time 3 = 1 |
Comments
Please log in to add comments