Lesson 1 · The assembly line in silicon · question 1 of 6 · open in the lesson
Explain the main concepts and benefits of each one of the following techniques used by a pipelined RISC-V processor:
- Pipelining of the instruction execution
- The five-stage organisation IF / ID / EX / MEM / WB
- The pipeline registers
- Separate instruction and data memories
Show model answer
1. Pipelining is an implementation technique that overlaps the execution of consecutive instructions: the execution is divided into stages and each stage works on a different instruction in the same clock cycle. The latency of one instruction does not change (k cycles), but once the pipeline is full one instruction completes per cycle, so the throughput grows by up to k times; n instructions take k + n − 1 cycles instead of nk, and the clock period becomes the time of one stage instead of a whole instruction. Costs: a fill of k − 1 cycles, pipeline-register overhead, and hazards (structural, data, control) that insert stalls.
2. The five stages correspond to five resources used once by every instruction: IF fetches from the instruction memory and computes PC + 4; ID decodes and reads the two source registers (two read ports); EX uses the ALU for the operation, the address or the branch comparison; MEM accesses the data memory (loads and stores only); WB writes the destination register (one write port). Because each stage uses a different resource, five instructions can be in flight without conflicts; every instruction traverses all five stages (idle stages are not skipped), so completion is in order and at most one instruction writes per cycle.
3. The pipeline registers IF/ID, ID/EX, EX/MEM and MEM/WB sit between the stages and are written on every clock edge. They hold everything an in-flight instruction still needs: the instruction and PC + 4 (IF/ID); the operand values, the immediate, the destination register number and the control signals for EX, MEM and WB (ID/EX); the ALU result or address, the store data, the branch target, rd and the MEM/WB control (EX/MEM); the loaded data or ALU result, rd and the WB control (MEM/WB). Benefits: they isolate the stages so that the clock period equals one stage; the control is decoded once and carried along; and they are the source of the values used by forwarding.
4. With a single memory, the instruction fetch of one instruction and the data access of another (IF and MEM of two different instructions in the same cycle) would compete for the memory port: a structural hazard with a stall every time. Separate instruction and data memories (in practice separate L1 caches) give the two stages their own port, so the hazard is designed away. It is a property of the implementation, not of the instruction set.
The 2026 paper asks its 8-point question in exactly this form: "Explain the main concepts and benefits of each one of the following techniques", with a few lines per sub-point. Fill them with the key words — overlap, throughput versus latency, k + n − 1, one resource per stage, the four register names with their contents, "structural hazard" for the memory — and with a cost next to each benefit. A sub-point that only says what the thing is called says nothing.