BEQ Instruction Property 2
The branch-on-equal (BEQ) instruction compares values in the left and right memory cells. If the values are not equal, then the Program Counter (PC) is incremented by 1. In other words, the computer simply moves to the next instruction. More formally:
if the following are true:
- instruction #i is
beq left=left right=right imm=imm
- the PC at time t = i
- not (value of cell left at time t = value of cell right at time t)
then the PC at time (t + 1) = i + 1
Instructions
Memory Cells |
---|
Program Counter | Time |
---|---|
0 | 0 |
LW Computer Simulator
This example can be expressed as:
if the following are true:
- instruction #0 is
beq left=1 right=2 imm=2
- the PC at time 0 = 0
- not (value of cell 1 at time 0 = value of cell 2 at time 0)
then the PC at time (0 + 1) = 0 + 1
Comments
Please log in to add comments