4210 Archtecture and Hardware for DSP Lecture 1 Introducton & Number systems
Admnstratve Stuff 4210 Archtecture and Hardware for DSP Text: VLSI Dgtal Sgnal Processng Systems: Desgn and Implementaton. K. Parh. Wley Interscence Posted artcles
Admnstratve Stuff Offce hours: Monday 1-2pm TR 3-4pm Room 2026 B x40607 HW 10% Quzes 10% Mdterm 25% Project 15% Fnal 40%
Topcs Number systems Fast arthmetc Algorthm representaton Transformaton (retmng, unfoldng, foldng) Systolc arrays and mappng algorthms nto hardware Low power desgn
Introducton Introducton to DSP algorthms Non-termnatng programs n real tme. Speed depends on applcatons (audo, vdeo, 2-D, 3-D, ) Need to desgn famles of archtectures for specfed algorthm complexty and speed constrants
Typcal DSP Programs nt 3T 2T T 0 Input DSP System Output 3-Dmensonal optmzaton: Area, Speed, Power) Usually, speed s a requrement, area-power tradeoff P=C V 2 F
Examples FIR flter, x(n) s the nput, y(n) output J 1 yn ( ) = h( jxn ) ( j) j= 0 IIR flter P = + yn ( ) ayn ( ) ( ) bkxn ( ) ( k) Q = 1 k= 0
Examples Convoluton M 1 N 1 = = yn ( ) xhn ( ) ( ) h( jxn ) ( j) = 0 j= 0 For n=1 to M+N-2, y(n)=0, For =0:M-1, y(n)=y(n)+x()*h(n-) end end MAC operaton
More Complex Examples Moton Estmaton Image (frame) s dvded nto macroblocks Each macroblock s compared to a macroblock n the reference frame usng some error measure. The search s conducted over a predetermned search area. A vector denotng the dsplacement of the (moton) s sent.
More Complex Examples Moton Estmaton Many measures of errors could be used. The dsplaced block dfference s(m,n) usng MAD (Mean Absolute Dfference) s defned as s( m, n) N = 1 N 1 x(, j) y( + m, j + = 0 j= 0 n) m,n are n s the search area, N s the macroblock sze. The one wth the mnmum error s chosen
More Complex Examples Vector Quantzaton Used n compresson A group of samples (vector) are quantzed together For example consder k pxels, wth W bts. That vector s compared to a group of N codewords, choose the one wth the mn. dstorton. We transmt the ndex of that codeword
More Complex Examples Vector Quantzaton Compresson rato = KW/log 2 N Eucldean dstance s used as a measure of dstorton. d( x,c = x 2 j ) = x c 2( x c j j 2 + e = j ), k 1 ( x = 0 e j c = j 1 2 ) 2 c j 2 = 1 2 k 1 c = 0 2 j
Dscrete Cosne Transform The 1-D DCT s defned as X ( K) = e( k) N 1 n= 0 (2n + 1) kπ x( n)cos 2N, k = 0,1,2,, N 1 e( k) = 1 f k = 0 2 1 otherwse
More Complex Examples Vterb Decodng FFT Wavelets and Flter banks See the book for detals
Requrements Consder block matchng algorthm, the computatonal requrement s as follows 3(2p+1) 2 NMF 3*(2*7+1)*288*352*30=2GOP Much hgher for hgher resoluton and bgger frames How to acheve these requrements?
hardware Mcroprocessors Mcroprocessors wth DSP extenson DSP FPGA ASIC
Number System Numbers and ther representaton Bnary numbers Negatve numbers Unconventonal numbers
Bnary Numbers An ordered sequence The value of the number s x n {0,1} The range [X mn, X max ] s the range of the numbers to be represented, n the prevous case [0,2 n -1]
Bnary numbers The prevous representaton s nonredundant and weghted (w ) The n-dgt number can be parttoned nto a fracton part (n-k bts) and an ntegral part(k bts)
Bnary numbers Gven the length of the operand, n, the weght r -m of the least sgnfcant dgt ndcates the poston of the radx pont. Unt n Last Poston ulp=r -m Smplfes the dscusson and there s no need to partton the number nto fractonal and ntegral parts.
Converson Convert 36.4375 nto bnary 36/2 Dvson by 2 Quotent Remander 18 0 9 0 4 1 2 0 1 0 0 1 Multplcaton by 2 Integer 100100.0111 Fracton 0.875 1.75 1 0.5 1 0.0
Negatve Numbers Sgned magntude Complement Dmnshed radx complement (1 s complement for bnary) Radx complement (2 s complement n bnary)
Sgned magntude The n th bt (dgt) s the sgn n-1 dgts for magntude (k-1 ntegral and m fractonal). Largest value 011 11 = X max =r k-1 -ulp Smallest negatve value (r k-1 -ulp) 11..1 Two representaton for zero
Sgned magntude Operatons may be more complcated than usng complement. For example, addng 2 numbers, a postve number X, and a ve number Y, the result depends on f X>Y or not If X > Y the result s X+(-Y) If Y>X swtch the 2 numbers, subtract, attach mnus sgn (Y-X)
Complement representaton Postve numbers are represented just as sgned-magntude Negatve numbers are represented as R- number, where R s a constant Note that (-y)=r-(r-y))=y The choce of R must satsfy 2 condtons Calculatng the complement s easy Smplfyng or elmnatng correcton
Complement representaton For radx complement R=r k For the dmnshed radx complement R=r k -ulp
r=2, k=n=4, m=0, ulp=2 0 =1
2 s complement Example 6= 0110-6 = 1010 4=0100-4 = 1100 6-4 4-6 6+4-4-6 0110 0100 0110 1100 1100 1010 0100 1010 1 0010 1110 1010 1 0110 +2-2 -6 +6 Carry n = carry out Ignore carry out Carry n carry out Overflow
1 s complement Example 6= 0110-6 = 1001 4=0100-4 = 1011 6-4 4-6 6+4-4-6 0110 0100 0110 1011 1011 1001 0100 1001 1 0001 1101 1010 1 0100 +2-2 -5 +4 Carry n = carry out Add to LSB Carry n carry out Overflow
Arthmetc Shft Consder the number Fnte extenson of sgned magntude s 0,0{ x, x,.,.,. }0,0,...... n 2 n 3 x0 2 s complement 1 s complement { xn 2, xn 3,.,.,. x0}... xn 1, xn 1{ xn 2, xn 3,.,.,. x0}0,0,...... xn 1, xn 1{ xn 2, xn 3,.,.,. x0} xn 1, x n 1
Arthmetc Shft 2 s Comp 1 s Comp -6 1010-6 1001-12 10100-12 10011-24 101000-24 100111-6 1010-6 1000-3 1101-3 1100-2 1110-1 1110-1 1111-0 1111
Unconventonal Number System Negatve radx number system A general class of of fxed-radx number system Sgned-dgt number system Resdue number system
Negatve radx Number System The radx could be negatve, r=-β, β s a postve number. Dgt set 0,1,, β-1 Value of X n = 1 x = 0 ( xn 1, xn 2,..., x0 ) ( β ) 287-10 =200-80+7= 127 Range = [090,909] -10, or [-9,909] 10 1010-2 = -8-2= -10 Range=[1010,0101] -2 = [-10,5] 10
Negatve radx Number System Algorthms do exst for basc operatons. Not better than 2 s complement systems
General Class of Fxed Radx Number System Characterzed by (n,β,λ), β s a postve radx, dgt set 0,1, β-1, and a vector of length n Λ=(λ n-1, λ n-2, λ 0 ) λ = {-1,1} X n 1 = = 0 λ x β 2 s Complement Λ={-1,1,1,.1}
General Class of Fxed Radx Number System P p P = { p = n 1 1/ 2( λ + 1)( β 1) β = 0 = 1/ 2 n 1, p [ n ] Q + ( β 1) Where Q s n 2,..., 0 } β 1 f λ = + 1 = 0 otherwse p the value of = Max. postve number 1 2 ( λ + 1)( β 1) n 1 n 1 = 1/ 2 λ ( β 1) β + ( β 1) β = 0 = 0 the tuple ( β 1, β 1,, β 1) Fnd the smallest representable number
Sgned Dgt Number System The dgts could be postve or negatve Redundant (more than one representaton for the same number) For a radx β, x {β-1, β-2,,1,0,1 β-1} To reduce redundancy, X r -1 = 2 r { a, a 1,...,1,0,1,... a}, where a 1
Sgned Dgt Number System Example: β=10,a=6,
Breakng the Carry Chan Add two numbers X,Y 0, f ) ( f ) ( f 0 1 1 0 1 1 = + = < + + + = + = + + t t w s a y x a y x a y x t rt y x w Example, a=6,r=10 1634+3366
Breakng the Carry Chan
Breakng the carry chan For no carry s = w +t a, -> w a-1 1 2 1 2 1 1 (1) ) ( w (lower bound) a y Case 2 1 2 (1) 2 w (upper bound) 2a y Case1 + + = = = = + = = = + r a r a r a a r a r w r a r a x r a r a r a x
Breakng the carry chan For bnary SD, r=2,a=1 t s mpossble for the prevous condton to hold. We do have carry n SD addton
Breakng the carry chan X,y 00, 11 01 01 01 01 11 11 X -1,y -1 Neth er s 1 At least one s 1 Neth er s 1 At least one s 1 t +1 0 1 0 0 1 1 1 w 0 1 1 1 0 0 0
Breakng the carry chan Example
Breakng the carry chan Example
Breakng the carry chan