Architecture Introduction
The Simple-As-Possible (SAP)-1 computer is a very basic model of a microprocessor. The SAP-1 design contains the basic necessities for a functional Microprocessor. Its primary purpose is to develop a basic understanding of how a microprocessor works, interacts with memory and other parts of the system like input and output. The instruction set is very limited and is simple.
1. Program Counter
The program is stored at the beginning of the memory with the first instruction at binary address 0000, the second instruction at 0001, the third at address 0010 and so on. The program counter which is part of the control unit, counts from 0000 to 1111. Its job is to send to the memory the address of the next instruction to be fetched and executed. It does this as mentioned in the next paragraph.
The program counter is reset to 0000 before each computer run. When the computer run begins, the program counter sends the address 0000 to the memory. The program counter is then incremented to get 0001. After the first instruction is fetched and executed, the program counter sends address 0001 to the memory. Again the program counter is incremented. After the second instruction is fetched and executed, the program counter sends address 0010 to the memory. So this way, the program counter keeps track of the next instruction to be fetched and executed.
The program counter is like someone pointing a finger at a list of instructions saying do this first, do this second, do this third, etc. This is why the program counter is called a pointer; it points to an address in memory where the instruction or data is being stored.