library ¤
Scoped model-card loading and hierarchical circuit elaboration.
Classes:
| Name | Description |
|---|---|
FileDigests | sha256 of file bytes, re-read only when |
Library | Load existing model libraries and elaborate their public subcircuits. |
ResolvedCircuit | Evaluated model cards awaiting conversion to kfnetlist and native models. |
ResolvedInstance | A leaf compact model with evaluated model and instance parameters. |
FileDigests ¤
sha256 of file bytes, re-read only when (mtime_ns, size) change.
A stamp is trusted only for files unmodified for a settling period before they were read, so an edit that keeps the size within one timestamp tick is still hashed. Hashing reads bytes only; nothing is loaded or validated.
Methods:
| Name | Description |
|---|---|
digest | Return the content digest, or |
Source code in circulax/netlist_io/library.py
digest ¤
Return the content digest, or None when the file is missing.
Source code in circulax/netlist_io/library.py
Library ¤
Library(
*,
temperature_c: float = 27.0,
include_paths: tuple[Path, ...] = (),
dialect: str = "ngspice",
statistical_mode: str = "reject"
)
Load existing model libraries and elaborate their public subcircuits.
Parameters and model cards are evaluated separately for each instance. Libraries retain their lexical scopes, local nodes and conditional branches.
Methods:
| Name | Description |
|---|---|
from_file | Read a library and select a named corner section when requested. |
include | Add a library to the same root scope, preserving declaration order. |
inspection_sources | Fingerprint actual parsed source dependencies without native loading. |
instantiate | Expand a library subcircuit without loading executable OSDI modules. |
refreshed | Reuse unchanged parsed cards or reparse edited, removed or shadowed source dependencies. |
resolve | Expand instances declared at the top level of a loaded circuit file. |
with_temperature | Reparse source declarations at a new temperature without mutation. |
Source code in circulax/netlist_io/library.py
from_file classmethod ¤
from_file(
path: str | Path,
*,
section: str | None = None,
temperature_c: float = 27.0,
include_paths: tuple[Path, ...] = (),
dialect: str = "ngspice",
statistical_mode: str = "reject"
) -> Library
Read a library and select a named corner section when requested.
statistical_mode="nominal" explicitly evaluates agauss at its nominal value. The default rejects random functions; sampling is unsupported.
Source code in circulax/netlist_io/library.py
include ¤
Add a library to the same root scope, preserving declaration order.
Source code in circulax/netlist_io/library.py
inspection_sources ¤
Fingerprint actual parsed source dependencies without native loading.
Source code in circulax/netlist_io/library.py
instantiate ¤
instantiate(
subcircuit: str,
nodes: tuple[str, ...] | None = None,
settings: dict[str, float] | None = None,
*,
name: str = "X1"
) -> ResolvedCircuit
Expand a library subcircuit without loading executable OSDI modules.
Source code in circulax/netlist_io/library.py
refreshed ¤
refreshed() -> Library
Reuse unchanged parsed cards or reparse edited, removed or shadowed source dependencies.
Source code in circulax/netlist_io/library.py
resolve ¤
resolve() -> ResolvedCircuit
Expand instances declared at the top level of a loaded circuit file.
Source code in circulax/netlist_io/library.py
with_temperature ¤
Reparse source declarations at a new temperature without mutation.
Source code in circulax/netlist_io/library.py
ResolvedCircuit dataclass ¤
ResolvedCircuit(
instances: list[ResolvedInstance],
loads: list[tuple[str, Path]],
ports: dict[str, str] = dict(),
temperature_c: float = 27.0,
)
Evaluated model cards awaiting conversion to kfnetlist and native models.
This intermediate retains ordered terminals and load declarations needed for OSDI provisioning. Compilation builds the canonical kfnetlist.Netlist.
Methods:
| Name | Description |
|---|---|
compile | Compile with immutable native analysis mode: dc (default), ac, or tran. |
compile ¤
compile(
*,
module_paths: tuple[Path, ...] = (),
osdi_modules: tuple[Path, ...] = (),
compiler: str | None = None,
cache_dir: Path | None = None,
backend: str = "dense",
analysis: str = "dc",
state_policy: str = "reject",
simparams: Mapping[str, float] | None = None
) -> Any
Compile with immutable native analysis mode: dc (default), ac, or tran.
simparams supplies numeric $simparam settings to all native devices. Separate registrations are required to change mode. For AC, retain DC conductance and obtain capacitance from an AC registration.
osdi_modules registers compiled .osdi/.va files by their own descriptor name directly, for libraries (e.g. plain ngspice model cards) that reference a module by name without a load statement.