Edexcel International Advanced Level Computer Science, point 11.1.1
Definition
Harvard architecture is a computer design with separate memories, and separate buses, for instructions and for data. (In von Neumann architecture, 1.1.2, both share one memory and one set of buses.)
Function
It lets the processor fetch the next instruction and read or write data at the same time, which removes the von Neumann bottleneck (1.1.2).
a. Memory structure
- Instruction memory holds the program (often ROM or flash, so it is read only and permanent).
- Data memory holds variables and working data (RAM).
- Each has its own address bus and data bus, so the two memories can be different sizes, different word lengths and different technologies.
- The control unit, ALU and registers work as before (1.1.4).
Characteristics and operation
- The PC gives the address of the next instruction on the instruction address bus.
- The instruction arrives on the instruction bus and goes to the CIR.
- While it is being decoded or executed, the next instruction can be fetched, because the instruction bus is free.
- If the instruction reads or writes data, it uses the data bus and data memory, at the same time as the next instruction fetch.
b. Difference between Harvard and von Neumann architecture
| Harvard | von Neumann | |
|---|---|---|
| Memory | Separate for instructions and data | One shared memory |
| Buses | Separate instruction and data buses | One set of buses |
| Instruction fetch and data access | At the same time | One after the other |
| Speed | Faster (no bottleneck) | Slower (bottleneck) |
| Complexity and cost | More (more buses and pins) | Less |
| Memory use | Fixed split: spare data memory can't hold instructions | Flexible: any split |
| Program protection | Easy: instruction memory can be read only | Harder: programs and data are mixed |
| Self-modifying code | Difficult or impossible | Possible |
| Typical use | Microcontrollers, DSPs, embedded systems | General-purpose computers |
Modern processors: a mixture
Most modern processors are modified Harvard. Outside the CPU, they use one main memory (von Neumann), but inside, the L1 cache is split into an instruction cache and a data cache (1.1.6), so fetches and data accesses can happen in parallel. This gives the flexibility of von Neumann with much of the speed of Harvard.
Benefits
- Higher throughput: instruction fetch and data access overlap.
- No bottleneck on a single bus.
- Memory can be tuned: instruction memory in read-only flash, data in RAM, with different widths.
- Better protection: programs can't be overwritten by faulty data.
- Predictable timing, which suits real-time systems.
Drawbacks
- More hardware: two buses and two memory interfaces cost more and take up more chip area.
- Memory isn't shared: unused data memory can't be used for instructions (and the reverse).
- More complex to design and to program (it is harder to load programs or treat instructions as data).
- Self-modifying code and loading programs are harder.
Worked example
Task: a washing machine controller runs a fixed program all the time and uses a little RAM for the current cycle. Explain why Harvard architecture suits it.
- The program never changes, so it can sit in read-only flash (instruction memory), where it is safe from being overwritten by a fault.
- The small data memory (RAM) holds only temperature, timer and state.
- The controller must respond quickly and predictably, and fetching instructions while reading sensors (data) in parallel helps.
- It doesn't need to load new programs or share memory, so the fixed split isn't a problem.
- Cost: the extra buses are simple to add in a small microcontroller.
A general-purpose PC, which loads many different programs of different sizes, needs flexible shared memory, so it uses von Neumann (with a split L1 cache).
Exam tip: the key difference is separate memories and buses for instructions and data, which allow simultaneous access. Give a benefit (speed, no bottleneck) and a drawback (cost, complexity, fixed memory split). You may be asked to complete a Harvard diagram, so draw two memories and two sets of buses joined to the CPU.
Check yourself
What is the main feature of Harvard architecture?
Separate memories and buses for instructions and data.
Why is Harvard architecture faster than von Neumann?
An instruction fetch and a data access can happen at the same time, so there is no single-bus bottleneck.
Give two drawbacks of Harvard architecture
Any two of: more hardware and cost; memory can't be shared between instructions and data; more complex design; harder to load programs.
Where is Harvard architecture commonly used?
Microcontrollers, digital signal processors and other embedded systems.
How do modern processors use ideas from both designs?
They use a single main memory (von Neumann) but have separate instruction and data caches at the L1 level (Harvard).