Freescale Semiconductor MSC8156EVM User guide

Freescale Semiconductor
Application Note
Document Number: AN4228
Rev. 0, 10/2010

MSC8156EVM Kernels Starting Guide

This document provides a starting guide to some commonly used digital signal processing functions available for use with the Freescale MSC8156EVM board. The example projects are demonstrated in this guide. The objective of this document is to help the users integrate various independent projects using these kernels.

1 Introduction

The MSC8156EVM is supported by a collection of commonly used digital signal processing kernels that function with the SC3850 DSP core. The project described in this document provides the kernel library consisting of C and assembly callable kernel applications, as well as their test harnesses. This tutorial guide demonstrates how to use several of the most useful and representative kernel examples such as FIR and IIR filters, FFT, Divide and Matrix Inverse.
NOTE
Download the kernel software package from the MSC8156EVM Tool Summary Page on
www.freescale.com.
Contents
1 Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1
2 What You Need to Run this Project . . . . . . . . . . . . . . . . .2
3 Test Procedures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
4 Common Kernel Example Demonstration . . . . . . . . . . . .4
4.1 FIR_complex_16x16. . . . . . . . . . . . . . . . . . . . . . . . . . .5
4.2 Complex Radix-4 FFT/IFFT 16x16 . . . . . . . . . . . . . . . .6
4.3 Complex Radix-2 and Radix-4 FFT/ IFFT 16x16 . . . . .9
4.4 IIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
4.5 Division 16×16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12
4.6 Ln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
4.7 Matrix Invers io n Co mp lex 2×2 . . . . . . . . . . . . . . . . . .14
4.8 Matrix Invers io n Co mp lex 4×4 . . . . . . . . . . . . . . . . . .15
© 2010 Freescale Semiconductor, Inc.
What You Need to Run this Project

2 What You Need to Run this Project

Running the DSP kernels requires the following devices:
Personal computer (PC) with CodeWarrior for StarCore-Based DSP IDE for the MSC8156EVM board connected to the PC
MSC8156EVM board
The MSC8156EVM project includes the following kernels:
FIR_complex_16×16
Complex Radix-4 FFT/IFFT 16×16
Complex Radix-4 and Radix-2 FFT/IFFT 16×16
IIR
Division
•Ln
Matrix Inversion complex 2×2
Matrix Inversion complex 4×4
Figure 1 shows the folder directory of all the kernel example projects.
Figure 1. Kernel Example Project Directory
MSC8156EVM Kernels Starting Guide, Rev. 0
2 Freescale Semiconduct or

3 Test Procedures

Use the following steps to prepare for and run the project:
1. Import the SC3850 DSP kernel library by dragging the .project file in
\fsl_sc3850_kernels\code\cw\sc3850_kernels to the CodeWarrior project window (Figure 2).
Figure 2. Importing the Project Files
2. Build the kernel by clicking on the build icon .
3. After building the kernel project, .elb files are created in the folder fsl_sc3850_kernels\lib.
Test Procedures
4. After the kernel is built, you can run one of the test cases in the \fsl_sc3850_kernels\test\ folder. Import the associated .project of the selected test case and build the project. After building the test case, .eld files are created in the \fsl_sc3850_kernels\tests\<test_case>\cw folder.
5. Load the project by clicking on the debug icon and selecting Debug Configurations.
6. Select the appropriate launch configuration, that is, assembly or C test (Figure 3), and click on the Debug button. Note that not all test cases are available in both assembly (ASM) and C. Some test cases only have one option.
Figure 3. Launch Configuration
7. Run the project by clicking on the run icon .
NOTE
See Section 4, Common Kernel Example Demonstration for details on how to run the DSP kernel test cases.
MSC8156EVM Kernels Starting Guide, Rev. 0
Freescale Semiconduc tor 3
Common Kernel Example Demonstration

4 Common Kernel Example Demonstration

After the DSP kernel library is built, the u ser can run one of the kerne l test ca ses provided with the EVM. This section provides detailed information for each kernel. For each kernel, the listing includes the following:
Location from which to import the file.
Function
ASM Prototype
C Prototype
Inputs
Outputs
Data alignment requirements (if applicable).
Performance Measurement
The following notes apply for all kernels:
1. Import the kernel as described in Section 3, Test Procedures.
2. DPU is a defined function that enables cycle measurements
#ifdef DPU
#define INIT_CYCLE InitDPU()
#define GET_CYCLE ReadCountDPU()
#endif
3. The kernel is called twice in the example project. The first call brings the kernel to cache so we can measure the performance of the second call more with warm cache.
4. The test results printed in the CodeWarrior console should show the cycles used to complete the kernel process and check with the reference outputs.
MSC8156EVM Kernels Starting Guide, Rev. 0
4 Freescale Semiconduct or

4.1 FIR_complex_16x16

Location:
fsl_sc3850_kernels\tests\fir_complex_16x16\cw\test_sc3850_fir_complex_16x16
Function:
FIR filtering with 16-bit complex inputs and coefficients
ASM Prototype:
void sc3850_fir_complex_16x16_asm(Word32 x[], Word32 h[], Word16 y[], Word16 nr, Word16 nh);
C Prototype:
Void sc3850_fir_complex_16x16_c(Word32 x[], Word32 h[], Word16 y[], Word16 nr, Word16 nh);
Inputs:
Word32 x[]: 32-bit complex inputs, 16 bits for real part and 16 bits for imaginary part Word32 h[]: 32-bit complex coefficients, 16 bits for real and 16 bits for imaginary part Word16 Nr: number of input data samples Word16 Nh: number of elements in the filter
Common Kernel Example Demonstration
In the test source code, these inputs are defined as shown in Figure 4.
#define Nr 40 #define Nh 40
Word16 Inpu t[2 * (2 *Nr + Nh+ 2) ]= {
#include "../vectors/test_in _8 0. dat "
};
Word16 Coef f[2 * Nh ]={
#include "../vectors/coeff.d at "
};
Input data and coefficients are vectors stored in .dat files
Test_in_80 has 244 entries Coeff has 80 entries
Figure 4. Input Definitions
Output:
Word16 y[]:16-bit output. Interleaved real and imaginary part
In the test source code, the output is computed and stored as shown in Figure 5.
str ea m = fo pen( "../vectors/output_8 0.da t", "w+ " );
for
(i= 0 ;i<2*2*N r;i+ + )
{ fpr in t f(s tr eam,"%d,\n",( in t) Ou tp ut[i]); }
fclose(strea m );
Figure 5. Output Definition
The output vector is stored to output_80.dat and compared with the reference output. If the accuracy of the filter is verified, in the CodeWarrior console it displays:
No wrong results found
MSC8156EVM Kernels Starting Guide, Rev. 0
Freescale Semiconduc tor 5
Loading...
+ 11 hidden pages