First diagram physical components
Second diagram state diagram
Definition: The central processing unit (CPU) of a computer is a piece of hardware that carries out the instructions of a computer program. It performs the basic arithmetical, logical, and input/output operations of a computer system.
The CPU can be considered as the ‘brain’ of a computer. Every single instruction, big or small, must go through the CPU.
Modern CPUs are small and square and contain multiple metallic connectors or pins on the underside. The CPU is inserted directly into a CPU socket, pin side down, on the motherboard.
The ALU or arithmetic logic unit is the part of the CPU which does all processes related to arithmetic and logic operations that need to be done on instruction words. Most of these operations are logical in nature. In some microprocessor architectures, the ALU is divided into the arithmetic unit (AU) and the logic unit (LU).
Depending on how the ALU is designed, it can make the CPU more powerful, but it also consumes more energy and creates more heat. Therefore, there must be a balance between how powerful and complex the ALU is and how expensive the whole unit becomes. This is why faster CPUs are more expensive, consume more power and dissipate more heat.
What it does to the data: The operation code tells the ALU what operation to perform and the operands are used in the operation. (For example, two operands might be added together or compared logically.) The format may be combined with the op code and tells, for example, whether this is a fixed-point or a floating-point instruction. The output consists of a result that is placed in a storage register and settings that indicate whether the operation was performed successfully.
Example of data: Inputs and outputs flow along an electronic path that is called a bus. The input for the ALU consists of an instruction word (sometimes called a machine instruction word) that contains an operation code (sometimes called an “op code”), one or more operands, and sometimes a format code.
The CU – Control Unit
The Control Unit or CU handles all processor control signals. It directs all input and output flow, fetches code for instructions from microprograms and directs other units and models by providing control and timing signals.
What is does with the data: A CU component is considered the ‘processor brain’ because it issues orders to just about everything and ensures correct instruction execution.
Example of data: A CU takes its input from the instruction and status registers.
Its rules of operation, or microprogram, are encoded in a programmable logic array (PLA), random logic or read-only memory (ROM).
Registers are a location where a single item of data can be stored, specialist high-speed storage areas contained inside the CPU.
Before any data can be processed, it must first be represented in a register.
e.g. Before any two numbers can be multiplied, they must both be represented in individual registers.
Registers located in the processor:
-Program Counter (PC) – Contains the address of the next instruction to be executed.
-Memory Address Register (MAR) – Contains the address of the memory location currently in use.
– Memory Buffer Register (MBR) -Contains data to be written/read to/from memory
-Current Instruction Register (CIR) – Holds the instruction whilst it is decoded.
-Accumulator (ACC) – Stores the results of calculations processed by the CPU (ALU).
– I/O AR – Particular I/O device.
– I/O BR – Data exchanged between CPU and I/O module.
(Without the CIR in place, when data is input into the MDR the inputted value would overwrite the input instruction in the MDR.)
We know the CPU can be seen as what allows computers to function. In order to carry out the tasks given to them the ALU and the CU must interact with each other and carry out what is known as the ‘Instruction Cycle’.
Instructions are processed by the control unit in correct order ie. Fetch, Decode, Execute. Each step is referred to as a phase. There are 6 fundamental phases of the instruction cycle.
Fetch instruction (aka pre-fetch)
Evaluate address (address generation)
Fetch operands (read memory data)
Execute instruction (ALU access)
Store result (writeback memory data)
To execute a program, the program code is copied from secondary storage into the main memory. The instruction is loaded into instruction register IR. The Memory address register (MAR) is loaded with instruction pointer. The instruction is loaded through the Memory data register (MDR). The CPU’s program counter is set to the memory location where the first instruction in the program has been stored, and execution begins. The program is now running. In a program, each machine code instruction takes up a slot in the main memory. These slots (or memory locations) each have a unique memory address. The program counter stores the address of each instruction and tells the CPU in what order they should be carried out.
The decoder circuit examines opcode* of the instruction. A unique decoder output line is then selected. The output line signals a circuit which implements the corresponding operation.
*The opcode tells the processor the job that needs to be done. A simple operation might be ‘add’ or ‘subtract’. A CPU’s instruction set contains the opcodes that it will accept. There are two types of opcode:
An opcode that tells the circuitry which operation to carry out
An opcode along with some data to be processed
Evaluate Operand Address Phase
If the operand involves reference to an operand in memory or available via I/O, then determine the address of the operand.
Fetch Operands Phase
Here the memory address register (MAR) is loaded with the address calculated and memory is read into memory data register (MDR), making data available as an input to the processing unit.
The operation indicated in the instruction is performed, data operand (DO).
The address is put into MAR and the new value is put int MDR. The memory unit is told to store and memory stores data from MDR into memory cell.
YouTube. (2018). The CPU Instruction Cycle. online Available at: https://www.youtube.com/watch?v=WoOoJT2mC9w Accessed 20 Oct. 2018.
BBC Bitesize. (2018). BBC Bitesize – GCSE Computer Science – Instructions – Revision 3. online Available at: https://www.bbc.com/bitesize/guides/z2342hv/revision/3 Accessed 19 Oct. 2018.
C-jump.com. (2018). The Instruction Cycle. online Available at: http://www.c-jump.com/CIS77/CPU/InstrCycle/lecture.html Accessed 17 Oct. 2018.
En.wikipedia.org. (2018). Processor register. online Available at: https://en.wikipedia.org/wiki/Processor_register Accessed 17 Oct. 2018.
WhatIs.com. (2018). What is arithmetic-logic unit (ALU)? – Definition from WhatIs.com. online Available at: https://whatis.techtarget.com/definition/arithmetic-logic-unit-ALU Accessed 17 Oct. 2018.
Techopedia.com. (2018). What is Arithmetic Logic Unit (ALU)? – Definition from Techopedia. online Available at: https://www.techopedia.com/definition/2849/arithmetic-logic-unit-alu Accessed 16 Oct. 2018.
En.wikibooks.org. (2018). Unit 1.1.1 Structure and Function of the Processor – Wikibooks, open books for an open world. online Available at: https://en.wikibooks.org/wiki/A-level_Computing/OCR/Unit_1.1.1_Structure_and_Function_of_the_Processor Accessed 16 Oct. 2018.
Webopedia.com. (2018). What is a CPU – Central Processing Unit? Webopedia Definition. online Available at: https://www.webopedia.com/TERM/C/CPU.html Accessed 16 Oct. 2018.
Techopedia.com. (2018). What is a Control Unit (CU)? – Definition from Techopedia. online Available at: https://www.techopedia.com/definition/2855/control-unit-cu Accessed 16 Oct. 2018.
Study.com. (2018). Central Processing Unit (CPU): Parts, Definition & Function – Video & Lesson Transcript | Study.com. online Available at: https://study.com/academy/lesson/central-processing-unit-cpu-parts-definition-function.html Accessed 13 Oct. 2018.