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 = 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] | None = None, prefix: str = '') int | float | complex | None ¶
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)¶
Evaluate the operation and generate a list of output values.
- Parameters:
- *inputs
List of input values.
- evaluate_output(index: int, input_values: Sequence[int | float | complex], results: MutableMapping[ResultKey, int | float | complex | None] | None = None, delays: MutableMapping[ResultKey, int | float | complex] | None = None, prefix: str = '', bits_override: int | None = None, quantize: bool = True) int | float | complex ¶
Evaluate the output at the given index with the given input values.
- Parameters:
- indexint
Which output to return the value for.
- input_valuesarray of float or complex
The input values.
- resultsMutableResultMap, optional
Used to store any results (including intermediate results) for caching.
- delaysMutableDelayMap, optional
Used to get the current value of any intermediate delay elements that are encountered, and be updated with their new values.
- prefixstr, optional
Used as a prefix for the key string when storing results/delays.
- bits_overrideint, optional
Specifies a word length override when truncating inputs which ignores the word length specified by the input signal.
- quantizebool, default: True
Specifies whether input truncation should be enabled in the first place. If set to False, input values will be used directly without any bit truncation.
See also
evaluate_outputs
,current_output
,current_outputs
- 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()¶
Evaluate the operation and generate a list of output values.
- Parameters:
- *inputs
List of input values.
- 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.
See also
- 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.
See also
- 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.
- 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(_)¶
Evaluate the operation and generate a list of output values.
- Parameters:
- *inputs
List of input values.
- 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.
See also
- 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.
See also
- 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.