1 / 32

Brief Overview of Residue Number System (RNS)

Brief Overview of Residue Number System (RNS). VLSI Signal Processing 台灣大學電機系 吳安宇. Outline. History Why RNS is needed ? Fundamental concepts in RNS. Conversion between Decimal and Residue. Conventional complex RNS Difficult arithmetic operations Applications. History.

sasha
Download Presentation

Brief Overview of Residue Number System (RNS)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Brief Overview ofResidue Number System (RNS) VLSI Signal Processing 台灣大學電機系 吳安宇

  2. Outline • History • Why RNS is needed ? • Fundamental concepts in RNS. • Conversion between Decimal and Residue. • Conventional complex RNS • Difficult arithmetic operations • Applications

  3. History • The ancient study of the residue numbering system begins with a verse from a third-centry book, Suan-Ching, by Sun Tzu. We have things of which we do not know the number, If we count them by three, the remainder is 2, If we count them by fives, the remainder is 3, If we count them by sevens, the remainder is 2, How many things are there?

  4. History • We commemorate this contribution as the Chinese Remainder Theorem, or CRT. This theorem, as well as RNS, was set forth in the 19th by Carl Friedrich Gauss in his celebrated Disquisitiones Arithmetical.

  5. Why RNS? • It is a “carry-free” system that performs addition, substraction, and multiplication as parallel operations. FA FA FA FA HA

  6. Definition • The RNS is defined in terms of a set of relatively prime moduli. • If P denotes the moduli set, then The dynamic range M is

  7. Definition • Any integer in the residue class ZM has a unique L-tuple representation given by where Xi=(X mod pi) and is called the ith residue.

  8. X → X1 X2 X → X1 X2 X → X1 X2 0 → 0 0 5 → 2 0 10 → 1 0 1 → 1 1 6 → 0 1 11 → 2 1 2 → 2 2 7 → 1 2 12 → 0 2 3 → 0 3 8 → 2 3 13 → 1 3 4 → 1 4 9 → 0 4 14 → 2 4 Example

  9. X X X X X → → → → → X1 X1 X1 X1 X1 X2 X2 X2 X2 X2 X3 X3 X3 X3 X3 12 24 0 48 36 → → → → → 0 0 0 0 0 0 0 0 0 0 2 4 0 1 3 13 49 25 37 1 → → → → → 1 1 1 1 1 1 1 1 1 1 3 0 1 2 4 26 50 2 38 14 → → → → → 2 2 2 2 2 2 2 2 2 2 4 1 0 2 3 39 27 3 15 51 → → → → → 0 0 0 0 0 3 3 3 3 3 4 1 2 0 3 40 52 4 28 16 → → → → → 1 1 1 1 1 0 0 0 0 0 3 4 2 1 0 17 41 53 5 29 → → → → → 2 2 2 2 2 1 1 1 1 1 1 0 4 3 2 6 54 42 30 18 → → → → → 0 0 0 0 0 2 2 2 2 2 4 2 1 3 0 19 7 55 31 43 → → → → → 1 1 1 1 1 3 3 3 3 3 4 0 3 2 1 44 32 56 8 20 → → → → → 2 2 2 2 2 0 0 0 0 0 0 2 1 3 4 21 33 45 57 9 → → → → → 0 0 0 0 0 1 1 1 1 1 3 1 0 2 4 10 46 58 22 34 → → → → → 1 1 1 1 1 2 2 2 2 2 2 3 1 0 4 35 59 47 11 23 → → → → → 2 2 2 2 2 3 3 3 3 3 0 4 2 3 1 Example

  10. X → X1 X2 X → X1 X2 X → X1 X2 -6 → 0 2 -2 → 1 2 2 → 2 2 -5 → 1 3 -1 → 2 3 3 → 0 3 -4 → 2 0 0 → 0 0 4 → 1 0 -3 → 0 1 1 → 1 1 5 → 2 1 Sign Representation • For signed RNS, any integer in (-M/2, M/2], has a unique RNS L-tuple representation where xi=(X mod pi) if X>0, and (M-|X|) mod pi otherwise.

  11. Operation

  12. 7(1, 3, 2 ) 7(1, 3, 2 ) 7(1, 3, 2 ) +3(0, 3, 3 ) - 3(0, 3, 3 ) *3(0, 3, 3 ) 10(1 mod 3, 6 mod 4, 5 mod 5) = (1,2,0) 4(1 mod 3, 0 mod 4, -1 mod 5) = (1,0,4) 21(0 mod 3, 9 mod 4, 6 mod 5) = (0,1,1) Operation (Example)

  13. Conversion • Efficient and rapid implementation of the operation (Xi o Yi) mod pi must be found. Only for the case where pi=2n can be easily implemented in conventional system. Xi (n bits) RAM or ROM Table Lookup Zi = (Xi o Yi) mod pi Zi (n bits) Yi (n bits)

  14. Decimal-to-residue Conversion • To be competitive system, the speed of data acquisition and the accompanying decimal-to-residue conversion must be equally fast.

  15. pi-(25mod pi) 2j mod pi j=4 j=3 j=2 j=1 j=0 i=1 3 i=1 1 3 4 2 1 i=2 3 i=2 2 1 4 2 1 Decimal-to-residue Conversion

  16. Residue-to-decimal Conversion • Generally speaking, the speed limitation of residue-to-decimal conversion is a problem in residue number system. • The R/D problem can be solved in one of the following two ways: • Mixed radix conversion (MRC) • Chinese Remainder Theorem (CRT)

  17. Pi=5 g 0 1 2 3 4 gi-1  1 3 2 4 Pi=6 g 0 1 2 3 4 5 Example: gi-1  1    5 Pi=7 g 0 1 2 3 4 5 6 gi-1  1 4 5 2 3 6 Multiplicative Inverse • The multiplicative inverse of g of modulo pi is denoted as gi-1 and satisfies

  18. Mixed Radix Conversion RNS • The MRC representation is given by MRC where v1=1, v2=p1, v3=p1p2, v4=p1p2p3, …

  19. Mixed Radix Conversion

  20. Mixed Radix Conversion • Use nesting subtractions and multiplicative inverse to make sequential conversion.

  21. Block Diagram of MRC p12-1 M p13-1 M p23-1 M p1L-1 M p2L-1 M pL-1,L-1 M

  22. Chinese Remainder Theorem where si=M/pi and si-1 is the multiplicative inverse of si mod pi, so that

  23. Chinese Remainder Theorem X1s1-1 mod p1 s1 X2s2-1 mod p2 s2 mod M XL sL-1 mod pL sL

  24. Chinese Remainder Theorem 1*2 mod 3 20 0*3 mod 4 15 mod 60 4*3 mod 5 12

  25. Conventional Complex RNS A complex number Z is defined to be

  26. Difficult Arithmetic Operations Magnitude comparison / Sign detection Division Base extension Scaling / Rounding / Truncation Overflow detection

  27. Magnitude ComparisonSign Detection • Not a weighted number system. • Every digits are equally important. The problem makes the RNS-based signal processors inefficient.

  28. Division • Blend of nested subtractions and magnitude comparisons, so it is more difficult in the RNS. RNS is not closed under division, since the RNS is an integer system, it is. Slow, high-overhead operation and should be avoided in RNS.

  29. L - tuple RNS K - tuple RNS Moduli extension R/D conversion D/R conversion Base Extension • Increase the dynamic range • Increase the resolution. R/D and D/R conversions are needed.

  30. Scaling / Rounding / Truncation • Prevent dynamic-range overflow. • A special form of division. • The scaling operation is easily to implement when scaling factor is: • power of two (2n) in 2’complement. • product of one or more of the moduli in RNS.

  31. Overflow Detection • Take the form of magnitude comparison. • To be avoided by using scaling operation during run-time.

  32. Applications • Filtering (FIR, IIR) • Adaptive system • Linear transformations

More Related