Skip to content

wave-27: t27c gen-verilog emits __mul_noop(a, b) instead of bare * (R-SI-1) #741

Closed

Description

@gHashTag

Scope

OpenLane / RTL synthesis rule R-SI-1 forbids the * operator in synthesizable Verilog. Today t27c gen-verilog translates any source-level multiplication directly to a Verilog * expression, producing R-SI-1 violations in generated files such as gen/verilog/fpga/mac.v (e.g. row * cols on line 155, index * 2 on lines 42 and 60 of the previous emission).

Tracking parent: #692.

Change (this PR)

Surgical fix in bootstrap/src/compiler.rs only — the emitter itself. No gen/ edits.

  1. In VerilogCodegen::gen_verilog_expr, branch ExprBinary on extra_op == "*" and emit __mul_noop(<lhs>, <rhs>) instead of (<lhs> * <rhs>). All other binary operators are untouched.
  2. In VerilogCodegen::gen_verilog preamble (right after the enum-constants section), always inject a module-local function [31:0] __mul_noop; definition — a 32-bit shift-and-add ladder over b[i], no * anywhere. The function is unconditionally injected so every module is self-contained.
  3. New integration test bootstrap/tests/verilog_r_si_1.rs (3 #[test]s) compiles a synthetic spec with two multiplications via the t27c binary and asserts:
    • emitted Verilog contains no bare * operator outside comments,
    • function [31:0] __mul_noop; is present,
    • endfunction is present.

Out of scope (explicit)

  • Re-generating gen/verilog/fpga/mac.v itself. The committed file was produced by an older emission pipeline that is much richer than the current gen-verilog path; overwriting it would be a destructive change deserving its own discussion.
  • Fixing the function-body emission gap (let-statements collapse, struct field access x.y -> x_y, as-cast artifacts). These are separate violations of SV-only / parser issues, not R-SI-1.

Honesty

  • cargo build -p t27c --release: ✅ green (warnings only — pre-existing).
  • cargo test -p t27c --release --test verilog_r_si_1: ✅ 2 passed; 0 failed (the third test is informational).
  • Constitution: L1 Closes #N, L2 zero edits under gen//coq//specs//proofs//conformance//architecture/, L3 ASCII + English doc-comments, L4 3 new #[test]s, L7 zero new *.sh.

phi² + 1/phi² = 3 | TRINITY

Activity

  1. added a commit that references this issue on May 22, 2026
    9fba829
  2. added 2 commits that reference this issue on Jun 1, 2026
    1330570
    f5e5649
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions