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
33 changes: 33 additions & 0 deletions .trinity/seals/analog_AnalogRawWriter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"built_by": "t27c-bootstrap@0.5.2+ea35d9b72",
"closure": [
{
"spec": "specs/analog/linear.t27",
"spec_hash": "sha256:3ddef7be183aba583ed285334ee389b48a65b41335e98914514235db7c4e5d62"
}
],
"config": "gen=c,rust,verilog,zig;tests=zig",
"gen_hash_c": "sha256:dbe7acad844a5bb019d88358e84fad32156944c3cc601f92cb1716c05a6f62f9",
"gen_hash_rust": "sha256:1972b1be92b8a559fab68c24223117ef5f81cbf884fcea7b6bda77be43716652",
"gen_hash_verilog": "sha256:3a68643c6ec1d387e396536a4ba5c260bc6bb24817bd28eca12c3d25ae130395",
"gen_hash_zig": "sha256:d0d359edef7382f60b996285beb57743005783d1d0a78d957646900574331ec3",
"module": "AnalogRawWriter",
"ring": 12,
"seal_schema": 2,
"sealed_at": "2026-10-19T06:56:46Z",
"sealed_by": "t27c-bootstrap@0.5.2",
"spec_hash": "sha256:aeeb1e59ef814992e7e73a1c68b4889fcac1a936ec8c921aa99d1fbb96083ce8",
"spec_path": "specs/analog/raw_writer.t27",
"tests": {
"failed": 0,
"failing": [],
"forced": false,
"passed": 18,
"total": 18,
"vacuous": 0
},
"toolchain": {
"test_runner": "sha256:8512b80da533b79289110fca4a65f3336abd7a059ca4b72ea595d5e33ff8ad10",
"zig": "0.16.0"
}
}
23 changes: 0 additions & 23 deletions cli/dlc10/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1790,29 +1790,6 @@ fn decode_dr_32(resp: &[u8]) -> u32 {
val
}

/// Extract `rx_len_bits` starting at `rx_start_bits` from the captured stream.
/// Bits arrive in the same packed format as `decode_dr_32`: 16-bit LE words,
/// LSB-first within each.
#[allow(dead_code)]
fn extract_rx(resp: &[u8], total_bits: usize, rx_start_bits: usize, rx_len_bits: usize) -> Vec<u8> {
let words: Vec<u16> = (0..resp.len() / 2)
.map(|i| u16::from_le_bytes([resp[2 * i], resp[2 * i + 1]]))
.collect();
let mut out = vec![0u8; rx_len_bits.div_ceil(8)];
for i in 0..rx_len_bits {
let src = rx_start_bits + i;
if src >= total_bits {
break;
}
let wi = src / 16;
let bi = src % 16;
if wi < words.len() && (words[wi] & (1 << bi)) != 0 {
out[i >> 3] |= 1 << (i & 7);
}
}
out
}

/// Index into the DLC10 16-bit-LE packed response by absolute Shift-DR
/// bit position (LSB-first within each 16-bit word).
fn bit_at(resp: &[u8], bit_idx: usize) -> bool {
Expand Down
15 changes: 15 additions & 0 deletions cli/tri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ mod report; // t27c gen-rust of specs/tri/test/report.t27 (#7369): every rule of
mod lab; // t27c gen-rust of specs/tri/lab/receipt.t27: every rule of `tri lab receipt`
#[path = "../../../gen/rust/tri/actors/metrics.rs"] #[allow(dead_code, unused_parens)]
mod act; // t27c gen-rust of specs/tri/actors/metrics.t27: every rule of `tri actors`
#[path = "../../../gen/rust/analog/raw_writer.rs"] #[allow(dead_code, unused_parens, unused_mut, unused_variables, non_snake_case, unused_assignments, clippy::all)]
mod raw; // t27c gen-rust of specs/analog/raw_writer.t27: every rule of `tri raw` (#10909)
#[path = "../../../bootstrap/gen/rust/verified/gen_hash_cache.rs"] #[allow(dead_code, unused_parens, unused_mut, unused_variables, non_snake_case, clippy::all)]
mod gen_cache; // the gen-hash cache's eviction limit, for `tri hot caches` (#8952)
#[path = "../../../bootstrap/gen/rust/verified/bitstream_reuse.rs"] #[allow(dead_code, unused_parens, unused_mut, unused_variables, non_snake_case, clippy::all)]
Expand Down Expand Up @@ -410,6 +412,8 @@ enum Commands {
/// Passed on to t27c after the action's own arguments.
#[arg(trailing_var_arg = true, allow_hyphen_values = true)] rest: Vec<String>,
},
/// The M1 RLC trace as an ngspice RAW file (ASCII, or --binary) that ngspice and uberWAVE open; --date sets the Date line (rules: specs/analog/raw_writer.t27, #10909).
Raw { out: String, #[arg(long)] binary: bool, #[arg(long)] date: Option<String> },
/// The Queen's actor telemetry: kinds, the deepest mailboxes, supervisors and threshold events, each row judged (rules: specs/tri/actors/metrics.t27, thresholds from specs/queen/telemetry.t27).
Actors {
/// The Queen's base URL.
Expand Down Expand Up @@ -1066,6 +1070,16 @@ fn cmd_lab(specs: Option<&str>, sha: &[String]) -> Result<u8> {
let x = lab::exit_code(n.iter().sum(), n[lab::V_RED as usize], n[lab::V_UNREAD as usize]); println!("{}", lab::exit_why(x)); Ok(x)
}

/// `tri raw` (#10909): every rule is specs/analog/raw_writer.t27; this allocates its buffers and writes the file.
fn cmd_raw(out: &str, binary: bool, date: Option<&str>) -> Result<u8> {
let d = date.map_or_else(|| chrono::Local::now().format("%a %b %e %H:%M:%S %Y").to_string(), str::to_string);
let (mut buf, mut vals, mut limbs, mut dig) = (vec![0u8; 1 << 16], vec![0f64; raw::RLC_VALS], vec![0u64; raw::RAW_LIMBS], vec![0u8; raw::RAW_DIGITS]);
let n = raw::raw_rlc_file(&mut buf, d.as_bytes(), binary, &mut vals, &mut limbs, &mut dig);
anyhow::ensure!(n > 0 && n <= buf.len(), "raw: the trace is not the RLC cell's pinned simulation, or the file does not fit");
fs::write(out, &buf[..n])?;
Ok(0)
}

/// `tri actors`: curl the telemetry (and with --replay the decision log), pretty-print it, and print what specs/tri/actors/metrics.t27 reads in it.
fn cmd_actors(url: &str, bound: u32, replay: bool) -> Result<u8> {
let get = |p: &str| -> Result<&'static str> { let o = Command::new("curl").args(["-fsSL", "--max-time", "60", &format!("{url}{p}")]).output()?; Ok(serde_json::from_slice::<serde_json::Value>(&o.stdout).ok().and_then(|v| serde_json::to_string_pretty(&v).ok()).unwrap_or_default().leak()) };
Expand Down Expand Up @@ -1330,6 +1344,7 @@ fn main() -> Result<()> {
Commands::Hooks { action } => hooks::run(action)?,
Commands::Lab { specs, sha, .. } => std::process::exit(cmd_lab(specs.as_deref(), sha)? as i32),
Commands::Actors { url, bound, replay } => std::process::exit(cmd_actors(url, *bound, *replay)? as i32),
Commands::Raw { out, binary, date } => std::process::exit(cmd_raw(out, *binary, date.as_deref())? as i32),
Commands::Hot { t27c, action, rest } => std::process::exit(cmd_hot(action, rest, t27c.as_deref()) as i32),
Commands::Payout { epoch, pool, json } => std::process::exit(payout::cmd(*epoch, *pool, *json)? as i32),
Commands::T27o { file, name, oracle, check, t27c, emit_cell } => std::process::exit(cmd_t27o(file, name.as_deref(), *oracle, *check, t27c.as_deref(), *emit_cell)? as i32),
Expand Down
Loading
Loading