New Reverse Conversion for Four-Moduli Set and Five-Moduli Set ()
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
and the RNS representation of an integer X be represented as
. Then the Chinese Remainder Theorem is as follows:
(2.1)
where M is the product of the mi
are the multiplicative inverse of
with respect to mi
[9] [10].
2.2. Mixed Radix Conversion
Consider the moduli set
and the RNS representation of an integer X be given as
, it’s decimal equivalent is computed based of the Mixed Radix Conversion as follows:
(2.2)
where
are the Mixed Radix Digits (MRDs) and computed as follows:
[11] (2.3)
That is, X in the interval
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
and residues
, moduli set m and residues r can be represented in congruence form as:
(3.1)
(3.2)
(3.3)
(3.4)
Equation (1) can be written in an equation form as:
(3.5)
Equation (5) must satisfy Equation (2) such that
.
Putting k into Equation (5), we have
(3.6)
Equation (6) must satisfy Equation (3) such that
Putting t into Equation (5), we have
(3.7)
Now Equation (7) is the general form of decimal equivalent that satisfies Equation (4) such that:
where
.

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
and residues
, 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
which gives the valid range for p (
) 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
.
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,
where,
.
When p = 0,
is satisfied. Since
satisfied X at the value of 75 (
), we stop and take that value as its decimal equivalent.
Therefore the decimal equivalent for n = 2 is 75.
From example 2,
where,
.
When p = 0,
is satisfied. Since
satisfied X at the value of 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
.
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
can be chosen instead of using
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,
where,
.
When p = 0,
is satisfied. Since
satisfied X at the value of 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,
,
,
where,
,
when p = 0
is satisfied. Since
satisfied X at the value of 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,
,
. Two of its residues are the same. That is
and
. 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,
and
should be set as
and
. Therefore
,
. Hence,
.
When p = 3,
is satisfied. Since
satisfied X at the value of 57 (
), 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.