Ports¶
The ports of a component are attributes with the name of the port, like gate.A and
gate.Y. Connect an output to an input with output.wire = input, and read or set a value
with port.value, either 0 or 1 (or a number for a bus), or "X" when it is unknown.
All port classes have the methods of Port. The other classes are used to write
your own components: they decide how a port updates its component and
the ports it drives.
Port
¶
Port(
parent: Component,
name: str,
width: int = 1,
output: bool = False,
)
Bases: ABC
The abstract base class for all ports
PortIn
¶
PortIn(parent: Component, name: str, width: int = 1)
Bases: PortWire
The PortIn class: * The port wire will instantaneously update the driven wires upon change. * The port will update the parent component upon change.
PortWire
¶
PortWire(
parent: Component,
name: str,
width: int = 1,
output: bool = False,
)
Bases: Port
The PortWire class: * The port wire will instantaneously update the driven wires upon change.
PortOutDelta
¶
PortOutDelta(
parent: Component,
name: str,
width: int = 1,
delay_ns: int = 1,
)
Bases: Port
The PortOutDelta class: * The port wire will update the driven wires after a delta cycle. * The port will update the parent component if the _update_parent variable is set to true.
PortOutImmediate
¶
PortOutImmediate(
parent: Component, name: str, width: int = 1
)
Bases: PortOutDelta
The PortOutImmediate class: * A special version of the PortOutDelta used for direct components (button/switch/value) * The port driver will update the driven wires immediately * The port will update the parent component if the _update_parent variable is set to true.
PortMultiBitWire
¶
PortMultiBitWire(
parent: Component,
name: str,
width: int,
output: bool = False,
)
Exceptions¶
PortConnectionError
¶
Bases: DigsimException
Exception for illegal connections