Program Counter on ADD

When an ADD instruction is executed, the program counter (PC) is always incremented by 1. This means that the instructions execute sequentially. More formally,

if the following are true:
  • instruction #x is add dst=s src1=d src2=imm
  • the PC at time t = x

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

For example, if the PC is 0, and instruction #0 is an ADD instruction, then when the instruction executes, the PC is set to 1:
Instructions
Memory Cells
Program Counter Time
0 0
LW Computer Simulator

In other words:

if the following are true:

  • instruction #0 is add dst=3 src1=1 src2=2
  • the PC at time 0 = 0

then the PC at time (0 + 1) = 0 + 1

Also note that:

if the following are true:

  • instruction #1 is add dst=2 src1=0 src2=1
  • the PC at time 1 = 1

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


Comments

Please log in to add comments