nets module#

Resolve JITX nets to the TO.N attribute every conducting object carries.

The spec recommends .N on all copper objects because “the absence of the .N attribute does not mean there is no net and is therefore ambiguous”, so copper that is genuinely on no net gets the reserved empty value %TO.N,*% rather than no attribute at all.

Net names are not mangled here. The X2 field escaping in format.model already turns every reserved character into a uXXXX escape, so a name reaches the file intact and two names that differ cannot be collapsed into one by a sanitizer.

EMPTY_NET = ''#

an object genuinely on no net.

Type:

The reserved %TO.N,*% value

SYNTHETIC_PREFIX = 'N$'#

Prefix for a name synthesized for a net object that arrived unnamed.

net_attribute(names)[source]#

TO.N for an object spanning a known set of nets.

An empty set, or one holding only unconnected copper, is the reserved empty value: the spec calls omitting the attribute ambiguous, so netless copper says so explicitly rather than staying silent. Several names is 5.6.13’s list form, which describes an object whose parts lie on different nets.

Return type:

tuple[str, tuple[str, ...]]

Parameters:

names (Sequence[str | None])

class NetResolver(design)[source]#

Bases: object

Net names for design objects, and the TO.N attribute for them.

Two situations look identical at the call site and are kept apart, which is the whole reason this class exists:

  • No net object at all is unconnected copper - tooling pads, isolated islands, logos - and takes the reserved empty value.

  • A net object with no name should not occur, because connected nets are named by the runtime one way or another. Collapsing it to the empty value would assert that connected copper is isolated, which is both wrong and invisible downstream, so a deterministic name is synthesized and the occurrences are counted into the run log.

Parameters:

design (RuntimeDesign)

name(element)[source]#

The net name for an element, or None when it is on no net.

None means the design has no net object for the element, which is what the empty .N value describes. It never means “unnamed”.

Return type:

str | None

Parameters:

element (object)

attribute(element)[source]#

The TO.N attribute for one conducting object.

Return type:

tuple[str, tuple[str, ...]]

Parameters:

element (object)

names_attribute(names)[source]#

TO.N for an object spanning a known set of nets.

Return type:

tuple[str, tuple[str, ...]]

Parameters:

names (Sequence[str | None])

report()[source]#

Log the defensive branch if it fired.

A synthesized name is not an error, but it means the runtime handed back a net with no name, so it should be visible in the run log rather than silently absorbed into the output.

Return type:

None