Repository navigation
analog M4c: the SAR ADC bootstrapped sampling switch -- M4b's solver reused, square law against ngspice LEVEL=1 (Closes #10753) - #10779
Merged
Conversation
…reused, square law against ngspice LEVEL=1 (Closes #10753) specs/analog/sar_switch.t27 (AnalogSarSwitch): the tracking_switch of the golden SAR deck (ten MOS, the inverter, the 603.2 fF boost capacitor XC3 and the 4 fF node capacitors; Vout loaded with 4 fF plus the M4a DAC's top plate, 3930.2 fF from M4a's own counts and the IHP cap_cmim density). THE DEVICE LEVEL IS THE SQUARE LAW (MOSFET LEVEL=1), NOT PSP103: devices are M3a's table as M4b reads it, 3125 in parallel for dt = 250 ps. Backward Euler on eight nodes (seven and a dummy) by M4b's pivoted Gauss in unsigned words, with a damped Newton that stops when every node is settled (the clock edges need up to 120 iterations). Measured against ngspice LEVEL=1 on the same grid, each with a named bound: gate overdrive within 0.26 mV (bound 0.4 mV) at Vin 0.2, 0.75, 1.3 V and four sine phases; tracking error within 36.9 uV of a 1.27 mV lag (bound 3 uV + 5 %); injection step within 0.36 uV (1 uV); droop 0 (1 nV). The three errors apart: arithmetic 247 units, table 39 mV (the knee), model 0.5 nV; discretization from a 50 ps ngspice deck. Negative controls: no boost capacitor, K too small, Vth 0.30, XM9 removed, XM6 halved; a broken constant makes seal --save refuse. M4b (specs/analog/sar_comparator.t27) is split, not copied: sc_stamp_chan, sc_clear, sc_stamp_cap, sc_apply_lim, sc_stamp_chan_f, sc_stamp_caps_f, sc_assemble_f, sc_resid_f; the law mode no longer clamps to the table range. Its 20 tests and folds are unchanged; its seal is renewed. Nine decks under specs/analog/decks/ (data). dupe_scan ok. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
Merged
Contributor
gHashTag
enabled auto-merge (squash)
October 19, 2026 02:37
… and sar_switch (Closes #10753) M3b changed mos_table.t27 (two tables) and renewed sar_comparator's seal for its closure; this branch changed sar_comparator.t27 itself. The only conflict was that seal: both seals are made again on the merged tree. mos_table 14/14, sar_comparator 20/20, sar_switch 14/14, mos_psp103 11/11, mos_psp103_data 4/4, 0 vacuous each; seal --verify all MATCH; every closure hash current; dupe_scan ok. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 19, 2026
Merged
16 of 21 tasks
This was referenced Oct 19, 2026
Contributor
PR DashboardGenerated at: 2026-10-19 03:00:15 UTC
Summary
Seal Status
|
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.
What this does
M4c of #10524 (epic #10486). New spec
specs/analog/sar_switch.t27(moduleAnalogSarSwitch, sealed) with nine ngspice decksspecs/analog/decks/sar_sw_*.cir(data).It emulates the
tracking_switchof the golden SAR deck (uberWAVEwp2-parser/golden/top.spice, GPL-2.0, read at run time, not vendored): ten MOS, the inverter, the 20 um x 20 umcap_cmimboost capacitor XC3 and the 4 fF node capacitors. The device level is the SQUARE LAW (SPICE MOSFET LEVEL=1), not PSP103 -- M3a's table as M4b reads it, 3125 devices in parallel for dt = 250 ps. Backward Euler on eight nodes (seven and one dummy, because M4b's solver is 8 x 8), M4b's pivoted Gauss in unsigned sign-magnitude words reused byuse.UNITS,SIDE,BRIDGE_UNITS(1023/32 units of the 9 um x 9 um cap_cmim) = 3930.2 fF, 3934.2 fF in all.cornerCAP.lib:22(cap_carea = 1.5E-15),capacitors_mod.lib:58,72(CJSW = 40E-18); C = CJ l w + 2 CJSW (l + w), checked in ngspice: 603.2 fF (20 x 20), 122.94 fF (9 x 9).sw_stamp_cfloat), nodes below ground and above the supply (the word is V * 2^24 + 0.5 V), and a damped Newton that stops when settled: at the clock edges a node moves by a volt in one step and plain Newton cycles between table cells. Most steps need 0 to 3 iterations (114 of 416 need none), the worst step needs 120 (K = 128).sc_stamp_chan,sc_clear,sc_stamp_cap,sc_apply_lim,sc_stamp_chan_f,sc_stamp_caps_f,sc_assemble_f,sc_resid_f); the analytic law mode no longer clamps to the table range. M4b's 20 tests and folds are unchanged; its seal is renewed.The four measurements against ngspice LEVEL=1 (same grid), emulator minus ngspice
SW_B_OD_V= 0.4 mVSW_B_TE_ABS_V3 uV +SW_B_TE_REL5 % of ngSW_B_INJ_V= 1 uVSW_B_DROOP_V= 1 nVEvery row is asserted against its bound (and the headline deviations from both sides). OD 0.2571 mV worst (a factor 1.6 inside), TE 36.9 uV of 66.3 uV at the sine's zero crossing (the table's on-resistance is 2.85 % high), 1.93 uV at DC (the integer words' settling floor).
The injection step is not the charge injection of a real switch: MOSFET LEVEL=1 with no TOX/CGSO/CGDO has no gate capacitance, so the step is Vout still following the input until the gate collapses (step 333). The droop is zero for the same kind of reason (no leak in the square law).
The three errors, kept apart (DC 0.75 V / sine zero crossing)
SW_B_ARITH_U= 260) against the converged real run. At the measurements: 97 nV / 4.1 uV (OD), 1.91 / 0.33 uV (TE), 0.17 / 0.015 uV (INJ).SW_B_TABLE_U= 660000), at step 35 on net5, the soft knee of XM8 (threshold 0.35 V inside the 62.5 mV cell). At the measurements: 0.253 mV in OD, 36.6 uV in TE (sine).SW_B_LAW_V= 1 nV); under 2 nV in OD, TE, INJ.sar_sw_sn0,sar_sw_fine): OD 2.96 mV, TE 3.4 uV (0.27 %), INJ 11.2 uV (4.5 %). Shared with ngspice by construction at 250 ps, larger than the table's 0.25 mV in OD.Negative controls (each a test that passes by seeing the failure)
sar_sw_nocb: 0.435 V, the emulator is within 2.85 mV of it).t27c seal --saverefuse (exit 1, no seal written):SW_CB = 0fails 10 of 14 tests,SW_STOPloosened to 6400 fails 6.Gates run
t27c test-report specs/analog/sar_switch.t27: 14 pass, 0 FAIL, vacuous passes 0 of 14 (about 10 s).t27b test: 14 pass (native).t27c test-report specs/analog/sar_comparator.t27: 20 pass, 0 vacuous (unchanged asserts).t27c seal --savethen--verify: all MATCH, for both seals; no home path or blocked verdict in either.python3 -I tools/dupe_scan.py: ok (682 of 13564 bodies in 195 groups, as before).What this does NOT claim
Closes #10753
🤖 Generated with Claude Code