Section 2.5 Program Counter
The program counter (PC) contains the address of the next instruction to be executed by the microcontroller. It is incremented after every instruction. An example program counter is depicted schematically in Figureย 2.5.1.
When the power is switched on, the program counter is forced to 0 and the instruction fetch starts from address 0 (
~reset = 0 forces the flip-flops to a value of 0).
If the instruction is a conditional branch instruction (which is discussed in Sectionย 15.3),
branch = 1 and the sum of the current PC value (Qs) is added to the branch offset (which is passed through MUX1) and that value is sent to Ds to update the PC value.
If the instruction is a jump instruction, then the value of jump target (which is passed through MUX2) is loaded into
Ds to update the PC value.
If the instruction is not a program flow control instruction (i.e. it is not a branch or jump instruction), then the PC is incremented by 1 after each instruction is fetched.
