Tiny-TPU SoC: The Smallest Useful Way to Understand an AI Chip
A RISC-V controller, an 8x8 systolic array, and an MMIO command queue turn matrix multiplication into something you can actually follow from Python to FPGA.
- Tiny-TPU is valuable because it turns accelerator design into a visible contract between CPU control and array compute.
- The MMIO bridge is the real teaching device here, because it shows how a normal program launches hardware work without micromanaging MAC operations.
- The 8x8 systolic array matters less as a speed trick than as a clean, reusable datapath that software can tile around.
- The repo's full stack, from Python export to firmware to RTL and testbenches, makes the learning loop complete.
Tiny-TPU is not trying to win a benchmark race. It is trying to make an AI chip legible. That is the more interesting problem for anyone who wants to understand how matrix math turns into a hardware job.
Google's TPU is a black box, so I decided to build my own.
Why Tiny-TPU matters
Most accelerator projects teach you the datapath and leave the orchestration fuzzy. Tiny-TPU does the opposite. It makes the control path visible first, so the array feels like the natural consequence of a software decision.
That matters because real AI hardware is rarely just a sea of multipliers. It is a coordination system: a CPU, an address map, a queue, a tile size, and a done bit. Tiny-TPU compresses that system into something you can reason about in one sitting.
The whole chip is a contract between CPU and TPU
The MMIO bridge is the heart of the system. A C program writes opcode, dimensions, input pointers, and an output pointer into mapped registers, then waits for completion. That simple write is enough to turn software into accelerator work.
This is the part people miss when they talk about AI chips. The important question is not just how fast the MACs run. It is how the system decides what those MACs should do, when, and with which slice of memory.
Tiny-TPU is not about competing with Google’s state-of-the-art chips; it’s about learning the fundamental principles of hardware acceleration for deep learning.
Inside the 8x8 systolic array
Once the job lands, the datapath becomes familiar. `pe.v` implements the multiply-accumulate behavior, and `sysArr.v` stitches those processing elements into an 8x8 mesh. Inputs move across the rows, partial sums move down the columns, and the whole grid advances in lockstep.
// Conceptual shape of the datapath
for (genvar i = 0; i < 8; i++) begin
for (genvar j = 0; j < 8; j++) begin
pe u_pe (
.clk(clk),
.a(data_row[i]),
.b(weight_col[j]),
.psum_in(psum[i][j]),
.psum_out(psum_next[i][j])
);
end
end
The elegance here is not complexity. It is regularity. Every cell behaves the same way, which makes the array easy to verify, easy to tile, and easy to explain. That is rare in hardware projects, and it is why this repo works as an explainer.
Why tiling is the real software layer
The array is fixed at 8x8, but the world is not. The tiling code in `mem_generator/` solves that mismatch by breaking larger matrices into chunks, feeding them through the accelerator, and stitching the results back together.
That makes the project feel like a complete system instead of a single RTL demo. Hardware provides the compute primitive. Software provides the reach.
| Project | Scope | Control model | Complexity | Educational value |
|---|---|---|---|---|
| Tiny-TPU | Full stack mini TPU | MMIO command queue | Low to medium | Very high |
| Gemmini | Research-grade accelerator generator | RISC-V ecosystem integration | High | High |
| NVDLA | Industrial deep learning accelerator | Large hardware/software stack | Very high | Medium |
| VTA | Compiler-centered accelerator stack | TVM-driven workflow | High | High |
| Simple-TPU | Systolic array focused | Simpler control path | Low | High |
Compared with Gemmini, NVDLA, or VTA, Tiny-TPU gives up ambition and gains clarity. You do not need to wade through a sprawling ecosystem to understand what a matrix accelerator is doing. You can see the whole thing.
The FPGA trick: infer the DSPs, don’t fight them
The repo also shows good hardware instinct. Instead of forcing the toolchain with hand-instantiated blocks everywhere, the design is arranged so Vivado can infer DSP48E1 slices where it makes sense. That is the kind of decision that quietly turns a teaching project into a real FPGA design.
// Hardware intent over primitive micromanagement
always @(posedge clk) begin
if (en) begin
acc <= acc + (a * b);
end
end
That tiny pattern is the whole idea. Write the arithmetic so the tool understands your intent, then let synthesis map it onto the silicon efficiently.
From MNIST export to live inference
The learning loop is what makes the repo stick. Python scripts export trained weights, firmware packages them for the accelerator, the RTL runs the job, and UART output confirms the result. It is a full path from model training to hardware inference.
The heart of Tiny-TPU is the Systolic Array. This is where all the heavy lifting (matrix multiplication) happens.
That loop matters more than raw throughput. It gives the reader a place to stand. You can change the weights, rerun the flow, and see the design as a sequence of ordinary engineering steps rather than a magical black box.
How it compares
Tiny-TPU occupies a narrow but useful niche. It is simpler than serious open-source accelerator frameworks, but more complete than a bare systolic array demo. That makes it unusually good for learning the handoff between software and hardware.
If Gemmini is a graduate seminar and NVDLA is an industrial codebase, Tiny-TPU is the whiteboard version that still behaves like a real system. It is not the end of the road. It is the cleanest on-ramp.
What Tiny-TPU teaches
The big lesson is that accelerator design is a coordination problem as much as a math problem. The clever part is not the multiply itself. It is making the CPU, the bridge, the tiles, and the array agree on a small, reliable contract.
That is why Tiny-TPU is worth reading even if you never plan to build a TPU. It shows the shape of the full stack without burying it under infrastructure.