Skip to main content

Module block_engine_rtl

Module block_engine_rtl 

Source
Expand description

block_engine_rtl — Stage 5 of the self-synthesizing bytecode XPU: the on-chip EXECUTE engine for a decoded block. Stage 4’s reconfigurable fabric runs a block’s certified SPATIAL placement (host-computed). This engine takes a block’s DECODED OPS DIRECTLY — no host placement step — and runs them on a universal reconfigurable datapath: one hardware array executes ANY bounded straight-line block by loading its op list as config. This is the unit the LGB1 decoder feeds: bytecode → ops → this engine → result, all on-chip.

Each cell i is v[i] = op_i(operand_a, operand_b) where an operand is a global input, a constant, or an earlier cell’s value v[j] (j<i) — selected by config muxes (a full-interconnect “crossbar” datapath, so there is no routing to place: the ops ARE the config). Feed-forward (v[i] reads only v[<i]) → combinational. The engine reproduces eval_fabric exactly, so it is proven ≡ the VM under iverilog by block_engine_lock.

Correct-first scope: this is the full-interconnect realization (trivial placement, larger interconnect). The AREA-OPTIMAL frontier is running these same ops through route_loop_body’s nearest-neighbour SPATIAL placement on the Stage-4 fabric with an on-chip placer — the two meet when the placement decode moves into silicon.

Structs§

BlockConfig
A decoded block transcribed into the execute engine’s config: one 32-bit control word per cell (op + the two operand sources) plus two 64-bit constant slots per cell, and result (which cell’s value is the block result).

Functions§

emit_block_engine_testbench
A self-checking testbench: drive each input vector, compare result to the VM oracle in bexec_{name}_{pin,eout}.hex (the engine loads its config from bexec_{name}_{ctrl,ac,bc,res}.hex).
emit_block_engine_verilog
Emit the universal block execute engine: a k-cell reconfigurable datapath over n_in inputs. Each cell decodes its control word into an op + two operand selects (input / constant / earlier cell) and computes combinationally; loading a decoded block’s op list runs it. Config is read once via $readmemh.
serialize_block
Transcribe a decoded block (FabricOp list + result index) into the engine’s config, padded to k cells (unused cells are inert — their value is never referenced).