Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Run Intrinsics Code Anywhere

From Texas Instruments Wiki
Jump to: navigation, search

NO LONGER SUPPORTED

The host intrinsics package is no longer supported. There are no plans to fix any issues or perform new releases. This article remains for reference only.

Introduction

Wouldn't it be cool to have one version of your code that runs on the C6000 embedded DSP and your host development system? Think of what you could do with that. Why, you could debug on the host system! Then, to run on the DSP, just re-build.

But, wait a second. What about those intrinsics? Those weird looking function calls like this ...

   y = _add2(a, b);

Code running on the DSP needs these intrinsics so it will run fast. How could that code work on my host system?

Code supplied in the host intrinsics package implements intrinsics like _add2(). Details are in this presentation.

Key Features

  • Hosted, in C language, implementation of all TI DSP C6000 family intrinsics enabling customers to maintain a single (yet optimized) source-code base that runs in both the C/C++ host programming environment and the DSP.
  • Validated on cygwin with gcc, Linux with gcc, Microsoft Visual Studio and (naturally) on TI DSP (the latter being done simply to compare results). The (few) tests that require big-endian are done on a Sparc Solaris workstation.
  • Unit Test suite for each intrinsic plus a variety of "real-world" tests combining multiple intrinsics.
  • Enables use of rich host development environments such as Microsoft Visual Studio etc. Customers may then be able to take advantage of tools like purify, quantify etc.

Download

All of these downloads are free. A my.ti.com login is required. Newer releases also require you to go through a simple and automated export screening process.

Version 0.91.00

Older Versions

Older versions can be downloaded from here.

How to test the Host Intrinsics?

To check the actual DSP-side results as a baseline you can use Loadti, a command line loader based on Debug Server Scripting that works on Simulation or Hardware platforms. For example: -

loadti -o=.\K_filt_long\Debug\K_filt_long.out -x=.\K_filt_long\Debug\K_filt_long.xml

We use the generated XML file to compare / diff for regression purposes. CCS project files are supplied for the DSP environment.

The same test can then be run under e.g. cygwin with gcc via: -

make
./dbg/K_filt_long

The result is pretty straightforward. It should yield e.g.

K_FILT_LONG: Result pass

The <testname>_d.c file is the main test harness. It executes 2 versions of a test routine - 1 in natural C (<testname>_c.c), the other loaded up with TI DSP intrinsics (<testname>_i.c). Results from both are compared. If they differ the test reports a failure, else TESTNAME: Result pass is printed to STDOUT.

The unit test harness is simpler - it simply compares the C intrinsics result with a known correct value. It does however try to catch corner cases by using values that impact sign-extension, saturation etc.

Related Articles