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
30 changes: 30 additions & 0 deletions bootstrap/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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<String> {
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<Vec<String>> {
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()
}
Expand Down Expand Up @@ -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)?
Expand Down Expand Up @@ -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)?
Expand Down
26 changes: 0 additions & 26 deletions docs/reports/data/W564-harness.sh

This file was deleted.

1 change: 0 additions & 1 deletion tools/devhome_baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 0 additions & 20 deletions tools/jtag/read_user1.py

This file was deleted.

Loading