
A complete closed-loop Push-T robot policy (the 2D pushing benchmark of the Diffusion Policy work) in a 2x2 tile. Every 10 Hz control step the host streams one camera frame (32x32 pixels, 4 bits per colour channel) and the agent position (two 8-bit codes) into the chip; the chip returns the next agent target position as two 8-bit codes. All policy computation is on the chip, all learned parameters are constants in logic, there is no frame buffer and no memory macro.
| Pin | Dir | Name | Function |
|---|---|---|---|
ui_in[7:0] |
in | D[7:0] | frame word, low byte |
uio[3:0] |
in | D[11:8] | frame word, high nibble. On the two agent words (words 0 and 1) these bits are not data: keep them 0 (0xA on word 0 is a readback command, see Bring-up readback; the word 0x5C3 as word 0 enters scan mode, see Scan chain) |
uio[4] |
in | STB | rising edge transfers one word. D must be stable from at least 1 clock cycle before the rising edge until at least 4 clock cycles after it (the chip samples D at the third clock edge after it first sees STB high); simplest: hold STB high for at least 4 clock cycles and change D only while STB is low. The first STB must come at least 4 clock cycles after SYNC falls or rst_n rises |
uio[5] |
in | SYNC | level; while high (>= 4 clock cycles) all state is cleared (protocol state and the stall-breaker's inter-frame state): episode reset and frame restart, same effect as rst_n |
uio[6] |
in | SEL | selects the action byte on uo_out while VALID: 0 = x, 1 = y (combinational multiplexer) |
uio[7] |
out | VALID | the action of the last complete frame is valid; cleared by the first word of the next frame, by SYNC and by reset; reads 0 in scan mode |
uo_out[7:0] |
out | ACT / STATUS | VALID = 1: action code selected by SEL. VALID = 0: status {ERR, BUSY, PIXEL_PHASE, ROW[4:0]}. Only while a readback view is selected (never after reset / SYNC unless a readback command is sent): the selected readback byte instead. Only in scan mode (never entered by the frame protocol): {0101110, SCAN_OUT} |
clk, rst_n |
in | one clock; rst_n is synchronised inside (hold low >= 4 clock cycles), synchronous clear |
uio_oe = 0x80 always (only uio[7] is driven by the chip); uio_out[6:0] = 0. ena and uio_in[7] are unused.
STB, SYNC and rst_n pass two-flop synchronisers, so the host needs no phase relation to clk.
| Word | Content |
|---|---|
| 0 | agent x code in D[7:0]: min(255, max(0, floor(agent_x / 2))); D[11:8] = 0 |
| 1 | agent y code in D[7:0]; D[11:8] = 0 (ignored) |
| 2 .. 1025 | pixel p = word - 2 in raster order (y = p // 32, x = p % 32, row 0 = top row of the image): D[11:8] = R, D[7:4] = G, D[3:0] = B, each the 4-bit value floor(S / 144) of the 3x3 block sum of the official 96x96 render |
Reset: hold rst_n low for at least 4 clock cycles (the demo board's reset does this) with the clock running, and
wait at least 4 clock cycles after releasing it before the first STB. After reset VALID = 0 and the status byte is 0x00.
Episode reset: pulse SYNC high for at least 4 clock cycles before the first frame of every episode, then wait at least 4 clock cycles before the first STB. It clears the stall-breaker state (small-move counter, direction counter) and the protocol state, so that every episode starts from the same chip state; the hardware reset does the same.
For a timed transfer at 10 MHz, space consecutive STB rising edges by at least 160 clock cycles. Hold STB high for at least four cycles and low for at least two. Keep the word stable from one cycle before the rising edge through four cycles after it.
uio[7]). At 10 MHz it rises 1.46 ms after the last word. If VALID has not risen
1 second after the last word, the episode has failed; if the status byte shows ERR, a word was sent too early.uo_out with SEL = 0 (x code) and SEL = 1 (y code). Apply target = 2 * code + 1 and step the simulator.After an interrupted transfer or an ERR indication, pulse SYNC or reset and send the frame again from word 0. An incomplete frame never raises VALID and does not change the stall-breaker state (it is updated only when a frame completes); the SYNC pulse itself clears that state, as an episode reset does, which only restarts the count of small-move frames and the direction sequence.
For diagnosing a chip that returns wrong actions. The design has no free pin, so the readback is in-band and uses the existing pins only; no pin changes direction. It is off after reset and after SYNC and stays off as long as D[11:8] of the agent x word is 0, as the frame format requires; then every pin behaves exactly as described above.
Entering. The word 0x5C3 (all 12 bits) enters scan mode in two places only: (a) where the agent x word is expected, i.e. the chip idle at a frame boundary (after reset / SYNC, or after VALID); (b) while the chip is BUSY, where any word is a protocol violation: this freezes a computation in progress. It is not a frame word there: nothing is counted and ERR is not set. Everywhere else 0x5C3 is an ordinary word (as agent y word its D[11:8] are ignored, as a pixel it is that colour). A host that follows the frame format (D[11:8] = 0 on the agent words, no word while BUSY) can therefore never enter scan mode.
In scan mode every register on the chain keeps its value (the chip is frozen) and the pins are:
| Pin | In scan mode |
|---|---|
uo_out[7:1] |
the constant 0101110 (so uo_out = 0x5C or 0x5D); with VALID = 0 this byte cannot be a status byte (ROW is 0 while PIXEL_PHASE is 0), so it identifies scan mode. Select readback view 0 before using it |
uo_out[0] |
SCAN_OUT: the bit at chain position 0 |
uio[7] VALID |
0 |
uio[4] STB |
rising edge with D[7] = 0: the chain shifts by one position. Rising edge with D[7] = 1: leave scan mode |
ui_in[0] D[0] |
SCAN_IN: taken at a shift strobe (same timing rule as a frame word: stable until 4 clock cycles after the STB edge) |
ui_in[7] D[7] |
0 = shift, 1 = leave, at an STB edge |
ui_in[6:1], uio[3:0], uio[6] SEL |
ignored |
uio[5] SYNC, rst_n |
as always: clear all state; they also leave scan mode |
No pin changes direction (uio_oe = 0x80 as always), so there is no new rule for the board.
Shifting. One bit per STB pulse: read SCAN_OUT, put the bit to shift in on D[0] (D[7] = 0), pulse STB (high >= 2 clock cycles, low >= 2, at least 5 clock cycles per bit; the shift happens at the third clock edge after the chip first sees STB high). After one shift, position p holds what position p + 1 held and position 555 holds SCAN_IN. 556 shifts read the whole state, position 0 first. Shifting each bit back in as it is read restores the state. To load a state, shift its 556 bits in, position 0 first.
Leaving. An STB pulse with D[7] = 1 changes nothing but the mode: from the next clock cycle the chip runs on from the state in its registers (an interrupted computation continues and ends with the same action as an uninterrupted one; a loaded state is resumed). No reset is needed. SYNC or reset instead clear everything.
None. The Tiny Tapeout demo board (RP2040, MicroPython) or any controller that can drive 15 inputs and read 9 outputs is sufficient; a PC runs the Push-T simulator.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | D[0] (frame word data); SCAN_IN in scan mode | ACT[0] while VALID, else ROW[0]; readback bit 0 while a readback view is selected; scan mode: SCAN_OUT | D[8] (input) |
| 1 | D[1] | ACT[1] while VALID, else ROW[1]; readback bit 1 while a readback view is selected; scan mode: 0 | D[9] (input) |
| 2 | D[2] | ACT[2] while VALID, else ROW[2]; readback bit 2 while a readback view is selected; scan mode: 1 | D[10] (input) |
| 3 | D[3] | ACT[3] while VALID, else ROW[3]; readback bit 3 while a readback view is selected; scan mode: 1 | D[11] (input) |
| 4 | D[4] | ACT[4] while VALID, else ROW[4]; readback bit 4 while a readback view is selected; scan mode: 1 | STB (input, word strobe; shift strobe in scan mode) |
| 5 | D[5] | ACT[5] while VALID, else PIXEL_PHASE; readback bit 5 while a readback view is selected; scan mode: 0 | SYNC (input, episode reset) |
| 6 | D[6] | ACT[6] while VALID, else BUSY; readback bit 6 while a readback view is selected; scan mode: 1 | SEL (input, 0: action x, 1: action y) |
| 7 | D[7]; in scan mode: 0 = shift, 1 = leave scan mode | ACT[7] while VALID, else ERR; readback bit 7 while a readback view is selected; scan mode: 0 | VALID (output; 0 in scan mode) |