JAL Instruction Property

When the jump-and-link (JAL) instruction executes, the Program Counter (PC) is set to jump_to. Thus, the next instruction to execute is instruction #jump_to. More formally:

if the following are true:
  • instruction #i is a JAL instruction with jump to: jump_to
  • the PC at time t = i

then the PC at time (t + 1) = jump_to

Here is an example where instruction #5 is a JAL instruction. To present a more realistic example, JUMP and JUMPR instructions are also present.
Instructions
Memory Cells
Program Counter Time
0 0
LW Computer Simulator

Initially, the PC is 0, so instruction #0 (JUMP) is executed. This sets the PC to 4. After instruction #4 is executed, PC increments by 1. Then the JAL instruction executes, setting the PC to 1. In other words:

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 (2 + 1) = 1


Comments

Please log in to add comments