
This chip plays straight-drop Tetris on a 10-column, 20-row board. A host sends the board and the current tetromino. The chip measures the height of each column and tries every legal rotation and column in ascending order. A two-unit rectified neural network trained by policy search scores the landing height, newly covered gaps, change in surface roughness and resulting piece height. The best score wins. A tie goes to the first placement. The host applies the returned move and clears completed lines.
Enable the project. Hold reset low for at least one rising clock edge, then release it. Pulse ui[7] high across a rising edge to start a new packet. This also interrupts any partial packet or running decision. Send the top row first and the bottom row last. For each row, drive columns zero through seven on uio[0:7] respectively and columns eight and nine on ui[0] and ui[1]. Hold ui[6] high for one rising edge per row. Low ui[6] inserts an idle cycle. Next send the piece number on uio[2:0] with ui[6] high for one rising edge. Piece numbers zero through six select I, O, T, S, Z, J and L. Set ui low and run the clock at 10 MHz.
When uo[7] is high, read the rotation from uo[5:4] and column from uo[3:0]. The result remains valid until the next packet, reset or disable. Busy is uo[6]. The longest search takes 338 cycles, or 33.8 microseconds at 10 MHz. Reset and reload the full board at the start of each game. Piece number seven discards the packet. Tie UI5 through UI2 low for the normal input-only bus protocol. The synchronous reset also applies when the project is disabled.
Use a Tiny Tapeout digital devkit.
Set UI5 high to enable readback. UI4 through UI2 select one byte with UI2 the least significant bit. The eight UIO pins carry input rows and the piece until the final input transfer. Release the host drivers after that transfer and before requesting readback. Hardware permits output only during computation and while the action is valid. For stable results stop with action valid, release UIO, set enable and select, clock three rising edges, then sample. Each new selector requires three clocks. Clear enable and clock three times before driving UIO again. Reset, deselection and a new-frame edge also release the registered output enable. Leave the bus released during that edge.
| Select | UIO7 through UIO0 |
|---|---|
| 0 | Constant 0x6D |
| 1 | Four-bit state, two-bit rotation, two-bit horizontal offset |
| 2 | Three-bit piece, four-bit candidate column, zero |
| 3 | Best score bits 7 through 0 |
| 4 | Best score bits 15 through 8 |
| 5 | Most recently evaluated placement score bits 7 through 0 |
| 6 | Most recently evaluated placement score bits 15 through 8 |
| 7 | Best sign bit, last score sign bit, six-bit encoded action |
The signed scores use 17-bit two's complement. In the valid state the last score belongs to the final legal placement in rotation and column order. Earlier views during computation sample the registers just before the rising edge. The state codes in order from 0 to 10 are IDLE, LOAD, PIECE, INIT, LAND, SURFACE, RIGHT_EDGE, HIDDEN, OUTPUT_LAYER, COMPARE and VALID. Score fields are meaningful once their corresponding stage has run.
Use the project clock as the timing reference for UI, host-driven UIO and project enable. Change data and commands while the clock is low, preferably on the falling edge. Keep them stable across the next rising edge. Release reset while the clock is low and stable before resuming transfers. The bit stream is a synchronous protocol. Crossing from an unrelated host clock requires a handshake outside this interface.
The revised input constraints use 20 ns maximum delay and 0 ns minimum delay relative to the rising edge. The former assumption of 20 ns minimum hid external hold and reset-removal requirements.
The integer policy scored 588.29 mean lines over 100 development games. The 50 organizer-only games specified by the task brief are excluded from development.
With project enable high, send 0x2E and 0x35 on UI on the first two rising clock edges after reset release. Release all eight host UIO drivers before shifting.
Stop the clock low at the state you want to inspect. Drive 0x16 on UI and sample UO7. Set UI0 to the incoming bit, then pulse the clock once. Repeat for all 189 bits. Feed each sampled bit back into UI0 to restore the captured state, or supply a saved bit stream to load it. Reset before starting a fresh application workload.
Across nine extracted RC and library corners, the smallest input hold or reset-removal slack is 0.292 ns at the macro pins with a 0 ns minimum input delay. This margin applies at the macro boundary and does not include board or shuttle timing.
| # | Input | Output | Bidirectional |
|---|---|---|---|
| 0 | Board column 8 / scan data in | Column bit 0 | Board column 0 / piece bit 0 / readback bit 0 |
| 1 | Board column 9 | Column bit 1 | Board column 1 / piece bit 1 / readback bit 1 |
| 2 | Readback select bit 0 | Column bit 2 | Board column 2 / piece bit 2 / readback bit 2 |
| 3 | Readback select bit 1 | Column bit 3 | Board column 3 / readback bit 3 |
| 4 | Readback select bit 2 | Rotation bit 0 | Board column 4 / readback bit 4 |
| 5 | Readback enable | Rotation bit 1 | Board column 5 / readback bit 5 |
| 6 | Word valid | Busy | Board column 6 / readback bit 6 |
| 7 | New frame | Action valid / scan data out | Board column 7 / readback bit 7 |