LM3000 Program Counter and Branch Unit
From BenningtonWiki
The program counter monitors which instruction in the program the microprocessor is on. This number is delivered to the instruction and operand RAM as a RAM address. The program counter is incremented by the clock, or is set to an instruction number by the branch unit.
For instance, we may start with the first instruction, 0, which is then sent as the address to the instruction RAM and the operand RAM. In the instruction RAM, there is a certain code, for instance a MOV instruction that is associated with address "0." The Operand also has a value, for instance 5, associated with the address 0. When the program counter reads 0, this address is accessed in the instruction and operand RAM. Once an instruction is executed, the clock increments the program counter, so that it is now at 1. This is the new address from which the instruction RAM and operand RAM will pull data.
However, when we have branches, the program counter does not increment sequentially from one line to the next. Instead, it loads a line number (stored in the operand RAM with the address of instruction for the branch) from which it reads.
For example, when a BEQ label is encountered and the Z flag is on, that instruction will send the number of the address that the program counter should branch to.


