4.1.2 · D5Computer Architecture (Deep)

Question bank — Harvard architecture — separate instruction - data memory

1,905 words9 min readBack to topic
Figure — Harvard architecture — separate instruction - data memory
Figure — Harvard architecture — separate instruction - data memory

True or false — justify

True or false: Harvard architecture means the computer has two CPUs working in parallel.
False. It is one CPU with two memory paths. The parallelism lives in memory access (fetch + data at once), not in computation — one chef, two delivery doors.
True or false: Harvard architecture is always faster than von Neumann.
False. The idealized gain is ; when (register-only arithmetic) , i.e. no gain at all. Harvard only wins when there is data traffic to hide under the fetch.
True or false: In a pure Harvard machine, an instruction fetch and a data read can occur in the same clock cycle.
True. That is the entire point — the instruction bus and data bus are physically separate wires, so two independent signals travel simultaneously.
True or false: Modified Harvard machines present the programmer with two separate address spaces.
False. Modified Harvard has one unified main memory (one address space); the split is only in the L1 I-cache and D-cache near the CPU. The programmer sees a flat, von-Neumann-like memory.
True or false: Because Harvard has two buses, it always has double the useful memory bandwidth of von Neumann.
False. You only reap two buses' worth of throughput when a fetch and a data access are both ready in the same cycle. If is small the data bus sits idle most cycles, so the useful gain is , not — double bandwidth is a peak number, not the everyday one.
True or false: Self-modifying code runs naturally on pure Harvard hardware.
False. Instruction memory is separate and usually read-only, so the CPU cannot easily write new instructions as data. This is precisely why pure Harvard is rare and Modified Harvard dominates.
True or false: Harvard's speed-up formula can exceed for a data-heavy program.
False. is a fraction, so , which bounds between and . Even if every instruction touched memory (), the ceiling is exactly .
True or false: Most modern desktop/phone CPUs are pure Harvard.
False. They are Modified Harvard: unified main memory with split L1 caches. This keeps von Neumann's flexibility (load programs as data) while enjoying Harvard's parallel fetch/access on the hot path.

Spot the error

"Harvard is faster because two buses let the CPU execute two instructions per cycle." — what's wrong?
It conflates executing with fetching. The two buses let you fetch one instruction while accessing data for another — one execution stream, two memory operations. Executing two instructions per cycle is superscalar issue, a different mechanism.
"Since instruction memory is read-only, a Harvard computer can never load a new program." — what's wrong?
This is only true for pure Harvard. Modified Harvard has a writable unified backing memory, so programs are loaded as ordinary data and then fetched as instructions — normal OSes and compilers run fine.
"For , von Neumann needs cycles because fetch and data happen at the same time." — what's wrong?
The justification is backwards. Correct reasoning, step by step: (1) von Neumann has one bus, which can carry only one addressed transaction per cycle. (2) Every one of the instructions must first be fetched, costing cycles. (3) The load/store instructions each need a second, separate trip on that same single bus to move their data — because the bus was busy carrying the fetch, the data cannot ride along with it. (4) Those two uses therefore take turns, so their costs add: . Simultaneity is the Harvard property (two buses), never von Neumann's.
"Harvard eliminates all pipeline hazards." — what's wrong?
It only removes the structural hazard where fetch and data access fight over one memory port. Data hazards (an instruction needing a result not yet computed) and control hazards (branches) are unaffected — those live in Pipelining, not the memory buses.
"An 8-bit microcontroller must use the same word width for instructions and data because they share the chip." — what's wrong?
Sharing a chip is not sharing a bus. Because Harvard has separate memories, instruction memory can be 16-bit wide while data memory is 8-bit wide. Independent widths are a feature of the separation, not a limitation.

Why questions

Why does the von Neumann cost add the terms while Harvard's cost takes the max?
One shared bus serializes fetch and data, so their per-cycle costs are sequential and sum: . Two independent buses run concurrently, so the smaller cost (data) hides under the larger (fetch) — you pay the maximum of the two, which is .
Why does the Harvard advantage vanish when ?
With no loads/stores there is nothing for the data bus to carry, so the second bus sits idle every cycle. There is no work to overlap, hence .
Why do embedded designers favour Harvard/Modified Harvard for microcontrollers?
Besides the fetch/data overlap, separate memories allow different word widths and address sizes (e.g. wide instruction ROM, narrow data RAM), giving tighter, cheaper silicon — which is why AVR, PIC and ARM Cortex-M are Modified Harvard.
Why is the split into an I-cache and a D-cache called "Modified Harvard" rather than "pure Harvard"?
Because underneath the caches there is a single unified main memory (the von Neumann part). Only the fast L1 layer near the CPU is split, so it is a hybrid — Harvard behaviour on top of a von Neumann memory.
Why can't we just widen a single von Neumann bus to get the same benefit as Harvard?
A wider single bus still carries one addressed transaction at a time; you can move more bits per trip but still choose fetch or data each cycle. Harvard's win is issuing two distinct addresses (one instruction address, one data address) in the same cycle, which one bus cannot do.
Why does the real-program speed-up land around rather than the maximum?
Because typical programs have : only about a third of instructions are loads/stores, the rest are register-only. Since , that measured pins the gain to .

Edge cases

Edge case: a program of pure register arithmetic () — what does Harvard give?
: no speed-up, and the extra data memory, pins and controller are wasted hardware. Harvard is a loss here in cost terms.
Edge case: a program where every instruction is a load or store () — what happens?
This is the best case, . Every fetch is perfectly shadowed by a data access, so Harvard runs twice as fast as the equivalent von Neumann machine.
Edge case: the D-cache misses and must fetch from unified main memory in Modified Harvard — is the "parallel fetch and data" still guaranteed?
No. On a data-cache miss the access falls through to the shared backing memory, reintroducing the von Neumann bottleneck for that access — the parallelism guarantee holds only while both operations hit their separate L1 caches.
Edge case: the I-cache misses in Modified Harvard — does that also hit the bottleneck?
Yes, symmetrically. An instruction-cache miss must go fetch the instruction from the same unified main memory the data path uses, so it too serializes against any concurrent data access — the split-cache parallelism is only free while both the I-cache and D-cache hit.
Edge case: two consecutive instructions both need a data access — do they overlap on one data bus?
No. The overlap in the model is fetch (instruction bus) versus data (data bus), not data versus data. Two data accesses still contend for the single data bus and take turns, so they do not both hide for free.
Edge case: instruction and data addresses happen to collide (same physical location) in pure Harvard — what breaks?
Nothing collides, because pure Harvard has separate memories with separate address spaces — address in instruction memory and address in data memory are different physical cells. This is exactly why loading code as data is awkward.
Edge case: a branch instruction that touches no data — does it benefit from the second bus?
Not directly. A no-data instruction has nothing for the data bus to carry that cycle, so its own execution sees ; the aggregate program speed-up still averages to over the whole instruction mix.

Connections

  • Von Neumann architecture — the single-bus baseline these traps contrast against.
  • Von Neumann bottleneck — the exact serialization the "add vs max" questions probe.
  • CPU instruction cycle — fetch/decode/execute; the overlap is fetch ∥ data.
  • Cache memory — split I-cache/D-cache is where Modified Harvard lives.
  • Pipelining — structural vs data/control hazards, clarified in "Spot the error".
  • Microcontrollers (AVR PIC ARM Cortex-M) — real Modified-Harvard hardware.
  • Memory bus and bandwidth — why "double bandwidth" is only peak, not effective.