SERBIAN JOURNAL OF ELECTRICAL ENGINEERING Vol., No. 3, October 04, 365-377 UDC: 6.37.54:004.383.3]:5.64 DOI: 0.98/SJEE40306S Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve Flter Desg Negova Stamekovć, Dragaa Žvaljevć, Vdosav Stojaovć Abstract: Implemetato of IIR flters resdue umber system (RNS) archtecture s more complex comparso to FIR flters, due to troducto of the scalg fucto. Ths fucto performs operato of dvso by a costat factor, whch s usually the power of two, ad after that the operato of roudg. I that way dyamc rage reducto dgtal systems s acheved. There are dfferet methods for scalg operato mplemetato, already preseted refereces. I ths paper, some RNS dyamc reducto techques have bee aalyzed ad the applcato of oe selected techque has bee preseted o example. I all RNS calculatos the power of two modul set {,, +} has bee appled. Keywords: Resdue arthmetc, Dgtal arthmetc, Scalg, Chese remader theorem. Itroducto Resdue umber system (RNS) s a parallel umber represetato system. I RNS, a teger wth large word-legth s dvded to several relatvely small tegers accordg to a specfc modul set. The addtos ad multplcatos of RNS tegers are performed cocurretly ad depedetly, ad there are o carres amog resdue chaels. The N th-order recursve dgtal flter s characterzed by the followg dscrete tme-doma relato: where N N j j, () j0 j y ( ) bx ( j) ay ( j) b j s the set of forward coeffcets, a j s the set of reverse coeffcets, x s the curret put, x j s the past put ad y j s the past output. I order to perform practcal mplemetato of ths flter that use RNS arthmetc, the coeffcets ad put sgal have to be coded by covertg Uversty of Pršta (at K. Mtrovca), Faculty of Natural Scece, 80 Kosovska Mtrovca, Lole Rbara 9, Serba; E-mal: egovastamekovc@gmal.com Uversty of Nš, Faculty of Electroc Egeerg, A. Medvedeva 4, 8000 Nš, Serba 365
N. Stamekovć, D. Žvaljevć, V. Stojaovć varables from the floatg pot system to tegers, by multplyg by a approprate coverso factor, K, ad roudg the result to the earest teger. Hece: N N y () Bx ( j) Ay ( j) { j }, () j K j0 j where B j ad A j are scaled up forward ad reverse coeffcets, respectvely. Implemetato of FIR flters does ot requre scalg [, ], but for the mplemetato of IIR flters scalg s ecessary. Scalg up s easy. Computato s smplfed by multplyg coeffcets wth l. Note that l has bee also trasformed to RNS. Scalg dow ( the followg text oly term 'scalg' wll be used) recursve flters s requred RNS code because stable recursve equatos geerally have floatg pot coeffcets that caot be represeted a teger umber system. If we choose the proper modul set, the the scalg factor K ca be a product of several modul or a sgle modulus, as t wll be show the followg text. Ths factor wll be used to derve a suffcet codto that esures that the RNS output y ( ) does ot exceed ts dyamc rage M. The flter cossts of three detcal sectos whch compute N N y ( ) B x( j) A y( j) { }, (3) j m m j m m m K j0 j where x m deotes the operato x modulo m. I a typcal IIR desg usg RNS, a system s mplemeted as a collecto of recursve ad orecursve system, each defed terms of a FIR structure, as show Fg.. Each FIR system may be mplemeted drectly from ther coeffcets [3]. Fg. RNS mplemetato of IIR flter usg two FIR sectos per chael ad scaler. 366
Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve Therefore, for stable flter, the recursve part should be scaled to cotrol dyamc rage growth. The scalg operato may be mplemeted wth mxed-radx coverso [4], Chese remader theorem (CRT) [5, 6], or ew CRT-I [7]. For mplemetato of scalg algorthms there are two approaches avalable the lterature cludg LUT-based approaches [8, 9] ad adder-based approaches [5, 0]. Hece, hgh effcet mplemetato of scalg s oe of the crtcal ssues applcatos of RNS recursve flter desg. I ths paper, a K scalg archtecture based o the specal modul set, s preseted. The scalg approach s CRT based. The scalg the frst ad the thrd chael s subtractor based whle the secod chael explots CRT to geerate the scaled resdue []. Ths paper s orgazed as follows: Secto provdes the detaled dervato of the proposed RNS scalg algorthm. Secto 3 descrbes the mplemetato archtecture of the proposed RNS scaler. The paper s cocluded Secto 4. RNS Scalg Techque Certa scalg dow operatos have bee proposed [5, 8, ] for scalg a teger the RNS. Let RNS umber X ( x0,, x k ) be the put to the scalg process, Y the output, ad K the scalg factor. I that case we have X X XK Y K (4) K where x s the floor fucto, also called the greatest teger fucto. Sce X s a usged teger umber, the (4) becomes y Y m X X K K m m m x X K K m m m The scalg s completely defed by the set of resdues ( y0,, y k ). A suffcet codto for the exstece of K m (5) s that Greatest Commo Dvsors (GCD) have value GCD ( Km, ). The ma problem fdg resdue Y s to obta value of K m. If the scalg factor K s the k product of some modul, that s, K m, the X K s easly avalable. For example, f K m, the value of X K s drectly avalable from the frst k resdue x, as t wll be show the followg text. However, f K m, 367. (5)
N. Stamekovć, D. Žvaljevć, V. Stojaovć sce GCD ( K, p ) whe k, aother algorthm has to be used to compute y. The followg lemmas are ecessary for our RNS computato. Lemma : Let am ad GCD ( am, ), the a multplcatve verse a whch satsfy a am, s a, for a, mk, for k a. a Lemma : The multplcato modulo of a resdue umber x by k, where k s a atural umber, s carred out by k -bt crcular left shftg. Therefore: k x x, kx,x,0 x, x, k. The multplcato of a resdue umber x by k s carred out by k-bt crcular rght shftg. Lemma 3: If X m a, k X ad GCD ( km, ), the modular operato after scalg s X k a m, k where k X deotes that the X s dvsble by k. m Cosder the well-kow 3-modul set { m, m, m 3 } {,, } whch has a dyamc rage approxmately equal to 3 bts. To recostruct the bary umber from ts resdues X ( x, x, x3), the Chese remder theorem (CRT) s geerally used [3 5] accordg to, (6) X m m M x mm M x mm M x 3 m 3 m 3 m3 3 M where M mmm 3, M M m ad M modulo m. 368 M k s the multplcatve verse of The multplcatve verse for gve modul set s show as follows: M m, M m ad M 3 m. By replacg these 3 values (6) we obta X ( ) x ( )( ) x ( )( ) x or (7) 3 ( )
Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve X ( ) x ( ) x x ( ) x3. ( ) (8) Sce X X,, ad usg ( ) Lemma, (8) ca be further smplfed X ( ) x ( ) x x ( ) x x where. (9) 3 ( ) After partal modulo operato we obta X ( ) x x ( ) x x. (0) 3 ( ) Fally, the calculato of CRT (6) ca be wrtte as X ABC x, () 369 A ( ) x, B( ) x, x3 C ( ). Oly logc operato ca be used to evaluate operads A, B ad C. Sce y X, the by usg () m () y ABC. (3) Thus, last sgfcat bts of AB C s y. The resultat resdue dgts of the scaled output for all modulus chaels are detcal to the scaled teger output wth a scalg error ot greater tha oe. Assumg that the bt expressos of x, x 3, x 3 are gve by (the MSB s are gve frst): x 000x x x,,,0 x 000x x x,,,0 x 000x x x 3 3, 3, 3,0 (4) the value A ca be rewrtte bary form by substtutg bary value of resdue x as
N. Stamekovć, D. Žvaljevć, V. Stojaovć A x x x x x. (5),0,,0,, The value B ca be rewrtte bary form by substtutg bary value of resdue x as B x, x, x,0 x, x, x,0 000 000. (6) The value C ca be rewrtte bary form by substtutg bary value of resdue x 3 as C x3,0x3, x3, x3, x3, x3, x3,0 0 00. (7) The addto (7) ca be rewrtte as show (8) C x x x x x x x 0 00 3,0 3, 3,0 3, 3, 3, 3, (8) Four bary umbers the summato of C B ca be reduced to two umbers as follows CB x x x x x x x 0 00 3,0 3, 3,0 3, 3, 3,, 000 x, x, x,0 000. (9) Frstly, summato of the secod ad the thrd bary umber o the rght had sde of equato (9) has to be obtaed. If x 3,, summato of the secod ad the thrd bary umber gves. O the other had, f 3, 0 x summato of the secod ad the thrd bary umber gves 0 00 0. Thus, we ca coclude x3, x3, 0 00 0 00 x3, x3, x3,. (0) By substtutg the (0) to (9) t s obtaed that 370
Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve CB x3,0 x 3, x3,0 x3, x3, x3, x3, x3, 37 x x x 000.,,,0 () Sce x3 ad x 3, ad x 3,, for,...,, ca ever be at the same tme, () ca be smplfed by combg bts marked wth x 3, the secod umber wth correspodg bts x 3,,,,, the frst umber by usg logc OR operato. Thus CB x 3,0 x3, x3,0 x3, x3, 000 () x, x, x,0 000, where x3, x3, x3,, 0,,, ad deotes logc OR operato. At last we cosder summato of the secod ad the thrd umber o the rght sde of (). If x,, ed-aroud-carry summato of the secod ad the thrd umber of () gves ( x, x,0 0 ). O the other had, f x, 0, bary addto wth ed-aroud-carry of the secod ad the thrd umber of () gves (0 x, x,0 0 00). We ca coclude 000 x x x 000,,,0 x x x x x x.,,,0,,, (3) Therefore, the four umbers the summato of C B are reduced to followg two umbers CB x 3,0 x3, x3,0 x3, x3, (4) x, x, x,0 x, x, x,. Example : Let 4, 55, x 00 00, x3 00 000. The by usg () 4 7 3 CB( ) 0 ( ) 0 55 (5) 60 00 70. 55
N. Stamekovć, D. Žvaljevć, V. Stojaovć Usg proposed algorthm wth x3,4 0 the C x3,0 x3,3 x3, x3, x3,0x3,3x3,x3, 0000, B x,3x,x,x,0x,3x,3x,3x,3 00. By modulo addg of these two bary umbers together we obta the followg result: That result s correct. We wll check the values of these umbers A, B ad C wth the MATLAB scrpt below. =6; m=[^-, ^, ^+]; mp=^(*)-; X=99; x=mod(x,m()); x=mod(x,m()); x3=mod(x,m(3)); % ------------------------------------------------- % The default oretato of the bary output s % Rght-MSB; % ------------------------------------------------- xb=deb(x,*); xb=deb(x,*); xb3=deb(x3,*); Ab=[xb(:) xb(:) xb()]; q(:-)=xb(); B_b=[q, ot(xb()),ot(xb(:-)),xb()]; C_b=[ot(xb3(:)),xb3(:) xb3(+),ot(xb3())]; Y=mod(bde(Ab)+bde(B_b)+bde(C_b),mp)*^+x; Check=[X Y] % X ad Y schould be equal To mplemet the modulo addto of three -bt umbers (A, B ad C) effcetly, we may use full adders as carry-save-adders (CSA) to covert the three -bt umbers to two. The carry-out from the most sgfcat bt ( c ) s fed to the least sgfcat bt posto ( c 0). The fast -bt carry-propagate-adder (CPA) wth ed-aroud-carry (EAC), s used to perform the modulo addto of two umbers to obta the fal result. The archtecture s show Fg.. 37
Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve Fg. The mplemetato operad preparato ad modulo ( ) addto of three -bt umbers A, B ad C. Scalg the teger varable X by costat teger K m, ca be obtaed usg (4) ad replacg X wth (6) [5] mm Y m M x M x m M x Sce y Y ad X X, the. (6) 3 3 m m 3 m3 3 mm3 m m mm m m. (7) mm y m M x M x m M x 3 3 m m 3 m3 3 mm3 m m By computg each of the resdue (7) depedetly, t ca be reduced to y x x x x. (8) It ca be see that scalg for the chael eeds oly oe modulo subtracto. Sce y Y ad X X the 3 m 3 mm 3 m3 m3 y x x x x, (9) 3 3 3 373
N. Stamekovć, D. Žvaljevć, V. Stojaovć because. Thus, the scalg for the chael also eeds oly oe modulo subtracto. The secod term of (6) s trucated to product approxmato show (8) ad (9). Sce 0 x, the 0 x / ad / x 0. It ca be cocluded that the proposed algorthm does ot troduce the scalg error. Example : To demostrate the valdty of the above scalg procedure we provde a example. Cosder the teger X 3987 wth the RNS represetato of (,3,9) for the modul set {5,6,7}. Usg (8) ad (9), the scaled output RNS represetato s: y 35 9 y 496 9 (30) y 39 3 7 because ABC 49. It ca be verfed that the RNS umber (9,9,) s equvalet to the teger 49 computed drectly from 3987 /6. 3 Archtecture of RNS Scaler Fg. 3 Archtecture of the proposed RNS scaler, where Y AB C ad y s last sgfcat bts. 374
Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve The complete RNS scalg archtecture [6] s show Fg. 3. The -bt umber Y ABC s scaled teger X ( x, x, x3), but scaled resdue y s hs last sgfcat bts. Thus, scaled output s avalable RNS ad weghted bary form. Sce, x s a -bt umber, the 3-bt teger X ca be realzed wth oly cocateato of x ad Y, wthout the use of hardware (). As show above, scalg chaels ad eeds oly subtractors. I followg text we propose both subtractors for geeratg scalg umbers y ad y 3. The frst modulo ( ) subtracto ca be expressed as follows: x y, f x y, x y (3) x y, f x y. The borrow out sgal, ( B out ), whch results from the subtracto of both x ad y, ca be used the process of computg modulo subtracto. Ths s due to the followg observatos: Bout f x y (3) Bout 0f x y. Thus, t s easy to show that t s possble to express x y as x yb out. The modulo subtractor, wth borrow out feedback sgal, ca be used to mplemet modulo subtractor (3). Ths type of subtractor s also kow as the Borrow-Propagate-Subtractor wth Ed-Aroud-Borrow (BPS wth EAB). Decremeter ca be composed of a half-subtractor array or a data-out MUX array ad a selecto modulo [7]. The proposed modulo ( ) subtracto algorthm avods the double represetato of zero. The secod modulo ( ) subtracto ca be expressed as follows: x y, f x y x y (33) x y, f x y where x ad y. The borrow bt s gored. The MSB-bt, whch results from the subtracto of both x ad y, ca be used the process of computg modulo subtracto. Ths s due to the followg observatos: d f x y, (34) d 0f x y. 375
N. Stamekovć, D. Žvaljevć, V. Stojaovć Thus, t s easy to show that t s possble to express x y as x yd. The modulo subtractor, wth borrow-out feedback sgal, ca be used to mplemet modulo subtractor (33). Proposed modulo ( ) subtracto algorthm avods the double represetato of zero. The modulo subtracto for operads modulo ad modulo represetato ca be performed by a covetoal borrow-propagate-subtractor (BPS). Icremeter s composed of a half-adder array or a data MUX array [8]. Example 3: Based o (33), y3 x x3 ca be computed as Note, y s expressed as a ( ) -bt umber. Igorg the borrow bt B out yelds to the correct result of. 4 Cocluso I ths paper, archtecture of scalg mplemetato for the tradtoal modul set {,, } s proposed. The RNS scalg algorthm s developed based o classcal CRT. For realzato of scalg archtecture, oly oe CPA wth EAC ad two subtractors are requred. The frst subtractor s modulo ad the secod subtractor s modulo. Ths scaler s very sutable for buldg ew types of recursve flter desg. The scaled resdues are terfaced drectly to the weghted bary system wthout the addtoal eed for the resdue-to-bary coverso. 5 Ackowledgemet Ths work was supported by the Serba Mstry of Scece ad Techologcal Developmet, Project No. 3009TR. 6 Refereces [] D. Zvaljevc, N. Stamekovc, V. Stojaovc: Dgtal Flter Implemetato based o the RNS wth Dmshed- Ecoded Chael, 35th Iteratoal Coferece o Telecommucatos ad Sgal Processg, Prague, Czech Republc, 03 04 July 0, pp. 66 666. 376
Scalg Fucto Based o Chese Remader Theorem Appled to a Recursve [] N. Stamekovc, V. Stojaovc: Costat-coeffcet FIR Flters based o Resdue Number System Arthmetc, Serba Joural of Electrcal Egeerg, Vol. 9, No. 3, Oct. 0, pp. 35 34. [3] R. Coway, J. Nelso: Improved RNS FIR Flter Archtectures, IEEE Trasacto o Crcuts ad Systems-II: Express Brefs, Vol. 5, No., Ja. 004, pp. 6 8. [4] N.S. Szabo, R.I. Taaka: Resdue Arthmetc ad ts Applcato to Computer Techology, McGraw-Hll, NY, USA, 967. [5] C.H. Chag, J.Y.S. Low: Smple, Fast ad Exact RNS Scaler for the Three-modul Set {,,+}, IEEE Trasacto o Crcuts ad Systems I: Regular Papers, Vol. 58, No., Nov. 0, pp. 686 697. [6] M. Grff, F. Taylor, M. Sousa: New Scalg Algorthms for the Chese Remader Theorem, d Aslomar Coferece o Sgals, Systems ad Computers, Pacfc Grove, CA, USA, 3 Oct. 0 Nov. 988, Vol., pp. 375 378. [7] J.Y.S. Low, C.H. Chag: A New RNS Scaler for {,,+}, Iteratoal Symposum o Crcuts ad Systems, Ro de Jaero, Brazl, 5 8 May 0, pp. 43 434. [8] A. Garca, A. Llors: A Look-up Scheme for Scalg the RNS, IEEE Trasactos o Computers, Vol. 48, No. 7, July 999, pp. 748 75. [9] Y. Kog, B. Phllps: Fast Scalg the Resdue Number System, IEEE Trasactos o Very Large Scale Itegrato (VLSI) Systems, Vol. 7, No. 3, March 009, pp. 443 447. [0] M.A.P. Sheoy, R. Kumaresa: A Fast ad Accurate RNS Scalg Techque for Hgh Speed Sgal Processg, IEEE Trasactos o Acoustcs, Speech ad Sgal Processg, Vol. 37, No. 6, Jue 989, pp. 99 937. [] N. Stamekovc, D. Zvaljevc, V. Stojaovc: The Use of Resdue Number System the Desg of the Optmal All-pole IIR Dgtal Flters, 36th Iteratoal Coferece o Telecommucatos ad Sgal Processg, Rome, Italy, 0 04 July 03, pp. 7 76. [] G.A. Julle: Resdue Number Scalg ad other Operatos usg ROM Arrays, IEEE Trasactos o Computers, Vol. C-7, No. 4, Aprl 978, pp. 35 336. [3] H.L. Garer: The Resdue Number System, IRE Trasacto o Electroc Computer, Vol. EC-8, No., Jue 959, pp. 40 47. [4] S. Adraos, H. Ahmad: A New Effcet Memoryless Resdue to Bary Coverter, IEEE Trasactos o Crcuts ad Systems, Vol. 35, No., Nov. 988, pp. 44 444. [5] Z. Wag, G. Julle, W.C. Mller: A Effcet 3-modulus Resdue to Bary Coverter, IEEE 39th Mdwest symposum o Crcuts ad Systems, Ames, IA, USA, 8 Aug. 996, Vol. 3, pp. 305 308. [6] N. Stamekovc: Dgtal Flter Implemetato usg RNS-bary Arthmetc, LAP Lambert Academc Publshg, 04. [7] S. B, W.J. Gross, W. Wag, A. Al-Khall, M.N.S. Swamy: A Area-reduced Scheme for Modulo - Addto/subtracto, 5th Iteratoal Workshop o System-o-chp for Real-tme Applcatos, Baff, Alberta - Caada, 0 4 July 005, pp. 396 399. [8] S. Veeramachae, L. Avash, K.M. Krth, M.B. Srvas: A Novel Hgh-speed Bary ad Gray Icremeter/decremeter for a Address Geerato Ut, Iteratoal Coferece o Idustral ad Iformato Systems, Peradeya, Sr Laka, 09 Aug. 007, pp. 47 430. 377