New Reverse Conversion for Four-Moduli Set and Five-Moduli Set

Abstract

Most reverse conversions in Residue Number Systems (RNS) are based on the Chinese Remainder Theorem (CRT) and the Mixed Radix Conversion (MRC). The complexity of the circuitry of the CRT is high due to the large modulo-M operation. The MRC has a simple circuitry but it’s a sequential process in nature. The purpose of this research is to obtain an efficient reverse conversion method to reduce the computational overhead found in the conventional reverse conversion algorithms. In this paper, new algorithms for reverse conversion in RNS for four-moduli set and five-moduli set have been proposed and their correctness evaluated. Numerical evaluations to ascertain the correctness and simplicity of the algorithm have been presented. These algorithms have fewer multiplicative index operations than those in the conventional CRT and MRC. The large modulo-M operation has been eliminated which reduces the computational overhead.

Share and Cite:

Salifu, A. (2021) New Reverse Conversion for Four-Moduli Set and Five-Moduli Set. Journal of Computer and Communications, 9, 57-66. doi: 10.4236/jcc.2021.94004.

1. Introduction

In recent times, digital processors based on RNS contribute significantly in many digital signal processing applications. In these related applications, addition is the common operation that is carried out using different kinds of adders. In RNS based arithmetic operations, there is no carry propagation which is a great limiting factor of archiving high speed processing time. Digital processors built based on RNS offer the advantages of parallelism and fault tolerance [1] [2] [3] [4]. In RNS, Integers are represented by taking the modulus operation of the given integer over a set of moduli. The respective residues represent the integer in RNS. Some of the problems that limit the full utilization of RNS are difficult in carrying out division, magnitude comparison, sign detection and scaling [5] [6].

To utilize RNS based processors and their advantages, conventional number systems such as numbers in binary or decimal representation must be converted into residues and that is referred to as Forward Conversion, then the RNS processor does the arithmetic operations and results are converted back to their binary or decimal equivalent and the process is referred to as Reverse Conversion. The Forward Conversion process is very fast and straight forward. The Reverse Conversion is more difficult and introduces much overhead in terms of time complexity and area [7] [8].

The conversions component of RNS structure is very essential in determining the performance of RNS. The conversion process may be computational intensive in the circuitry and may introduce undue propagation delay and increase the area of the general architecture of the RNS system. This can derail the importance of using RNS in digital processor applications. To completely build an RNS processor that can replace the currently used digital processors, there is the need to build efficient conversion algorithms that will still make the gains in terms of speed in RNS a worthwhile adventure.

Currently available conversion algorithms are based on the Chinese Remainder Theorem or the Mixed Radix Conversion techniques. The MRC is inherently a sequential process in nature; in computing the mixed radix digits, the correctness of the subsequent mixed radix digits depends on the preceding mixed radix value. This is a major challenge as an error in one mixed radix value will lead to an error in the preceding mixed radix value. The major problem with the Chinese remainder theorem based reverse conversion techniques is the need of a large modulo adder in the last stage. This can derail the general performance of the RNS architecture because it increases the computational intensity of the conversion process.

In this paper, a new reverse conversion technique is presented for a four modular set and five modular set. The paper seeks to obtain a new reverse algorithm without the need of a large modulo adder found in the CRT conversion technique. The proposed conversion technique also seeks to resolve the inherent sequential process found in the MRC. This technique is based on what is proposed by Asiedu and Salifu (2021) but limited to a two-moduli set and a three-moduli set hence limiting the dynamic range (few numbers can be represented). The new scheme seeks to increase the dynamic range in order to allow applications with huge numbers to be represented.

2. Related Algorithms

Traditionally, there are two main known algorithms for reverse conversion, the Chinese Remainder Theorem (CRT) and the Mixed Radix Conversion (MRC). Other variants based on the CRT and MRC have been proposed. The advantage of the CRT is because the data conversion can be parallelized to limit inherent errors in the conversion process. The disadvantage is that it has slow modulo-M operation. MRC has less complex circuitry but by nature, it is a sequential process where the value of the subsequent mixed radix depends on the preceding mixed radix value. This implies that an error in one mixed radix value will lead to an error in the subsequent mixed radix value.

Asiedu and Salifu (2021) proposed a recent reverse conversion algorithm for two-moduli set and three-moduli set that are very simple and with fewer multiplicative inverse operations than there are in the traditional algorithms like the Chinese Remainder Theorem (CRT) and Mixed Radix Conversion (MRC).

2.1. Chinese Remainder Theorem

Given the moduli set { m 1 , m 2 , m 3 , , m n } and the RNS representation of an integer X be represented as { x 1 , x 2 , x 3 , , x n } . Then the Chinese Remainder Theorem is as follows:

| X | M = | i = 1 N x i | M i 1 | m i M i | M (2.1)

where M is the product of the mi M i 1 are the multiplicative inverse of M i with respect to mi M i = M m i [9] [10].

2.2. Mixed Radix Conversion

Consider the moduli set { m 1 , m 2 , m 3 , , m n } and the RNS representation of an integer X be given as { x 1 , x 2 , x 3 , , x n } , it’s decimal equivalent is computed based of the Mixed Radix Conversion as follows:

X = d 1 + d 2 m 1 + d 3 m 1 m 2 + + d n m 1 m 2 m 3 m n 1 (2.2)

where d i , i = 1 , 2 , , n are the Mixed Radix Digits (MRDs) and computed as follows:

d 1 = x 1

d 2 = | ( x 2 d 1 ) | m 1 1 | m 2 | m 2

d 3 = | ( ( x 3 d 1 ) | m 1 1 | m 3 d 2 ) | m 2 1 | m 3 | m 3

d n = | ( ( ( x 3 d 1 ) | m 1 1 | m n d 2 ) | m 2 1 | m n d n 1 ) | m n 1 1 | m n | m n [11] (2.3)

That is, X in the interval [ 0 , M ] can be unambiguously represented.

3. Proposed Algorithms

The proposed algorithm is based on the algorithm for reverse conversion proposed by Asiedu and Salifu (2021). The authors proposed new algorithms for reverse conversion for two-moduli set and for three-moduli set. In this paper, four-moduli set and a five-moduli set are proposed.

3.1. Algorithm for Four Moduli Set

Given a four moduli set m = { m 1 , m 2 , m 3 , m 4 } and residues r = ( r 1 , r 2 , r 3 , r 4 ) , moduli set m and residues r can be represented in congruence form as:

X r 1 mod m 1 (3.1)

X r 2 mod m 2 (3.2)

X r 3 mod m 3 (3.3)

X r 4 mod m 4 (3.4)

Equation (1) can be written in an equation form as:

X = m 1 k + r 1 (3.5)

Equation (5) must satisfy Equation (2) such that

m 1 k + r 1 r 2 mod m 2

m 1 k ( r 2 r 1 ) mod m 2

k ( r 2 r 1 ) m 1 1 mod m 2

k = m 2 t + | ( r 2 r 1 ) m 1 1 | m 2 .

Putting k into Equation (5), we have

X = m 1 m 2 t + ( m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) (3.6)

Equation (6) must satisfy Equation (3) such that

m 1 m 2 t + ( m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) r 3 mod m 3

m 1 m 2 t r 3 ( m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) mod m 3

t ( r 3 m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) ( m 1 m 2 ) 1 mod m 3

t = m 3 p + | ( r 3 m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) ( m 1 m 2 ) 1 | m 3

Putting t into Equation (5), we have

X = m 1 m 2 ( m 3 p + | ( r 3 m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) ( m 1 m 2 ) 1 | m 3 ) + ( m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 )

X = m 1 m 2 m 3 p + m 1 m 2 ( | ( r 3 m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) ( m 1 m 2 ) 1 | m 3 ) + ( m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) (3.7)

Now Equation (7) is the general form of decimal equivalent that satisfies Equation (4) such that:

| m 1 m 2 m 3 p + m 1 m 2 ( | ( r 3 m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) ( m 1 m 2 ) 1 | m 3 ) + ( m 1 | ( r 2 r 1 ) m 1 1 | m 2 + r 1 ) | m 4 = r 4

where p = [ 0 , r 4 ] .

3.2. Algorithm for Five Moduli Set

Following the algorithm for four moduli set above,

Special case for four moduli sets with two or more of its residues being the same: Given a four moduli set m = { m 1 , m 2 , m 3 , m 4 } and residues r = ( r 1 , r 2 , r 3 , r 4 ) , if any two of these residues are the same then the value of s in the formula for four moduli set can be directly set to the value of the residues that appeared twice without any computation of s.

With the advancement of four moduli set having two or more of its residues being the same, the number of multiplicative inverses and the number of arithmetic operations are further reduced.

NOTE: It should be noted that, the r i 1 which gives the valid range for p ( p = [ 0 , r i 1 ] ) can be chosen base on the least value of mi’s in a given moduli set corresponding to its residue to limit the range of p.

4. Evaluation

Numerical evaluations of the algorithms are presented to ascertain the correctness of the algothms as follows:

Consider the four-moduli set as { 2 n + 1 , 2 n , 2 n 1 , 2 n 1 1 } .

As n = 4, we have M = {17, 16, 15, 7} and residues r = (7, 11, 0, 5).

As n = 2, we have M = {5, 4, 3, 1} and residues r = (2, 1, 0, 0).

Solution:

With four moduli set, we have:

From example 1,

m 1 = 17 , m 2 = 16 , m 3 = 15 , m 4 = 7 r 1 = 7 , r 2 = 11 , r 3 = 0 , r 4 = 5

X = | 17 × 16 × 15 p + 17 × 16 ( | ( 0 s ) × ( 17 × 16 ) 1 | 15 ) + s | 7 = 5

where,

s = 17 | ( 11 7 ) × 17 1 | 16 + 7

s = 17 | 4 × 1 | 16 + 7

s = 75

X = | 4080 p + 272 ( | ( 0 75 ) × 272 1 | 15 ) + 75 | 7 = 5

X = | 4080 p + 272 ( | ( 75 ) × 8 | 15 ) + 211 | 7 = 5

X = | 4080 p + 272 × 0 + 75 | 7 = 5

| 4080 p + 75 | 7 = 5

p = [ 0 , 1 , 2 , 3 , 4 , 5 ] .

When p = 0,

| 4080 × 0 + 75 | 7 = 5 is satisfied. Since | 75 | 7 = 5 satisfied X at the value of 75 ( 4080 × 0 + 75 ), we stop and take that value as its decimal equivalent.

Therefore the decimal equivalent for n = 2 is 75.

From example 2,

m 1 = 5 , m 2 = 4 , m 3 = 3 , m 4 = 1 , r 1 = 2 , r 2 = 1 , r 3 = 0 , r 4 = 0

X = | 5 × 4 × 3 p + 5 × 4 ( | ( 0 s ) × ( 5 × 4 ) 1 | 3 ) + s | 1 = 0

where,

s = 5 | ( 1 2 ) × 5 1 | 4 + 2

s = 5 | ( 1 ) × 1 | 4 + 2

s = 5 × 3 + 2

s = 17

X = | 60 p + 20 ( | ( 0 17 ) × 20 1 | 3 ) + 17 | 1 = 0

X = | 60 p + 20 ( | ( 17 ) × 2 | 3 ) + 17 | 1 = 0

X = | 60 p + 20 × 2 + 17 | 1 = 0

| 60 p + 57 | 1 = 0

p = [ 0 ] .

When p = 0,

| 60 × 0 + 57 | 1 = 0 is satisfied. Since | 57 | 1 = 0 satisfied X at the value of 57 ( 60 × 0 + 57 ), we stop and take that value as its decimal equivalent.

Therefore the decimal equivalent for n = 2 is 57.

Consider the five-moduli set as { 2 n 1 1 , 2 n + 1 , 2 n , 2 n 1 , 2 n + 1 1 } .

As n = 4 we have m = {7, 17, 16, 15, 31} and residues r = (4, 14, 4, 10, 5).

As n = 5, we have m = {31, 65, 64, 63, 127} and residues r = (6, 6, 37, 5, 116).

Solution:

With five moduli set, we have:

We earlier stated that to limit the range of p, the smallest m i can be chosen instead of using m i 1 for the range of p. Example 3 and 4 will be used for instance.

From example 3, the smallest modulus is 7 corresponding to residue 4 will be used for the range of p instead of the last modulus which is 31. For this instance,

m 1 = 17 , m 2 = 16 , m 3 = 15 , m 4 = 31 , m 5 = 7 , r 1 = 14 , r 2 = 4 , r 3 = 10 , r 4 = 5 , r 5 = 4

X = | 17 × 16 × 15 × 31 p + 17 × 16 × 15 ( | ( 5 q ) × ( 17 × 16 × 15 ) 1 | 31 ) + q | 7 = 4

where,

s = 17 | ( 4 14 ) × 17 1 | 16 + 14

s = 17 | ( 10 ) × 1 | 16 + 14

s = 17 × 6 + 14

s = 116

q = 17 × 16 ( | ( 10 116 ) × ( 17 × 16 ) 1 | 15 ) + 116

q = 272 ( | ( 106 ) × 8 | 15 ) + 116

q = 272 × 7 + 109

q = 2020

X = | 126480 p + 4080 ( | ( 5 2020 ) × 4080 1 | 31 ) + 2020 | 7 = 4

| 126480 p + 4080 ( | ( 2015 ) × 18 | 31 ) + 2020 | 7 = 4

| 126480 p + 4080 ( | 36270 | 31 ) + 2020 | 7 = 4

| 126480 p + 4080 × 0 + 2020 | 7 = 4

| 126480 p + 2020 | 7 = 4

p = [ 0 , 1 , 2 , 3 , 4 ] .

When p = 0,

| 126480 × 0 + 2020 | 7 = 4 is satisfied. Since | 2020 | 7 = 4 satisfied X at the value of 2020 ( 126480 × 0 + 2020 ), we stop and take that value as its decimal equivalent.

Therefore the decimal equivalent as n = 4 is 2020.

From example 4, the smallest modulus is 31 corresponding to residue 6 will be used for the range of p instead of the last modulus which is 127. For this instance, m 1 = 65 , m 2 = 64 , m 3 = 63 , m 4 = 127 , m 5 = 31 , r 1 = 6 , r 2 = 37 , r 3 = 5 , r 4 = 116 , r 5 = 6

X = | 65 × 64 × 63 × 127 p + 65 × 64 × 63 ( | ( 116 q ) × ( 65 × 64 × 63 ) 1 | 127 ) + q | 31 = 6 ,

where,

s = 65 | ( 37 6 ) × 65 1 | 64 + 6

s = 65 | 31 × 1 | 64 + 6

s = 65 × 31 + 6

s = 2021

q = 65 × 64 ( | ( 5 2021 ) × ( 65 × 64 ) 1 | 63 ) + 2021

q = 4160 ( | ( 2016 ) × 32 | 63 ) + 2021

q = 4160 × 0 + 2021

q = 2021

X = | 33284160 p + 262080 ( | ( 116 2021 ) × 262080 1 | 127 ) + 2021 | 31 = 6

| 33284160 p + 262080 ( | ( 1905 ) × 82 | 127 ) + 2021 | 31 = 6

| 33284160 p + 262080 ( | 156210 | 127 ) + 2021 | 31 = 6

| 33284160 p + 262080 × 0 + 2021 | 31 = 6

| 33284160 p + 2021 | 31 = 6

p = [ 0 , 1 , 2 , , 6 ] ,

when p = 0

| 33284160 × 0 + 2021 | 31 = 6 is satisfied. Since | 2021 | 7 = 4 satisfied X at the value of 2021 ( 33284160 × 0 + 2021 ) we stop and take that value as its decimal equivalent.

Therefore the decimal equivalent as n = 5 is 2021.

Numerical illustration for special case of four moduli sets with two or more of its residues being the same:

As n = 2 in the four-moduli set, m 1 = 5 , m 2 = 4 , m 3 = 3 , m 4 = 1 , r 1 = 2 , r 2 = 1 , r 3 = 0 , r 4 = 0 . Two of its residues are the same. That is r 3 = 0 and r 4 = 0 . Hence the value of s in the formula for four moduli set must be set to the value of r3 or r4 which is zero (0). Moreover, r 3 = 0 m 3 = 3 and r 4 = 0 m 4 = 1 should be set as r 1 = 0 m 1 = 3 and r 2 = 0 m 2 = 1 . Therefore m 1 = 3 , m 2 = 1 , m 3 = 5 , m 4 = 4 , r 1 = 0 , r 2 = 0 , r 3 = 2 , r 4 = 1 . Hence,

X = | m 1 m 2 m 3 p + m 1 m 2 ( | ( r 3 0 ) ( m 1 m 2 ) 1 | m 3 ) + 0 | m 4 = r 4

X = | 3 × 1 × 5 p + 3 × 1 ( | ( 2 0 ) × ( 3 × 1 ) 1 | 5 ) + 0 | 4 = 1

X = | 15 p + 3 ( | 2 × 2 | 5 ) + 0 | 4 = 1

X = | 15 p + 3 × 4 + 0 | 4 = 1

X = | 15 p + 12 | 4 = 1

p = [ 0 , 1 , 2 , 3 ] .

When p = 3,

| 15 × 3 + 12 | 4 = 1 is satisfied. Since | 57 | 4 = 1 satisfied X at the value of 57 ( 15 × 3 + 12 ), we stop and take that value as its decimal equivalent.

Therefore the decimal equivalent is still 57 as required.

5. Conclusion

A new algorithm for reverse conversion for four-moduli set and a five-moduli set have been proposed. This will have a reverse conversion algorithm with high dynamic range, where more numbers can be uniquely and unambiguously represented. Numerical evaluation shows the correctness of the algorithm.

Conflicts of Interest

The author declares no conflicts of interest regarding the publication of this paper.

References

[1] Tanaka, R.I. and Szabo, N.S. (1967) Residue Arithmetic and its Applications to Computer Technology. McGraw Hill, New York.
[2] Soderstrand, M.A., Jenkins, W.K, Jullien, G.A. and Taylor, F.J. (1986) Residue Number System Arithmetic: Modern Applications in Digital Signal Processing. IEEE Press, New York.
[3] AyyavaruReddy, Y. and Sekhar, B. (2016) An Efficient Reverse Converter Design for Five Moduli Set RNS. International Journal of Advanced Research in Computer and Communication Engineering, 5, 208-212.
[4] Daniel, A. and Abdul, M. (2021) New Algorithm for Reverse Conversion in Residue Number System. Global Scientific Journals, 9, 661-665.
[5] Kalyanaraman, K. and Nicholas, C.H.V. (2013) Efficient Reverse Converters Designs for RNS based Digital Signal Processing Systems. IEEE 2nd Global Conference on Consumer Electronics-GCCE, 1-4 October 2013, Tokyo.
https://doi.org/10.1109/GCCE.2013.6664781
[6] Azadeh, A.Z., Amir, S.M., et.al. (2014) Reverse Converter Design via Parallel-Prefix Adders: Novel Components, Methodology, and Implementations. IEEE Transactions on Very Large Scale Integration (VLSI) Systems, 2015, Kansas.
[7] Omondi, A. and Premkumar, B. (2007) Residue Number System: Theory and Implementation. Imperial College Press, London.
[8] Reddy, Y.A. and Sekhar, B. (2016) An Efficient Reverse Converter Design for Five Moduli Set RNS. International Journal of Advanced Research in Computer and Communication Engineering, 5, 208-212.
[9] Duc-Minh, P., Premkumar, A.B. and Madhukumar, A.S. (2011) Error Detection and Correction in Communication Channels Using Inverse Gray RSNS Codes. IEEE Transactions on Communications—TCOM, 59, 975-986.
https://doi.org/10.1109/TCOMM.2011.022811.100092
[10] Omondi, A. and Premkumar, B. (2007) Residue Number Systems: Theory and Implementation. Imperial College Press, London.
https://doi.org/10.1142/p523
[11] Chung-Kuan, C. (2006) Computer Arithmetic Algorithms and Hardware Design, Lecture notes. University of California, San Diego.

Copyright © 2021 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.