Fix: nominal temperature Tnom runs at 0 °C — init param misrouted to hidden_state slot#145
Open
Gerd-Vandersteen wants to merge 1 commit into
Open
Fix: nominal temperature Tnom runs at 0 °C — init param misrouted to hidden_state slot#145Gerd-Vandersteen wants to merge 1 commit into
Gerd-Vandersteen wants to merge 1 commit into
Conversation
Author
|
Companion PR: #144 fixes the device temperature ( |
…4 params corrupted)
An init param sources its runtime *value* from the eval input slot of the same name.
A model can expose several eval slots that collide under .lower(): a value `param`,
its `param_given` flag, and a `hidden_state` cache slot. EKV exposes `TNOM` (param)
and `Tnom` (hidden_state); BSIM4 exposes all three for `tnom`, `vth0`, `u0`, ...
The map `eval_name_to_idx = {n.lower(): i ...}` was last-wins, so an init value-param
could source from the hidden_state slot (an init *output*, pre-initialized to 0.0) or
the given-flag (0/1) instead of the value — silently corrupting it. On EKV this ran the
nominal temperature at Tnom = 0 + P_CELSIUS0 = 273.15 K instead of DEFAULT_TNOM = 25 C;
on BSIM4 it corrupted 176 params (NaN DC solve).
Fix: rank collisions by preference so a value-param always reads its value —
value-input (param/temperature/voltage/implicit_unknown/sysfun) > param_given >
hidden_state; last-wins within a tier. Also default un-given tnom/tref/tr to the
-`NOT_GIVEN sentinel so the model selects its own DEFAULT_TNOM.
Evidence: EKV Id at Vg=0.7,Vd=1.0 goes 7.17 -> 5.9588 uA, matching an independent
VACASK/OSDI run of the same .va exactly (ratio 1.0000); all d(Id)/dtheta match to 0.00%.
Companion PR fixes the device temperature (TEMP); this PR is independent of it.
38a9e8d to
46759eb
Compare
Author
|
Updated (force-push): generalized the collision fix after BSIM4 bring-up surfaced a third case — a model can expose a value |
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.
Problem
A model's nominal temperature
Tnomcan silently run at 0 °C instead of its intendeddefault (e.g. EKV's
DEFAULT_TNOM = 25 °C), mis-scaling everypow(ratioT, BEX)mobility/thresholdtemperature correction.
Root cause is a case-insensitive parameter-name collision in the init→eval index map
(
vajax/analysis/openvaf_models.py,compile_openvaf_models). A model can expose both an inputparam and a same-named hidden_state cache slot that collide when lowercased — EKV exposes input
TNOM(kind=param) and hidden_stateTnom(kind=hidden_state). The map was built last-wins:so
'tnom'resolved to the hidden_state slot. Init params are inputs, but the generated initfunction then sourced
TNOM's value from that hidden_state slot — pre-initialized to 0.0 — sothe model computed
Tnom = 0 +P_CELSIUS0 = 273.15 K`.Fix
Two changes:
(
param/param_given/temperature/voltage/implicit_unknown/sysfun) overhidden_state,while preserving legacy last-wins among entries of the same preference (so a
paramand itsparam_giventwin are untouched). This is the load-bearing fix — init inputs must never sourcefrom a hidden_state (init-output) slot.
tnom/tref/trfall back to the-\NOT_GIVENsentinel (model_defaults.get(pname, 1e21)) so the model selects its ownDEFAULT_TNOM`.Evidence
EKV
IdatVg=0.7, Vd=1.0goes7.17 → 5.9588 µA, matching an independent VACASK/OSDI run of thesame
.vaexactly (ratio 1.0000); everyd(Id)/dθmatches to 0.00%.Blast radius (compiled all 11 bundled models): every mapping the fix changes is
hidden_state → input— the same shadowed-input bug —ekv(TNOM),bsimimg(WR, TNOM),bsimcmg(RHORSD, TNOM, NVTM, CGSP, CGDP),
bsimbulk(RBxx, TNOM),hisim2(mfactor, NFALP1/2, NSUBD/NW).There are no
param ↔ param_givenflips. All are latent "init input silently read as 0.0" bugs,so the promotion is strictly a correctness improvement (these models were not previously
numerically re-validated against VACASK — worth a look during their bring-up).
Note
The cleanest upstream fix for the default half would be teaching openvaf_py
get_param_defaults()to emit sentinel/computed defaults, so the runtime fallback need never guess. The map fix (change 1)
is independent of that and is the essential correctness fix. A companion PR fixes the device
temperature (
TEMP); this PR is independent of it.