Inside the CPU
The CPU (central processing unit) fetches and carries out instructions.
- ALU (arithmetic logic unit): does calculations and comparisons.
- Control unit: decodes instructions and sends signals to make the other parts act, in step with the clock.
- Cache: a small amount of very fast memory on or near the CPU.
- Registers: tiny, very fast stores inside the CPU, each with one job.
In the von Neumann architecture, program instructions and data are stored together in the same main memory, and the CPU fetches them one at a time. Buses connect the CPU to memory: the address bus carries addresses, the data bus carries data and the control bus carries signals such as read and write.
The registers
| Register | Holds |
|---|---|
| Program Counter (PC) | the address of the next instruction |
| Memory Address Register (MAR) | the address about to be read from or written to |
| Memory Data Register (MDR) | the data or instruction just read, or about to be written |
| Current Instruction Register (CIR) | the instruction being decoded and executed |
| Accumulator (ACC) | the results of calculations |
OCR asks for these register names. AQA and Edexcel ask about the cycle and the parts of the CPU more generally; knowing the registers helps with both.
Fetch, decode, execute
- Fetch: the address in the PC is copied to the MAR. The instruction at that address is copied into the MDR, then into the CIR. The PC goes up by 1.
- Decode: the control unit works out what the instruction means.
- Execute: the instruction is carried out. It might load a value, do a calculation in the ALU, or store a result.
Step through this little program. LOAD 5 copies the value at address 5 into the ACC, ADD 6 adds the value at address 6, STORE 7 puts the ACC into address 7.
Which register?
Think about what each register is for, not just its initials.