
This chip runs one layer of a convolutional neural network: a 3x3 convolution of an 8x8 image with 4 filters at once, streaming the image in one pixel at a time.
wgt[tap*4 + filter] with tap = row*3 + col.Inside:
All control inputs pass through 2-flop synchronisers, so the host can be a slow microcontroller (such as the demo board's RP2040) on its own clock.
Designed by CNNAccelTeam9: Nitya Shah, Kush Shah, Kiran Karthik and Toprak Celikel.
This project started in the Basics of ASICs (bASICs) course at the MIT Beaver Works Summer Institute (BWSI) (https://bwsi.mit.edu/bwsi-programs-2/basics-of-asics/). Thank you to the BWSI instructors and staff for teaching us the RTL-to-GDS flow, and to the Tiny Tapeout team for making it possible to put the design on real silicon.
| Pin | Name | Dir | Meaning |
|---|---|---|---|
| ui[7:0] | DATA | in | byte to write (weight or pixel) |
| uio[0] | WR | in | rising edge: write DATA |
| uio[1] | SEL | in | 1 = weights, 0 = image. Any change restarts the byte count |
| uio[2] | START | in | rising edge: start a new image (keeps the weights, clears DONE) |
| uio[3] | RD | in | rising edge: current result byte read, show the next one |
| uio[5] | BUSY | out | wait: not ready for the next write |
| uio[6] | DONE | out | the last result of the image has been read |
| uio[7] | RVALID | out | RESULT holds a valid byte |
| uo[7:0] | RESULT | out | current result byte (0 when RVALID is low) |
Hold every strobe high and low for at least 2 clocks each, and keep DATA steady while WR is high.
rst_n low, then high) with all inputs at 0.tap0 f0, tap0 f1, tap0 f2, tap0 f3, tap1 f0, .... For each byte: put it
on DATA, pulse WR, wait until BUSY = 0.For another image with the same weights, pulse START and go to step 3. After a reset, load the weights again. Extra bytes (more than 36 weights or 64 pixels) and writes while BUSY are ignored.
In Python-like pseudocode:
def write(b):
DATA = b; pulse(WR)
while BUSY:
if RVALID:
for i in range(12):
results.append(RESULT); pulse(RD)
SEL = 1; [write(w) for w in weights]
SEL = 0; [write(p) for p in pixels]
The cocotb testbench in test/ checks every result against a Python model
(test/cnn_model.py), on the RTL and on the gate-level netlist.
None. Everything can be driven from the Tiny Tapeout demo board's microcontroller.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | DATA[0] | RESULT[0] | WR (in) |
| 1 | DATA[1] | RESULT[1] | SEL (in) |
| 2 | DATA[2] | RESULT[2] | START (in) |
| 3 | DATA[3] | RESULT[3] | RD (in) |
| 4 | DATA[4] | RESULT[4] | |
| 5 | DATA[5] | RESULT[5] | BUSY (out) |
| 6 | DATA[6] | RESULT[6] | DONE (out) |
| 7 | DATA[7] | RESULT[7] | RVALID (out) |