Submodular signed RNS index-calculus multiplier

The submodular signed RNS index-calculus multiplier addresses inefficiencies in digital arithmetic systems by employing submodular decomposition and sign-magnitude encoding to reduce lookup table sizes and adder complexity, improving computational performance.

WO2026245982A1PCT designated stage Publication Date: 2026-11-26FUTUREWEI TECHNOLOGIES INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/US2025/044861
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-09-04
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Modern digital arithmetic systems face inefficiencies in multiplication techniques due to oversized lookup tables and imbalances in adder circuits, leading to increased hardware complexity and limited performance in high dynamic range computations.

Method used

A submodular signed RNS index-calculus multiplier apparatus and method that utilizes forward and reverse conversion lookup tables, sub-modulo adders, and sign computation logic to perform modular multiplication efficiently, reducing lookup table sizes and adder complexity through submodular decomposition and sign-magnitude encoding.

Benefits of technology

The solution achieves faster and more efficient modular multiplication by minimizing adder sizes and lookup tables, enhancing performance and reducing hardware complexity in digital arithmetic systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US2025044861_26112026_PF_FP_ABST
    Figure US2025044861_26112026_PF_FP_ABST
Patent Text Reader

Abstract

Configuring modular multiplication in an RNS includes storing a first RNS operand and a second RNS operand, each operand including a sign and a magnitude. The magnitude of the first RNS operand is received at a first forward conversion LUT, which outputs a first sign bit and a first set of submodular indices. The magnitude of the second RNS operand is received at a second forward conversion LUT, which outputs a second sign bit and a second set of submodular indices. A first modular sum is generated based on a first subset of the first and second sets of submodular indices. A second modular sum is generated based on a second subset of the first and the second sets of submodular indices. A product magnitude and sign are generated based on the modular sums. The product sign is adjusted using the sign bits and operand signs.
Need to check novelty before this filing date? Find Prior Art

Description

SUBMODULAR SIGNED RNS INDEX-CALCULUS MULTIPLIERTECHNICAL FIELD

[0001] The present disclosure is related to digital hardware design, with a focus on digital arithmetic systems and arithmetic units that utilize the Residue Number System (RNS) for operations such as addition, subtraction, and multiplication. Some aspects relate to digital arithmetic systems and, more specifically, to submodular signed RNS index-calculus multiplication techniques.BACKGROUND

[0002] Modern digital arithmetic systems routinely require highly efficient multiplication techniques to address the performance and power constraints of today's computing applications. The techniques employed in such systems may incorporate residue number representations, wherein integers are decomposed into several smaller components to enable parallel, carry -free processing. However, in implementing these methods, the conventional delays associated with binary carry propagation are often circumvented through decomposition. Although such approaches offer the promise of increased speed and reduced interconnect complexity, many current RNS-based multiplication methods are hindered by oversized lookup tables and imbalances in the underlying adder circuits. These deficiencies not only escalate overall hardware complexity but also limit the system’s performance in applications that demand rapid, high dynamic range computations.SUMMARY

[0003] Various examples are now described to introduce a selection of concepts in a simplified form that is further described below in the detailed description. The Summary is not intended to identify essential features of theclaimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.

[0004] According to a first aspect of the present disclosure, there is provided an apparatus for performing modular multiplication in a residue number system (RNS). The apparatus comprises a first operand register and a second operand register, each configured to store a sign and a magnitude representing a corresponding first RNS operand and a corresponding second RNS operand. The apparatus further comprises a first memory storing a first forward conversion lookup table (LUT), the first forward conversion LUT to receive the magnitude of the first RNS operand and output a first sign bit and a first set of submodular indices corresponding to the magnitude of the first RNS operand. The apparatus also comprises a second memory storing a second forward conversion LUT. the second forward conversion LUT to receive the magnitude of the second RNS operand and output a second sign bit and a second set of submodular indices corresponding to the magnitude of the second RNS operand. The apparatus includes a first sub-modulo adder coupled to the first and second memories, the first sub-modulo adder to generate a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices. The apparatus further includes at least a second submodulo adder coupled to the first and second memories, the second sub-modulo adder to generate a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices. In some aspects, more than two sub-modulo adders can be used (e.g., n sub-modulo adders, where n is a positive integer greater than 2). The apparatus comprises a third memory coupled to the first and second sub-modulo adders, the third memory storing a reverse conversion LUT, the reverse conversion LUT to determine a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on the first submodular sum and the second submodular sum. In aspects where more than 2 sub-modulo adders are used, there will be a corresponding (higher) number of submodular sums. The apparatus further comprises a sign computation logic coupled to the first operand register, the second operand register, the first memory, the second memory, and the third memory, the sign computation logic to adjust the product sign based onthe first sign bit, the second sign bit, the sign in the first operand register, the sign in the second operand register, and an actual parity from the reverse conversion LUT.

[0005] In a first implementation form of the apparatus according to the first aspect as such, the reverse conversion LUT comprises a plurality of table entries comprising uncorrected and corrected entries for sign and magnitude values associated with the first and second submodular sums. The reverse conversion LUT further comprises a plurality’ of parity bits corresponding to the plurality' of table entries.

[0006] In a second implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the reverse conversion LUT is further to store, for each table entry of the reverse conversion LUT, a set of indices corresponding to at least the first and second submodular sums. The reverse conversion LUT is further to determine the product magnitude and the product sign based on the set of indices.

[0007] In a third implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the apparatus further comprises parity logic coupled to the first memory, the second memory, and the third memory, the parity logic to compute an expected parity based on the first and second RNS operands. The parity logic is further to perform a comparison of the expected parity with the actual parity from the reverse conversion LUT. The parity logic is further to generate a parity' mismatch signal based on the comparison.

[0008] In a fourth implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the apparatus further comprises correction logic coupled to the sign computation logic, the reverse conversion LUT, and the parity' logic, the correction logic to select the product magnitude and the product sign from the uncorrected and corrected entries based on the parity mismatch signal.

[0009] In a fifth implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, theparity logic is further to detect an invalid row condition or a wrap-around condition associated with generating the first and second submodular sums by comparing the expected parity and the actual parity. The parity logic is further to signal the correction logic to select first corrected entries from the corrected entries stored in the first conversion LUT for the product magnitude and the product sign in response to the wrap-around condition.

[0010] In a sixth implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the first forward conversion LUT and the second forward conversion LUT are to determine the first and second sets of submodular indices based on reducing an index associated with the first RNS operand and the second RNS operand, modulo each of a plurality of pairwise co-prime submoduli. In some aspects, a higher number of sets of submodular indices can be used (e.g., n sets).

[0011] In a seventh implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the apparatus further comprises an output register coupled to the sign computation logic, the output register to store the product sign and the product magnitude.

[0012] In an eighth implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the output register is further to output the product sign and the product magnitude in a sign-magnitude encoded format.

[0013] In a ninth implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, the sign computation logic is further to adjust the product sign as an exclusive-OR (XOR) of the first sign bit, the second sign bit, the sign in the first operand register, the sign in the second operand register, and the parity mismatch signal.

[0014] In a tenth implementation form of the apparatus according to the first aspect as such or any preceding implementation form of the first aspect, each of the first sub-modulo adder and the second sub-modulo adder is configured as a 2n-1 modular adder, a 2n adder, or a 2n+1 modular adder. Insome aspects, a higher number of sub-modulo adders can be used (e.g., n submodulo adders).

[0015] According to a second aspect of the present disclosure, there is provided a computer-implemented method for performing modular multiplication in a residue number system (RNS). The method comprises storing a first RNS operand and a second RNS operand, each RNS operand comprising a sign and a magnitude. The method further comprises receiving the magnitude of the first RNS operand at a first forward conversion lookup table (LUT) and outputting a first sign bit and a first set of submodular indices. The method also comprises receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and a second set of submodular indices. The method includes generating a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices. The method includes generating at least a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices. The method further comprises determining, at a reverse conversion LUT, a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on the first submodular sum and the second submodular sum. The method further comprises adjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and an actual parity from the reverse conversion LUT. As mentioned above, a different number of sets (e.g., n sets) of submodular indices and submodular sums can be used.

[0016] In a first implementation form of the computer-implemented method according to the second aspect as such, the determining at the reverse conversion LUT further comprises outputting, from the reverse conversion LUT, a plurality of table entries comprising uncorrected and corrected entries for sign and magnitude values associated with at least the first and second submodular sums, and a plurality of parity bits corresponding to the plurality of table entries.

[0017] In a second implementation form of the computer-implemented method according to the second aspect as such or any preceding implementationform of the second aspect, the determining at the reverse conversion LUT further comprises storing, for each table entry of the reverse conversion LUT, a set of indices corresponding to at least the first and second submodular sums, and determining the product magnitude and the product sign based on the set of indices.

[0018] In a third implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the method further comprises computing an expected parity based on the first and second RNS operands. The method further comprises performing a comparison of the expected parity with the actual parity from the reverse conversion LUT. The method further comprises generating a parity mismatch signal based on the comparison.

[0019] In a fourth implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the method further comprises selecting the product magnitude and the product sign from the uncorrected and corrected entries based on the parity mismatch signal.

[0020] In a fifth implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the computing of the expected parity, performing the comparison, and generating the parity mismatch signal further comprises detecting an invalid row condition or a wrap-around condition associated with generating at least the first and second submodular sums by comparing the expected parity and the actual parity. The method further comprises selecting first corrected entries from the corrected entries stored in the first conversion LUT for the product magnitude and the product sign in response to the wraparound condition.

[0021] In a sixth implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the receiving the magnitude of the first RNS operand at the first forward conversion LUT and the receiving the magnitude of the second RNS operand at the second forward conversion LUT further comprisesdetermining at least the first and second sets of submodular indices based on reducing an index associated with the first RNS operand and the second RNS operand, modulo each of a plurality of pairwise co-prime submoduli.

[0022] In a seventh implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the method further comprises storing the product sign and the product magnitude in an output register.

[0023] In an eighth implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the method further comprises outputting the product sign and the product magnitude in a sign-magnitude encoded format.

[0024] In a ninth implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the adjusting the product sign further comprises adjusting the product sign as an exclusive-OR (XOR) of the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the parity mismatch signal.

[0025] In a tenth implementation form of the computer-implemented method according to the second aspect as such or any preceding implementation form of the second aspect, the generating of at least the first submodular sum and the generating of the second submodular sum each comprises performing a submodular sum using a 2n-1 modular adder, a 2n adder, or a 2n+1 modular adder.

[0026] According to a third aspect of the present disclosure, there is provided a non-transitory computer-readable medium storing computer instructions for performing modular multiplication in a residue number system (RNS), that configure at least one processor, upon execution of the computer instructions, to perform steps comprising storing a first RNS operand and a second RNS operand, each operand comprising a sign and a magnitude. The steps further comprise receiving the magnitude of the first RNS operand at a first forw ard conversion lookup table (LUT) and outputting a first sign bit and a firstset of submodular indices. The steps further comprise receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and at least a second set of submodular indices. The steps further comprise generating a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices. The steps further comprise generating at least a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices. The steps further comprise determining at a reverse conversion LUT, a product magnitude, and a product sign for a product of the first RNS operand and the second RNS operand based on the first submodular sum and the second submodular sum. The steps further comprise adjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and an actual parity from the reverse conversion LUT.

[0027] In a first implementation form of the non-transitory computer-readable medium according to the third aspect as such, the steps further comprise outputting, from the reverse conversion LUT, a plurality of table entries comprising uncorrected and corrected entries for sign and magnitude values associated with at least the first and second submodular sums, and a plurality of parity bits corresponding to the plurality of table entries. As mentioned above, a different number of sets (e.g., n sets) of submodular indices and submodular sums can be used.

[0028] In a second implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps further comprise storing, for each table entry of the reverse conversion LUT, a set of indices corresponding to at least the first and second submodular sums, and determining the product magnitude and the product sign based on the set of indices.

[0029] In a third implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps further comprise computing an expected parity based on the first and second RNS operands. The steps furthercomprise performing a comparison of the expected parity with the actual parity from the reverse conversion LUT. The steps further comprise generating a parity mismatch signal based on the comparison.

[0030] In a fourth implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps further comprise selecting the product magnitude and the product sign from the uncorrected and corrected entries based on the parity mismatch signal.

[0031] In a fifth implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps of computing the expected parity, performing the comparison, and generating the parity mismatch signal further comprise detecting an invalid row' condition or a wrap-around condition associated with generating the first and second submodular sums by comparing the expected parity and the actual parity. The steps further comprise selecting first corrected entries from the corrected entries stored in the first conversion LUT for the product magnitude and the product sign in response to the wraparound condition.

[0032] In a sixth implementation form of the non-transitory computer-readable media according to the third aspect as such or any preceding implementation form of the third aspect, the steps of receiving the magnitude of the first RNS operand at the first forward conversion LUT and receiving the magnitude of the second RNS operand at the second forward conversion LUT further comprise determining the first and second sets of submodular indices based on reducing an index associated with the first RNS operand and the second RNS operand, modulo each of a plurality of pairwise co-prime submoduli. As mentioned above, a different number of sets (e.g., n sets) of submodular indices and submodular sums can be used.

[0033] In a seventh implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps further comprise storing the product sign and the product magnitude in an output register.

[0034] In an eighth implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps further comprise outputting the product sign and the product magnitude in a sign-magnitude encoded format.

[0035] In a ninth implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the step of adjusting the product sign further comprises adjusting the product sign as an exclusive-OR (XOR) of the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the parity mismatch signal.

[0036] In a tenth implementation form of the non-transitory computer-readable medium according to the third aspect as such or any preceding implementation form of the third aspect, the steps of generating the first submodular sum and generating the second submodular sum each comprise performing a submodular sum using a 2n-1 modular adder, a 2nadder, or a 2n+1 modular adder.

[0037] According to a fourth aspect of the present disclosure, there is provided an apparatus for performing modular multiplication in a residue number system (RNS). The apparatus includes means for storing a first RNS operand and a second RNS operand, each RNS operand comprising a sign and a magnitude; means for receiving the magnitude of the first RNS operand at a first forward conversion lookup table (LUT) and outputting a first sign bit and a first set of submodular indices; means for receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and at least a second set of submodular indices; means for generating a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices; means for generating a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices; means for decoding each of the at least first and second submodular sums into decoded submodular sums associated with a 1-hot vector using a first decoder and a second decoder; means for combining the decoded submodular sums using a set of AND gates togenerate table lookup addresses; means for determining, using an OR gate, whether a table lookup address of the table lookup addresses corresponds to a bottom half of a reverse LUT; means for remapping the table lookup address using a set of pass gate multiplexers, the pass gate multiplexers being controlled by the output of the OR gate; means for inverting a product sign when the address is in the bottom half of the reverse LUT; means for determining a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on the table lookup address; and means for adjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the output of the OR gate, indicating a table bottom condition.

[0038] In a first implementation form of the apparatus according to the fourth aspect as such, the reverse LUT comprises a plurality of table entries, each entry including a sign bit and a signed magnitude, and wherein the number of table entries is (p— 1) / 2 for a prime modulus p.

[0039] In a second implementation form of the apparatus according to the fourth aspect as such or any preceding implementation form of the fourth aspect, the means for remapping the table lookup address using the set of pass gate multiplexers further comprises selecting between a top half and the bottom half of the reverse LUT based on an output of the OR gate. In some aspects, the means for inverting the product sign further comprises means for flipping the product sign when the address is in the bottom half of the reverse LUT.

[0040] Any one of the foregoing examples may be combined with any one or more of the other foregoing examples to create a new embodiment within the scope of the present disclosure.BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings illustrate generally, by way of example, but not by way of limitation, various embodiments discussed in the present document.

[0042] FIG. 1 is a block diagram of a computer system that can be configured to perform disclosed functionalities, according to example embodiments.

[0043] FIG. 2 is a block diagram of a microprocessor of the computer system of FIG. 1, which can be configured to perform disclosed functionalities, according to example embodiments.

[0044] FIG. 3 illustrates a Residual (or Residue Number System (RNS)) number RNS(8|7| 5| 3) represented in a binary -coded number format.

[0045] FIG. 4 is a block diagram of a circuit that can be configured as an adder, a subtractor, or a multiplier for numbers in the RNS format using the RNS(8|7|5|3) representation, according to example embodiments.

[0046] FIG. 5 illustrates components for implementing modular multiplication for moduli not of the form 2k-1, 2k, or 2k+1. according to example embodiments.

[0047] FIG. 6 illustrates a table with multiplication group representations using the primitive roots of a prime number p=11.

[0048] FIG. 7 is a block diagram of an index-calculus multiplier circuit.

[0049] FIG. 8 is a table with magnitude and submodular indices, which can be used by a submodular RNS multiplier circuit.

[0050] FIG. 9 is a block diagram of a submodular RNS multiplier circuit configured based on the table of FIG. 8.

[0051] FIG. 10 is a table with magnitude, sign, and sign magnitude, which can be used by a sign-magnitude RNS multiplier circuit.

[0052] FIG. 11 is a table with magnitude, sign, and sign magnitude, which can be used by a sign-magnitude RNS multiplier circuit.

[0053] FIG. 12 is a block diagram of a sign-magnitude RNS multiplier circuit configured based on the tables of FIG. 10 and FIG. 11.

[0054] FIG. 13 is a block diagram of a modulo 106 adder.

[0055] FIG. 14A is a block diagram of a multiplier circuit, according to example embodiments.

[0056] FIG. 14B is a flowchart of a method for configuring forward LUTs used by the multiplier embodiments associated with FIG. 15 - FIG.20, according to example embodiments.

[0057] FIG. 14C is a flowchart of a method for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 15 - FIG. 16, according to example embodiments.

[0058] FIG. 14D is a flowchart of a method for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 17A - FIG. 17C, according to example embodiments.

[0059] FIG. 14E is a flowchart of a method for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 18A - FIG. 18C, according to example embodiments.

[0060] FIG. 14F is a flowchart of a method for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 19A - FIG.20, according to example embodiments.

[0061] FIG. 15 is a table with magnitude, sign, sign magnitude, submodular indices, and parity, which can be used by a multiplier circuit configured based on disclosed techniques, according to example embodiments.

[0062] FIG. 16 is a block diagram of a submodular signed RNS indexcalculus multiplier circuit configured based on the table of FIG. 15. according to example embodiments.

[0063] FIG. 17A is a table with magnitude, sign, sign magnitude, submodular indices, and parity, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a perfect wraparound case, according to example embodiments.

[0064] FIG. 17B is a forward lookup table (LUT), which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a perfect wrap-around case, according to example embodiments.

[0065] FIG. 17C is a reverse LUT, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a perfect wrap-around case, according to example embodiments.

[0066] FIG. 18A is a table with magnitude, sign, sign magnitude, submodular indices, and parity, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no wraparound and complete fill case, according to example embodiments.

[0067] FIG. 18B is a forward LUT, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no wrap-around and complete fill case, according to example embodiments.

[0068] FIG. 18C is a reverse LUT. which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no wrap-around and complete fill case, according to example embodiments.

[0069] FIG. 19A is a table with magnitude, sign, sign magnitude, submodular indices, and parity, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no wraparound and partial fill case, according to example embodiments.

[0070] FIG. 19B is a forward LUT, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no wrap-around and partial fill case, according to example embodiments.

[0071] FIG. 19C is a reverse LUT. which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no wrap-around and partial fill case, according to example embodiments.

[0072] FIG. 20 is a block diagram of a multiplier circuit configured based on the tables of FIG. 19A, FIG. 19B, and FIG. 19C, according to example embodiments.

[0073] FIG. 21 is a table with magnitude, sign, sign magnitude, and submodular indices, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no parity case associated with FIG. 21 - FIG. 24, according to example embodiments.

[0074] FIG. 22 is a reverse LUT. which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no parity case associated with FIG.21 - FIG.24, according to example embodiments.

[0075] FIG. 23 is a block diagram of a multiplier circuit configured based on the tables of FIG.21 and FIG.22, according to example embodiments.

[0076] FIG. 24 is a block diagram of an OR gate and a multiplexer circuit, which can be used in the multiplier circuit of FIG.23, according to example embodiments.

[0077] FIG. 25 is a block diagram of another embodiment of the multiplier circuit of FIG.23, according to example embodiments.

[0078] FIG. 26 is a block diagram of a 1-hot modulo 3 adder used by the multiplier circuit of FIG.25, according to example embodiments.

[0079] FIG. 27 depicts Verilog code for the 1-hot modulo 3 adder and the 1-hot modulo 5 adder used by the multiplier circuit of FIG.25, according to example embodiments.

[0080] FIG. 28 is a flowchart of a method for configuring a submodular signed RNS index-calculus multiplier circuit, according to example embodiments.

[0081] FIG. 29 is a diagram of circuitry for a device that implements algorithms and performs methods, according to some example embodiments.DETAILED DESCRIPTION

[0082] The following detailed description provides illustrative examples of the disclosed subject matter and associated embodiments. This description is intended to facilitate understanding of the disclosed subject matter and its various aspects, but is not meant to limit the scope of the claims. The disclosed subject matter generally pertains to the field of digital arithmetic systems, specifically those employing the RNS for the computation of arithmetic operations such as addition, subtraction, and multiplication. The describedtechniques address challenges in modular arithmetic, including carry propagation, lookup table size, and hardware complexity, while introducing novel methods for submodular signed RNS index-calculus multiplication.

[0083] It should be understood at the outset that although an illustrative implementation of one or more embodiments is provided below, the disclosed systems and / or methods described with respect to FIGS. 1-29 may be implemented using any number of techniques, whether currently known or not yet in existence. The disclosure should in no way be limited to the illustrative implementations, drawings, and techniques illustrated below, including the exemplary designs and implementations illustrated and described herein, but may be modified within the scope of the appended claims along with their full scope of equivalents.

[0084] In the following description, reference is made to the accompanying drawings that form a part hereof and are shown, by way of illustration, specific embodiments that may be practiced. These embodiments are described in sufficient detail to enable those skilled in the art to practice the inventive subject matter, and it is to be understood that other embodiments may be utilized, and that structural, logical, and electrical changes may be made without departing from the scope of the present disclosure. The following description of example embodiments is, therefore, not to be taken in a limiting sense, and the appended claims define the scope of the present disclosure.

[0085] The examples and embodiments described herein are provided for illustrative purposes only and are not intended to cover all possible variations. Specific details, such as widely recognized principles of modular arithmetic or standard digital circuit design techniques, may be omitted for clarity and brevity. The described subject matter allows for numerous modifications, rearrangements, and substitutions without departing from the scope defined by the appended claims. Accordingly, the specific configurations, structures, and methods disclosed herein are not to be construed as limiting, but rather as representative of the concepts presented.

[0086] As used herein, the term “Residue Number System (RNS)’?indicates a number representation system in which an integer is represented byits remainders (residues) with respect to a set of pairwise co-prime moduli. Each number is uniquely represented as a vector of residues, and arithmetic operations such as addition, subtraction, and multiplication are performed independently in each modulus channel, without carry propagation between channels.

[0087] As used herein, the term "modulus" (plural: “moduli”) indicates an integer greater than one that serves as the base for modular arithmetic in an RNS channel. Each modulus in an RNS system is pairwise co-prime with the others, and the dynamic range of the RNS is the product of all moduli.

[0088] As used herein, the term “dynamic range” indicates the total number of distinct values that can be uniquely represented in a given RNS system, calculated as the product of all the moduli used in the system.

[0089] As used herein, the term “primitive root” indicates an integer (g) such that the set of its powers modulo a prime (p) generates all nonzero elements of the multiplicative group modulo p. In other words, every integer from 1 to p-1 can be written as gkmod p for some integer k.

[0090] As used herein, the term “index calculus” indicates a multiplication technique in which operands are represented by their indices. As used herein, the term “index” (e.g.. index k) indicates the power or exponent of a generator g being a primitive root of a prime modulus p. Multiplication is performed by adding the indices modulo p-1, and the product is obtained by a reverse lookup from the resulting index.

[0091] As used herein, the term “submodular” indicates a structure or operation in which a modulus is factored into smaller, pairwise co-prime submoduli, allowing arithmetic operations to be performed using smaller and faster adders corresponding to each submodulus.

[0092] As used herein, the term “sign-magnitude encoding” indicates a representation of numbers in which each value is expressed by a sign bit and a magnitude, typically reducing the size of lookup tables by exploiting the symmetry of modular groups.

[0093] As used herein, the term “lookup table (LUT)” indicates a memory structure or data table used to map input values (such as indices orresidues) to corresponding output values (such as products or reverse indices) in modular arithmetic operations. In some aspects, an LUT can be configured as a hardware device.

[0094] As used herein, the term "forw ard lookup table7’ (or "forw ard LUT”) indicates a table that maps a number or its magnitude to its corresponding index or submodular representation, typically used in the initial stage of indexcalculus multiplication.

[0095] As used herein, the term “reverse lookup table” (or “reverse LUT”) indicates a table that maps an index or submodular representation back to the corresponding number or magnitude, typically used to recover the product in index-calculus multiplication.

[0096] As used herein, the term “wrap-around” indicates a condition in modular arithmetic w here the sum of indices or residues exceeds the range of valid table entries, requiring correction or adjustment to maintain consistency with the group structure.

[0097] As used herein, the term “corrected” (as in “corrected sign” or “corrected magnitude”) indicates a value in a lookup table that has been adjusted to account for invalid or unused table entries, typically by shifting or inverting the corresponding uncorrected value.

[0098] As used herein, the term “uncorrected” (as in “uncorrected sign” or “uncorrected magnitude”) indicates a value in a lookup table that is directly derived from the group structure without adjustment for invalid or unused entries.

[0099] As used herein, the term “submodular signed RNS index-calculus multiplier” indicates a modular multiplier that combines submodular decomposition and sign-magnitude encoding with index-calculus multiplication, resulting in reduced adder sizes and smaller lookup tables compared to existing multiplier techniques.

[0100] As used herein, the term “end-around-carry (EAC) adder” indicates an adder used for moduli of the form 2n-l, in which the carry-out fromthe most significant bit is fed back as a carry-in to the least significant bit, enabling efficient modular addition.

[0101] As used herein, the term "diminished- 1 adder” indicates an adder architecture for modulo 2n+l arithmetic, where the operands are represented in a form that allows the adder to operate on n-bit values, improving speed and area efficiency.

[0102] As used herein, the term “pairwise co-prime” indicates that every pair of integers in a set has no common divisors other than one. This is a property that can be used for the moduli in an RNS system to ensure unique representation and correct arithmetic.

[0103] As used herein, the term “prime modulus” (e.g., p) indicates a modulus value that is a prime number, used as the base for modular arithmetic in a given RNS channel or group, ensuring the existence of a primitive root and unique group structure.

[0104] As used herein, the term “generator” (e.g., g) indicates a primitive root of a prime modulus p, such that the set of its powers modulo p generates all nonzero elements of the multiplicative group modulo p.

[0105] As used herein, the term “index” (e.g., k) indicates the exponent to which the generator g is raised to produce a particular group element modulo p (i.e., for a group element x, x=gkmod p).

[0106] As used herein, the term “unsigned magnitude” (e.g.. magk) indicates the absolute value of a group element corresponding to index k, without regard to sign, as generated by the power gkmod p.

[0107] As used herein, the term “sign bit” (e.g., Sk) indicates a binary value associated with a group element or table entry that indicates whether the corresponding signed magnitude is positive or negative.

[0108] As used herein, the term “signed magnitude” (e.g., msk) indicates the value of a group element represented as the absolute value (magnitude) together with its sign, typically determined by the sign bit Sk.

[0109] As used herein, the term “number of submoduli” (e.g., n) indicates the total count of submoduli into which a modulus is factored for submodular arithmetic, with each submodulus being pairwise coprime with the others.

[0110] As used herein, the term “submoduli” (e.g., mo, mi,..., mn-i) indicates the set of pairwise co-prime integers into which a modulus is factored, each serving as the base for a submodular channel in the RNS system.

[0111] As used herein, the term “dynamic range (M)” indicates the product of all moduli, representing the total number of unique values that can be represented in the RNS system or a modular group.

[0112] As used herein, the term “submodular indices” (e.g., <k>mo, <k>mi,..., <k>mn-i) indicates the set of remainders obtained by reducing the index k modulo each submodulus mo, mi,..., mn-i, used to address or organize lookup tables in submodular arithmetic.

[0113] As used herein, the term “valid rows in a reverse LUT” (e.g., rv) indicates the number of rows in a reverse lookup table that correspond to valid, meaningful group elements or products, typically equal to the number of unique group elements represented.

[0114] As used herein, the term “invalid rows in a reverse LUT” (e.g.. n) indicates the number of rows in a reverse lookup table that do not correspond to valid group elements or products, often resulting from mismatches between the group size and the table size.

[0115] As used herein, the term “modular adder sum” (e.g., <sum>msk) indicates the result of adding two signed magnitudes (or other group elements) modulo the prime modulus p or another specified modulus.

[0116] As used herein, the term “submodular adder sum” (e.g., <surn>mo. <sum>mi,..., <surn>mn-i) indicates the result of adding two indices or values modulo each submodulus mo, mi,..., mn-i, producing a set of submodular sums.

[0117] As used herein, the terms “parity” or “parity bit” (e.g., pi. or p) indicate a binary value (typically 0 or 1) associated with a table entry or index,indicating whether the index or address is even or odd. and used to detect a wrap-around or to select between corrected and uncorrected table entries.

[0118] As used herein, the term "uncorrected reverse LUT sign"’ (e.g.. suk) indicates the sign bit value retrieved from a reverse lookup table entry before any correction for invalid rows or a wrap-around is applied.

[0119] As used herein, the term “corrected reverse LUT sign” (e.g.. sck) indicates the sign bit value retrieved from a reverse lookup table entry after correction for invalid rows or wrap-around, typically by shifting or inverting the uncorrected value.

[0120] As used herein, the term “uncorrected reverse LUT magnitude” (e.g., muk) indicates the magnitude value retrieved from a reverse lookup table entry before any correction for invalid rows or a wrap-around is applied.

[0121] As used herein, the term “corrected reverse LUT magnitude” (e.g., mck) indicates the magnitude value retrieved from a reverse lookup table entry after correction for invalid rows or wrap-around, typically by shifting the uncorrected value by the number of invalid rows.

[0122] As used herein, the term “residue” indicates the remainder obtained when an integer is divided by a modulus, representing the value of that integer in a particular RNS channel.

[0123] As used herein, the term “residue representation” indicates the expression of an integer as a vector of its residues with respect to a set of pairwise co-prime moduli in an RNS system.

[0124] As used herein, the term “RNS channel” indicates an independent computational path or unit corresponding to a specific modulus in an RNS system, where arithmetic operations are performed modulo that modulus.

[0125] As used herein, the term “carry propagation” indicates the process in conventional arithmetic where a carry generated in one digit position is transferred to the next higher digit position, which is eliminated in RNS arithmetic.

[0126] As used herein, the term “carry-save adder’ (or CSA) indicates a digital adder architecture that computes the sum of three or more numbers by producing separate sum and carry outputs, allowing for faster addition by deferring carry propagation.

[0127] As used herein, the term “carry-propagate adder” (or CPA) indicates a digital adder architecture that computes the sum of two numbers by propagating carries through each digit position, resulting in a final sum.

[0128] As used herein, the term “end-around borrow adder” indicates an adder used for moduli of the form 2n+l, where the borrow from the least significant bit is fed back to the most significant bit, enabling efficient modular addition.

[0129] As used herein, the term “end-around carry adder” indicates an adder used for moduli of the form 2n-l.

[0130] As used herein, the term “weighted representation” indicates a number representation in which each digit position has an associated weight, typically a power of the base, as in conventional binary' or decimal systems.

[0131] As used herein, the term “multiplicative group” indicates the set of nonzero integers modulo a prime p under multiplication, forming a group structure with respect to modular multiplication.

[0132] As used herein, the term “additive group” indicates the set of integers modulo n under addition, forming a group structure with respect to modular addition.

[0133] As used herein, the term “isomorphic mapping” indicates a one-to-one correspondence between two group structures that preserves the group operation, such as between the multiplicative group modulo p and the additive group modulo p-1.

[0134] As used herein, the term “pseudo primitive root” indicates an integer g such that the set of its powers modulo p covers all absolute values from 1 to (p— 1 ) / 2, used in sign-magnitude or symmetric RNS index-calculus multipliers.

[0135] As used herein, the term “parity mismatch’" indicates a condition where the expected parity and the actual parity of a table entry differ, typically used to detect a wrap-around or the need for correction in lookup tables.

[0136] As used herein, the term “bit line” indicates a conductor in a memory array that connects the columns of memory cells to sense amplifiers or peripheral circuits.

[0137] As used herein, the term “DRAM cell” indicates a dynamic random-access memory cell, typically consisting of a transistor and a capacitor, used to store a single bit of information.

[0138] As used herein, the term “compute-in-memory (CIM)” indicates an architectural approach in which computation, such as multiplication or accumulation, is performed directly within memory arrays, reducing data movement and improving efficiency.

[0139] As used herein, the term “mantissa” indicates the significant digits of a floating-point number, representing the precision component in floating-point arithmetic.

[0140] As used herein, the term “exponent” indicates the part of a floating-point number that scales the mantissa by a power of the base, determining the overall magnitude of the value.

[0141] As used herein, the term “floating point format” indicates a number representation in which a value is expressed as a mantissa and an exponent, allowing for a wide dynamic range.

[0142] As used herein, the term “integer format” indicates a number representation in which a value is expressed as a whole number without fractional or exponential components.

[0143] As used herein, the term “dynamic range efficiency” indicates the ratio of the dynamic range provided by a set of RNS moduli to the minimum required dynamic range for a given data type or application.

[0144] As used herein, the term “table entry ” indicates a single row or cell in a lookup table, containing data such as a magnitude, sign, index, or other value used in modular arithmetic operations.

[0145] As used herein, the term “table address” indicates the index or set of indices used to access a specific entry in a lookup table.

[0146] As used herein, the term “table correction” indicates the process or value used to adjust a lookup table entry7to account for invalid or unused rows, wrap-around, or other conditions.

[0147] As used herein, the term “invalid parity ” indicates a parity value assigned to a table entry7that does not correspond to a valid group element or product, often used to mark unused or invalid rows.

[0148] As used herein, the term “valid parity” indicates a parity value assigned to a table entry that corresponds to a valid group element or product.

[0149] As used herein, the term “group element” indicates a member of a mathematical group, such as an integer modulo p in the multiplicative group of a prime field.

[0150] As used herein, the term “multiplicative inverse” indicates, for a given element x in a group, another element y such that x • y = 1 mod p.

[0151] As used herein, the term “additive inverse” indicates, for a given element x in a group, another element y such that x + y = 0 mod p.

[0152] As used herein, the term “modulo reduction” indicates the operation of reducing a value to its remainder after division by a modulus.

[0153] As used herein, the term “modulo addition” indicates the operation of adding two values and then reducing the result modulo a specified modulus.

[0154] As used herein, the term “modulo multiplication” indicates the operation of multiplying two values and then reducing the result modulo a specified modulus.

[0155] As used herein, the term “modulo subtraction” indicates the operation of subtracting one value from another and then reducing the result modulo a specified modulus.

[0156] As used herein, the term “submodular decomposition” indicates the process of factoring a modulus into smaller, pairwise co-prime submoduli for use in submodular arithmetic.

[0157] As used herein, the term “balanced submoduli” indicates a selection of submoduli whose sizes are similar, resulting in more uniform channel widths and delays in RNS arithmetic.

[0158] As used herein, the term “unbalanced submoduli” indicates a selection of submoduli with significantly different sizes, which can lead to uneven channel widths and delays in RNS arithmetic.

[0159] As used herein, the term “channel width” indicates the number of bits required to represent values in a particular RNS channel, determined by the size of the modulus.

[0160] As used herein, the term “channel delay” indicates the time required to perform arithmetic operations in a particular RNS channel, typically influenced by the size of the modulus and the adder architecture.

[0161] As used herein, the term “data type” indicates a classification of data based on its representation and range, such as integer, floating point, or fixed point, which determines the required dynamic range and precision.

[0162] As used herein, the term “operand” indicates an input value to an arithmetic operation, such as addition, subtraction, or multiplication, in RNS or other number systems.

[0163] As used herein, the term “product sign” indicates the sign bit associated with the result of a multiplication operation, determined by the signs of the operands and any correction logic.

[0164] As used herein, the term “product magnitude” indicates the absolute value associated with the result of a multiplication operation, determined by the magnitudes of the operands and any correction logic.

[0165] As used herein, the term “sign detector"’ indicates a circuit or algorithm used to determine the sign of a value in modular or RNS arithmetic.

[0166] As used herein, the term “overflow detection” indicates the process of determining whether an arithmetic operation has produced a result outside the representable range of the system.

[0167] As used herein, the term “magnitude comparison” indicates the process of comparing the absolute values of two numbers, typically in the context of modular or RNS arithmetic.

[0168] As used herein, the term “conversion” (e.g., RNS to / from binary) indicates the process of translating a value between its residue number system representation and its conventional binary representation.

[0169] As used herein, the term “table size” indicates the number of entries or the total storage required for a lookup table used in modular or RNS arithmetic.

[0170] As used herein, the term “table fill” indicates the proportion of valid entries in a lookup table relative to its total size.

[0171] As used herein, the term “partial fill” indicates a lookup table in which only a subset of the possible entries correspond to valid group elements or products.

[0172] As used herein, the term “complete fill” indicates a lookup table in which all possible entries correspond to valid group elements or products.

[0173] As used herein, the term “perfect wrap-around” indicates a condition in which the periodicity of the group exactly matches the size of the submodular table, resulting in no invalid rows and simplified correction logic.

[0174] As used herein, the term “no wrap-around” indicates a condition in which the sum of indices or residues does not exceed the range of valid table entries, eliminating the need for a wrap-around correction.

[0175] As used herein, the term “correction logic” indicates circuitry or algorithms used to adjust lookup table outputs to account for invalid rows, wraparound, or other conditions.

[0176] As used herein, the term “correction offset” indicates the amount by which a lookup table entry’ is shifted or adjusted to account for invalid or unused rows.

[0177] As used herein, the term “table rotation” indicates the process of cyclically shifting the entries of a lookup table to align valid and corrected values.

[0178] As used herein, the term “table shift” indicates the process of moving the entries of a lookup table up or down by a specified number of positions to achieve correction.

[0179] As used herein, the term “table inversion” indicates the process of flipping the sign or value of a lookup table entry, typically as part of correction logic.

[0180] As used herein, the term “table mapping” indicates the correspondence between input indices and output values in a lookup table.

[0181] As used herein, the term “table lookup” indicates the process of retrieving a value from a lookup table based on a given address or index.

[0182] As used herein, the term “table output” indicates the value retrieved from a lookup table for a given input address.

[0183] As used herein, the term “table input” indicates the address or index used to access a specific entry in a lookup table.

[0184] As used herein, the term “table row” indicates a horizontal entry in a lookup table, ty pically corresponding to a specific input or index.

[0185] As used herein, the term “table column” indicates a vertical entry in a lookup table, typically corresponding to a specific output value or attribute.

[0186] As used herein, the term “table index” indicates the value or set of values used to address a specific entry in a lookup table.

[0187] As used herein, the term “table value” indicates the data stored in a specific entry of a lookup table.

[0188] As used herein, the term “table parity” indicates the parity bit associated with a table entry, which is used for wrap-around or correction logic.

[0189] As used herein, the term “table sign” indicates the sign bit associated with a table entry, representing the sign of the corresponding value.

[0190] As used herein, the term “table magnitude” indicates the magnitude value associated with a table entry, representing the absolute value of the corresponding group element.

[0191] As used herein, the term “table wrap” indicates the wrap bit or status associated with a table entry, indicating whether the value has wrapped around the modulus.

[0192] As used herein, the term “table mismatch” indicates a discrepancy between expected and actual values in a lookup table, often used to trigger correction logic.

[0193] As used herein, the term “table validity” indicates whether a table entry corresponds to a valid group element or product.

[0194] As used herein, the term “table invalidity” indicates that a table entry does not correspond to a valid group element or product, often due to mismatches between group size and table size.

[0195] As used herein, the term “1-hot modulo adder” indicates an adder that accepts inputs and produces outputs in 1-hot decoded form, instead of in binary form, and is capable of computing a sum in any arbitrary modulus (e.g., not just for moduli of the form 2n-l, 2n, or 2n+l). Because the adder uses 1-hot decoded inputs and outputs, its modulus is usually restricted to very small values (e.g., values that are approximately smaller than or equal to 8).

[0196] Computer systems frequently include one or more circuits for performing arithmetic functions such as addition, subtraction, multiplication, and division. In general-purpose computer architectures, one or more circuits for performing arithmetic operations such as multiplication may be integrated as execution units within a central processing unit (CPU). For example, computer systems frequently include combinatorial logic circuits (e.g., in a microprocessor) such as a Vector Unit (VU), an arithmetic logic unit (ALU),and / or a floating-point unit (FPU), often referred to as a math coprocessor. One or more such units may include multiplication circuits (multiplication units) to perform multiplication operations. In a general-purpose computer architecture, one or more VUs, ALUs, and / or FPUs may be integrated as execution units within the central processing unit. One way to improve the efficiency of multiplication operations is through the use of Residual, or Residue Number System (RNS), multiplication operations, in which a set of remainders represents the operands for a set of moduli. Although this approach can provide advantages, when implemented, it can require m x m lookup tables for a modulus value of m, may need to use division for performing modular reduction for general values of m, or may be restricted to specific values such as 2n-l. 2n, or 2n+l, where n is an integer. The need for division can significantly slow the process, and the need for 2-dimensional lookup tables can result in large areas and power requirements for larger moduli. The moduli of the form 2n-1, 2n, or 2n+l restrict the possible choices of moduli. Circuits that perform RNS-based multiplication operations in an efficient manner (e.g., one or more multiplier circuits that may be configured based on the disclosed techniques) may mitigate such delays.

[0197] The problem addressed by the disclosed techniques concerns inefficiencies in the processing of complex queries within batch-processing frameworks, specifically in the context of hardware and digital arithmetic systems. A primary issue arises from the repeated retrieval and processing of identical data during the execution of a single query. This leads to redundant computations, increased processing time, and inefficient use of system resources. In the context of RNS-based arithmetic units, traditional approaches to modular multiplication require either large lookup tables or complex modular reduction operations, especially when the modulus is not of the form 2n-l, 2nor 2n+l. These methods often result in significant hardware area and power consumption, as well as increased computational latency.

[0198] The environment in which this problem occurs includes batchprocessing systems that interact with various storage media, such as local storage devices, cloud storage, and external databases. The problem is particularlyrelevant in systems where high-throughput and low-latency arithmetic operations are critical, such as neural network accelerators, digital signal processors, and general-purpose computing units.

[0199] The impact of the problem can cause inefficient arithmetic operations, which can limit the overall performance of computing systems, increase energy consumption, and restrict scalability. In neural network and signal processing applications, these inefficiencies can lead to slower inference times and higher operational costs. If not addressed, the problem can prevent systems from meeting performance and efficiency requirements for modem data-intensive applications.

[0200] Potential causes of the problem include the inherent limitations of conventional RNS multiplier designs. Prior solutions often require full-sized lookup tables, which scale poorly with increasing modulus size, or rely on adder architectures that are not optimized for hardware efficiency. In some cases, the selection of submoduli leads to unbalanced channel widths, causing uneven delays and further reducing system performance.

[0201] Some solutions can address these issues through the use of submodular decomposition and sign-magnitude encoding. Submodular RNS multipliers break down the modulus into smaller, co-prime submoduli to reduce adder size, but still require large lookup tables and can result in unbalanced hardware. Sign-magnitude RNS multipliers reduce the lookup table size by half but do not address the adder size. These approaches provide partial improvements but do not fully resolve the combined challenges of lookup table size, adder efficiency, and balanced channel delays.

[0202] The current document discusses these limitations and sets the stage for a solution that aims to combine the advantages of submodular decomposition and sign-magnitude encoding, while addressing the shortcomings of prior approaches.

[0203] The disclosed techniques include methods and systems (e.g., hardware architectures such as multiplier circuits) for modular multiplication in digital arithmetic systems, which can be based on combining two types of RNSindex-calculus multiplication: RNS submodular index-calculus multiplication and RNS sign-magnitude index-calculus multiplication. By combining submodular decomposition with sign-magnitude encoding and index-calculus multiplication, the disclosed techniques enable arithmetic operations to be performed using smaller, balanced adders and reduced-size lookup tables. The method leverages the properties of primitive roots and submodular indices to efficiently map and retrieve multiplication results, while correction logic ensures accuracy in cases of table wrap-around or invalid entries. The technical effect is a reduction in hardware complexity, area, and power consumption, along with improved computational speed and scalability for high dynamic range arithmetic operations.

[0204] Compared to prior art techniques, the disclosed approach offers several advantages. Traditional submodular RNS multipliers reduce adder size but require large lookup tables and can result in unbalanced channel delays, while sign-magnitude RNS multipliers reduce lookup table size but do not address adder efficiency The disclosed techniques overcome these limitations by simultaneously minimizing both adder size and lookup table size, and by enabling the use of balanced submoduli for uniform channel delays. This results in more efficient hardware implementations, lower latency, and better scalability for applications such as neural network accelerators and digital signal processors.

[0205] FIG. 1 through FIG. 13 illustrate the context and limitations of some existing techniques in digital arithmetic systems using the RNS. These figures include block diagrams of computer systems and microprocessors (e.g., FIG. 1 and FIG.2), representations of RNS numbers and modular arithmetic units (e.g., FIG.3 - FIG.5), tables and diagrams showing primitive roots, indexcalculus multiplication, and submodular RNS multipliers (e.g., FIG.6 - FIG.9), as well as sign-magnitude encoding, lookup tables, and adder architectures (e.g., FIG. 10 - FIG. 13). FIG. 14A through FIG.26 present the disclosed techniques, including block diagrams and tables for submodular signed RNS index-calculus multipliers, forward and reverse lookup tables, correction logic, and example hardware implementations. These figures demonstrate thestructure, operation, and technical advantages of the solution, including reduced lookup table size, balanced submoduli, and efficient correction mechanisms for modular multiplication in RNS-based digital arithmetic systems.

[0206] FIG. 1 is a block diagram of a computer system 100 that can be configured to perform disclosed functionalities, according to example embodiments.

[0207] FIG. 2 is a block diagram of a microprocessor 120 of the computer system 100 of FIG. 1, which can be configured to perform disclosed functionalities, according to example embodiments.

[0208] FIG. 1 and FIG. 2, respectively, are block diagrams of a computer system 100 and a microprocessor 120 that can be incorporated into such a computer system that implements one or more of the disclosed techniques. In the simplified representation of FIG. 1, the computer system 100 includes a computer 105, one or more input devices 101, and one or more output devices 103. Common examples of input devices 101 include a keyboard, a mouse, or a voice recognition system to support voice commands. Common examples of output devices 103 include monitors, speakers, or printers.Computer 105 includes a memory 107 and a microprocessor 120, whereas in this simplified representation, memory 107 is represented as a single block. The memory 107 can include ROM memory, RAM, and / or non-volatile memory’, and, depending on the embodiment, can include separate memory for data and instructions.

[0209] FIG. 2 illustrates one embodiment for the microprocessor 120 of FIG. 1, and includes the memory 107. In the representation of FIG. 2, the microprocessor 120 includes control logic 125, a processing block 140, an input interface 121. and an output interface 123. The dotted lines represent control signals exchanged between the control logic 125 and the other elements of the microprocessor 120 and the memory 107. The solid lines in FIG. 2 represent the flow of data and instructions within the microprocessor 120 and between the microprocessor 120 and the memory 107.

[0210] The processing block 140 includes combinatorial logic 143 that is configured to execute instructions and registers 141 in which the combinatorial logic stores instructions and data while executing these instructions. In the simplified representation of FIG. 2, certain elements or units, such as a vector unit (VU) 146, an arithmetic logic unit (ALU) 147, and a floating-point unit (FPU) 149, are shown, while other elements are not explicitly shown in the combinatorial logic 143. The combinatorial logic 143 is connected to memory 107 to receive and execute instructions and supply the results. The combinatorial logic 143 is also connected to the input interface 121 to receive input from input device(s) 101 and / or other sources. The combinatorial logic 143 is also connected to the output interface 123 to provide output to the output device(s) 103 and / or other destinations.

[0211] A microprocessor, such as the microprocessor 120. may perform a range of different functions, including arithmetic operations. For example, a microprocessor may perform addition, subtraction, multiplication, multiply-accumulate, and / or division. Aspects of the present disclosure may enable efficient multiplication operations to be performed by a microprocessor (e.g., microprocessor 120 or another disclosed processor). More generally, aspects of the present disclosure can be applied to embodiments for one or more central processing units (CPUs), graphic processing units (GPUs), artificial intelligence (Al) accelerators, Tensor Processing Units (TPUs), and / or any other digital logic that performs multiplication or multiplication as part of a multiply-accumulate operation.

[0212] Multiplication operations may be performed by one or more multiplication circuits in the microprocessor 120. For example, one or more of the VU 146, the ALU 147, and the FPU 149 may include one or more multiplication circuits configured based on the disclosed techniques. Other elements of combinatorial logic 143 may alternatively or additionally include one or more multiplication circuits. The disclosed techniques and configurations are not limited to multiplication circuits or multiply-accumulate units in any location (in a microprocessor or elsewhere) or used for any particular purpose.They can be applied wherever multiplication or multiply-accumulate operations are desired.

[0213] Several different approaches may be used to perform multiplication. The disclosed techniques are based on the use of the RNS, which is briefly explained below.

[0214] The RNS is based on the use of modular arithmetic and a property known as the Chinese Remainder Theorem. If mi,..., mk are integers greater than 1 (often called moduli or divisors), then the Chinese Remainder Theorem asserts that if the mi are pairwise coprime, and if ai,..., ak are integers such that 0 < ai < mi for every i, then there is one and only one integer x, such that 0 < x < N and the remainder of the Euclidean division of x by mi is ai for every i. The consequence is that, if M denotes the product of k pairwise relatively prime moduli, M = mk-i x • • • x mi x mo, then M is the number of different representable values in the RNS and is known as its dynamic range. This allows any number within this dynamic range to be expressed as a vector of its values for each of the moduli.

[0215] Take the example of moduli 8, 7, 5, and 3. The dynamic range in this example is M = 8 x 7 x 5 x 3 = 840, which is the total number of distinct values that are representable in this example 4-modulus RNS. A number in this format is made up of four components, one for each modulus, and referred to as an RNS(8| 7| 5|3) number. The following are some example numbers in RNS(8|7|5|3) format:

[0216] (0|0|0|0)RNS Represents 0 or 840 or • • •

[0217] (1|1|1|1)RNS Represents 1 or 841 or * « «

[0218] (2|2|2|2)RNS Represents 2 or 842 or • • •

[0219] (0|1|3|2)RNS Represents 8 or 848 or • • •

[0220] (5|0|1|0)RNS Represents 21 or 861 or • • •

[0221] (0|1|4|1)RNS Represents 64 or 904 or • • •

[0222] (2|0|0|2)RNS Represents -70 or 770 or • • •

[0223] (7|6|4|2)RNS Represents -1 or 839 or • • •

[0224] Other numbers, modulo 840, can be expressed in the RNS(8| 7| 5|3) format. When performing arithmetic for integers in the RNS format, the operations can be on a component-by-component basis, using the corresponding modulus. Performing arithmetic for integers in this way can be advantageous in improving computational efficiency.

[0225] Continuing with the example of the moduli 8, 7, 5, and 3, an integer (within the corresponding dynamic range) in a binary-coded number format for RNS(8|7|5|3) is illustrated in FIG. 3.

[0226] FIG. 3 illustrates an RNS(8|7|5|3) number 300 represented in a binary-coded number format. Referring to FIG.3, the RNS(8|7|5|3) number 300 can be represented by a 3 -bit mod 8 slot 302, a 3-bit mod 7 slot 304, a 3-bit mod 5 slot 306, and a 2-bit mod 3 slot 308.

[0227] When performing an arithmetic operation between two numbers in this format, operations can individually be performed pairwise on each component. This allows arithmetic operations for numbers in such an RNS format to be separated into independent RNS channels, as illustrated in FIG. 4.

[0228] FIG. 4 is a block diagram of a circuit 400 that can be configured as an adder, a subtractor, or a multiplier for numbers in the RNS format using the RNS(8|7|5|3) representation, according to example embodiments. At the top of FIG. 4 are shown two operands, Operand 1 and Operand 2, in the RNS(8|7|5|3) format that can be stored in corresponding operand registers 411-1 and 411-2. where these operands will be converted to the RNS format (e.g.. during an operation that typically takes a few steps that can be hidden behind other operations). The modulus 8, 7, 5, and 3 components of each operand go to the corresponding mod-8 unit 401, mod-7 unit 403, mod-5 unit 405, and mod-3 unit 407 to undergo pair- wise operations in each RNS channel using the corresponding modular arithmetic. The components of the results can be stored in the result register 421, which can be used in subsequent RNS computations or converted out of the RNS format when needed.

[0229] The RNS approach, illustrated with respect to FIG. 4, has several advantages used by the disclosed techniques. It solves the carry-propagationproblem, as carry-propagation is limited to a few bits. It is faster, as 4x4 multipliers are generally simpler than a 16x16 multiplier. It is also associated with a smaller footprint, as a 4x4 multiplier is -1 / 16 the size of a 16x16 multiplier (power and area scaled quadratically). Additionally, small residue arithmetic operations can be implemented with direct table lookup. This approach does require conversion between the RNS format and binary, and some arithmetic operations (e.g., division, sign detection, and overflow detection) are more difficult, but the disclosed techniques are primarily concerned with multiplication, where it can have a number of advantages over existing multiplication circuit techniques.

[0230] Considering the details of implementing efficient RNS multiplication, one detail is the selection of the RNS moduli, where two of the considerations are channel width and the number of channels. Suppose the objective is to reduce the addition / multiplication execution time. In that case, a large number of small moduli is desirable, as the execution time is determined by the largest modulus and the power / area of multipliers proportional to n2.

[0231] One approach to selecting moduli is to use moduli of the form 2k, 2k-l, or 2k+l for ease of implementation. In this approach, the total number of bits can be minimized by using an efficient binary representation, i.e.. maximizing the dynamic range by selecting a modulus, mi, that equals 2kor is one larger or smaller than it, (2k-l ), for example. A single mi of the form 2kmay be used because the moduli must be relatively prime. Moduli mi of the form (2k-I) perform well, since end-around-carry adders may be used for this form.However, not all terms of the form (2k- 1 ) may be selected, since, for example, 2k-l = (2k / 2- 1 )(2k / 2+l) for even values of k.

[0232] Considering the case of representing a 32-bit integer in the RNS system, this has a range = 232= 4,294,967,296, and using moduli of the form 2kor 2k-l for ease of implementation. One set of possible moduli is then mi = 31, 63, 127. 255, 256. The dynamic range M is adequate as M / 232= 3.7799, and this set of moduli is relatively prime. These five moduli are of 5, 6, 7, 8, and 8 bits, respectively, for a total of 34 bits. For moduli of the form 2k, an ordinary binaryadder can be used, with the residue read directly from the least significant bits (LSBs). For moduli of the form 2k-l, an “end-around carry"’ adder can be used.

[0233] Another approach is to use the smallest prime moduli for which a symmetric complete residue system exists. One example of a 32-bit integer is the nine moduli mi = 3, 5, 7, 11, 13, 19, 23, 29, 37. The dynamic range M is adequate as M / 232= 1.6393, and this set of 9 moduli is of 2, 3, 3, 4, 4, 5, 5, 5, and 6 bits respectively, for a total of 37 bits. Although this has more moduli (and a higher total number of bits), its largest moduli are significantly smaller. This has the advantage of smaller moduli being faster, and that area / power is reduced as this is proportional to log2(mi)2. However, implementing multiplication for moduli not of the form 2kor 2k-l has some complications, as illustrated with respect to FIG.5.

[0234] FIG. 5 illustrates components 500 for implementing modular multiplication for moduli not of the form 2k-1, 2k, or 2k+1. according to example embodiments. Multiplier circuit 501 receives two n-bit operands A and B, and multiplies these to generate the 2n-bit result of AB. To turn this into the n-bit mod-m product of these numbers, |AB|m, the product AB needs to undergo modular reduction in the modular reduction circuit 503. However, implementing modular reduction requires division, which is a time-consuming multistep operation that slows down the process.

[0235] To avoid this drawback, the disclosed techniques (e.g., as described in connection with FIG. 14A - FIG. 26) use different techniques for multiplying moduli not of the form 2k-1, 2k, or 2k+1. More specifically, the disclosed techniques presented below involve the use of the primitive roots of a number in modular arithmetic. Given gx(mod p), where p is a prime number, the question is whether there is a value of g that ensures a unique output from 1 to p-1, for every value of x from 0 to p-1. If so, this generator (g) is known as a primitive root under modulo p, namely, Y = gx(mod p). Table 600 of FIG.6 illustrates an example.

[0236] FIG. 6 illustrates a table 600 with multiplication group representations using the primitive roots of a prime number p=11. Referring to FIG. 6, in the top row, the index (i.e., power of the primitive root) runs from 0-9. with the second row showing the root g to the power of the index, mod 11, notated as | |n. As shown in the left-most column of table 600, the primitive roots of 11 are g = 2, 6, 7, or 8. Considering an example using the root of g=7, circled in the oval and computing the product of |5|n * 110|n = 50 = |6|n, 5 corresponds to |g2|n and 10 corresponds to |g5| 11. Adding the indices (exponents) to look up the product from the product index, 2+5=7, and looking up |g7|ii =6, which is the correct result. This can similarly be performed using any group formed by a primitive root g of p, and not limited to a primitive root of 2.

[0237] FIG. 7 is a block diagram of an index-calculus multiplier circuit 700 configured to perform modular arithmetic operations using lookup tables (LUTs) 702, 704, and 708, and a modulo 10 adder 706, according to certain embodiments. Referring to FIG. 7, index-calculus multiplier circuit 700 leverages the principles of index-calculus multiplication, as described in connection with FIG. 6, to compute modular products by adding indices and performing reverse lookups.

[0238] In some aspects, a first LUT 702 maps a source operand 710 to the corresponding index k and magnitude magk under modulus p = 11.Additionally, a second LUT 704 maps the source operand 712 to the corresponding index k and magnitude magk under the same modulo. A modulo 10 adder 706 is configured to perform modular addition on the indices retrieved from the first and second LUTs. Moreover, a third LUT 708 maps the sum of indices (sumk) computed by the modulo 10 adder 706 to the corresponding magnitude magk under modulo p = 11. The circuit further includes the source operands 710 and 712 as input values to be multiplied, and a product output 714 representing the final modular product.

[0239] Accordingly, the operation of the multiplier circuit 700 can be described as follows. Initially, the first LUT 702 receives the first source operand 710 (e.g., 5)(iij) and maps the operand to the corresponding index k = 2 and magnitude magk = 5 under modulus p = 11. Similarly, the second LUT 704 receives the second source operand 712 (e.g., (10 (nj) and maps the operand to the respective index k = 5 and magnitude magk = 10.

[0240] Subsequently, the indices k = 2 and k = 5 obtained from the LUTs 702 and 704 are provided as inputs to the modulo 10 adder 706. The adder 706 performs modular addition on these indices, such that:sumk = (2 + 5) mod 10 = 7.

[0241] Thereafter, the sumk = 7 is utilized to address the third LUT 708. In some embodiments, the third LUT 708 performs a reverse lookup and maps sumk = 7 to the corresponding magnitude magk = 6 under modulus p = 11.

[0242] At the point of execution, the resulting modular product (6 (n) is output as the product output 714, which represents the multiplication of the source operands <5)(n) and (10)(n) under modulo p = 11.

[0243] In summary, the index-calculus multiplier circuit 700 illustrates a technique for performing modular multiplication through the addition of indices and reverse lookup mechanisms.

[0244] FIG. 8 is a table 800 with magnitude and submodular indices, which can be used by an unsigned submodular RNS multiplier circuit. Referring to FIG. 8. table 800 is organized into rows and columns, with each row corresponding to a specific attribute of the RNS and each column representing an indexed entry. In some aspects, table 800 can be used during the operation of an unsigned submodular RNS multiplier circuit, such as the multiplier circuit 900 illustrated in FIG. 9.

[0245] In some aspects, table 800 can be configured based on generator g=2, p=29, and two (or more) co-prime submoduli adders mO and ml. where mO x ml = (p-1).

[0246] Over time, the first row of table 800 is configured to correspond to the index k, which ranges from 0 to 27. Accordingly, the index k serves as an identifier for each entry and is utilized to address the lookup operations performed during modular arithmetic computations. As a result, index k can be used to map magnitudes and submodular indices to their respective positions within the table.

[0247] In certain aspects, the second row of table 800 represents the magnitudes magk. which are derived from the modular arithmetic properties ofthe RNS system. For instance, these magnitudes correspond to the non-negative values of the group elements generated by the primitive root g under the modulus p. As a result, the magnitude values include entries such as 1, 2, 4, 8, 16, and so forth, reflecting the modular reduction of powers of g, and these entries can be used for determining the unsigned representation of numbers in the RNS system.

[0248] Furthermore, the third and fourth rows contain the submodular indices (k)mo and (k)mi, respectively. In some embodiments, these indices are calculated by reducing the index k modulo the submoduli mo and mi, which are pairwise coprime integers. More specifically, the submodular indices (k)mo and ((k)miexhibit periodicity based on the values of mO and ml. Accordingly, these indices are used to address the forward LUTs 902 and 904 and the reverse LUT 910 in the unsigned submodular RNS multiplier circuit 900.

[0249] Additionally, table 800 is designed to facilitate modular multiplication by providing precomputed values that can be accessed during arithmetic operations. As a result, the magnitudes magk and the submodular indices (k)mo and (k)miare used in conjunction with lookup tables to perform modular addition and multiplication without carry propagation.

[0250] FIG. 9 is a block diagram of an unsigned submodular RNS multiplier circuit 900 configured based on the table of FIG.8. More specifically, multiplier circuit 900 is configured to perform modular multiplication using forward LUTs 902 and 904, reverse LUT 910, a modulo 4 adder 906, and a modulo 7 adder 908. Referring to FIG. 9, the multiplier circuit 900 operates based on submodular decomposition and modular arithmetic, where precomputed values stored in the LUTs are leveraged to compute modular products without necessitating carry propagation.

[0251] In some aspects, source 912 represents the first operand, <5>(29), in the modular arithmetic operation, while source 914 represents the second operand, <10>(29). Forward LUT 902 is operable to map the first operand to its corresponding submodular indices and magnitude under modulus 29, and forward LUT 904 performs a similar mapping for the second operand. The first operand, <5>(29), is supplied to forward LUT 902, which maps <5>(29) tosubmodular indices (2)<4) and O7), and assigns a magnitude value of 5.Similarly, the second operand, 0°)(2S>), is provided to forward LUT 904. resulting in a mapping to submodular indices (3)(4) and (2)<?) with a magnitude value of 10. The modulo 4 adder 906 carries out modular addition on the submodular indices derived from the first and second operands under modulus 4, and the modulo 7 adder 908 performs the analogous addition under modulus 7. The combined submodular indices ⟨1⟩₍₄₎ and ⟨3⟩₍₇₎ are used to address reverse LUT 910. As a result, reverse LUT 910 maps the combined submodular indices from the modular adders back to the corresponding magnitude under modulus 29, with product 916 representing the final modular product, ⟨21⟩₍₂₉₎, which results from the multiplication operation.

[0252] In some embodiments, the unsigned submodular RNS multiplier circuit 900 offers several technical advantages. For example, reduced adder widths are achieved by decomposing the modulus into smaller, pairwise coprime submoduli (e.g., p=29, submoduli mO, ml={4,7}, so that (4 x 7 = 29-1)), resulting in the utilization of smaller, faster modular adders that require less hardware area. Additionally, efficient lookup table usage is achieved through the application of forward and reverse lookup tables, thereby eliminating the need for complex modular reduction operations and enabling rapid computation of modular products. Moreover, the scalability of the design is enhanced as the modular approach permits handling of larger dynamic ranges by selecting the appropriate submoduli, making the circuit well-suited for high-performance applications such as neural network accelerators and digital signal processors.

[0253] Even though the unsigned submodular RNS multiplier circuit 900 increases speed by reducing carry-propagate adder widths, the circuit still uses full-sized lookup tables, with a size of p-1. Additionally, the submoduli used by multiplier circuit 900 are co-prime. with the (mo * mi) product being equal to (p-1). This submoduli configuration can result in some sub-moduli being large and unbalanced (e.g., RNS 47 = 2 x 23, RNS 53 = 2 x 29, RNS 83 = 2 x 41, RNS 97 = 3 x 32, and RNS 107 = 2 x 53). Unbalanced submoduli can lead to one RNS channel having a much larger delay than the others. These drawbacks of the unsigned submodular RNS multiplier circuit 900 are addressed by multiplicationcircuits configured based on the disclosed techniques (e.g., as discussed in connection with FIGS. 14A-29).

[0254] FIG. 10 is a diagrammatic representation of a table 1002 that provides index, magnitude, sign, and sign magnitude data, according to example embodiments. Referring to FIG. 10, the table 1002 is structured to represent the modular arithmetic properties of an RNS under a specific modulus, thereby facilitating modular multiplication operations within the sign-magnitude RNS multiplier circuit 1200 illustrated in FIG. 12.

[0255] In some embodiments, the first row of the table corresponds to the index k. which ranges from 0 to 27, serving as an identifier for each entry and being used to address lookup operations during modular arithmetic computations. Accordingly, index k can be used to map magnitudes and signmagnitude values to their respective positions within the table.

[0256] In some aspects, the second row represents the unsigned magnitudes (magk), which are derived from the modular arithmetic characteristics embedded within the RNS system. For example, the unsigned magnitudes include values such as 1, 2, 4, 8, 16, and so forth, thereby reflecting the modular reduction of powers of the primitive root g under the modulus p. These values can be used in determining the unsigned representation of numbers in the RNS system.

[0257] Furthermore, the third row contains the sign bits (sk) that indicate whether a corresponding signed magnitude is positive or negative. More specifically, the sign bit is determined based on whether the unsigned magnitude (magk) exceeds half the modulus ((p - 1 ) / 2). Thus, if magk is greater than or equal to (p–1) / 2, the sign bit Sk is set to 1, indicating a negative value; otherwise, Sk is set to 0, indicating a positive value.

[0258] Additionally, the fourth row represents the signed magnitudes (msk). which combine the magnitude and sign information. In some aspects, the signed magnitude msk is calculated as follows: if magk is greater than or equal to (p–1) / 2, then msk is computed as p minus magk, resulting in a negative value; otherwise, msk equals magk, thereby resulting in a positive value. Accordingly,this encoding reduces the range of values to ±1 through ±(p-l) / 2, which simplifies the modular arithmetic operations.

[0259] Moreover, table 1002 is divided into two halves: the first half (indices 0 to 13) and the second half (indices 14 to 27). In some embodiments, the first half (which is also represented as table 1102 in FIG. 11) contains the unsigned magnitudes along with their corresponding sign and signed magnitude values. In contrast, the second half is a mirror image of the first half, with the signed magnitudes inverted to represent the additive inverse. This symmetry can be used in sign-magnitude encoding, facilitating efficient lookup table usage and minimizing the size of the lookup tables by half.

[0260] FIG. 11 illustrates a table 1102 that provides indexed data for magnitude, sign, and sign magnitude, in accordance with example embodiments, which may be utilized by the sign-magnitude RNS multiplier circuit 1200 described in FIG. 12. Referring to FIG. 11, table 1102 represents the first half of table 1002 from FIG. 10, with a focus on the modular arithmetic properties of an RNS under a specific modulus.

[0261] As an example, in table 1102, the signed magnitude for magk = 16 is computed as msk = 13, while the signed magnitude for magk = 1 is msk = 1.

[0262] In some embodiments, table 1102 is structured to facilitate modular multiplication operations within the sign-magnitude RNS multiplier circuit 1200. By leveraging the symmetry characteristic of modular groups, the sign-magnitude encoding minimizes the size of lookup tables and enables computation of modular products.

[0263] FIG. 12 is a block diagram illustrating a sign-magnitude RNS multiplier circuit 1200 configured based on the LUTs of FIG. 10 and FIG. 11, according to example embodiments. Referring to FIG. 12, the multiplier circuit 1200 comprises two forward LUTs 1202 and 1204, a modulo 14 adder 1206, a reverse LUT 1208, an exclusive-OR (XOR) circuit 1210, two sources 1212 and 1214, and output comprising a product sign 1216 and a product magnitude 1218.

[0264] In some embodiments, the operation of the multiplier circuit 1200 is demonstrated by the example multiplication of a positive operand, specifically+5 modulo 29, and a negative operand, specifically -10 modulo 29, with the resulting product being +8 modulo 29. Initially, the first source operand, +5 modulo 29, is provided to the forward LUT 1202 as source 1212, which maps the operand to the corresponding signed magnitude of +5, a sign bit of 1, and an index value of 8. Similarly, the second source operand, -10 modulo 29, is supplied to the forward LUT 1204 as source 1214, which maps the operand to the corresponding signed magnitude of +10, a sign bit of 1, and an index value of 9.

[0265] Accordingly, the indices 8 and 9 retrieved from the forward LUTs 1202 and 1204 are then provided as inputs to the modulo 14 adder 1206. The modulo 14 adder 1206 performs modular addition on these indices such that the sum index is determined by the operation: sumk = (8 + 9) mod 14 = 3. The resulting sum index 3 is subsequently used to address the reverse LUT 1208.

[0266] Furthermore, the reverse LUT 1208 maps the sum index 3 to the corresponding signed magnitude of +8 and a sign bit of 0 (indicating a positive value) under modulo 29. In alignment with this mapping, the signed magnitude +8 is output as the product magnitude 1218. In some embodiments, to determine the product sign 1216, the XOR circuit 1210 combines the sign bits of the two source operands (0 and 1), the sign bits from the forward LUTs (1 and 1). the sign bit retrieved from the reverse LUT 1208 (0), and the carry-out bit from the modulo 14 adder 1206 (1). By performing the XOR operation, the product sign is obtained as follows: product sign = 0 © 1 ® 1 ® 1 © 1 © 0 = 0, indicating a positive product.

[0267] Thus, as described, the multiplier circuit 1200 outputs the product sign (+) and the product magnitude (+8) modulo 29. thereby completing the modular multiplication operation in accordance with the disclosed embodiments. The primary advantage of the multiplier circuit 1200 is that it reduces the lookup table sizes by 50% in comparison to the multiplier circuit 900 of FIG.9.However, the adder in multiplier circuit 1200 is not as small as each of the adders used by multiplier circuit 900.

[0268] FIG. 13 illustrates a modulo 106 adder 1300, according to certain embodiments. Referring to FIG. 13, the modulo 106 adder 1300 comprisesmultiple interconnected components, including a carry-save adder 1302, two carry-propagate adders 1304 and 1306. amultiplexer circuit 1308. inputs 1310, and an output 1312.

[0269] In some aspects, the inputs 1310, labeled as |X|(ioe) and | Y|(ios), represent the operands to be added modulo 106. Accordingly, these inputs are processed through the carry -save adder 1302, which computes intermediate sum and carry outputs. The carry-save adder 1302 is configured to handle 7-bit values, thereby reflecting the bit- width required for the modulo 106 operation.

[0270] Furthermore, the intermediate outputs from the carry -save adder 1302 are subsequently fed into two carry-propagate adders 1304 and 1306. Specifically, the first carry-propagate adder 1304 computes the sum (X + Y), whereas the second carry-propagate adder 1306 computes the sum (X + Y + 22). The constant value 22 is derived from the difference between the modulus 106 and the next higher power of two, namely 128. This adjustment facilitates proper modular reduction when the computed sum exceeds the modulus.

[0271] Additionally, the multiplexer circuit 1308 is responsible for selecting the appropriate output based on the carry-out signal C(out) generated by the second carry-propagate adder 1306. When the sum (X + Y + 22) exceeds 127. the carry-out signal is set, and accordingly, the multiplexer circuit 1308 selects the output of the second carry-propagate adder 1306. Otherwise, the multiplexer circuit 1308 selects the output of the first carry-propagate adder 1304, thereby ensuring that the final result adheres to the modulo 106 constraint.

[0272] Moreover, the output 1312, labeled as |X + Y|(ioe), represents the final modular sum, which is generated by the multiplexer circuit 1308 and reflects the outcome of the modulo 106 addition operation.

[0273] In some embodiments, the design of the modulo 106 adder 1300 highlights the shortcomings of conventional multipliers; specifically, the need for additional hardware components, such as multiple carry-propagate adders 1304 and 1306 and a multiplexer circuit 1308, to handle arbitrary modulo n addition. More specifically, the modulo 106 adder 1300 represents the complexities of adder circuits when the submoduli used by a multiplier circuitare not represented in the form 2n-l, 2n, or 2n+l. These complexities result in increased hardware area, power consumption, and computational latency.However, the disclosed techniques mitigate these challenges by utilizing submodular decomposition (e.g., to ensure submoduli used by a multiplier circuit are represented in the form 2n-l, 2n, or 2n+l) and sign-magnitude encoding to streamline adder architectures and minimize hardware requirements.

[0274] FIG. 14A is a block diagram of a multiplier circuit 1400, according to example embodiments. Multiplier circuit 1400 integrates functionalities of both the unsigned submodular RNS multiplier circuit 900 and the sign-magnitude RNS multiplier circuit 1200. Example embodiments of multiplier circuit 1400 are represented as multiplier circuit 1600 (of FIG. 16) and multiplier circuit 2000 (of FIG. 20). In this regard, multiplier circuit 1400 is configured as a submodular signed RNS index-calculus multiplier circuit (also referred to as a submodular sign-magnitude RNS index-calculus multiplier circuit).

[0275] Multiplier circuit 1400 comprises operand registers for source 0 and source 1, each providing a sign (e.g., corresponding source signs 1422 and 1426) and magnitude (e.g., corresponding magnitudes 1424 and 1428). The circuit includes two forward conversion ROMs 1402 and 1404, which map the input operands to their corresponding submodular indices and sign-magnitude encodings. The outputs from the forward conversion ROMs are provided to a pair of sub-modulo adders 1408 and 1410, which perform modular addition on the submodular indices. The results from the sub-modulo adders are then used to address a reverse conversion ROM 1412, which maps the combined submodular indices back to the corresponding product magnitude and sign. The multiplier circuit 1400 further includes XOR circuits 1406, 1414, and 1420 for computing expected parity, detecting parity mismatches, and determining the final product sign, as well as multiplexer circuits 1416 and 1418 for selecting between corrected and uncorrected values based on parity mismatch. The final product sign 1430 and product magnitude 1432 are stored in the result registers 1429.

[0276] The source sign 1422 and the source magnitude 1424 represent the sign and magnitude of the first operand. The source sign 1426 and the source magnitude 1428 represent the sign and magnitude of the second operand. The forward conversion ROM 1402 and forward conversion ROM 1404 can store forward LUTs (e.g., forward LUTs 1602 and 1604 of FIG. 16). These LUTs map the source operands to their corresponding submodular indices and magnitudes.

[0277] The XOR circuit 1406 computes the expected parity based on the input operands. The sub-modulo adder 1408 and sub-modulo adder 1410 are configured to perform modular addition on the submodular indices derived from the operands. In some aspects, each of the sub-modulo adders 1408 and 1410 can be configured as a 2n-l modular adder or a 2n+l modular adder.

[0278] The reverse conversion ROM 1412 stores a reverse LUT (e.g., reverse LUT 1612 of FIG. 16). and maps the combined submodular indices back to the corresponding magnitude and sign using the reverse LUT.

[0279] The XOR circuit 1414 detects parity mismatches between the expected and actual parity values.

[0280] The multiplexer circuit 1416 and the multiplexer circuit 1418 select between corrected and uncorrected values based on the parity mismatch.

[0281] The XOR circuit 1420 computes the final product sign by combining the source signs, the table product sign, and the parity mismatch. In this regard, the XOR circuit 1420 is also referred to as a sign computation logic.

[0282] The product sign 1430 and product magnitude 1432 represent the final modular product's sign and magnitude, which can be stored in the result registers 1429.

[0283] In operation, the multiplier circuit 1400 receives two RNS operands (e.g., source 0 and source 1), each represented by a sign and magnitude. The forward conversion ROMs 1402 and 1404 translate these operands into submodular indices and sign-magnitude form. More specifically, the forw ard conversion ROMs 1402 and 1404 map the source operands to theircorresponding submodular indices and magnitudes based on precomputed values stored in the forward LUTs.

[0284] The XOR circuit 1406 computes the expected parity based on the input operands. This parity is utilized to detect wrap-around conditions during modular arithmetic operations.

[0285] The sub-modulo adders 1408 and 1410 perform modular addition on the submodular indices derived from the forward conversion ROMs, producing a set of combined indices. Each adder operates independently on the respective submodulus, ensuring efficient computation without carry' propagation.

[0286] The combined submodular indices from the sub-modulo adders are provided to the reverse conversion ROM 1412. This ROM maps the indices back to the corresponding magnitude and sign, representing the intermediate product. These combined submodular indices are used to address the reverse conversion ROM, which outputs the corresponding product magnitude and sign.

[0287] The XOR circuit 1414 compares the expected parity (computed by the XOR circuit 1406) with the actual parity derived from the reverse conversion ROM 1412. A detected mismatch indicates a wrap-around condition. More specifically, if a mismatch is detected, the correction logic (e.g., multiplexer circuits 1416 and 1418) selects the corrected product values. For example, the multiplexer circuits 1416 and 1418 select between corrected and uncorrected values based on the parity mismatch detected by the XOR circuit 1414. Corrected values account for invalid rows or wrap-around conditions in the lookup tables.

[0288] The XOR circuit 1420 computes the final product sign by combining the source operand signs, the forward LUTs’ sign bits, and the table product sign from the reverse conversion ROM 1412. The final product sign 1430 and product magnitude 1432 are output from the circuit and stored in the result registers 1429. These values represent the modular product of the input operands in the submodular signed RNS index-calculus format.

[0289] In some aspects, multiplier circuit 1400 is configured as a submodular signed RNS index-calculus multiplier circuit based on a signmagnitude index-calculus multiplier with a periodicity of (p–1) / 2 and a submodular index-calculus multiplier with a periodicity of mo x mi x... x n-i. To combine both designs, the multiplier circuit 1400 is configured based on p = 2(mo x mi x... x mn-i) + 1, which ensures that the reverse LUT works without any modification. However, this configuration can limit the choices of p, given mo and mi.

[0290] In some aspects, to widen the choice of p, given mo and mi, the multiplier circuit 1400 can be configured based on loosening the restriction to p <= 2(mo x mi x... x mn-i) + 1.

[0291] If p < 2(mo x mi x... x mn-i) + 1, then there will be a mismatch in the periodicities of (p- 1) / 2 and mo x mi x... x mn-i. This configuration can lead to invalid rows in the reverse LUT. If the sum of the submodular indices addressing the reverse LUT points to an invalid row, then a correction needs to be added to the index to get the periodicities to match up again. The mismatch condition can be detected by expected versus actual parity' in the reverse LUT. When a parity mismatch occurs, then the sign and parity from the corrected columns can be used instead of the sign and magnitude from the uncorrected columns (which correction can be performed via the multiplexer circuits 1416 and 1418).

[0292] The architecture of the multiplication circuit 1400 enables efficient modular multiplication with reduced lookup table size, smaller and balanced adders, and correction for rap-around and invalid table entries.Multiplication circuit 1400 (or any other multiplication circuit configured based on the disclosed techniques) is associated with the following advantages over existing multiplication circuits:

[0293] (a) Multiplication circuit 1400 is configured to emulate traditional datatypes with the smallest possible submoduli, which minimizes submoduli adder width, as well as equalizes the submoduli adder width for balanced delays.

[0294] (b) Multiplication circuit 1400 is configured to process integer and floating-point mantissa datatypes (e.g.. up to 64x64 integers). Such datatypes use odd prime moduli from 3 to 107. However, the multiplication circuit 1400 (configured based on the disclosed techniques) can process such dataty pes with only the following sets of small submoduli: 3 x 5, 3 x 7, 5 x 7, 5 x 9, or 7 x 9.

[0295] (c) The above-listed submoduli used by the disclosed techniques represent adders of the form 2n-l, 2n, or 2n+l, which avoids complication in the adder design (e.g., as in the modulo 106 adder 1300 of FIG. 13). Adders of the form 2n-l can be built with End- Around-C arty (EAC) adders, and adders of the form 2n+l can be built with End-Around Borrow (or “Diminished- 1”) adders. Adders of the form 2nare conventional binary adders. Both of these adders add negligible area and delay over conventional binary adders (as opposed to RNS adders composed of a carry-save adder (CSA), two carry-propagate adders (CPA’s), and a multiplexer, as the modulo 106 adder 1300 is configured).

[0296] FIG. 14B is a flowchart of a method 1450 for configuring forw ard LUTs used by the multiplier embodiments associated with FIG. 14A and FIG. 15 - FIG. 20. according to example embodiments. The functionalities of method 1450, as well as any of the methods discussed in connection with FIG. 14B - FIG. 14F can be performed by a multiplier circuit or a processor (e.g., a processor associated with or implementing the multiplier circuit).

[0297] At operation 1452, any odd prime modulus, p, is selected.

[0298] At operation 1454, any primitive root, g, of the odd prime p is selected as the generator.

[0299] At operation 1456, a modulo p group of (p-1 ) / 2 integers is generated. A modulus index k can be configured. For example, modulus index k is configured based on k = 0 to (p-l) / 2 - 1. Magnitudes magk are calculated as magk = |gk|p. These magnitudes are calculated as unsigned magnitudes. Sign and sign-magnitude encodings are calculated from the unsigned magnitudes as follows:

[0300] (a) if magk > (p-1 ) / 2, then msk = (p - magk), else msk = magk; and

[0301] (b) if magk ≥ (p-1) / 2, then sk = 1, else sk = 0.

[0302] At operation 1458, submoduli are determined as follows:

[0303] (a) Choose n submoduli mo, mi,..., mn-i, where:

[0304] (a.1) n > 2 and all submoduli are odd primes (each pairwise coprime).

[0305] (a.2) m0 x m1 x mn-1 ≥ (p-1) / 2. This condition is equivalent to p <2(m0 x m1 x mn-1) + 1. In some aspects, this condition is met for the disclosed techniques.

[0306] (a.3) Configure the dynamic range M as M = mox mi x... mn-i.

[0307] At operation 1460, the forward LUTs are generated as follows:

[0308] (a) Let i = 1 to (p-l) / 2.

[0309] (b) Each table row is addressed by the signed magnitudes msk.

[0310] (c) Let k = indexfmsk],

[0311] (d) LUT column 1 is the sign bit, Sk.

[0312] (e) LUT columns 2 to n-1 are the submodular indices (k)mo, (k)mi,..., (k)mn-l.

[0313] (f) LUT column n is the parity bit p, where p = 1 if k is odd, else p = 0.

[0314] After the forward LUTs are generated, method 1450 proceeds to generating the reverse LUT, e.g., using one of methods 1462 (as described in FIG. 14C), 1464 (as described in FIG. 14D), 1466 (as described in FIG. 14E), or 1468 (as described in FIG. 14F). Generation of the reverse LUT can be based on the values of the prime modulus p and the submoduli mo, mi,..., mn-i.

[0315] FIG. 14C is a flowchart of a method 1462 for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 15 - FIG.16, according to example embodiments. In some aspects, method 1462 is performed when p > (mo x mi x... x mn-i) + 2.

[0316] At operation 1470, the modulus index is initialized as k = 0 to M-1.

[0317] At operation 1472, each table row is addressed by the tuples «k)m0, <k)mi,..., (k)mn-i)M, from (0, 0,..., 0)M to (mo-1, mi-1..... mn-i-l)M.

[0318] At operation 1474, for p > (mo x mi x... x mn-i) + 2, the number of valid rows is configured as rv= (p-1 ) / 2, and the number of invalid rows is configured as n = M - (p-l) / 2.

[0319] At operation 1476, for the valid rows from (0, 0,..., 0}M to ((rv-l)mo, ( rv-l)mi,..., ((rv-l)mn-i )M, the following reverse LUT configurations are performed:

[0320] (a) LUT column 1 is set as the uncorrected sign, suk.

[0321] (b) LUT column 2 is set as the corrected sign, sck, equal to the logical NOT of the corrected sign, suk, rotated down by n positions.

[0322] (c) LUT column 3 is set as the uncorrected magnitude muk.

[0323] (d) LUT column 4 is set as the corrected magnitude, msk, equal to muk rotated down by n positions.

[0324] (e) LUT column 5 is set as the parity bit p, where p = 1 if k is odd, else p = 0.

[0325] At operation 1478, for the invalid rows from «rv)mo, ((rv)mi,..., ( rv)mn-i )M to (mo-1, mi-1,..., mn-i-ltyi, the following reverse LUT configurations are performed:

[0326] (a) LUT column 1 is set as the uncorrected sign, suk, which is invalid, and can be set to zero.

[0327] (b) LUT column 2 is set as the corrected sign, sck, equal to the logical NOT of the corrected sign, suk, rotated down by n positions.

[0328] (c) LUT column 3 is set as the uncorrected magnitude muk, which is invalid and can be set to zero.

[0329] (d) LUT column 4 is set as the corrected magnitude, msk, equal to muk rotated down by ri positions.

[0330] (e) LUT column 5 is set as the parity bit p, set to invalid parity, where p = 0 if k is odd, else p = 1.

[0331] FIG. 14D is a flowchart of a method 1464 for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 17A -FIG. 17C, according to example embodiments. In some aspects, method 1462 is performed when p = 2(mo x mi x... x mn-i) + 1, which is also referred to as a perfect wrap-around case. During a perfect wrap-around case, no invalid rows appear in the LUTs (e.g., p = 31, mO.ml = {3,5}).

[0332] Some examples of special moduli (p) / submoduli (mo, mi) pair values (not a complete list) for the perfect wrap-around case are as follows: 31 {3,5}, 43 {3,7}, 71 {5,7}, and 127 {7,9}. For this case, the sign and magnitude are correct.

[0333] At operation 1480, the modulus index is initialized as k = 0 to M-1.

[0334] At operation 1482, each table row is addressed by the tuples «k)mo, (k)mi,..., (k)mn-i M, from (0, 0,..., 0 M to (mo-l, mi-l,..., mn-i-l)M.

[0335] At operation 1484, the following reverse LUT configurations are performed:

[0336] (a) LUT column 1 is set as Sk.

[0337] (b) LUT column 2 is set as smi.

[0338] (c) LUT column n is set as the parity bit p, where p = 1 if k is odd. else p = 0.

[0339] FIG. 14E is a flowchart of a method 1466 for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 18A -FIG. 18C, according to example embodiments. In some aspects, method 1466 is performed when p = (mo x mi x... x nh-i) + 2, which is also referred to as a no wrap-around and complete fill case. During a no wrap-around and complete fill case, all products are in the table without a wrap-around (e.g., when p=17, mo, mi = {3,5}).

[0340] Some examples of special moduli (p) / submoduli (mo, mi) pair values (not a complete list) for the no wrap-around, complete fill case are as follows: 17 {3,5}, 23 {3,7}, 37 {5,7}, and 47 {5,9}. For this case, the sign and magnitude are correct.

[0341] At operation 1486, the modulus index is initialized as k = 0 to M-1.

[0342] At operation 1488, each table row is addressed by the tuples «k)mo, (k)mi,..., (k)mn-i)M, from (0, 0,..., 0 M to (mo-l, mi-l,..., mn-i-l)M.

[0343] At operation 1490, the following reverse LUT configurations are performed:

[0344] (a) For all valid rows from (0, 0,..., 0 M to ((rv-l)mo, ((rv-l)mi,..., (rv-l) mn- i M:

[0345] (a.1) LUT column 1 is set as Sk.

[0346] (a.2) LUT column 2 is set as is smk.

[0347] (a.3) LUT column n is set as the parity bit p, where p = 1 if k is odd, else p = 0.

[0348] (b) For all invalid rows from <(rv)mo, «rv)mi,..., ((rv)mn-i M to(mo-1, mi-1,..., mn-i-l)M:

[0349] (b.l) LUT column 1 is set as Sk.

[0350] (b.2) LUT column 2 is set as smk.

[0351] (b.3) LUT column 3 is set as the parity bit p, set to invalid parity, where p = 0 if k is odd, else p = 1.

[0352] FIG. 14F is a flowchart of a method 1468 for configuring a reverse LUT used by the multiplier embodiment associated with FIG. 19A -FIG. 20, according to example embodiments. In some aspects, method 1468 is performed when p < (mo x mi x... x rm-i) + 2, which is also referred to as a no wrap-around and partial fill case. During a no wrap-around and partial fill case, all products are in the table without wrap-around, and the unused rows are deleted (e.g., when p=11. mo.mi = {3,5}).

[0353] Some examples of special moduli (p) / submoduli (mo, mi) pair values (not a complete list) for the no wrap-around and partial fill case are as follows: 7, 11, 13 {3,5}, 17, 19 {3,7}, 23, 29, 31 {5,7}, 37, 41, 43 {5,9}, 47, 53, 59, and 61 {7,9}. For this case, the sign and magnitude are correct.

[0354] At operation 1492, the modulus index is initialized as k = 0 to M-1.

[0355] At operation 1494, each table row is addressed by the tuples «k)mo, (k)mi,..., (k)mn-i)M, from (0, 0,..., 0 M to (mo-l, mi-l,..., mn-i-l)M.

[0356] At operation 1496, the following reverse LUT configurations are performed:

[0357] (a) For all valid rows from (0, 0,..., 0)M to ((rv-l)mo, ((rv-l)mi,..., (rv-l) mn- i )M:

[0358] (a.1) LUT column 1 is set as Sk.

[0359] (a.2) LUT column 2 is set as smk.

[0360] (a.3) LUT column n is set as the parity bit p, where p = 1 if k is odd, else p = 0.

[0361] (b) For all invalid rows from <(rv)mo, «rv)mi,..., ((rv)mn-i )M to((2*rv-l)m0, ((2*rv-l)ml,..., ((2*rv-l)mn-l )M:

[0362] (b.l) LUT column 1 is set as Sk.

[0363] (b.2) LUT column 2 is set as smk.

[0364] (b.3) LUT column 3 is set as the parity bit p, set to invalid parity, where p = 0 if k is odd, else p = 1.

[0365] FIG. 15 is a diagram of a lookup table 1500 providing precomputed values for magnitude, sign, sign magnitude, submodular indices, and parity, which are utilized by the multiplier circuit 1600 of FIG. 16 or the multiplier circuit 1400 of FIG. 14A, according to example embodiments.Referring to FIG. 15, table 1500 is organized into rows and columns corresponding to specific attributes of an RNS, thereby facilitating modular arithmetic operations within the multiplier circuit 1600.

[0366] In some aspects, the first row of table 1500 corresponds to an index k. which ranges from 0 to 13. The index k serves as an identifier for each entry in table 1500, and is used to address lookup operations during modular arithmetic computations. Accordingly, this index maps magnitudes, submodular indices, and parity values to their respective positions within the table.

[0367] In some embodiments, the second row represents unsigned magnitudes magk, which are derived from modular arithmetic properties of the RNS system. For example, magnitudes include non-negative values generated by successive powers of a primitive root g under a modulus p (e.g., values such as 1, 2, 4, 8, 16, and so forth), reflecting modular reduction of gAk. These magnitudes are accessed during lookup operations to determine the unsigned representation of RNS elements.

[0368] The third row contains sign bits Sk, which indicate whether a corresponding signed magnitude is positive or negative. In particular, if magk is greater than or equal to (p- 1) / 2, then sk is set to 1 (indicating a negative value); otherwise, sk is set to 0 (indicating a positive value). As a result, the sign bits enable sign determination without requiring additional arithmetic.

[0369] The fourth row represents signed magnitudes msk, which combine magnitude and sign information. Specifically, if magk > (p 1 ) / 2, then msk = p magk (resulting in a negative value); otherwise, msk = magk (resulting in a positive value). This encoding achieves a reduction in the value range to ±1 through ±((p-l) / 2), facilitating modular arithmetic operations.

[0370] The fifth and sixth rows contain submodular indices (k)mo and (k)mi, respectively, which are calculated by reducing index k modulo submoduli mo and mi (pairwise co-prime integers). In some embodiments, these indices exhibit periodicity based on the values of mo and mi and are used to address forward LUTs 1602 and 1604 and reverse LUT 1612 in the multiplier circuit 1600.

[0371] The seventh row represents parity bits pk, which indicate whether index k is even or odd. In particular, pk is set to 1 when k is odd and 0 when k iseven. As a result, parity bits detect wrap-around conditions during modular arithmetic operations and select between corrected and uncorrected table entries.

[0372] In some aspects, table 1500 is used to facilitate modular multiplication by providing precomputed values that can be accessed during arithmetic operations. Accordingly, magnitudes magk, sign bits Sk, signed magnitudes msk, submodular indices (k)mo and k)mi, and parity bits pk are employed in conjunction with LUTs 1602, 1604. and 1612 to perform modular addition and multiplication without carry propagation.

[0373] FIG. 16 is a diagram of a submodular signed RNS index-calculus multiplier circuit 1600, according to example embodiments. Referring to FIG.16, multiplier circuit 1600 includes a forward LUT 1602, a forward LUT 1604, a modulo 3 adder 1606, a modulo 5 adder 1608, an XOR circuit 1610, a reverse LUT 1612, an XOR circuit 1618, a multiplexer circuit 1614, a multiplexer circuit 1616, an XOR circuit 1620, a source 1622. a source 1624, a product sign 1626, and a product magnitude 1628.

[0374] Multiplier circuit 1600 can be configured based on two (or more) co-prime submoduli adders: mO x mlForward LUT number of entries can be set as — 2, and the reverse LUT number of entries can be set as mo x mi.

[0375] In some aspects, forward LUT 1602 and forward LUT 1604 store precomputed sign bits, submodular indices, and parity bits for operands received from source 1622 and source 1624. Accordingly, each forward LUT entry exploits sign-magnitude encoding to reduce the number of entries by approximately one half relative to a full LUT, the reduced entry count being equal towhere p is the prime modulus.

[0376] The modulo 3 adder 1606 and the modulo 5 adder 1608 perform modular addition on the submodular indices generated by the forward LUTs 1602 and 1604. More specifically, each adder independently reduces an index k modulo the respective submodulus mo or mi, thereby avoiding carry propagation and enabling streamlined parallel computation.

[0377] Reverse LUT 1612 receives the combined indices from modulo adders 1606 and 1608, and maps those indices back to a corresponding magnitude and sign. The reverse LUT 1612 is organized as a table of entries indexed by the tuple (k)mo, (k)mi, and includes both corrected (e.g., sck and mck) and uncorrected columns (e.g., suk and muk). The corrected-versus-uncorrected entry offset equals the number of unused rows, namely m0·m1 − (p-1) / 2, to accommodate wrap-around conditions and invalid index combinations. The corrected-versus-uncorrected sign and magnitude reverse LUT outputs: wraparound triggers use of corrected sign, magnitude instead of uncorrected. The corrected-versus-uncorrected entry offset is equal to the number of unused rows (number of unused rows = mO x ml — ^-)-

[0378] In some embodiments, XOR circuit 1610 computes an expected parity bit from the input operands, and XOR circuit 1618 detects a wrap-around by comparing the expected parity to the actual parity obtained from reverse LUT 1612. When a parity mismatch is detected, multiplexer circuits 1614 and 1616 select the corrected sign and magnitude values; otherwise, the uncorrected values are used. Parity bits on forward and reverse lookup tables can be configured as follows: expected versus actual parity indicates a wrap-around (e.g.. using a corrected sign and magnitude instead of uncorrected).

[0379] In some aspects. XOR circuit 1620 determines the final product sign by XORing the source operand signs, the sign bits from forward LUTs 1602 and 1604, the table-derived product sign from reverse LUT 1612, and the parity mismatch indicator from XOR circuit 1618. Product magnitude 1628 is output by multiplexer circuit 1616 after selecting the appropriate magnitude value.

[0380] The operation of multiplier circuit 1600 begins when source 1622 and source 1624 supply input operands, for example, +5)29 and (-10)29. These operands are first mapped by forward LUTs 1602 and 1604 into sign bits, submodular indices, and parity bits. Next, the modulo 3 adder 1606 and the modulo 5 adder 1608 independently add the submodular indices. Thereafter, the combined indices address the reverse LUT 1612, which provides candidate magnitude and sign values in corrected or uncorrected form. Wrap-around conditions are detected by XOR circuits 1610 and 1618, and corrected values areselected by multiplexer circuits 1614 and 1616 when necessary. At the conclusion of the process, XOR circuit 1620 computes the product sign 1626. and multiplexer circuit 1616 outputs the resulting product magnitude 1628, yielding the modular product (+8)29. The product sign 1626 can be computed as the XOR of source signs, source LUT signs, and the table product sign (as illustrated in FIG. 16).

[0381] FIG. 17A is table 1700 of precomputed group values for a submodular signed RNS index-calculus multiplier circuit 1400 configured for a perfect wrap-around case, according to example embodiments. Referring to FIG. 17A, table 1700 represents the multiplicative group of prime modulus p = 31 generated by primitive root g = 3. Table 1700 provides entries for index k, unsigned magnitude magk, sign bit Sk, signed magnitude msk, submodular indices (k)mo and (k)mi. and parity bit pk. These attributes are leveraged by the multiplier circuit 1400 to perform modular multiplication without carry propagation.

[0382] In some aspects, the first row corresponds to index k, which ranges from 0 to 14. Specifically, k serves as an identifier for each table entry and is used to address lookup operations during modular arithmetic computations. Accordingly, the range of k is determined by the periodicity of the sign-magnitude encoding, namely (p— 1 ) / 2 = 15.

[0383] The second row of table 1700 represents the unsigned magnitudes magk, derived from successive powers of g under modulus p. For example, mago = 1, magi = 3, mag2 = 9, and so forth. These precomputed magnitudes define the non-negative values used in the RNS system.

[0384] The third row of table 1700 contains sign bits Sk, which indicate whether the corresponding signed magnitude is positive or negative. In some embodiments, Sk is set to 1 when magk > (p— 1 ) / 2, and set to 0 when magk < (p-l) / 2. For instance, so = 0, S4 = 1, and sio = 0.

[0385] The fourth row of table 1700 represents signed magnitudes msk, which combine magnitude and sign information. When magk > (p— 1) / 2, msk = p - magk; otherwise, msk = magk. As a result, the signed magnitude range is constrained to ±1 through ±15. For example, mso = 1, ms4 = 12. and msio = 13.

[0386] The fifth and sixth rows of table 1700 contain submodular indices (k)mo and (k)mi, respectively, where mo = 3 and mi = 5 are pairwise co-prime submoduli. Accordingly, each k value is reduced modulo mo and mi. For example, (0)mo = 0, (l)m0= 1, (2)mo = 2; and (0)mi= 0, (l)mi= 1, (2)mi= 2.

[0387] The seventh row of table 1700 represents parity bits pk, which indicate whether k is even (pk = 0) or odd (pk = 1). The parity information is utilized to detect wrap-around conditions and determine whether to select corrected or uncorrected table entries. For instance, po = 0, pi = 1. and p? = 0.

[0388] The table of FIG. 17A can be used by a multiplier circuit to provide a forward lookup of precomputed values. These values are used in conjunction with the forward LUT 1702 of FIG. 17B and the reverse LUT 1704 of FIG. 17C to perform addition and multiplication without carry propagation. The wrap-around scenario ensures that reverse table entries remain valid, thereby simplifying the correction logic.

[0389] FIG. 17B is a diagram of a forward LUT 1702 utilized in a multiplier circuit configured according to the disclosed techniques, particularly in connection with a perfect wrap-around case that achieves complete alignment. Referring to FIG. 17B, the forward LUT 1702 provides precomputed values that enable modular arithmetic operations — including addition and multiplication — without carry propagation. Accordingly, the forward LUT 1702 can be used during the operation of submodular signed RNS index-calculus multipliers, as the forward LUT 1702 maps signed magnitudes to their corresponding submodular indices and parity bits.

[0390] The forw ard LUT 1702 is organized into rows and columns, with each row corresponding to a specific signed magnitude mskand each column representing an attribute of the modular arithmetic system. More specifically, forward LUT 1702 is structured as summarized below.

[0391] The first column of forward LUT 1702, labeled “Address msk.” represents the signed magnitude values mskthat serve as the address for each row in the forward LUT 1702. These values range from 1 to 15, corresponding to theperiodicity of the sign-magnitude encoding, which is (p— 1) / 2, where p is the prime modulus. For example, when ir = 1, the address entry is 1.

[0392] The second column of forward LUT 1702, labeled “Sign Sk,’" indicates the sign bit associated with each signed magnitude m* The sign bit Sk is set to 0 for positive values and 1 for negative values. For instance, when DU = 1, Sk = 0, whereas when msk = 2, Sk = 1.

[0393] The third and fourth columns of forward LUT 1702, labeled “Submodular Indices (k)mo” and “(k)mi,” represent the submodular indices derived by reducing the index k modulo the submoduli mo and mi, respectively. These submodular indices exhibit periodicity based on the values of mo and mi. which are pairwise coprime. For example, for rr k = 1, the submodular indices are (k)mo = 0 and ((k)mi= 0.

[0394] The fifth column of forward LUT 1702, labeled “Parity pty’ indicates whether the index k is even or odd. The parity bit pk is set to 0 for even indices and 1 for odd indices. For example, when mSk = 1. pk = 0, and when mSk = 2. pk= 1.

[0395] In some aspects, the forward LUT 1702 is used to map signed magnitudes mSkto their corresponding submodular indices (k)mo and (k)mi, as well as their parity bits pk. These precomputed values are leveraged during modular arithmetic operations to address the reverse lookup table and retrieve the final product magnitude and sign. The forward LUT 1702 facilitates computation by removing the need for carry propagation and supporting streamlined parallel processing.

[0396] In the ideal wrap-around scenario, the periodicity of the group aligns with the size of the submodular table (e.g., forw ard LUT 1702), resulting in no invalid rows. This adjustment simplifies the correction logic, as all entries in the forward LUT 1702 are valid and directly correspond to meaningful group elements. In this regard, the forward LUT 1702 can be used during the operation of submodular signed RNS index-calculus multipliers by providing precomputed mappings for signed magnitudes, submodular indices, and parity bits.

[0397] FIG. 17C is a diagram of a reverse LUT 1704 configured for use in a submodular signed RNS index-calculus multiplier circuit, particularly in connection with a perfect wrap-around case, according to example embodiments. Referring to FIG. 17C, reverse LUT 1704 facilitates modular arithmetic operations — including addition and multiplication — without carry' propagation.

[0398] In some aspects, reverse LUT 1704 is organized into a matrix of rows and columns, with each row representing a distinct table entry indexed by the tuple (summo, summi). The first two columns, labeled (summo) and (summi), represent submodular indices derived by reducing the sum of input operand indices modulo the respective submoduli mo and mi, which are pairwise coprime. For example, the table address (0, 0) corresponds to the first row, whereas (2, 4) corresponds to the last row. The remaining columns correspond to specific attributes of the modular arithmetic system, including sign (suk), magnitude (muk), and parity (pk).

[0399] The third column of reverse LUT 1704, labeled “Sign suk,” indicates the sign bit associated with each table entry'. In some embodiments, a sign bit of 0 represents a positive value, while a sign bit of 1 represents a negative value. This column is used during reverse lookup operations to determine the sign of the modular product.

[0400] The fourth column, labeled “Magnitude m.” represents the unsigned magnitude associated with each entry, derived from RNS modular arithmetic properties and corresponding to the values of group elements generated by a primitive root under modulus p. For example, the magnitude muk for address (0, 0) is 1, whereas for (2, 4) the magnitude is 10.

[0401] The fifth column, labeled “Parity pk / ?indicates whether an entry corresponds to an even or odd index — 0 for even, 1 for odd — and is used to detect wrap-around conditions and to select between corrected and uncorrected entries when necessary.

[0402] In the perfect wrap-around scenario, the periodicity of the group aligns with the size of the submodular table, ensuring that all rows in reverse LUT 1704 are valid. As a result, there is no need for correction logic, becauseno invalid rows exist. As such, reverse LUT 1704 provides direct mappings for all valid submodular indices, streamlining the lookup process and enhancing computational efficiency.

[0403] Technical advantages of reverse LUT 1704 include the elimination of cany’ propagation and complex modular reduction operations by leveraging precomputed sign, magnitude, and parity values. Furthermore, the wrap-around configuration ensures the validity of all table entries, thereby reducing hardware complexity and computational latency.

[0404] FIG. 18A is a diagram of a precomputed lookup table 1800 representing the multiplicative group of the prime p = 17 generated by the primitive root g = 3, according to example embodiments. Referring to FIG. 18A, table 1800 provides precomputed values for modular arithmetic operations — namely, magnitude, sign, signed magnitude, submodular indices, and parity — which collectively support the operation of a multiplier circuit 1400 configured for a no wrap-around and complete fill case.

[0405] The first row of table 1800 corresponds to the index k, which ranges from 0 to 7. The index k serves as an identifier for each entry in the table and is used to address lookup operations during modular arithmetic computations. The range of k is determined by the periodicity of the signmagnitude encoding, which is (p - l) / 2 for p = 17.

[0406] The second row of table 1800 represents the unsigned magnitudes magk. derived from successive powers of the primitive root g = 3 under modulus p = 17. For example, mago = 1, magi = 3, and mag2 = 9. These precomputed magnitudes define the non-negative values utilized in the RNS, thereby facilitating parallel arithmetic operations.

[0407] The third row of table 1800 contains the sign bits Sk, which indicate whether the corresponding signed magnitude is positive or negative. In one embodiment. Sk is set to 1 when magk > (p - 1 ) / 2 and set to 0 when magk < (p - 1 ) / 2. For instance, so = 0, S3 = 1, and S5 = 0. As a result, the sign information can be used to detect wrap-around conditions during modular multiplication.

[0408] The fourth row of table 1800 represents the signed magnitudes msk. which combine magnitude and sign information. When magk > (p - l) / 2, msk = p - magk; otherwise, msk = magk. Accordingly, the signed magnitude range is constrained to ±1 through ±(p-l) / 2. For example, mso = 1, mss = 7, and ms6 = 2, thereby bounding the values for efficient hardware implementation.

[0409] The fifth and sixth rows of table 1800 contain the submodular indices (kjm» and (kjmi, respectively, where mo = 3 and mi = 5 are pairwise coprime submoduli. Accordingly, each k value is reduced modulo mo and mi for distributed residue computation. For example, (0)m» = 0, (l)m»=k (2)m» = 2; and (0)m, = 0, <l>mi= 1, <2>mi= 2.

[0410] The seventh row of table 1800 represents the parity bits pk, which indicate whether k is even (pk = 0) or odd (pk = 1 ). The parity' information is utilized to detect wrap-around conditions and determine whether to select corrected or uncorrected table entries. For instance, po = 0, pi = 1, and p2 = 0.

[0411] The no wrap-around and complete fill case ensures that all entries in the table are valid, thereby simplifying the correction logic and enhancing computational efficiency.

[0412] FIG. 18B is a forward LUT 1802 utilized in modular arithmetic operations as part of a multiplier circuit configured for a no wrap-around and complete fill case. In some embodiments, the forward LUT 1802 is designed to map signed magnitudes msk to their corresponding attributes, including sign bits Sk, submodular indices (k)m« and (k)m,, and parity’ bits pk. Additionally, this table is used in conjunction with the precomputed table 1800 of FIG. 18A and the reverse lookup table 1804 of FIG. 18C to perform modular arithmetic operations without carry propagation.

[0413] The first column of the forward LUT 1802, labeled “Address (msk) / ’ represents the signed magnitude values msk that serve as the address for each row in the table. For example, these values range from 1 to 8, corresponding to the periodicity of the sign-magnitude encoding, namely (p-1 ) / 2, where p is the prime modulus. When msk = 1, for instance, the address entry is 1.

[0414] Furthermore, the second column of the forward LUT 1802, labeled “Sign (sk),” indicates the sign bit associated with each signed magnitude msk. The sign bit Sk is set to 0 for positive values and to 1 for negative values. More specifically, when msk = 1, Sk = 0, whereas when msk = 2, Sk = 1.

[0415] In addition, the third and fourth columns of the forward LUT 1802, labeled “Submodular Indicesand “Submodular Indicesrespectively, represent the submodular indices derived by reducing the index k modulo the submoduli mo and mi. These submodular indices exhibit periodicity based on the pairwise co-prime integers mo and mi. For example, for msk = 1, the submodular indices are (k)m» = 0 and (kfy, = 0.

[0416] The fifth column of the forward LUT 1802, labeled “Parity (pk),” indicates whether the index k is even or odd. The parity bit pk is set to 0 for even indices and to 1 for odd indices. For instance, when msk = 1, pk = 0, and when msk = 3, pk = 1.

[0417] Accordingly, the forward LUT 1802 facilitates modular arithmetic operations by providing precomputed mappings for signed magnitudes, submodular indices, and parity bits. These mappings are utilized during modular addition and multiplication to address the reverse lookup table 1804 and retrieve the final product magnitude and sign. The no wrap-around and complete fill case ensures that all entries in the table are valid, thereby simplify ing the correction logic.

[0418] FIG. 18C is a reverse LUT 1804 utilized in modular arithmetic operations as part of a multiplier circuit configured for a no wrap-around and complete-fill case, according to example embodiments. In some aspects, the reverse LUT 1804 is designed to map combined submodular indices back to their corresponding attributes — namely, sign, magnitude, and parity — thereby enabling modular multiplication without carry propagation.

[0419] Referring to FIG. 18C, the reverse LUT 1804 is organized into rows and columns, with each row representing a distinct table entry indexed by the tuple (sunimo, summi). The first two columns, labeled (surnmo) and (surnmi), represent submodular indices derived by reducing the sum of input operandindices modulo the respective submoduli mo and mi, which are pairwise coprime. For example, the table address (0, 0) corresponds to the first row, whereas <2, 4) corresponds to the last row. These indices serve as the address for each entry in the table and are used to retrieve the corresponding modular arithmetic attributes.

[0420] The third column of the reverse LUT 1804, labeled “Sign suk,’’ indicates the sign bit associated with each table entry. A sign bit of 0 represents a positive value, while a sign bit of 1 represents a negative value. This column is utilized during reverse lookup operations to identify the sign of the modular product.

[0421] The fourth column of the reverse LUT 1804, labeled “Magnitude muk,” represents the unsigned magnitude associated with each entry7. These magnitudes are derived from RNS modular arithmetic properties and correspond to the values of group elements generated by a primitive root under modulus p. For example, the magnitude muk for address (1, 2) is 6, which is the product magnitude associated with the highest table index in the reverse LUT 1804.

[0422] The fifth column of the reverse LUT 1804, labeled “Parity pk,” indicates whether an entry7corresponds to an even or odd index, 0 for even, 1 for odd. Parity bits are used to detect wrap-around conditions and to select between corrected and uncorrected entries when necessary. For example, the parity bit pk for address (1, 2) is 1, indicating an odd index.

[0423] The reverse LUT 1804 is structured to facilitate modular multiplication by leveraging precomputed values for sign, magnitude, and parity. In some embodiments, the table is divided into two halves: the first half contains the original entries, while the second half is a copy of the first half with inverted parity. Accordingly, this symmetry' ensures efficient handling of modular arithmetic operations and simplifies the correction logic. In the no wrap-around and complete-fill case, all entries in the reverse LUT 1804 are valid, eliminating the need for correction logic. This configuration ensures that the periodicity7of the group aligns with the size of the submodular table, thereby enhancing computational efficiency. For example, the product table magnitude with themaximum reverse LUT index is computed as |2|i? = |6| n * |6| 17, demonstrating the table’s ability to handle modular multiplication without carry’ propagation.

[0424] The reverse LUT 1804 operates in collaboration with the precomputed table 1800 of FIG. 18A and the forward LUT 1802 of FIG. 18B to perform modular arithmetic operations.

[0425] FIG. 19A is table 1900 illustrating the multiplicative group of the prime modulus p = 11 generated by the primitive root g = 2, which can be used by a multiplier circuit (e.g., multiplier circuit 2000) configured based on disclosed techniques and in connection with a no wrap-around and partial fill case. Referring to FIG. 19A. table 1900 provides precomputed values for modular arithmetic operations — namely magnitude, sign, signed magnitude, submodular indices, and parity — which are utilized by the multiplier circuit 2000 of FIG. 20 in connection with a no wrap-around and partial fill case.

[0426] The first row of table 1900 corresponds to the index k, which ranges from 0 to 4. The index k serves as an identifier for each entry in the table and is used to address lookup operations during modular arithmetic computations. Accordingly, the range of k is determined by the periodicity of the sign-magnitude encoding, which is (p— 1) / 2 for p = 11.

[0427] The second row of table 1900 represents the unsigned magnitudes magk, derived from successive powers of the primitive root g = 2 under modulus p = 11. For example, mago = 1, magi = 2, mag2 = 4, mag3 = 8, and magi = 5. These precomputed magnitudes define the non-negative values utilized in the RNS, thereby facilitating parallel arithmetic operations.

[0428] The third row of table 1900 contains the sign bits Sk, which indicate whether the corresponding signed magnitude is positive or negative. Specifically, Sk is set to 1 when magk > (p— 1 ) / 2 and set to 0 when magk < (p-1 ) / 2. For instance, so = 0, S3 = 1, and si = 0. As a result, the sign information can be used to detect wrap-around conditions during modular multiplication.

[0429] The fourth row of table 1900 represents the signed magnitudes msk, which combine magnitude and sign information. When magk > (p— 1 ) / 2, msk = p - magk; otherwise, msk = magk. As a result, the signed magnitude rangeis constrained to ±1 through ±(p-l) / 2. For example, mso = 1, ms3 = 3, and ms4 = 5, thereby bounding the values for efficient hardware implementation.

[0430] The fifth and sixth rows of table 1900 contain the submodular indices (k)mo and (k)mi. respectively, where mo = 3 and mi = 5 are pairwise coprime submoduli. Accordingly, each k value is reduced modulo mO and ml for distributed residue computation. For example, O)mo = 0, l)mo = 1, 2)mo = 2; and (0 mi=0, l)mi=1, (2}mi=2.

[0431] The seventh row of table 1900 represents the parity bits pk, which indicate whether k is even (pk = 0) or odd (pk= 1). In one embodiment, the parity information is utilized to detect wrap-around conditions and determine whether to select corrected or uncorrected table entries. For instance, po = 0, pki = 1, and Pk2 = 0.

[0432] Table 1900 is configured to facilitate modular multiplication by providing precomputed values that can be accessed during arithmetic operations. These values are used in conjunction with the forward LUT 1902 of FIG. 19B and the reverse LUT 1904 of FIG. 19C in the multiplier circuit 2000 to perform modular addition and multiplication without carry propagation.

[0433] FIG. 19B is a diagram of a forward LUT 1902 utilized together with table 1900 and reverse LUT 1904 by multiplier circuit 2000 configured based on disclosed techniques and in connection with a no wrap-around and partial fill case, according to example embodiments. Referring to FIG. 19B, forward LUT 1902 is configured for ano wrap-around and partial fill case as described in the disclosed techniques. In this configuration, forward LUT 1902 facilitates modular arithmetic operations by mapping signed magnitudes mSk to their corresponding attributes, including sign bits Sk, submodular indices (k)mo and (k)mi, and parity bits pk. For instance, when mSk equals a particular value, forward LUT 1902 returns the precomputed sign, submodular indices, and parity for use in subsequent processing by multiplier circuit 2000.

[0434] In some embodiments, the structure and components of forward LUT 1902 are organized into rows and columns, with each row corresponding toa specific signed magnitude mskand each column representing an attribute of the modular arithmetic system.

[0435] The first column of the forward LUT 1902 includes address rrisk, which represents the signed magnitude values mSk and serves as the row addresses in the forward LUT 1902. These values range from 1 to 5, reflecting the periodicity of the sign-magnitude encoding ((p–1) / 2, where p is the prime modulus). For example, when mSk = 1, the address entry is “1.”

[0436] The second column of the forward LUT 1902 includes sign Sk. This column indicates the sign bit associated with each signed magnitude mSk. set to 0 for positive values and 1 for negative values. For instance, when mSk = 3. Sk = 1 denotes a negative value.

[0437] The third and fourth columns of the forward LUT 1902 include submodular indices (k)mo and (k)mi. These columns list the indices obtained by reducing k modulo the submoduli mo and mi, respectively, where mo and mi are pairwise coprime integers. For example, for mSk = 4, (kmo = 2 and ((k)mi= 2.

[0438] The fifth column of the forw ard LUT 1902 includes parity pk. This column indicates whether index k is even or odd. The parity bit pk is set to 0 for even indices and 1 for odd indices. For example, when mSk = 2, pk = 1 indicates an odd index.

[0439] Forward LUT 1902 can be used in modular arithmetic operations by providing precomputed mappings for signed magnitudes, submodular indices, and parity bits. More specifically, these mappings are utilized during modular addition and multiplication to address reverse LUT 1904 and retrieve the final product magnitude and sign. For example, the sign bit Sk enables efficient sign determination without additional arithmetic operations. Additionally, the submodular indices (k)mo and ((k)mifacilitate distributed residue computation across pairwise co-prime submoduli, ensuring streamlined parallel processing. Furthermore, the parity bit pk supports detection of wrap-around conditions, thereby determining whether to select corrected or uncorrected table entries during modular arithmetic operations.

[0440] In some aspects, the technical advantages of using the forw ard LUT 1902 include simplification of modular arithmetic by leveraging precomputed values, which eliminates carry propagation and supports parallel computation. In the no wrap-around and partial fill case, all entries in forward LUT 1902 are valid, reducing hardware complexity and computational latency.

[0441] FIG. 19C is a diagram of reverse LUT 1904 utilized in modular arithmetic operations as part of multiplier circuit 2000 configured for a no wraparound and partial-fill case, according to example embodiments. Referring to FIG. 19C, the reverse LUT 1904 is designed to map combined submodular indices back to their corresponding attributes — namely, sign, magnitude, and parity' — thereby enabling modular multiplication without carry propagation.

[0442] The reverse LUT 1904 is organized into rows and columns, with each row representing a distinct table entry indexed by the tuple (sum,ro. summi). The first two columns, labeled (summo) and (summty. represent submodular indices derived by reducing the sum of input operand indices modulo the respective submoduli mo and mi, which are pairwise co-prime. For example, the table address (0, 0) corresponds to the first row. whereas (2, 3} corresponds to the last row of the table. These indices serve as the address for each entry in the table and are used to retrieve the corresponding modular arithmetic attributes.

[0443] The third column of the reverse LUT 1904. labeled “Sign suk,” indicates the sign bit associated with each table entry. A sign bit of 0 represents a positive value, while a sign bit of 1 represents a negative value. Accordingly, this column is utilized during reverse lookup operations to identity' the sign of the modular product.

[0444] The fourth column of the reverse LUT 1904, labeled “Magnitude muk,” represents the unsigned magnitude associated with each entry. These magnitudes are derived from RNS modular arithmetic properties and correspond to the values of group elements generated by a primitive root under modulus p. For example, the magnitude muk for address (1, 4) is 5, which is the product magnitude associated with the highest table index in the reverse LUT 1904.

[0445] The fifth column of the reverse LUT 1904, labeled “Parity pk,” indicates whether an entry corresponds to an even or odd index (0 for even, 1 for odd). Parity bits are used to detect wrap-around conditions and to select between corrected and uncorrected entries when necessary. For example, the parity bit pk for address (1, 1) is 1, indicating an odd index. As a result, the reverse LUT 1904 is structured to facilitate modular multiplication by leveraging precomputed values for sign, magnitude, and parity.

[0446] In some aspects, reverse LUT 1904 is divided into two halves: the first half contains the original entries, while the second half is a copy of the first half with inverted parity. This symmetry ensures efficient handling of modular arithmetic operations and simplifies the correction logic. For example, the product table entry with the maximum reverse LUT index is computed as |3|11= |5|11× |5|11, demonstrating the table's ability to handle modular multiplication without carry propagation.

[0447] In the no wrap-around and partial-fill case, all products are in the table without wrap-around, and unused rows are deleted. This configuration allows the periodicity of the group to align with the size of the submodular table, which improves computational efficiency. The reverse LUT 1904 works in conjunction with the precomputed table 1900 of FIG. 19A and the forward LUT 1902 of FIG. 19B in the multiplier circuit 2000 to execute modular arithmetic operations.

[0448] FIG. 20 is a block diagram of a multiplier circuit 2000 configured based on the tables of FIG. 19A, FIG. 19B, and FIG. 19C, according to example embodiments. Referring to FIG. 20, multiplier circuit 2000 comprises forward LUT 2002. forward LUT 2004, modulo 3 adder 2006. modulo 5 adder 2008, XOR circuit 2010, reverse LUT 2012, XOR circuit 2014, XOR circuit 2016, source 2018, source 2020, product sign 2022, and product magnitude 2024.

[0449] In some aspects, forward LUT 2002 and forward LUT 2004 are configured to map the input operands from source 2018 and source 2020, respectively, to their corresponding submodular indices, sign bits, and parity bits. For example, each forward LUT 2002 entry is precomputed based on thetables of FIG. 19A and FIG. 19B, leveraging sign-magnitude encoding to reduce the number of entries by approximately half relative to a full LUT.Accordingly, the forward LUT 2002 processes the first operand, while forward LUT 2004 processes the second operand.

[0450] The modulo 3 adder 2006 and the modulo 5 adder 2008 perform modular addition on the submodular indices derived from the forward LUTs. Specifically, the modulo 3 adder 2006 operates on the submodular indices corresponding to modulus 3, while the modulo 5 adder 2008 operates on the submodular indices corresponding to modulus 5. In some aspects, the adders are configured to independently compute the modular sums without carry propagation.

[0451] The reverse LUT 2012 maps the combined submodular indices from the modulo adders back to their corresponding magnitude and sign. In particular, the reverse LUT 2012 is organized as a table indexed by the tuple (summ0, summ1), where summ0and summ1are the modular sums computed by the modulo 3 adder 2006 and the modulo 5 adder 2008, respectively. The reverse LUT 2012 includes columns for uncorrected sign (suk), uncorrected magnitude (muk), and parity (pk).

[0452] In some aspects, the XOR circuit 2010 computes the expected parity based on the input operands. The expected parity is compared to the actual parity derived from the reverse LUT 2012 by the XOR circuit 2014, which detects parity mismatches indicating wrap-around conditions. When a mismatch is detected, the correction logic selects the corrected sign and magnitude values from the reverse LUT 2012. Subsequently, XOR circuit 2016 computes the final product sign 2022 by combining the source operand signs, the sign bits from the forward LUTs 2002 and 2004, the table-derived product sign from the reverse LUT 2012, and the parity mismatch indicator from XOR circuit 2014. The final product magnitude 2024 is output after selecting the appropriate magnitude value based on the correction logic.

[0453] In operation, multiplier circuit 2000 receives two RNS operands from source 2018 and source 2020, each represented by a sign and magnitude. The forward LUTs map these operands into submodular indices, sign bits, andparity bits. Thereafter, the modulo 3 adder 2006 and the modulo 5 adder 2008 independently add the submodular indices. The combined indices address reverse LUT 2012, which provides candidate magnitude and sign values in uncorrected form. Wrap-around conditions are detected by XOR circuits 2010 and 2014, and corrected values are selected when necessary. Subsequently, the XOR circuit 2016 computes the product sign 2022, and the product magnitude 2024 is output, completing the modular multiplication operation.

[0454] In some aspects, the disclosed techniques can be used to configure a multiplier circuit (e.g., multiplier circuit 2300) with reduced complexity (e.g., without the use of parity bits), as discussed below, in connection with FIGS.21-24.

[0455] FIG. 21 is a table 2100 with magnitude, sign, sign magnitude, and submodular indices, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a no parity case associated with FIG. 21 - FIG. 24, according to example embodiments. FIG. 21 introduces a foundational data structure for implementing modular multiplication in an RNS system, particularly in cases where parity bits are not required for correction logic. Table 2100 includes the following data: index k, unsigned magnitude (magk), sign bit (Sk). signed magnitude (msk). and a plurality of submodular indices (such as (k)mo and (k)mi).

[0456] The index k serves as the primary identifier for each entry in the table. It is used to address and organize the table rows, and it typically ranges from 0 up to (p— 1) / 2, where p is the prime modulus of the RNS system. The index k is fundamental for mapping each group element to its corresponding attributes in the table.

[0457] The unsigned magnitude (magk) represents the absolute value of the group element associated with index k. It is derived from the modular exponentiation of a primitive root under the modulus p. The unsigned magnitude is used to determine the value of the RNS element before considering its sign.

[0458] The sign bit (Sk) indicates whether the corresponding signed magnitude is positive or negative. The sign bit is determined by comparing the unsigned magnitude to half the modulus. If the unsigned magnitude is greater than or equal to (p— 1) / 2, the sign bit is set to 1 (negative); otherwise, it is set to 0 (positive).

[0459] The signed magnitude (msk) combines the unsigned magnitude and the sign bit to represent the group element in sign-magnitude form. If the sign bit is 1, the signed magnitude is calculated as p minus the unsigned magnitude, resulting in a negative value. If the sign bit is 0, the signed magnitude is equal to the unsigned magnitude.

[0460] The submodular indices (such as (k)mo and (k)mi) are calculated by reducing the index k modulo each of a set of pairwise co-prime submoduli. These indices are used to address forward and reverse lookup tables in the multiplier circuit and enable efficient modular arithmetic operations by decomposing the computation into smaller, parallelizable channels.

[0461] In operation, table 2100 provides precomputed values for each index k, including the unsigned magnitude, sign bit, signed magnitude, and submodular indices. When a multiplier circuit receives an operand, it can use the table to quickly determine the sign-magnitude representation and the appropriate submodular indices for further processing. The submodular indices are then used to address lookup tables and perform modular addition or multiplication without carry propagation.

[0462] The components of table 2100 interact by mapping each group element (indexed by k) to its sign-magnitude representation and submodular decomposition. This mapping enables the multiplier circuit (e.g., multiplier circuit 2300) to convert between different representations and perform arithmetic operations in a residue number system. The use of precomputed values in the table eliminates the need for on-the-fly calculations, which can reduce computational complexity.

[0463] FIG. 22 is a reverse LUT 2200, which can be used by a multiplier circuit configured based on disclosed techniques and in connection with a noparity case associated with FIG. 21 - FIG. 24, according to example embodiments.

[0464] Reverse LUT 2200 includes the following components: sign bit column (sk) and signed magnitude column (msk).

[0465] The sign bit column (sk) indicates the sign of the result for the addressed entry. A value of 0 denotes a positive result, while a value of 1 denotes a negative result. This information is essential for reconstructing the correct sign-magnitude representation of the modular product or sum.The signed magnitude column (msk) provides the signed magnitude value associated with each entry in the reverse LUT. This value is determined based on the modular arithmetic properties of the RNS and the sign bit, and it represents the final result of the modular multiplication or addition operation in sign-magnitude form.

[0466] In operation, the reverse LUT 2200 can be addressed by the combined submodular indices obtained from the modular addition of the submodular indices of two operands. The addressed entry provides the sign bit and signed magnitude of the result, which are then used to reconstruct the final modular product or sum in sign-magnitude form. The use of precomputed values in the reverse LUT enables modular arithmetic operations, as the result can be retrieved directly without the need for real-time computation.

[0467] A feature of the reverse LUT 2200 is that it contains a reduced number of rows compared to reverse LUTs in preceding figures. Specifically, the number of entries is (p— 1 ) / 2, where p is the prime modulus. For example, for p = 11, the reverse LUT 2200 includes only 5 rows. This reduction is possible in the no-parity case, where only valid, unique results are stored, and no correction or parity management is required. In this regard, reverse LUT 2200 provides a direct mapping from submodular indices to result values, and by reducing the number of table entries to only those necessary for valid results.

[0468] The components of the reverse LUT 2200 interact by mapping the combined submodular indices to the corresponding sign and signed magnitude values. When a multiplier circuit performs a modular multiplication or addition,it computes the submodular sums for each submodulus, uses these as the address to the reverse LUT. and retrieves the precomputed result. This process streamlines the computation and ensures accuracy, particularly in the no-parity case where parity bits and correction logic are not required.

[0469] FIG. 23 is a block diagram of a multiplier circuit 2300 configured based on the tables of FIG. 21 and FIG. 22, according to example embodiments.

[0470] In some aspects, the multiplier circuit 2300 does not require a parity bit or parity entries in the forward and reverse look-up tables. Instead of parity, the multiplier circuit 2300 uses decoded submodular indices to detect entries in the second half of the table that result in an inverted sign and were previously detected by inverted parity.

[0471] In comparison, multiplier circuit 2000 uses (p-1 ) / 2 reverse lookup table entries (e.g., in reverse LUT 2012) with normal (odd) parity. Following these, there are (p- 1) / 2 - 1 reverse lookup table entries with inverted (even) parity for a total of (p-2) reverse lookup table entries. Detection of a parity mismatch triggers a sign flip in the final product sign. Additionally, the last (p-l) / 2 -1 table sign and magnitude table entries are duplicates of the first (p-1 ) / 2 -1 table entries.

[0472] The optimized multiplier circuit 2300 eliminates the parity bits and relies on decoded submodular index values directly to determine if the submodular sums address an entry in the bottom half or the top half of the reverse lookup table.

[0473] In some aspects, multiplier circuit 2300 includes the following components: forward lookup tables (LUTs) 2302 and 2304, submodular adders 2306 and 2308, decoders 2310 and 2312, a set of AND gates 2314, a set of pass gate multiplexers 2316 (with a single multiplexer illustrated as a pass gate multiplexer 2318), an OR gate 2320, an OR gate 2322, a reverse LUT 2324, sources 2326 and 2328. an XOR circuit 2330, product sign 2332, and product magnitude 2334.

[0474] Operand registers are configured to store the input operands for the modular multiplication operation (e.g., sources 2326 and 2328). Eachoperand register holds a sign and a magnitude representing a corresponding RNS operand, providing the initial data required for the multiplication process.

[0475] Forward LUTs 2302 and 2304 receive the magnitude of each operand and output a sign bit and a set of submodular indices. These LUTs use precomputed tables, such as the table shown in FIG. 21, to map the input magnitudes to their corresponding sign-magnitude representations and submodular decompositions.

[0476] Submodular adders 2306 and 2308 receive the submodular indices from the forward LUTs and perform modular addition for each submodulus, generating the combined submodular sums that serve as addresses for the reverse LUT 2324.

[0477] Submodular sum decoders 2310 and 2312 generate 1-hot decodes from each of the submodular sums. These decoders convert the submodular sum values into vectors where only one bit is set, corresponding to the value of the sum.

[0478] The set of AND gates 2314 combines each decoded submodular index value to uniquely represent table lookup addresses. Each AND gate receives inputs from the submodular sum decoders and outputs a logic ‘ 1 ’ only for a unique combination of submodular indices.

[0479] OR gate 2320 logically ORs the outputs of the AND gates that correspond to the bottom half of the reverse LUT 2324. If the output of the OR gate is ‘ 1 ', it indicates that the address is in the bottom half of the table.The set of pass gate multiplexers 2318 is controlled by the output of the OR gate 2320. When the OR gate output is ’ 1’. the MUX2 gates convert the address of each entry in the bottom half of the reverse LUT 2324 to the corresponding entry in the top half of the table. The output of the OR gate flips the final product sign if the address is in the bottom half.

[0480] Reverse LUT 2324 is addressed by the output of the MUX2 gates (e.g., the set of pass gate multiplexers 2316). and provides the product sign index bit (e.g., labelled as “Sign sk” in the reverse LUT 2324) and signed magnitude for the result. The reverse LUT 2324, as shown in FIG. 23, contains only (p-l) / 2 entries, a reduction from the (p-2) entries required in the multiplication circuit 2000 of FIG. 20.

[0481] Sign computation logic (e.g., XOR circuit 2330) determines the final product sign based on the sign bits from the operand registers, the forward LUTs, the reverse LUT, and the output of the Table Bottom signal from the logical NOT of the OR gate 2320. The Table Bottom signal, when a ‘1’, flips the sign of the final product. The table Bottom signal becomes a ‘1 ' when the output of the OR gate is a ‘ 1’.

[0482] An output register can store the final product sign 2332 and product magnitude 2334, providing the result of the modular multiplication operation.

[0483] In operation, multiplier circuit 2300 begins by loading the input operands into the operand registers. The magnitudes are provided to forward LUTs 2302 and 2304, which output the corresponding sign bits and submodular indices. Submodular adders 2306 and 2308 compute the modular sums for each submodulus. Submodular sum decoders 2310 and 2312 convert these sums into 1-hot vectors. The set of AND gates 2314 combines the decoded values to generate unique table lookup addresses. The OR gate 2320 determines if the address is in the bottom half of the reverse LUT 2324. If so, the set of pass gate multiplexers 2316 remaps the address to the top half, and the output of the OR gate flips the product sign. The reverse LUT 2324 outputs the sign and signed magnitude, which are processed by the sign computation logic (e.g., XOR circuit 2330) and stored in the output register.

[0484] In comparison to the multiplier circuits in the preceding figures, the multiplier circuit 2300 does not require a parity bit or parity entries in the forward and reverse lookup tables. Instead of parity, the multiplier circuit 2300 uses decoded submodular indices to detect entries in the second half of the table that result in an inverted sign and were previously detected by inverted parity. In the multiplier circuit 2000, there are (p-l) / 2 reverse lookup table entries with normal (odd) parity, followed by (p- 1) / 2 - 1 entries with inverted (even) parity, for a total of (p-2) entries. Detection of a parity mismatch triggers a sign flip in the final product sign, and the last (p-1 ) / 2 -1 table sign and magnitude entries areduplicates of the first (p–1) / 2 - 1 entries. The optimized multiplier circuit 2300 eliminates the parity bits and relies on decoded submodular index values directly to determine if the submodular sums address an entry in the bottom half or the top half of the reverse lookup table.

[0485] In some aspects, if the submodular sums are (2)3 and (3)s, these values are decoded into 1-hot vectors, [1, 0, 0] and [0, 1, 0, 0, 0], respectively. The last AND2 gate (of the set of AND gates 2314) has an output of ‘ 1 all others are zero. The output of the OR gate is also a ‘f, indicating an address entry at the bottom of the table. The ' 1 ’ output of the OR gate triggers the MUX2 gates to select the 1-hot address decodes from the bottom half of the table instead of the top half. Thus, address decode 6 is mapped to address decode 1, address decode 7 is mapped to address decode 2, address decode 8 is mapped to address decode 3, and address decode 9 is mapped to address decode 4, effectively correcting the RNS3 submodular index.

[0486] In comparison to the preceding multiplier circuits, multiplier circuit 2300 is configured with less logic, due to no parity bit or parity bit entries in the forward and reverse lookup tables, as well as a reduced number of address entries in the reverse lookup table (e.g., a reduction from (p-2) to (p-l) / 2).

[0487] The case for product 0 is handled as follows: when either srcO or srcl is zero, the output of an OR gate 2322 is set to ‘ T. This signal prevents the submodular decodes from outputting a logic ' 1 ’, guaranteeing that both submodular decodes are set to [0, 0, 0] and [0, 0, 0, 0, 0], respectively, and activates address 0 of the reverse lookup table, which corresponds to an output of zero (sign = 0, magnitude = 0). The AND2 gates have two inputs because there are two submodular decodes feeding each gate; if there are ‘n’ submodular decodes, then the AND2 gates become n-input AND gates.

[0488] The multiplier circuit 2300 includes the following additional advantages. The multiplexers can be implemented in CMOS logic as pass-gate multiplexers (e.g., as illustrated in FIG. 24). Additionally, wide OR gates can be designed efficiently based on domino logic OR gates (e.g., an example design of the OR gate 2320 is illustrated in FIG. 24). This approach can be used for handling larger moduli, such as moduli 29 and above.

[0489] FIG. 24 is a block diagram of the OR gate 2320 and the pass gate multiplexer 2318 (which can be part of the set of pass gate multiplexers 2316), which can be used in the multiplier circuit of FIG.23, according to example embodiments.

[0490] In some aspects, the OR gate 2320 is a digital logic gate that outputs a logic high signal only when any of its inputs are at logic high. In the context of the multiplier circuit 2300, the OR gate 2320 is used to combine the outputs of a set of AND gates that correspond to the detection of address entries in the bottom half of the reverse lookup table. The output of the OR gate 2320 serves as a control signal for the pass gate multiplexers.

[0491] The pass gate multiplexer 2318 is a CMOS-based multiplexer that selectively passes one of its input signals to its output based on a control signal. In the multiplier circuit 2300, the pass gate multiplexer 2318 is used to remap address decodes from the bottom half of the reverse lookup table to the corresponding entries in the top half, and to flip the product sign when necessary. The pass gate multiplexer 2318 is designed for efficient implementation in CMOS logic, enabling high-speed and low-power operation.

[0492] In operation, the OR gate 2320 receives input signals from the outputs of the AND gates that represent unique combinations of submodular index decodes. When all of these inputs are low, indicating that the current address is not in the bottom half of the table, the OR gate outputs a low signal. When any input is high, indicating an address in the bottom half, the OR gate outputs a signal. This output is used as the control signal for the pass gate multiplexer 2318.

[0493] The pass gate multiplexer 2318 receives the control signal from the OR gate 2320 and, based on its value, selects between the address decodes from the top half or the remapped bottom half of the reverse lookup table. When the control signal indicates a bottom-half address, the multiplexer remaps the address and flips the product sign as required by the optimized case III design. When the control signal indicates a top-half address, the multiplexer passes the address decode unchanged.

[0494] The interaction between the OR gate 2320 and the pass gate multiplexer 2318 enables the multiplier circuit 2300 to handle address remapping and sign correction without the need for parity bits or additional correction logic.

[0495] FIG. 25 is a block diagram of another embodiment of the multiplier circuit of FIG. 23, according to example embodiments.

[0496] In some aspects, multiplier circuit 2500 includes the following components: forward LUTs 2502 and 2504, decoders 2510, 2512, 2513, and 2515, 1-hot modulo adders 2506 and 2508. a set of AND gates 2514, a set of pass gate multiplexers 2516 (with a single multiplexer illustrated as a pass gate multiplexer 2518), an OR gate 2520, an OR gate 2522, a reverse LUT 2524, sources 2526 and 2528, an XOR circuit 2530, product sign 2532, and product magnitude 2534.

[0497] Multiplier circuit 2500 is a variation of the multiplier circuit 2300 of FIG. 23, except that multiplier circuit 2500 uses 4 decoders and the modulo 3 and modulo 5 adders in FIG. 23 are replaced with a different type of adder. called a “1-hot modulo adder.” More specifically, the modulo 3 adder 2306 has been replaced with the 1-hot modulo 3 adder 2506, and the modulo 5 adder 2308 has been replaced with the 1-hot modulo 5 adder 2508. In the multiplier circuit 2500, each 1-hot modulo adder receives a decoded set of submodular indices from corresponding decoders 2510, 2512, 2513, and 2515. In some aspects, each 1-hot modulo adder produces a set of 1-hot outputs directly, instead of outputs in a binary7format. Therefore, there is no equivalent of decoders 2310 and 2312 in the multiplier circuit 2500.

[0498] FIG. 26 is a block diagram of a 1-hot modulo 3 adder 2600 used by the multiplier circuit of FIG. 25, according to example embodiments. Adder 2600 receives srcO and srcl decoder outputs as well as an inverted product_zero signal. A set of AND and OR gates forms a set of multiplexors which produce a correct decoded modulo 3 sum based on the srcO and srcl decoded inputs. One advantage of the 1-hot modulo adder 2600 depicted in FIG.26 is that it is a simpler and faster design than a traditional end-around carry modulo adder (for a modulo adder of the form 2n-l) or end-around borrow modulo adder (for amodulo adder of the form 2n+l). This is true for small modulo adders of two or three bits, as depicted in this design, and possibly also up to 4-bit adders.Furthermore, this design could also be built using pass-gate multiplexors for even faster operation. A second advantage of this design is that it is applicable to modulo adders not of the form 2n-l or 2n+l, such as perhaps 8, 10, or 11. Thus, submodular indices other than the forms 2n-l or 2n+l may be used if needed. The inverted product zero signal ensures that if the product is detected as being zero, due to either srcO or srcl being zero, then no output sum decodes are active.

[0499] FIG. 27 depicts example Verilog code 2700 for the 1-hot modulo 3 adder and the 1-hot modulo 5 adder used by the multiplier circuit of FIG.25, according to example embodiments. The Verilog code provides the functional definition of both the 1-hot modulo 3 adder and the 1-hot modulo 5 adder. The 1-hot modulo 3 adder Verilog code is the functional definition of the 1-hot modulo 3 adder block diagram in FIG. 26.

[0500] In some aspects, the Verilog code 2700 provides the functional definition of both a 1-hot modulo 3 adder and a 1-hot modulo 5 adder. The 1-hot modulo 3 adder Verilog code is the functional definition of the 1-hot modulo 3 adder block diagram in FIG. 26. The code functions as a set of three 3: 1 multiplexers, built with three sets of three AND gates and three OR gates. The code generates a 1-hot decoded modulo 3 sum output. When the Product_Zero input is active, it deactivates all of the 1 -hot decoded modulo 3 sum outputs to indicate that none are valid for this product zero condition.

[0501] FIG. 28 is a flowchart of a method 2800 for configuring a submodular signed RNS index-calculus multiplier circuit, according to example embodiments. Method 2800 includes operations 2802, 2804, 2806, 2808, 2810, 2812, and 2814. By way of example and not limitation, method 2800 is described as being performed by any of the disclosed multiplier circuits (e.g., multiplier circuits discussed in connection with FIGS. 14-27) or computer 2900 of FIG. 29. Any of the methods disclosed herein can be configured as computer-implemented methods performed by one or more processors within a computing device.

[0502] At operation 2802, a first RNS operand and a second RNS operand are stored, where each operand comprises a sign and a magnitude. This operation may be performed by loading the operands into dedicated operand registers or memory locations of a multiplier circuit, as illustrated in the operand registers of the apparatus in FIG. 14A, FIG. 16, FIG. 20, and FIG. 23.

[0503] At operation 2804, the magnitude of the first RNS operand is received at a first forward conversion lookup table (LUT). The first forward conversion LUT processes the input magnitude and outputs a first sign bit and a first set of submodular indices. These indices are determined by reducing the operand’s index modulo each of a plurality of pairwise co-prime submoduli, as shown in the forw ard LUT stored in the forward conversion ROM 1402 and forward LUT 1602.

[0504] At operation 2806, the magnitude of the second RNS operand is received at a second forward conversion LUT. The second forward conversion LUT outputs a second sign bit and a second set of submodular indices corresponding to the magnitude of the second RNS operand. This process is analogous to the first operand’s conversion and is performed by the second forward LUT. such as 1404 or 1604.

[0505] At operation 2808, a first submodular sum is generated based on the first set of submodular indices. This is accomplished using a first submodulo adder, which performs modular addition on the submodular indices derived from the first operand, as depicted in the sub-modulo adder 1408 or 1606.

[0506] At operation 2810, a second submodular sum is generated based on the second set of submodular indices. This operation is performed by a second sub-modulo adder, which adds the submodular indices from the second operand, as shown in sub-modulo adder 1410 or 1608.

[0507] At operation 2812, a product magnitude and a product sign for the product of the first RNS operand and the second RNS operand are determined, at a reverse conversion LUT, based at least on the first submodular sum and the second submodular sum. The reverse conversion LUT, such as 1412 or 1612.maps the combined submodular sums to the corresponding product values, including both sign and magnitude.

[0508] Even though the disclosed techniques are discussed in connection with using two submodular sums, the disclosure is not limited in this regard, and n submodular sums can be used instead (where n is an integer that is greater than or equal to 2).

[0509] At operation 2814, the product sign is adjusted based on the first sign bit, the second sign bit, the sign in the first operand, the sign in the second operand, and the actual parity from the reverse conversion LUT. This adjustment may involve logic such as XOR circuits (e.g., 1420 or 1620) and may use parity information to select between corrected and uncorrected sign values, ensuring the final product sign is accurate for all modular multiplication scenarios.

[0510] Even though the above disclosure and the claims discuss two sets of submodular indices and two submodular sums, the disclosure is not limited in this regard, and a different number of sets (e.g., n sets) of submodular indices and a different number of submodular sums (e.g., n sums) can be used. In this regard, there can be up to ‘n’ submodular indices and sums (and therefore up to ‘n’ submodular index columns in each forw ard LUT).

[0511] FIG. 29 is a diagram of circuitry for a device that implements algorithms and performs methods, according to some example embodiments. Not all components need to be used in various embodiments. For example, clients, servers, and cloud-based network devices may each use a different set of components, or in the case of servers, larger storage devices.

[0512] One example computing device in the form of a computer 2900 (also referred to as computing device 2900, computer system 2900, or computer 2900) may include a processor 2905, memory 2910, removable storage 2915, non-removable storage 2920. input interface 2925. the output interface 2930, and communication interface 2935, all connected by a bus 2940. Although the example computing device is illustrated and described as the computer 2900, the computing device may be in different forms in different embodiments.

[0513] Memory 2910 may include volatile memory 2945 and nonvolatile memory’ 2950, and may store a program 2955. The computer 2900 may include, or have access to, a computing envrronment that includes a variety of computer-readable media, such as the volatile memory 2945, the non-volatile memory 2950, the removable storage 2915, and the non-removable storage 2920. Computer storage includes random-access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) and electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD ROM), digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium capable of storing computer-readable instructions.

[0514] Computer-readable instructions stored on a computer-readable medium (e.g., the program 2955 stored in memory 2910) are executable by the processor 2905 of the computer 2900. A hard drive, CD-ROM, and RAM are some examples of articles that include a non-transitory computer-readable medium such as a storage device. The terms ‘"computer-readable medium" and ‘‘storage device’’ do not include carrier waves to the extent that carrier waves are deemed too transitory'. “Computer-readable non-transitory media” includes all types of computer-readable media, including magnetic storage media, optical storage media, flash media, and solid-state storage media. It should be understood that software can be installed and sold on a computer. Alternatively, the software can be obtained and loaded into the computer, including obtaining the software through a physical medium or distribution system, including, for example, from a server owned by the software creator or from a server not owned but used by the software creator. The software can be stored on a server for distribution over the Internet, for example. As used herein, the terms “computer-readable medium” and “machine-readable medium” are interchangeable.

[0515] Processor 2905 may utilize one or more circuits discussed herein, such as submodular signed RNS index-calculus multiplier circuit 2960configured according to disclosed techniques (e.g.. as discussed in connection with FIGS. 1-28).

[0516] Any one or more of the modules described herein may be implemented using hardware (e.g., a processor of a machine, an applicationspecific integrated circuit (ASIC), a field-programmable gate array (FPGA), or any suitable combination thereof). Moreover, any two or more of these modules may be combined into a single module, and the functions described herein for a single module may be subdivided among multiple modules. Furthermore, according to various example embodiments, modules described herein as being implemented within a single machine, database, or device may be distributed across multiple machines, databases, or devices.

[0517] Although a few embodiments have been described in detail above, other modifications are possible. For example, the logic flow s depicted in the figures do not require the particular order shown or a sequential order to achieve desirable results. Other steps may be provided, or steps may be eliminated, from the described flows, and other components may be added to, or removed from, the described systems. Other embodiments may be within the scope of the following claims.

[0518] It should be further understood that software, including one or more computer-executable instructions that facilitate processing and operations as described above concerning any one or all of the steps of the disclosure, can be installed in and sold with one or more computing devices consistent with the disclosure. Alternatively, the software can be obtained and loaded into one or more computing devices, including obtaining the software through a physical medium or distribution system, including, for example, from a server owned by the software creator or from a server not owned but used by the software creator. The software can be stored on a server for distribution over the Internet, for example.

[0519] Also, it will be understood by one skilled in the art that this disclosure is not limited in its application to the details of construction and the arrangement of components outlined in the description or illustrated in the drawings. The embodiments herein are capable of other embodiments andcapable of being practiced or carried out in various ways. Also, it will be understood that the phraseology and terminology’ used herein are for description and should not be regarded as limiting. The use of “including,” “comprising,” or “having” and variations thereof herein is meant to encompass the items listed thereafter and equivalents thereof, as well as additional items. Unless limited otherwise, the terms “connected,” “coupled,” and “mounted,” and variations thereof herein are used broadly and encompass direct and indirect connections, couplings, and mountings. Also, the terms “connected” and “coupled” and variations thereof are not restricted to physical or mechanical connections or couplings. Further, terms such as up, down, bottom, and top are relative and are employed to aid illustration, but are not limiting.

[0520] The components of the illustrative devices, systems, and methods employed following the illustrated embodiments can be implemented, at least in part, in digital electronic circuitry', analog electronic circuitry, computer hardware, firmware, software, or in combinations of them. These components can be implemented, for example, as a computer program product such as a computer program, program code, or computer instructions tangibly embodied in an information carrier, or a machine-readable storage device, for execution by, or to control the operation of, data processing apparatus such as a programmable processor, a computer, or multiple computers.

[0521] A computer program can be written in any form of programming language, including compiled or interpreted languages, and it can be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or another unit suitable for use in a computing environment. A computer program can be deployed to be executed on one computer or multiple computers at one site or distributed across multiple sites and interconnected by a communication network. Also, functional programs, codes, and code segments for accomplishing the techniques described herein can be easily construed as within the scope of the claims by' programmers skilled in the art to which the techniques described herein pertain. Method steps associated with the illustrative embodiments can be performed by one or more programmable processors executing a computer program, code, or instructions to perform functions (e.g.,by operating on input data and / or generating an output). Method steps can also be performed by, and an apparatus for performing the methods can be implemented as special-purpose logic circuitry, e.g., an FPGA (field-programmable gate array) or an ASIC (application-specific integrated circuit), for example.

[0522] The various illustrative logical blocks, modules, and circuits described in connection with the embodiments disclosed herein may be implemented or performed with a general-purpose processor, a digital signal processor (DSP), an ASIC, an FPGA, or other programmable logic devices, discrete gate, or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP core, or any other such configuration.

[0523] Processors suitable for the execution of a computer program include, by way of example, both general and special-purpose microprocessors, and any one or more processors of any kind of digital computer. Generally, a processor will receive instructions and data from a read-only memory, a randomaccess memory, or both. The required elements of a computer are a processor for executing instructions and one or more memory devices for storing instructions and data. Generally, a computer will also include, or be operatively coupled to receive data from or transfer data to, or both, one or more mass storage devices for storing data, e.g., magnetic, magneto-optical disks, or optical disks.Information carriers suitable for embodying computer program instructions and data include all forms of non-volatile memory, including by way of example, semiconductor memory devices, e.g., electrically programmable read-only memory or ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory devices, and data storage disks (e.g., magnetic disks, internal hard disks, or removable disks, magneto-optical disks, and CD-ROMand DVD-ROM disks). The processor and the memory can be supplemented by or incorporated into special-purpose logic circuitry.

[0524] Those with skill in the art understand that information and signals may be represented using any of a variety of different technologies and techniques. For example, data, instructions, commands, information, signals, bits, symbols, and chips that may be referenced throughout the above description may be represented by voltages, currents, electromagnetic waves, magnetic fields or particles, optical fields or particles, or any combination thereof.

[0525] As used herein, “machine-readable medium’" (or “computer-readable medium”) means a device able to store instructions and data temporarily or permanently and may include, but is not limited to, randomaccess memory (RAM), read-only memory (ROM), buffer memory, flash memory, optical media, magnetic media, cache memory, other ty pes of storage (e.g., Erasable Programmable Read-Only Memory (EEPROM)), and / or any suitable combination thereof. The term “machine-readable medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, or associated caches and servers) able to store processor instructions. The term “machine-readable medium” shall also be taken to include any medium (or a combination of multiple media) that is capable of storing instructions for execution by one or more processors 2905, such that the instructions, when executed by one or more processors 2905, cause the one or more processors 2905 to perform any one or more of the methodologies described herein. Accordingly, a “machine-readable medium” refers to a single storage apparatus or device, as well as “cloud-based” storage systems or storage networks that include multiple storage apparatus or devices. The term “machine-readable medium” as used herein excludes signals per se, including carrier waves.

[0526] In addition, techniques, systems, subsystems, and methods described and illustrated in the various embodiments as discrete or separate may be combined or integrated with other systems, modules, techniques, or methods without departing from the scope of the present disclosure. Other items shown or discussed as coupled or directly coupled or communicating with each othermay be indirectly coupled or communicating through some interface, device, or intermediate component, whether electrically, mechanically, or otherwise. Other examples of changes, substitutions, and alterations are ascertainable by one skilled in the art and could be made without departing from the scope disclosed herein.

[0527] Although the present disclosure has been described regarding specific features and embodiments thereof, it is evident that various modifications and combinations can be made thereto without departing from the scope of the disclosure. For example, other components may be added to or removed from the described systems. The specification and drawings are, accordingly, to be regarded simply as an illustration of the disclosure as defined by the appended claims, and are contemplated to cover any modifications, variations, combinations, or equivalents that fall within the scope of the present disclosure. Other aspects may be within the scope of the following claims.

Claims

CLAIMSWhat is claimed is:

1. An apparatus for performing modular multiplication in a residue number system (RNS), the apparatus comprising:a first operand register and a second operand register, each configured to store a sign and a magnitude representing a corresponding first RNS operand and a corresponding second RNS operand;a first memory’ storing a first forward conversion lookup table (LUT), the first forward conversion LUT to:receive the magnitude of the first RNS operand; and output a first sign bit and a first set of submodular indices corresponding to the magnitude of the first RNS operand;a second memory storing a second forward conversion LUT, the second forward conversion LUT to:receive the magnitude of the second RNS operand; and output a second sign bit and a second set of submodular indices corresponding to the magnitude of the second RNS operand;a first sub-modulo adder coupled to the first and second memories, the first sub-modulo adder to generate a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices;at least a second sub-modulo adder coupled to the first and second memories, the second sub-modulo adder to generate a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices;a third memory coupled to the first and second sub-modulo adders, the third memory storing a reverse conversion LUT, the reverse conversion LUT to determine a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on at least the first submodular sum and the second submodular sum; anda sign computation logic coupled to the first operand register, the second operand register, the first memory, the second memory, and the third memory, the sign computation logic to adjust the product sign based on the first sign bit, the second sign bit, the sign in the first operand register, the sign in the second operand register, and an actual parity' from the reverse conversion LUT.

2. The apparatus of claim 1, wherein the reverse conversion LUT comprises:a plurality of table entries comprising uncorrected and corrected entries for sign and magnitude values associated with at least the first and second submodular sums; anda plurality of parity bits corresponding to the plurality of table entries.

3. The apparatus of claim 2, wherein the reverse conversion LUT is further to:store, for each table entry of the reverse conversion LUT, a set of indices corresponding to at least the first and second submodular sums; and determine the product magnitude and the product sign based on the set of indices.

4. The apparatus of claim 3, further comprising:parity logic coupled to the first memory, the second memory7, and the third memory, the parity logic to:compute an expected parity based on the first and second RNS operands;perform a comparison of the expected parity with the actual parity from the reverse conversion LUT; andgenerate a parity mismatch signal based on the comparison.

5. The apparatus of claim 4, further comprising:correction logic coupled to the sign computation logic, the reverse conversion LUT, and the parity logic, the correction logic to:select the product magnitude and the product sign from the uncorrected and corrected entries based on the parity mismatch signal.

6. The apparatus of claim 5, wherein the parity logic is further to:detect an invalid row condition or a wrap-around condition associated with generating the first and second submodular sums by comparing the expected parity and the actual parity; andsignal the correction logic to select first corrected entries from the corrected entries stored in the first conversion LUT for the product magnitude and the product sign in response to the wrap-around condition.

7. The apparatus of any of claims 1-6. wherein the first forward conversion LUT and the second forward conversion LUT are to:determine at least the first and second sets of submodular indices based on reducing an index associated with the first RNS operand and the second RNS operand, modulo each of a plurality of pairwise co-prime submoduli.

8. The apparatus of any of claims 1-6, further comprising:an output register coupled to the sign computation logic, the output register to:store the product sign and the product magnitude.

9. The apparatus of claim 8. wherein the output register is further to: output the product sign and the product magnitude in a sign-magnitude encoded format.

10. The apparatus of claim 4, wherein the sign computation logic is further to:adjust the product sign as an exclusive-OR (XOR) of the first sign bit, the second sign bit, the sign in the first operand register, the sign in the second operand register, and the parity mismatch signal.

11. The apparatus of any of claims 1-10, wherein each of the first submodulo adder and at least the second sub-modulo adder is configured as a 2“-l modular adder, a 2nadder, or a 2n+l modular adder.

12. A computer-implemented method for performing modular multiplication in a residue number system (RNS), the method comprising:storing a first RNS operand and a second RNS operand, each RNS operand comprising a sign and a magnitude;receiving the magnitude of the first RNS operand at a first forward conversion lookup table (LUT) and outputting a first sign bit and a first set of submodular indices;receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and a second set of submodular indices;generating a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices;generating at least a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices; determining at a reverse conversion LUT, a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on the first submodular sum and at least the second submodular sum; andadjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and an actual parity from the reverse conversion LUT.

13. The method of claim 12, wherein the determining at the reverse conversion LUT further comprises:outputting, from the reverse conversion LUT, a plurality of table entries comprising uncorrected and corrected entries for sign and magnitude values associated with the first submodular sum and at least the second submodular sum, and a plurality of parity bits corresponding to the plurality of table entries.

14. The method of claim 13, wherein the determining at the reverse conversion LUT further comprises:storing, for each table entry of the reverse conversion LUT, a set of indices corresponding to at least the first and second submodular sums, and determining the product magnitude and the product sign based on the set of indices.

15. The method of claim 14, further comprising:computing an expected parity based on the first and second RNS operands;performing a comparison of the expected parity with the actual parity from the reverse conversion LUT; andgenerating a parity mismatch signal based on the comparison.

16. The method of claim 15, further comprising:selecting the product magnitude and the product sign from the uncorrected and corrected entries based on the parity mismatch signal.

17. The method of claim 16, wherein the computing of the expected parity, performing the comparison, and generating the parity mismatch signal further comprises:detecting an invalid row condition or a wrap-around condition associated with generating the first submodular sum and at least the second submodular sum by comparing the expected parity and the actual parity; andselecting first corrected entries from the corrected entries stored in the first conversion LUT for the product magnitude and the product sign in response to the wrap-around condition.

18. The method of any of claims 12-17, wherein the receiving the magnitude of the first RNS operand at the first forward conversion LUT and the receiving the magnitude of the second RNS operand at the second forward conversion LUT further comprises:determining the first set of submodular indices and at least the second set of submodular indices based on reducing an index associated with the first RNS operand and the second RNS operand, modulo each of a plurality of pairwise coprime submoduli.

19. The method of any of claims 12-18, further comprising:storing the product sign and the product magnitude in an output register.

20. The method of claim 19, further comprising:outputting the product sign and the product magnitude in a signmagnitude encoded format.

21. The method of claim 15, wherein the adjusting the product sign further comprises:adjusting the product sign as an exclusive-OR (XOR) of the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the parity mismatch signal.

22. The method of any of claims 12-21, wherein the generating of the first submodular sum and the generating of the second submodular sum each comprises:performing a submodular sum using a 2n-1 modular adder, a 2nadder, or a 2n+1 modular adder.

23. A non-transitory computer-readable medium storing computer instructions for performing modular multiplication in a residue number system (RNS), that configure at least one processor, upon execution of the computer instructions, to perform steps comprising:storing a first RNS operand and a second RNS operand, each operand comprising a sign and a magnitude;receiving the magnitude of the first RNS operand at a first forward conversion lookup table (LUT) and outputting a first sign bit and a first set of submodular indices;receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and a second set of submodular indices;generating a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices;generating a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices;determining at a reverse conversion LUT, a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on at least the first submodular sum and the second submodular sum; and adjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and an actual parity from the reverse conversion LUT.

24. The non-transitory computer-readable medium of claim 23, the steps further comprising:outputting, from the reverse conversion LUT, a plurality of table entries comprising uncorrected and corrected entries for sign and magnitude values associated with at least the first and second submodular sums, and a plurality of parity bits corresponding to the plurality of table entries.

25. The non-transitory computer-readable medium of claim 24, the steps further comprising:storing, for each table entry of the reverse conversion LUT, a set of indices corresponding to at least the first and second submodular sums, and determining the product magnitude and the product sign based on the set of indices.

26. The non-transitory computer-readable medium of claim 25, the steps further comprising:computing an expected parity based on the first and second RNS operands;performing a comparison of the expected parity with the actual parity from the reverse conversion LUT; andgenerating a parity mismatch signal based on the comparison.

27. The non-transitory computer-readable medium of claim 26, the steps further comprising:selecting the product magnitude and the product sign from the uncorrected and corrected entries based on the parity mismatch signal.

28. The non-transitory computer-readable medium of claim 27, wherein the steps of computing the expected parity, performing the comparison, and generating the parity mismatch signal further comprise:detecting an invalid row condition or a wrap-around condition associated with generating at least the first and second submodular sums by comparing the expected parity and the actual parity; andselecting first corrected entries from the corrected entries stored in the first conversion LUT for the product magnitude and the product sign in response to the wrap-around condition.

29. The non-transitory computer-readable medium of any of claims 23-28, wherein the steps of receiving the magnitude of the first RNS operand at the first forward conversion LUT and receiving the magnitude of the second RNS operand at the second forward conversion LUT further comprise:determining at least the first and second sets of submodular indices based on reducing an index associated with the first RNS operand and the second RNS operand, modulo each of a plurality of pairwise co-prime submoduli.

30. The non-transitory computer-readable medium of any of claims 23-29, the steps further comprising:storing the product sign and the product magnitude in an output register.

31. The non-transitory computer-readable medium of claim 30, the steps further comprising:outputting the product sign and the product magnitude in a signmagnitude encoded format.

32. The non-transitory computer-readable medium of claim 26, wherein the step of adjusting the product sign further comprises:adjusting the product sign as an exclusive-OR (XOR) of the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the parity mismatch signal.

33. The non-transitory computer-readable medium of any of claims 23-32, wherein the steps of generating at least the first submodular sum and generating the second submodular sum each comprise:performing a submodular sum using a 2n-1 modular adder, a 2nadder, or a 2n+1 modular adder.

34. An apparatus for performing modular multiplication in a residue number system (RNS), the apparatus comprising:means for storing a first RNS operand and a second RNS operand, each RNS operand comprising a sign and a magnitude;means for receiving the magnitude of the first RNS operand at a first forward conversion lookup table (LUT) and outputting a first sign bit and a first set of submodular indices;means for receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and a second set of submodular indices;means for generating a first submodular sum based on a first subset of the first set of submodular indices and the second set of submodular indices;means for generating a second submodular sum based on a second subset of the first set of submodular indices and the second set of submodular indices;means for decoding each of the at least first and second submodular sums into decoded submodular sums associated with a 1-hot vector using a first decoder and a second decoder;means for combining the decoded submodular sums using a set of AND gates to generate table lookup addresses;means for determining, using an OR gate, whether a table lookup address of the table lookup addresses corresponds to a bottom half of a reverse LUT; means for remapping the table lookup address using a set of pass gate multiplexers, the pass gate multiplexers being controlled by the output of the OR gate;means for inverting a product sign when the address is in the bottom half of the reverse LUT;means for determining a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on the table lookup address; andmeans for adjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the output of the OR gate, indicating a table bottom condition.

35. The apparatus of claim 34, wherein the reverse LUT comprises a plurality of table entries, each entry including a sign bit and a signed magnitude, and wherein the number of table entries is (p–1) / 2 for a prime modulus p.

36. The apparatus of claim 34, wherein the means for remapping the table lookup address using the set of pass gate multiplexers further comprises selecting between a top half and the bottom half of the reverse LUT based on an output of the OR gate, and wherein the means for inverting the product signfurther comprises means for flipping the product sign when the address is in the bottom half of the reverse LUT.

37. An apparatus for performing modular multiplication in a residue number system (RNS), the apparatus comprising:means for storing a first RNS operand and a second RNS operand, each RNS operand comprising a sign and a magnitude;means for receiving the magnitude of the first RNS operand at a first forward conversion lookup table (LUT) and outputting a first sign bit and a first set of submodular indices;means for receiving the magnitude of the second RNS operand at a second forward conversion LUT and outputting a second sign bit and a second set of submodular indices;means for decoding the first set of submodular indices and the second set of submodular indices into decoded submodular indices;means for generating decoded submodular sums based on the decoded submodular indices;means for combining the decoded submodular sums using a set of AND gates to generate table lookup addresses;means for determining, using an OR gate, whether a table lookup address of the table lookup addresses corresponds to a bottom half of a reverse LUT; means for remapping the table lookup address using a set of pass gate multiplexers, the pass gate multiplexers being controlled by the output of the OR gate;means for inverting a product sign when the address is in the bottom half of the reverse LUT;means for determining a product magnitude and a product sign for a product of the first RNS operand and the second RNS operand based on the table lookup address; andmeans for adjusting the product sign based on the first sign bit, the second sign bit, the sign in the first RNS operand, the sign in the second RNS operand, and the output of the OR gate, indicating a table bottom condition.

38. The apparatus of claim 37, wherein the means for generating the decoded submodular sums comprises one or more 1-hot modulo adders.