Experiments for Chapter 3

Download Chapter 3 experimental software programs

Back to Top


Fixed-Point Implementation

There are 5 experiments in this chapter:

1.     Experiment 3A - Quantization of Sinusoid Signals

2.     Experiment 3B - Quantization of Speech Signals

3.     Experiment 3C - Overflow and Saturation Arithmetic

4.     Experiment 3D - Quantization of Coefficients

5.     Experiment 3C - Function Approximation in Fixed-point Number Representation

The purpose of the experiments in this section are to learn input quantization effects and to determine the proper fixed-point representation for a fixed-point DSP system.


Experiment 3A - Quantization of Sinusoid Signals

To experiment with the input quantization effects, we altering the number of bits of the input samples into 16-bit, 12-bit, and so on. The C function exp3a.c is listed in Table E3-1 for reference. The linker command file used for the experiments are identical to the previous experiments.

 

Table E3-1 List of C function for Experiment 3A.

 

To conduct Experiment 3A, following these steps:

1.     Create the project, exp3a and include the linker command file exp3.cmd, the function exp3a().

2.     Use rts55.lib for main() function initialization and build the project.

3.     Build the project and debug if needed.

4.     Using CCS to display all output buffers out16[], out12[], out8[], and out6[], set integer data type with data length 40 for viewing, see Figure E3-1.

5.     Compare the results of each output stream and describe the differences between the waveform represented by different wordlength.

 

Figure E3-1 Quantization effects of 12, 8, and 6 bits to a sinusoid signal.

Back to Top


Experiment 3B - Quantization of Speech Signals

Speech is one of most used signals in DSP applications, from cell phone to MP3 player. To understand the quztization effects to the speech signals, this experiment uses a digitized speech file timit1.asc as input for demonstration. The function exp3b.c for this experiment is listed below.

 

Table E3-2 List of C function for Experiment 3B.

 

To conduct Experiment 3B, following these steps:

1.     Create the project, exp3b and include the linker command file exp3.cmd, the function exp3b().

2.     Use rts55.lib for main() function initialization and build the project.

3.     Build the project. Debug is needed.

4.     Use the File I/O capability of the CCS to connect the speech data file timit1.asc to your project using probe points.

5.     After quantizing the speech file to 12-bit, 8-bit, and 4-bit, using File I/O to save the quantized speech files to disk. Then, using MATLAB or other programs to listen to the original speech file and comparing it with three quantized speech files at 12, 8, and 4 bits.

Back to Top


Experiment 3C - Overflow and Saturation Arithmetic

Overflow may occur in fixed-point DSP system when the number is larger than the register or memory can handle. In this experiment, we use assembly routine ovf_sat.asm to demonstrate the overflow and overflow handling. The function exp3c.c for this experiment and the assembly routine ovf_sat.asm are listed in Table E3-3 and Table E3-4, respectively.

 

Table E3-3 List of C function for Experiment 3C.

 

Table E3-4 List of the overfolw and saturation demo routine for Experiment 3C.

To conduct Experiment 3C, following these steps:

1.     Create the project, exp3c and include the linker command file exp3.cmd, the function exp3c(), and assembly routine ovf_sat.asm.

2.     Use rts55.lib for main() function initialization and build the project.

3.     Build the project. Debug is needed.

4.     Use the CCS graphic function to view the ramp counter and sinewave. See Figure E3-2 for reference.

(a) Without saturation protection - overflow causes the data errors

(b) with saturation protection - the data saturated when overflow occurs

Figure E3-2 Examples of overflow and saturation.

 

Back to Top


Experiment 3D - Quantization of Coefficients

Filters are widely used for DSP applications. Due to quantization, the filter in fixed-point representation will no longer the same as the floating-point filter obtained from most filter design packages. In this experiment, we use assembly routine exp3d_iir.asm to show the quantization effects to filter coefficients. More filter experiments will be presented later in Chapter 5 and Chapter 6. The function exp3d.c for this experiment and the assembly routine exp3d_iir.asm are listed in Table E3-5 and Table E3-6, respectively.

 

Table E3-5 List of C function for Experiment 3D.

 

Table E3-6 List of the IIR filter routine for Experiment 3D.

To conduct Experiment 3D, following these steps:

1.     Create the project, exp3d and include the linker command file exp3.cmd, the function exp3d(), and assembly routine exp3d_iir.asm.

2.     Use rts55.lib for main() function initialization and build the project.

3.     Build the project. Debug is needed.

4.     Interface the project with a signal source, such as the speech file timit1.asc. Process the data and save the filter output.

5.     Listen the IIR filte output file generated with different coefficient wordlengths.

 

Back to Top


Experiment 3E - Function Approximation in Fixed-point Number Representation

For DSP applications, we often use Q-format to represent fractional numbers. We have introduced quantization and overflow protection in previous experiments. In this experiment, we will present another useful method - polynomial approximation with sinusoid function example to further study and understand the fixed-point arithmetic operation and overflow control. The function exp3e.c for this experiment and the assembly routine sine_cos.asm are listed in Table E3-7 and Table E3-8, respectively.

 

Table E3-7 List of C function for Experiment 3E.

 

Table E3-8 List of the sine-cosine generator for Experiment 3E.

To conduct Experiment 3D, following these steps:

1.     Create the project, exp3e and include the linker command file exp3.cmd, the function exp3e(), and assembly routine sine_cos.asm.

2.     Use rts55.lib for main() function initialization and build the project.

3.     Build the project. Debug is needed.

4.     Calculate the values of sin(q) and cos(q) functions for 0<q<2p.

 

Back to Top


copyright © 2001 by Sen M. Kuo and Bob H. Lee
website last updated March 17, 2001