Retrospective: From Gates to AI

Rodolfo Azevedo

Institute of Computing, University of Campinas (UNICAMP), Brazil

rodolfo.azevedo@unicamp.br

http://www.ic.unicamp.br/~rodolfo/mo801

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

Goal of this class

Module 6, Class 4: the full stack in one picture, where to go next, and course feedback.

Every component in the system you built today was described in the first three weeks of the course. Today we draw the line from the first logic gate to the last inference result.

At the end of this class, you should be able to:

  • Trace the complete abstraction stack from Boolean logic gates to a working AI inference result.
  • Identify the key hardware/software design decisions made at each module of the course and their performance consequences.
  • Explain how each layer's latency contribution adds up to the total inference time measured in Project 3.
  • Describe concrete next steps in computer architecture, ML hardware, or embedded systems based on your interests.
MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

The full abstraction stack

Boolean logic (M01A01)
    AND, OR, NOT, XOR → truth tables → Boolean algebra
    │
    ▼
Combinational circuits (M01A01-A02)
    MUX, decoder, comparator → `assign`, `always_comb`
    │
    ▼
Sequential circuits (M01A03-A04)
    DFF → register → counter → FSM → `always_ff`, `enum`
    │
    ▼
Digital building blocks (M01A05)
    ALU, register file, SRAM → `parameter`, `generate`
    │
    ▼
RV32I processor (M02)
    ISA → multicycle datapath → control FSM → `ebreak` → simulation
    │
    ▼
HW/SW interface (M03)
    Bus → Zmmul → Zicsr/Zicntr → CMAC → UART → timer → GPIO → C drivers
    │
    ▼
TinyML inference (M04)
    tiny_conv → int8 quantization → C kernel → profiling → roofline
    │
    ▼
Hardware accelerator (M05)
    MAC array → BRAM buffer → FSM → bus integration → speedup measurement
    │
    ▼
KWS inference on Tang Nano 9K
    "yes" / "no" / "_unknown_" / "_silence_"

Every layer was built by you, from scratch. None of them were black boxes.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

What Nand2Tetris spirit looks like for AI

Nand2Tetris takes you from a NAND gate to Tetris. This course takes you from an AND gate to AI inference.

Nand2Tetris This course
NAND gates Logic gates (M01A01)
HDL (like MyHDL) SystemVerilog (M01)
Hack CPU RV32I multicycle (M02)
Assembly language RV32I ISA + ABI
VM / compiler C → RV32I toolchain
OS / memory Memory-mapped bus (M03)
Applications (Tetris) KWS inference (M04-05)
Hardware accelerator (M05)
FPGA (Nand2Tetris uses emulator) Tang Nano 9K (real hardware)

The key difference: this course's "application" is a machine learning model — which means understanding not just the compute, but the data representation (int8 quantization), the memory hierarchy (BRAM vs. DMEM vs. bus), and the performance model (roofline).

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

What you now understand that documentation alone cannot teach

  1. Why RISC-V has 6 instruction formats — you implemented the immediate extraction logic for each.
  2. Why memory-mapped I/O needs volatile — you saw what the compiler does without it.
  3. Why the bottleneck is memory, not compute — you measured it, not just read about it.
  4. Why Amdahl's Law limits system speedup — you lived it: 7.2× layer, 3.5× system.
  5. Why the BRAM buffer mattered more than the extra MACs — you placed both on the roofline.
  6. Why TinyML uses int8, not float32 — you implemented the requantization arithmetic.

These are not things you can fully understand without building. The course existed to create the experience of building.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

Limitations of what we built

Honest accounting of what a production system does that ours does not:

Gap Production solution Course equivalent
MFCC extraction DSP library on MCU Pre-computed test vectors
Only 4 KB program memory External flash + bootloader 4 KB BRAM
No interrupt support NVIC, CSR trap handler ebreak + polling
Single model, fixed weights TFLite Micro interpreter Hard-coded kernel
No power management Clock gating, sleep modes Always-on
Only PW conv accelerated Full graph NPU One layer type

None of these gaps are conceptual — they are engineering. You have the foundation to close any of them.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

Research directions from here

Hardware/software co-design: model architecture search that explicitly optimizes for your hardware constraints — fewer channels, fewer layers, compatible with a 4-wide MAC array.

In-memory computing: instead of moving weights from SRAM to MAC units, perform the multiplication inside the memory cell (analog or digital). Eliminates the memory bottleneck entirely. Active research area.

Dataflow compilation (TVM, MLIR/CIRCT): compilers that take a model graph and generate both the software schedule and the hardware configuration automatically. What Vela does for Ethos-U.

Neuromorphic computing: spiking neural networks (SNNs) — binary activations, event-driven computation, ultra-low power. Very different trade-off point from the int8 MAC-array world.

Open-source silicon (OpenROAD, efabless): take your accelerator design all the way to a real chip. The GW1NR-9C costs $3 per unit; your chip could cost $0.10 in volume if you tape it out in the Skywater 130nm open PDK.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

The open-source ecosystem

Everything used in this course is free and open:

Tool License What it does
OSS CAD Suite Various open Yosys, nextpnr, Verilator, GTKWave
Gowin EDA Proprietary (free tier) Place & route for GW1NR-9C
RISC-V GNU toolchain GPLv3 C cross-compiler for RV32I
TensorFlow Lite Apache 2.0 Model training + quantization
Chisel Apache 2.0 Next-level HDL (generates SV)
OpenROAD BSD ASIC synthesis + P&R
OpenLane2 Apache 2.0 RTL-to-GDS pipeline

You can keep going after this course without spending money on tools.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

Course feedback

(Anonymous — please be specific)

  1. Which module was most valuable? Which was least?
  2. What was the biggest obstacle you encountered?
  3. What would you add, remove, or restructure?
  4. Did the Tang Nano 9K board exercises help? Too many? Too few?
  5. Was the difficulty level appropriate?

Your feedback directly shapes the next offering of this course.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0

Thank you

You built a processor from logic gates, extended it with hardware peripherals, ran a machine learning model on it, and designed custom silicon to accelerate it — all in one semester, on a $20 FPGA board.

That is the course. You now know what is inside the devices that surround you every day.

MO801/MC972 · Topics in Computer Architecture and Hardware · Rodolfo Azevedo · CC BY-SA 4.0