DSP Cours V2 PDF
DSP Cours V2 PDF
DSP Cours V2 PDF
Elément de module:
Traitement du signal et implémentation sur DSP
Digital Signal Processing and Applications with the
TMS320C6713 DSK
Prof A.JBARI
[email protected]
Books:
– Digital Signal Processing Using MATLAB®, Third Edition, Vinay K. Ingle and John G.
Proakis, (Cengage Learning 200 First Stamford Place, Suite 400, Stamford, CT 06902,
USA)
– Digital Signal Processing Fundamentals and Applications, Li Tan, DeVry University
Decatur, Georgia, Copyright 2008, Elsevier Inc
– Digital Signal Processing and Applications with the C6713 and C6416 DSK, Rulph
Chassaing,Worcester Polytechnic Institute, Copyright © 2005 by John Wiley & Sons, Inc.
– DSP Applications Using C and the TMS320C6x DSK, Rulph Chassaing, Copyright © 2002
by John Wiley & Sons, Inc.
Web documents and links:
• http://www.analog.com/media/en/technical-documentation/data-sheets/ADSP-
2101_2103_2105_2115.pdf?doc=AD7475_7495.pdf
• ftp://ftp.analog.com/pub/cftl/ADI%20Classics/Mixed%20Signal%20and%20DSP%20Design%20Tec
hniques,%202000/Section_7_DSP_Hardware.pdf
• dspworkshop_part1_2007.pdf , dspworkshop_part2_2007.pdf
• …
Integer representation
Example:
27=0 0 0 1 1 0 1 1
To define a fixed point type conceptually, all we need are two parameters:
width of the number representation, and binary point position within the
number
Real number= integer part
· Fractional part
N= F× r ^ E:
Decimal numbers use radix of 10 (F×10^E);
while binary numbers use radix of 2 (F×2^E).
• Examples: N=48
r=10: N= 4,8 * 101 : F=4,8 ; E=1
r=2: N= 48 = 1,5*25 : F=1,5 ; E =5
N= -48 = -1,5*25
= 1 10000100 10000000000000000000000
= C2400000 h
Modern computers store one byte of data in each memory address or location,
i.e., byte addressable memory. An 32-bit integer is, therefore, stored in 4 memory
addresses.
The term "Endian" refers to the order of storing bytes in computer memory. In "Big
Endian" scheme, the most significant byte is stored first in the lowest memory
address (or big in first), while "Little Endian" stores the least significant bytes in
the lowest memory address.
Examples:
The 32-bit integer 12345678H (221505317010) is stored as:
– in big endian: 12H 34H 56H 78H
– in little endian: 78H 56H 34H 12H.
An 16-bit integer 00H 01H is interpreted as 0001H in big endian, and 0100H as
little endian.
Analog Digital
Discrete function Vk of discrete
Continuous function V of
sampling variable tk, with k =
continuous variable t (time,
Sampled integer: Vk = V(tk).
space etc) : V(t).
signal
Sampling
operation
Analog filter: to limit the frequency range of analog signals prior to the sampling process
and attenuate aliasing distortion (Antialias filter).
Analog-to-digital conversion (ADC) unit: to sample and convert band-limited signal into
the digital signal, which is discrete both in time and in amplitude.
Digital signal (DS) processor: processes the digital data according to DSP rules such as
lowpass, highpass, and bandpass digital filtering, or other algorithms for different
applications.
Digital-to-analog conversion (DAC) unit: Converts the processed digital signal to an
analog output signal which is continuous in time and discrete in amplitude.
Reconstruction (anti-image) filter: to smooth the DAC output voltage levels back to the
analog signal for real-world applications.
Digital filtering:
Open-Loop Architecture
= −
=0
=
Spectral analysis:
The sampled signal spectrum is the sum of the scaled original spectrum and
copies of its shifted versions, called replicas.
Pr. A.JBARI DSP implementation 22
Signal Sampling
Half of the sampling frequency fs=2 is usually called the Nyquist frequency
(Nyquist limit), or folding frequency.
Condition: the spectrum of the sampled signal ys(t) contains the same spectral
content as the original spectrum X( f ).
Recovered
signal spectrum
" !
The linear time-invariant digital filter can then be described by the linear
difference equation:
& &
,&
$=' #$ +
−$
*+ =
+ ,)
$=' ($ +
−$
2πnk N−
−1
1 2πnk
N −1 −j 1 j
X [k ] = ∑ x[n]e N x[n] =
N
∑ X [k ]e
n =0
N
n =0
• Requires:
– Complex multiplications: N2
– Complex additions: N(N-1)
– Real Multiplications: 4*N2
– Real additions: 2N (2N-1)
= ∑ x[ n
n even
]W nk
N + ∑ x[
n odd
n ]W nk
N
N −1 N −1
2 2
WNr
Or simplify:
WN( r + N 2) WNr -1
(= −WNr )
For N=8 :
WNr
Or simplify:
WN( r + N 2 ) WNr -1
(= −WNr )
Motion estimation
Memory-register architecture
register on-chip
file memory
example:
Goal
add first 100 values in array a
– reduce overhead for executing loops
and store result in R1
– general purpose processors
initialize loop counter TMS320C3x-like assembler
execute loop body
check loop exit condition
LDI @a, AR0!
branch to loop start or exit loop
LDI 0.0, R1!
– digital signal processors
RPTS 99!
initialize loop counter
ADDF3 *(AR0)++, R1, R1!
execute loop body
…
check loop exit condition
branch to loop start or exit loop
RPTS N repeats next
instruction N-1 times
■ Add, Subtract, Negate, Increment, Decrement, Absolute Value, AND, OR, Exclusive
OR, NOT
■ Bitwise Operators, Constant Operators
■ Multi-Precision Math Capabilites
■ Divide Primitives
■ Saturation Mode for Overflow Support
■ Background Registers for Single-Cycle Context Switch
■ Example Instructions:
◆ IF EQ AR = AX0 + AY0;
◆ AF = MR1 XOR AY1;
◆ AR = TGLBIT 7 OF AX1;
■ 40-Bit Accumulator for Overflow Protection (219x Adds Second 40-Bit Accumulator)
◆ IF MV SAT MR;
◆ MR = MR - AR * MY1(SS);
◆ MR = MR + MX1 * MY0(RND);
◆ IF LT MR = MX0 * MX0(UU);
MAC Instructions
[IF cond] MR|MF
= xop * yop ; Multiply
= MR + xop * yop ; Multiply/Accumulate
= MR – xop * yop ; Multiply/Subtract
= MR ; Transfer MR
= 0 ; Clear
IF MV SAT MR ; Conditional MR Saturation
Pr. A.JBARI DSP implementation 58
Hardware Multiply
Multiply//Accumulate (MAC) Unit
Two types of parallel MAC:
Remarks:
• At clock cycle 11, the pipeline is “full”
• There are no holes (“bubbles”) in the pipeline in this example
Remarks:
• Fetch packet n has 3 execution packets
• All subsequent fetch packets have 1 execution packet
• Notice the holes/bubbles in the pipeline caused by lack of parallelization
Pr. A.JBARI DSP implementation 78
Execute Stage of C6713 Pipeline
results available
after E1 (zero delay slots)
Functional Latency: How long must we wait for the functional unit to be free?
Delay Slots: How long must we wait for the result?
General remarks:
Functional unit latency <= Delay slots
Strange results will occur in ASM code if you don’t pay attention to delay
slots and functional unit latency
All problems can be resolved by “waiting” with NOPs
Efficient ASM code tries to keep functional units busy all of the time.
Efficient code is hard to write (and follow).
TMS320C6713 DSK:
digital inputs = 4 DIP switches
digital outputs = 4 LEDs
ADC and DAC = AIC23 codec