Components in a CPU
General purpose Registers
- A synonym for memory in computer science
- General purpose reigster
- A memory cell
- Each general purpose register has a unique name
- It is used to
- store (and recall) intermediate result of complex computations
Arithmetic and Logic Unit (ALU)
- It is a complex electrical circuit that can perform Mathematical (+,-,x,/) and logical operation (<, <=, >, >=, and, or)
- The output (result) of the computation (obtained by the ALU) is often stored in a general purpose register.
Instruction Register (IR)
- Contains the current instruction being executed by the CPU
- The CPU will perform the operation indicated by the instruction code contained in the instruction register
Program Counter (PC)
- The program counter is a register (memory cell)!
- This register contains the address (location in memory) of the next instruction after the CPU finishes executing the current instruction in the instruction register
- The value in the program counter will be increased after the CPU finishes executing one instruction
Processor Status Register (PSR)
- This register contains the various information about the CPU.
- Among the information contained in the PSR is
- The result of a comparison operation
- When the CPU compares 2 numbers a and a and b, the outcome of the comparison is stored in the PSR
- The outcome of a compare operation will allow the CPU to determine the following fact between a and b.