From c948f4df7636aca7279e04d30d763ec87cd618f1 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 19 Oct 2026 12:49:20 +0700 Subject: [PATCH] analog: PSP103 drain and gate charge tables (tt, ss), the charge-aware table solver, the 500 fF inverter within 0.02 % of ngspice (Closes #10880) M3c of #10486, the charge half of #10777 (Part of #10777). - specs/analog/decks/psp103_q_tt.cir, psp103_q_ss.cir: the drain and gate charge of sg13_lv_nmos / sg13_lv_pmos on the M3b grid, taken from the terminal currents of one backward Euler step (PSP103 reports no terminal charge), with the current tables and ngspice's own op-point capacitances printed in the same run. - mos_psp103_data.t27: TT_QD_N TT_QG_N TT_QD_P TT_QG_P and the SS_ four, the 401-sample ngspice backward Euler waveform at 500 fF (INV500_BE, printed by psp103_inv_be_500f.cir), pins. - mos_table.t27: the solver generalized with the two drain-charge tables and the previous step's gate (the *_q functions); the current-only functions are those with zero charge tables, nothing is copied, M3a's pinned run is untouched. Three tests: zero charge is the old path, a plane of charge gives the closed form of the gate-edge kick, the mirror holds with four tables swapped. - mos_psp103.t27: tt inverter at 500 fF and dt = 100 ps against ngspice backward Euler on the same grid, tpLH 0.020 % and tpHL 0.0041 % (3.09 % and 3.63 % without charge); the three errors apart; the ss charge tables in the tt run fail the check; the table slopes agree with ngspice's op-point capacitances within 0.3 %; the weak-inversion 1 % bound stated with its reasons (follow-up #10881). Corners ff, fs, sf: #10882. Part of #10486 Co-Authored-By: Claude Sonnet 5.5 --- .trinity/seals/analog_AnalogMosPsp103.json | 20 +- .../seals/analog_AnalogMosPsp103Data.json | 16 +- .trinity/seals/analog_AnalogMosTable.json | 16 +- .../seals/analog_AnalogSarComparator.json | 4 +- .trinity/seals/analog_AnalogSarSwitch.json | 4 +- specs/analog/decks/psp103_inv_be_500f.cir | 11 + specs/analog/decks/psp103_q_ss.cir | 140 +++++ specs/analog/decks/psp103_q_tt.cir | 140 +++++ specs/analog/mos_psp103.t27 | 414 ++++++++++++- specs/analog/mos_psp103_data.t27 | 555 +++++++++++++++++- specs/analog/mos_table.t27 | 268 ++++++++- 11 files changed, 1517 insertions(+), 71 deletions(-) create mode 100644 specs/analog/decks/psp103_q_ss.cir create mode 100644 specs/analog/decks/psp103_q_tt.cir diff --git a/.trinity/seals/analog_AnalogMosPsp103.json b/.trinity/seals/analog_AnalogMosPsp103.json index 147dcf14ba..d265286ba3 100644 --- a/.trinity/seals/analog_AnalogMosPsp103.json +++ b/.trinity/seals/analog_AnalogMosPsp103.json @@ -7,31 +7,31 @@ }, { "spec": "specs/analog/mos_psp103_data.t27", - "spec_hash": "sha256:d5f3244ff1936f2b96e95b06e022d6b42b489ac49e025ec99486d6d36e6c6580" + "spec_hash": "sha256:be100dec66ee80de6cf520f79038e7668bc1171102db1fefe6a4c74559d029de" }, { "spec": "specs/analog/mos_table.t27", - "spec_hash": "sha256:9c0d1537ed5d8d60c4bdcb67d1e4c73ef80270e8cab224cb089c5b568fe11182" + "spec_hash": "sha256:16d28f10fa8663926dddb4bcced981cdc4cd8f38a6b748e4b7688f2e56bbab6c" } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:d7a49c643703a544723718186df74850018c4bf067fdb06ca9c860d775e069e8", - "gen_hash_rust": "sha256:32ee0d51345b936e45ff10956b90fdcafb6106bca46c2700de2bf43bf4407119", - "gen_hash_verilog": "sha256:0e3d19e85e67353129e8213c6135a5d1b518de4d7502c2d92512695b92de832e", - "gen_hash_zig": "sha256:445a5f05e794204ad3e4c198735c6fb1f4ab816e26fd36d3c408bba83168164f", + "gen_hash_c": "sha256:a5aeefd7abe3aee47919f32153161040121a31fba6fbfc6e3517fe1796191a8a", + "gen_hash_rust": "sha256:0660934f0f63c77f8b204796f1c8e3f5db1d35603797d7ddf912f66a2039d4a2", + "gen_hash_verilog": "sha256:06e55f455e71a7b274d2b8e766028a05ec666c1814b4ed64f8e7ad381706e61e", + "gen_hash_zig": "sha256:460548424dd136ec773917ebc3dd3c6ad31561cbde36cabf8a69266c2e8c7b6c", "module": "AnalogMosPsp103", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T02:10:22Z", + "sealed_at": "2026-10-19T05:34:01Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:c5bd55a847953654fbef792dcfc61da7f6434b8023341df9ab4a53e5d082bbe0", + "spec_hash": "sha256:811617266484683542dd1723db77687ad7fdf7f5a665953f5e6a920a7bdf0118", "spec_path": "specs/analog/mos_psp103.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 11, - "total": 11, + "passed": 17, + "total": 17, "vacuous": 0 }, "toolchain": { diff --git a/.trinity/seals/analog_AnalogMosPsp103Data.json b/.trinity/seals/analog_AnalogMosPsp103Data.json index 06125dea5e..d1dac009ec 100644 --- a/.trinity/seals/analog_AnalogMosPsp103Data.json +++ b/.trinity/seals/analog_AnalogMosPsp103Data.json @@ -7,23 +7,23 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:d0135ebcf91901c442dc8a0c3e3a431f50a57cbc563d430a34e45e68392c9dfe", - "gen_hash_rust": "sha256:9dad368c2549f028ae0828213c7231a0e8ff613988ff42ce7d3aac6fcf9c4e52", - "gen_hash_verilog": "sha256:52f448d5fe93db1de3faa5fa13cb881486ec67a2ed17d1db475cd4d8d222ac82", - "gen_hash_zig": "sha256:1bdd4c520cb0864ffa3c4d2f7ce80418e7a0752e37610b81b4a000c528c413f9", + "gen_hash_c": "sha256:be16cbf1fbac3021d77530b1e86f19bfacf626eb7cfe834900c984331491c060", + "gen_hash_rust": "sha256:cbd4b0ad5ced378295e73bec1bcc69ff8270b99f4a4e27064a6aa2b0aa02c222", + "gen_hash_verilog": "sha256:f062ed3fc219deec9fa254d48b0a8e3ac8de0d2c525810154d1f25ab20a95162", + "gen_hash_zig": "sha256:03d50a36f22f40daf936ade0b764ae11b4142c3f667bf1ab640007eb4fdbcb45", "module": "AnalogMosPsp103Data", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T02:10:08Z", + "sealed_at": "2026-10-19T05:33:43Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:d5f3244ff1936f2b96e95b06e022d6b42b489ac49e025ec99486d6d36e6c6580", + "spec_hash": "sha256:be100dec66ee80de6cf520f79038e7668bc1171102db1fefe6a4c74559d029de", "spec_path": "specs/analog/mos_psp103_data.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 4, - "total": 4, + "passed": 7, + "total": 7, "vacuous": 0 }, "toolchain": { diff --git a/.trinity/seals/analog_AnalogMosTable.json b/.trinity/seals/analog_AnalogMosTable.json index 5b1d2673a8..de7669cec8 100644 --- a/.trinity/seals/analog_AnalogMosTable.json +++ b/.trinity/seals/analog_AnalogMosTable.json @@ -7,23 +7,23 @@ } ], "config": "gen=c,rust,verilog,zig;tests=zig", - "gen_hash_c": "sha256:3de4432818944eab74fae03952b4b4cffd104b00b9cda80dd73bb6ed6e819f0c", - "gen_hash_rust": "sha256:775c36a7f0370d1bc3dd0752f72f435e3fbc6e4972ad9b5c77efc35fb2784750", - "gen_hash_verilog": "sha256:0f3b42817e930cb80890ec45f5ecb5ecdf2a73bb764d029149ab8519dfd43dfc", - "gen_hash_zig": "sha256:05393568aa75f13169560fb6fd1118d46141ae46931458fc181ac12ba42ca196", + "gen_hash_c": "sha256:e0ca09255f83209260afff210947c8af851f5412f9aa7a40f7f5b148a29ac739", + "gen_hash_rust": "sha256:dd4d433feaf2d937fc3acb769f6a9a8febc6d7cc58363dbc061ad9922eba3eb6", + "gen_hash_verilog": "sha256:152706909b6dd98a9fda6242ef666dfa85a03c0a6e4d37564088d2e43da3aafa", + "gen_hash_zig": "sha256:652d1bfbd355d08e8eca4a3f13a4957322006510c310d796111db8aac65ef1d0", "module": "AnalogMosTable", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T02:09:56Z", + "sealed_at": "2026-10-19T05:33:16Z", "sealed_by": "t27c-bootstrap@0.5.2", - "spec_hash": "sha256:9c0d1537ed5d8d60c4bdcb67d1e4c73ef80270e8cab224cb089c5b568fe11182", + "spec_hash": "sha256:16d28f10fa8663926dddb4bcced981cdc4cd8f38a6b748e4b7688f2e56bbab6c", "spec_path": "specs/analog/mos_table.t27", "tests": { "failed": 0, "failing": [], "forced": false, - "passed": 14, - "total": 14, + "passed": 17, + "total": 17, "vacuous": 0 }, "toolchain": { diff --git a/.trinity/seals/analog_AnalogSarComparator.json b/.trinity/seals/analog_AnalogSarComparator.json index df7ea1875f..5a33e5f807 100644 --- a/.trinity/seals/analog_AnalogSarComparator.json +++ b/.trinity/seals/analog_AnalogSarComparator.json @@ -7,7 +7,7 @@ }, { "spec": "specs/analog/mos_table.t27", - "spec_hash": "sha256:9c0d1537ed5d8d60c4bdcb67d1e4c73ef80270e8cab224cb089c5b568fe11182" + "spec_hash": "sha256:16d28f10fa8663926dddb4bcced981cdc4cd8f38a6b748e4b7688f2e56bbab6c" } ], "config": "gen=c,rust,verilog,zig;tests=zig", @@ -18,7 +18,7 @@ "module": "AnalogSarComparator", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T02:37:52Z", + "sealed_at": "2026-10-19T05:38:44Z", "sealed_by": "t27c-bootstrap@0.5.2", "spec_hash": "sha256:b88d05d5d17937024580ab40e80b698b63962cab531164d4a94a5dddd05a72a8", "spec_path": "specs/analog/sar_comparator.t27", diff --git a/.trinity/seals/analog_AnalogSarSwitch.json b/.trinity/seals/analog_AnalogSarSwitch.json index 3f8d0787ed..623e9ac7f9 100644 --- a/.trinity/seals/analog_AnalogSarSwitch.json +++ b/.trinity/seals/analog_AnalogSarSwitch.json @@ -7,7 +7,7 @@ }, { "spec": "specs/analog/mos_table.t27", - "spec_hash": "sha256:9c0d1537ed5d8d60c4bdcb67d1e4c73ef80270e8cab224cb089c5b568fe11182" + "spec_hash": "sha256:16d28f10fa8663926dddb4bcced981cdc4cd8f38a6b748e4b7688f2e56bbab6c" }, { "spec": "specs/analog/sar_cdac.t27", @@ -26,7 +26,7 @@ "module": "AnalogSarSwitch", "ring": 12, "seal_schema": 2, - "sealed_at": "2026-10-19T03:59:52Z", + "sealed_at": "2026-10-19T05:48:24Z", "sealed_by": "t27c-bootstrap@0.5.2", "spec_hash": "sha256:122726502a51cb4c8980674b819ee3251bf8ee69a5586d6cd44a5eafcf284cb4", "spec_path": "specs/analog/sar_switch.t27", diff --git a/specs/analog/decks/psp103_inv_be_500f.cir b/specs/analog/decks/psp103_inv_be_500f.cir index ddb03914c7..104c40c34a 100644 --- a/specs/analog/decks/psp103_inv_be_500f.cir +++ b/specs/analog/decks/psp103_inv_be_500f.cir @@ -11,6 +11,8 @@ IHP SG13G2 inverter, 500 fF, backward Euler on a fixed 100 ps grid, corner mos_t * at (k + 2) dt; step 0 starts at t = dt = 100 ps and step 200 at 201 dt = 20.1 ns. * What it prints (ngspice .meas, 6 digits, in s): tplh and tphl, the times at which the output crosses 0.75 V rising (after step 0's edge) and * falling (after step 200's edge); the delays are these minus 100 ps and minus 20.1 ns. +* M3c adds the waveform: between "BEGIN tran_be" and "END tran_be", 401 rows " TAB