b_asic.sfg_generators¶
B-ASIC signal flow graph generators.
This module contains a number of functions generating SFGs for specific functions.
- b_asic.sfg_generators.analytical_block_matrix_inverse(N: int, name: str | None = None, mode: str = 'mid', pe: str | None = None) SFG¶
Generate an SFG for the analytical block matrix inverse algorithm.
- Parameters:
- Nint
Dimension of the square input matrix.
- namestr, optional
The name of the SFG. If None, “Analytical block matrix-inversion”.
- modestr, default: “mid”
The mode of operation, either “top”, “bot”, or “mid”.
- pestr, optional
Processing element to use. Can be “mads”, “addsub”, or None.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.block_cholesky_matrix_inverse(N: int, name: str | None = None, mode: str = 'eqs', pe: str | None = None) SFG¶
Generate an SFG for the block Cholesky matrix inverse algorithm.
- Parameters:
- Nint
Dimension of the square input matrix.
- namestr, optional
The name of the SFG. If None, “Block Cholesky matrix-inversion”.
- modestr, default: “eqs”
The mode of operation, either “mult” or “eqs”.
- pestr, optional
Processing element to use. Currently only None is supported.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.block_ldlt_matrix_inverse(N: int, name: str | None = None, mode: str = 'eqs', pe: str | None = None) SFG¶
Generate an SFG for the block LDLT matrix inverse algorithm.
- Parameters:
- Nint
Dimension of the square input matrix.
- namestr, optional
The name of the SFG. If None, “Block LDLT matrix-inversion”.
- modestr, default: “eqs”
The mode of operation, either “mult” or “eqs”.
- pestr, optional
Processing element to use. Can be “mads”, “addsub”, or None.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.cholesky_matrix_inverse(N: int, name: str | None = None, mode: str = 'eqs', pe: str | None = None) SFG¶
Generate an SFG for the Cholesky matrix inverse algorithm.
- Parameters:
- Nint
Dimension of the square input matrix.
- namestr, optional
The name of the SFG. If None, “Cholesky matrix-inversion”.
- modestr, default: “eqs”
The mode of operation, either “mult” or “eqs”.
- pestr, optional
Processing element to use. Can be “mads”, “addsub”, or None.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.direct_form_1_iir(b: Sequence[complex], a: Sequence[complex], name: str | None = None, mult_properties: dict[str, int] | dict[str, dict[str, int]] | None = None, add_properties: dict[str, int] | dict[str, dict[str, int]] | None = None) SFG¶
Generate a direct-form IIR filter of type I with coefficients a and b.
- b_asic.sfg_generators.direct_form_2_iir(b: Sequence[complex], a: Sequence[complex], name: str | None = None, mult_properties: dict[str, int] | dict[str, dict[str, int]] | None = None, add_properties: dict[str, int] | dict[str, dict[str, int]] | None = None) SFG¶
Generate a direct-form IIR filter of type II with coefficients a and b.
- b_asic.sfg_generators.fir(coefficients: Sequence[complex], name: str | None = None, symmetric: bool = False, transposed: bool = False, mult_properties: dict[str, int] | dict[str, dict[str, int]] | None = None, add_properties: dict[str, int] | dict[str, dict[str, int]] | None = None) SFG¶
Generate a signal flow graph of an FIR filter.
The coefficients parameter is a sequence of impulse response values:
coefficients = [h0, h1, h2, ..., hN]
Leading to the transfer function:
\[\sum_{i=0}^N h_iz^{-i}\]- Parameters:
- coefficients1D-array
Coefficients to use for the FIR filter section.
- nameName, optional
The name of the SFG. If None, “Direct-form FIR filter”.
- symmetricbool, optional
Whether to generate a symmetric FIR structure.
- transposedbool, optional
Whether to generate a transposed FIR structure.
- mult_propertiesdictionary, optional
Properties passed to
ConstantMultiplication.- add_propertiesdictionary, optional
Properties passed to
Addition.
- Returns:
- Signal flow graph
- b_asic.sfg_generators.lattice_wdf(coefficients: Sequence[float], name: str | None = None, only_adaptors: bool = False) SFG¶
Generate a signal flow graph of a lattice wave digital filter.
- Parameters:
- coefficients1D-array
Adaptor coefficients, interleaved between the two allpass branches.
- namestr, optional
Name of the SFG. Defaults to
"Lattice WDF".- only_adaptorsbool, optional
If True, use an adaptor for the final addition and scaling.
- Returns:
- SFG
Signal flow graph of the lattice WDF.
- b_asic.sfg_generators.ldlt_matrix_inverse(N: int, name: str | None = None, mode: str = 'eqs', pe: str | None = None) SFG¶
Generate an SFG for the LDLT matrix inverse algorithm.
- Parameters:
- Nint
Dimension of the square input matrix.
- namestr, optional
The name of the SFG. If None, “LDLT matrix-inversion”.
- modestr, default: “eqs”
The mode of operation, either “mult” or “eqs”.
- pestr, optional
Processing element to use. Can be “mads”, “addsub”, or None.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.matrix_multiplication(m: int, n: int, p: int, name: str | None = None, mad_properties: dict[str, int] | dict[str, dict[str, int]] | None = None) SFG¶
Generate a structure for the multiplication of matrices A and B. Where A is of size \(m \times n\) and B \(n \times p\).
- Parameters:
- mint
Number of rows in A.
- nint
Number of columns in A (and rows in B).
- pint
Number of columns in B.
- nameName, optional
The name of the SFG. If None, “Matrix-multiplication”.
- mad_propertiesdictionary, optional
Properties passed to
MAD.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.radix_2_dif_fft(points: int) SFG¶
Generate a radix-2 decimation-in-frequency FFT structure.
- Parameters:
- pointsint
Number of points for the FFT, needs to be a positive power of 2.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.tile_ldlt_matrix_inverse(N: int, name: str | None = None, mode: str = 'eqs', pe: str | None = None) SFG¶
Generate an SFG for the tile LDLT matrix inverse algorithm.
- Parameters:
- Nint
Dimension of the square input matrix.
- namestr, optional
The name of the SFG. If None, “Tile LDLT matrix-inversion”.
- modestr, default: “eqs”
The mode of operation, either “mult” or “eqs”.
- pestr, optional
Processing element to use. Can be “mads”, “addsub”, or None.
- Returns:
- SFG
Signal Flow Graph
- b_asic.sfg_generators.wdf_allpass(coefficients: Sequence[float], name: str | None = None, latency: int | None = None, latency_offsets: dict[str, int] | None = None, execution_time: int | None = None) SFG¶
Generate a signal flow graph of a WDF allpass section based on symmetric two-port adaptors.
Simplifies the SFG in case an adaptor operation is 0.
- Parameters:
- coefficients1D-array
Coefficients to use for the allpass section.
- nameName, optional
The name of the SFG. If None, “WDF allpass section”.
- latencyint, optional
Latency of the symmetric two-port adaptors.
- latency_offsetsoptional
Latency offsets of the symmetric two-port adaptors.
- execution_timeint, optional
Execution time of the symmetric two-port adaptors.
- Returns:
- SFG
Signal Flow Graph