RNS representation and arithmetic Consider the lowcost RNS s
Solution
a) RNS given is RNS(32|31|15|7)
To find RNS representation of x = 168, divide 168 by each moduli of RNS and store the remainder value
168%32 = 8
168%31 = 13
168%15 = 3
168%7 = 0
x = 168 = (8|13|3|0)RNS
To find RNS representation of y = - 23, find the RNS representation of 23 first
23%32 = 23
23%31 = 23
23%15 = 8
23%7 = 2
23 = (23|23|8|2)RNS
To find -23, Subtract the given number from moduli of RNS
-23 = (32-23|31-23|15-8|7-2)RNS = (9|8|7|5)RNS
b) x = 168 = (8|13|3|0)RNS y = -23 = (9|8|7|5)RNS
x + y (RNS) = (8+19|13+8|3+7|0+5) = (27|21|10|5)RNS
Please note: For subtraction, every moduli will be added parallely. In case of overflow, result % rns moduli will be used.
x+y = 168 - 23 = 145 = (27|21|10|5)RNS
x-y (RNS) = (32+8-9|13-8|15+3-7|7+0-5) = (31|5|11|2)RNS
Please note: For subtraction, every moduli will be subtracted parallely. If subtrahend is larger than minuend, then the moduli of RNS will get added to minuend.
x-y = 168 - -23 = 191 = (31|5|11|2)RNS
