The operation or task that must perform by CPU are:
- Fetch Instruction: The CPU reads an instruction from memory.
- Interpret Instruction: The instruction is decoded to determine what
action is required.
- Fetch Data: The execution of an instruction may require reading data from
memory or I/O module.
- Process data: The execution of an instruction may require performing some
arithmatic or logical operation on data.
- Write data: The result of an execution may require writing data to memory
or an I/O module.
To do these tasks, it should be clear that the CPU needs to store some data
temporarily. It must remember the location of the last instruction so that
it can know where to get the next instruction. It needs to store instructions
and data temporarily while an instruction is beign executed. In other words,
the CPU needs a small internal memory. These storage location are generally
referred as registers.
The major components of the CPU are an arithmatic and logic unit (ALU) and a
control unit (CU). The ALU does the actual computation or processing of
data. The CU controls the movement of data and instruction into and out of the
CPU and controls the operation of the ALU.