Implementation

The CodeWarrior for DSP56800E and DSP56800EX has intrinsic functions to generate inline-assembly-language instructions. These intrinsic functions are a CodeWarrior extension to ANSI C.

Use intrinsic functions to target specific processor instructions. For example:

The IDE implements intrinsic functions as inline C functions in file intrinsics_56800E.h, in the MSL directory tree. These inline functions contain mostly inline assembly language code. An example is the abs_s intrinsic, defined as:

Listing: Example code - Definition of intrinsic function: abs_s
#define    abs_s(a) __abs_s(a)

           /* ABS_S */

inline Word16 __abs_s(register Word16 svar1)

{

/*

 *   Defn: Absolute value of a 16-bit integer or fractional value

 *        returning a 16-bit result.

 *        Returns $7fff for an input of $8000

 *   

 *   DSP56800E instruction syntax:  abs FFF

 *             Allowed src regs:  FFF

 *             Allowed dst regs:  (same)

 *   

 *   Assumptions: OMR's SA bit was set to 1 at least 3 cycles

 *   before this code.

 */

   asm(abs svar1);

   return svar1;

}