Skip to content

gap: .t27 has no clocked/sequential construct — spec-first datapath is combinational-only (blocks Phase 2) #1764

Description

@gHashTag

The spec-first .t27 compute path lowers to combinational Verilog only. This blocks a real streaming accelerator (Phase 2 of the BitNet roadmap): weights-from-BRAM, activation streaming, per-cycle accumulation all need clocked state.

Evidence

  • gen-verilog specs/fpga/uart.t27 emits 0 always @(posedge clk) blocks.
  • A module-level var count : u8 becomes a reg, but its update lives inside a combinational function (count = count + 1; in fn tick), never in a clocked process — so the state is never actually registered/advanced by a clock.
  • debug-hir on any spec shows always_blocks: [] and ternary_cores: []. The HIR emitter has emit_always_block (compiler.rs:17968) and emit_ternary_core, and clocked always-blocks are constructed in unit tests (compiler.rs:19729), but the AST→HIR lowering never populates them from source.

Two paths forward for Phase 2

  1. Compiler feature: add a clocked-process / sequential-block construct to the .t27 grammar (e.g. on posedge(clk) { ... } or a registered-var semantics) and wire the AST→HIR lowering to populate always_blocks (the emitter already exists). Then a streaming ternary accumulator can be spec-first.
  2. Hand-written engine: the clocked datapath already exists in the hand-written SV emitters (pipeline_stage2_compute, etc.), and the spec-first dot27 is bit-exact equal to the hand-written trit27_dot_product (feat(ternary): spec-first ternary MAC dot product (.t27), bit-exact vs handwritten #1743). So Phase 2 could instead complete the hand-written bitnet_engine_top (fix input≡weight aliasing + write-back + quantizer wiring; test: bitnet_top asserts stale contract (busy + mem tie-off) vs current gen-bitnet-engine-top #1726) using the proven-equivalent compute.

This is the crux of the on-hardware MVP path; recording it so the choice is deliberate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions