Next Article in Journal
Sensitivity Analysis of Influencing Factors of Underground Civil Air Defense Construction Vibration under Vehicle Load
Previous Article in Journal
Working Face Stability of Box Shield Tunneling under Non-Uniform Support Pressure
Previous Article in Special Issue
Multiple Error Correction in Redundant Residue Number Systems: A Modified Modular Projection Method with Maximum Likelihood Decoding
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Performance Analysis of Hardware Implementations of Reverse Conversion from the Residue Number System

1
North-Caucasus Center for Mathematical Research, North-Caucasus Federal University, 355017 Stavropol, Russia
2
Institute for Design Problems in Microelectronics, 124365 Moscow, Russia
3
Department of Applied Mathematics an Mathematical Modeling, North-Caucasus Federal University, 355017 Stavropol, Russia
4
Institute for System Programming of the Russian Academy of Sciences, 124681 Moscow, Russia
5
School of Computing, Communication and Business, Hochschule für Technik und Wirtschaft (University of Applied Sciences for Engineering and Economics), 10318 Berlin, Germany
6
Department of Higher Mathematics and Physics, National University of Architecture and Construction of Armenia, Yerevan 0009, Armenia
*
Authors to whom correspondence should be addressed.
Appl. Sci. 2022, 12(23), 12355; https://doi.org/10.3390/app122312355
Submission received: 17 November 2022 / Revised: 28 November 2022 / Accepted: 29 November 2022 / Published: 2 December 2022
(This article belongs to the Special Issue Emerging Residue Number System Technologies and Applications)

Abstract

:
The Residue Number System (RNS) is a non-positional number system that allows parallel computations without transfers between digits. However, some operations in RNS require knowledge of the positional characteristic of a number. Among these operations is the conversion from RNS to the positional number system. The methods of reverse conversion for general form moduli based on the Chinese remainder theorem and the mixed-radix conversion are considered, as well as the optimized methods for special form moduli. In this paper, a method is proposed that develops the authors’ ideas based on the modified mixed-radix conversion and reference points. The modified method based on the mixed-radix conversion in this case makes it possible to replace the operation of finding the residue of division by a large modulo with the sequential calculation of the residue. The method of reference points allows to reduce the size of the stored information compared to the use of ROM to store all the residues of RNS. The application of this approach makes it possible to find a balance between the speed of the calculation and the hardware used, by varying the number of moduli of one method and the other.

1. Introduction

Position-based calculations with binary and decimal numbers require transfers between digits, which have a negative impact on performance or device overhead for calculations with large numbers. In non-position-based number systems, such as the Residue Number System (RNS), transfers between digits are avoided. Interest in RNS as a basis for computing system development emerged as early as the 1950s [1,2]. In particular, in the USSR, long-range detection radar stations operating on the basis of modular arithmetic and built under the leadership of I.Ya. Akushsky and D.I. Yuditsky were deployed in the 1960s. Currently, various aspects of the residue number system are applied in patents of companies from the USA (Olsen IP Reserve, LLC; The Athena Group, Inc.; Cisco Technology, Inc.), China (Tianjin University; No 30 Inst China Electronic Technology Group Corp.; Univ Xidian), and the UK (Samsung Electronics Co., Ltd.).
The architecture of computing systems operating in RNS generally consists of forward conversion of positional numbers into RNS [3], computation of the main problem using modular addition [4], multiplication [5], number comparison and sign determination [6] operations, reconversion from RNS to positional number system [7,8,9,10,11,12,13,14]. Furthermore, if addition, subtraction, multiplication in RNS have a parallel structure with numbers of small dimensions, then the operations of sign determination, comparison, conversion from RNS to the positional number system require the calculation of the positional characteristic of the number, which is computationally complex.
The work is structured as follows. In Section 2, reverse conversion methods for general form moduli, such as Chinese Remainder Theorem (CRT), Mixed-Radix Conversion (MRC), CRT with fractional numbers, New CRT I, and New CRT II are discussed. In Section 3, we consider the application of RNS moduli of the special kind 2 n ± 1 , 2 n . Section 4 considers the MRC-based method proposed by the authors. In Section 5, the authors’ proposed method based on reference points is considered. However, the result of the work is the method considered in Section 6, which combines the use of modified MRC and the method of reference points. The results of the physical synthesis of the reverse conversion methods are presented in Section 7. Section 8 analyzes the results of the physical synthesis and draws conclusions about the applicability of the proposed approaches.

2. Reverse Conversion for General View Moduli

Most methods of reverse conversion are based on the use of CRT and MRC.
Reconstruction of a number X from its modular form x 1 , x 2 , , x n using the classical form of the Chinese Residue Theorem (CRTc) [7] is possible by the formula:
X = i = 1 n P i 1 p i · P i · x i P ,
where p 1 , p 2 , , p n are RNS moduli, P = i = 1 n p i is RNS dynamic range, P i = P p i , P i 1 p i is multiplicative inversion of P i modulo p i .
To illustrate the considered methods, let us consider examples of RNS with 8-bit range, in particular 7 , 8 , 9 with range P = 7 · 8 · 9 = 504 .
For the given RNS the auxiliary coefficients are:
P 1 = 504 7 = 72 , P 2 = 63 , P 3 = 56 , P 1 1 p 1 = 4 , P 2 1 p 2 = 7 , P 3 1 p 3 = 5 .
Consider the reconstruction of the number X = 3 , 2 , 1 = 10 . Then, using the Formula (1), we obtain:
X = 4 · 72 · 3 + 7 · 63 · 2 + 5 · 56 · 1 504 = 2026 504 = 10 .
In the case of the hardware implementation, the product calculations are performed in parallel, and the summation can be performed by tree doubling, which speeds up the calculations, but it is necessary to find the remainder of the division by a large number P.
Although in some cases it helps to simplify the scheme by using the Formula (1) to find the remainder for each summand P i 1 p i · P i · x i P , the hardware implementation of the classical CRT leads to large areas and delays.
Another approach to reverse conversion is using the mixed-radix conversion [7], according to which the number x 1 , x 2 , , x n can be transformed into a positional number system based on the formula:
X = d 1 + d 2 · p 1 + d 3 · p 1 · p 2 + + d n · p 1 · · p n 1 ,
In this case, the MRC numbers d i can be calculated with the formulas:
d 1 = x 1 ,
d 2 = x 2 d 1 · p 1 1 p 2 mod p 2 ,
d 3 = x 3 d 1 · p 1 1 p 3 d 2 · p 2 1 p 3 mod p 3
d n = x n d 1 · p 1 1 p n d 2 · p 2 1 p n d n 1 · p n 1 1 p n mod p n .
Consider the reconstruction process for the number X = 3 , 2 , 1 = 10 , then
d 1 = 3 ,
d 2 = 2 3 · 7 1 8 mod 8 = 1 · 7 mod 8 = 1 ,
d 3 = 1 3 · 7 1 9 1 · 8 1 9 mod 9 = 2 · 4 1 · 8 mod 9 = 0 .
Then, by the Formula (2), we obtain:
X = 3 + 1 · 7 + 0 · 7 · 8 = 10 .
The main advantage of MRC is that calculations can be performed with small numbers without having to determine the remainder by a large modulo. However, the sequential architecture MRC leads to an increase in delay when the number of moduli increases.
To solve the problem of finding the remainder of the division by the dynamic range in the classical Chinese remainder theorem, its modification with fractional numbers in which the left and right parts of the expression (1) are divided by the dynamic range P [15]:
X ¯ = X P = i = 1 n P i 1 p i p i · x i 1 = i = 1 n k i · x i 1 ,
where the symbol 1 denotes the fractional part of the number, and
k i = P i 1 p i p i , i = 1 , 2 , , n .
In this case, the sum value in (3) is a positional characteristic that lies in the range 0 , 1 and enables number comparison and sign detection. The number X we are looking for is obtained by multiplying X ¯ by the dynamic range P, i.e.,
X = X ¯ · P .
For the RNS with moduli 7 , 8 , 9 , the coefficients calculated by the Formula (4) will be:
k 1 = P 1 1 p 1 p 1 = 4 7 , k 2 = 7 8 , k 3 = 5 9 .
The number X = 3 , 2 , 1 = 10 is reconstructed with the Formula (3):
X ¯ = 4 · 3 7 + 7 · 2 8 + 5 · 1 9 1 = 1013 252 1 = 5 252 ,
then X = 5 252 · 504 = 10 .
However, the coefficients k i can rarely be represented as a finite fraction, so the question of the accuracy of rounding the coefficients is acute.
In the article [7], there is an approximate modification of the method based on the CRT scaling by 2 N , where N = log 2 P μ 1 , μ = i = 1 n p i 1 . Then the Formulas (3) and (4) can be written as:
X = i = 1 n k i · x i 2 N ,
where the coefficients k i are rounded upwards
k i = P i 1 p i p i · 2 N , i = 1 , 2 , , n .
Then, the recovered number can be obtained by the formula with rounding down:
X = X · P 2 N .
For RNS 7 , 8 , 9 the required accuracy is N = 13 , so the calculation is performed modulo 2 N = 8192 . Then the coefficients are k i :
k 1 = P 1 1 p 1 p 1 · 2 N = 4 7 · 2 13 = 4682 , k 2 = 7168 , k 3 = 4552 .
From the Formula (5) for the number X = 3 , 2 , 1 = 10 we obtain:
X = 4682 · 3 + 7168 · 2 + 4552 · 1 2 13 = 32934 2 13 = 166 .
Then X will be equal to:
X = 166 · 504 8192 = 10 .
Another method based on the CRT is a method called New CRT [8], which is given by the formula:
X = x 1 + k 1 x 2 x 1 p 1 + k 2 ( x 3 x 2 ) p 1 p 2 + + k n 1 x n x n 1 p 1 p n 1 P ,
where
k i = 1 j = 1 i p j j = i + 1 n p j , 1 i r 1 .
For the above considered RNS 7 , 8 , 9 the coefficients k i of the new CRT will be:
k 1 = 1 p 1 p 2 p 3 = 31 , k 2 = 1 p 1 p 2 p 3 = 5 .
Then, using the Formula (7) for the number X = 3 , 2 , 1 = 10 we obtain:
X = 3 + 31 · 2 3 · 7 + 5 · ( 1 2 ) · 7 · 8 504 = 494 504 = 10 .
The article [16] proposes two modifications of the New CRT, which are denoted as New CRT I and New CRT II.
Let us consider each of these methods separately. In New CRT I, the Formula (8) similarly calculates constants k i , which are used to find coefficients a i , i = 0 , , n 1 :
a 0 = 1 k 1 p 1 p 1 p 2 p n 1 p n
a 1 = k 1 k 2 p 2 p 2 p n 1 p n
a n 2 = k n 2 k n 1 p n 1 p n 1 p n
a n 1 = k n 1 p n
Then, for these coefficients we build a matrix of characteristics:
A = a 0 , 0 0 0 0 a 0 , 1 a 1 , 1 0 0 a 0 , n 2 a 1 , n 2 a n 2 , n 2 0 a 0 , n 1 a 1 , n 1 a n 2 , n 1 a n 1 , n 1
which coefficients are obtained from the representation of a i in the mixed-radix conversion:
a 0 = a 0 , 0 + a 0 , 1 p 1 + + a 0 , n 1 p 1 p 2 p n 1
a 1 = a 1 , 1 + a 1 , 2 p 2 + + a 1 , n 1 p 2 p n 1
a n 2 = a n 2 , n 2 + a n 2 , n 1 p n 1
a n 1 = a n 1 , n 1
Then, from the matrix A and the value X = x 1 , x 2 , , x n a vector B = A × X can be obtained, i.e.:
B = B 0 B 1 B n 2 B n 1 = a 0 , 0 0 0 0 a 0 , 1 a 1 , 1 0 0 a 0 , n 2 a 1 , n 2 a n 2 , n 2 0 a 0 , n 1 a 1 , n 1 a n 2 , n 1 a n 1 , n 1 × x 1 x 2 x n 1 x n
Then, the number X can be reconstructed by the formula:
X = B 0 + B 1 p 1 + B 2 p 1 p 2 + + B n 1 p 1 p 2 p n 1 p 1 p 2 p n
Consider a similar example for which the coefficients of a i are:
a 0 = 1 31 · 7 504 = 288 = 1 + 1 p 1 + 5 p 1 p 2 ,
a 1 = 31 5 · 8 72 = 63 = 7 + 7 p 2 ,
a 2 = 5 9 = 5 .
For the number X = 3 , 2 , 1 = 10 we obtain the vector B:
B = 1 0 0 1 7 0 5 7 5 × 3 2 1 = 3 17 34 .
From which we obtain:
X = 3 + 17 · 7 + 34 · 7 · 8 504 = 10 .
For the case of ordered RNS with moduli satisfying the expression p i > p 1 + + p i 1 or more strictly p i > 2 p i 1 , the reverse conversion can be obtained without taking into account the remainder modulo P.
In this case, the function Y < 2 P is given by
Y = B 0 + B 1 p 1 + B 2 p 1 p 2 + + B n 1 p n p 1 p 2 p n 1
and the required value of X is
X = Y if Y < P , Y P if Y P .
The restriction of moduli in this case leads to an unbalanced RNS. So, for the 8-bit range, we can take a set of moduli 3 , 7 , 13 , where the dimensionality of each module is one binary digit larger. In this case:
k 1 = 61 , k 2 = 5
a 0 = 91 , a 1 = 26 , a 2 = 5 .
Then for the number X = ( 1 , 3 , 10 ) = 10 we obtain:
B = 1 0 0 2 5 0 4 3 5 × 1 3 10 = 1 17 63
The desired value of X can be obtained from (9) and the vector B = B 0 , B 1 , B 2 p 3 : Y = 1 + 17 · 3 + 11 · 3 · 7 = 283 , since Y P = 273 , then X = Y P = 10 .
This method requires matrix multiplication with small-digit numbers, finding the remainder modulo RNS, and multiplication with accumulation for n summands.
Another method proposed in [16] is called New CRT II.
For a two-moduli CRT with p 1 , p 2 moduli, the Algorithm 1 denoted by findno x 1 , x 2 , p 1 , p 2 , X .
Algorithm 1 Algorithm findno number recovery for a two-moduli RNS
Require:  x 1 , x 2 , p 1 , p 2
Ensure:  X < p 1 · p 2
1:
k 0 = p 2 1 p 1
2:
return X = x 2 + k 0 x 1 x 2 p 1 · p 2
For ordered RNS with moduli p 1 < p 2 < < p n a recursive Algorithm 2 translate ( ( x 1 , x 2 , , x n ) , X ) is used.
Consider an example of applying the Algorithm 2 to RNS 7 , 8 , 9 and the number X = 3 , 2 , 1 = 10 .
Since n = 3 , according to step 5 of the Algorithm 2 we obtain two new calls of this algorithm translate x 1 , N 1 and translate x 2 , x 3 , N 2 .
Calling translate x 1 , N 1 leads to step 11 of the Algorithm 2, for which we obtain N 1 = x 1 mod p 1 , P 1 = p 1 , i.e., N 1 = 3 , P 1 = 7 .
Calling translate x 2 , x 3 , N 2 leads to step 9 of the Algorithm 2, for which from the Algorithm 1 findno we obtain N 2 = x 3 + p 3 1 p 2 · x 2 x 3 p 2 · p 3 , P 2 = p 2 · p 3 . That is, N 2 = 1 + 1 · 2 1 8 · 9 = 10 , P 2 = 8 · 9 = 72 .
Algorithm 2 Algorithm translate of number reconstruction in RNS
Require:  x 1 , x 2 , , x n , p 1 , p 2 , , p n
1:
if  n = 2 t > 2 (n—even, greater than 2) then
2:
    translate x 1 , , x t , N 1 , P 1 = i = 1 t p i
3:
    translate x t + 1 , , x n , N 2 , P 2 = i = t + 1 n p i
4:
    findno N 1 , N 2 , P 1 , P 2 , X
5:
else if  n = 2 t + 1 > 2 (n—odd, greater than 2) then
6:
    translate x 1 , , x t , N 1 , P 1 = i = 1 t p i
7:
    translate x t + 1 , , x n , N 2 , P 2 = i = t + 1 n p i
8:
    findno N 1 , N 2 , P 1 , P 2 , X
9:
else if  n = 2  then
10:
    findno x 1 , x 2 , p 1 , p 2 , X
11:
else if  n = 1  then
12:
     X = x 1 mod p 1
13:
end if
Then, according to step 8 of the Algorithm 2, the call findno N 1 , N 2 , P 1 , P 2 , X , that is, the calculation
X = N 2 + P 2 1 P 1 · N 1 N 2 P 1 · P 2 = 10 + 72 1 7 · 3 10 7 · 72 = 10 .
Thus, the New CRT II method is based on the recursive use of MRC with two moduli. In this case, there are difficulties in calculating the multiplicative inversion in the last steps of the algorithm, but in the hardware implementation these values can be written to memory.
In [11] the set of odd moduli p 1 , p 2 , , p n 1 whose range P h = i = 1 n 1 p i and from the Formula (1) we can obtain
X h = i = 1 n 1 P i x i P i p i P h .
Adding the remainder x n modulo p n = 2 k leads to the expression:
X = 2 k X h 2 k P h + P h x n P h 2 k 2 k P h = 2 k i = 1 n 1 P i x i 2 k P i p i + P h x n P h 2 k 2 k P h
For d log 2 n 1 , denote x n = x n P h 2 k , which splits into blocks x q and x p by k d and d bits, respectively, that is, x n = 2 k d x p + x q .
Next, the variables introduced are:
x i = x i 2 k d P i p i and x p = x p i = 1 n 1 x i p i 2 d
and x n = 2 k d x p + x q = x p | | x q , ( | | —concatenation of binary values).
Then the Formula (10) can be rewritten as:
X = 2 k d i = 1 n 1 P i x i + P h x n 2 k P h ,
In this case, as in (9), the value of X < 2 · 2 k P h , i.e., does not exceed the double range and can be computed without computing the remainder by a large modulo.
Consider a similar example, with moduli 7 , 9 , 8 , then n = 3 , k = log 2 8 = 3 . P h = p 1 · p 2 = 63 , P 1 = P h p 1 = p 2 = 9 , P 2 = p 1 = 7 . d = log 2 3 1 = 1 .
For the number X = 3 , 1 , 2 = 10 , calculate x i and x q , x p , x p , x n .
x 1 = x 1 2 3 1 P 1 p 1 = 3 · 2 2 · 9 1 7 7 = 3 , x 2 = 1 , x p = 1 , x q = 2 .
x p = x p i = 1 n 1 x i p i 2 d = 1 , x n = 2 k d x p + x q = 6 .
Then, from (11) we obtain X = 514 504 = 10 .
This method allows you to find the reconstructed number without calculating the remainder large modulo, because X < 2 · 2 k P h .

3. Use of Special Type Moduli

To improve the performance of RNS, many researchers are considering moduli of a special kind 2 n 1 , 2 n , 2 n + 1  [8], 2 2 n , 2 2 n 1 1 , 2 2 n 1 , 2 2 n + 1 1  [9], 2 k 3 , 2 k 2 , 2 k 1 and 2 k + 1 , 2 k + 2 , 2 k + 3  [10], 2 2 n 5 1 , 2 2 n 3 1 , 2 2 n 2 + 1 , 2 2 n 1 1 , 2 2 n 1 + 1 , 2 2 n , 2 2 n + 1  [12], 2 2 n , 2 n + 1 , 2 n 1 , 2 n + 3 , 2 n 3 [13].
The most interesting among the reverse conversion methods is the optimization for the moduli set 2 n 1 , 2 n , 2 n + 1 , which was proposed in the article [8].
The most efficient implementations are based on the modulo 2 n 1 for which a number of properties are satisfied:
  • The sign change (additive inversion) is achieved by bitwise negation, i.e., z 2 n 1 = z ¯ 2 n 1 = z ¯ n 1 z ¯ 0 2 n 1 , e.g., 5 7 = 101 2 7 = 101 ¯ 2 7 = 010 2 7 = 2 .
  • The multiplication by 2 d can be performed by a cyclic shift to the left by d digits, i.e., 2 d z 2 n 1 = z n d 1 z 0 z n 1 z n d 2 n 1 , e.g., 2 · 5 7 = 2 · 101 2 7 = 011 2 7 = 3 .
  • Multiplication by multiplicative inversion 2 d 2 n 1 can be performed by a cyclic shift to the right by d positions or to the left by n d positions, since 2 d z 2 n 1 = 2 n d z 2 n 1 , i.e., 2 d z 2 n 1 = z d 1 z 0 z n 1 z d 2 n 1 , e.g., 2 1 · 5 7 = 2 1 · 101 2 7 = 110 2 7 = 3 .
  • For any non-negative integer i, 2 i · n 2 n 1 = 1 , then the ( s n ) bit number can be represented as
    i = 0 s 1 2 n i y n i + 1 1 y n i 2 n 1 = i = 0 s 1 y n i + 1 1 y n i 2 n 1
The article [8] is based on the idea that an expression for the reverse conversion based on the CRT (1) can be represented in a form, where the constant and the variables can be separated:
X = i = 1 n b i · x i + C k P
First, one takes from the set 2 n , 2 n 1 , 2 n + 1 two moduli p 2 , p 3 = 2 n 1 , 2 n + 1 for which the number X 23 = x 2 , x 3 is found from CRT:
X 23 = p 3 · x 2 · p 3 1 p 2 + p 2 · x 3 · p 2 1 p 3 p 2 p 3 = = 2 n + 1 · 2 n 1 · x 2 + 2 n 1 · 2 n 1 · x 3 2 2 n 1 = = 2 n 1 · 2 n + 1 · x 2 + 2 n 1 x 3 2 2 n 1
Based on the MRC for the set of moduli p 1 , p 2 p 3 , the number X = x 1 , X 23 is found:
X = x 1 + p 1 ( X 23 x 1 ) 1 p 1 p 2 p 3 = x 1 + 2 n X h ,
where
X h = X 23 x 1 2 1 2 2 n 1 = = 2 n 1 2 n + 1 x 2 + 2 n 1 x 3 x 1 2 1 2 2 n 1 = = x 1 2 n + x 2 2 n + 1 2 1 + x 3 2 n 1 2 1 2 2 n 1
The optimization of the expression (13) is possible by bitwise operations. The first term can be represented as follows:
x 1 · 2 n 2 2 n 1 = 2 1 x ¯ 1 , n 2 x ¯ 1 , 0 | | 0 0 n | | x ¯ 1 , n 1 + 2 n 1 2 2 n 1 .
The second term appears as:
x 2 2 n + 1 2 1 2 2 n 1 = 2 1 x 2 | | x 2 2 2 n 1 .
The third term can be represented as:
x 3 2 n 1 2 1 2 2 n 1 = = 2 1 x 3 , n 1 x 3 , n x 3 , 0 x 3 , n | | x ¯ 3 , n 1 x ¯ 3 , 0 + 2 n + + 1 2 n + 1 2 2 n 1
or
x 3 2 n 1 2 1 2 2 n 1 = 2 1 x 3 , n 1 x 3 , 0 | | x ¯ 3 , n 1 x ¯ 3 , 1 | | x 3 , 0 x 3 , n ¯ + + 0 0 n 1 | | x ¯ 3 , n | | 0 0 n 1 | | x 3 , n | | 0 + + 1 2 n + 1 2 2 n 1
Depending on the chosen representation of the third term (14) or (15), the article [8] forms two variants of the reverse conversion constructed using the formula:
X h = w 1 + w 2 + w 3 + C k 2 2 n 1
In the first case, based on the Formula (14) we have:
w 1 = x ¯ 1 , n 1 x ¯ 1 , 0 | | 0 0 n w 2 = x 2 , 0 | | x 2 , n 1 x 2 , 0 | | x 2 , n 1 x 2 , 1 w 3 = x ¯ 3 , 0 | | x 3 , n 1 x 3 , n x 3 , 0 x 3 , n | | x ¯ 3 , n 1 x ¯ 3 , 1 C k = 2 n 1 + 2 1 1 2 n + 1 + 2 n 1 2 2 n 1 = 2 2 n 1 + 2 n 1 1 = 1 0 0 n 1 1 n 1
In the article [8], there is a typo that C k has n + 2 zeros. However, it is obvious that 2 2 n 1 contains one and 2 n 1 zeros, and the number ( 2 n 1 1 ) contains n 1 one. Then adding the numbers will result in the lowest number n 1 being a one, and the remaining 2 n 1 n 1 = n zeros will remain zeros. For example, for n = 2 : 2 3 + 2 1 = 9 = 1001 2 .
For the second case, the formula (15) gives:
w 1 = x ¯ 1 , n 1 x ¯ 1 , 0 | | x ¯ 3 , n | | 0 0 n 2 | | x 3 , n w 2 = x 2 , 0 | | x 2 , n 1 x 2 , 0 | | x 2 , n 1 x 2 , 1 w 3 = x 3 , 0 x 3 , n ¯ | | x 3 , n 1 x 3 , 0 | | x ¯ 3 , n 1 x ¯ 3 , 1 C k = 2 n 1 + 2 1 1 2 n + 1 2 2 n 1 = 2 2 n 1 1 = 0 1 1 2 n 1
The addition of C k in the calculation of X h by the Formula (16) is equivalent to the addition of 2 n C k to X 23 . Moreover, the latter can also be obtained by simultaneous addition of c 2 = 2 n C k 2 n 1 = C k 2 n 1 to x 2 modulo 2 n 1 and c 3 = 2 n C k 2 n + 1 = C k 2 n + 1 to x 3 modulo 2 n + 1 (leaving the remainder x 1 of even modulo unchanged, since 2 n C k 2 n = 0 ).
In the first case we obtain:
c 2 = 2 n 2 2 n 1 + 2 n 1 1 2 n 1 = 0 ,
c 3 = 2 n 2 2 n 1 + 2 n 1 1 2 n + 1 = 1 .
In the second case:
c 2 = 2 n 2 2 n 1 1 2 n 1 = 2 n 1 1 = 0 1 1 n 1 ,
c 3 = 2 n 2 2 n 1 1 2 n + 1 = 2 n 1 + 1 = 01 0 0 n 2 1 .
Then the Formula (16) will be reduced to:
X h = w 1 + w 2 + w 3 2 2 n 1
with further use of the Formula (12).
Consider a similar example with RNS 8 , 7 , 9 , n = 3 , for the number X = 10 = 2 , 3 , 1 .
In the first case, the coefficients c 2 = 0 and c 3 = 1 do not depend on the value of n. Then the offset value of X = 2 , 3 , 1 + 1 9 . From this follows
x 1 = 2 = 010 2 , w 1 = 101 | | 000 2 = 40 ,
x 2 = 3 = 011 2 , w 2 = 1 | | 011 | | 01 2 = 45 ,
x 3 = 2 = 0010 2 , w 3 = 1 | | 010 | | 10 2 = 42 .
Then X h = 40 + 45 + 42 63 = 1 , and X = 2 + 2 3 · 1 = 10 .
For the second case for n = 3   c 2 = 2 2 1 = 3 and c 3 = 2 3 + 1 = 5 . Then the offset value of X = 2 , 3 + 3 7 , 1 + 5 9 . From here
x 1 = 2 = 010 2 , w 1 = 101 | | 1 | | 0 | | 0 2 = 44 ,
x 2 = 6 = 110 2 , w 2 = 0 | | 110 | | 11 2 = 27 ,
x 3 = 6 = 0110 2 , w 3 = 1 | | 110 | | 00 2 = 56 .
Then X h = 44 + 27 + 56 63 = 1 , and X = 2 + 2 3 · 1 = 10 .
In the first case, only addition with c 3 is required, but n of OR logical operators are required when calculating w 3 , in the second case there is one OR operator, but addition is performed on both c 2 and c 3 .

4. Modified Method Based on MRC

The patent [17] presents a new Algorithm 3 for translation of RNS to the positional number system and base extension based on the mixed-radix conversion, which we will hereafter call “the modified mixed-radix conversion method”. This algorithm works with moduli of the generalized form.
Algorithm 3 Reconstructing numbers and expanding bases
Require:  x 1 , , x n , p n + 1
Ensure:  X , X p n + 1
1:
P i = P p i ; P i 1 p i ; B i = P i · P i 1 p i
2:
w ^ 1 = 1 ; w ^ j = i = 1 j 1 p i , j = 2 , n ¯
3:
B i MRC b ^ i , j , i , j = 1 , n ¯ , B i = j = 1 n b ^ i , j · w ^ j
4:
U i = j = 1 i x j · b ^ j , i , i = 1 , n ¯
5:
σ 0 = 0 , x ^ i = σ i 1 + U i p i , σ i = σ i 1 + U i p i
6:
X = i = 1 n x ^ i · w ^ i ,
7:
X p n + 1 = i = 1 n x ^ i · w ^ i p n + 1
8:
return  X , X p n + 1
In some cases it is necessary to add one or more additional moduli to detect range overflows or to detect and correct errors. If the modulo p n + 1 is added, then the new range allows the display of any number X < P · p n + 1 .
Consider the Algorithm 3 in detail. Set of a residue number system with moduli p 1 , p 2 , , p n for which the orthogonal bases of RNS B i = P i · P i 1 p i , i = 1 , n ¯ . Compute the bases of the MRC w ^ j = i = 1 j 1 p i , j = 2 , n ¯ , with w 1 = 1 . The orthogonal RNS bases are represented in MRC as a vector of values b ^ i , j , for which B i = j = 1 n b ^ i , j · w ^ j . The values of b ^ i , j form a triangular matrix.
Given X = x 1 , x 2 , , x n , we need to recover the number X in the positional number system and find the remainder of the division of X by an additional modulo p n + 1 , which we denote by X p n + 1 .
To do this, x 1 , x 2 , , x n is multiplied by the triangular matrix b ^ i , j , so U i = j = 1 i x j · b ^ j , i , i = 1 , n ¯ .
Then x ^ i = σ i 1 + U i p i and σ i = σ i 1 + U i p i are calculated, assuming that σ 0 = 0 .
We can substitute that x ^ i and σ i are related as the remainder of the division of the sum σ i 1 + U i by the modulo p i and the rank of the sum, i.e., the carry by how many times the sum value exceeds the modulo.
Then find the value of the expression X = i = 1 n x ^ i · w ^ i to convert a number from RNS to a positional number system, and to expand the bases, find X p n + 1 = | i = 1 n x ^ i · w ^ i p n + 1 .
Let us consider an example to illustrate how the algorithm works. Given a residue number system with three moduli 7 , 8 , 9 . Then let P = i = 1 3 p i = 504 .
Let us calculate P i = P p i , P i 1 p i and B i = P i · P i 1 p i :
P 1 = 8 · 9 = 72 , P 1 1 p 1 = 72 1 7 = 4 , B 1 = 288 , P 2 = 7 · 9 = 63 , P 2 1 p 2 = 63 1 8 = 7 , B 2 = 441 , P 3 = 7 · 8 = 56 , P 3 1 p 3 = 56 1 9 = 5 , B 3 = 280 .
Let us calculate w ^ j = i = 1 j 1 p i :
w ^ 1 = 1 , w ^ 2 = 7 , w ^ 3 = 7 · 8 = 56 .
Let us calculate the representation of B i in MRC:
B 1 MRC B ^ 1 = b ^ 1 , 1 , b ^ 1 , 2 , b ^ 1 , 3 = 1 , 1 , 5 , checking 1 + 1 · 7 + 5 · 56 = 288 ,
B 2 MRC B ^ 2 = b ^ 2 , 1 , b ^ 2 , 2 , b ^ 2 , 3 = 0 , 7 , 7 , checking 0 + 7 · 7 + 7 · 56 = 441 ,
B 3 MRC B ^ 3 = b ^ 3 , 1 , b ^ 3 , 2 , b ^ 3 , 3 = 0 , 0 , 5 , checking 0 + 0 · 7 + 5 · 56 = 280 .
Given X = 10 = 3 , 2 , 1 , we can compute U i = j = 1 i x j · b ^ j , i :
U 1 = x 1 · b ^ 1 , 1 = 3 · 1 = 3 , U 2 = x 1 · b ^ 1 , 2 + x 2 · b ^ 2 , 2 = 3 · 1 + 2 · 7 = 17 , U 3 = x 1 · b ^ 1 , 3 + x 2 · b ^ 2 , 3 + x 3 · b ^ 3 , 3 = 3 · 5 + 2 · 7 + 1 · 5 = 34 .
Let us calculate x ^ i = σ i 1 + U i p i and σ i = σ i 1 + U i p i :
x ^ 1 = U 1 p 1 = 3 7 = 3 , σ 1 = U 1 p 1 = 3 7 = 0 , x ^ 2 = σ 1 + U 2 p 2 = 0 + 17 8 = 1 , σ 2 = σ 1 + U 2 p 2 = 17 8 = 2 , x ^ 3 = σ 2 + U 3 p 3 = 2 + 34 9 = 0 .
From this we obtain:
X = i = 1 n x ^ i · w ^ i = 3 · 1 + 1 · 7 + 0 · 56 = 10 .
Consider the block diagram for converting numbers from RNS and base expansion based on the Algorithm 3 shown in Figure 1.
The number x 1 , x 2 , , x n represented in RNS is fed to the n inputs of the residues, where n is the number of moduli of the residue number system.
The residues from the corresponding residue inputs are written to n residue storage units. From the outputs of the residue storage units, the residues moduli p 1 , p 2 , , p n are fed to multipliers which form a triangular matrix and calculated values of the products of the residue with the base coefficients in the MRC x j · b ^ j , i , where B i = P i · P i 1 p i = j = 1 n b ^ i , j · w ^ j , are orthogonal bases of RNS, w ^ j = i = 1 j 1 p i , j = 1 , n ¯ are bases of MRC, with w ^ 0 = 1 .
The output of the first residue storage unit modulo p 1 is connected to the inputs of n multipliers by b ^ 1 , 1 , , b ^ 1 , n , which compute the values x 1 · b ^ 1 , i , i = 1 , n ¯ .
The output of the second residue storage unit modulo p 2 is connected to the inputs of the ( n 1 ) -th multiplier by b ^ 2 , 2 , , b ^ 2 , n , which compute the values x 2 · b ^ 2 , i , i = 2 , n ¯ , and so on, the output of the n-th residue storage unit modulo p n are connected to the input of the multiplier by b ^ n , n , which calculates the value x n · b ^ n , n .
The outputs of the multipliers are connected to the inputs of n modular adders modulo p i , i = 1 , n ¯ , and the output of the multiplier by b ^ 1 , 1 is connected to the input of the first modular adder modulo p 1 and performs calculations x ^ 1 = U 1 p 1 = x 1 · b ^ 1 , 1 p 1 , σ 1 = x 1 · b ^ 1 , 1 p 1 , the value x ^ 1 goes to the output of the first modular adder modulo p 1 , the value σ 1 goes to the carry output of the first modular added modulo p 1 .
The outputs of the multipliers by b ^ 1 , 2 and by b ^ 2 , 2 are connected to the inputs of the second modular adder modulo p 2 , whose carry input is connected to the carry output of the first modular adder modulo p 1 , and calculates x ^ 2 = σ 1 + U 2 p 2 = σ 1 + x 1 · b ^ 1 , 2 + x 2 · b ^ 2 , 2 p 2 , σ 2 = σ 1 + x 1 · b ^ 1 , 2 + x 2 · b ^ 2 , 2 p 2 , the value of x ^ 2 goes to the output of the second modular adder modulo p 2 , the value of σ 2 goes to the carry output of the second modular adder modulo p 2 .
Therefore, the outputs of the multipliers by b ^ i , n , i = 1 , n ¯ , are connected to the inputs of the n t h modular adder modulo p n , whose carry input is connected to the carry output of the ( n 1 ) -th modular adder modulo p n 1 , and calculates x ^ n = σ n 1 + U n p n = σ n 1 + i = 1 n x i b ^ i , n p n , σ n = σ n 1 + i = 1 n x i b ^ i , n p n , the value x ^ n arrives at the output n of the modular adder modulo p n , the value of σ n arrives at the carry output of the n -th modular adder modulo p n , which is not connected to other elements.
The values of x ^ i from the outputs of i-th modular adders modulo p i are fed to the inputs of i-th multipliers by the bases of MRC w ^ i , i = 1 , n ¯ , where multiplication of x ^ i by w ^ i = j = 1 i 1 p j takes place.
The output of the i-th multiplier by the bases of the MRC w ^ i is connected to the i-th inputs of the adder and the modular adder, i = 1 , n ¯ , the input of the extended base of the modular adder receives the modulo value p n + 1 , the output of the reduced number of the adder receives the reduced number X in the positional number system, and the output of the remainder on the extended basis of the modular adder receives the number on the extended basis, i.e., X p n + 1 .
This method has a similar matrix structure to New CRT, but uses a sequential calculation without the remainder over a large modulo, as in MRC.

5. Method Based on Reference Points

In [18], a method of reference points based on the use of LUT tables is proposed for translation from a residue number system.
For a given set of moduli p 1 , p 2 , , p n is chosen by the reference point modulo p n , which to reduce the number of values in memory it is more efficient to choose the largest modulo RNS.
Then the contents of the LUT will consist of P h = i = 1 n 1 p i reference points, which correspond to numbers X = x 1 , x 2 , , x n 1 , 0 , which are completely divided by the modulo p n .
In order to obtain an arbitrary number Y = y 1 , y 2 , , y n that is completely divided by p n , you must subtract y n from the number Y, that is, calculate x i = y i y n p i , i = 1 , , n .
For example, for a RNS 7 , 8 , 9 and an initial number Y = 10 = 3 , 2 , 1 , the reference point is X 3 1 | 7 , 2 1 8 , 1 1 9 = 2 , 1 , 0 .
Thus, by analogy with New CRT II and the MRC for two moduli, the reference point will be X = X h · p n 1 P h P h · p n , where X h is the positional number obtained from x 1 , x 2 , , x n 1 for the set of moduli p 1 , p 2 , , p n 1 .
For example, for the number Y = 228 = 4 , 4 , 3 , the reference point would be the value X 4 3 7 , 4 3 8 , 3 3 9 = 1 , 1 , 0 . Since 1 , 1 for the set of moduli 7 , 8 is 1, and 9 1 7 · 8 = 25 , the reference point is X = 1 · 25 56 · 9 = 225 , which corresponds to the subtraction from Y = 228 of residue y n = 3 .
It can be seen that the value of the reference point depends on the number x 1 , x 2 , , x n 1 with moduli p 1 , p 2 , , p n 1 and range P h = i = 1 n 1 p i . Then the computation can be replaced by a memory access, which by the value X h = x 1 , x 2 , , x n 1 will give the value X h · p n 1 P h P h · p n .
In this case, the reverse converter based on the reference points can have a hierarchical structure, for example, as shown in Figure 2. In this case, based on the differences of the residues x 1 x 3 p 1 and x 2 x 3 p 2 by moduli p 1 and p 2 , respectively, using LUT with the values of the reference points, which are X 12 · p 3 1 p 1 p 2 p 1 p 2 · p 3 , where X 12 is—the restored value over the moduli p 1 , p 2 , and adding with the remainder x 3 modulo p 3 find the restored number X 123 modulo p 1 , p 2 , p 3 .
Then similarly are the differences of the residues by moduli p 4 and p 5 and the reconstructed number X 123 , and since the value of X 123 can greatly exceed the values of modules p 4 and p 5 , forward conversion blocks are used, which can be implemented both arithmetically and using memory. Similarly, the values in the LUT of reference points are found, where the pre-calculated values X 45 · P 123 1 P 45 P 45 · P 123 for P 123 = p 1 · p 2 · p 3 and P 45 = p 4 · p 5 .
Thus, by varying the number of LUT inputs from 1 to n 1 and the number of reverse conversion layers, a solution with better time or area can be obtained.

6. Modification of the Reference Points Method Based on the MRC

As the number of moduli and their dimensionality increase, the method of reference points requires a significant amount of memory.
First, we introduce a method based on the proposed methods of reference points and modified MRC. Let us take RNS p 1 , , p n 1 , p n , where p n = 2 k , i.e., degree 2. Then using the Algorithm 3 we find X h by the moduli p 1 , , p n 1 , and using the method of reference point we compute x n X h p n . Since p n = 2 k , this expression can be reduced to taking k lower bits of the sum x n + X ¯ h + 1 , where X ¯ h is the bitwise inversion.
Then, based on this value, a precomputed value equal to x n + X ¯ h + 1 2 k · P h 1 2 k 2 k · P h is selected from the LUT table of size 2 k , where P h = i = 1 n 1 p i . The final value is obtained by adding x n + X ¯ h + 1 2 k . In this case, the reverse converter can have a structure, for example, as shown in Figure 3.
Consider an example for RNS 3 , 5 , 7 , 8 and the number X = 115 = 1 , 0 , 3 , 3 . To calculate the Algorithm 3, find the parameters of the RNS 3 , 5 , 7 :
P h = 3 · 5 · 7 = 105 , P 1 = 5 · 7 = 35 , P 1 1 p 1 = 35 1 3 = 2 , B 1 = 70 , P 2 = 3 · 7 = 21 , P 2 1 p 2 = 21 1 5 = 1 , B 2 = 21 , P 3 = 3 · 5 = 15 , P 3 1 p 3 = 15 1 7 = 1 , B 3 = 15 .
Let us calculate w ^ j = i = 1 j 1 p i :
w ^ 1 = 1 , w ^ 2 = 3 , w ^ 3 = 3 · 5 = 15 .
Let us calculate the representation of B i in the MRC:
B 1 MRC B ^ 1 = b ^ 1 , 1 , b ^ 1 , 2 , b ^ 1 , 3 = 1 , 3 , 4
B 2 MRC B ^ 2 = b ^ 2 , 1 , b ^ 2 , 2 , b ^ 2 , 3 = 0 , 2 , 1
B 3 MRC B ^ 3 = b ^ 3 , 1 , b ^ 3 , 2 , b ^ 3 , 3 = 0 , 0 , 1 .
To calculate X h = 1 , 0 , 3 we then compute U i = j = 1 i x j · b ^ j , i :
U 1 = x 1 · b ^ 1 , 1 = 1 · 1 = 1 ,
U 2 = x 1 · b ^ 1 , 2 + x 2 · b ^ 2 , 2 = 1 · 3 + 0 · 2 = 3 ,
U 3 = x 1 · b ^ 1 , 3 + x 2 · b ^ 2 , 3 + x 3 · b ^ 3 , 3 = 1 · 4 + 0 · 1 + 3 · 1 = 7 .
Let us calculate x ^ i = σ i 1 + U i p i and σ i = σ i 1 + U i p i :
x ^ 1 = U 1 p 1 = 1 3 = 1 , σ 1 = U 1 p 1 = 1 3 = 0 ,
x ^ 2 = σ 1 + U 2 p 2 = 0 + 3 5 = 3 , σ 2 = σ 1 + U 2 p 2 = 3 5 = 0 ,
x ^ 3 = σ 2 + U 3 p 3 = 0 + 7 7 = 0 .
From this we obtain:
X h = i = 1 n x ^ i · w ^ i = 1 · 1 + 3 · 3 + 0 · 15 = 10 .
According to the method of reference vectors we find the difference
X 4 = x 4 X h p 4 = 3 10 8 = 1 .
In the case of a hardware implementation, to obtain X 4 , one must add x 4 to one and k = 3 to the lowest bits of the inverted value of X h , i.e.,
X 4 = 11 + 1010 ¯ + 1 8 = 11 + 101 + 1 8 = 1001 8 = 1 .
LUT of reference point stores values X 4 · P h 1 2 k 2 k · P h , values for this case are shown in Table 1.
Since X 4 = 1 , based on the Table 1 we obtain a value of 105 and then the initial value X = 105 + X h = 115 .
Changing the ratio of the number of moduli over which the reconstruction in the modified MRC and the method of reference points, as well as the number of steps in the method of reference points allows you to flexibly adjust the system according to the constraints on the used area and computation time.

7. Physical Synthesis of Reverse Conversion Methods

Physical synthesis of methods for translating from a residue number system to a positional number system was performed on an ASIC in the RTL and physical synthesis Cadence Genus Synthesis Solution environment using the NangateOpenCellLibrary and computation time optimization. The parameters measured were the signal propagation time across the circuit (picoseconds, ps) and the area used (square micrometer, µm2).
The Chinese residue theorem-based method (Formula (1)), the approximated CRT-based method (Formulas (5) and (6)), the mixed-radix conversion-based method (Formula (2)), a method based on special moduli 2 n 1 , 2 n , 2 n + 1 [8], the reference points method proposed by the authors and discussed in Section 5, the modified MRC-based method (Algorithm 3), and the introduced method based on reference points and modified MRC (Section 6).
Simulation results for the reference points method, CRT, approximate CRT, modified MRC, MRC, special moduli 2 n 1 , 2 n , 2 n + 1 and the proposed method are shown in Figure 4, Figure 5, Figure 6 for 8, 16 and 32 bits, respectively.
In addition, Table 2, Table 3, Table 4 are given to compare the proposed modification with the previously developed methods. In these tables, the reference points based method is denoted as I, the modified mixed-radix conversion based method—II, the proposed modification—III. The configuration of the layers for the reference points method is given in the second column.
The analysis of the Figure 4 shows that the reference point based method has the smallest area in the 8-bit domain and is only slightly inferior to the special type moduli in terms of time. The MRC and approximate CRT-based methods have complex computational algorithms and perform poorly in terms of both area and time.
In the 16-bit domain (Figure 5), the method using special moduli has a clear advantage, and the method based on reference points has a low execution time, but at the same time significant hardware costs. The proposed method allows to reduce the used area, but slightly increases the computation time.
In the 32-bit domain (Figure 6), the reference points method shows both some of the best and some of the worst results in terms of time and area, and thus a strong dependence on the set of moduli and the configuration of layer over which the residues are grouped for the LUT. The MRC-based method performs worse than the CRT and the approximate CRT in most cases, but has less area as the dimensionality increases.
Figure 7 and Figure 8 show the best time and area, respectively, for the methods considered.

8. Conclusions

In this paper, an overview of the methods of conversion from the residue number system to the positional number system is given. Reverse conversion methods for general form moduli, such as the Chinese residue theorem, mixed-radix conversion, the Chinese residue theorem with fractional numbers, new CRT I, and new CRT II, were considered. The application of RNS moduli of the special form 2n ± 1, 2n was also considered. Based on the modified mixed-radix conversion presented by Algorithm 3 and the method of reference points (Section 5), a method of reverse conversion of a number from a residue number system to a positional number system is proposed (Section 6). The results of physical synthesis have shown that the use of moduli of a special type makes it possible to significantly reduce the computational time and the claimed area, however, the task of working with moduli of a general type often arises.
The reference points method proposed by the authors in [18] makes it possible to obtain computationally efficient implementations, but the used area can differ up to 30 times within one dimension (for the sets {7, 17, 31, 65, 127, 256} and {1023, 1025, 8192}), which leads to the need to check a large number of sets of a given dimension in the search for the optimal set.
The method proposed in this work reduces the required area (up to five times for the set {7, 17, 31, 65, 127, and 256}) for RNS with a large number of moduli compared to the reference point method and reduces the area for RNS with three and four moduli compared to the modified MRC. It is possible to combine the reference point method with different configurations of layers and methods based on CRT and MRC to obtain efficient implementations in terms of computational speed and required area.

Author Contributions

Conceptualization, V.K., D.T., M.B., I.M., A.S., N.K., T.E. and M.G.; methodology, V.K., D.T., M.B., I.M., A.S., N.K., T.E. and M.G.; software, V.K. and I.M.; validation, V.K., D.T., M.B., I.M., A.S., N.K., T.E. and M.G.; formal analysis, V.K., D.T., M.B., I.M., A.S., N.K., T.E. and M.G.; investigation, V.K., D.T., M.B., I.M., A.S., N.K., T.E. and M.G.; writing—original draft preparation, V.K., D.T., M.B. and I.M.; writing—review and editing, V.K., D.T., M.B., I.M., A.S., N.K., T.E. and M.G.; supervision, V.K., D.T., M.B. and A.S. All authors have read and agreed to the published version of the manuscript.

Funding

This work was carried out at the North Caucasus Center for Mathematical Research within agreement no. 075-02-2022-892 with the Ministry of Science and Higher Education of the Russian Federation. The reported study was funded by Russian Federation President Grant MD-1414.2021.4, MK-1203.2022.1.6 and SP-3186.2022.5.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Garner, H.L. The residue number system. In Proceedings of the Western Joint Computer Conference, San Francisco, CA, USA, 3–5 March 1959. [Google Scholar]
  2. Malashevich, B.M. Brief Basis and History of Domestic Modular Computers. Origins of modular arithmetic. Proc. SoRuCom-2017 2017, 10, 193–207. (In Russian) [Google Scholar]
  3. Low, J.Y.S.; Chang, C.H. A new approach to the design of efficient residue generators for arbitrary moduli. IEEE Trans. Circuits Syst. I Regul. Pap. 2013, 60, 2366–2374. [Google Scholar] [CrossRef]
  4. Patel, R.A.; Benaissa, M.; Powell, N.; Boussakta, S. Novel power-delay-area-efficient approach to generic modular addition. IEEE Trans. Circuits Syst. I Regul. Pap. 2007, 54, 1279–1292. [Google Scholar] [CrossRef]
  5. Zimmermann, R. Efficient VLSI implementation of modulo (2n ± 1) addition and multiplication. In Proceedings of the 14th IEEE Symposium on Computer Arithmetic, Adelaide, Australia, 14–16 April 1999; pp. 158–167. [Google Scholar]
  6. Tchernykh, A.; Babenko, M.; Shiriaev, E.; Pulido-Gaytan, B.; Cortés-Mendoza, J.M.; Avetisyan, A.; Drozdov, A.Y.; Kuchukov, V. An Efficient Method for Comparing Numbers and Determining the Sign of a Number in RNS for Even Ranges. Computation 2022, 10, 17. [Google Scholar] [CrossRef]
  7. Chervyakov, N.I.; Molahosseini, A.S.; Lyakhov, P.A.; Babenko, M.G.; Deryabin, M.A. Residue-to-binary conversion for general moduli sets based on approximate Chinese remainder theorem. Int. J. Comput. Math. 2017, 94, 1833–1849. [Google Scholar] [CrossRef]
  8. Patronik, P.; Piestrak, S.J. Design of RNS reverse converters with constant shifting to residue datapath channels. J. Signal Process. Syst. 2018, 90, 323–339. [Google Scholar] [CrossRef] [Green Version]
  9. Ananda Mohan, P.V. Reverse Converters for the Moduli Set {2n, 2n−1 − 1, 2n − 1, 2n+1 − 1}(nEven). Circuits Syst. Signal Process. 2018, 37, 3605–3634. [Google Scholar] [CrossRef]
  10. Phalguna, P.S.; Kamat, D.V.; Ananda Mohan, P.V. RNS-to-Binary Converters for New Three-Moduli Sets {2k − 3,2k − 2,2k − 1} and {2k + 1,2k + 2, 2k + 3}. J. Circuits Syst. Comput. 2018, 27, 1850224. [Google Scholar] [CrossRef]
  11. Patronik, P. On reverse converters for arbitrary multi-moduli RNS. Integration 2020, 75, 158–167. [Google Scholar] [CrossRef]
  12. Madhavi Latha, M.V.N.; Rachh, R.R.; Ananda Mohan, P.V. An improved RNS-to-binary converter for 7-modulus set {2n−5 − 1, 2n−3 − 1, 2n−2 + 1, 2n−1 − 1, 2n−1 + 1, 2n, 2n + 1} for n even. Sadhana 2020, 45, 1–4. [Google Scholar] [CrossRef]
  13. Mojahed, M.; Molahosseini, A.S.; Zarandi, A.A.E. Multifunctional unit for reverse conversion and sign detection based on five-moduli set {22n, 2n + 1, 2n − 1, 2n + 3, 2n − 3}. Comput. Sci. 2021, 22, 101–121. [Google Scholar] [CrossRef]
  14. Majd, K.M.; Molahosseini, A.S. Energy-Efficient Residue-to-Binary Conversion Based on a Modulo-Adder-Free Architecture. In Proceedings of the 2022 30th International Conference on Electrical Engineering (ICEE), Tehran, Iran, 17–19 May 2022; Volume 10, pp. 676–680. [Google Scholar]
  15. Hung, C.Y.; Parhami, B. An approximate sign detection method for residue numbers and its application to RNS division. Comput. Math. Appl. 1994, 27, 23–35. [Google Scholar] [CrossRef] [Green Version]
  16. Wang, Y. Residue-to-binary converters based on new Chinese remainder theorems. IEEE Trans. Circuits Syst. II Analog. Digit. Signal Process. 2000, 47, 197–205. [Google Scholar] [CrossRef]
  17. Patent for Invention № 2744815 Russian Federation, Int. Cl. G06F 7/72. Device for Transferring Numbers from Residue Number System and Base-Radix Extensions: № 2020120649; Priority. 22.06.2020; Date of Publication. 16.03.2021/Babenko M.G., Kuchukov V.A., Chernykh A.N., Kucherov N.N.; Proprietor: Federalnoe Gosudarstvennoe Avtonomnoe Obrazovatelnoe Uchrezhdenie Vysshego Obrazovaniia “Severo-Kavkazskii Federalnyi Universitet” (RU).—13 p. Available online: https://fips.ru/ofpstorage/Doc/IZPM/RUNWC1/000/000/002/744/815/%D0%98%D0%97-02744815-00001/document.pdf (accessed on 16 November 2022).
  18. Stempkovsky, A.; Telpukhov, D.; Mkrtchan, I.; Zhigulin, A. Reference Points Based RNS Reverse Conversion for General Moduli Sets. In Proceedings of the International Conference on Mathematics and Its Applications in New Computer Systems, Stavropol, Russia, 13–15 December 2021; pp. 253–262. [Google Scholar]
Figure 1. Computational unit for translating numbers from RNS and expanding bases.
Figure 1. Computational unit for translating numbers from RNS and expanding bases.
Applsci 12 12355 g001
Figure 2. Reverse converter based on reference point.
Figure 2. Reverse converter based on reference point.
Applsci 12 12355 g002
Figure 3. Reverse converter based on reference point and modified MRC.
Figure 3. Reverse converter based on reference point and modified MRC.
Applsci 12 12355 g003
Figure 4. Reverse conversion for 8 bits.
Figure 4. Reverse conversion for 8 bits.
Applsci 12 12355 g004
Figure 5. Reverse conversion for 16 bits.
Figure 5. Reverse conversion for 16 bits.
Applsci 12 12355 g005
Figure 6. Reverse conversion for 32 bits.
Figure 6. Reverse conversion for 32 bits.
Applsci 12 12355 g006
Figure 7. Comparison of the time required for the methods of translation from RNS to positional number system.
Figure 7. Comparison of the time required for the methods of translation from RNS to positional number system.
Applsci 12 12355 g007
Figure 8. Comparison of the area used for methods of translation from RNS to positional number system.
Figure 8. Comparison of the area used for methods of translation from RNS to positional number system.
Applsci 12 12355 g008
Table 1. LUT values for the example at hand.
Table 1. LUT values for the example at hand.
X 4 Reference Point Value X 4 Reference Point Value
004420
11055525
22106630
33157735
Table 2. Time and area comparison for 8 bits.
Table 2. Time and area comparison for 8 bits.
RNS ModuliLayerArea, µm2Time, ps
IIIIIIIIIIII
{3, 5, 7, 8}3-5-7/8553442408654987987
3-7/5-8425729
{3, 5, 32}3-5/32236483279521787787
32/3-5266494
{3, 7, 16}3-7/162173503155236911016
{5, 7, 8}5-7/82932882772778451051
{5, 9, 16}5-9/164094444146119841277
16/5-9371508
{7, 9, 16}7-9/16406426342568979970
{7, 15, 16}7-15/1660457954371311971486
15-16/7392903
Table 3. Time and area comparison for 16 bits.
Table 3. Time and area comparison for 16 bits.
RNS ModuliLayerArea, µm2Time, ps
IIIIIIIIIIII
{3, 5, 7, 17, 64}3-5-7/64/17158215381498232217522012
{5, 7, 9, 17, 32}5-7-9/17/32218116771477151821152288
5-32/7-17/918682896
{7, 15, 17, 64}7-17/15/64132916271553180520252231
{7, 15, 31, 32}7-31/15-32255215661381153820182266
{15, 17, 31, 32}31/32 /15-17200114641353191520142274
{31, 33, 128}31/33/1289451302759107116251628
128/31-332219798
{31, 63, 64}31/63/64101514571391137219642320
31-63/6426431048
Table 4. Time and area comparison for 32 bits.
Table 4. Time and area comparison for 32 bits.
RNS ModuliLayerArea, µm2Time, ps
IIIIIIIIIIII
{3, 7, 17, 31, 65, 127, 128}3-17-31/7-127/65/12812,15356585982507747314837
3-128/7-127/17-65/3110,7305461
{7, 17, 31, 65, 127, 256}7-65/17-256/31-12730,74154216168332142124545
{9, 17, 31, 65, 127, 128 }127/17-65/128/9-31960153395314419041904675
128/127/65/9-17-3125,8704383
{31, 33, 65, 127, 512}31-33/65/127/512699653915397374642704392
31-127/65-33/51219,6913356
{31, 65, 127, 129, 256}31-65/127/129/25610,90352976333476345104727
{127, 129, 257, 1024}127/129/1024/257350952263906370735893917
127-129/1024/25711,0753407
{127, 255, 257, 1024}127/255/257/1024431860254535358940754284
{127, 255, 511, 512}127/255/511/512483759455726310842214377
{1023, 1025, 8192}1023/1025/8192107436522482136628212984
8192/1023/102526593081
{1023, 2047, 4096}4096/2047/1023153550313966217933233638
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Kuchukov, V.; Telpukhov, D.; Babenko, M.; Mkrtchan, I.; Stempkovsky, A.; Kucherov, N.; Ermakova, T.; Grigoryan, M. Performance Analysis of Hardware Implementations of Reverse Conversion from the Residue Number System. Appl. Sci. 2022, 12, 12355. https://doi.org/10.3390/app122312355

AMA Style

Kuchukov V, Telpukhov D, Babenko M, Mkrtchan I, Stempkovsky A, Kucherov N, Ermakova T, Grigoryan M. Performance Analysis of Hardware Implementations of Reverse Conversion from the Residue Number System. Applied Sciences. 2022; 12(23):12355. https://doi.org/10.3390/app122312355

Chicago/Turabian Style

Kuchukov, Viktor, Dmitry Telpukhov, Mikhail Babenko, Ilya Mkrtchan, Alexander Stempkovsky, Nikolay Kucherov, Tatiana Ermakova, and Marine Grigoryan. 2022. "Performance Analysis of Hardware Implementations of Reverse Conversion from the Residue Number System" Applied Sciences 12, no. 23: 12355. https://doi.org/10.3390/app122312355

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop