Unit-Safe Circuit Decks: Dimensional Type Inference for SPICE Netlists and Verilog-A Models that Catches Scale-Suffix, Unit and Parameter-Binding Errors before Simulation
Circuit decks are among the last widely used engineering programs with no notion of physical units. In SPICE syntax, letters that follow a number and are not scale factors are silently ignored, the suffix means milli rather than mega, and a parameter expression may combine a time constant with a resistance without any check that the result is a capacitance. Behavioural models in Verilog-A attach unit strings to natures, but the dimensional consistency of their expressions is not checked. Errors of this kind simulate without complaint and produce plausible but wrong results. This paper proposes dimensional type inference for circuit decks: a static checker that (i) keeps, instead of discarding, the unit letters of every numeric literal; (ii) generates dimension constraints from element bindings, parameter expressions, subcircuit interfaces and behavioural expressions; (iii) solves them as linear equations over the rational exponent vectors of the SI base dimensions, which gives principal dimensions for every parameter and pinpoints inconsistent ones; and (iv) adds a configurable magnitude-plausibility layer that flags values whose dimension is correct but whose scale is implausible for the element and technology. The checker runs before simulation, needs no change to the simulator, handles compact models through gradual typing, and returns explanations that show the chain of bindings leading to each error. We formalise the rules, show how they extend to the MNA system for dimension-aware scaling, and outline an evaluation on open netlists and models. Concept/architecture paper analysed with symbolic models; no simulation was run and no measured results are claimed. Any numerical values quoted come from the cited sources. Simulation-based validation is planned for a follow-up paper. Self-drawn figures (scripts/make_figs.py). AI-assisted drafting; the author is responsible for the content.
Authors
- I-Wei Tseng
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-25
- DOI
- https://doi.org/10.5281/zenodo.24535603
- Primary Topic
- Logic, programming, and type systems
- Type
- preprint