Proof: Beq Branch
Let's prove the following theorem:
if the following are true:
- instruction #5 is
beq left=3 right=4 imm=1
- the PC at time 19 = 5
- value of cell 3 at time 19 = 3
- value of cell 4 at time 19 = 3
then the PC at time 20 = 7
Proof:
Given
1 | instruction #5 is beq left=3 right=4 imm=1 |
---|---|
2 | the PC at time 19 = 5 |
3 | value of cell 3 at time 19 = 3 |
4 | value of cell 4 at time 19 = 3 |
# | Claim | Reason |
---|---|---|
1 | value of cell 3 at time 19 = value of cell 4 at time 19 | if value of cell 3 at time 19 = 3 and value of cell 4 at time 19 = 3, then value of cell 3 at time 19 = value of cell 4 at time 19 |
2 | the PC at time (19 + 1) = (5 + 1) + 1 | if instruction #5 is beq left=3 right=4 imm=1 and the PC at time 19 = 5 and value of cell 3 at time 19 = value of cell 4 at time 19, then the PC at time (19 + 1) = (5 + 1) + 1 |
3 | (5 + 1) + 1 = 7 | (5 + 1) + 1 = 7 |
4 | the PC at time (19 + 1) = 7 | if the PC at time (19 + 1) = (5 + 1) + 1 and (5 + 1) + 1 = 7, then the PC at time (19 + 1) = 7 |
5 | 19 + 1 = 20 | 19 + 1 = 20 |
6 | the PC at time (19 + 1) = the PC at time 20 | if 19 + 1 = 20, then the PC at time (19 + 1) = the PC at time 20 |
7 | the PC at time 20 = 7 | if the PC at time (19 + 1) = the PC at time 20 and the PC at time (19 + 1) = 7, then the PC at time 20 = 7 |
Comments
Please log in to add comments