Edge AI Add-on API 2.2.0
Loading...
Searching...
No Matches
nrf_axon_dsp_intrinsics.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "nrf_axon_driver.h"

Go to the source code of this file.

Macros

#define NRF_AXON_DSP_VECTOR_MULTPLE   (4)
 Axon dsp intrinsic vector lengths must be a multiple of 4.
 
#define NRF_AXON_DSP_VECTOR_LENGTH_CEIL(vector_length)
 

Enumerations

enum  AxonRoundingEnum { kAxonRoundingNone = 0 , kAxonRoundingMax = 32 }
 

Functions

nrf_axon_result_e nrf_axon_fft_24 (const int32_t *in_ptr, int32_t *out_ptr, uint16_t length_log2, bool half_output, bool round_by_length_log2, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 Performs a 24bit (unpacked) complex FFT. complex numbers are stored in pairs, real component, imaginary component. length_log2 is log2(fft length). (ie, fft length=1<<length_log2). For a real FFT, imaginary coefficients must be set to 0.
 
nrf_axon_result_e nrf_axon_fft_power_24 (const int32_t *in_ptr, int32_t *out_ptr, uint16_t length_log2, bool half_output, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 Performs a 24bit (unpacked) complex FFT, then sums the squares of the complex coefficients, and divides by fft length. complex numbers are stored in pairs, real component, imaginary component. length_log2 is log2(fft length). (ie, fft length=1<<length_log2). For a real FFT, imaginary coefficients must be set to 0.
 
nrf_axon_result_e nrf_axon_fir_24_24_24 (const int32_t *in_ptr, const int32_t *filter_ptr, int32_t *out_ptr, uint16_t input_length, uint16_t filter_length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter. Filter coefficients are MAC'd with the input in reverse order. ie, for filter length F, output x[n] = input[n-F]*filter[F-1] + input[n-F-1]*filter[F-2]+...input[n-1]*filter[0]. The filter output starts at outptr+ filter_length. out_ptr[0..filter_length-1] are written to but should be discarded.
 
nrf_axon_result_e nrf_axon_fir_24_16_24 (const int32_t *in_ptr, const int16_t *filter_ptr, int32_t *out_ptr, uint16_t input_length, uint16_t filter_length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter. Filter coefficients are MAC'd with the input in reverse order. ie, for filter length F, output x[n] = input[n-F]*filter[F-1] + input[n-F-1]*filter[F-2]+...input[n-1]*filter[0]. The filter output starts at outptr+ filter_length. out_ptr[0..filter_length-1] are written to but should be discarded. Input is int24, filter is int16, and output is int24.
 
nrf_axon_result_e nrf_axon_sqrt_24 (const int32_t *in_ptr, int32_t *out_ptr, uint16_t length, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Sqrt"=> "Square Root" Calculates a the square root of vector input, output=SQRT(input). Note that the radix of the result is half the radix of the input.
 
nrf_axon_result_e nrf_axon_logn_11p12 (const int32_t *in_ptr, int32_t *out_ptr, uint16_t length, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "logn"=> "Natural Log" Calculates the natural log of vector input, output=ln(input). Input and output are both interpreted as q11.12. If the input radix doesn't match 11.12, then an offset can be added to the output to correct the result for radix 12. For an input radix "r", the offset to add is ln(2^^r) << 12.
 
nrf_axon_result_e nrf_axon_exp_11p12 (const int32_t *in_ptr, int32_t *out_ptr, uint16_t length, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "exp"=> "exponent" (e to the x) Calculates the exponent of vector input, output=exp(input). Input and output are both interpreted as q11.12. If the input radix isn't 11.12, there is no analogous way to logn() to correct the output. (ie, one can't add or multiple by an offset to correct the result). The effective input range (without saturation) is -8.3 to 7.46
 
nrf_axon_result_e nrf_axon_xspys_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Xspys"=>"X Squared Plus Y Squared" adds the square of vector Y to the square of vector X.
 
nrf_axon_result_e nrf_axon_xspys_24_24_24_input_stride2 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Xspys"=>"X Squared Plus Y Squared" adds the square of vector Y to the square of vector X. input_stride2 indicates that the input vectors will skip every other entry. This is useful for calculating fft power, as the x vector can be the real components, and the y vector can by the imaginary components.
 
nrf_axon_result_e nrf_axon_xsmys_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Xsmys"=>"X Squared Minus Y Squared" subtracts the square of vector Y from the square of vector X.
 
nrf_axon_result_e nrf_axon_xty_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Xty"=>"X Times Y " multiplies vector X and vector Y.
 
nrf_axon_result_e nrf_axon_xpy_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Xpy"=>"X Plus Y " vector adds vector X and vector Y.
 
nrf_axon_result_e nrf_axon_xmy_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Xmy"=>"X Minus Y" subtracts vector Y from vector X.
 
nrf_axon_result_e nrf_axon_axpb_24_24 (const int32_t *x_ptr, const int32_t *a_scalar, const int32_t *b_scalar, int32_t *output, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "axpb"=>"a times x + b" Multiplies eache vector value by "a" and adds "b"
 
nrf_axon_result_e nrf_axon_axpby_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, const int32_t *a_scalar, const int32_t *b_scalar, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "axpby"=>"a times x + b times y" Multiplies each x vector value by "a" and adds the product of "b" and the corresponding y vector value.
 
nrf_axon_result_e nrf_axon_xs_24_24 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "xs"=>"x squared" Each vector value is multiplied by itself
 
nrf_axon_result_e nrf_axon_mar_24_24_32 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Mar" => "Multiply, Accumulate, recursive" sums the products of elements in input vector X and input vector Y (ie, dot product)
 
nrf_axon_result_e nrf_axon_mar_16_24_32 (const int16_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Mar" => "Multiply, Accumulate, recursive" sums the products of elements in input vector X and input vector Y (ie, dot product)
 
nrf_axon_result_e nrf_axon_mar_16_16_32 (const int16_t *x_ptr, const int16_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Mar" => "Multiply, Accumulate, recursive" sums the products of elements in input vector X and input vector Y (ie, dot product)
 
nrf_axon_result_e nrf_axon_mar_24_24_24 (const int32_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Mar" => "Multiply, Accumulate, recursive" sums the products of elements in input vector X and input vector Y (ie, dot product)
 
nrf_axon_result_e nrf_axon_mar_16_24_24 (const int16_t *x_ptr, const int32_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Mar" => "Multiply, Accumulate, recursive" sums the products of elements in input vector X and input vector Y (ie, dot product)
 
nrf_axon_result_e nrf_axon_mar_16_16_24 (const int16_t *x_ptr, const int16_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Mar" => "Multiply, Accumulate, recursive" sums the products of elements in input vector X and input vector Y (ie, dot product)
 
nrf_axon_result_e nrf_axon_marx_24_32 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Marx" => "Multiply, Accumulate, recursive, only reload the x vector" sums the products of elements in input vector X and input vector Y (ie, dot product) The y vector must have been pre-loaded using a Mar operation immediately before the 1st Marx.
 
nrf_axon_result_e nrf_axon_marx_16_32 (const int16_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Marx" => "Multiply, Accumulate, recursive, only reload the x vector" sums the products of elements in input vector X and input vector Y (ie, dot product) The y vector must have been pre-loaded using a Mar operation immediately before the 1st Marx.
 
nrf_axon_result_e nrf_axon_marx_24_24 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Marx" => "Multiply, Accumulate, recursive, only reload the x vector" sums the products of elements in input vector X and input vector Y (ie, dot product) The y vector must have been pre-loaded using a Mar operation immediately before the 1st Marx.
 
nrf_axon_result_e nrf_axon_marx_16_24 (const int16_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Marx" => "Multiply, Accumulate, recursive, only reload the x vector" sums the products of elements in input vector X and input vector Y (ie, dot product) The y vector must have been pre-loaded using a Mar operation immediately before the 1st Marx.
 
nrf_axon_result_e nrf_axon_acc_24_32 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Acc" => "Accumulate" sums the elements in vector X
 
nrf_axon_result_e nrf_axon_acc_16_32 (const int16_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Acc" => "Accumulate" sums the elements in vector X
 
nrf_axon_result_e nrf_axon_acc_24_24 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Acc" => "Accumulate" sums the elements in vector X
 
nrf_axon_result_e nrf_axon_acc_16_24 (const int16_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "Acc" => "Accumulate" sums the elements in vector X
 
nrf_axon_result_e nrf_axon_l2norm_24_32 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "l2norm" => sums the square of the elements in vector X
 
nrf_axon_result_e nrf_axon_l2norm_16_32 (const int16_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "l2norm" => sums the square of the elements in vector X
 
nrf_axon_result_e nrf_axon_l2norm_24_24 (const int32_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "l2norm" => sums the square of the elements in vector X
 
nrf_axon_result_e nrf_axon_l2norm_16_24 (const int16_t *x_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "l2norm" => sums the square of the elements in vector X
 
nrf_axon_result_e nrf_axon_xty_16_16_32 (const int16_t *x_ptr, const int16_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 vector multiplies 2 16bit vectors to produce a 32bit vector
 
nrf_axon_result_e nrf_axon_xty_16_16_32_output_stride (const int16_t *x_ptr, const int16_t *y_ptr, int32_t *out_ptr, uint16_t length, uint8_t rounding_bits, uint8_t output_extra_stride, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 vector multiplies 2 16bit vectors to produce a 32bit vector, with option to have unpacked output vector.
 
nrf_axon_result_e nrf_axon_memset_32_output_stride (int16_t set_val, int32_t *out_ptr, uint16_t length, uint8_t output_extra_stride, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 Sets 32bit words with the value in set_val (which is limited to 16bits, but sign extended to 32bits).
 
nrf_axon_result_e nrf_axon_saturate_32_24 (const int32_t *in_ptr, int32_t *out_ptr, uint16_t length, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 Saturates a 32bit vector to 24bits, unpacked. Used to convert 32bit output into 24bit input needed by many axon dsp operations.
 
nrf_axon_result_e nrf_axon_saturate_32_8 (const int32_t *in_ptr, int8_t *out_ptr, uint16_t length, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 Saturates a 32bit vector to 8bits, unpacked.
 
nrf_axon_result_e nrf_axon_fir_2d_16_16_32_decimate (const int16_t *input_ptr, const int16_t *filter_ptr, int32_t *out_ptr, uint16_t input_height, uint16_t filter_height, uint16_t decimate_width, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter with decimation multiple. Filter coefficients are MAC'd with the input. Input elements are multiplied with filter elements in the same order. in the order. ie, for filter length F, output x[n] = input[n]*filter[0] + input[n+1]*filter[F+1]+...input[n+F-1]*filter[F-1]. After each output is generated, the input skips ahead by decimate_width. The filter output starts at out_ptr[0].
 
nrf_axon_result_e nrf_axon_fir_2d_16_16_24_decimate (const int16_t *input_ptr, const int16_t *filter_ptr, int32_t *out_ptr, uint16_t input_height, uint16_t filter_height, uint16_t decimate_width, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter with decimation multiple. Filter coefficients are MAC'd with the input. Input elements are multiplied with filter elements in the same order. in the order. ie, for filter length F, output x[n] = input[n]*filter[0] + input[n+1]*filter[F+1]+...input[n+F-1]*filter[F-1]. After each output is generated, the input skips ahead by decimate_width. The filter output starts at out_ptr[0].
 
nrf_axon_result_e nrf_axon_fir_16_16_32_decimate (const int16_t *input_ptr, const int16_t *filter_ptr, int32_t *out_ptr, uint16_t input_length, uint16_t filter_length, uint16_t decimate, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter with decimation multiple. Filter coefficients are MAC'd with the input. Input elements are multiplied with filter elements in the same order. in the order. ie, for filter length F, output x[n] = input[n]*filter[0] + input[n+1]*filter[F+1]+...input[n+F-1]*filter[F-1]. After each output is generated, the input skips ahead by decimate_width. The filter output starts at out_ptr[0].
 
nrf_axon_result_e nrf_axon_fir_16_16_32_1024_256_decimate_1 (const int16_t *input_ptr, const int16_t *filter_ptr, int32_t *out_ptr, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter with decimation multiple. Filter coefficients are MAC'd with the input. Input elements are multiplied with filter elements in the same order. in the order. ie, for filter length F, output x[n] = input[n]*filter[0] + input[n+1]*filter[F+1]+...input[n+F-1]*filter[F-1]. After each output is generated, the input skips ahead by decimate_width. The filter output starts at out_ptr[0].
 
nrf_axon_result_e nrf_axon_fir_16_16_32_1024_256_decimate_4 (const int16_t *input_ptr, const int16_t *filter_ptr, int32_t *out_ptr, uint8_t rounding_bits, nrf_axon_syncmode_blocking_e block_mode, bool keep_reservation)
 "FIR" => "Finite Impulse Response" filter with decimation multiple. Filter coefficients are MAC'd with the input. Input elements are multiplied with filter elements in the same order. in the order. ie, for filter length F, output x[n] = input[n]*filter[0] + input[n+1]*filter[F+1]+...input[n+F-1]*filter[F-1]. After each output is generated, the input skips ahead by decimate_width. The filter output starts at out_ptr[0].