After this chapter you will be able to
- explain the parts and working of the CPU
- name the important registers and their jobs
- describe the machine (instruction) cycle
- explain clock speed, cores, threads, cache and pipelining
- compare RISC and CISC processors
- identify the main components on a motherboard
5.1 The Central Processing Unit (CPU)
The CPU (also called the processor) executes program instructions. In a modern computer the whole CPU sits on one chip called the microprocessor.
Components: ALU, Control Unit, Registers, and on-chip cache.
Brain of the computer.
Fitted into a socket on the motherboard and cooled by a heat sink and fan.
Three main units: the CPU’s core units are the ALU, the Control Unit and the registers. Cache is a separate, fast memory that is often placed on the same chip; it is not counted as one of the three main units.
Scratch pad memory (SPM) is a very small, very fast memory inside the processor that holds temporary data during processing. Together with cache, it is part of the CPU, not of main memory or secondary storage.
Some exam books list the CPU’s three parts as Control Unit, ALU and Memory unit, where the memory unit means the registers. In that convention, main RAM is not part of the CPU.
Arithmetic Logic Unit (ALU)
- Arithmetic operations: addition, subtraction, multiplication, division.
- Logical operations: AND, OR, NOT, XOR; comparisons (>, <, =).
- Results are stored in the accumulator or other registers.
- Floating-point work is handled by the FPU (Floating Point Unit), historically called the math co-processor.
- The ALU has two sections: the arithmetic section and the logic section.
Control Unit (CU)
- Fetches instructions from memory, decodes them and sends control signals to carry them out.
- Controls the timing of all operations using the clock.
- Does not execute arithmetic itself.
5.2 Registers — the CPU’s Own Tiny Memory
Registers are the smallest and fastest memory locations, built inside the CPU.
| Register | Full form | Job |
|---|---|---|
| PC | Program Counter | Holds the address of the next instruction to be executed |
| IR | Instruction Register | Holds the instruction currently being executed |
| MAR | Memory Address Register | Holds the address of the memory location to read/write |
| MDR / MBR | Memory Data Register / Memory Buffer Register | Holds the data being read from or written to memory |
| AC | Accumulator | Holds intermediate results of ALU operations |
| SP | Stack Pointer | Points to the top of the stack in memory |
| FR / PSW | Flag Register / Program Status Word | Holds status flags — zero, carry, sign, overflow |
| GPR | General Purpose Registers | Temporary data for any operation |
| I/O AR / I/O BR | I/O Address / Buffer Register | Address and data for I/O devices |
★ EXAM POINT — Program Counter → address of the next instruction. Instruction Register → the current instruction. Accumulator → ALU result. Registers are the fastest memory in a computer.
- A register is built from a group of flip-flops; a 64-bit register has 64 flip-flops.
- MAR and MDR work together to link the CPU with main memory.
- The MDR is as wide as the memory word. For a memory of 64K words with 8 bits per word, the MDR is 8 bits wide.
- Writing new data into a register destroys its old contents (destructive write). Reading copies the value and leaves it unchanged (non-destructive read).
- A register is a sequential circuit, because flip-flops hold their state.
- CIR (Current Instruction Register) is another name for the IR.
- The Instruction Buffer Register (IBR) holds an instruction that has been fetched but is not to be executed yet. Some texts use this register; the IR holds the instruction being executed or decoded now.
- Programmer-visible registers (general-purpose, data and address registers) can be used directly by a program. MAR and MBR are internal registers that only the CPU uses.