Binary Arithmetics for the Next Address
In theory, the PC is a 32-bit byte address into the instruction memory:
- Sequential operation: PCត:0> = PCត:0> + 4
- Branch operation: PCត:0> = PCត:0> + 4 + SignExt[Imm16] * 4
The magic number “4” always comes up because:
- The 32-bit PC is a byte address
- And all our instructions are 4 bytes (32 bits) long
In other words:
- The 2 LSBs of the 32-bit PC are always zeros
- There is no reason to have hardware to keep the 2 LSBs
In practice, we can simplify the hardware by using a 30-bit PCត:2>:
- Sequential operation: PCត:2> = PCត:2> + 1
- Branch operation: PCត:2> = PCត:2> + 1 + SignExt[Imm16]
- In either case: Instruction-Memory-Address = PCត:2> concat “00”