b_asic.special_operations

Inheritance diagram of b_asic.special_operations

B-ASIC Special Operations Module.

Contains operations with special purposes that may be treated differently from normal operations in an SFG.

class b_asic.special_operations.Delay(src0: SignalSourceProvider | None = None, initial_value: int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | APyFixed | APyCFixed | APyFloat | APyCFloat = 0, name: str = '')

Bases: AbstractOperation

Unit delay operation.

Represents a delay of one iteration. The initial value is zero unless otherwise specified.

Parameters:
src0SignalSourceProvider, optional

The node to be delayed.

initial_valueNumber, default: 0

Initial value of the delay.

nameName, default “”

Name.

current_output(index: int, delays: Mapping[ResultKey, int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | APyFixed | APyCFixed | APyFloat | APyCFloat] | None = None, prefix: str = '') int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | APyFixed | APyCFixed | APyFloat | APyCFloat

Get the current output at the given index of this operation, if available.

The delays parameter will be used for lookup. The prefix parameter will be used as a prefix for the key string when looking for delays.

See also

current_outputs, evaluate_output, evaluate_outputs
evaluate(a, data_type, delays=None) int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | 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.

property initial_value: int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | APyFixed | APyCFixed | APyFloat | APyCFloat

Get the initial value of this delay.

is_linear = True
classmethod type_name() TypeName

Get the type name of this graph component.

class b_asic.special_operations.Input(name: str = '')

Bases: AbstractOperation

Input operation.

Represents an input port to an SFG. Its value will be updated on each iteration when simulating the SFG.

Parameters:
nameName, optional

Operation name.

evaluate(data_type=None) int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | 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.

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_constant = False
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.

property value: int | float | complex | type[Any] | dtype[Any] | _SupportsDType[dtype[Any]] | tuple[Any, Any] | list[Any] | _DTypeDict | str | None | APyFixed | APyCFixed | APyFloat | APyCFloat

Get the current value of this input.

class b_asic.special_operations.Output(src0: SignalSourceProvider | None = None, name: str = '')

Bases: AbstractOperation

Output operation.

Represents an output port to an SFG. The SFG will forward its input to the corresponding output signal destinations.

Parameters:
src0SignalSourceProvider, optional

The signal connected to the Output operation.

nameName, optional

Operation name.

evaluate(_, data_type) 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.