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.

9 min read • View on GitHub • More from Dhyanam206

A wide editorial scene shows a small RISC-V controller desk on the left sending a job card across a narrow bridge into an 8x8 grid of processing cells on the right. The image explains that Tiny-TPU is not just compute hardware. It is a control path, a datapath, and a software handoff working together.
Tiny-TPU makes the accelerator stack legible by showing how a CPU launches matrix work into a fixed systolic array.
Key Takeaways

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 key abstraction is delegation. The CPU launches a job, the bridge decodes it, and the array does the math.

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.

A close-up editorial scene shows one matrix tile moving through three stations: a firmware clipboard stacked with 8x8 tiles, an MMIO register panel, and a tiny systolic array tray. The image explains why tiling exists and how fixed hardware can still handle larger matrices.
Tiling is the software layer that makes a fixed 8x8 accelerator useful for larger problems.

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.

ProjectScopeControl modelComplexityEducational value
Tiny-TPUFull stack mini TPUMMIO command queueLow to mediumVery high
GemminiResearch-grade accelerator generatorRISC-V ecosystem integrationHighHigh
NVDLAIndustrial deep learning acceleratorLarge hardware/software stackVery highMedium
VTACompiler-centered accelerator stackTVM-driven workflowHighHigh
Simple-TPUSystolic array focusedSimpler control pathLowHigh

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.