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, bits: int | None = None, name: str = '')¶
Bases:
AbstractGraphComponent
A 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:
- sourceOutputPort, Signal, or Operation, optional
OutputPort, Signal, or Operation to connect as source to the signal.
- destinationInputPort, Signal, or Operation, optional
InputPort, Signal, or Operation to connect as destination to the signal.
- bitsint, optional
The word length of the signal.
- nameName, default: “”
The signal name.
See also
- property bits: int | None¶
Get the number of bits that this operation using this signal as an input should quantize received values to. None = unlimited.
- 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:
- destinationInputPort, Signal, or Operation
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.
- 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:
- sourceOutputPort, Signal, or Operation
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.
- property source: OutputPort | None¶
Return the source OutputPort of the signal.
- classmethod type_name() TypeName ¶
Get the type name of this graph component.