05 · int8-rollout-engine · Verilog · Tang Nano 20K
Thirty-two futures, every tick.
A port of the engine's integer math, matching the Python golden model exactly on 200,000 random steps. Every 50 ms it imagines 32 plans through a 3 → 16 → 2 int8 physics model, scores each one, and applies the first action of the cheapest. Drag the pendulum to push it.
One cell per hardware lane: its total imagined cost this tick. Brighter is cheaper. Copper is the winner.
What each lane does
Every lane starts from the same measured state, quantized to int8, and steps its own plan of H actions through the learned model. One imagined step is three multiply-adds into 16 hidden units, a shift and a clamp, then 16 multiply-adds into two outputs:
The lane with the lowest total wins, ties going to the lower index exactly like the RTL's strict <. Its plan becomes next tick's warm start: shifted one step, with the other 31 candidates sampled around it.
The hardware time per decision is (32 / LANES) · (83 · H + 2) + 34 clocks, which is 1,281 for 32 lanes and 15 steps. The 8-lane board build takes 5,022 clocks, measured on a logic analyzer as 186.000 µs at 27 MHz.
In the real project, the board picks every action of 20 Pendulum-v1 episodes, and all 20 returns are identical to the golden model's. Here the physics is a JS copy of Pendulum-v1, and the planner is this page.