JAL Instruction Store Property

When the jump-and-link (JAL) instruction executes, the current program counter (PC) value + 1 is stored in memory cell #2. This is the "link" part of jump-and-link. After jumping to a different part of the program, if the program wishes to pick up where it left off, then it can JUMPR to memory cell #2. 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 value of cell 2 at time (t + 1) = i + 1

Here is an example where instruction #5 is a JAL instruction:
Instructions
Memory Cells
Program Counter Time
0 0
LW Computer Simulator

After a few cycles, instruction #5, a JAL instruction, is executed. Note that 6 is stored in cell #2. 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 value of cell 2 at time (2 + 1) = 5 + 1


Comments

Please log in to add comments