What Is Cpu

Central processing unit(CPU)

● often referred as the brain of a computer

● hardware that interprets and processes most of the commands from computer's

hardware and software programs.

● Instructions/commands given by the hardware and software are made up of 32bit strings

or 64bit strings of 1s and 0s (machine code)

● Made up of 3 parts

● Opcode: (1 byte) The instruction, telling the processor what to do. E.g. tells the CPU that

a byte must be copied

● First operand: (2 bytes) is the memory address of where the data is to be stored.

● Second operand: (1 byte) is the data.

● E.g. the whole instruction could be written as: Copy the memory location specified by the

byte of data
represented by 10000001.

Use of registers and accumulators

● Registers are temporary storage holding areas located on the cpu.

● They store address locations for instructions, results of calculations and flags which

show the result of a
comparison.

● The accumulator is a special register that holds the data items currently being processed

such as results.

FETCH-execute cycle


1. FETCH: the control unit fetches the instruction from main memory (RAM). The control unit

does this by using the program counter (register) to store the memory address for the NEXT

instruction to be carried out. The program counter’s job is to obtain and store the NEXT

instruction for the CPU.
2. DECODE: The opcode is separated from the data addresses

(operands) by the control unit (CU). The control unit uses this opcode to figure out what type of

instruction has to be carried out. The opcode is then loaded into the instruction register, and the

data addresses copied into the address register.
3. EXECUTE: the opcode in the instruction

register is sent to and then executed by the Arithmetic logic unit (ALU)
4. STORE: While the

instruction is being executed, the results of any data being processed are stored in...