Professional Documents
Culture Documents
BITS Pilani: Digital Signal Processing
BITS Pilani: Digital Signal Processing
BITS Pilani
Pilani|Dubai|Goa|Hyderabad
Date : 09/1/2014
DIGITAL SIGNAL PROCESSING A signal is a function of one or more independent variables. y1 = sin (2 . Pi. 10. t); How many independent variables? This is a 1D signal. How do you represent a gray scale image pixel? Y = F (x, y); A signal can be M- dimensional.
SIGNAL
SIGNAL A signal is called scalar valued if its value is unique for every instant of independent variables. If a signal has multiple values at any instant, it is called as vector valued signal. Ex: Black and white image ? Colour image?
A black and white video is a ___D signal? A color video signal is a___ D signal? 3 channel and 3D signal.
1. Simple time domain operation 2. Filtering 3. Signal generation 4. Generation of complex valued signal 5. Amplitude modulation 6. Quadrature amplitude modulation 7. Multiplexing and demultiplexing
Advantages of DSP
More robust than analog signals with respect to temperature and other time variation. Easy to adjust the processing characteristic just by changing the coefficients. Accuracy can be controlled by changing the word length of signal. Flexibility (Programmability and reusability) Digital signals can be stored, recovered, transmitted received and manipulated virtually without any error. Reproductively is easy. Exact linear phase No loading problem due to cascading
Disadvantages of DSP over ASP DSP design can be expensive especially for high bandwidth signals where fast analog to digital conversion is required(>10 MHz). Design of DSP system is extremely time consuming and highly complex and specialized activity. DSP device consume more power and thus not suitable in some cases using battery power. The need for ADC and DAC not economical for simpler application.
Periodic and aperiodic signal Symmetric and antisymmetric signal Energy and Power Signal
increase as w
DSP techniques can be applicable if the system is a LTI i.e. linear time invariant. Most useful systems fall into linear time invariant category . In DSP , the signal being processed is broken into simple components, each component is processed individually, and the result is reunited.
Common decompositions:
Impulse decomposition:
An N samples signal is decomposed in to N component signals, each containing N samples. Each of the component signals contains one point from the original signal, with the remainder of the values being zero. A single nonzero point in a string of zeros is called an impulse.
Fourier Decomposition: Fourier decomposition is important for three reasons. First, a wide variety of signals are inherently created from superimposed sinusoids. Second, linear systems respond to sinusoids in a unique way: a sinusoidal input always results in a sinusoidal output. Third, the Fourier decomposition is the basis for Fourier analysis, and the even more advanced Laplace and ztransforms. Most cutting-edge DSP algorithms are based on some aspect of these techniques.
Use Impulse decomposition Each impulse will be a shifted and scaled delta function. Obtain system response to each decomposed impulse. Super impose the response corresponding to each decomposed impulse. Can you draw the shape of the system output corresponding to the above input?
CONVOLUTION
x[n]
h[n]
y[n]
Example: x[n]= [0, 1, 2, -1, 1, 2, 1, 2, 1] h[n] = [0, 1, -1, 0] y[6]=? Here N=9, M=4 = h[0] x[6-0]+h[1]. X[6-1]+h[2].x[6-2]+h[3].x[6-3] = 0+(1)(2)+(-1)(1)+0 =2-1 =1 For obtaining the DSP system output we have to do mainly multiply and accumulate operation.
Expression for 8-tap FIR filter. Y[n] = a0 X[n]+ a1 X[n-1]+ a2 X[n-2]+ -- - - - +a7X[n-7] Most recurring computation is multiplication and then accumulation (MAC)
DSP~GPP
Real time throughput requirement Used in embedded application. To support DSP computation like FFT, convolution, special features are provided. Have MAC unit Not real time throughput needed Desktop computing No special features.
Architectural evolution:
Von Neumann
Called as Von Neumann architecture. Designed by: John Von Neumann, an American mathematician. Single memory shared by both the program instructions and data. Most computers today are of the Von Neumann design.
How many cycles needed for MAC instruction for two numbers that reside in external memory? 1. Get the opcode of instruction. 2. Get data1 3. Get data2 4. Multiply and accumulate and store result. (Assume that CPU computation takes very small time in comparison to memory access) So need four cycles.
Harvard architecture
Developed at Harvard University (1940) Program instructions and data can be fetched at the same time. Increasing overall processing speed Most present day DSPs use this dual bus architecture. Ex: ADSP-21xx and AT&T's DSP16xx.
1. Instruction 1 fetched. 2. Instruction 1 decode and get data1 from DM and coefficient from PM 3. Perform MAC operation and store result in DM as well as fetch Instruction 2 from PM. 4. Instruction 2 decode get data1 from DM and coefficient from PM 5. Perform MAC operation and store result in DM (for inst 2) as well as fetch Instruction 3 from PM. So single MAC operation need 3 cycles
Three memory banks Allow three independent memory accesses per instruction cycle. Processors based on a three-bank modified Harvard architecture include the Zilog Z893xx, Motorola DSP5600x, DSP563xx
Multiple-Access Memories
Using fast memories that support multiple, sequential accesses per instruction cycle over a single set of buses OR Using multi-ported memories that allow multiple concurrent memory accesses over two or more independent sets of buses.
This arrangement provides one program memory access and two data memory accesses per instruction word. Ex: Motorola DSP561xx processors.
Part of program memory is used as data memory. Including an instruction cache in the CPU. The first time through a loop, slower operation Next executions of the loop will be faster This means that all of the memory to CPU information transfers can be accomplished in a single cycle. EX: ADSP-2106x and new ADSP-211xx
VLIW CPUs have four to eight execution units. One VLIW instruction encodes multiple operations. EX:if a VLIW device has four execution units, then a VLIW instruction for that device would have four operation fields. VLIW instructions are usually at least 64 bits in width. VLIW CPUs use software (the compiler) to decide which operations can run in parallel. Hardware's complexity for instruction scheduling is reduced. EX: TMS320 C6xx
Endians:
Big Endian(MSB in first location) Little endian How 12345678 will be stored in four location starting from 4000 in each case? TI DSP: Little endian Motorola DSP: Big endian
Fixed-point
16-bit 20-bit 24-bit
Narrow dynamic range but costs low. Faster than FLPDSP
Floating-point
32-bit 64-bit 80-bit 128-bit
Wider dynamic range but complex hardware. Slower than FIPDSP
Fixed-Point Notation
A 16-bit fixed-point number can be interpreted as either: Integer (i.e., 20645) Fractional number (i.e., 0.75)
Integer:
Unsigned integer (from 0 to 216 i.e. 65,536) Signed integer (from 32,768 to 32,767) N-bit fixed point, 2s complement integer representation X = -bN-1 2N-1 + bN-2 2N-2 + + b020
Represent 3 using 3-bit twos complement representation. What is the maximum and minimum number you can represent using 3-bit twos complement representation?
Let us do multiplication using 3-bit twos complement representation. 1. Multiply 2 with (-1)
Now removing the two extended sign bits to have size of 3 we get:
Is the result correct? No. Overflow occurs as the result (-6) is out of dynamic range (-4).
011
001
So the overflow error is avoided. As multiplication of fractional number can not exceed dynamic range no overflow will be there.
Some parameters to define representation accuracy Precision Smallest step (difference) between two consecutive N-bit numbers. Dynamic Range Ratio between the largest number and the smallest (positive) number. It can be expressed in dB (decibels) as follows: Dynamic Range (dB) =
In integer representation the precision is how much? In DSP much more precision is needed. So fractional number representation is used.
Q m.n notation m bits for integer portion n bits for fractional portion Total number of bits N = m + n + 1, for signed numbers Example: 16-bit number (N=16) and Q2.13 format 2 bits for integer portion 13 bits for fractional portion 1 signed bit (MSB) Special cases: 16-bit integer number (N=16) => Q15.0 format 16-bit fractional number (N = 16) => Q0.15 format; also known as Q.15 or Q15
Binary pt position .
Q1.14
Upper 2 bits
Remaining 14 bits
Q15 used in 16-bit DSP chip, resolution of the fraction will be 215 or 30.518e6 Q15 means scaling by 1/215 Q15 means shifting to the right by 15 Example: how to represent 0.2625 in memory: Method 1 (Truncation): INT[0.2625*215]= INT[8601.6] = 8601 = 0010000110011001 Method 2 (Rounding): INT[0.2625*215+0.5]= INT[8602.1] = 8602 = 0010000110011010 By this method of rounding or truncation we introduce quantization error
Represent 0.95624 in Q4 format. Use truncation and rounding. 15.2999984 01111 Find the quantization error. Ans: 0.01874 Overflow in Fixed point addition:
Fixed-point
16-bit 20-bit 24-bit
Narrow dynamic range but costs low. Faster than FLPDSP
Floating-point
32-bit 64-bit 80-bit 128-bit
Narrow dynamic range but complex hardware. Slower than FIPDSP
A number is represented by two parts: a mantissa and an exponent where value of the number = mantissa x 2exponent The mantissa is usually a signed fractional value with a single implied (not actually stored) integer bit. Exponent is in excess or biased notation (biase = 127 for single precision and 1023 for double precision) The exponent is an integer that represents the number of places that the binary point of the mantissa must be shifted right or left to obtain the original number represented.
EX: what is the value of 1 10000001 01000000000000000000000 Exponent = 129-127=2 Fraction part =0.012 = 0.25 Value = - 1.25 * 22 = - 5 Express +0.5 in single precision format. 0.5 = 1.00*2-1 Exponent = 126 (126-127=-1), sign is 0, fraction part = 0.00 0 01111110 00000000000000000000000
Ex: Represent 100.25 in IEEE754 floating point format. Steps: 1. Convert decimal to binary 2. Represent binary number obtained in proper format 3. Represent exponent in biased format 4. Zero pad. ANS: 100 = 1100100 0.25 = 0.01 100.25= 1100100.01=1.10010001*26 X-127=6 X=133 = 85h=10000101 0 1000 0101 1001000100000
E = E1 +E2 - 127 Example: X1 = 1 10000010 00000000 X2 = 0 10000011 000.00 Ans? 1 10000110 000000
Let E1 = 250 and e2 = 250 What will be E? Need 9 bits to represent and not available. Over flow in multiplication Underflow in multiplication The minimum value of biased exponent = 1 (= -126 actual) If an actual number has exponent less than -126, this can not be normalized and called as denormal number. Ex: X = 1* 2 -64 and x2 = 1* 2 -65
55
CTFT
DTFT
DFT
If h[n] is of finite length or of infinite length? If y[n] will be of finite length or infinite length?
2. IIR filter:
a1 = - 0.9
Can you find y[n] for different values of n? Assume y[n] = 0 for n <0 What is this y[n] is called as Can it be called as impulse response?
Can you find the z- transform and H(z) of this ? Can I write the expression for y[n] in generalized form as
Can you find the impulse response for this system? h[0], h[1], h[2], .
What will be the pole of this TF? Can you show the location of pole in z plane? An IIR filter is stable if all poles of the TF are within the unit circle.
What are the location of the poles? At zero. So FIR filter is always stable.
p 0 + p1 z 1 + p 2 z 2 + L + p M z M H (z) = d 0 + d 1 z 1 + d 2 z 2 + L + d N z N
N
H (z) =
n=0
h[ n ] z n
Advantages in using an FIR filter (1) Can be designed with exact linear phase (2) Filter structure always stable with quantised coefficients Disadvantages in using an FIR filter - Order of an FIR filter is considerably higher(~10 times) than that of an equivalent IIR filter meeting the same specifications; this leads to higher computational complexity for FIR
FIR filter design using FS method. Need to find impulse response for finite duration. Direct truncation of impulse response leads to well known Gibbs phenomenon. It manifests itself as a fixed percentage overshoot and ripple before and after discontinuity in the frequency response
/2
G (e
j
N = 50
G (e
/2
j
N = 100
/2
/2
71
Direct truncation of impulse response leads to well known Gibbs phenomenon. It manifests itself as a fixed percentage overshoot and ripple before and after discontinuity in the frequency response