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.Compression(factor: int = 2, in0: SignalSourceProvider | None = None, name: str = '', *, phase: int = 0)¶
Bases:
_RateChangeReduce the sample rate by retaining every factor:th sample.
The output is
y[n] = x[factor * n + phase].- Parameters:
- factorint, default: 2
Positive integer compression factor.
- in0
SignalSourceProvider, optional Input stream.
- name
Name, optional Operation name.
- phaseint, default: 0
Retained phase, in the range
0 <= phase < factor.
Notes
Simulate graphs containing this operation with
Simulation. Useto_single_rate()before scheduling.
- class b_asic.special_operations.Delay(in0: SignalSourceProvider | None = None, initial_value: int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat = 0, name: str = '')¶
Bases:
AbstractOperationUnit delay operation.
Represents a delay of one iteration. The initial value is zero unless otherwise specified.
- Parameters:
- in0
SignalSourceProvider, optional The node to be delayed.
- initial_valueNumber, default: 0
Initial value of the delay.
- name
Name, default “” Name.
- in0
- current_output(index: int, delays: Mapping[ResultKey, int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat] | None = None, prefix: str = '') int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat | 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, data_type, delays=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_type
DataType, optional Data type to use for quantization during evaluation.
- property initial_value: int | float | complex | DTypeLike | APyFixed | APyCFixed | APyFloat | APyCFloat¶
Get the initial value of this delay.
- is_linear = True¶
- class b_asic.special_operations.Expansion(factor: int = 2, in0: SignalSourceProvider | None = None, name: str = '', *, phase: int = 0)¶
Bases:
_RateChangeIncrease the sample rate by an integer factor using zero insertion.
The output is
y[factor * n + phase] = x[n]; all other samples are zero. Filtering, when needed, is represented by separate operations.- Parameters:
- factorint, default: 2
Positive integer expansion factor.
- in0
SignalSourceProvider, optional Input stream.
- name
Name, optional Operation name.
- phaseint, default: 0
Nonzero phase, in the range
0 <= phase < factor.
Notes
Simulate graphs containing this operation with
Simulation. Useto_single_rate()before scheduling.
- class b_asic.special_operations.Input(name: str = '')¶
Bases:
AbstractOperationInput operation.
Represents an input port to an SFG. Its value will be updated on each iteration when simulating the SFG.
- Parameters:
- name
Name, optional Operation name.
- name
- evaluate(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_type
DataType, 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.
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¶
- class b_asic.special_operations.MemoryRead(address: int = 0, memory_name: str = '', name: str = '', latency: int = 0)¶
Bases:
InputRead a value from a memory address.
Behaves as an
Inputwith an address and an optional memory name. During simulation, values are supplied through the SFG input mechanism. The address and memory name identify the memory location symbolically.- Parameters:
- addressint, default: 0
Read address.
- memory_name
Name, optional Memory name. An empty name denotes the default memory.
- name
Name, optional Operation name.
- latencyint, default: 0
Cycles between presenting the read address and obtaining the value. The operation starts when the address is presented, and its value output has this latency offset.
- class b_asic.special_operations.MemoryWrite(address: int = 0, in0: SignalSourceProvider | None = None, memory_name: str = '', name: str = '')¶
Bases:
OutputWrite a value to a memory address.
Behaves as an
Outputwith an address and an optional memory name. During simulation, values are collected through the SFG output mechanism. The address and memory name identify the memory location symbolically.- Parameters:
- addressint, default: 0
Write address.
- in0
SignalSourceProvider, optional The signal to write.
- memory_name
Name, optional Memory name. An empty name denotes the default memory.
- name
Name, optional Operation name.
- class b_asic.special_operations.Output(in0: SignalSourceProvider | None = None, name: str = '')¶
Bases:
AbstractOperationOutput operation.
Represents an output port to an SFG. The SFG will forward its input to the corresponding output signal destinations.
- Parameters:
- in0
SignalSourceProvider, optional The signal connected to the Output operation.
- name
Name, optional Operation name.
- in0
- evaluate(_, data_type) None¶
Evaluate the operation and generate a list of output values.
- Parameters:
- *inputs
List of input values.
- data_type
DataType, 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.
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¶