Skip to content

fpga-synthesis has never once passed: the SIMULATION guard is inverted, and %%0d is emitted literally #2153

Closed

Description

@gHashTag

Every run of fpga-build.yml has failed since the workflow was added on 2026-05-30: 600 runs, 598 failure, 2 cancelled, 0 success, and 184 of 184 on master. The failing job is fpga-synthesis, the failing step is FPGA synthesis (Yosys + JSON netlist), and the log line is the same one every time:

/home/runner/work/t27/t27/build/fpga/generated/mac.v:535: ERROR: Failed to evaluate system task `$display' with non-constant argument at position 2.
##[error]Process completed with exit code 1.

This is a generator defect, not an environment problem. Two independent bugs produce it.

1. The SIMULATION guard is inverted for the synthesis path

bootstrap/src/compiler.rs lines 7276, 7330 and 7352 wrap benchmark blocks in:

`ifndef SIMULATION

ifndef includes the block when the macro is not defined. The only place in the tree that defines it is bootstrap/src/suite.rs:859:

read_verilog -sv -DSIMULATION

The synthesis path does not. bootstrap/src/main.rs:4937 and :4962 emit a bare read_verilog {files}. So benchmark code — including $display with a runtime argument, which Yosys cannot evaluate — is fed to the synthesiser on every single synthesis run, and excluded from the one flow that could tolerate it.

Scale: 121 `ifndef SIMULATION occurrences and zero `ifdef occurrences across the generated tree; 31 generated .v files contain $display. mac.v:535 is not special, it is just the first file Yosys reaches.

Either the guard should be `ifdef SIMULATION, or the synthesis path should define the macro. The two must agree; today they are opposites.

2. %%0d is written to the file literally

compiler.rs:7376:

$display("[BENCH] {} : %%0d cycles", var)

The line is built with format!, where the only escape is {{/}} — %% is not an escape and passes through verbatim. The generated file contains %%0d 8 times in mac.v and %0d 0 times. In Verilog %% prints a literal %, so the argument is never consumed by a conversion specifier, which is exactly the shape of thing Yosys objects to.

Verification, not by CI

bootstrap/build.rs compares the SHA-256 of compiler.rs against bootstrap/stage0/FROZEN_HASH, so a fix must re-freeze (./scripts/tri freeze). A fix must also be shown not to move any generated file it does not intend to move — ./scripts/tri diffbin over the corpus, zero regressions as the condition.

yosys is not installable via apt in the sandbox (Unable to locate package yosys); yowasp-yosys from pip is the workaround for reproducing locally.

A separate observation on the gate

t27c synth-readiness reports NOT READY with Parse 31/36 and exits with code 0. A gate that never fails does not gate. Five specs are behind that count and belong to a parser issue, not this one:

  • specs/fpga/boards/arty_a7_integration.t27, specs/fpga/boards/qmtech_a100t_integration.t27, specs/fpga/verification/build_verify.t27 — Unexpected token in expression: KwInvariant
  • specs/fpga/vcd_conformance_compare.t27, specs/fpga/power_analysis.t27 — unexpected token after expression statement: Ident

What this is not

Nothing here is measured on hardware. This is a text-generation defect found by reading the generator and the CI log. No claim is made about the netlist that would result once it is fixed, and no claim is made about silicon.

Found while diagnosing the red checks on #2151, where the same failure was shown to reproduce byte-identically on the base commit.

Activity

  1. gHashTag commented on Aug 21, 2026

    @gHashTag
    CollaboratorAuthor

    Both named defects are fixed on origin/master, and the job in the title now passes there. Closing on that evidence.

    1. The inverted SIMULATION guard — fixed by e3e3a7171e6527781467e6c09c6399001be214de

    "fpga-build's yosys loop could never have passed as written — 1/32 → 32/32 (#2216)", 2026-08-19T13:02:59Z. Verified an ancestor of master (compare/e3e3a7171e65...master returns behind_by: 0). It took the second of the two options this issue offered — the synthesis path now defines the macro rather than the guard being flipped. Both synthesis invocations in bootstrap/src/main.rs (now :7020 and :7049, formerly :4937 / :4962) read:

    read_verilog -sv -DSIMULATION {files}
    hierarchy -check -top {top}
    

    The commit's own diff comment states the intent: *"-DSIMULATION: strips ifndef"*. The guards themselves are unchanged and still `` ifndef SIMULATION `` — which is now correct, because the two sides finally agree.

    2. %%0d emitted literally — fixed on master

    bootstrap/src/compiler.rs:12163 now emits:

    "$display(\"[BENCH] {} : %0d cycles\", {});",

    with the reasoning recorded above it at :12155-12161 as W646 / T57.

    3. The job passes

    fpga-synthesis concluded success on the five most recent fpga-build.yml runs on master, newest first:

    run head fpga-synthesis
    32464326319 bba06449f success
    32461331260 10e3d5e71 success
    32459394039 b168dbbf6 success
    32458240860 f5be7dc1c success
    32370578621 efdddbacb success

    fpga-synthesis-arty and fpga-lint are green in the same runs. The mac.v:535 $display error quoted in this issue no longer appears.

    One thing this close does not claim. fpga-build.yml as a whole is still red on master. In run 32464326319 the failing job is fpga-conformance, at step Compile conformance testbenches (iverilog) — a different job with a different cause, tracked by #2241, #2275 and #2326. This issue's subject, fpga-synthesis, is green.

    Also noting for whoever reads it next: PR #2161's body still says "fpga-formal / fpga-synthesis red is the master baseline (#2153)". Both of those jobs are green on master as of the runs above, so that baseline note is stale.

    Triage pass, 2026-08-21. Verified against origin/master @ fead099c213563ca214a85a37956c5cf6f514516 and the GitHub commits API — not against a local checkout.

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