Part 5 · RISC Microarchitecture · levels 48–67

The fifth part is RISC Lab: you build a 32-bit RISC processor on the RV32I teaching subset in Verilog and take it to a five-stage pipeline — with forwarding, load bubbles and wrong-path flushes that you detect and resolve yourself.

Open in the game →Course curriculum

The main ideas of the part

  • A register file instead of an accumulator: 32 registers x0–x31, x0 is always zero; every instruction names its operands explicitly — rs1, rs2 and rd.
  • The RV32I teaching subset: 32-bit instructions and data, the R/I/S/B/U/J formats, 26 instructions. Memory is reachable only through lw/sw.
  • The control unit, forwarding unit and hazard unit are Verilog blocks you write yourself: you state the "hazard" and the "bubble" in terms of signals.
  • Five stages IF—ID—EX—MEM—WB: one instruction walks through all five while its neighbour already stands on the next one.
  • The engineering trade-off: the pipeline is measured by two metrics — CPI and the cost of the circuit (delay, gate count).

What you will have built by the end

By the end of the part you will have a pipelined RISC core: the single-cycle RV32I core sliced into five stages with forwarding, the load bubble and branch flush — and the same "Knight Rider" LED program that closed the single-cycle arc, now on the pipeline, with a ZIP export for the Tang Nano 9K.

Levels of the part

  1. 48. Farewell, Accumulator! Open in the game →
  2. 49. Anatomy of an R-type Instruction Open in the game →
  3. 50. A 32-bit ALU Open in the game →
  4. 51. A Constant Inside the Instruction Open in the game →
  5. 52. Memory by the Rules Open in the game →
  6. 53. A Step of Four Open in the game →
  7. 54. A Loop on BNE Open in the game →
  8. 55. Array Sum Open in the game →
  9. 56. Call and Return Open in the game →
  10. 57. Nested Calls and the Stack Open in the game →
  11. 58. Assembling RV32I Open in the game →
  12. 59. Knight Rider RISC Open in the game →
  13. 60. The Verification Lab Open in the game →
  14. 61. Why the Cycle Is Long Open in the game →
  15. 62. Between Stages Open in the game →
  16. 63. Five Instructions in Flight Open in the game →
  17. 64. The Short Path Open in the game →
  18. 65. The Load Bubble Open in the game →
  19. 66. Ghosts of the Wrong Path Open in the game →
  20. 67. Knight Rider Pipeline Open in the game →

Each level number leads to its library guide; "Open in the game" goes straight to the level in the simulator.

Up next: the Verilog and FPGA hub →