7-24
SC100 C Compiler
Runtime Libraries
set2crm()
Sets rounding mode to two
’
s-complement rounding mode.
void setnosat()
Clears saturation mode bit in status register.
void setsat32()
Sets saturation mode bit in status register.
short shl(short var1,short var2)
Short shift left. Arithmetically shifts the 16-bit
var1
left
var2
positions. Zero fills the
var2
LSB of the result. If
var2
is negative, arithmetically shifts
var1
right by
var2
with sign extension. Saturates the result in cases where
underflow or overflow occurs.
short shr(short var1,short var2)
Short shift right. Arithmetically shifts the 16-bit
var1
right
var2
positions with sign extension. If
var2
is negative,
arithmetically shifts
var1
left by
var2
with sign extension.
Saturates the result in cases where underflow or overflow
occurs.
short shr_r(short var1,short var2)
Short shift right and round. Same as
shr(var1,var2)
but
with rounding. Saturates the result in cases where
underflow or overflow occurs.
void stop()
Generates assembly instruction to enter
Stop
low power
mode.
short sub(short var1,short var2)
Performs the subtraction with overflow control and
saturation.The 16-bit result is set at
+32767
when overflow
occurs or at
-32768
when underflow occurs.
void trap()
Generates assembly instruction to execute
Trap
exception.
void wait()
Generates assembly instruction to enter
Wait
low power
mode.
Word40 X_abs(Word40 X_var1)
40-bit absolute value of
X_var1
.
Word40 X_add(Word40 X_var1,
Word40 X_var2)
Extended precision add. Performs the addition
X_var1+X_var2
without saturation. .
short X_cmpeq(Word40 X_var1,
Word40 X_var2)
Extended precision compare equal. Compares two 40-bit
values and returns a 16-bit result containing the value
if the values are equal, or
if they are not.
short X_cmpgt(Word40 X_var1,
Word40 X_var2)
Extended precision compare greater than. Compares two
40-bit values and returns a 16-bit result containing
.
Word40 X_extend(long L_var1)
Sign extend 32-bit value to 40-bit value.
short X_extract_h(Word40 X_var1)
Extended precision extract high. Returns the 16 MSB of the
40-bit value
X_var1
.
short X_extract_l(Word40 X_var1)
Extended precision extract low. Returns the 16 LSB of the
40-bit value
X_var1
.
Word40 X_mac(Word40 X_var3,
short var1,short var2)
Extended precision multiply accumulate. Multiplies
var1
by
var2
and shifts the result left by 1. Adds the 40-bit result to
X_var3
without saturation, and returns a 40-bit result. For
example:
X_mac(X_var3,var1,var2) =
X_add(X_var3,X_mult(var1,var2)).
Table 7-35. Built-in Intrinsic Functions (Continued)
Function
Purpose