RISC Microarchitecture: the next course stage

In development — levels 48–56 are announced; no dates have been set.

After 47 levels you can build a computer that runs a program. The next step is to make it fast: split one instruction into five stages and find out where, and why, a pipeline goes wrong.

What changes after Part 4

In Parts 1–4 you built the processor around an accumulator: almost every instruction read it, did something with it, and wrote it back. That is convenient for the first steps and inconvenient for speed, because two instructions cannot work at once while both hold the same register.

Part 5 rebuilds the machine around a different model:

The exact instruction list and opcode table are not fixed yet: they are being refined together with the levels.

The five pipeline stages of E-RISC-16 Left to right: IF — instruction fetch, ID — decode and register read, EX — execute in the ALU, MEM — memory access, WB — write the result back to a register. IF fetch ID decode EX ALU MEM memory WB write-back register register register register

Three principles of the stage

The Part 5 levels work differently from those in Parts 1–2. There, the check compared a circuit against a truth table. Here the mistake is usually not in a single gate but in how the stages agree with each other, and it shows only in behaviour over time.

  1. Productive failure. First you build a naive pipeline and run a real program on it. The result is wrong. Then you look for the cause in the waveform: which stage, on which cycle, received the wrong value. The rule appears as a conclusion from observation, not as a ready answer in the task.
  2. Open control logic. The Control Unit, Forwarding Unit, and Hazard Unit are circuits you build. What counts as "the source is ready", "a conflict", or "a bubble" is something you state in terms of signals rather than take on trust.
  3. Engineering trade-off. A pipeline is not free: it speeds up some programs and complicates the circuit. Every step tracks two metrics — cycles per instruction (CPI) and circuit cost: propagation delay and gate count.

The route: nine levels

The sequence runs from the register file to core assembly: each level adds exactly one reason a pipeline can go wrong.

48

Goodbye, Accumulator!

Eight registers, load-store memory access, and R0 that always reads as zero.

49

Anatomy of an Instruction

Instruction fields, sign extension, and the decoder that turns bits into control signals.

50

Single-Cycle RISC

The R-type datapath: PC → instruction memory → registers → ALU → write-back.

51

Memory and Branches

LW/SW, the Control Unit, and BEQ: the first loop on your own instruction set.

52

The Pipeline

Four pipeline registers, five stages, and instruction tokens moving through a cycle.

53

The Short Path

RAW hazards and forwarding: the result reaches the ALU directly, without waiting for the register write.

54

The Load-Use Bubble

The load-use hazard and the Hazard Unit: why LW sometimes needs exactly one bubble.

55

Ghosts of the Wrong Path

Control hazards, flush, and the cost of a branch: what happens to already-fetched instructions.

56

Silicon Pipeline

Core assembly, the CPI metric, and porting the project to Tang Nano 9K.

Learning outcomes

After the stage a student can:

For teachers

Part 5 follows Part 4 and builds on it: by then the student has already built a control unit, a custom instruction set, and a datapath in Verilog. The pipeline introduces no new gates; it introduces a new requirement on how familiar blocks are organised.

Productive failure works here like a lab session: the right answer cannot be guessed, only derived from the mismatch between the expected and the actual result. What is assessed is therefore not "wire it according to the cheat sheet" but diagnosis: did the student find the cycle, the stage, and the signal where the error appeared, and state the rule that removes it?

Open control logic gives a second point of assessment: the forwarding rule, the stall condition, and the flush point must be written in terms of the circuit's signals. Such a rule can be tested on new programs, not only on the one where it was invented.

The schedule of the stage and the exact instruction set are not fixed. Materials will appear in the course curriculum and the level map together with the finished levels.

Status and scope

Next steps

Start the current course →