b_asic.utility_operations

Inheritance diagram of b_asic.utility_operations

B-ASIC Utility Operations Module.

Contains some operations that are not really operations, but needed for other reasons.

class b_asic.utility_operations.ComplexToReal(in0: SignalSourceProvider | None = None, name: str = '')

Bases: AbstractOperation

Split a complex signal into its real and imaginary parts.

Output 0 is the real part and output 1 is the imaginary part. Both outputs are real signals. Used at complex SFG interfaces by complex_to_real() with split_io=False.

Parameters:
in0SignalSourceProvider, optional

Complex input signal.

nameName, optional

Operation name.

evaluate(a, data_type=None) → tuple[int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat, int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat]

Evaluate the operation and generate a list of output values.

Parameters:
*inputs

List of input values.

data_typeDataType, optional

Data type to use for quantization during evaluation.

classmethod type_name() → TypeName

Get the type name of this graph component.

class b_asic.utility_operations.DontCare(name: str = '')

Bases: AbstractOperation

Dont-care operation.

Used for ignoring the input to another operation and thus avoiding dangling input nodes.

Parameters:
nameName, optional

Operation name.

evaluate(data_type=None) → float

Evaluate the operation and generate a list of output values.

Parameters:
*inputs

List of input values.

data_typeDataType, optional

Data type to use for quantization during evaluation.

get_input_coordinates() → tuple[tuple[float, float], ...]

Return coordinates for inputs.

These maps to the polygons and are corresponding to a start time of 0 and height 1.

get_output_coordinates() → tuple[tuple[float, float], ...]

Return coordinates for outputs.

These maps to the polygons and are corresponding to a start time of 0 and height 1.

get_plot_coordinates() → tuple[tuple[tuple[float, float], ...], tuple[tuple[float, float], ...]]

Return coordinates for the latency and execution time polygons.

This returns a tuple containing coordinates for the two polygons outlining the latency and execution time of the operation. The polygons are corresponding to a start time of 0 and are of height 1.

is_linear = True
property latency: int

Get the latency of the operation.

This is the longest time it takes from one of the input ports to one of the output ports.

classmethod type_name() → TypeName

Get the type name of this graph component.

class b_asic.utility_operations.RealToComplex(in0: SignalSourceProvider | None = None, in1: SignalSourceProvider | None = None, name: str = '')

Bases: AbstractOperation

Join real and imaginary signals into a complex signal.

Both inputs must be real. Input 0 supplies the real part and input 1 the imaginary part. Used at complex SFG interfaces by complex_to_real() with split_io=False.

Parameters:
in0, in1SignalSourceProvider, optional

Real and imaginary input signals, respectively.

nameName, optional

Operation name.

evaluate(a, b, data_type=None) → int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat

Evaluate the operation and generate a list of output values.

Parameters:
*inputs

List of input values.

data_typeDataType, optional

Data type to use for quantization during evaluation.

classmethod type_name() → TypeName

Get the type name of this graph component.

class b_asic.utility_operations.Sink(in0: SignalSourceProvider | str | None = None, name: str = '')

Bases: AbstractOperation

Sink operation.

Used for ignoring the output from another operation to avoid dangling output nodes.

Parameters:
in0SignalSourceProvider, optional

Source of the unused output. A string is accepted as a positional name for compatibility with earlier versions.

nameName, optional

Operation name.

evaluate() → None

Evaluate the operation and generate a list of output values.

Parameters:
*inputs

List of input values.

data_typeDataType, optional

Data type to use for quantization during evaluation.

get_input_coordinates() → tuple[tuple[float, float], ...]

Return coordinates for inputs.

These maps to the polygons and are corresponding to a start time of 0 and height 1.

get_output_coordinates() → tuple[tuple[float, float], ...]

Return coordinates for outputs.

These maps to the polygons and are corresponding to a start time of 0 and height 1.

get_plot_coordinates() → tuple[tuple[tuple[float, float], ...], tuple[tuple[float, float], ...]]

Return coordinates for the latency and execution time polygons.

This returns a tuple containing coordinates for the two polygons outlining the latency and execution time of the operation. The polygons are corresponding to a start time of 0 and are of height 1.

is_linear = True
property latency: int

Get the latency of the operation.

This is the longest time it takes from one of the input ports to one of the output ports.

classmethod type_name() → TypeName

Get the type name of this graph component.