A 5-stage instruction pipeline has every stage taking 10 ns, with negligible latch delay. Find the time to execute 100 instructions with and without pipelining, and the speed-up.
The von Neumann (stored-program) architecture keeps instructions and data in one read–write memory reached over a shared bus, while the CPU loops through fetch, decode and execute. It frames every PSC question on RISC/CISC, Flynn's taxonomy, pipelining and Amdahl's law.
A program is a list of instructions, and data is what those instructions work on. The first large electronic computer, ENIAC (1945–46), kept its program outside memory: operators set switches and plugged patch cables, so changing from one calculation to another could take days of rewiring.
The stored-program concept removes the rewiring. Instructions are encoded as binary numbers and kept in the same read–write memory as the data. Loading a new program is then just writing new numbers into memory, and one program can treat another program as data — exactly what compilers, loaders and operating systems do every day.
John von Neumann wrote the design down in the First Draft of a Report on the EDVAC (June 1945), drawing on discussions with ENIAC's builders J. Presper Eckert and John Mauchly. Because his name alone was on the report, any machine organised this way is called a von Neumann machine. It is also called the Princeton architecture, after the IAS machine built at Princeton in 1951–52.
Von Neumann's report split a computer into a few cooperating units, and textbooks now list five: input, output, memory, arithmetic logic unit and control unit. The ALU, the control unit and a handful of fast registers together form the CPU (central processing unit).
| Unit | What it does | Examples |
|---|---|---|
| Input | Converts outside information into binary and delivers it to memory or the CPU | Keyboard, mouse, sensor, network card |
| Memory | Holds the program and its data at numbered addresses; can be read and written | Main memory (RAM), backed by cache and disk |
| ALU | Performs arithmetic (add, subtract) and logic (AND, OR, NOT, compare, shift) | Adder, shifter, flag logic |
| Control unit | Fetches and decodes instructions, then issues timed control signals to every other unit | Instruction decoder, sequencer, timing generator |
| Output | Converts binary results into a form people or machines can use | Display, printer, actuator |
The units are joined by a system bus made of address, data and control lines (see the Instruction formats, addressing & bus organization topic). Inside the CPU, a few registers do the book-keeping for every instruction:
| Register | Holds | Note |
|---|---|---|
| PC — program counter | Address of the next instruction to fetch | Incremented during fetch; a jump overwrites it |
| IR — instruction register | The instruction being decoded and executed | Its opcode bits feed the decoder |
| MAR — memory address register | The address being sent to memory | Drives the address bus (CPU → memory) |
| MBR / MDR — memory buffer (data) register | The word just read from, or about to be written to, memory | Sits on the data bus, both directions |
| AC — accumulator | One ALU operand and the result | Single-accumulator machines; general registers in modern CPUs |
Instructions and data travel over the same path between CPU and memory, so the CPU can make only one of those transfers at a time. Processors became far faster than memory, so the CPU often sits waiting on that single channel. John Backus called this the von Neumann bottleneck in his 1977 Turing Award lecture.
Count the traffic for a simple ADD X: one memory access fetches the instruction and a second reads X. The instruction is a passenger on the same road as the data, and since a modern CPU wants a new instruction every fraction of a nanosecond, instruction traffic alone can fill the road.
The Harvard architecture removes the conflict at its root: it has separate memories and separate buses for instructions and data, so the next instruction can be fetched in the same cycle as a data read or write. The name comes from the Harvard Mark I (Howard Aiken, 1944), which read instructions from punched paper tape while its data sat in electromechanical counters.
| Feature | Von Neumann (Princeton) | Harvard |
|---|---|---|
| Memories | One memory for instructions and data | Separate instruction memory and data memory |
| Buses | One shared set of address/data buses | Two independent sets |
| Fetch and data access in one cycle | No — they take turns | Yes — in parallel |
| Word widths | Same for both | Can differ (PIC16: 14-bit instructions, 8-bit data) |
| Loading programs as data, self-modifying code | Natural | Awkward; program memory is often ROM or flash |
| Hardware cost | Lower, simpler | Higher (two memories, two buses) |
| Typical use | General-purpose PCs, servers, main memory of most CPUs | DSPs and microcontrollers (8051, AVR, PIC) |
The CPU spends its whole life repeating one loop, the instruction cycle. We write each step in RTL (register transfer language): X ← Y means “copy the contents of Y into X”, M[MAR] means “the memory word whose address is in MAR”, and micro-operations separated by a comma happen in the same clock period.
FETCH t1: MAR ← PC
t2: MBR ← M[MAR], PC ← PC + 1
t3: IR ← MBR
INDIRECT t1: MAR ← IR(address)
t2: MBR ← M[MAR]
t3: IR(address) ← MBR(address) ; IR now holds the real operand address
EXECUTE t1: MAR ← IR(address)
(ADD X) t2: MBR ← M[MAR]
t3: AC ← AC + MBR
INTERRUPT t1: MBR ← PC ; return address
t2: MAR ← save-address, PC ← ISR-address
t3: M[MAR] ← MBR ; old PC saved in memoryThe fetch needs three clock periods because each step depends on the previous one. PC ← PC + 1 can share t2 with the memory read because it uses the PC's own incrementer, not the memory bus. The increment is really the instruction length in addressable units: a byte-addressed machine with 32-bit instructions does PC ← PC + 4.
Stallings draws the same cycle as a state diagram: instruction address calculation → instruction fetch → instruction operation decoding → operand address calculation → operand fetch (repeated for each operand) → data operation → operand address calculation → operand store → interrupt check, then back to the start. The upper states use the memory bus; the middle ones run inside the CPU.
An instruction set architecture (ISA) is the list of instructions a processor understands. CISC (complex instruction set computer) designs such as the VAX, Intel 8086 and x86 offer many powerful instructions that can work directly on memory. RISC (reduced instruction set computer) designs keep a small set of simple, fixed-length instructions so that each can finish in about one clock cycle in a pipeline.
RISC grew out of three projects: IBM's 801 (John Cocke, from 1975), Berkeley RISC (David Patterson, 1980–82) and Stanford MIPS (John Hennessy, 1981). ARM, MIPS, SPARC, PowerPC and RISC-V are RISC today. The x86 is still CISC at the instruction level, although modern x86 chips translate each instruction into RISC-like micro-operations internally.
| Feature | RISC | CISC |
|---|---|---|
| Number of instructions | Small — simple operations only | Large — hundreds, some very complex |
| Instruction length | Fixed (typically 32 bits) | Variable (8086: 1 to 6 bytes) |
| Addressing modes | Few and simple | Many and complex |
| Memory access | Only LOAD and STORE touch memory (load–store) | Most instructions may use memory operands |
| Cycles per instruction | ≈ 1 with pipelining | Several, varying by instruction |
| Control unit | Hardwired | Usually microprogrammed |
| Registers | Many general-purpose (32 or more) | Fewer, often special-purpose |
| Pipelining | Easy — uniform instructions | Harder — irregular formats |
| Code size | Larger (more instructions per task) | Compact |
| Burden on compiler | Heavy (scheduling, register allocation) | Lighter |
| Examples | ARM, MIPS, SPARC, PowerPC, RISC-V | VAX, Intel 8086/x86, Motorola 68000, IBM System/360 |
Michael J. Flynn (1966) classified computers by how many instruction streams and data streams they process at once. An instruction stream is the sequence of instructions being executed; a data stream is the sequence of operands those instructions act on.
| Class | Instruction streams | Data streams | Examples |
|---|---|---|---|
| SISD | Single | Single | Classic von Neumann uniprocessor (8085, one simple core) |
| SIMD | Single | Multiple | Vector processors (Cray-1), array processors (ILLIAC IV), GPUs, SSE/AVX/NEON instructions |
| MISD | Multiple | Single | Rare: redundant fault-tolerant computers voting on one data stream (Space Shuttle flight control); systolic arrays are sometimes cited |
| MIMD | Multiple | Multiple | Multicore CPUs, SMP servers, clusters, distributed systems |
More processors help only the part of a job that can actually run in parallel. Gene Amdahl (1967) captured this limit: if a fraction f of the original running time is sped up by a factor s, the remaining (1 − f) still runs at the old speed and dominates.
With f = 0.9 and 10 processors, S = 1 / (0.1 + 0.09) ≈ 5.26, and no number of processors can ever beat 1 / 0.1 = 10. Gustafson's law (1988) is the optimistic counterpart: when the problem size grows with the machine, the parallel part grows too, so the scaled speed-up keeps rising.
Pipelining overlaps the stages of successive instructions, like an assembly line: while one instruction executes, the next is being decoded and a third is being fetched. Latches (pipeline registers) separate the stages, and every stage moves forward on the same clock.
The first instruction needs all k cycles to come out; after that one instruction completes every cycle, giving k + (n − 1). When stages have unequal delays, the clock must fit the slowest stage plus the latch delay, which is why designers balance the stages.
In Intel's line the 8086 (1978) was the first to overlap fetching with execution: its bus interface unit fills a 6-byte prefetch queue while the execution unit works — a simple two-stage pipeline, and a past-paper fact.
Try the problem first, then reveal the working one step at a time.
A 5-stage instruction pipeline has every stage taking 10 ns, with negligible latch delay. Find the time to execute 100 instructions with and without pipelining, and the speed-up.
A new floating-point unit makes FP operations 10 times faster. FP work takes 40 % of the program's original running time. What is the overall speed-up, and what is the best possible speed-up from improving FP alone?
The same program of 10⁹ instructions runs on machine A (2 GHz, CPI 2.0) and on machine B (1.5 GHz, CPI 1.2). Which is faster, by how much, and what are their MIPS ratings?
A 16-bit machine uses a 4-bit opcode and a 12-bit address (all values in hex). Opcodes: 1 = LOAD (AC ← M[X]), 5 = ADD (AC ← AC + M[X]), 2 = STORE (M[X] ← AC). Memory holds 200: 1500, 201: 5501, 202: 2502, 500: 0007, 501: 0005, and PC = 200. Trace PC, IR and AC, and count the memory accesses.
A 4-stage pipeline has stage delays of 60, 50, 90 and 80 ns, and each pipeline latch adds 10 ns. Find (a) the clock period, (b) the time for 1,000 instructions, (c) the time without pipelining (no latches) and (d) the speed-up.
80 % of a program's running time can be parallelised perfectly. How many processors are needed for an overall speed-up of 4? What is the maximum speed-up possible?
Write the fetch and execute micro-operations, one clock period per line, for STORE X (M[X] ← AC) on a CPU with PC, MAR, MBR, IR and AC. How many memory accesses does the instruction make?
Classify each under Flynn's taxonomy: (a) a GPU applying the same shader to a million pixels; (b) a quad-core laptop running a browser and a compiler at once; (c) an 8085 trainer kit; (d) three flight computers running different programs on the same sensor stream and voting on the result; (e) one AVX instruction adding eight pairs of floats.
A program of 2 × 10⁸ instructions has this mix: ALU 40 % (CPI 1), loads 30 % (CPI 3), stores 20 % (CPI 2), branches 10 % (CPI 2). On a 500 MHz CPU, find the average CPI, the CPU time and the MIPS rating.
10 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.