Title: Difficult RNS Operations
1Difficult RNS Operations
- Sign Test
- Magnitude Comparison
- Overflow Detection
- Generalized Division
Suffices to discuss first three in context of
being able todo magnitude comparison since they
are essentially same if M is such that MNP1
where the values representedare in interval
-N,P.
2Difficult RNS Operations
- Sign Test same as Comparison with P
- Overflow Detection accomplished using Signs of
Operands and Results - Focus On
- Magnitude Comparison
- Generalized Division
3Magnitude Comparison
- Could Convert to Weighted Representation Using
CRT - Too Complicated too much Overhead
- Use Approximate CRT Instead
- Divide CRT Equality by M
by Definition
4Approximate CRT
- Addition of Terms is Modulo-1
- All mi-1lt?iyigtmi Are in 0,1)
- Whole Part of Result Discarded and Fractional
Part Kept - Much Easier than CRT Modulo-M Addition
- mi-1lt?iyigtmi Can be Precomputed for all y and i
- Use Table Lookup Circuit and Fractional
Adder (ignore carry-outs)
5Approximate CRT LUT
6Magnitude Comparison Example
Use approximate CRT decoding to determine the
larger of the two numbers.
Reading the Values from the Tables
Thus, we conclude that
7Approximate CRT Error
If Maximum Error in Approximate CRT Table is ?,
then Approximate CRT Decoding Yields Scaled Value
of RNS Number with Error No Greater than k ?
Previous Example Table Entries Rounded to 4 Digits
Maximum Error in Each Entry is ?0.00005
k4 Digits Error is 4?0.0002
0.0571-0.05360.0035 gt 4?0.0002, so XgtY is Safe
8Redundant RNS Representations
- Do Not Have Restrict Digits in RNS to Set 0, mi
-1 - If 0, ?i Where ?i ? mi Then RNS is Redundant
- Redundant RNS Simplifies Modular Reduction Step
for Each Arithmetic Operation
9Redundant RNS Example
- Consider mod-13 with 0,15
- Redundant since
- Addition Using Pseudo-redundancies Can be Done
with Two 4-bit Adders
X
Y
Cout
00
Ignore
SUM