Expand description
File-based subcircuit expansion (flatten pass).
Front-end only: turns a PedalDef containing use("path.pedal") instances
(declared in the components { ... } block, collected into
PedalDef::uses) into ONE flat PedalDef that the existing
compile_pedal accepts unchanged. The WDF/SPQR compiler and runtime are
never touched.
A use(...) instance is FLATTENED into the parent’s single component / net /
control list (unlike inline subcircuit { ... } blocks, which partition the
graph into separate rate-domain processors via
[crate::compiler::subcircuit] — file-based uses must NOT route through
that path).
§Namespacing
For an instance id:
- component
R3→id.R3; everyComponentPin { component, .. }is rewritten toid.component. - a bare internal node
Reserved(name)(notgnd, not a supply rail, not a declared port) →Reserved("id.name"). gndstays global.- a supply rail (
vccor a named supply of the sub) stays global by default, UNLESS the parent explicitly mapsid.<rail>to a node — then it unifies with that node (implicit-global, overridable). - a declared port
P(from the sub’sports { }, plusin/out) unifies with whatever node the parent wired toid.P. A used-but-unmapped non-rail port is a loud error.
§Controls
A sub control on component C becomes a control on id.C. A parent control
referencing id.<subctrl> re-targets/renames the namespaced sub control.
Functions§
- expand_
uses - Expand all file-based
use(...)subcircuit instances inpedalinto a single flatPedalDef. - parse_
and_ expand_ pedal_ file - Path-aware entry point: read
path, parse, and expand itsuse(...)instances relative to the file’s own directory.