Newer
Older
Angus Lothian
committed
from b_asic.graph_component import TypeName
from b_asic.abstract_graph_component import AbstractGraphComponent
if TYPE_CHECKING:
from b_asic import OutputPort, InputPort
Angus Lothian
committed
class Signal(AbstractGraphComponent):
"""A connection between two ports."""
_source: "OutputPort"
_destination: "InputPort"
Angus Lothian
committed
def __init__(self, src: Optional["OutputPort"] = None, dest: Optional["InputPort"] = None, **kwds):
super().__init__(**kwds)
Angus Lothian
committed
@property
def source(self) -> "OutputPort":
"""Returns the source OutputPort of the signal."""
Angus Lothian
committed
def destination(self) -> "InputPort":
"""Returns the destination InputPort of the signal."""
Angus Lothian
committed
def source(self, src: "OutputPort") -> None:
"""Sets the value of the source OutputPort of the signal."""
@destination.setter
def destination(self, dest: "InputPort") -> None:
Angus Lothian
committed
"""Sets the value of the destination InputPort of the signal."""
Angus Lothian
committed
@property
def type_name(self) -> TypeName:
return "s"
Angus Lothian
committed
"""Disconnects the source OutputPort of the signal."""
Angus Lothian
committed
"""Disconnects the destination InputPort of the signal."""