# A-level Computing/AQA/Paper 2/Fundamentals of computer organisation and architecture/The stored program concept

When we talk about the stored program concept, we need to think with regard to the internal layout and architecture of a computer.
Early computers such as the IBM had no form of internal storage - all instructions and data were held on punch cards, which could be fed into the IBM to process data. In the 1960s, when the IBM was used, calculations were performed to get astronauts into orbit, and back, with the processing power of a modern-day toaster! Nowadays, computers typically use Von-Neumann Architecture, which reflects the idea of the stored program concept.
The Von-Neumann Architecture, and stored-program concept, works where machine code instructions and data are stored, and loaded from memory into the processor to be executed in sequential order. Von-Neumann Architecture is used for general purpose machines, where instructions and data are held in the same memory location - this is our main memory, or RAM.
On the other hand, Harvard Architecture follows the stored-program concept, however it takes into account the use of the memory unit. With both instructions and data being held in the same address, the processor is unable to work at optimum speed as the two are competing over the same data bus. In addition, one data bus may have an insufficient bus width for program instructions i.e. increased traffic due to program instructions having a greater word length. Harvard Architecture is often used for specialist embedded computer systems, where optimum speed is the priority of the system.
Building on the Von Neumann architecture we get the idea of how the stored program concept works. If you have ever loaded a game on a console you might notice that:
* you need to insert a disc
* the disc spins
* the game says loading
* the game plays
This is the stored program concept in motion! Let's take apart what is happening:
* You insert an optical disk (secondary storage) with the code on.
* The code is loaded into the main memory.
* The processor fetches, decodes and executes instructions from main memory to play the game.
* Exercise: Characteristics of a processor
* How many different addresses can a 8 line address bus address?
* Answer:
* $2^{8}=256$
* How does the address bus width affect main memory?
* Answer:
* If you have a small address bus then you will be limited in the number of addresses you can talk to and therefore how much main memory you can directly address.
* How wide would the address bus have to be to talk to 1024 addresses?
* Answer:
* 10 lines wide since $2^{10}=1024$
* What is wrong with using a 9 bit address bus but having 700 memory locations in main memory?
* Answer:
* We can only address $2^{9}=512$ different locations. It wouldn't be able to talk to address locations $513-700$.
* Define the stored program concept:
* Answer:
* A program must be (resident) in main memory in order for it to be executed. The instructions are fetched from main memory, then decoded and executed in the CPU.

### Harvard Architecture

The Harvard architecture is a computer architecture which uses physically separate memory locations for instructions and data. This is done through the use of embedded Digital Signal Processing (DSP) systems. The two memories may have different characteristics. In embedded systems, instructions may be stored in read-only memory whereas data may be held in read-write memory. Embedded systems include many specialised computers built in that operate in real-time, such as traffic lights.
To summarise, the Von Neumann architecture uses a shared memory and bus for both data and instructions whereas the Harvard architecture has physically separate memories for instructions and data.