AI Engine Intrinsics User Guide  (AIE) v(2024.1)
 All Data Structures Namespaces Functions Variables Typedefs Groups Pages
Integer Operations

Overview

Modules

 AIE ID
 
 Digital Pre-Distortion
 
 Peak Cancellation Crest Factor Reduction (PC-CFR)
 

Functions

int scalar_abs (int a)
 

Scalar select intrinsics

char select (bool, char, char)
 Scalar select.
 
unsigned char select (bool, unsigned char, unsigned char)
 Scalar select.
 
short select (bool, short, short)
 Scalar select.
 
int select (bool, int, int)
 Scalar select.
 
long select (bool, long, long)
 Scalar select.
 
void * select (bool, void *, void *)
 Scalar select.
 

Leading bit count

unsigned clb (int a)
 Count number of leading consecutive bits. If a is positive, count leading 0's, otherwise count leading 1's.
 
unsigned clb (unsigned a)
 Count number of leading consecutive 0's.
 
unsigned clb (long long a)
 Count number of leading consecutive bits. If a is positive, count leading 0's, otherwise count leading 1's.
 
unsigned clb (unsigned long long a)
 Count number of leading consecutive 0's.
 

Inserting nops in the micro-code

void nop (unsigned delay)
 Insert pipeline bubbles in the micro-code.
 
void nop ()
 Insert pipeline bubbles in the micro-code.
 

Bit extraction/update

unsigned bitset (unsigned src, unsigned val, unsigned idx)
 
unsigned bitget (unsigned src, unsigned idx)
 

Function Documentation

unsigned bitget ( unsigned  src,
unsigned  idx 
)

Returns the value (0 or 1) of the bit at idx in src.

return (src >> idx) & 1
Parameters
srcThe value in which a bit is to be get.
idxThe index of the bit to get. This must be a compile time constant.
unsigned bitset ( unsigned  src,
unsigned  val,
unsigned  idx 
)

Returns the updated src with the bit at idx set to val.

mask = ~(1 << idx)
newbit = ((val) ? 1 : 0) << idx
src = (src & mask) | newbit
Parameters
srcThe value in which a bit is to be set.
valThe value to set the bit to. Treated as a 1 or 0 to be shifted into the correct position.
idxThe index of the bit to set. This must be a compile time constant.
unsigned clb ( int  a)

Count number of leading consecutive bits. If a is positive, count leading 0's, otherwise count leading 1's.

unsigned clb ( unsigned  a)

Count number of leading consecutive 0's.

unsigned clb ( long long  a)

Count number of leading consecutive bits. If a is positive, count leading 0's, otherwise count leading 1's.

unsigned clb ( unsigned long long  a)

Count number of leading consecutive 0's.

void nop ( unsigned  delay)

Insert pipeline bubbles in the micro-code.

Parameters
delayNumber of cycles between two instructions. (Default = 2)
Note
Delay must be a compile time constant.
Subsequent nops will be collapsed into a single nop (only the maximum value will be seen).
void nop ( )

Insert pipeline bubbles in the micro-code.

Parameters
delayNumber of cycles between two instructions. (Default = 2)
Note
Delay must be a compile time constant.
Subsequent nops will be collapsed into a single nop (only the maximum value will be seen).
int scalar_abs ( int  a)
char select ( bool  ,
char  ,
char   
)

Scalar select.

These instructions are equivalent to the ternary ?: operator and should normally be inferred by the compiler automatically.

unsigned long select ( bool  ,
unsigned  char,
unsigned  char 
)

Scalar select.

These instructions are equivalent to the ternary ?: operator and should normally be inferred by the compiler automatically.

short select ( bool  ,
short  ,
short   
)

Scalar select.

These instructions are equivalent to the ternary ?: operator and should normally be inferred by the compiler automatically.

int select ( bool  ,
int  ,
int   
)

Scalar select.

These instructions are equivalent to the ternary ?: operator and should normally be inferred by the compiler automatically.

long select ( bool  ,
long  ,
long   
)

Scalar select.

These instructions are equivalent to the ternary ?: operator and should normally be inferred by the compiler automatically.

void* select ( bool  ,
void *  ,
void *   
)

Scalar select.

These instructions are equivalent to the ternary ?: operator and should normally be inferred by the compiler automatically.