
The TinyNPU 3x3 is an explainable, purely combinational hardware Neural Processing Unit designed for educational purposes. It classifies 3x3 binary pixel grids into four categories: Horizontal lines, Vertical lines, and two Diagonals.
Instead of storing synaptic weights in volatile memory, the weights (+1 for target pixels, -1 for background noise) are physically hardwired directly into the silicon using spatial Adder Trees. This architecture allows the NPU to compute the MAC (Multiply-Accumulate) operations instantaneously without requiring a clock signal.
A hardware Max Pooling layer (a tree of signed comparators) evaluates the results to select the highest score. If the maximum score meets the internal activation threshold (set to 2) and there are no ties, the NPU validates the shape.
To make the AI's "thought process" transparent, the 8-bit output bus is split into two telemetry data points:
ui_in[7:0] and the 9th pixel on uio_in[0].uo_out[7:0] after the gate propagation delay (~2.5ns).val & 0x07) to get the detected shape ID:
0 = Unknown / Noise (Threshold not met or tie)1 = Horizontal Line (-)2 = Vertical Line (|)3 = Diagonal 1 ()4 = Diagonal 2 (/)val >> 3). This reveals the internal MAC score, demonstrating the network's confidence level before the final classification.To fully exploit the educational aspect of this chip, the following external hardware is recommended:
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | Pixel 0 | Prediction ID [Bit 0 / LSB] | Pixel 8 (Le 9ème pixel de la matrice) |
| 1 | Pixel 1 | Prediction ID [Bit 1] | |
| 2 | Pixel 2 | Prediction ID [Bit 2 / MSB] | |
| 3 | Pixel 3 | Max MAC Score [Bit 0 / LSB] | |
| 4 | Pixel 4 | Max MAC Score [Bit 1] | |
| 5 | Pixel 5 | Max MAC Score [Bit 2] | |
| 6 | Pixel 6 | Max MAC Score [Bit 3] | |
| 7 | Pixel 7 | Max MAC Score [Bit 4 / Signe] |