Copyright © Peter Brett 2015
This work is licensed under a Creative Commons Attribution 4.0 International License.
Each circuit has subcircuits, i.e. a circuit can instantiate another circuit as a circuit instance.
Each circuit has attributes that can can have instance-specific values. For example, the "refdes" of physical parts on a PCB need to be uniquely and flatly numbered across the design, no matter how deep the hierarchy.
This introduces complications, as follows.
-
Consider a circuit
A
. It is instantiated twice in circuitB
. That means that two instances are needed:B→A1
andB→A2
. -
Consider another circuit
C
that instantiatesB
twice. Now there are 6 instances needed:C→B1→A1
,C→B1→A2
,C→B2→A1
, andC→B2→A2
.
It might be conceptually clearer if we get rid of circuits altogether, and only have circuit instances.
Each instance can either be an overlay, in which case it's derived from another instance, or a root, which isn't derived from anything.
Each instance also contains children. Children must be overlays. If an overlay Y
is derived from an instance X
, then Y
must have exactly one child derived from each child of X
.
Overall, this means that each root contains an instance for each subcircuit instantiated at every level of the design, and this ensures that there's a place to attach attributes to every element in the design.
Suppose that there's a root A
, and it's instantiated by B
. The instance diagram is:
A B
⇩
AB1 → B
To evaluate an attribute:
- find the path of the instance that you want to evaluate the attribute for (e.g.
A⇨AB1
) - get the derivation list for the instance (e.g.
AB1→B
) - walk the derivation list until you find a value for the attribute.
The instance diagram is:
C B A
⇩ ⇩
CB1 → B CB2 → B BA1 → A
⇩ ⇩ BA2 → A
CB1A1 → BA1 → A CB2A1 → BA1 → A
CB1A2 → BA2 → A CB2A2 → BA2 → A
In the PCB design for C
, the designer assigns a refdes to each instance of A
. These can be attached to the instances CB1A1
, CB1A2
, CB2A1
, and CB2A2
.
The instance-only design allows full back-annotation and full hierarchy.
A circuit has ports. These are ways that instances of the circuit can be connected into the netlist. For example, a circuit that represents a resistor would have a port for each of the resistor's pins.
Like circuit instances, there are similarly root ports and overlay ports. A root instance has a list of root ports, and an overlay instance has a list of overlay ports. An overlay instance has exactly one overlay port for each port in the instance it was derived from.
This setup allows attributes to be attached to ports at any level in the hierarchy.
Unresolved: Does this scheme cause issues with netlist resolution?