AI Engine Intrinsics User Guide  (AIE) r2p23
 All Data Structures Namespaces Functions Variables Typedefs Groups Pages
Control register

Intrinsics to set, get and clear bits of the control register. More...

Overview

Intrinsics to set, get and clear bits of the control register.

These fields have undefined values by default as they are not initialized.

Lower 32 bit MD0:

Field Bits Meaning
Q - Saturation Mode [0] 0 – No saturation; truncation of MSBs
1 – Perform saturation
R - Rounding Mode [1-3] rounding_modes
Rdx - Radix [4-6] FFT radix selection
SQ - Symmetric saturation [7] Mode control for symmetric saturation
mdSSa - Select [8] Bit to select stream SS0 or SS1
mdSSb - Select [9] Bit to select stream SS0 or SS1
mdMSa - Select [10] Bit to select stream MS0 or MS1
mdMSb - Select [11] Bit to select stream MS0 or MS1
Reserved [12:15] Reserved bits
FP_ADD_MASK - MASK [16:23] Mask bits to mask floating point exceptions
FP_MUL_MASK - MASK [24:31] Mask bits to mask floating point exceptions

Higher 32 bit MD1:

Field Bits Meaning
FP_NLF_MASK - MASK [0:7] Mask bits to mask floating point exceptions
FP_FIX2FLOAT_MASK - MASK [8:15] Mask bits to mask floating point exceptions
FP_FLOAT2FIX_MASK - MASK [16:23] Mask bits to mask floating point exceptions
Reserved [24:31] Reserved bits

SRS rounding and saturation

The rounding and saturation in the srs intrinsics (Shift-Round-Saturate) is controlled through special mode setting commands. The following example shows their usage:

static int16_t data[8] = {0xf00000,0x3C0,0x380,0x37F,0,0,0,0};
void ex3()
{
v8acc48 acc = ups(*(v8int16*)(data));
v8int16 r_s = srs(acc,8); // r_s = {0x7FFF, 0x4, 0x4, 0x3, ...}
v8int16 r_ns = srs(acc,8); // r_ns = {0x0000, 0x4, 0x4, 0x3, ...}
v8int16 nr_ns = srs(acc,8); // r_ns = {0x0000, 0x3, 0x3, 0x3, ...}
v8int16 nr_s = srs(acc,8); // nr_s = {0x7FFF, 0x4, 0x3, 0x3, ...}
}

In this example, the first element overflows 16-bit signed data and shows the effect of the saturation mode setting, while the second to fourth elements shows the effect of the rounding mode setting following a 8-bit right shift.

Full register access

Get or set the low or high MC register Parameter can be 0 or 1 and specifies the 32bit word to be accessed. 0 is lower 32 bit and 1 is higher 32 bit. See: Bit meanings for what each bit means.

unsigned int get_MD (unsigned int idx)
 
void set_MD (unsigned int val, unsigned int idx)
 
unsigned int get_MC (unsigned int idx)
 
void set_MC (unsigned int val, unsigned int idx)
 

Miscellaneous control bits

unsigned int get_sat ()
 Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-128:127].
 
void set_sat ()
 Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-128:127].
 
void clr_sat ()
 Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-128:127].
 
unsigned int get_symsat ()
 Control symmetric saturation. Requires saturation to be enabled. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-127:127].
 
void set_symsat ()
 Control symmetric saturation. Requires saturation to be enabled. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-127:127].
 
void clr_symsat ()
 Control symmetric saturation. Requires saturation to be enabled. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-127:127].
 
unsigned int get_rnd ()
 Control for rounding mode (for Shift-Round-Saturate). See rounding_modes for possible values.
 
void set_rnd (unsigned int val)
 Control for rounding mode (for Shift-Round-Saturate). See rounding_modes for possible values.
 
unsigned int get_rdx ()
 FFT radix selection. Valid values are 2, 3, 4, 5, 7.
 
void set_rdx (unsigned int val)
 FFT radix selection. Valid values are 2, 3, 4, 5, 7.
 

Floating point addition

Intrinsics for masking floating point addition exceptions

unsigned int get_fpadd_zero_msk ()
 Get mask for zero result after fp addition .
 
void set_fpadd_zero_msk ()
 Set mask for zero result after fp addition .
 
void clr_fpadd_zero_msk ()
 Clear mask for zero result after fp addition .
 
unsigned int get_fpadd_inf_msk ()
 Get mask for infinite result after fp addition .
 
void set_fpadd_inf_msk ()
 Set mask for infinite result after fp addition .
 
void clr_fpadd_inf_msk ()
 Clear mask for infinite result after fp addition .
 
unsigned int get_fpadd_inv_msk ()
 Get mask for invalid result after fp addition .
 
void set_fpadd_inv_msk ()
 Set mask for invalid result after fp addition .
 
void clr_fpadd_inv_msk ()
 Clear mask for invalid result after fp addition .
 
unsigned int get_fpadd_tiny_msk ()
 Get mask for tiny result after fp addition .
 
void set_fpadd_tiny_msk ()
 Set mask for tiny result after fp addition .
 
void clr_fpadd_tiny_msk ()
 Clear mask for tiny result after fp addition .
 
unsigned int get_fpadd_huge_msk ()
 Get mask for huge result after fp addition .
 
void set_fpadd_huge_msk ()
 Set mask for huge result after fp addition .
 
void clr_fpadd_huge_msk ()
 Clear mask for huge result after fp addition .
 
unsigned int get_fpadd_inex_msk ()
 Get mask for inexact result after fp addition .
 
void set_fpadd_inex_msk ()
 Set mask for inexact result after fp addition .
 
void clr_fpadd_inex_msk ()
 Clear mask for inexact result after fp addition .
 

Floating point multiplication

Intrinsics for masking floating point multiplication exceptions

unsigned int get_fpmul_zero_msk ()
 Get mask for zero result after fp multiplication .
 
void set_fpmul_zero_msk ()
 Set mask for zero result after fp multiplication .
 
void clr_fpmul_zero_msk ()
 Clear mask for zero result after fp multiplication .
 
unsigned int get_fpmul_inf_msk ()
 Get mask for infinite result after fp multiplication .
 
void set_fpmul_inf_msk ()
 Set mask for infinite result after fp multiplication .
 
void clr_fpmul_inf_msk ()
 Clear mask for infinite result after fp multiplication .
 
unsigned int get_fpmul_inv_msk ()
 Get mask for invalid result after fp multiplication .
 
void set_fpmul_inv_msk ()
 Set mask for invalid result after fp multiplication .
 
void clr_fpmul_inv_msk ()
 Clear mask for invalid result after fp multiplication .
 
unsigned int get_fpmul_tiny_msk ()
 Get mask for tiny result after fp multiplication .
 
void set_fpmul_tiny_msk ()
 Set mask for tiny result after fp multiplication .
 
void clr_fpmul_tiny_msk ()
 Clear mask for tiny result after fp multiplication .
 
unsigned int get_fpmul_huge_msk ()
 Get mask for huge result after fp multiplication .
 
void set_fpmul_huge_msk ()
 Set mask for huge result after fp multiplication .
 
void clr_fpmul_huge_msk ()
 Clear mask for huge result after fp multiplication .
 
unsigned int get_fpmul_inex_msk ()
 Get mask for inexact result after fp multiplication .
 
void set_fpmul_inex_msk ()
 Set mask for inexact result after fp multiplication .
 
void clr_fpmul_inex_msk ()
 Clear mask for inexact result after fp multiplication .
 

Non linear functions

Intrinsics for masking non linear function (such as sqrt, inv and inv_sqrt) exceptions

unsigned int get_fpnlf_zero_msk ()
 Get mask for zero result after nlf .
 
void set_fpnlf_zero_msk ()
 Set mask for zero result after nlf .
 
void clr_fpnlf_zero_msk ()
 Clear mask for zero result after nlf .
 
unsigned int get_fpnlf_inf_msk ()
 Get mask for infinite result after nlf .
 
void set_fpnlf_inf_msk ()
 Set mask for infinite result after nlf .
 
void clr_fpnlf_inf_msk ()
 Clear mask for infinite result after nlf .
 
unsigned int get_fpnlf_inv_msk ()
 Get mask for invalid result after nlf .
 
void set_fpnlf_inv_msk ()
 Set mask for invalid result after nlf .
 
void clr_fpnlf_inv_msk ()
 Clear mask for invalid result after nlf .
 
unsigned int get_fpnlf_tiny_msk ()
 Get mask for tiny result after nlf .
 
void set_fpnlf_tiny_msk ()
 Set mask for tiny result after nlf .
 
void clr_fpnlf_tiny_msk ()
 Clear mask for tiny result after nlf .
 
unsigned int get_fpnlf_inex_msk ()
 Get mask for inexact result after nlf .
 
void set_fpnlf_inex_msk ()
 Set mask for inexact result after nlf .
 
void clr_fpnlf_inex_msk ()
 Clear mask for inexact result after nlf .
 
unsigned int get_fpnlf_div0_msk ()
 Get mask for division_by_zero result after nlf .
 
void set_fpnlf_div0_msk ()
 Set mask for division_by_zero result after nlf .
 
void clr_fpnlf_div0_msk ()
 Clear mask for division_by_zero result after nlf .
 

Fix to float conversions

Intrinsics for masking fix to float conversion exceptions

unsigned int get_fx2fl_zero_msk ()
 Get mask for zero result after fix float .
 
void set_fx2fl_zero_msk ()
 Set mask for zero result after fix float .
 
void clr_fx2fl_zero_msk ()
 Clear mask for zero result after fix float .
 
unsigned int get_fx2fl_inex_msk ()
 Get mask for inexact result after fix float .
 
void set_fx2fl_inex_msk ()
 Set mask for inexact result after fix float .
 
void clr_fx2fl_inex_msk ()
 Clear mask for inexact result after fix float .
 

Float to fix conversions

Intrinsics for masking fix to float conversion exceptions

unsigned int get_fl2fx_hint_msk ()
 Get mask for hint result after float fix .
 
void set_fl2fx_hint_msk ()
 Set mask for hint result after float fix .
 
void clr_fl2fx_hint_msk ()
 Clear mask for hint result after float fix .
 
unsigned int get_fl2fx_inv_msk ()
 Get mask for invalid result after float fix .
 
void set_fl2fx_inv_msk ()
 Set mask for invalid result after float fix .
 
void clr_fl2fx_inv_msk ()
 Clear mask for invalid result after float fix .
 

Function Documentation

void clr_fl2fx_hint_msk ( )

Clear mask for hint result after float fix .

void clr_fl2fx_inv_msk ( )

Clear mask for invalid result after float fix .

void clr_fpadd_huge_msk ( )

Clear mask for huge result after fp addition .

void clr_fpadd_inex_msk ( )

Clear mask for inexact result after fp addition .

void clr_fpadd_inf_msk ( )

Clear mask for infinite result after fp addition .

void clr_fpadd_inv_msk ( )

Clear mask for invalid result after fp addition .

void clr_fpadd_tiny_msk ( )

Clear mask for tiny result after fp addition .

void clr_fpadd_zero_msk ( )

Clear mask for zero result after fp addition .

void clr_fpmul_huge_msk ( )

Clear mask for huge result after fp multiplication .

void clr_fpmul_inex_msk ( )

Clear mask for inexact result after fp multiplication .

void clr_fpmul_inf_msk ( )

Clear mask for infinite result after fp multiplication .

void clr_fpmul_inv_msk ( )

Clear mask for invalid result after fp multiplication .

void clr_fpmul_tiny_msk ( )

Clear mask for tiny result after fp multiplication .

void clr_fpmul_zero_msk ( )

Clear mask for zero result after fp multiplication .

void clr_fpnlf_div0_msk ( )

Clear mask for division_by_zero result after nlf .

void clr_fpnlf_inex_msk ( )

Clear mask for inexact result after nlf .

void clr_fpnlf_inf_msk ( )

Clear mask for infinite result after nlf .

void clr_fpnlf_inv_msk ( )

Clear mask for invalid result after nlf .

void clr_fpnlf_tiny_msk ( )

Clear mask for tiny result after nlf .

void clr_fpnlf_zero_msk ( )

Clear mask for zero result after nlf .

void clr_fx2fl_inex_msk ( )

Clear mask for inexact result after fix float .

void clr_fx2fl_zero_msk ( )

Clear mask for zero result after fix float .

void clr_sat ( )

Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-128:127].

void clr_symsat ( )

Control symmetric saturation. Requires saturation to be enabled. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-127:127].

unsigned int get_fl2fx_hint_msk ( )

Get mask for hint result after float fix .

unsigned int get_fl2fx_inv_msk ( )

Get mask for invalid result after float fix .

unsigned int get_fpadd_huge_msk ( )

Get mask for huge result after fp addition .

unsigned int get_fpadd_inex_msk ( )

Get mask for inexact result after fp addition .

unsigned int get_fpadd_inf_msk ( )

Get mask for infinite result after fp addition .

unsigned int get_fpadd_inv_msk ( )

Get mask for invalid result after fp addition .

unsigned int get_fpadd_tiny_msk ( )

Get mask for tiny result after fp addition .

unsigned int get_fpadd_zero_msk ( )

Get mask for zero result after fp addition .

unsigned int get_fpmul_huge_msk ( )

Get mask for huge result after fp multiplication .

unsigned int get_fpmul_inex_msk ( )

Get mask for inexact result after fp multiplication .

unsigned int get_fpmul_inf_msk ( )

Get mask for infinite result after fp multiplication .

unsigned int get_fpmul_inv_msk ( )

Get mask for invalid result after fp multiplication .

unsigned int get_fpmul_tiny_msk ( )

Get mask for tiny result after fp multiplication .

unsigned int get_fpmul_zero_msk ( )

Get mask for zero result after fp multiplication .

unsigned int get_fpnlf_div0_msk ( )

Get mask for division_by_zero result after nlf .

unsigned int get_fpnlf_inex_msk ( )

Get mask for inexact result after nlf .

unsigned int get_fpnlf_inf_msk ( )

Get mask for infinite result after nlf .

unsigned int get_fpnlf_inv_msk ( )

Get mask for invalid result after nlf .

unsigned int get_fpnlf_tiny_msk ( )

Get mask for tiny result after nlf .

unsigned int get_fpnlf_zero_msk ( )

Get mask for zero result after nlf .

unsigned int get_fx2fl_inex_msk ( )

Get mask for inexact result after fix float .

unsigned int get_fx2fl_zero_msk ( )

Get mask for zero result after fix float .

unsigned int get_MC ( unsigned int  idx)
unsigned int get_MD ( unsigned int  idx)
unsigned int get_rdx ( )

FFT radix selection. Valid values are 2, 3, 4, 5, 7.

unsigned int get_rnd ( )

Control for rounding mode (for Shift-Round-Saturate). See rounding_modes for possible values.

unsigned int get_sat ( )

Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-128:127].

unsigned int get_symsat ( )

Control symmetric saturation. Requires saturation to be enabled. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-127:127].

void set_fl2fx_hint_msk ( )

Set mask for hint result after float fix .

void set_fl2fx_inv_msk ( )

Set mask for invalid result after float fix .

void set_fpadd_huge_msk ( )

Set mask for huge result after fp addition .

void set_fpadd_inex_msk ( )

Set mask for inexact result after fp addition .

void set_fpadd_inf_msk ( )

Set mask for infinite result after fp addition .

void set_fpadd_inv_msk ( )

Set mask for invalid result after fp addition .

void set_fpadd_tiny_msk ( )

Set mask for tiny result after fp addition .

void set_fpadd_zero_msk ( )

Set mask for zero result after fp addition .

void set_fpmul_huge_msk ( )

Set mask for huge result after fp multiplication .

void set_fpmul_inex_msk ( )

Set mask for inexact result after fp multiplication .

void set_fpmul_inf_msk ( )

Set mask for infinite result after fp multiplication .

void set_fpmul_inv_msk ( )

Set mask for invalid result after fp multiplication .

void set_fpmul_tiny_msk ( )

Set mask for tiny result after fp multiplication .

void set_fpmul_zero_msk ( )

Set mask for zero result after fp multiplication .

void set_fpnlf_div0_msk ( )

Set mask for division_by_zero result after nlf .

void set_fpnlf_inex_msk ( )

Set mask for inexact result after nlf .

void set_fpnlf_inf_msk ( )

Set mask for infinite result after nlf .

void set_fpnlf_inv_msk ( )

Set mask for invalid result after nlf .

void set_fpnlf_tiny_msk ( )

Set mask for tiny result after nlf .

void set_fpnlf_zero_msk ( )

Set mask for zero result after nlf .

void set_fx2fl_inex_msk ( )

Set mask for inexact result after fix float .

void set_fx2fl_zero_msk ( )

Set mask for zero result after fix float .

void set_MC ( unsigned int  val,
unsigned int  idx 
)
void set_MD ( unsigned int  val,
unsigned int  idx 
)
void set_rdx ( unsigned int  val)

FFT radix selection. Valid values are 2, 3, 4, 5, 7.

void set_rnd ( unsigned int  val)

Control for rounding mode (for Shift-Round-Saturate). See rounding_modes for possible values.

void set_sat ( )

Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-128:127].

void set_symsat ( )

Control symmetric saturation. Requires saturation to be enabled. Symmetric saturation rounds an n-bit signed value in the range [- ( 2^(n-1) -1 ) : +2^(n-1) - 1 ]. For example if n=8 the range would be [-127:127].