AI Engine Intrinsics User Guide (AIE) v2024.2
Loading...
Searching...
No Matches

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, ...}
}
v8int16 srs(v8acc48 a, int shft)
Definition me_srs.h:255
v16acc48 ups(v16int16 a, int shft)
Definition me_ups.h:86
void set_rnd(unsigned int val)
Control for rounding mode (for Shift-Round-Saturate). See rounding_modes for possible values.
Definition me_set_mode.h:284
void clr_sat()
Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - ...
Definition me_set_mode.h:241
void set_sat()
Control saturation. Saturation rounds an n-bit signed value in the range [- ( 2^(n-1) ) : +2^(n-1) - ...
Definition me_set_mode.h:241
#define rnd_conv_odd
Round halfway towards nearest odd number.
Definition me_defines.h:148
#define rnd_pos_inf
Round halfway towards positive infinity.
Definition me_defines.h:138
#define rnd_floor
No rounding - Truncate LSB, always round down (towards negative infinity)
Definition me_defines.h:134

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].
 
void set_sat_mode (unsigned int eSatMode)
 Control symmetric saturation.
 
unsigned int get_sat_mode ()
 get symmetric saturation. values 0 (sat and symsat cleared), 1 (sat is set), 3 (sat and symsat are both set).

 
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

◆ clr_fl2fx_hint_msk()

void clr_fl2fx_hint_msk ( )

Clear mask for hint result after float fix .

◆ clr_fl2fx_inv_msk()

void clr_fl2fx_inv_msk ( )

Clear mask for invalid result after float fix .

◆ clr_fpadd_huge_msk()

void clr_fpadd_huge_msk ( )

Clear mask for huge result after fp addition .

◆ clr_fpadd_inex_msk()

void clr_fpadd_inex_msk ( )

Clear mask for inexact result after fp addition .

◆ clr_fpadd_inf_msk()

void clr_fpadd_inf_msk ( )

Clear mask for infinite result after fp addition .

◆ clr_fpadd_inv_msk()

void clr_fpadd_inv_msk ( )

Clear mask for invalid result after fp addition .

◆ clr_fpadd_tiny_msk()

void clr_fpadd_tiny_msk ( )

Clear mask for tiny result after fp addition .

◆ clr_fpadd_zero_msk()

void clr_fpadd_zero_msk ( )

Clear mask for zero result after fp addition .

◆ clr_fpmul_huge_msk()

void clr_fpmul_huge_msk ( )

Clear mask for huge result after fp multiplication .

◆ clr_fpmul_inex_msk()

void clr_fpmul_inex_msk ( )

Clear mask for inexact result after fp multiplication .

◆ clr_fpmul_inf_msk()

void clr_fpmul_inf_msk ( )

Clear mask for infinite result after fp multiplication .

◆ clr_fpmul_inv_msk()

void clr_fpmul_inv_msk ( )

Clear mask for invalid result after fp multiplication .

◆ clr_fpmul_tiny_msk()

void clr_fpmul_tiny_msk ( )

Clear mask for tiny result after fp multiplication .

◆ clr_fpmul_zero_msk()

void clr_fpmul_zero_msk ( )

Clear mask for zero result after fp multiplication .

◆ clr_fpnlf_div0_msk()

void clr_fpnlf_div0_msk ( )

Clear mask for division_by_zero result after nlf .

◆ clr_fpnlf_inex_msk()

void clr_fpnlf_inex_msk ( )

Clear mask for inexact result after nlf .

◆ clr_fpnlf_inf_msk()

void clr_fpnlf_inf_msk ( )

Clear mask for infinite result after nlf .

◆ clr_fpnlf_inv_msk()

void clr_fpnlf_inv_msk ( )

Clear mask for invalid result after nlf .

◆ clr_fpnlf_tiny_msk()

void clr_fpnlf_tiny_msk ( )

Clear mask for tiny result after nlf .

◆ clr_fpnlf_zero_msk()

void clr_fpnlf_zero_msk ( )

Clear mask for zero result after nlf .

◆ clr_fx2fl_inex_msk()

void clr_fx2fl_inex_msk ( )

Clear mask for inexact result after fix float .

◆ clr_fx2fl_zero_msk()

void clr_fx2fl_zero_msk ( )

Clear mask for zero result after fix float .

◆ clr_sat()

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].

◆ clr_symsat()

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].

◆ get_fl2fx_hint_msk()

unsigned int get_fl2fx_hint_msk ( )

Get mask for hint result after float fix .

◆ get_fl2fx_inv_msk()

unsigned int get_fl2fx_inv_msk ( )

Get mask for invalid result after float fix .

◆ get_fpadd_huge_msk()

unsigned int get_fpadd_huge_msk ( )

Get mask for huge result after fp addition .

◆ get_fpadd_inex_msk()

unsigned int get_fpadd_inex_msk ( )

Get mask for inexact result after fp addition .

◆ get_fpadd_inf_msk()

unsigned int get_fpadd_inf_msk ( )

Get mask for infinite result after fp addition .

◆ get_fpadd_inv_msk()

unsigned int get_fpadd_inv_msk ( )

Get mask for invalid result after fp addition .

◆ get_fpadd_tiny_msk()

unsigned int get_fpadd_tiny_msk ( )

Get mask for tiny result after fp addition .

◆ get_fpadd_zero_msk()

unsigned int get_fpadd_zero_msk ( )

Get mask for zero result after fp addition .

◆ get_fpmul_huge_msk()

unsigned int get_fpmul_huge_msk ( )

Get mask for huge result after fp multiplication .

◆ get_fpmul_inex_msk()

unsigned int get_fpmul_inex_msk ( )

Get mask for inexact result after fp multiplication .

◆ get_fpmul_inf_msk()

unsigned int get_fpmul_inf_msk ( )

Get mask for infinite result after fp multiplication .

◆ get_fpmul_inv_msk()

unsigned int get_fpmul_inv_msk ( )

Get mask for invalid result after fp multiplication .

◆ get_fpmul_tiny_msk()

unsigned int get_fpmul_tiny_msk ( )

Get mask for tiny result after fp multiplication .

◆ get_fpmul_zero_msk()

unsigned int get_fpmul_zero_msk ( )

Get mask for zero result after fp multiplication .

◆ get_fpnlf_div0_msk()

unsigned int get_fpnlf_div0_msk ( )

Get mask for division_by_zero result after nlf .

◆ get_fpnlf_inex_msk()

unsigned int get_fpnlf_inex_msk ( )

Get mask for inexact result after nlf .

◆ get_fpnlf_inf_msk()

unsigned int get_fpnlf_inf_msk ( )

Get mask for infinite result after nlf .

◆ get_fpnlf_inv_msk()

unsigned int get_fpnlf_inv_msk ( )

Get mask for invalid result after nlf .

◆ get_fpnlf_tiny_msk()

unsigned int get_fpnlf_tiny_msk ( )

Get mask for tiny result after nlf .

◆ get_fpnlf_zero_msk()

unsigned int get_fpnlf_zero_msk ( )

Get mask for zero result after nlf .

◆ get_fx2fl_inex_msk()

unsigned int get_fx2fl_inex_msk ( )

Get mask for inexact result after fix float .

◆ get_fx2fl_zero_msk()

unsigned int get_fx2fl_zero_msk ( )

Get mask for zero result after fix float .

◆ get_MC()

unsigned int get_MC ( unsigned int  idx)

◆ get_MD()

unsigned int get_MD ( unsigned int  idx)

◆ get_rdx()

unsigned int get_rdx ( )

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

◆ get_rnd()

unsigned int get_rnd ( )

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

◆ get_sat()

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].

◆ get_sat_mode()

unsigned int get_sat_mode ( )

get symmetric saturation. values 0 (sat and symsat cleared), 1 (sat is set), 3 (sat and symsat are both set).

◆ get_symsat()

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].

◆ set_fl2fx_hint_msk()

void set_fl2fx_hint_msk ( )

Set mask for hint result after float fix .

◆ set_fl2fx_inv_msk()

void set_fl2fx_inv_msk ( )

Set mask for invalid result after float fix .

◆ set_fpadd_huge_msk()

void set_fpadd_huge_msk ( )

Set mask for huge result after fp addition .

◆ set_fpadd_inex_msk()

void set_fpadd_inex_msk ( )

Set mask for inexact result after fp addition .

◆ set_fpadd_inf_msk()

void set_fpadd_inf_msk ( )

Set mask for infinite result after fp addition .

◆ set_fpadd_inv_msk()

void set_fpadd_inv_msk ( )

Set mask for invalid result after fp addition .

◆ set_fpadd_tiny_msk()

void set_fpadd_tiny_msk ( )

Set mask for tiny result after fp addition .

◆ set_fpadd_zero_msk()

void set_fpadd_zero_msk ( )

Set mask for zero result after fp addition .

◆ set_fpmul_huge_msk()

void set_fpmul_huge_msk ( )

Set mask for huge result after fp multiplication .

◆ set_fpmul_inex_msk()

void set_fpmul_inex_msk ( )

Set mask for inexact result after fp multiplication .

◆ set_fpmul_inf_msk()

void set_fpmul_inf_msk ( )

Set mask for infinite result after fp multiplication .

◆ set_fpmul_inv_msk()

void set_fpmul_inv_msk ( )

Set mask for invalid result after fp multiplication .

◆ set_fpmul_tiny_msk()

void set_fpmul_tiny_msk ( )

Set mask for tiny result after fp multiplication .

◆ set_fpmul_zero_msk()

void set_fpmul_zero_msk ( )

Set mask for zero result after fp multiplication .

◆ set_fpnlf_div0_msk()

void set_fpnlf_div0_msk ( )

Set mask for division_by_zero result after nlf .

◆ set_fpnlf_inex_msk()

void set_fpnlf_inex_msk ( )

Set mask for inexact result after nlf .

◆ set_fpnlf_inf_msk()

void set_fpnlf_inf_msk ( )

Set mask for infinite result after nlf .

◆ set_fpnlf_inv_msk()

void set_fpnlf_inv_msk ( )

Set mask for invalid result after nlf .

◆ set_fpnlf_tiny_msk()

void set_fpnlf_tiny_msk ( )

Set mask for tiny result after nlf .

◆ set_fpnlf_zero_msk()

void set_fpnlf_zero_msk ( )

Set mask for zero result after nlf .

◆ set_fx2fl_inex_msk()

void set_fx2fl_inex_msk ( )

Set mask for inexact result after fix float .

◆ set_fx2fl_zero_msk()

void set_fx2fl_zero_msk ( )

Set mask for zero result after fix float .

◆ set_MC()

void set_MC ( unsigned int  val,
unsigned int  idx 
)

◆ set_MD()

void set_MD ( unsigned int  val,
unsigned int  idx 
)

◆ set_rdx()

void set_rdx ( unsigned int  val)

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

◆ set_rnd()

void set_rnd ( unsigned int  val)

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

◆ set_sat()

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].

◆ set_sat_mode()

void set_sat_mode ( unsigned int  eSatMode)

Control symmetric saturation.

Parameters
eSatModeis an enum with acceptable value 0 (sat and symsat cleared), 1 (sat enabled), 3(sat and symsat 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]

◆ set_symsat()

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].