Repository navigation
analog: sar_comparator.t27 -- the SAR ADC dynamic comparator, multi-node Newton, square law against ngspice LEVEL=1 (Closes #10583) - #10604
Merged
Conversation
…ode Newton, square law against ngspice LEVEL=1 (Closes #10583) M4b of the SAR ADC milestone (#10524, epic #10486). The StrongARM-style dynamic_comparator of the golden SAR deck: eight internal nodes, fifteen square-law devices (the device level is the square law, not PSP103), each read from M3a's bilinear table (the 24-cell grid read as 62.5 mV cells). - backward Euler on all eight nodes at once, K = 3 fixed Newton iterations, the 8 x 9 system solved by Gaussian elimination with partial pivoting in unsigned sign-magnitude u64 words; the f64 twin of the same iteration and an analytic-law run (Newton to convergence) live in the tests - residual after the last iteration at every step: at most 2 units (0.12 uV) at K = 3; K = 1 reaches 29361, K = 2 reaches 55 (negative controls) - +-2 mV and +-0.5 mV decide the right way; decision time (first output through Vdd / 2) 5.489 / 5.558 ps against ngspice 5.496 / 5.569 ps (-0.14 % / -0.20 %), resolution time 6.963 / 7.734 ps against 6.931 / 7.694 ps (+0.47 % / +0.53 %) - errors kept apart: arithmetic 68 / 251 units, table 15.2 / 19.0 mV, analytic law against ngspice 1.4e-9 V - negative controls: K = 1, K = 2, inputs swapped, input-pair m swapped (38/34 vs 34/38), Vth = 0.30 table - four ngspice MOSFET LEVEL=1 decks (fixed-step backward Euler recipe of bench.t27) in specs/analog/decks/, their numbers recorded in the spec - metastability reported: each quartering of the input adds 7.67 steps; at 0 V the circuit stays symmetric and never decides Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 18, 2026 18:46
This was referenced Oct 18, 2026
Closed
Closed
Merged
Contributor
gHashTag
added a commit
that referenced
this pull request
Oct 18, 2026
This was referenced Oct 18, 2026
16 of 21 tasks
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 #10583
Part of #10524 (M4b), epic #10486.
Device level: the SQUARE LAW (cpphdl's MOS law, SPICE MOSFET LEVEL=1), not PSP103. IHP tables replace the law in M3b (#10516) and change nothing in the solver. The decision times below are the 0.1 ps backward Euler grid's, not the continuous circuit's.
What it is
specs/analog/sar_comparator.t27: the StrongARM-styledynamic_comparatorof the golden SAR deck (uberWAVEwp2-parser/golden/top.spice, GPL-2.0, read at run time and not vendored): eight internal nodes (ap, an, net1, net2, net3, dp, dn, n_clkc), fifteen devices (XM1..XM13 and the inverter), W/L/m of the deck.use analog::mos_table: id_of, gm_cell, gds_cell, unchanged): its 24-cell grid is read as 24 cells of 62.5 mV (unit 2^-24 V, Vdd = 1.5 * 2^24). Price: 0.35 V lands inside cell 5, a soft knee, measured in the spec.sc_clk_attosc_sign). The f64 twin of the same iteration and an analytic-law run (Newton to convergence) are in the tests. Residual after the last iteration is computed at every step.specs/analog/decks/(sar_cmp_p2,_m2,_p05,_m05), fixed-step backward Euler by the recipe of bench.t27, the same W, L, m, KP, VTO and capacitors. Their numbers are recorded in the spec (the spec does not run ngspice; runngspice -b specs/analog/decks/sar_cmp_p2.cir).Result (K = 3, fixed point, against ngspice LEVEL=1 on the same grid)
The issue asks for 5 %; the worst is 0.53 %. The decks for -2 mV and -0.5 mV print the same times as +2 mV and +0.5 mV.
Errors, kept apart (each bound asserted from both sides)
Negative controls (each a test that passes by seeing the failure)
Also reported, not hidden
Gates
t27c test-report specs/analog/sar_comparator.t27: 20 tests, 20 pass, 0 vacuous passes;tri test: 20 pass.python3 -I tools/dupe_scan.py: ok.tri types ratchet: CLEAN (no new type).t27c check: 0 warnings.docs/reports/t27b_expectations.jsonuntouched.t27c frontierreports toolchain drift; the tests and seal were run on it.🤖 Generated with Claude Code