DSP LAB 9 Merged
DSP LAB 9 Merged
Lab Report
Experiment # 9:
Linear Convolution via DSK C6713
Date: _____23-04-2025____
Group Members Registration Number Syndicate
Awais Raza 417441 B
Ummar Rizwan 432088
Muhammad Anas 406540
1 Aim
The aim of this lab is to implement linear convolution using the TMS320C6713 DSP
Starter Kit and verify it using Code Composer Studio (CCS).
2 Equipment
• Operating System: Windows XP
• USB Cable
• Power Supply
3 Theory
3.1 Linear Convolution
Linear convolution is a fundamental operation in digital signal processing that produces
the output response of a system based on its impulse response and an input signal. For
discrete-time signals, the linear convolution of two sequences x[n] and h[n] is defined as:
∞
X
y[n] = x[n] ∗ h[n] = x[k] · h[n − k] (1)
k=−∞
For finite-length sequences, where x[n] has length M and h[n] has length N , the
convolution will produce an output sequence y[n] of length M + N − 1.
1
3.2 TMS320C6713 DSP
The TMS320C6713 is a floating-point digital signal processor developed by Texas Instru-
ments. It features:
The C6713 DSP uses the VelociTI architecture, with eight execution units including
two multipliers and six arithmetic logic units (ALUs).
4 Procedure
1. Open Code Composer Setup and select C6713 simulator, click save and quit.
2. Start a new project using Project → New pull-down menu, save it in a separate
directory (C:\My projects) with file name linearconv.pjt.
3. Create a new source file using File → New Source file menu and save it in the
project folder as linearconv.c.
4. Add the source file (linearconv.c) to the project: Project → Add files to Project →
Select linearconv.c.
5. Add the linker command file hello.cmd: Project → Add files to Project (path:
C:\CCstudio\tutorial\dsk6713\hello\hello.cmd).
6. Add the run time support library file rts6700.lib: Project → Add files to Project
(Path: C\CCStudio\cgtools\lib\rts6700.lib).
9. Load the linearconv.out file (from project folder impulse response\Debug) using
File → Load Program.
11. To view the output graphically, select View → Graph → Time and Frequency.
2
5 Implementation
5.1 C Code for Linear Convolution
The following C code implements linear convolution on the DSK C6713:
1 /*
2 * Linear Convolution on DSK C6713
3 */
4
5 # include < stdio .h >
6 # include < stdlib .h >
7
8 # define INPUT_LEN 5 // Length of input sequence
9 # define IMPULSE_LEN 4 // Length of impulse response
10 # define OUTPUT_LEN ( INPUT_LEN + IMPULSE_LEN - 1) // Length of output
sequence
11
12 // Global variables for visualization in CCS
13 float input [ INPUT_LEN ] = {1.0 , 2.0 , 3.0 , 2.0 , 1.0}; // Input sequence
14 float impulse [ IMPULSE_LEN ] = {0.5 , 1.0 , 0.5 , 0.25}; // Impulse
response
15 float output [ OUTPUT_LEN ]; // Output sequence
16
17 // Function to perform linear convolution
18 void li nearCo nvolut ion ( float *x , int lenX , float *h , int lenH , float * y
) {
19 int n , k ;
20
3
50 for ( int i = 0; i < OUTPUT_LEN ; i ++) {
51 printf ( " % f " , output [ i ]) ;
52 }
53 printf ( " \ n " ) ;
54
55 // Keep program running to allow observation in CCS
56 while (1) ;
57
58 return 0;
59 }
Listing 1: Linear Convolution Implementation
1. Definition of input sequence, impulse response, and output array as global variables
to facilitate visualization in CCS.
3. The main function that calls the convolution function and displays the results.
6 Results
6.1 Expected Output
For the given input sequence x[n] = {1.0, 2.0, 3.0, 2.0, 1.0} and impulse response h[n] =
{0.5, 1.0, 0.5, 0.25}, the expected convolution result is:
y[0] = 1.0 × 0.5 = 0.5
y[1] = 1.0 × 1.0 + 2.0 × 0.5 = 2.0
y[2] = 1.0 × 0.5 + 2.0 × 1.0 + 3.0 × 0.5 = 4.0
y[3] = 1.0 × 0.25 + 2.0 × 0.5 + 3.0 × 1.0 + 2.0 × 0.5 = 5.25
y[4] = 2.0 × 0.25 + 3.0 × 0.5 + 2.0 × 1.0 + 1.0 × 0.5 = 4.0
y[5] = 3.0 × 0.25 + 2.0 × 0.5 + 1.0 × 1.0 = 2.75
y[6] = 2.0 × 0.25 + 1.0 × 0.5 = 1.0
y[7] = 1.0 × 0.25 = 0.25
Therefore, y[n] = {0.5, 2.0, 4.0, 5.25, 4.0, 2.75, 1.0, 0.25}
4
6.2 Visualization
When executed on the DSK C6713, the output can be visualized through CCS’s graphing
capabilities. The Time/Frequency Graph tool allows us to observe the input sequence,
impulse response, and the resulting convolution as shown in Figure 1.
7 Verification
To verify the correctness of our implementation, we can compare the results with the
built-in convolution function in MATLAB or with manual calculations.
The length of the convolution result should be:
5
8 Discussion
8.1 Efficiency Considerations
The implemented algorithm has a time complexity of O(N²), where N is the length of the
longer sequence. For real-time DSP applications, more efficient algorithms such as Fast
Convolution using the Fast Fourier Transform (FFT) might be preferable, especially for
longer sequences.
9 Precautions
1. Switch ON the computer only after connecting the USB cable and ensure the DSP
kit is ON.
10 Conclusion
In this lab, we successfully implemented linear convolution on the TMS320C6713 DSP
using Code Composer Studio. The implementation correctly calculates the convolution
of an input sequence with an impulse response, producing the expected output sequence.
This demonstrates the fundamental operation of convolution, which is crucial for many
digital signal processing applications such as filtering, system identification, and signal
analysis.
Through this lab, we gained practical experience with: