b_asic.signal¶
B-ASIC Signal Module.
Contains the class for representing the connections between operations.
- class b_asic.signal.Signal(source: OutputPort | Signal | Operation | None = None, destination: InputPort | Signal | Operation | None = None, name: str = '')¶
Bases:
AbstractGraphComponentA connection between two ports.
Note
If a Signal is provided as source or destination, the connected port is used. Hence, if the argument signal is later changed, it will not affect the current Signal.
- Parameters:
See also
- property neighbors: Iterable[GraphComponent]¶
Return a list of the (up to) two operations connected to this signal.
- remove_source() None¶
Disconnect the source OutputPort of the signal.
If the source port still is connected to this signal then also disconnect the source port.
- set_destination(destination: InputPort | Signal | Operation) None¶
Connect to the entered destination InputPort.
Also, disconnect the previous destination InputPort of the signal and connect the entered destination port to the signal if it has not already been connected.
- Parameters:
- destination
InputPort,Signal, orOperation InputPort, Signal, or Operation to connect as destination to the signal. If Signal, it will connect to the destination of the signal, so later on changing the destination of the argument Signal will not affect this Signal. If Operation, it must have a single input, otherwise a TypeError is raised.
- destination
- set_source(source: OutputPort | Signal | Operation) None¶
Connect to the entered source OutputPort.
Also, disconnect the previous source OutputPort of the signal and connect the entered source port to the signal if it has not already been connected.
- Parameters:
- source
OutputPort,Signal, orOperation OutputPort, Signal, or Operation to connect as source to the signal. If Signal, it will connect to the source of the signal, so later on changing the source of the argument Signal will not affect this Signal. If Operation, it must have a single output, otherwise a TypeError is raised. That output is used to extract the OutputPort.
- source
- property source: OutputPort | None¶
Return the source OutputPort of the signal.