~ The Processor


Arithmetic logic unit

A simple example of an arithmetic logic unit (2-bit ALU) that does AND, OR, XOR, and addition

The Arithmetic Logic Unit or the ALU is a digital circuit that performs arithmetic and logical operations. Where arithmetic operations include things such as ADD and SUBTRACT and the logical operations include things such as AND, OR, NOT.

The ALU is a fundamental building block in the central processing unit (CPU) of a computer and without it the computer wouldn't be able to calculate anything! Some examples of assembly code instructions that would use the ALU are as follows (not all processors will have all these instructions):

ADD ;add one number to another number
SUB ;subtract one number to another number
INC ;increment a number by 1
DEC ;decrements a number by 1
MUL ;multiply numbers together
OR  ;boolean algebra function
AND ;boolean algebra function
NOT ;boolean algebra function
XOR ;boolean algebra function
JNZ ;jump to another section of code if a number is not zero (used for loops and ifs)
JZ  ;jump to another section of code if a number is zero (used for loops and ifs)

Control unit

The control unit sits inside the CPU and coordinates the input and output devices of a computer system. It coordinates the fetching of program code from main memory to the CPU and directs the operation of the other processor components by providing timing and control signals.


Processor clock - A timing device connected to the processor that synchronises when the fetch, decode execute cycle runs

Your computer might contain several clocks that each regulate different things. The clock we are going to look at here will keep the processor in line. It will send the processor a signal at regular times telling it to start the fetch decode execute routine.

Lights flash at frequency f = 0.5 Hz (Hz = hertz), 1.0 Hz and 2.0 Hz, where {\displaystyle x}x Hz means {\displaystyle x}xflashes per second.

Clock speed - The number of cycles that are performed by the CPU per second

Clock speed is measured in Hertz, which means 'per second'. You have probably heard of clock speeds such as 1 MHz, this means 1,000,000 cycles per second and potentially a million calculations. A computer of speed 3.4 GHz means it might be capable of processing 3,400,000,000 instructions per second! However it isn't as simple at that, as some processors can perform more than one calculation on each clock cycle, and processors from different manufacturers and using different architecture are often difficult to compare. (See the Megahertz myth). Also with the increase in multi-core processors such as the PS3 (7 cores) and the Xbox 360 (3 cores) there might be times where the clock might be ticking but there is nothing for the processor to calculate, the processor will then sit idle.

General purpose and dedicated registers

Registers - a small amount of fast storage which is part of the processor

For immediate calculations, using main memory is too slow. Imagine having to send a signal along the address bus and some data along the data bus when all you want to do is store the result of adding two numbers together. The distance between the processor and main memory, even though it might be a few centimetres, is far enough for the signal to take a significant time to get there. To get past this issue there are small amounts of memory stored inside the processor itself, these are called registers. Registers are incredibly fast pieces of memory that are used to store the results of arithmetic and logic calculations.

Different processors will have different sets of registers. A common register is the Accumulator (acc) which is a data register, where the user is able to directly address (talk to) it and use it to store any results they wish. Processors may also have other registers with particular purposes:

  • General purpose register - allow users to use them as they wish
  • Address registers - used for storing addresses
  • Conditional registers - hold truth values for loop and selection

There are also 4 registers in particular that you need to know, we'll meet them in more detail in the next chapter:

  • Program Counter (PC) - an incrementing counter that keeps track of the memory address of which instruction is to be executed next.
  • Memory Address Register (MAR) - holds the address in memory of the next instruction to be executed
  • Memory Buffer Register (MBR) - a two-way register that holds data fetched from memory (and ready for the CPU to process) or data waiting to be stored in memory
  • Current Instruction register (CIR) - a temporary holding ground for the instruction that has just been fetched from memory
Example: Name the component

Match the following components to the numbers on the diagram: Processor, Data bus, Control Bus, Main memory, Keyboard, Secondary storage, Address bus, Clock, Monitor, VDU controller, disk controller, keyboard controller


Don't worry about the size of this problem, we are going to tackle it bit by bit. the first step is to remember the differences between each of the components:

  • Processor - connected to other devices using buses
  • Data bus - bi-directional connection between devices
  • Main memory - internal to the computer and linked through the buses
  • Keyboard - external to the computer, an input device
  • Secondary storage - external device, an input and output device
  • Address bus - uni-directional connection between devices
  • Clock - regulates the processor
  • Monitor - external output device
  • VDU controller - connects system to external monitor
  • Disk controller - connects system to external secondary storage
  • Keyboard controller - connects system to external keyboard device
  • Control Bus - A bi-directional bus used to control signals between the components

Now we have remembered what each device does, can you label them all?

Answer :

  1. Clock
  2. Processor
  3. Main memory
  4. keyboard controller
  5. VDU controller
  6. Disk controller
  7. Data bus (or Control bus)
  8. Control bus (or Data bus)
  9. Address bus
  10. Keyboard
  11. Monitor
  12. Secondary storage