Central processing unit (CPU), types of registers: program counter, stack pointer, PSW (Program Status Word)

Central processing unit (CPU): A CPU is a hardware component in a computer which is used for fetching instructions from memory and then executing them. Every instruction is decoded from the memory , type and operands are determined and then it is executed.

Register: A register in a CPU is used for holding variables and temporary results. Registers are used by operating system to hold the status of a program being executed. If a program is stopped the instructions are stored in the register so that when the program is resumed, it can be started from the same point where it was stopped. Different types of registers:

1) Program counter: A program counter is used for holding memory address of next instruction. When an instruction is fetched then, the program counter is updated.

2) Stack pointer: A stack pointer is used to point current stack in memory. Stack has a frame for every procedure which is entered but not executed.

3) PSW (Program Status Word): It holds control bits, CPU priority, and condition code bits set by comparison instructions.

Leave a Reply