diff --git a/bootstrap/src/main.rs b/bootstrap/src/main.rs index d56d1495d2..d9bb514c1f 100644 --- a/bootstrap/src/main.rs +++ b/bootstrap/src/main.rs @@ -1293,6 +1293,9 @@ enum Commands { /// Input file path input: String, }, + /// Print the IGLA board event a .t27 spec states, as one JSON object + #[command(name = "gen-json")] + GenJson { input: String }, /// Compute deterministic test_vector_hash from conformance JSON Conformance { @@ -5637,6 +5640,31 @@ fn run_gen_python(input_path: &str) -> anyhow::Result<()> { } } +/// `gen-json` (#10050): the IGLA board event a spec states, as one JSON object. Every value comes +/// through the gen-js layer, which spells it as JSON does; this only arranges them, cells zipped. +fn run_gen_json(input_path: &str) -> anyhow::Result<()> { + let (ast, _) = ast_for_codegen(input_path)?; + let scope = codegen_js::Bound::in_spec(&ast); + let v = |name: &str| -> anyhow::Result { + let found = ast.children.iter().find(|n| n.kind == compiler::NodeKind::ConstDecl && n.name == name); + let node = found.ok_or_else(|| anyhow::anyhow!("gen-json: the spec declares no const {name}"))?; + codegen_js::const_value(&codegen_js::JS, node, &scope).map_err(anyhow::Error::msg) + }; + let items = |name: &str| -> anyhow::Result> { + let s = v(name)?; + Ok(s.trim_matches(|c| c == '[' || c == ']').split(", ").map(String::from).collect()) + }; + let (status, pct) = (items("CELL_STATUS")?, items("CELL_PCT")?); + anyhow::ensure!(status.len() == pct.len(), "gen-json: {} statuses, {} percents", status.len(), pct.len()); + let (ks, kp) = (v("KEY_STATUS")?, v("KEY_PCT")?); + let cells: Vec<_> = status.iter().zip(&pct).map(|(s, p)| format!("{{{ks}:{s},{kp}:{p}}}")).collect(); + let lens = items("LENS_PCT")?.join(","); + let metrics = format!("{{{}:[{lens}],{}:[{}]}}", v("KEY_LENS")?, v("KEY_CELLS")?, cells.join(",")); + let (job, stage, msg, progress) = (v("JOB")?, v("STAGE")?, v("MSG")?, v("PROGRESS")?); + println!("{{\"job\":{job},\"stage\":{stage},\"msg\":{msg},\"progress\":{progress},\"metrics\":{metrics}}}"); + Ok(()) +} + fn sha256_hex(data: &[u8]) -> String { sha256::hash_hex(data).iter().map(|&c| c as char).collect() } @@ -11978,6 +12006,7 @@ async fn main() -> anyhow::Result<()> { Commands::GenJs { input } => run_gen_js(&input)?, Commands::GenTs { input } => run_gen_ts(&input)?, Commands::GenPython { input } => run_gen_python(&input)?, + Commands::GenJson { input } => run_gen_json(&input)?, Commands::Conformance { input } => run_conformance(&input)?, Commands::Path { input, synth } => { service::run_path(&std::env::current_dir()?, &input, synth)? @@ -12415,6 +12444,7 @@ fn main() -> anyhow::Result<()> { Commands::GenJs { input } => run_gen_js(&input)?, Commands::GenTs { input } => run_gen_ts(&input)?, Commands::GenPython { input } => run_gen_python(&input)?, + Commands::GenJson { input } => run_gen_json(&input)?, Commands::Conformance { input } => run_conformance(&input)?, Commands::Path { input, synth } => { service::run_path(&std::env::current_dir()?, &input, synth)? diff --git a/docs/reports/data/W564-harness.sh b/docs/reports/data/W564-harness.sh deleted file mode 100755 index 3f43b2e645..0000000000 --- a/docs/reports/data/W564-harness.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/zsh -REPO=/Users/playom/t27/.claude/worktrees/igla-fpga-improvements-3f5e1a -OUT=/tmp/w560/results8.tsv -: > "$OUT" -n=0 -while read -r f; do - n=$((n+1)) - base=$(basename "$f" .t27) - zf="/tmp/w560/r2_${base}_$n.zig" - if ! "$REPO/target/release/t27c" gen "$f" > "$zf" 2>/dev/null || [ ! -s "$zf" ]; then - printf '%s\tGEN_FAIL\t0\n' "$f" >> "$OUT"; continue - fi - log=$(cd /tmp/w560 && zig test "$zf" 2>&1) - # A compile error is authoritative: zig prints "error:" with a file:line prefix. - if echo "$log" | grep -qE '^[^ ]+\.zig:[0-9]+:[0-9]+: error:'; then - printf '%s\tCOMPILE_FAIL\t0\n' "$f" >> "$OUT" - elif echo "$log" | grep -qE "All [0-9]+ tests passed"; then - p=$(echo "$log" | grep -oE "All [0-9]+ tests passed" | grep -oE "[0-9]+") - printf '%s\tALL_PASS\t%s\n' "$f" "$p" >> "$OUT" - elif echo "$log" | grep -qE "panic: assertion failed|terminated with signal ABRT|[0-9]+ passed; [0-9]+ failed"; then - p=$(echo "$log" | grep -cE "\.\.\.OK$") - printf '%s\tTEST_FAIL\t%s\n' "$f" "$p" >> "$OUT" - else - printf '%s\tUNKNOWN\t0\n' "$f" >> "$OUT" - fi -done < /tmp/bdd_ok.txt diff --git a/tools/devhome_baseline.txt b/tools/devhome_baseline.txt index 25f48a6b62..b45529d324 100644 --- a/tools/devhome_baseline.txt +++ b/tools/devhome_baseline.txt @@ -23,7 +23,6 @@ docs/NOW.md 1 docs/fpga/LOCAL-BITSTREAM-FLOW.md 3 docs/reports/OPENXC7-PNR-NOT-FUNCTION-PRESERVING.md 1 -docs/reports/data/W564-harness.sh 1 docs/reports/data/W568-harness.sh 1 docs/reports/data/W586-harness.sh 1 docs/reports/pdf/build_pdf.sh 1 diff --git a/tools/jtag/read_user1.py b/tools/jtag/read_user1.py deleted file mode 100644 index ef03c458f3..0000000000 --- a/tools/jtag/read_user1.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys; sys.path.insert(0,'tools/jtag') -from mpsse_jtag import Mpsse, CLK_BITS_OUT_NEG, CLK_TMS_OUT_NEG -def shift_ir(m, val): - m.tms([1,1,0,0]) - m.w(bytes([CLK_BITS_OUT_NEG, 4, val & 0x1F])) - m.w(bytes([CLK_TMS_OUT_NEG, 0, (((val>>5)&1) << 7) | 0x01])) - m.tms([1,0]) -def user1(idx=0, nbits=4): - m = Mpsse(idx) - try: - m.tms([1,1,1,1,1]); m.tms([0]) - shift_ir(m, 0x02) - m.tms([1,0,0]) - r = m.shift_dr_read(nbits); m.tms([1,1,0]) - return r[0] & ((1<