Repository navigation
t27o: SPICE front end -- parse, flatten and inventory an ngspice netlist, or refuse with the line (Closes #10509) - #10530
Merged
Merged
Conversation
…ist, or refuse with the line (Closes #10509) specs/tools/t27o/spice_convert.t27 is the second t27o front end, beside rust_convert.t27, reached by file extension: `tri t27o deck.spice | deck.cir | deck.sp` prints an inventory (cards by kind, the subckt list, MOS and cap_cmim counts by model, .tran, .lib corners, TEMP, flattened instances with ngspice-style hierarchical names, m-weighted device counts) or `line N: <reason>` plus the card, and exits 1. The deck ends at the LAST .end card: top.spice has its first .end at line 296 and every .subckt definition after it, and ngspice produced the golden .raw from that file, so the reader reads the whole file (rule and evidence in the spec header, tested both ways). The reported refusal is the earliest one. 22 tests, 0 vacuous; sealed; generated Rust under gen/rust/tools/t27o/; 9 lines of hand Rust in cli/tri/src/main.rs (the module and the extension dispatch). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Contributor
This was referenced Oct 18, 2026
Merged
gHashTag
disabled auto-merge
October 18, 2026 17:26
This was referenced Oct 18, 2026
… so the SPICE glue does not grow hand-written Rust (Closes #10509) own-language failed: +9 / -1 hand-written lines in cli/tri/src/main.rs (owner rule 2026-10-09: hand-written foreign code may not grow). Both functions document themselves "nothing calls this now" (their callers went in #5935) and have no caller, test caller included; git_paths and gate_script keep their other callers. Net hand-written Rust for the PR: +9 / -38. `cargo build --release -p tri` passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
PR DashboardGenerated at: 2026-10-18 18:34:16 UTC
Summary
Seal Status
|
This was referenced Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10509
M2a of #10486:
specs/tools/t27o/spice_convert.t27, the SPICE front end of t27o.tri t27o deck.spice|.cir|.spreads an ngspice netlist, flattens its subcircuits and prints an inventory, or printsline N: <reason>plus the card and exits 1. Emitting the M1 cell spec from the inventory is M2b.Result on the acceptance deck (
top.spice, downloaded at run time, not committed)tri t27o top.spiceaccepts the whole file (exit 0):Flattened MOS count 1265 (1534 weighted by m); instance names are hierarchical (
x3.x1.xm1). An independent Python flattening of the same text gives the same numbers (mos 1265, mim 128, c 38, levels 517, depth 4, weighted 1534).Two differences from the issue text, both measured: the deck has 16
.subcktdefinitions (grep -ci '^\.subckt'; the 17th hit of a plain grep is the comment**.subckt top), not 20; and it holds 64cap_cmimX instances, which the issue does not mention, socap_cmimis recognised like the two MOS models (counted separately, w/l/m checked, not evaluated). Also read beyond the card list because the deck needs them:.ic,.nodeset,.save,.global(recorded) and the post-processing commands inside.control(counted as ignored; any other control command is refused).The
.endruleThe reader reads the whole file and the deck ends at the LAST
.end. Intop.spicethe first.endis line 296 and every.subcktfollows it; ngspice produced the golden.rawfrom that file, so it saw them. Stopping at the first.endwould refuse all 72 instances. Documented in the spec header and tested both ways (definitions after a first.endare read; with a single.endthey are ignored and the instance is reported undefined with its line).Gates
t27c test-report specs/tools/t27o/spice_convert.t27: 22 tests, 22 pass, 0 FAIL, 0 vacuous (Zig backend);t27b test(JIT) agrees, 22/22.tri test specs/tools/t27o/spice_convert.t27: exit 0 (the new fail-on-vacuous gate, tri test: refuse vacuous passes -- report.t27 reads the "vacuous passes N of M" line (Closes #10497) #10507).megscale 6 -> 3 failssi_suffixes_milli_is_not_mega; stopping at the first.endfails the end-rule test; dropping the.in hierarchical names fails four tests. The suite also holds the refusal side (B source,.measure, braces, unknown element, bad number, undefined subckt, port mismatch, recursion, ...) next to the same decks without the offending card being accepted.t27c seal ... --save/--verify: all hashes MATCH;.trinity/seals/t27o_T27oSpice.jsoncommitted.t27c frontier --only: REUSE for this spec and for rust_convert.t27.gen/rust/tools/t27o/spice_convert.rsis byte-identical tot27c gen-rustoutput and compiles standalone;cargo build --release -p tribuilds.cli/tri/src/main.rs(module declaration + the extension dispatch incmd_t27o; the extension test itself isis_spice_namein the spec). Cap is 40 per file, 80 per PR. If a gate asks for theowner-approved-foreignlabel for touchingmain.rs, that is the owner's to add; I did not add it.Not in this PR
Node resolution through port maps,
.paramsubstitution,.measure/B sources/.func/behavioural models (refused), M2b (emitting the M1 spec), M3 (evaluating MOS). Two skill lines are now stale (tri-pipeline/SKILL.md"Rust is the only front end today",analog-emulation/SKILL.mdconverter row); the agent sandbox could not write under.claude/skills, so they are left for a follow-up.🤖 Generated with Claude Code