
This design computes C = A × B for two 4×4 matrices containing signed INT4 values. Four reusable signed INT4 processing elements are used rather than sixteen simultaneously instantiated PEs. Matrix B is loaded and stored in row-major order. One row of matrix A is then loaded at a time. For each output column c, the four-PE chain computes:
C[r][c] = A[r][0]*B[0][c] + A[r][1]*B[1][c] + A[r][2]*B[2][c] + A[r][3]*B[3][c].
The controller reuses the same four PEs to compute the four columns of the current row, then the next row. This is a resource-shared matrix-multiplication accelerator, not a fully parallel 16-PE array or a complete CNN convolution pipeline. Signed 10-bit accumulation/output is used because (-8) * (-8) * 4 = +256, which exceeds the maximum signed 9-bit value (+255).
Commands are provided on uio_in[1:0]: 00 = IDLE, 01 = LOAD, 10 = START, and 11 = READ. Each command should be followed by an IDLE cycle. INT4 two's-complement data is provided on ui_in[3:0]; the upper four input bits are unused. uio_out[2] reports busy and uio_out[3] reports that one result element is ready. uio_oe[3:2] enables those two status outputs.
A[r], from A[r][0] through A[r][3], with four LOAD commands.uio_out[3] to indicate that the next result element is ready.The result-valid status is per element, not a single flag held until all 32 bytes have been read. Each result is sign-extended to 16 bits for the byte-wise interface.
For physical operation, use a compatible Tiny Tapeout demo board or an external controller capable of providing the Tiny Tapeout clock, reset, enable, input, and command signals and sampling the output/status pins. Follow the electrical and board-specific requirements of the selected Tiny Tapeout platform.
The Cocotb tests in test/test.py use a Python reference model for 4×4 matrix multiplication and cover signed INT4 arithmetic, result-byte ordering, completion when ena is low, status signals, reset recovery, repeated transactions, and randomized matrix pairs. Run the test suite against the current RTL revision before tapeout.
The physical-design metrics previously recorded in the main README belong to an earlier RTL revision and are not results for the current matrix-multiplication RTL. Re-run the GDS and gate-level flow and update the metrics from the new reports. The earlier snapshot reported one root clock-buffer max-fanout warning. RUN_KLAYOUT_DRC is configured as 0, so KLayout DRC should not be described as passed unless it is run separately. EDA flow results are not measurements from fabricated silicon.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | INT4 input bit 0 | Result byte bit 0 | Command bit 0 |
| 1 | INT4 input bit 1 | Result byte bit 1 | Command bit 1 |
| 2 | INT4 input bit 2 | Result byte bit 2 | Busy status output |
| 3 | INT4 input bit 3 | Result byte bit 3 | Current matrix element result-valid status |
| 4 | Unused | Result byte bit 4 | Unused |
| 5 | Unused | Result byte bit 5 | Unused |
| 6 | Unused | Result byte bit 6 | Unused |
| 7 | Unused | Result byte bit 7 | Unused |