The JUMP Instruction
The jump (JUMP) instruction sets the PC to a specified value. The JUMP instruction format is:
jump imm=immediate
When this instruction is executed, LWCS will set the Program Counter to the immediate value. Thus, the jump instruction determines which instruction will be executed next.
Memory cells are not affected by this instruction.
More precisely,
if the following are true:
- the PC at time t = i
- instruction #i is
jump imm=jump_to
then the PC at time (t + 1) = jump_to
For example,
if the following are true:
- the PC at time 0 = 0
- instruction #0 is
jump imm=2
then the PC at time (0 + 1) = 2
Since 0 + 1 is 1, the PC at time 1 = 2
Try executing the JUMP instruction in the simulator:
| Memory Cells |
|---|
| Program Counter | Time |
|---|---|
| 0 | 0 |
Initially, the PC is 0, so instruction #0 is executed. In the JUMP instruction, imm is 2, so the PC is changed to 2. Thus, instruction #1 is skipped, and instruction #2, an ADDI instruction, is executed next.
Comments
Please log in to add comments