
TinyDSP-8 performs signed 8-bit multiplication, multiply-accumulate, and 4-tap finite impulse response filtering. Each of two iterative shift-and-add lanes reuses a 9-bit adder/subtractor across eight cycles. The negative weight of the final multiplier bit is handled by subtraction. The full 16-bit product is sign-extended and written to or added into a signed 24-bit accumulator on a separate commit cycle.
The inputs are two's-complement fixed-point codes. If a system assigns
Fa and Fb fractional bits to the operand codes, then the product and raw
accumulator have Fa + Fb fractional bits. Use a consistent scale across
a sequence of MAC commands. The output view applies an arithmetic right shift,
optional ReLU, then optional signed 8-bit clipping. The shift discards low bits
and rounds negative values toward minus infinity. It leaves the accumulator intact.
| Pins | Direction | Function |
|---|---|---|
| ui_in[7:0] | Input | Write data, bit 7 most significant |
| uio[2:0] | Input | Address, bit 0 least significant |
| uio[3] | Input | Active-high write strobe |
| uio[4] | Output | BUSY |
| uio[5] | Output | DONE |
| uio[7:6] | Unused | Leave unconnected |
| uo_out[7:0] | Output | Combinational read data |
| clk | Input | Rising-edge clock, 10 MHz design target |
| rst_n | Input | Synchronous active-low reset |
| ena | Input | Tiny Tapeout project enable. Low pauses synchronous progress. Reset still applies. |
| Address | Write while idle | Read |
|---|---|---|
| 0 | Operand A | Formatted result bits 7:0 |
| 1 | Operand B | Formatted result bits 15:8 |
| 2 | Configuration | Formatted result bits 23:16 |
| 3 | Command | Status bits 2:0 = overflow, done, busy |
| 4 | Operand C | Raw accumulator bits 7:0 |
| 5 | Operand D | Raw accumulator bits 15:8 |
| 6 | Coefficient index (bits 1:0) | Raw accumulator bits 23:16 |
| 7 | Signed coefficient at selected index | Configuration |
| Configuration bits | Meaning |
|---|---|
| 4:0 | Arithmetic right shift by 0–31, with sign fill |
| 5 | Enable ReLU |
| 6 | Saturate accumulator to signed 24-bit range on MAC overflow. Clear for wraparound. |
| 7 | Clip formatted output to signed 8-bit range and sign-extend to 24 bits |
| Code | Operation | Enabled edges until DONE after acceptance |
|---|---|---|
| 1 | Multiply A × B and replace the accumulator | 9 |
| 2 | Add A × B to the accumulator | 9 |
| 3 | Clear accumulator, DONE, and overflow | 0 |
| 4 | Replace accumulator with A × B + C × D | 10 |
| 5 | Add A × B + C × D to the accumulator | 10 |
| 6 | Accept A as the next FIR sample and replace the accumulator with the 4-tap output | 19 |
| 7 | Clear the three previous FIR samples | 0 |
| Other | Leave state unchanged | 0 |
With the project selected, hold address and data stable around a rising clock edge and assert WRITE for one edge per write. A valid compute command asserts BUSY and clears DONE and overflow on its acceptance edge. The commit edge updates the accumulator and flags. Writes are ignored while BUSY, including on the commit edge. The next command can be accepted one edge after commit. DONE and overflow on its acceptance edge. Eight enabled multiply edges follow, then one commit edge updates the accumulator and flags. The earliest next command can be accepted is ten cycles after the previous acceptance. Writes are ignored while BUSY, including on the commit edge. DONE and overflow remain latched until the next accepted compute command, clear, or reset. Read the three bytes after completion with no intervening command or configuration write. Read data settles combinationally as address changes.
Select the project, reset for a rising edge, then release reset. Write
A = 0xfd (-3), B = 0x07, and command 0x01. After BUSY clears, status
is 0x02 and the raw and formatted bytes are eb ff ff in low-to-high
order (-21). Write configuration 0x20 to enable ReLU. The formatted
bytes become 00 00 00 and the raw accumulator still reads -21. Write
command 0x02 to add another -21. The raw accumulator reads -42.
Write index 0–3 to address 6 and its signed coefficient to address 7. For each sample, write A at address 0, issue command 6, and wait for DONE before reading the result. Coefficient 0 multiplies the newest sample. The filter retains the three previous samples. Reset clears the history and coefficients. Command 7 clears history while retaining coefficients.
Both FIR passes share the multiplication lanes. The first pass computes taps 0 and 1, and the second computes taps 2 and 3. The datapath uses a 17-bit signed pair sum and an 18-bit signed four-tap sum before sign-extension to 24 bits. The accumulator output stays stable until commit.
For a signed impulse test, program coefficients (4, −3, 2, −1), clear the history with command 7, turn off output formatting, then send samples (1, 0, 0, 0, 0). The five results should be (4, −3, 2, −1, 0).
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | DATA_IN0 | DATA_OUT0 | ADDR0 |
| 1 | DATA_IN1 | DATA_OUT1 | ADDR1 |
| 2 | DATA_IN2 | DATA_OUT2 | ADDR2 |
| 3 | DATA_IN3 | DATA_OUT3 | WRITE |
| 4 | DATA_IN4 | DATA_OUT4 | BUSY |
| 5 | DATA_IN5 | DATA_OUT5 | DONE |
| 6 | DATA_IN6 | DATA_OUT6 | |
| 7 | DATA_IN7 | DATA_OUT7 |