_{1}

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.

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 [

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 [

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.

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).

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 m_{i} M i − 1 are the multiplicative inverse of M i with respect to m_{i} M i = M m i [

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 [

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

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.

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 ] .

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 m_{i}’s in a given moduli set corresponding to its residue to limit the range of p.

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 r_{3} or r_{4} 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.

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.

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

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