The CPU

<< Previous: Algorithms homeNext: CPU performance >>

Parts of the CPU

The CPU is the central processing unit. The role of the CPU is to process instructions by running the fetch-decode-execute cycle. The CPU has a number of component parts such as:

Part of CPU Description
Arithmetic logic unit(ALU) The CPU performs all of the arithmetic operations including bit shifts and logical comparisons.
Control unit Decodes instructions and controls and coordinates the movement of data around the CPU on the tick of the system clock.
Cache Very fast but small memory location for storing recently and frequently used instructions.
Registers A register is a very fast storage located within the CPU itself. There are both generic and specific registers.

Special registers

As well as the general purpose registers that store instructions and data as the program executes the CPU also contains some special registers that have specific purposes.

Special register What it does
Program counter (PC) Stores the address of the next instruction to be executed.
Memory address register (MAR) Temporarily holds the address of the next instruction or piece of data to be fetched.
Memory data register Temporarily holds the actual instruction or piece of data that has just been fetched.
Accumulator The accumulaor stores the result

What happens at the fetch stage?

The program counter holds the address of the next instruction. This address is transferred to the memory address register(MAR). The program counter is incremented so it points to the next instruction to be executed.



The instruction at the address specified by the MAR is returned and placed in the memory data register(MDR).



What happens at the decode stage?

The control unit decodes the instruction to work out what needs to be done. If the instruction requires some data to be fetched e.g. ADD 105, the address of the data will be passed to the MAR. If extra data is required, it is fetched from the address in MAR and returned to the MDR.



What happens at the execute stage?

The instruction is carried out e.g. add 105 would add the value of the data stored in register 105 (15) to what is already in the accumulator (5) and return the result (20) to the accumulator.



Knowledge check


Questions:
Correct:

Question text


<< Previous: Algorithms homeNext: CPU performance >>

© All materials created by and copyright S.Goff