Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions bootstrap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6821,25 +6821,37 @@ fn run_fpga_build(
let synth_dir = build_dir.join("synth");
fs::create_dir_all(&synth_dir).context("create build/fpga/synth")?;

let modules = [
"mac", "uart", "spi", "bridge", "top_level",
"hir", "hw_types", "memory", "clock_domain", "fifo",
"axi4", "apb_bridge", "gf16_accel", "formal",
"ternary_isa", "stdlib", "simulator", "assembler", "testbench", "vcd_trace",
"e2e_demo", "linker", "timing", "power", "placement", "partition",
"router", "dft", "cts", "crossopt", "bootrom",
"sv_emit", "firrtl", "cdc", "lint", "coverage",
];
// T75: the set is the DIRECTORY, not a literal. It used to be a hardcoded
// array of 36 names, and it had drifted in both directions: five names had
// no spec and printed `SKIP (spec not found)` without failing, while four
// specs sat in specs/fpga/ and were never generated at all -- bpsk (the
// merged BPSK modem core), power_analysis, ternary_link and
// vcd_conformance_compare. Measured with this same t27c and the
// elaboration ratchet's own iverilog invocation, those four carry 14 real
// errors the ratchet had never counted, and nothing bounded their growth.
//
// Reading the directory makes "the fpga module set" mean what it says, and
// a spec added tomorrow is covered without anyone remembering this list.
let mut modules: Vec<String> = fs::read_dir(&specs_dir)
.with_context(|| format!("read {}", specs_dir.display()))?
.filter_map(|e| e.ok())
.filter(|e| e.path().extension().and_then(|x| x.to_str()) == Some("t27"))
.filter_map(|e| e.path().file_stem().and_then(|s| s.to_str()).map(String::from))
.collect();
modules.sort();
if modules.is_empty() {
anyhow::bail!(
"no .t27 spec found under {} -- the scan is broken, not the tree",
specs_dir.display()
);
}

println!("=== FPGA Build: Verilog generation{}===", if use_hir { " (HIR path) " } else { " " });
println!(" {} spec(s) under {}", modules.len(), specs_dir.display());
let mut generated_count = 0u32;
for module in &modules {
let spec_file = specs_dir.join(format!("{}.t27", module));
let out_file = gen_dir.join(format!("{}.v", module));
if !spec_file.exists() {
println!(" SKIP {} (spec not found)", module);
continue;
}
let gen_cmd = if use_hir { "gen-verilog-hir" } else { "gen-verilog" };
let status = std::process::Command::new(&t27c)
.arg(gen_cmd)
Expand Down
24 changes: 24 additions & 0 deletions docs/now/2026-08-23-the-module-set-is-a-directory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# NOW -- "the 32-module fpga set" was a literal, and it had drifted both ways (2026-08-23)

Refs #2325.

- `fpga-build` iterated a hardcoded 36-name array in `bootstrap/src/main.rs`,
not `specs/fpga/`. Measured drift in BOTH directions:
- **5 names have no spec** -- `sv_emit`, `firrtl`, `cdc`, `lint`, `coverage`
-- and printed `SKIP (spec not found)` while the command exited 0.
- **4 specs were never generated at all**: `bpsk` (the merged BPSK modem
core), `power_analysis`, `ternary_link`, `vcd_conformance_compare`.
- Generating those four with this same `t27c` and the ratchet's own iverilog
invocation: **14 errors nothing counted and nothing bounded** --
`vcd_conformance_compare` 13, `power_analysis` 1, the other two clean.
- The set is now the directory. `SKIP` disappears because there is nothing to
skip, and an empty directory fails loudly rather than reporting success over
zero modules.
- The elaboration ratchet did its job against me: it refused the change with
four `NEW` rows and exit 1 until the increase was recorded deliberately.
Baseline 162/32 -> **176/36**, with the reason written next to the number --
this is coverage arriving, not a regression. The earlier hand-written note
survived the update, which is the preservation added in #2441 working.
- Everything else held: yosys 36/36, conformance still executes 18 mac + 3 spi,
vector and withdrawn gates green. The 13 red cargo tests are unchanged and
pre-existing (#2292).
10 changes: 10 additions & 0 deletions tools/elab_baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# `tri elab classify` -- it measures the distribution by message shape.
# iverilog-version 13.0
# --- notes (hand-written, preserved) ---
# 2026-08-23: 162 -> 176 across 32 -> 35 modules, and that is COVERAGE
# arriving, not a regression. The module set was a hardcoded 36-name array
# in main.rs; four specs on disk were never generated -- bpsk,
# power_analysis, ternary_link, vcd_conformance_compare -- and carried 14
# errors nothing counted or bounded. The set is now the directory (T75).
#
# clock_domain went 4 -> 5 and that was the FIX landing, not a regression. Its
# 4 entries were syntax errors from a keyword-named parameter emitted bare; a
# syntax error truncates the file, so the 5 real elaboration errors behind it
Expand All @@ -16,6 +22,7 @@ apb_bridge 4
assembler 4
axi4 2
bootrom 3
bpsk 0
bridge 16
clock_domain 5
crossopt 0
Expand All @@ -33,14 +40,17 @@ memory 5
partition 2
placement 6
power 2
power_analysis 1
router 8
simulator 2
spi 0
stdlib 2
ternary_isa 6
ternary_link 0
testbench 8
timing 10
top_level 0
uart 0
vcd_conformance_compare 13
vcd_trace 14
zerodsp_top 5
Loading