# A-level Computing/AQA/Computer Components, The Stored Program Concept and the Internet/Machine Level Architecture/Internal and external hardware components of a computer

Modern computing (arguably) started in 1822 when Charles Babbage, a British Mathematician, proposed 'the difference engine'. This was a mechanical machine that could calculate numbers from given inputs. Unfortunately Babbage never got enough funding to realise his plans and there was no Victorian Computing Revolution, however, you can see a completed modern version in the Science Museum in London (along with half of Babbage's brain!).
Since Babbage there have been several different designs of computers, and the one we are going to focus on here is called the 3-Box Model, or Von Neumann machine. In this machine:
* All data and instructions are stored in the Main Memory
* Instructions are sent to the Processor along the System Bus to be executed
* Any input and output (such as printing and entering instruction) is performed by I/O devices with the data travelling from the I/O devices to the Processor and Main Memory by means of the System Bus:
Consider a program stored on a DVD, to get the machine to run it, you will have to input the data from the DVD to the memory using the system bus. Once the program is loaded into memory the instructions it will be sent to the CPU line by line using the system bus and executed there. Any things to be printed or shown on a screen will be sent to the Output box.
We'll now look in more detail at these components:

## Processor

The processor (or Central Processor Unit - CPU) is one of the most complex parts of any computer system. The processor executes programs and supervises the operation of the rest of the system. Single chip processors are otherwise known as microprocessors. Gordon E Moore theorized that the number of transistors that could be integrated onto the chip would double every 18–24 months, most modern processors will contain billions of transistors. Multicore microprocessors are now very popular, where the processor will have several cores allowing for multiple programs or threads to be run at once.

## Main Memory

Main memory is used to store program instruction and data, using the System Bus to communicate with CPU. Main memory is often created using Random Access Memory (or RAM) or Read Only Memory (ROM). Modern computers will have gigabytes of RAM, meaning that large programs can run and multiple programs can run at once. The more main memory that you have the larger the number of programs you can run at once.
Main memory consists of data stored in addresses, in general, the more main memory you have the more addresses you'll have and vice versa.
    AddressContents 1024Cabbage 1025Celery 1026Courgette 1027Carrot 1028Cucumber 1029Chard
In the above example if we were to perform the following assembly code instruction:
    LDA 1026 ;LOAD memory location 1026
This would return the word: "Courgette"
If we were to perform the following assembly code instruction:
    STO "Beetroot", 1025 ;STORE data given into memory location 1025
This would change the value stored in memory location 1025 from "Celery" to "Beetroot"

### ROM and RAM

The two main types of main memory are ROM and RAM. Whilst RAM might be several gigabytes in size, ROM will often be a few kilobytes. As ROM is read only memory, it tends to store core software instructions such as the code needed to load the Operating System into RAM (known as bootstrapping) or change the bios. RAM is much much larger and stores the code to run the operating system and programs that you run on your computer. When you load a disc into a games console, the code won't do anything until it has loaded from the disc into the system RAM, that's why you see a loading screen.
* Exercise: Central Processing Unit
* Give a definition for main memory:
* Answer:
* Main memory is a data store that can be directly addressed by the CPU
* What is the difference between ROM and RAM?
* Answer:
* ROM is Read Only Memory, RAM is random access memory. This means that ROM cannot be written to, it can only be read from. RAM can be both read from and written to.
* Name the four components of Von Neumann Architecture
* Answer:
* Processor
* Main memory
* I/O devices
* System bus

## System Bus

A Bus is a connection between different devices. This connection will normally consist of multiple wires along which signals, instructions and data will be carried. In Von Neumann Architecture there is a single bus to manage the connection between the three main components. The System Bus consists of 3 separate buses, each with a specific task that you need to know. This three bus model is an expansion of the Von Neumann architecture showing greater detail.

### Address Bus

A single-directional bus that carries address signals from the CPU to Main Memory and I/O devices. This might involve the CPU requesting some data from Main Memory, sending the address of the data to Main Memory, then Main Memory returning the data along the data bus. Let's take a look at some code:
This code is asking to load the data from memory address 23 into the CPU, the address bus does not send addresses to the processor, but only sends them from the processor. To do this the CPU would send 23 along the Address Bus, and the value from memory location 23 would be sent along the Data Bus back to the CPU. The size of the Address Bus can dictate how much Main Memory you can have in your system. For example, if you had an Address Bus of 3 bits, then:
This would mean that your Main Memory could only have 8 different addressable blocks

### Data bus

A bi-directional bus, typically consisting of 32 wires, used to transport data and instructions between the three components of the three-box model. The larger the Data Bus the more data can be transported at one time. For example if we have an 8 bit Data Bus, the maximum value we could send along the Bus would be:
The larger the Data Bus the more data we can send at once and the more complex instructions we can use.

### Control bus

A bi-directional bus, typically consisting of more than 16 wires, used to transport control signals between the three components of the three-box model. The control bus is used to carry important information such as messages to say when a device has finished a job or when a device has just been plugged in. A simple example would be when you plug in your USB key and after a few moments a screen pops up asking you what you want to do with it. The control bus also contains interrupt signals which allow devices (printers, keyboards, disks, etc.) to signal that they have finished a request. The CPU temporarily suspends its current program, services the device and then resumes the previous program.
* Extension: Modern Architecture
* The information above will serve you well for the exam; however, the way many modern processors work may break the definitions you have just learnt:
* Since modern CPUs now have internal memory(cache) and I/O devices have the ability to access memory without the need for the CPU(DMA), the address bus has to be bi-directional. However, the model used in the exam treats it as being uni-directional.
* Some modern systems combine address and data buses since they are used at different parts of the fetch decode execute cycle.
* What is now called ROM is nowadays just hard to write Flash memory requiring special equipment, voltages or processes. It isn't truly Read Only as you can change it with some difficulty. You may have upgraded the BIOS on your computer for example.
* Modern chip designs have evolved either towards integrating more logic onto the CPU chip (memory controllers, Ethernet interfaces, serial ports etc.) for embedded applications (driven originally by the design of printers and photocopiers and called SOC - System On a Chip) or towards a single fast bus towards a second chip that has multiple buses for various types of device (see Northbridge for more information).
Exercise: Central Processing Unit
Complete the following table:
NameDirectionDescription
Address Bus
Data Bus
Control Bus
Answer:
NameDirectionDescription
Address Busuni-directionalCarries addresses from the CPU to main memory or other devices
Data Busbi-directionalTransports data and instructions
Control Busbi-directionalTransports control signals
What is the largest number the following width data buses can carry at one time:
width 4 wires
Answer:
$1111=2^{4}-1=15$
width 6 wires
Answer:
$111111=2^{6}-1=63$
width 10 wires
Answer:
$1111111111=2^{10}-1=1023$
How many addresses can the following width addresses buses address:
width 4 wires
Answer:
$1111=2^{4}=16$
width 5 wires
Answer:
$11111=2^{5}=32$
width 8 wires
Answer:
$11111111=2^{8}=256$
An address bus that can address a maximum of 2GB memory is 31 wires in width. How many wires would it need if it were to address a maximum of 4GB of memory?
Answer:
32 as $2^{32}=4294967296$ bytes or 4GB of memory
But you don't have to be really good at maths to answer this. 4GB is twice 2GB and we know that 2^x is half the size of 2^x+1. :

## Peripherals

Input/Output devices are used by the system to get information in and out, as they are not internal but are connected to the CPU, we refer to them as peripherals (your hands are peripheral to your torso). We'll cover the specific ones you need to learn a little later, but for the moment you need to know the fundamental difference:
* Input Devices - used to get information into the system. E.g. Keyboard
* Output Devices - used to send information out of the system. E.g. Visual Display Unit (VDU)
If you look at the Von Neumann Architecture notice that it doesn't mention Keyboard or display, this is a very smart move as you don't want to force every computer to have a keyboard (think about a games console, there is no keyboard on that) or a VDU (some computer such as MP3 players don't have a screen). However, some computer architecture does include specific I/O controllers:

### I/O controllers

An I/O controller is an electronic circuit that connects to a system bus and an I/O device; it provides the correct voltages and currents for the system bus and the I/O device. Examples would include:
* keyboard controller, attached to a keyboard
* disk controller for a Hard Disk (Hard Disks are not main memory!)
* video display controller, attaching a video display unit (monitor)

### I/O ports

I/O ports is a complementary method of performing input/output between the CPU and peripheral devices in a computer. This allows I/O devices to be connected to the CPU without having to have specialist hardware for each one. Think about the USB port on your computer, you can connect Keyboards, Mice, Game pads, Cameras, Phones, etc. and they all connect using the same port.

## Secondary storage

Main memory can be very expensive and you often require storing data that you won't use constantly. Think about a computer game that you haven't played for a couple of months. The last thing you want to do is to store this code in main memory taking up all that precious and expensive space. To get past this issue we use secondary storage. This is normally inexpensive data storage sitting external to the CPU, connected through an I/O controller, that we can use as and when we need. Secondary Storage will store data permanently, without the need for the electricity to remain always on (Think about a USB key, it doesn't need to be plugged in to keep its data). So taking the game example again, we only load the game into main memory (maybe from a DVD or hard disk), as and when we need it. Examples of secondary storage include:
* Hard Disk drive
* USB thumb drives
* CD-ROM / DVD / Blu-ray
* Tape drives
* Exercise: I/O and Peripherals
* Name 2 input peripherals:
* Answer:
* Keyboard
* Mouse
* Scanner
* Camera
* Microphone
* Games pad
* Name 2 output peripherals:
* Answer:
* Speakers
* Printer
* Visual Display Unit
* Name two ways to connect peripherals to a CPU:
* Answer:
* I/O controller
* I/O ports
* Name 2 secondary storage devices:
* Answer:
* Hard Disk
* USB thumb stick
* CD-ROM / DVD / Blu-Ray
* Name 2 I/O controllers
* Answer:
* Hard Disk controller
* Keyboard controller
* Visual Display Unit Controller