Folded residual number system crossbar addition unit

WO2024119200A3PCT designated stage Publication Date: 2024-11-28FUTUREWEI TECHNOLOGIES INC
1 Cites 0 Cited by

Patent Information

Application Number
PCT/US2024/021869
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-03-28
Publication Date
2024-11-28

Smart Images

  • Figure US2024021869_28112024_PF_FP_ABST
    Figure US2024021869_28112024_PF_FP_ABST
Patent Text Reader

Abstract

An addition circuit adds two selected numbers, modulo p in a fast and efficient manner. The addition can be implemented by use of a crossbar adder circuit. In a folded and split crossbar embodiment, for modulo p operands in a sign-magnitude format, a crossbar array of size ((p+1) / 2)x((p+1) / 2) can be used to compute the magnitude of the sum with logic circuitry used to compute the sign of the sum.
Need to check novelty before this filing date? Find Prior Art

Description

FOLDED RESIDUAL NUMBER SYSTEM CROSSBAR ADDITION UNITInventor:Michael DibrinoFIELD

[0001] The following is related generally to the field of electronic circuits and, more specifically, to electronic circuits for performing arithmetic functions such as multiplication.BACKGROUND

[0002] 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, or VU, an arithmetic logic unit, or ALU, and / or a floating-point unit, or FPU, often referred to as a math coprocessor. One or more such units may include addition circuits (addition units) to perform addition operations. In general-purpose computer architectures, one or more VUs, ALUs and / or FPUs may be integrated as execution units within the central processing unit.

[0003] One way to improve the efficiency of addition operations is through use of a Residual, or Residue, Number System (RNS) addition operations in which the operands are represented by a set of remainders for a set of moduli. Although this approach can provide advantages, it can require m x m lookup tables for a modulus value of m, be restricted to specific values such as 2'-1 or 2'+1 , where i is an integer, or multiple adders for non 2'-1 or 2'+1 modulo values and moduli of the form 2'-1 or 2'+1 restrict the possible choices of moduli. Circuits that perform RNS based additionoperations in a more efficient manner than non-modular implementations of addition circuits.SUMMARY

[0004] According to one aspect of the present disclosure, an addition circuit includes a crossbar adder circuit and a sign determination circuit. The crossbar adder circuit is configured to: receive a magnitude of a first modulo p input number in a signmagnitude format; receive a magnitude of a second modulo p input number in the signmagnitude format; and determine a magnitude of a sum of the first modulo p input number and the second modulo p input number from the magnitude of the of the first modulo p input number and the magnitude of the of the second modulo p input number. The sign determination circuit is configured to: receive a sign value of the first modulo p input number in the sign-magnitude format; receive a sign value of a second modulo p input number in the sign-magnitude format; and determine a sign value of the sum of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

[0005] Optionally, in the preceding aspect, the crossbar adder circuit is a (p+1 ) / 2 by (p+1 ) / 2 crossbar array of switches.

[0006] Optionally, in the preceding aspect, the switches are arranged in columns and rows; the switches of each column connected between a corresponding magnitude one of the first modulo p input numbers and a different row output; and a control gate of each of the switches is connect to receive the magnitude of one of the second modulo p input numbers.

[0007] Optionally, in the preceding aspect, the addition circuit also includes: a first plurality of multiplexers each configured to receive as input the magnitude of a corresponding pair of the second modulo p input numbers and apply a selected one of the corresponding pair of the second modulo p input numbers to the control gates of switches along a corresponding diagonal of a top triangle of the array of switches; and a second plurality of multiplexers each configured to receive as input themagnitude of a corresponding pair of the second modulo p input numbers and apply a selected one of the corresponding pair of the second modulo p input numbers to the control gates of switches along a corresponding diagonal of a bottom triangle of the array of switches.

[0008] Optionally, in the preceding aspect, the corresponding pair of the second modulo p input numbers add to a first same value for each of the first plurality of multiplexers; and the corresponding pair of the second modulo p input numbers add to a second same value for each of the second plurality of multiplexers.

[0009] Optionally, in any of the preceding four aspects, the switches are NMOS transistors.

[0010] Optionally, in any of the five preceding aspects, the switches are implemented as one or more of finFET transistors, Gate-AII-Around (GAA) transistors, or nanowire or nanosheet transistors.

[0011] Optionally, in any of the preceding aspects, the first modulo p input number is received as a binary encoded value and the second modulo p input number is received as a binary encoded value and the crossbar adder circuit is further configured to: convert the magnitude of the first modulo p input number to a first binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero; and convert the magnitude of the second modulo p input number to a second binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero.

[0012] Optionally, in the preceding aspect, the crossbar adder circuit is further configured to select between a first input value and a second input value for input of the second modulo p input number inputs into the cross-bar array for non-zero values of the second modulo p input number.

[0013] Optionally, in the preceding three aspects, the addition circuit is one of a plurality of modular arithmetic units, each for a different modulus value and each configured to receive a corresponding component of input values in a residual number format system.

[0014] Optionally, in any of the preceding aspects, the addition circuit further comprises a plurality of level restore circuits, each configured to receive two outputs of a row of the crossbar adder circuit, one of outputs active and the other outputs inactive, and provide the output of each of the rows as a strong logic value.

[0015] Optionally, in any of the preceding aspects, the p is an odd number.

[0016] Optionally, in any of the preceding aspects, the addition circuit further comprises a buffer configured connected to the crossbar adder circuit and configured to store the determined magnitude of the sum of the first modulo p input number and the second modulo p input number, wherein the magnitude of the second modulo p input number is the stored determined magnitude.

[0017] According to an additional aspect of the present disclosure, there is provided a method of performing modulo p addition, comprising: receiving a first modulo p input number in a sign-magnitude format; receiving a second modulo p input number in the sign-magnitude format; determining a magnitude of a sum of the first modulo p input number and the second modulo p input number by providing the magnitude of the first modulo p input number and the second modulo p input number as respective first and second inputs of a crossbar multiplier circuit; and determining a sign value of the sum of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

[0018] Optionally, in the preceding aspect, the method further comprises: storing the determined magnitude of the sum in a buffer; and providing the stored determined magnitude of the sum in the buffer as the magnitude of the second modulo p input number.

[0019] Optionally, in the preceding aspect, the method further comprises: generating the first modulo p input number by a modulo p multiplier circuit.

[0020] Optionally, in any of the three immediately preceding aspects, p is an odd number.

[0021] Optionally, in any of the four immediately preceding aspects, receiving the first modulo p input number in the sign-magnitude format comprises: receiving the first modulo p input number as a binary encoded value; and converting the magnitude of the first modulo p input number to a first binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero, and receiving the second modulo p input number in the sign-magnitude format comprises: receiving the second modulo p input number as a binary encoded value; and converting the magnitude of the second modulo p input number to a second binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero.

[0022] Optionally, in the preceding aspect, the method further includes selecting between a first input value and a second input value for input of the second modulo p input number inputs into the crossbar array for non-zero values of the second modulo p input number.

[0023] Optionally, in any of the six immediately preceding aspects, the method further includes: receiving at each of a plurality of level restore circuit two outputs of a corresponding row of the crossbar multiplier circuit, one of outputs active and the other outputs inactive; and provide by each of the level restore circuits the output of the corresponding row as a strong logic value.

[0024] According to a further aspect, a multiply and accumulate circuit, comprises a multiplication circuit configured to determine a product of a first modulo p input number and a second modulo p input number from a multiplication circuit and an addition circuit. The addition circuit comprises: a buffer configured to store an output of the addition circuit; a crossbar adder circuit configured to receive a magnitude of the product of the first modulo p input number and the second modulo p input number from a multiplication circuit, receive a magnitude of the stored output of the addition circuit from the buffer, and determine a magnitude of a sum of the product of the first modulo p input number and the second modulo p input number and the stored output of the addition circuit; and a sign determination circuit configured to receive a sign value of the product of the first modulo p input number and the second modulo p input number from the multiplication circuit, receive a sign value of the stored output of the addition circuit from the buffer, and determine a sign value of the sum of the productof the first modulo p input number and the second modulo p input number and the stored output of the addition circuit.

[0025] Optionally, in the preceding aspect, the multiply and accumulate circuit further comprises the multiplication circuit, comprising: a crossbar multiplier circuit configured to receive a magnitude of the first modulo p input number and a magnitude of the second modulo p input number and determine the magnitude of the product of the first modulo p input number and the second modulo p input number from the magnitude of the of the first modulo p input number and the magnitude of the of the second modulo p input number; and a sign determination circuit configured to receive a sign value of the first modulo p input number and a sign value of a second modulo p input number and determine the sign value of the product of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

[0026] Optionally, in the preceding two aspects, the crossbar adder circuit is a (p+1 ) / 2 by (p+1 ) / 2 crossbar array of switches.

[0027] Optionally, in the preceding aspect, the switches are NMOS transistors.

[0028] Optionally, in either of the two preceding aspects, the switches are implemented as one or more of finFET transistors, Gate-AII-Around (GAA) transistors, or nanowire or nanosheet transistors.

[0029] Optionally, in any of the five preceding aspects, the crossbar adder circuit is further configured to select between a first input value and a second input value for the magnitude of the product of the first modulo p input number and a second modulo p input number for input into the crossbar array for non-zero values of the magnitude of the product of the first modulo p input number and a second modulo p input number.

[0030] Optionally, in any of the six preceding aspects, p is a prime number.

[0031] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used as an aid in determining the scope of the claimed subjectmatter. The claimed subject matter is not limited to implementations that solve any or all disadvantages noted in the Background.BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Aspects of the present disclosure are illustrated by way of example and are not limited by the accompanying figures for which like references indicate elements.

[0033] Figures 1A and 1 B are respectively block diagrams of a computer system and a microprocessor that can be incorporated into such a computer system.

[0034] Figure 2A illustrates the components of a number as represented in a Residual, or Residue, Number System (RNS) number RNS(8|7|5|3) in a binary-coded number format.

[0035] Figure 2B illustrates an embodiment for the structure of an adder, subtractor, or multiplier for numbers in the RNS format using the RNS(8|7|5|3) example.

[0036] Figure 3 illustrates components for implementing modular multiplication for moduli not of the form 2kor 2k-1 .

[0037] Figure 4 is a table to illustrate the determination of the primitive roots of a prime number of the example of p=7.

[0038] Figure 5 is a table illustrating the modulo 11 value of 2kfor the k values 0 to 9.

[0039] Figure 6 lists the primitive roots of the prime numbers up to 100 with the prime numbers having a primitive root of 2 highlighted.

[0040] Figure 7 is a table illustrating the modulo 11 value of 2kfor the k values 0 to 9 for both “wrapped” and “unwrapped” remainder values.

[0041] Figures 8 and 9 are tables respectively illustrating the modulo 7 and 23 value of 2kfor both wrapped and unwrapped remainder values.

[0042] Figure 10 lists the primitive roots of the prime numbers up to 100 with the additional available primes without a primitive root of 2 for which the methods presented here can be applied.

[0043] Figures 11A and 11 B provide the value of 2kfor both wrapped and unwrapped remainder values for selected small primes which have primitive roots of 2 that can be used in the process, specifically for modulus values of 5, 11 , 13, 19, and 29.

[0044] Figure 12 illustrates an example of a barrel shifter efficiently implemented with a crossbar switch.

[0045] Figure 13 illustrates the signed remainder table of (n-1 ) entries for the n=13 example.

[0046] Figures 14 and 15 schematically illustrate implementation of a signed modulo 13 multiplication circuit as full crossbar circuit and as a folded and split crossbar circuit, respectively.

[0047] Figure 16 illustrates the reduction in remainder size of the signed remainder table to just (n-1 ) / 2 entries for the n=13 example.

[0048] Figures17A and17B present an embodiment for a split and folded crossbar multiplier circuit.

[0049] Figure18 illustrates an NMOS only crossbar shifter circuit implementation than can be used in some embodiments.

[0050] Figure19 illustrates an example of a level restorer circuit.

[0051] Figure 20 illustrates an embodiment for a cross-connected level restoration circuit for use with the outputs of a split crossbar multiplier.

[0052] Figures 21 and 22 illustrate the operation of the cross-connected level restoration circuit embodiment of Figure 20 for a “0” input and a weak “1” input, respectively.

[0053] Figure 23 is a flowchart to illustrate the operation of the cross-connected level restoration circuit embodiment of Figure 20.

[0054] Figures 24A and 24B illustrate a portion of a further embodiment for a split and folded crossbar multiplier circuit for the n=13 example.

[0055] Figure 25 is a remainder table for modulo 23 multiplication in wrapmagnitude format.

[0056] Figures 26 and 27 respectively illustrate embodiments for sign bit to wrap bit conversion in an NMOS with level restoration and a CMOS embodiment for the modulo 13 example.

[0057] Figure 28 shows an embodiment of a wrap select circuit for product wrap- to-sign conversion for a modulo 13 example.

[0058] Figures 29A and 29B present an embodiment for a folded and split NMOS crossbar multiplier for inputs in a sign-magnitude format.

[0059] Figures 30A and 30B present an embodiment for a folded NMOS crossbar multiplier for inputs in a sign-magnitude format for a non-primitive root of 2.

[0060] Figure 31 is a flowchart for an embodiment of performing modular multiplication based on the embodiments of 17A, 17B, 24A, 24B, 29A, 29B, 30A, and 30B.

[0061] Figures 32-35 provide more detail on the ordering of inputs to the crossbar arrays and their relationship to a modulus having a primitive root of 2.

[0062] Figure 36 is a block diagram to illustrate the use of power-of-2 ordering for both folded and unfolded crossbar embodiments for RNS multiplication.

[0063] Figure 37 is a block diagram of an example of a prior art modulo 13 RNS adder.

[0064] Figures 38 and 39 schematically illustrate implementation of a modulo 13 addition circuit as full crossbar circuit and as a folded and split crossbar circuit, respectively.

[0065] Figures 40A-40D present addition tables for a modulo 13 example for when the input values are folded.

[0066] Figure 41 illustrates the folding of each of addition tables of Figures 40A- 40D.

[0067] Figures 42A and 42B are tables respectively presenting the Operand B input top and bottom triangle multiplexing for a folded and split crossbar adder circuit.

[0068] Figure 43 is a schematic representation of how the upper and lower triangles of Figures 40A-40D are arranged in a folded and split crossbar adder arrangement.

[0069] Figures 44A and 44B are an embodiment of a folded and split crossbar adder.

[0070] Figure 45 is an embodiment for a folded and split crossbar adder in which the operands are received in a 1 -hot vector format for the magnitude and the output is provided in a 1 -hot vector format.

[0071] Figures 46A and 46B illustrates of an NMOS crossbar multiple and accumulate (MAC) in a folded and split embodiment with inputs and outputs in a sign, 1 -hot vector format.

[0072] Figures 47 and 48 respectively present schematics of embodiments of the Operand B input multiplexers of Figure 44A and the output multiplexers of Figures 44B.

[0073] Figures 49A-49D illustrate the correspondence between the different choices of outputs the addition tables for the modulo 13 example for when the input values are folded.

[0074] Figure 50 is circuit diagram for an embodiment of output sign circuit of Figures 44B and 45.

[0075] Figures 51 -53 present several topologies for accumulator embodiments.

[0076] Figure 54 is a flowchart for an embodiment of performing modular addition based on the embodiments of 44A, 44B, 45, and 46B.

[0077] Figure 55 illustrates an example of a computing system configured to implement embodiments of the present technology.DETAILED DESCRIPTION

[0078] One technique to improve the efficiency of a multiplication circuit is through use of the Residual, or Residue, Number System (RNS) in which the multiplication operands are represented as a set of remainder values for a set of moduli. This allows for the multiplication to be broken down into a set of channels, one for each of the moduli, that can perform modular arithmetic within each of the channels. This approach has the advantages of using traditional implementations, but it also has a number of inefficiencies. One is that it uses two dimensional lookup tables for modular multiplication, where such tables scale as the square of the size of the modulus which means that tables can become very large. Another inefficiency is that for moduli not of the form 2kor 2k-1 , modular multiplication can be slow as it uses division in the modular reduction of the product. Another inefficiency is that for moduli of the form 2k- 1 for which somewhat efficient modular multiplications are possible, only a limited number of ‘small’ moduli exist (e.g., 3, 7, 15, 31 for k<5). A limited number of moduli will limit the range of the number which can be represented by the plurality of moduli channels. Additionally, since the moduli must be pairwise co-prime, only a single moduli of the form 2kcan be used. Larger moduli of the form 2k-1 are not desirable due to the inherent delay of carry propagation.

[0079] In embodiments presented below, the multiplication can be implemented and improved by using a crossbar multiplication circuit. In a folded and split crossbar embodiment, for modulo p operands in a sign-magnitude format, a crossbar array of size ((p-1 ) / 2) x ((p+1 ) / 2) can be used to compute the magnitude of the product with logic circuitry used to compute the sign of the product.

[0080] In other aspects, a cross-connected level restoration circuit is presented. For each row of the folded and split crossbar multiplication circuit, two outputs result, one active and at either a low logic level or a degraded high logic level and the otherinactive and floating. The cross-connected level restoration circuit restores the logic levels for the active input and returns a low logic level for the floating input.

[0081] The present embodiments of the disclosure may be implemented in many different forms and the claim scope should not be construed as being limited to the embodiments set forth herein. Rather, these embodiments are provided to convey the inventive embodiment concepts to those skilled in the art. Indeed, the disclosure is intended to cover alternatives, modifications, and equivalents of these embodiments, which are included within the scope and spirit of the disclosure as defined by the appended claims. Furthermore, in the following detailed description of the present embodiments of the disclosure, numerous specific details are set forth in order to provide a thorough understanding. However, it will be clear to those of ordinary skill in the art that the present embodiments of the disclosure may be practiced without such specific details.

[0082] Figures 1 A and 1 B, respectively, are block diagrams of a computer system and a microprocessor that can be incorporated into such a computer system that implements one or more embodiments of the disclosure. In the simplified representation of Figure 1A, 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 or mouse or even a voice recognition system to support voice commands. Common examples of output devices 103 include monitors, speakers or printers. The computer 105 includes a memory 107 and a microprocessor 120, where in this simplified representation the memory 107 is represented as a single block. The memory 107 can include ROM memory, RAM memory and / or non-volatile memory and, depending on the embodiment, can include separate memory for data and instructions.

[0083] Figure 1 B illustrates one embodiment for the microprocessor 120 of Figure 1A and also includes the memory 107. In the representation of Figure 1 B, the microprocessor 120 includes control logic 125, a processing block 140, an input interface 121 , and an output interface 123. The dashed 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 represent the flow of dataand instructions within the microprocessor 120 and between the microprocessor 120 and the memory 107.

[0084] 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 Figure 1 B, certain elements or units, such as a vector unit (VII) 146, an arithmetic logic unit (ALU) 147, and a floating-point unit (FPU) processor 149, are shown, while other elements are not explicitly shown in the combinatorial logic 143. The combinatorial logic 143 is connected to the memory 107 to receive and execute instruction and supply back 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 output device(s) 103 and / or other destinations.

[0085] 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 technology may enable efficient multiplication operations to be performed by a microprocessor. More generally, aspects of the present technology can more generally 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.

[0086] 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. Other elements of combinatorial logic 143 may alternatively or additionally include one or more multiplication circuits. The present technology is not limited to multiplication circuits or multiply-accumulate units in any particular location (in a microprocessor or elsewhere) or used for any particular purpose and can be applied wherever efficient multiplication or multiply-accumulate operations are desired.

[0087] A number of different approaches may be used to perform multiplication. The embodiments presented in the following discussion are based on the use of the Residual, or Residue, Number System (RNS). Before discussing these embodiments, some discussion is given of the Residual Number System.

[0088] The residual number system is based on the use of modular arithmetic and a property known as the Chinese Remainder Theorem. If mi, ..., n < are integers greater than 1 (often called moduli or divisors), then the Chinese remainder theorem asserts that if the ny are pairwise coprime, and if ai , ... , ak are integers such that 0 < az< mi for every / , then there is one and only one integer x, such that 0 < x < N and the remainder of the Euclidean division of x by ny is azfor every / . The consequence is that, if M denotes the product of k pairwise relatively prime moduli,M = nik-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.

[0089] To take the example of the 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 an RNS(8|7|5|3) number. The following are some example numbers in RNS(8|7|5| 3) format: Represents 0 or 840 or ■ ■ ■ Represents 1 or 841 or ■ ■ ■ Represents 2 or 842 or ■ ■ ■ Represents 8 or 848 or ■ ■ ■ Represents 21 or 861 or ■ ■ ■ Represents 64 or 904 or - - Represents -70 or 770 or - -Represents -1 or 839 or ■ ■ ■Other numbers, modulo 840, can be similarly expressed in the RNS(8|7|5|3) format. When performing arithmetic for integers in the RNS format, the operations can be ona component by component basis, using the corresponding modulus. Performing arithmetic for integers in this can have a number of advantages.

[0090] 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 Figure 2A. This includes three 3-bit slots for the mod 8, mod 7, and mod 5 components and a 2-bit slot for the mod 3 component. When performing an arithmetic operation between two numbers in this format, operations can individually be performed pair-wise on each component. This allows arithmetic operations for numbers in such an RNS format to be separated out into independent RNS channels, as illustrated in Figure 2B.

[0091] Figure 2B illustrates an embodiment for the structure of an adder, subtractor, or multiplier for numbers in the RNS format using the RNS(8|7|5|3) example that may be implemented by a processor. At top are shown two operands, Operand 1 and Operand 2, in the RNS(8|7|5|3) format that can be stored in corresponding registers 2111 and 2112, where these operands will be converted to the RNS format previously in 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 201 , mod-7 unit 203, mod-5 unit 205, and mod-3 unit 207 to undergo pair-wise operations in each RNS channel using the corresponding modular arithmetic. The components of the results can then be stored in the result register 221 , which can be used in subsequent RNS computations or converted out of the RNS format when needed.

[0092] The RNS approach illustrated with respect to Figure 2B has a number of advantages. It solves the carry-propagation problem, as carry-propagation is limited to a few bits. It is faster, as for example, 4x4 multipliers are considerably more than 4 times simpler than a 16x16 multiplier. It is also smaller 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, overflow detection) are more difficult, but the following is concerned with multiplication, where it can have a number of advantages.

[0093] 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. If the objective is to reduce the addition / multiplication execution time, then a large number of small moduli is desirable, as the execution time is determined by the largest modulus and Power / Area of multipliers proportional to n2.

[0094] One approach to selecting moduli is to use moduli of the form 2kor 2k-1 for ease of implementation. In this approach the total number of bits can be minimized by using an efficient binary representation — i.e., maximize the dynamic range by selecting a modulus, mi, that equals 2kor is very close to it (2k-1 ), for example. Only a single mi of the form 2kbecause the moduli must be relatively prime. Moduli mi of the form (2k-1 ) work 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-1 = (2^ - 1 )(2k / 2+1 ) for even values of k.

[0095] 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-1 for ease of implementation. One set of possible moduli are then rrij = 31 , 63, 127, 255, 256. The dynamic range M is adequate as M / 232= 3.7799 and this set of moduli are 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 binary adder can be used, with the residue read directly from the LSBs. For moduli of the form 2k-1 , an ‘end-around carry’ adder can be used.

[0096] Another approach is to use the smallest prime moduli for which a symmetric complete residue system exists. One example for a 32 bit integer are the nine moduli rrij = 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 are 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 advantages of smaller moduli2 begin faster and that area / power are reduced as this is proportional to log^m,) . However, implementing multiplication for moduli not of the form 2kor 2k-1 has some complications, as can illustrated with respect to Figure 3.

[0097] Figure 3 illustrates components for implementing modular multiplication for moduli not of the form 2kor 2k-1 . Multiplier block 301 receives two n-bit operands A and B and multiplies these together 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 block 303. However, implementing modular reduction requires division, which is a time consuming multistep operation that slows down the process. To avoid this problem, the embodiments below present a simple and efficient method to multiply moduli not of the form 2kor 2k-1 .

[0098] The embodiments presented below involve the use of the primitive roots of a number in modular arithmetic: Given gx(mod p) and where p is a prime number, the question is whether there a value of g that makes 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: Y = gx(mod p). This can be determined though use the Euler Totient Function cp(p) that counts the positive integers up to a given integer p that are relatively prime to p (i.e., has no greatest common divisors except 1 ). For prime numbers, cp(p) = p-1. The factors, f, of cp(p) are then determined and, for each generator g, gf(mod p) is tested for all factors, f. If any gf(mod p) = 1 , then g is not a primitive root of p. The table of Figure 4 illustrates an example.

[0099] Figure 4 is a table to illustrate the determination of the primitive roots of a prime number of the example of p=7. If p=7, cp(7) = p-1 = 6, which has factors f = 2, 3. In the table for p=7, the first row are the generators and the first column the powers x. The table values are then the corresponding generator raised the power x. As shown in the table, g3= 1 for both g = {2,4} and g2= 1 for g = {6}. Consequently, 2, 3, and 6 are not primitive roots of p=7 and we find that by testing g{2 3}(mod 7) that the primitive roots are Y = 3, 5.

[0100] In the following, primes with a primitive root of 2 will be or particular interest, since, for primes with primitive roots of 2 as moduli, modular multiplication can be performed by rotating of 1 -hot vectors, i.e., a binary valued vector all 0s with a single 1 entry. This can be illustrated by the table of Figure 5 for the example of p=11 .

[0101] Figure 5 is a table illustrating the modulo 11 value of 2kfor the k values 0 to 9. The top row is the values of k, with the corresponding value of 2kbelow. The mod11 reductions of 2k, or remainders, are in the bottom row. As the prime number 11 has a primitive root of 2, each of the mod 11 remainders of 2kare different and that all remainders are represented with the exception of 0. (Note that k=0 corresponds to 2°=1 and that 0 would be represented as a vector of all zeros.)

[0102] An example calculation can be the multiplication of 3 (mod 11 ) x 6 (mod 11 ). The first operand is represented as a 1 -hot vector of (p-1 ) elements in which the location of the 1 is based on the location of the operand in the bottom row, so that for the example of 3, this is represented by 1 -hot vector 0000000010. The second operand is represented by a rotate amount, where the amount of rotate is, for an operand value of k, the modular reduction of 2k, so that for the example of 6, the amount of rotate is amount of 9. To compute the product of the operands, the 1 -hot vector of the first operand is right rotated by the rotate amount of the second operand, so that to compute 3 (mod 11 ) x 6 (mod 11 ), 0000000010 is rotated right by 9 bits. The result is 0000000100 which corresponds to 7, which is the correct result. As in this example, this approach allows for modular multiplication with respect to prime numbers that have a primitive root of 2 to be multiplied using a simple rotation.

[0103] Figure 6 lists the primitive roots of the prime numbers up to 100. The primes with a primitive root of 2 and boxed in a darker line. As can be seen, the primes (up to 100) which have a primitive root of 2 are: 3,5,11 , 13,19,29,37,53,59,51 ,67,83. Using a set of these primes as the moduli for RNS numbers, embodiments given below use modular multiplication to efficiently be performed using only the (positive, or “unwrapped”) remainder values, such as given on the bottom line of the table of Figure 5 for the p=11 . In other embodiments, both unwrapped and wrapped remainders can be used, as can be illustrated with respect to Figure 7.

[0104] Figure 7 is a table illustrating the modulo 11 value of 2kfor the k values 0 to 9 for both “unwrapped” and “wrapped” remainder values. Figure 7 repeats the elements of Figure 5, but also adds a bottom line for wrapped remainder values. For each unwrapped remainder x, there exists a wrapped remainder, y, such that y = x - p, where p is the moduli, y is called the additive inverse of x. So, for the p=11 example, instead of using the number set {1 , 2, 4, 8, 5, 10, 9, 7, 3, 6}, alternatively the combined unwrapped number set {1 , 2, 4, 8, 5} and wrapped number set {10, 9, 7, 3, 6} which are the additive inverses of the unwrapped number set, can be used.

[0105] Considering again the example of multiplying 3 (mod 11 ) x 6 (mod 11 ) and just looking at the 1 to 4 columns, 3 is represented by 1 -hot vector 00010 for a wrapped remainder. 6 is in the wrapped remainder row as corresponding to k=4, or a rotate amount of 4. The product is then computed by rotating 00010 right by 4 bits, or 00100. This corresponds to k=2, so that result corresponds to either +4 (in the unwrapped row) or 7 (in the wrapped row). The determination of which of these values to select is based on whether the operands were selected from the unwrapped or wrapped row: Assigning “0” for a unwrapped row selection and “1” for a wrapped row selection, the operand signs can then be XNOR-ed for result selection. In this example, both operands have a sign value of 1 , so 1 XNOR 1 = 1 , so the wrapped value 7 is selected, which is the correct result. An XNOR operation is used since the process has taken a right hand side rotate (positive moduli of powers of 25to 29) and replaced them with wrapped complements of the moduli.

[0106] The use of wrapped remainders along with unwrapped remainders can provide additional advantages. One of these is that the rotate register size has been cut in half. Another is that this can remove the need for the primitive root to generate all values, but only half of them. As discussed above, when only using the unwrapped remainders, the usable primes needed to have a primitive root of 2, but being able to use both unwrapped and wrapped remainders expands the number of usable primes. Examples of this can be illustrated with respect to the tables of Figures 8 and 9 for the primes 7 and 23.

[0107] Figures 8 and 9 are tables respectively illustrating the modulo 7 and 23 value of 2kfor both unwrapped and wrapped remainder values. These figures are laid out similarly to Figure 7, but also include lower row “Check” listing the sum of the unwrapped and wrapped remainder values directly above to check that they add up to 7 or 23, respectively. As can be seen from Figure 6, modulo 7 has primitive roots 3, 5 and modulo 23 has primitive roots 5, 7, 10, 11 , 14, 15, 18, 19, 21 , 26, 27. Neither has a primitive root of 2 and, as seen on the remainder lines of Figures 8 and 9, the remainders repeat after three k values for modulo 7 and after 11 k values for modulo 23. So only half the roots are available if only unwrapped remainders are used, but if unwrapped / wrapped remainder values (a set of numbers and their additive inverses) are used, this is enough.

[0108] The multiplication process using unwrapped and wrapped remainders for such roots can be illustrated by the example of multiplying 3 (mod 23) x 6 (mod 23). Referring to the remainder lines, the operand 3 is represented by the 1-hot vector 00000000100 from the unwrapped line. Again referring to the remainder lines, the second operand 6 is in the unwrapped remainder line and is represented by a rotate amount of k=9. The product is then computed by rotating 00000000100 right by 9 bits, with the result of 00000010000, which corresponds to 18 or wrapped 5. Again using the sign encoding of “0” unwrapped, “1” wrapped, the choice can be made by XOR- ing the sign values: 0 XOR 0 = 0, so 18 is selected, which is the correct result. In the non-2 primitive root case, XOR (rather than XNOR) is used because the wrapped complements of the moduli on the left side of the table of Figure 9 represent the “true” unwrapped moduli values on the right side.

[0109] This technique allows for some, but not all, primes without a primitive root of 2 to be also used, complementing the primes with a primitive root of two and allowing the use of more smaller primes. However, this cannot be done for all primes without a primitive root of 2. The table of Figure 10 repeats the table of Figure 6, but now highlight the added primes.

[0110] Figure 10 lists the primitive roots of the prime numbers up to 100 with the additional available primes without a primitive root of 2 highlighted. As highlighted, the added primes are 7, 23, 47, 79, 97. Not all of the primes have this property, however, such as 17. Using available primes that are 6 bits or less, this gives a dynamic range 0f M = 2x3x 5x7x 11 x 13 = 30,030 = 1.83 x 2A14. Using up to 7 bits gives a dynamic range 0fM = 2x3x5x7x11 x 13x 19x23x29 = 380,570,190 = 1.42 x 228. Extending up to an 8-B it range, M =2x3x5x7x11 x13x19x23x29x37x 47 x 53 x 59 x 61 = 1.26 x 1017= 1.75 x 256. Consequently, use of an RNS implementation can allow for multiplication of quite large number with relatively small circuitry.

[0111] Figures 11A and 11 B provide the value of 2kfor both unwrapped and wrapped remainder values for additional smaller primes that can be used in the process, specifically for modulus values of 5, 11, 13, 19, and 29.

[0112] The following discussion considers embodiments for the circuitry to implement the residual number system multiplication techniques described above. Specific embodiments include a crossbar based multiplication circuit that is both scalable and efficient. Relative to prior art modular multiplication circuits, such as combinational multipliers or Wallace tree multipliers, the crossbar based approach presents smaller and more power efficient circuitry.

[0113] Figure 12 illustrates an example of a barrel shifter efficiently implemented with a crossbar switch. A barrel shifter is a digital circuit that can shift a data word by a specified number of bits without the use of any sequential logic and can be used to present a relatively simple implementation of a crossbar circuit as an introduction to residual number system crossbar multiplication units presented further below. The example of Figure 12 is a 4X4 example, with an input (xo, xi, X2, xs) that is a 1 -hot vector (i.e., one entry “1”, the rest “0”), a shift count of 0-3, and an output (yo, yi, y2, ys) corresponding to the input shifted (mod 4) by the shift amount. The shift count is received at a decoder 1201 that converts the shift count to another 1 -hot vector specifying a shift amount of either shift 0, shift 1 , shift 2, or shift 3. The barrel shifter is a square array of switches (4x4 in this example) connected between the input (xo, xi , X2, xs) vector and the output vector (yo, yi , y2, ys) and controlled by the shift value. The shift values run diagonally upward across the array, looping back from the bottom. For example, switch 1203 connects input xo to output ys and is controlled by the shift 3 input, that an input of (1 , 0, 0, 0) becomes an output of (0, 0, 0, 1 ) in response to a shift of 3. In the example of switch 1205, this connects the input of X3 to the output of yi and is controlled by shift 2 such that an input of (0, 0, 0, 1 ) becomes an output of (0, 1 , 0, 0) for a shift of 2. Note that in the arrangement of Figure 12, the inputs run from xo to X3 left to right, with the shift and output indices increase from bottom to top.

[0114] The array structure of the crossbar switch can be made quite dense, similarly to a DRAM device. In terms of RNS multiplication, for a modulo value of n, rather than an (n-1 )x(n-1 ) array, multiplier optimization based on the unwrapped / wrapped approach can reduce this to an (n-1 ) / 2 x (n-1 ) / 2 array for a 75% area savings. By use of a single gate per switch, the circuit can be fast and, such as by using a single NMOS pulldown device, small. Although the size of the array grows as n2, this can be mitigated by use of a “folded” crossbar arrangement based onwrapping, as described below with respect to Figures 14 and 15, for example. The crossbar switch can also result in degraded logic “1” output levels when only NMOS pass gates are used, but level restoring circuitry as presented below can overcome this problem.

[0115] Figure 13 illustrates both wrapped and unwrapped remainder values (wrapped values are the additive inverses of the unwrapped values) for the example of modulus value of 13 when using negative remainders. Figure 13 repeats the mod 13 table of Figure, but with the remainders greater than 6 replaced with negative values: for example, -1 replaces 12, -2 replaces 11 , and so on. In this arrangement, the wrapped values (Wrap = 1 row) are the modulo additive inverses of the unwrapped values (Wrap=0 row). Not that in this arrangement, the wrap bit is not always the same as the sign bit, such as the k=3 column where the Wrap = 0 value is -5 and the Wrap = 1 value is +5. This distinction is discussed in more detail below.

[0116] Figures 14 and 15 schematically illustrate implementation of a modulo 13 multiplication circuit as full crossbar circuit and as a folded and split crossbar circuit, respectively. In the full crossbar implementation of Figure 14, the input vector is the (n-1 ) component 1 -hot input vector, the rotate amount the rotate amount as an (n-1 ) component 1 -hot vector, resulting in a crossbar multiplier of size (n-1 )2, avoiding the larger (n-1 ) component 1 -hot output vector. Figure 14 shows this n=13 example of Figure 13, but with negative and positive values used corresponding to the Wrap=0 and Wrap=1 values for k=0-5.

[0117] To reduce the size of the crossbar array, a folded and split crossbar array can be used, in which only the Wrap=0 values for k=0-5 are used. In this case, the crossbar array is folded, in that the product is between only one of + / - 1 , 2, 3, 4, 5, 6 is used, and split, in that array is split into a wrapped and unwrapped halves with the outputs divided between the wrapped and unwrapped values. This reduces the array size to ((n-1 ) / 2)2, or the size of the full crossbar. In the n=13 case, the values used are then 1 , 2, 4, -5, 3, and 6, but where the sign needs to be adjusted as described in more detail below.

[0118] Considering the full crossbar of Figure 14 and the folded and split crossbar of Figure 15 further, in a full crossbar implementation, each non-zero value for bothinputs has a corresponding input line after decoding. In a folded crossbar implementation, one or more of the input lines for each input is shared by a pair of input values, where an additional piece of information (e.g., a sign or wrap value) is used to distinguish between the pair of values sharing an input line. As illustrated in Figure 15, and as used in the following discussion, folded is used to refer to when the inputs have been fully folded, or folded in half, so that for each input line for both inputs is shared by two of the non-zero inputs. (For the treatment of zero inputs see, for example, Figures 29A and 29B.) However, intermediate degrees of folding, where less than all of the input values are paired up are possible as alternate embodiments. The crossbar is split in that part of the array corresponds to wrapped values and part corresponds to unwrapped values.

[0119] The use of a folded and split crossbar implementation reduces the size of the needed crossbar array from (n-1 )2to ((n-1 ) / 2)2, or a quarter in size, requiring less space on the logic die. Although the size of the crossbar array is reduced by a quarter, as described with respect to Figures 29A and 29B, for example, additional circuitry is needed to sort out the sign values of the inputs. Consequently, for smaller moduli, a full crossbar implementation may take up less area than a folded and split crossbar implementation. For example, in a RNS arithmetic unit, the optimal implementation may use a full crossbar for, say, modulo 5 and below, with the folded and split crossbar used for modulo 7 and above.

[0120] Figure 16 illustrates the reduction in remainder size of the remainder table to just (n-1 ) / 2 entries for the n=13 example. The recued number of values are those used in the folded and split crossbar embodiment of Figure 15 for the inputs, where the wrap or sign value is accounted for by additional logic circuitry, an example of which is shown in Figure 17B.

[0121] Figures17A and17B present an embodiment for a split and folded crossbar multiplier circuit for the n=13 example, where the two figures shows different parts of the same circuit. The circuitry includes the crossbar barrel shifter that calculates a product magnitude and the circuitry to calculate product wrap value, where the magnitude and wrap value together give the final product value. Approximately half of the crossbar cells (those above lower left-to-upper right diagonal with black fill, such as 1711 and 1717) calculate a wrap condition, which indicate that Operand A has beenwrapped off the end of the barrel shifter by rotation by Operand B. The other crossbar cells (those on and below the diagonal with no fill, such as 1713 and 1715) are the products that have not wrapped off the end of the barrel shifter.

[0122] The inputs to the crossbar array of operand A and operand B are received as magnitude values, where if not already in the appropriate 1-hot vector format (such as from a previous operation in this format) these are respectively converted in Decoder A 1703 and Decoder B 1701. These inputs can then be applied to the crossbar array as described above with respect to Figure 15. In the folded and split arrangement though, the outputs from the wrapped switches and the unwrapped switches in each row are kept separate in each row to use in determining the product wrap value. For example, in the top row, the output of wrapped element 1711 goes to the lower output line of the first row while the output of unwrapped element 1713 goes to the upper output line of the row. Similarly, in the third row wrapped switch 1717 goes to the lower line and unwrapped switch 1715 goes to the upper line. (As the bottom row has only unwrapped values, it only has a single output.)

[0123] Following the outputs from the barrel shifter on to Figure17B, the pairs of outputs from each row of the barrel shifter go a corresponding one of the OR gates 1721 , so that if the output on either of the lines is a “1”, the combined result is a “1”. This results in the output in a 1-hot vector format. In this unwrapped / wrapped n=13 embodiment, the different components correspond to the shown values of 1 , 2, 4, 5, 3, 6, where, since all elements of the bottom row are unfolded, an OR gate is not needed for the bottom row. At this point, the product magnitude is in the 1-hot vector format and, if the magnitude is not to be kept in this format (such as for a subsequent operation), a corresponding one of the set of AND gates 1725 received the values. The second input of each of the AND gates is the corresponding value in a 4-bit decimal value, i.e. , 4’d1 is 1 in the format (0001 ). Here, a value is used as n=13 and 4 bits are needed to express 13 as a binary number. The resultant outputs of the AND gates 1725 are then the product magnitude.

[0124] The series of AND gates 1723 are part of the product wrap determination circuitry. These each receive the output of the corresponding OR gate 1721 with its 1 -hot vector value and the other input corresponding to the lower line of the row. The outputs of the AND gates 1723 are then inputs to the OR gate 1733, so that if any ofthe AND gates 1723 output a “1 ”, the OR gate provides a “1 ” for the wrap select values. The operands A and B also have, in addition to the magnitude inputs, a wrap input in the folded embodiment. The operand A wrap bit and operand B wrap bit are inputs to the XOR gate 1731 , whose output then is combined with the wrap select value in XOR gate 1735 to generate the product wrap output value. Alternately, the circuitry of Figure 17B can be replaced with the circuitry of Figure 29B as presented below.

[0125] Figure18 illustrates an NMOS only crossbar shifter circuit implementation that can be used in some embodiments. By use of a single NMOS for each element of the crossbar shifter array, such as NMOS1801 connected between operand A[0] input and output Out[0] and with its control gate connected to operand B[0], the size the array can use a smaller area than an NMOS / PMOS transmission gate implementation. The crossbar circuit array devices can be implemented in any semiconductor technology, including but not limited to planar transistors, finFET transistors, and ribbonFET, gate-all-around (GAA) or nano-wire or nano-sheet transistors.

[0126] Considering the NMOS implementation of Figure18 further and looking NMOS1801 , when A[0] is at ground or logic ‘0’ and B[0] is at logic T or VDD, Out[0] will also be at ground, and so definitely at “0”. However, when both of A[0] and B[0] are a “1” value of VDD, Out[0] will not be the full VDD value; rather, if the threshold voltage of the NMOS1801 is Vth, then Out[0] will be degraded to VDD-Vth and a “weak” “1” logic value. To maintain the logic values as they propagate through the arithmetic unit, the “1” logic values need to be restored to a strong “1” value of the high logic level VDD by use level restorer.

[0127] Figure19 illustrates an example of a level restorer circuit. The circuit acts as an inverter, but with well-defined output logic values of either ground for “0” or VDD for “1”, even for a weak “1” input. When receiving a “0” value or ground, PMOS1903 will be on and NMOS1901 off, so that the Out value will be VDD and the full “1” logic level and, since Out is high, PMOS1905 is off and the input stays at ground. When receiving a weak “1” input that is reduced from VDD, NMOS1901 may not fully be on and PMOS1903 may not fully be off, resulting in the Out value being pulled down somewhat, but not fully to a well-defined “0” value of ground. As the Out is also connected to the gate of PMOS1905, this will turn PMOS1905 at least partially on,raising In value and taking Out fully to a strong “0” value of ground. Although such a level restorer will work with a standard crossbar shifter, the situation is more complicated for the split crossbar arrangement.

[0128] Figure 20 illustrates an embodiment for a cross-connected level restoration circuit for use with the outputs of a split crossbar multiplier. At left of Figure 20 is a portion 2001 of a split crossbar showing four elements of one row. The right most input / SOo (hereis used to represent NOT, which is shown in the figures as a bar on top of the name) is unwrapped and connected to the output of / xbar and the other three inputs are wrapped and connected to the output of inverse of / (xbar_wrap). If these two outputs were independent, they could respectively use the level restoration circuit of 2020 or 2025 to restore weak “1” values of (VDD - Vth) to the full VDD logic level; however, the two values are related in that the gate selects on one output will be always inactive, causing high impedance output on that crossbar output section. To correct these related output values, the cross-connected level restoration circuit is introduced, with an embodiment shown at 2021 .

[0129] The embodiment of Figure 20 includes cross-connected pull-ups to restore low-z state on both outputs. For the xbar output, at the input of level restoration circuit 2023 the pull-ups of PMOSs 2031 and 2033 respectively have their gates connected to the input and the output of level restoration circuit 2025. For the xbar_wrap output, at the input of level restoration circuit 2025 the pull-ups of PMOSs 2035 and 2037 respectively have their gates connected to the input and the output of level restoration circuit 2023. As will be discussed with respect to Figures 21 and 22, in the embodiment of Figure 20, PMOS 2033 and PMOS 2037 and the other pull-up PMOSs can be weak devices relative to the transistors forming the inverters of 2023 and 2025 and relative to other elements in the multiplication circuit. The circuit 2021 is needed since the split crossbar circuit is being used to compute two separate results with the same crossbar circuit: the crossbar to calculate a product magnitude; and the same crossbar also generates the wrap indication.

[0130] Considering Figure 20 further, as the second input of the split crossbar is a 1 -hot vector, only one of S1o, S1 i , SI2, and SI3 will be high, with the others all at ground, so that only one of the columns will be ON. Thus, if S1o is high, S11 , SI2, and SI3 are all at “0” and the input / (xbar_wrap) will be left to float, while / xbar will bedetermined by / SOo. Consequently, if S1o is high, if / SOo=O, then / xbar=“0”; and if / SOo=1 , then / xbar is a weak “1”, where, as discussed above, the full “1” value of VDD will be degraded or weakened to the reduced value of (VDD-Vth), where Vth is the threshold voltage of the crossbar NMOS switch. Similarly, as the cross-connected level restoration circuit 2021 is symmetric between its inputs, if S1o is low, / xbar is floating and / (xbar_wrap) will either be a “0” or a weak “1” based on the value of / SO3, / SO2, or / SOi respectively depending on which of S11, SI2, or SI3 is on. For the floating input, the cross-connected level restoration circuit 2021 will output a “0” for either a ”0” or weak “1” at the non-floating input; and for the floating input, a ”0” or weak “1” will respectively result in a (full VDD value) “1” or a “0”. This operation is illustrated with respect to Figures 21 and 22.

[0131] Figures 21 and 22 illustrate the operation of the cross-connected level restoration circuit embodiment of Figure 20 for a “0” input and a weak “1” input, respectively. In Figures 21 and 22, the / (xbar_wrap) input is floating and the / xbar input is either “0” or a weak “1”, corresponding to the S1o=“1” case. Based on the symmetry of the circuit’s topology between the / xbar and / (xbar_wrap) paths, for the S1o= “0” case the value would be swapped between the upper path and the lower path.

[0132] In Figure 21 , the input / xbar = “0” so that, as discussed with respect to Figure 19, the output from level restorer 2023 is xbar= “1”. As xbar= “1”, the pull-up PMOS of level restorer 2023 is OFF. Looking now at the cross-coupled pull-up devices and the / (xbar_wrap) path, as / xbar = “0” is the gate voltage of PMOS 2035, PMOS 2035 is ON and the floating input of level restorer 2025 is now “1”, so that xbas_wrap= “0” and the pull-up of level restorer 2025 is also on. Since xbar= “1”, the pull-up PMOS 2037 is OFF and does not contribute. PMOS 2031 now has its gate set to the high “1” level, it is OFF and does not contribute to the input to the top path level restorer 2023.

[0133] With respect to PMOS 2033, as xbar_wrap is “0”, it will also be ON. However, PMOS 2033 is formed to be a weak device relative to the other transistors setting the / xbar level so that, even though it is ON, its output to the / xbar input to level restorer 2023 is overridden by the “0” value provided at the input by / SOo. For example, PMOS 2033 can be sized to provide low current when ON, as represented by the broken line arrow. Similarly, in the symmetric embodiment of Figures 20, PMOS 2037will be a similarly weak device. (Depending on the embodiment, the other pull-up PMOSs can also be relatively weak devices.) Consequently, when / xbar= “0” and / (xbar_wrap) is floating, xbar is a strong “1” and xbar_wrap= “0”.

[0134] Figure 22 considers when / xbar is a weak “1” and / (xbar_wrap) is again floating. As discussed with respect to Figure 19, the output from the level restorer 2023 will be xbar= “0”, with the PMOS back to the input (corresponding to PMOS 1905 of Figure 19) ON, taking the input to a strong “1”. As / xbar is now a strong “1”, 2035 is OFF, but as xbar= “0”, PMOS 2037 is ON. However, as PMOS 2037 is a relatively weak device, this results in a weak “1” at the input to level restorer 2025, but this is turned to a strong “1” by level restorer 2025, so that the output xbar_wrap= “0”. Consequently, PMOS 2031 is OFF and does not contribute, while PMOS 2033 is ON, further strengthening the “1” at / xbar. Consequently, when / xbar is a weak “1” and / (xbar_wrap) is floating, xbar= “0” and xbar_wrap= “0”.

[0135] Because of the symmetry of the cross-connected level restoration circuit 2021 , when / (xbar_wrap)= “0” and / xbar is floating, xbar_wrap is a strong “1” and xbar= “0”; and when / (xbar_wrap) is a weak “1” and / xbar is floating, xbar_wrap= “0” and xbar= “0”. In this way the circuit 2021 will return a “0” for the floating input that is to be ignored, while acting as a level restored for the active input, returning a strong “1” for a “0” input and a “0” for a weak “1” input.

[0136] Figure 23 is a flowchart to illustrate the operation of the cross-connected level restoration circuit embodiment of Figure 20. At 2301 , the cross-connected level restoration circuit 2021 receives first and second inputs (e.g., / xbar and / xbar_wrap), where either one of the inputs can be active and the other one of the inputs is inactive. The inactive input is floating and the active input either at a low logic value (“0”) or a degraded high logic value (weak “1”). At 2303 and 2305 the corresponding outputs for the two inputs are generated. For the active input, at 2303 the corresponding output is generated by the level restore circuit of the active input, either 2023 or 2025, resulting full high logic level (“1”) for a low logic level input or a low logic level (“0”) for the weak “1” of the degraded high logic input. The levels on the active input’s path then bias the cross-connected pull-up transistors (e.g., PMOSs 2031 , 2033, 2035, 2037) to set the output corresponding to the inactive input to a low logic level. Although presented here as being used for the split and folded crossbar circuit for modularmultiplication, it can be applied to similar circuits, such as other arithmetical circuits such as a modular adder. More generally, when a row of logic circuitry provides a pair of related outputs for two subsets of switches in which only one is active at a time, the cross-connected level restoration circuit can be used.

[0137] Figures 24A and 24B illustrate a portion of an embodiment for a split and folded crossbar multiplier circuit for the n=13 example. Relative to Figure 17A, Figure 24A has NMOSs for the switches, adds in the cross-connected level restoration circuits, and adds in 0 detection. More specifically, in the split crossbar array, each of the switches of Figure17A is now implemented as a single NMOS, such as a finFET, ribbonFET, gate-all-around (GAA), or nano-wire or nano-sheet transistors, for example. With 0 detection, there are (p+1 ) / 2 second inputs and the split and folded crossbar multiplier circuit is of size (p-1 ) / 2 x (p+1 ) / 2.The operand B magnitude decoder now includes a 0 decode value 2451 . Each also now has a NMOS switch in column 2453 whose gate is connected to the 0 decode value 2451. The zero decode in crossbar ensures low-impedance on one of the two sets of crossbar outputs. Consequently, when operand B has zero magnitude, each of the unwrapped outputs will be pulled high (e.g., VDD-Vth), which will then be turned into a “0” by the subsequent level restores 2443.

[0138] The cross-connected level restorers 2443 are connected to receive the pair of outputs of each row to provide well-defined logic outputs of either ground or VDD, described above with respect to Figure 23. As the cross-connected level restorers 2443 also invert their input values, each operand A input now receives an inverter 2441 to cancel out the inversion of the level restorers 2443. As discussed above with respect to Figure17A, the bottom row of the shifter array has all unwrapped switches, so that a more conventional level restore circuit 2445, as in Figure 19. Alternately, if a cross-connected level restored is used at 2445, to provide the 1 -bit value of the operand A, a “1” value (1 ’b1 ) can supplied to as the second input, as this value will be inactive when the first input is active. The outputs of the level restore circuits 2443 can then pass on to the rest of the circuit, which can be implemented as in Figure 24B.

[0139] Figure 24B repeats the elements of Figure 17B, which are similarly numbered (e.g., XOR 1741 is now XOR 2431 ), but adds the three input AND gate 2439. AND block 2439 insures that the output product sign is zero when either of theinput sources are zero. Put another way, this is a three input AND gate. One input is the output of XOR gate 2435, which represents the output sign when both sources are non-zero. The other two inputs to the AND gate 2439 have inverted inputs, which mean that both of these inputs (Operand A Decode 0, Operand B Decode 0) must be inactive (logic 0) for the output sign bit from the XOR gate 2435 to pass through to the output. If either of these two inverted inputs are logic T (indicating that one or both of the sources equal to zero), then the product sign will be forced to zero. Alternately, the circuitry of Figure 24B can be replaced with the circuitry of Figure 29B as presented below.

[0140] The embodiments for crossbar multipliers discussed so far have used a wrap-magnitude encoding. The following embodiments instead consider a signmagnitude encoding. The sign-magnitude encoding format can be implemented with less decoding than binary encoding in the folded multiply crossbar, since instead of needing to decode (for example) “1” and “12” separately from binary and then OR-ing them, there is only a single decode (for magnitude). Additionally, it is easier to convert operands in a binary encoding to / from the sign-magnitude RNS encoding than trying to convert binary to / from a ‘wrap’-magnitude encoding, as the “wrap” bit does not have any standard meaning outside RNS folded crossbar multiplication, whereas the sign bit does. Figures 16 and 25 provide examples of remainder tables that can be used to illustrate converting input sign bits to wrap bits.

[0141] Figures 16 and 25 are respectively remainder tables for modulo 13 and 23 multiplication in wrap-magnitude format. In Figure 16, the “-5” / “5” values are bolded to indicate that the sign bit does not equal the wrap bit. In Figure 25, the columns with the lighter background indicate remainders for which the sign bit does not equal the wrap bit. Therefore, when decoding the inputs, if the inputs match an entry for which the sign and wrap bits differ, a “flip” bit can be set to be XOR-ed with the sign bit. As the decodings, including the special case of zero, are 1 -hot vector decodings, the multiplier can be implemented as an NMOS network (with level restoration) to perform this logic OR function or as a full CMOS circuit using with 1 -hot inputs. Figures 26 and 27 illustrate embodiments for these two implementations.

[0142] Figures 26 and 27 respectively illustrate embodiments for sign bit to wrap bit conversion in an NMOS with level restoration and a CMOS embodiment for themodulo 13 example, where the MOSFETs can again be implemented in a FinFET embodiment. Referring back to Figure 16 and considering the Wrap=0 line, the only negative value is for 5, while the other values (and the unshown 0 value) are all nonnegative. To perform a sign bit to wrap bit conversion in an NMOS embodiment, the 5 input pulls down the output ( / flip) to ground, while the other input values pull up the output up to VDD - Vth. To restore the full logic values, a level restorer 2601 converts the output / flip to flip, so that in the NMOS (with level restoration) implementation the inverses for the input can be used to undo the inversion. For a CMOS embodiment, as in Figure 27, the inverse of the 5 value is used to supply the gate voltage of a PMOS pull up, this the other (non-negative) values are all applied to a corresponding gate of an NMOS pull down. In the CMOS case of Figure 27, a level restorer is not needed to provide the final output flip value as the logic values at the output are well-defined and level restoration is not needed.

[0143] Figure 28 shows an embodiment of a wrap select circuit for product wrap- to-sign conversion for a modulo 13 example. At upper left are shown the crossconnected level restoration circuits for the outputs of the crossbar array, which then serve as inputs to the wrap select circuity to determine the product sign. The wrap select circuit includes a determination circuit 2801 in an NMOS embodiment that then is followed by a level restoration circuit 2803 similar to those described above to provide well-defined logical values for the wrap select output. Other embodiments can be CMOS based, although these embodiments would typically require greater area and complexity. The circuit of Figure 28 selects the final wrap bit from the crossbar product outputs that the multiplier circuit uses to create the product sign bit and is scalable with the folded crossbar. When the product row that matches the result, either xbar or xbar wrap will be a logic “1”, while for all other product rows, both of xbar and xbar wrap will be a logic “0”. Xbar 5 is the unwrapped output for output value 5 and is used (rather than xbar wrap 5) because the wrap bit for output 5 is different from the sign bit for output 5 (i.e., +5 is wrapped, while -5 is unwrapped for modulo 13). The determination circuit 2801 also includes the “0” decode to ensure that all product outputs are covered.

[0144] Figures 29A and 29B present an embodiment for a folded and split NMOS crossbar multiplier for inputs in a sign-magnitude format for the n=13 example, wherethe two figures shows different parts of the same circuit. Figure 29A repeats the elements of Figure 24A, with a decoder 2901 to provide Operand B in a 1 -hot format if received as a magnitude and with a decoder 2903 to provide Operand A in a 1 -hot format if received as a magnitude. The 1 -hot format version is optimal for chained (i.e., sequentially dependent) multiplications as it eliminates 1-hot encoding / decoding to / from binary and if an operand is received the 1 -hot format, the corresponding decoder (2901 , 2903) is not needed. Relative to Figure 24A, the embodiment of Figures 29A includes elements related to the operand sign inputs. For operand B, the input values in the 1 -hot vector format are inputs into the Sign to Wrap circuit 2913, such as illustrated by the embodiments of Figure 26 or 27. The result sign flip value for operand B and sign value for operand B are then inputs to the XOR gate 2915. Similarly for operand A, the input values in the 1-hot vector format and the 0 value from operand B are inputs into the Sign to Wrap circuit 2911 , that can also be as illustrated by the embodiments of Figure 26 or 27. (The XOR gate corresponding to 2915 is in Figure 29B.) The operand A sign flip value, the outputs of the lever restorers, and the XOR 2915 continue on to the circuitry of Figure 29B.

[0145] In Figure 29B, relative to Figure17B the OR gates 2921 and the AND gates 2923 serve the same respective functions as the OR gates 1721 and the AND gates 1725. If the output is provided in a 1 -hot vector format, such as for subsequent multiplications, the AND gates 1723 for the encoding to binary format is not needed for the product magnitude. The equivalent of the AND gates 1723 are no longer present and the OR 1733 is replaced by wrap select circuit 2925, where Figure 28 is one embodiment for wrap select circuit 2925. Both of the inputs to the OR gates 2921 are provided to the wrap select circuit 2925. The product sign value is generated by the XOR logic circuit 2927, which receives the wrap select value from the wrap select circuit 2925, and AND logic 2929. Additionally, XOR logic circuit 2927 also receives the output of XOR 2915 for the B operand and output of XOR 2917 for the A operand, where XOR has inputs of the operand A sign flip value from sign to wrap circuit 2911 and the operand A sign value. The output of XOR 2927 is then one of the inputs to AND gate 2929, with additional inputs the inverted values of when Operand A decodes as 0 and when operand B decodes as 0. The resultant output of the circuit of Figures 29A and 29B is then a sign value for the product and the product either in 1-hot vectorformat (if AND gates 2923 are not included) or a magnitude format (if AND gates 2923 are used).

[0146] Figures 29A and 29B present a folded and split crossbar multiplier for the case that the modulus has a primitive root of 2, specifically for a modulo 13 example. Referring back Figure 11 A, it can be seen that for modulo 13 all remainders are unique and represented for k=0 to 11 . The situation is different for moduli that are one of the added primes in Figure 10, but that do not have a primitive root of 2. To use the modulo 23 example, as can be seen in Figure 9, all remainders are unique within the first half of the range (k = 0 to 10). All remainders from the first half of the range (k = 0 to 10) repeat exactly in the same order in the second half of the range (k = 11 to 21 ).

[0147] In a folded crossbar, the multiplication circuit only uses the first half of the remainders (i.e., for RNS-13, instead of remainder range of 0-12, the circuit of Figures 29A and 29B uses a remainder range of -6 to +6). In RNS-13, as shown in Figure 11 A a remainder of +8 is equivalent to a remainder of -5, so that for any remainder in which a negative appears in the top row (i.e., 8 or 5), that the sign-to-wrap indicator is set to a ‘T, else it is set to a ‘O’. Consequently, for RNS-13, an input of 5 has a sign-to-wrap indicator of “1”, with all other inputs have sign-to-wrap indicator of “0”. For the nonprimitive root of 2 case, such as for RNS-23 as illustrated in Figure 9, inputs of 7, 5, 10, and 11 have a sign-to-wrap indicator of “1”, while all other inputs have a sign-to- wrap indicator of “0”, so that for the product output, the circuit can recover the product sign using a wrap-to-sign which performs the same function as sign-to-wrap.

[0148] To determine the final product sign for moduli with a primitive root of 2, as for the RNS-13 example of Figure 29B, in AND logic 2929 the product sign is determined as:Product Sign = (Sign A XOR Sign-to-Wrap A) XOR(Sign B XOR Sign-to-Wrap B) XOR (Product Wrap-to-Sign) XOR (Product Wrap). For moduli without a primitive root of 2 and for which all remainders are unique in the first half of the table and repeat exactly in the second half of the table, such asRNS- 23, there is no product wrap:Product Sign = (Sign A XOR Sign-to-Wrap A) XOR(Sign B XOR Sign-to-Wrap B) XOR (Product Wrap-to-Sign).Figures 30A and 30B illustrate an embodiment for implementing

[0149] Figures 30A and 30B present an embodiment for a folded NMOS crossbar multiplier for inputs in a sign-magnitude format for the n=23 example, where the two figures shows different parts of the same circuit. Figures 30A and 30B are laid out similarly to Figures 29A and 29B, although the equivalents of decoders A 2901 and B 2903 for the inputs and 2923 for the output are not shown. The decoded operand A is supplied to both the crossbar array and to the sign to wrap circuitry 3011 (along with the 0 value for operand B) to provide an operand A sign flip. The decoded operand B is supplied to both the crossbar array and to the sign to wrap circuitry 3013 to provide an operand B sign flip, which is an input to XOR 3015 along with the sign input of operand B. The crossbar array is folded, but not wrapped, so that there is only one output per row and a conventional level restorer, illustrated in Figure 19, can be used.

[0150] Moving to Figure 30B, the operand A sign flip value and operand A sign are both received at XOR 3017, whose output, along with that of XOR 3015, are received at XOR 3027. Relative to Figure 29B, the equivalent of the OR circuits 2921 are not needed as array is not wrapped. The third input to the XOR 3027 is from the wrap to sign circuit 3025, which takes an input directly from each row of the cross bar array. Similarly to Figure 29B, the product sign is provided by AND logic 3029 that has as inputs the output of XOR 3027 and the inverted values of when Operand A decodes as 0 and when operand B decodes as 0.

[0151] Relative to the embodiment of Figure 29A and 29B, the non-primitive root- of-2 embodiment of Figures 30A and 30B has no product wrap, so split crossbar array (as no product wrap) and no cross-connected level restore (because there is no split crossbar array), so that a more conventional level restore circuitry can be used. Consequently, in this embodiment the non-primitive root of 2 circuit can be simpler than the primitive root of 2 circuit. The non-primitive root of 2 must meet the following criteria: The first half of the moduli table must have unique values which represent exactly half of the remainders; and the second half of the table must exactly repeat the first half of the table in the same order.

[0152] Figure 31 is a flowchart for an embodiment of performing modular multiplication based on the embodiments of17A,17B, 24A, 24B, 29A, 29B, 30A, and 30B, where Figures 29A and 29B will be used as the exemplary embodiment for presenting the steps of Figure 31. Beginning at step 3101 , a first modulo p inputnumber is received in a sign-magnitude format, where p is a prime number. For example, taking the first modulo p input number as operand A, the sign value is received at XOR gate 2917 and the magnitude is received at the decoder 2903, although, if the magnitude is already in a 1 -hot vector format, the input can go directly to the inverters shown below decoder 2903 and the sign to wrap circuit 2911 . In step 3103, which can be concurrent with step 3101 , a second modulo p input number is received in a sign-magnitude format. For example, taking the second modulo p input number as operand B, the sign value is received at XOR gate 2915 and the magnitude is received at the decoder 2901 , although again if the magnitude is already in a 1 -hot vector format, the input can go directly to the switch array and the sign to wrap circuit 2913.

[0153] In step 3105, a magnitude of a product of the first modulo p input number and the second modulo p input number is determined by providing the magnitude of the first modulo p input number and the second modulo p input number as respective first and second inputs of the folded and split crossbar multiplier circuit of Figure 29A, along with the OR gates 2921 of Figure 29B. The sign value of the product of the first modulo p input number and the second modulo p input number is determined from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number using the XOR gates 2915, 2917, 2927 and the wrap select circuit 2925 in step 3107.

[0154] In the embodiments presented above, a dense NMOS folded and split crossbar circuit replaces the conventional modular multiplier. By use of a regular NMOS crossbar structure, far less area is needed that for a conventional modular multiplier for a wide variety of RNS moduli. In particular, such embodiments: require no combinatorial multipliers or adders and no division to obtain remainder values; expand available moduli beyond conventional 2n, 2n-1 , or 2n+1 moduli and beyond extremely small moduli using lookup tables; and require minimal extra logic- only decoders and a small number of basic gates. Use of the folded and split architecture uses 75% less area in the crossbar than a “naive” (n-1 )x(n-1 ) implementation of an (un-folded, un-split) crossbar. Use of 1 -hot encoding in crossbar can reduce switching power over conventional modular multiplier. Additionally, this approach widens thedynamic range of multipliers by allowing use of certain non-“primitive root of 2” primes (e.g., 7, 23, 47, 79, 97 under 100).

[0155] To further improve efficiency and layout, the embodiment of Figures 29A and 29B uses a regular 1 -dimensional array of NMOS devices with 1 -hot inputs for wide logic OR’s or selection of multiple decodes; that is, it can help to insure that any remaining ‘glue’ logic scales along with the main crossbar logic. Additionally, the use of sign-magnitude encoding of RNS numbers improves RNS multiplication (as opposed to prior-art unsigned binary encoding). Use of a “cross-connected levelrestoration circuit” enables correct electrical operation of the split crossbar. These various features can significantly provide better area, power, and performance establishes argument for use of signed-magnitude RNS encoding for GPUs, deep learning accelerators, autonomous vehicles, DSPs, vector and tensor processors, and CPUs.

[0156] To provide additional context, Figures 32-35 provide more detail on the ordering of inputs to the crossbar arrays and their relationship to a modulus having a primitive root of 2. More specifically, Figures 32-34 consider the case of modulo 13 multiplication, with Figures 32 and 33 considering a full crossbar arrangement (as represented schematically in Figure 13) and Figure 34 considering a folded crossbar arrangement (as represented schematically in Figure 16). Figure 32 illustrates an RNS-13 full nxn crossbar multiplier with the inputs values in sequential order, running from 1 to 12 for both the inputs of both source 0 and source 1. The array shows the resultant RNS-13 products that, as illustrated by the highlighted “1” output, have no regular pattern and cannot be extracted along rows.

[0157] Figure 33 illustrates an RNS-13 full nxn crossbar multiplier with the inputs values in a modulo power-of-two ordering (i.e., 1 , 2, 4, ... , in mod-p arithmetic), which is used in the embodiments presented here, both folded and unfolded. In an unfolded embodiment, all of the values can be positive and there is not the need for use of a sign or wrap value to distinguish between inputs and output, as is needed in the folded crossbar embodiments. In the modulo power-of-two source ordering of Figure 33, the products are aligned row-by-row, making it very easy to extract the product values.

[0158] Figure 34 illustrates an RNS-13 full folded crossbar multiplier with the inputs values in a modulo power-of-two ordering. In this example, the crossbar array is “fully” folded in that each of the inputs for both Source 0 and Source 1 represent to two inputs and each output represents two outputs, where the pairs of values for both inputs and outputs are differentiated by an additional piece of information, such as the wrap or sign values described above with respect to Figures 8, 9, and 11A-16. The folded crossbar of Figure 34 is an optimized size array version of the full crossbar implementation of Figure 33, with the crossbar array being of the size, although it does require the additional circuit to keep track of the sign values. Consequently, for smaller moduli, the full modulo power-of-two ordered crossbar array may require less area, while the folded and split crossbar array will be preferred for the other, larger moduli. Because of this, in some embodiments for arithmetic logic units, the first one or several moduli may use an unfolded implementation, with the other moduli will use a folded and split implementation.

[0159] Referring back to the discussion primitive roots of 2 with respect to Figures 6 and 10, the approach of Figures 33 and 34 works for primes with a primitive root of 2 and, in a folded embodiment, some moduli without a primitive root of 2. Figure 35 illustrates what happens when a modulus does not have a primitive root of 2 and is attempted to be used in an implementation of a power-of-2 full crossbar. Figure 35 considers the example of RNS-17 power-of-2 source ordering. Considering the Source 0 input, staring from left the values are 1 , 2, ... , 9, and then start over again at 1 . The is also seen for the Source 1 input values and for the products, such that there are missing and repeated source and product values when applying a modulo power- of-two ordering to full array when the modulus does not have a primitive root of 2.

[0160] Figure 36 is a block diagram to illustrate the use of power-of-2 ordering for both folded and unfolded crossbar embodiments for RNS multiplication. The inputs Source 0 and Source 1 are initially received and, if in sequential or other, non-power- of-2, ordering at respective source decoders 3601 and 3603. In addition to the input decoding described above with respect to Figures 29A and 29B or 24A and 24B, the decoders 3601 and 3603 also arrange the inputs in power-of-2 ordering, where these can be in folded or unfolded format, which are then applied to the crossbar array 3605, which will correspondingly be a full (p-1 )x(p-1 ) array (for non-zero values), a foldedand split ((p-1 ) / 2)x((p-1 ) / 2) array (for non-zero values), depending on the embodiment. For an unfolded crossbar array, the output will be unfolded, while for a folded embodiment the output will include a sign (or wrap) value, as well as a magnitude. If in folded format, unfolding circuitry 3607 is included for the final output. Some embodiment can also be “partially” folded, where some, but less than all, of the inputs are folded and shared by two unfolded inputs that are folded to a signal magnitude differentiated by a sign or other distinguishing value.

[0161] Referring back to the embodiment Figures 29A and 29B, this corresponds to a folded and split embodiment and the (non-zero) portions of the crossbar array Figure 29A is of size ((p-1 ) / 2)x((p-1 ) / 2) and inputs are of size >2(p-1 ). (With zero included, the size is ((p-1 ) / 2)x((p+1 ) / 2), with the second input size >2(p+1 ).) The circuitry of Figure 29B then corresponds to the unfolding circuitry 3607. In full (i.e., unfolded) embodiment, relative to Figure 29A the (non-zero) portions of the crossbar array is of size (p-1 )x(p-1 ) and inputs each of size (p-1 ). Additionally, the crossconnected level restorers 2443 can be replaced with a standard level restorer as in Figure 19. With respect to Figure 29B, as the operands and output are no longer folded, these elements are not needed in a full crossbar embodiment. In both the folded and full crossbar arrangement, the connections of the crossbar array represent the topology of the connections of the switches, but the actual layout on a die may be arranged in different ways, with corresponding changes in routing.

[0162] The preceding discussion has considered folded RNS crossbar multiplication units. The following discussion presents embodiments of folded RNS crossbar addition units. More specifically, embodiments are presented for addition units that add two selected numbers, modulo n, in a fast and efficient manner. Addition can be achieved by a dense NMOS “folded” and “split” crossbar. Two-dimensional lookup table and full-size crossbar adders (which do not scale well with n) and slow non {2n, 2n-1 , 2n+1 } adders are both bypassed by this method. Figure 37 illustrates an example of such a prior art adder.

[0163] Figure 37 is a block diagram of an example of a prior art modulo 13 RNS adder. X and Y are the two inputs, along with a fixed value of 3. The value of 3 is due to the modulo 13 example, as 13+3 is equal to next power of 2n, namely 16 or 24, where n is the number bits to express the modulus as a binary. For example, formodulo 7, 1 would be the fixed input as 7+1 =23; and for modulo 19, the fixed input would 13 as 19+13=25. The X and Y values are input into a carry-propagate adder (CPA) 3701 and X, Y, and 3 are input into the carry-save adder (CSA) 3703 to calculate X+Y and X+Y+3 in parallel. The X+Y+3 output of CSA 3703 is then input to CPA 3705. A multiplexer MUX 3707 receives the outputs of both CPA 3701 and CPA 3705, along with the Carry Out value Cout from CPA 3705.

[0164] If X+Y+3 has no carry, then then X+Y < 13 (X+Y in modulo 13 digit set), and the output of CPA 3701 is selected by MUX 3707. If X+Y+3 does have carry out, then X+Y >13, so that a subtract 13 is needed to calculate the correct modulo 13 sum. Subtract 13 can be implemented by adding X+Y+3-16, where X+Y+3 comes from the output of CSA 3703 and the -16 comes naturally because the adders are only 4-bit adders.

[0165] The area required for the modulo 13 adder of Figure 37 is then: 1x 4-bit Carry-Save Adder; 2x 4-bit Carry-Propagate Adder; and 1x 4-bit Multiplexor. More generally, the number of bits will be k, where 2kis the smallest power of 2 greater than the modulus, so that the area will grow by Iog2 of the modulus.

[0166] For the multiplication circuit, the embodiments presented above presented a folded crossbar multiplication circuit for moduli of non 2kor 2k-1 widths. The folded crossbar multiplier used sign-magnitude inputs, as opposed to straight binary inputs. By providing embodiment of a low-power, low-area sign-magnitude modular adder, the folded crossbar adder can be combined the folded crossbar multiplier to form a low-power, low-area modular multiply and accumulate (MAC) unit.

[0167] Figures 38 and 39 schematically illustrates implementation of a modulo 13 addition circuit as full crossbar circuit and as a folded and split crossbar circuit, respectively. The are arranged similarly to Figures 14 and 15 that schematically illustrates implementation of a signed modulo 13 multiplication circuit, but the inputs and outputs are arranged differently and details of how the crossbar is split differ. For the full crossbar of Figure 38, the first operand of n=13 values are input at top arranged in ascending order from right to left, the second operand of n=13 values are input on the diagonal at bottom left arranged in descending order from top to bottom, and then=13 sum values output at left arranged in descending order from top to bottom. The size of the full crossbar array is consequently n2.

[0168] In the folded and split implementation of the crossbar adder, the inputs and outputs now run from 0 to >2(n-1 ), or 0-6 in the modulo 13 example. Remainders greater than 6 are replaced with negative values, so that, for example, -1 is same as 12, -2 is same as 11 , and so on, where the negatives are the modulo additive inverse of the positives. The array is folded, in that that the sum is 0 or + / - for 1 , 2, 3, 4, 5, 6; and the array is split, in that the outputs are divided between “left” and "right”. The resultant size of a folded and split crossbar embodiment is consequently ((n+1 ) / 2)2. Unlike the split and folded crossbar multiplier circuits presented above, which restricted the modulus to certain prime numbers, the split and folded crossbar adder circuits presented below can represent any modulus value, although in practice, the moduli will usually be odd due to the requirement that all moduli be pairwise prime.

[0169] Figures 40A-40D present addition tables for a modulo 13 example for when the input values are folded. When folded, the non-zero input values for the two inputs run from 1 to >2(n-1 ) for each input. Consequently, there are four combinations of +, - values for the two inputs, as reflected in the four tables of Figures 40A-40D. In each of the four addition tables, there is a top triangle of output results for rows and a bottom triangle of output results for rows. In Figures 40A and 40B, the first operand (Operand A) is negative (or 0) and in Figures 40C and 40D Operand A is positive (or 0). In Figures 40A and 40C, the second operand (Operand B) is positive in the bottom triangle and is negative (or 0) in the top triangle. In Figures 40B and 40D, the second operand is negative in the bottom triangle and is positive in the top triangle.

[0170] Figure 41 illustrates the folding of each of addition tables of Figures 40A- 40D. Each of Figures 40A-40D includes a top triangle and bottom triangle of sums with the same Operand A inputs, so that the top and bottom triangles can be combined into a rectangular arrangement for implementation as crossbar array, such as discussed below with respect to Figures 44A and 44B. As illustrated in Figures 40A- 40D and discussed further with respect to Figures 42A, 42B, 44A, and 44B, the Operand B inputs differ between the top triangle and bottom triangle, as due the output values of the different rows.

[0171] In Figure 40A, the second operand (Operand B) is ordered from 1 to 6 (smallest to largest) in the bottom triangle. In Figure 40B, the second operand (Operand B) is ordered from -6 to -1 (smallest to largest) in the bottom triangle. In Figure 40C, the second operand (Operand B) is ordered from 6 to 1 (largest to smallest) in the bottom triangle. In Figure 40D, the second operand (Operand B) is ordered from -1 to -6 (largest to smallest).

[0172] In Figure 40A, the second operand (Operand B) is ordered from -6 to -1 (smallest to largest) in the top triangle. In Figure 40B, the second operand (Operand B) is ordered from 0 to 6 (smallest to largest) in the top triangle. In Figure 40C, the second operand (Operand B) is ordered from 0 to -6 (largest to smallest) in the top triangle. In Figure 40D, the second operand (Operand B) is ordered from 6 to 1 (largest to smallest) in the top triangle.

[0173] Returning to Figures 40A-40D, these also illustrate an example of a computation using the tables. The example uses -4 for Operand A and -1 for Operand B. As Operand A has a negative value, the table of either Figure 40A or 40B will be used. Figure 40B has the -1 value for Operand B in its bottom triangle, so that the sum can be determined by following the Operand B value up diagonal until it hits the Operand A column, with a value of (-1 ) + (-4) = -5, corresponding to output on row Bottom 2.

[0174] Considering the top triangles vs the bottom triangles, the top triangles are used when the sign of Operand B is the same as the sign of Operand A (Figure 40A or Figure 40D). The top triangles are also used when the Operand B is 0 or the sign of operand B is different from the sign of operand A (Figure 40B and Figure 40C). Otherwise, the bottom triangle is used for each corresponding Figures 40A - 40D. The multiplexing of the Operand B inputs values when folded can be illustrated with respect to figures 42A and 42B.

[0175] Figures 42A and 42B are tables respectively presenting the Operand B input top and bottom triangle multiplexing for a folded and split crossbar adder circuit. The columns of Figure 42A show the Operand B top triangle multiplexing of input values. The top triangle values for Operand B run from 0 to 6, ascending in column A and descending in column B. The top multiplexing is: Select Column A (0,1 ,2, 3, 4, 5, 6) =(OpA_Sign XOR OpB_Sign) OR Src1_Zero; and select Column B (6, 5, 4, 3, 2,1 ,0) otherwise. For the bottom triangle, Operand B run from 1 to 6, ascending in column A and descending in column B. The top multiplexing is: Select Column A (1 ,2, 3, 4, 5, 6) = (OpA_Sign XOR OpB_Sign); and select Column B (6, 5, 4, 3, 2,1 ,) otherwise.

[0176] Figure 43 is a schematic representation of how the upper and lower triangles of Figures 40A-40D are arranged in a folded and split crossbar adder layout for a modulo 13 example. The top and bottom triangles are placed into a square array, with the top triangle in the lower right and the bottom triangle in the upper left. The middle portion of the addition tables, corresponding to the “0” value row between the top and bottom triangles of Figures 40B and 40C, are placed along the top of the crossbar array in this embodiment. For the top triangle, the Operand B values are multiplexed either in to the order of column A or column B of Figure 42A. For the bottom triangle, the Operand B values are multiplexed either in to the order of column A or column B of Figure 42B.

[0177] Figures 44A and 44B are an embodiment of a folded and split crossbar adder, where Figures 44A and 44B are two parts of the same circuit. The adder circuit of Figures 44A and 44B are laid out similarly to the multiplier circuit of Figures 29A and 29B and again is an NMOS based embodiment for the switches of the array. The inputs of Operand A and Operand B received in sign, magnitude format. Operand A is received at decoder 4401 that converts the input into a 1 -hot vector format and then (in inverted form) applied to the columns of the crossbar array. In this modulo 13 example, the values run from 0 to 6 (= (n+1 ) / 2). Operand B magnitudes are similarly received at decoder 4403 for conversion into a 1 -hot vector format.

[0178] To account for the four addition tables of Figures 40A-40D, the inputs for both of the bottom inputs and the top inputs for Operand B are multiplexed in respective multiplexers 4405 and 4407. For the bottom input multiplexers 4405 of Operand B, these are selected as discussed with respect to Figures 42B. For the top input multiplexers 4407 of Operand B, these are selected as discussed with respect to Figure 42A. An embodiment for the multiplexing circuits 4405 and 4407 is given below in Figure 47. The four combinations of the outputs of the multiplexing circuits 4405 and 4407 allow for the crossbar circuit to cover the four combinations of Figures 40A-40D. The inputs to the multiplexers 4405 are, from top, the pairs (1 , 6), (2, 5), (3,4), (4, 3), (5, 2), and (6, 1 ), adding up to the same value (here 7) in each case. The inputs to the multiplexers 4407 are, from left, the pairs (0, 6), (1 , 5), (2, 4), (4, 2), and (5, 1 ), adding up to the same value (here 6) in each case and where 3 is not paired or multiplexed. The outputs of the multiplexing circuits 4405 and 4407 are the respectively applied along the upward diagonals to the control gates of the switches of the bottom (i.e. , upper left) section of the array and top (i.e., lower right) section of the array.

[0179] The resultant output lines of each row include a top row output and a bottom row output pair, similarly to the upper five rows of Figure 29A. For example, the gate of transistor 4413 of the bottom triangle receives the output of the multiplexer of 4405 receiving 1 and 6 values of Operand B, with the transistor 4413 connected between the Operand A 0 value and the bottom output of row 5. The gate of transistor 4415 of the top triangle receives the output of the multiplexer of 4407 receiving 0 and 6 values of Operand B, with the transistor 4415 connected between the Operand A 1 value and the top output of row 5. The top and bottom output of each of rows 0-5 then go through a corresponding cross-connected level restoration circuit 4409 as discussed above with respect to Figures 20-22.

[0180] To determine 0 outputs, the Middle row (at the top of the array) is a row of switches 4411 are connected between the (inverted) decoded Operand A values and the Mid output, where the control gates of row 4411 respectively receive the corresponding decoded Operand B value. As there is only one output of the Mid row, a single input level restorer, as in Figure 19, is used for the top circuit of level restorers 4409. Figure 44A also shows the Operand B Sign input, which is used in the circuitry of Figure 44B.

[0181] Figures 44A and 44B are part of the same circuit, where Figure 44B determines the final sum output in sign, magnitude format. To account for the four tables of Figures 40A-40D, each of the magnitude select output multiplexers 4421 receives four inputs, corresponding to the top and bottom pairs of two rows of the outputs of the crossbar array, where these rows are paired, staring from top, as (0, 5), (1 , 4), (2, 3), (3, 2), (4, 1 ), and (5, 0), where an embodiment for the four input multiplex circuits 4421 is given in Figure 48. The 1 -hot output of multiplex circuits 4421 is then converted into a sum magnitude format by AND circuits 4423, as discussed withrespect to the AND circuits 2923 of Figures 29B. The sign for the sum is determined in the output sign circuit 4425 that has as inputs Operand B Sign, top row values T5:0, the Mid value, and the bottom row values B5:0, where an embodiment for output sign circuit 4425 is given below in Figure 50.

[0182] Figure 45 is an embodiment for a folded and split crossbar adder in which the operands are received in a 1 -hot vector format for the magnitude and the output is provided in a 1-hot vector format. Consequently, Figure 45 corresponds to Figures 44A and 44B in the same way the multiplier of Figures 30A and 30B correspond to Figures 29A and 29B. Figure 45 repeats many of the elements of Figure 44A and 44B, but, as the magnitudes Operand A and Operand B are now in 1 -hot vector format, the decoders 4401 and 4403 are not included. Similarly, as the magnitude of the sum is also provided in 1 -hot vector format, the AND circuits 4423 are omitted. The embodiment of Figure 45 can be useful when the addition is part of a sequence of operations using the crossbar adders, crossbar multipliers, or a combination of these, such as the multiple and accumulate circuit of Figures 46A and 46B.

[0183] Figures 46A and 46B illustrates of an NMOS crossbar multiple and accumulate (MAC) in a folded and split embodiment with inputs and outputs in a sign, 1 -hot vector format. Figures 46A and 46B together form the MAC unit that together could be, for example, the modulo 13 RNS MAC unit of a stage in a neural network. Figure 46A is the folded and split crossbar multiplication circuit and Figure 46B is the adder in which the multiplication values are accumulated.

[0184] The multiplier 4601 of Figure 46A is a modulo 13 example corresponding to the modulo 23 example of Figures 30A and 30B or, without the input decoders 2901 and 2903 and output decoder 2923, the modulo 13 example of Figure 29A and 29B. In Figure 46A, the input is in the sign, 1-hot vector format, such as would be coming from a preceding stage, but if the input of Operand A or Operand B is received in the sign, magnitude format, corresponding decoders such as 2901 and 2903 of Figures 29A can be included. The output of multiplier 4601 is in the sign, 1-hot output that is provided to the adder 4603 of Figure 46B.

[0185] The adder 4603 is arranged as for Figure 45, with the output of the multiplier4601 input as Operand B of Figure 45. The outputs of adder 4603 are received atbuffers 4605, where the outputs (corresponding to the accumulated values) is looped back as to adder 4603 to correspond to the Operand A input of Figure 45. As additional multiplication results from multiplier 4601 , adder 4603 adds this new result to the previously accumulated result in the buffers 4605 to generate the sum sign and sum magnitude values for the stage. If the output is a final stage output, for example, it can be converted into sum magnitude format as with the encoder of AND circuits 4423 of Figure 44B.

[0186] Figures 47 and 48 respectively present schematics of embodiments of the Operand B input multiplexers 4405, 4407 of Figure 44A and the output multiplexers 4421 of Figures 44B, as well as those of Figures 45 and 46B. The two source inputs Src In 0 and Src In 1 are respectively connected through switches, here NMOS transistors, 4701 and 4703 to the output node Out through inverter 4705. For example, referring to the top-most MUX of 4405 of Figure 44A or 45, the two input values would be 1 and 6. Similarly, for the left-most MUX of 4407, the input would be 0 and 6. Selection between the two source inputs Src In 0 and Src In 1 are respectively based on the corresponding select signal Sei 0 and Sei 1 applied to the gates of switches 4701 and 4703, where the selection is made with respect to the tables of Figures 42A and 42B. To have well-defined output levels, PMOS 4709 has its gate connected the Out node, so that, as described with respect to Figure 19, if Out is low, a strong 1 results at the input of a strong 0 at Out.

[0187] Figure 48 illustrates an embodiment of one of the 4 to 1 multiplexers 4421 for the example of the T2, B2, T5, B5 row outputs as the multiplexed input. The top values Out T2 and Out T5 are provided to the gates of PMOS 4811 and NMOS 4813 through respective NMOS switches 4801 and 4803. The bottom values Out B5 and Out B2 are provided to the gates of PMOS 4815 and NMOS 4817 through respective NMOS switches 4805 and 4807. The selection is based on the signs of Operand A and Operand B, with the XOR-ing of these values being an effective subtracting of these values, which is applied to the gates of transistors 4803 and 4807, the inverse of the XOR-ing of these values being an effective addition of these values, which is applied to the gates of transistors 4801 and 4805.

[0188] Figures 49A-49D illustrate the correspondence between the different choices of outputs and the addition tables for the modulo 13 example for when theinput values are folded. Figures 49A-49D again show the same four cases, corresponding to the four sign pairs, as in Figures 40A-40D, but with the different output cases highlighted for when the sum is ±2. As outlined in in the heavier weight lines, the outputs for Figures 49A-49D are the respective combinations (T2, B2), (B5, T5), (B5, T5), and (B2, T2).

[0189] Returning Figure 48, the PMOSs 4811 and 4815 are connected in series between the high supply voltage level and the input of inverter 4821 , with NMOSs 4813 and 4817 connected in parallel between ground and the input of inverter 4821 , where the output of the multiplexer 4421 is the output Out 2 of inverter 4821. To provide well-defined Out 2 values, Out 2 is connected to the gates of PMOSs 4823 and 4825 for level restoration.

[0190] Figure 50 is circuit diagram for an embodiment of output sign circuit 4425 of Figures 44B and 45. The embodiment of Figure 50 for sign determination, as with Figures 47 and 48 for input / output multiplexing, use a layout of NMOS devices for density. Each of the bottom row outputs of the crossbar array is applied to a gate of one of the NMOSs 5003 connected in parallel between inverter 5007 input and inverse of the sign value of source 1 Src1_Sign, where, in Figures 44B and 45 source 1 is Operand B and source 0 is Operand A. Each of the top row outputs of the crossbar array is applied to a gate of one of the NMOSs 5001 connected in parallel between inverter 5007 input and the combination of Src1_Sign OR-ed with the combination of Src1_Zero AND-ed with the inverse of Src0_Sign. The input of inverter 5007 is also connected to the high logic level though NMOS 5005 which has its gate connected to the Middle row output of the crossbar array. The Sign value is then the output of the inverter 5007, which is also applied to the gate of PMOS 5009 for level restoration.

[0191] Considering Figure 50 further and referring back to the tables of Figures 40A-40D, the sign of the result (inside of the top triangles) is the opposite of OpB_Sign. The exception is for the case of SrcB = 0 in the Figure 40C diagram on slide 1 . In this case, the Sign of the Sum (positive) is the same as the sign of Operand B (positive because sign(0) = 0). The output sign circuit 4425 adjusts the source inputs to the NMOS devices 5001 on top (corresponding to the top triangle to account for this case). The output sign circuit for the bottom triangle does not include the case for SrcB = 0 and is therefore unaffected. The output sign circuit 4425 is an inverting circuit andproduces the inverse (or opposite) sign of whatever is fed into the source inputs of the NMOS devices.

[0192] The embodiments for the crossbar adder circuit presented here are presented in the context of a residual number system, as were the crossbar multiplier circuit embodiments presented preceding the adders. In the case of the multiplier, the circuit can be applied to prime moduli with a primitive root of 2 as well additional primes as discussed with respect to Figure 10. The adder circuit can more generally applied to all odd prime moduli and, additionally, non-prime odd moduli. The folded and split crossbar adder circuit can be applied to even moduli, although it needs to be adapted as the number of row in the top triangles and bottom triangles are unequal; however, as the main application here is to residual number system embodiments that use prime number moduli (or at least moduli with no common factors) that are (aside from the “degenerate” p=2 case) odd, the even case will not be developed here.

[0193] Returning to multiply and accumulate applications, Figures 51 -53 present several topologies for accumulator embodiments. MACs are often embodiment in applications involving very large data sets, such as neural networks. To accommodate these large data sets, different embodiments can use differing amounts parallelism. One approach is to use a sequential accumulation topology, as in the embodiment of Figure 51 . In the embodiment of Figure 51 , a single source SO of multiplication results that are received at an adder circuit 5101 , where it is added to the currently accumulated value in accumulated result in accumulator 5141 . Figures 46A and 46B presents such an arrangement, where the output of multiplication circuit 4601 are sequentially received at adder 4603 (corresponding to adder 5101 ) with the accumulated results accumulated in buffers 4605 (corresponding to accumulator 5141 ).

[0194] Figure 52 illustrates a spatial accumulation topology in which the computations are split into multiple channels performed in parallel. In this example, eight multiplication sources S0-S7, such as of modulo p channel of an RNS implementation. A first set of adders 5201 , 5203, 5205, 5207 such as in Figure 45 perform pair-wise additions, followed by a second set of adders 5211 and 5213, and finally a final adder 5221 . The number of such stages of adders in the tree of Figure 52 will be based on the number of multiplication channels.

[0195] Figure 53 illustrates a sequential and accumulation topology, combining the features of Figures 51 and 52. The tree of adders first stage 5301 , 5303, 5305, 5307, second stage 5311 , 5313, and third stage 5321 is arranged as in the corresponding stages of the tree of Figure 52. Similarly to Figure 51 , the final stage adder 5331 is in a loop with accumulator 5341 to accumulate sequential sets of multiplication results received at S0-S7.

[0196] Figure 54 is a flowchart for an embodiment of performing modular addition based on the embodiments of 44A, 44B, 45, and 46B. At 5401 , a first modulo p input number is received in a sign-magnitude format. In Figures 44A and 45, the first input can correspond to Operand A, where Operand A can be received in a 1 -hot vector format, as in Figure 45, or decoded into this format as in decoders 4401 . In the multiply and accumulate embodiment of Figures 46A and 46B, the first input can correspond to the values stored in the buffers 4605. At 5403, a first modulo p input number is received in a sign-magnitude format. In Figures 44A and 45, the first input can correspond to Operand B, where Operand B can be received in a 1 -hot vector format, as in Figure 45, or decoded into this format as in decoders 4403. In the multiply and accumulate embodiment of Figures 46A and 46B, the first input can correspond to the output of the multiplier 4601 .

[0197] At 5405, the magnitude the sum the first modulo p input number and the second modulo p input number by providing the magnitude of the first modulo p input number and the second modulo p input number as respective first and second inputs of a crossbar multiplier circuit by applying the first input to the columns of the crossbar array of switches, the second input along diagonals to the control gates, are the output resulting on the rows. The multiplexers 4421 then determine the magnitude of the sum. At 5407, the output sign circuit 4425 determining a sign value of the sum of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

[0198] The embodiments presented above present a dense, NMOS based embodiments of folded crossbar adder circuits that require less area than conventional modular adder for a wide variety of RNS moduli. This expands available moduli beyond the single-adder case, which requires moduli of the form 2nor 2n-1 . For non2nor 2n-1 moduli, folded crossbar implementation is denser than prior-art “dual adder” design. The use of 1-hot encoding in the crossbar reduces switching power over conventional modular multiplier. The adder embodiments also widens the dynamic range of representable number formats by permitting use of any moduli. Additionally, they enable multiply-accumulate (MAC) operations in sign-magnitude RNS format by pairing with a sign-magnitude RNS multiplier.

[0199] Figure 55 is a high-level block diagram of a computing system 5501 that can be used to implement various embodiments of the microprocessors described above. In one example, the computing system 5501 is a network system 5501. Specific devices may utilize all of the components shown, or only a subset of the components, and levels of integration may vary from device to device. Furthermore, a device may contain multiple instances of a component, such as multiple processing units, processors, memories, transmitters, receivers, etc.

[0200] The network system may comprise a computing system 5501 equipped with one or more input / output devices, such as network interfaces, storage interfaces, and the like. The computing system 5501 may include a central processing unit (CPU) 5510, a memory 5520, a mass storage device 5530, and an I / O interface 5560 connected to a bus 5570, where the CPU can include a microprocessor such as described above with respect to Figures 1A-B. The computing system 5501 is configured to connect to various input and output devices (keyboards, displays, etc.) through the I / O interface 5560. The bus 5570 may be one or more of any type of several bus architectures including a memory bus or memory controller, a peripheral bus or the like.

[0201] The CPU 5510 may comprise any type of electronic data processor, including the microprocessor 120 of Figure 1 B, which includes divide circuits (e.g., any of the divide circuits described above). The CPU 5510 may be configured to implement any of the schemes described herein with respect to division, using any one or combination of steps described in the embodiments. The memory 5520 may comprise any type of system memory such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), read-only memory (ROM), a combination thereof, or the like. In an embodiment, the memory 5520 mayinclude ROM for use at boot-up, and DRAM for program and data storage for use while executing programs.

[0202] The mass storage device 5530 may comprise any type of storage device configured to store data, programs, and other information and to make the data, programs, and other information accessible via the bus 5570. The mass storage device 5530 may comprise, for example, one or more of a solid-state drive, hard disk drive, a magnetic disk drive, an optical disk drive, or the like.

[0203] The computing system 5501 also includes one or more network interfaces 5550, which may comprise wired links, such as an Ethernet cable or the like, and / or wireless links to access nodes or one or more networks 5580. The network interface 5550 allows the computing system 5501 to communicate with remote units via the network 5580. For example, the network interface 5550 may provide wireless communication via one or more transmitters / transmit antennas and one or more receivers / receive antennas. In an embodiment, the computing system 5501 is coupled to a local-area network or a wide-area network for data processing and communications with remote devices, such as other processing units, the Internet, remote storage facilities, or the like. In one embodiment, the network interface 5550 may be used to receive and / or transmit interest packets and / or data packets in an ICN. Herein, the term “network interface” will be understood to include a port.

[0204] The components depicted in the computing system of Figure 55 are those typically found in computing systems suitable for use with the technology described herein, and are intended to represent a broad category of such computer components that are well known in the art. Many different bus configurations, network platforms, and operating systems can be used.

[0205] The technology described herein can be implemented using hardware, firmware, software, or a combination of these. Depending on the embodiment, these elements of the embodiments described above can include hardware only or a combination of hardware and software (including firmware). For example, logic elements programmed by firmware to perform the functions described herein is one example of elements of the described multiplication circuit. A multiplication circuit can include a processor, FGA, ASIC, integrated circuit or other type of circuit. The softwareused is stored on one or more of the processor readable storage devices described above to program one or more of the processors to perform the functions described herein. The processor readable storage devices can include computer readable media such as volatile and non-volatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer readable storage media and communication media. Computer readable storage media may be implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Examples of computer readable storage media include RAM, ROM, EEPROM, flash memory or other memory technology, 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 which can be used to store the desired information, and which can be accessed by a computer. A computer readable medium or media does (do) not include propagated, modulated or transitory signals.

[0206] Communication media typically embodies computer readable instructions, data structures, program modules or other data in a propagated, modulated or transitory data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as RF and other wireless media. Combinations of any of the above are also included within the scope of computer readable media.

[0207] In alternative embodiments, some or all of the software can be replaced by dedicated hardware logic components. For example, and without limitation, illustrative types of hardware logic components that can be used include Field-programmable Gate Arrays (FPGAs), Application-specific Integrated Circuits (ASICs), Applicationspecific Standard Products (ASSPs), System-on-a-chip systems (SOCs), Complex Programmable Logic Devices (CPLDs), special purpose computers, etc. In one embodiment, software (stored on a storage device) implementing one or more embodiments is used to program one or more processors. The one or moreprocessors can be in communication with one or more computer readable media / storage devices, peripherals and / or communication interfaces.

[0208] It is understood that the present subject matter may be embodied in many different forms and should not be construed as being limited to the embodiments set forth herein. Rather, these embodiments are provided so that this subject matter will be thorough and complete and will fully convey the disclosure to those skilled in the art. Indeed, the subject matter is intended to cover alternatives, modifications and equivalents of these embodiments, which are included within the scope and spirit of the subject matter as defined by the appended claims. Furthermore, in the following detailed description of the present subject matter, numerous specific details are set forth in order to provide a thorough understanding of the present subject matter. However, it will be clear to those of ordinary skill in the art that the present subject matter may be practiced without such specific details.

[0209] Aspects of the present disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatuses (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable instruction execution apparatus, create a mechanism for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0210] The description of the present disclosure has been presented for purposes of illustration and description but is not intended to be exhaustive or limited to the disclosure in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the disclosure. The aspects of the disclosure herein were chosen and described in order to best explain the principles of the disclosure and the practical application, and to enable others of ordinary skill in the art to understand the disclosure with various modifications as are suited to the particular use contemplated.

[0211] For purposes of this document, each process associated with the disclosed technology may be performed continuously and by one or more computing devices. Each step in a process may be performed by the same or different computing devices as those used in other steps, and each step need not necessarily be performed by a single computing device.

[0212] Although the subject matter has been described in language specific to structural features and / or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims

CLAIMSWhat is claimed is:

1. An addition circuit, comprising: a crossbar adder circuit configured to: receive a magnitude of a first modulo p input number in a sign-magnitude format; receive a magnitude of a second modulo p input number in the signmagnitude format; and determine a magnitude of a sum of the first modulo p input number and the second modulo p input number from the magnitude of the of the first modulo p input number and the magnitude of the of the second modulo p input number; and a sign determination circuit configured to: receive a sign value of the first modulo p input number in the signmagnitude format; receive a sign value of a second modulo p input number in the sign-magnitude format; and determine a sign value of the sum of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

2. The addition circuit of claim 1 , wherein the crossbar adder circuit is a (p+1 ) / 2 by (p+1 ) / 2 crossbar array of switches.

3. The addition circuit of claim 2, wherein: the switches are arranged in columns and rows; the switches of each column connected between a corresponding magnitude one of the first modulo p input numbers and a different row output; and a control gate of each of the switches is connect to receive the magnitude of one of the second modulo p input numbers.

4. The addition circuit of claim 3, further comprising:a first plurality of multiplexers each configured to receive as input the magnitude of a corresponding pair of the second modulo p input numbers and apply a selected one of the corresponding pair of the second modulo p input numbers to the control gates of switches along a corresponding diagonal of a top triangle of the array of switches; and a second plurality of multiplexers each configured to receive as input the magnitude of a corresponding pair of the second modulo p input numbers and apply a selected one of the corresponding pair of the second modulo p input numbers to the control gates of switches along a corresponding diagonal of a bottom triangle of the array of switches.

5. The addition circuit of claim 4, wherein: the corresponding pair of the second modulo p input numbers add to a first same value for each of the first plurality of multiplexers; and the corresponding pair of the second modulo p input numbers add to a second same value for each of the second plurality of multiplexers.

6. The addition circuit of any of claims 2-5, wherein the switches are NMOS transistors.

7. The addition circuit of any of claims 2-6, wherein the switches are implemented as one or more of finFET transistors, Gate-AII-Around (GAA) transistors, or nanowire or nanosheet transistors.

8. The addition circuit of an of claims 1-7, wherein the first modulo p input number is received as a binary encoded value and the second modulo p input number is received as a binary encoded value, and wherein the crossbar adder circuit is further configured to: convert the magnitude of the first modulo p input number to a first binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero; and convert the magnitude of the second modulo p input number to a second binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero.

9. The addition circuit of claim 8, wherein the crossbar adder circuit is further configured to: select between a first input value and a second input value for input of the second modulo p input number inputs into the cross-bar array for non-zero values of the second modulo p input number.

10. The addition circuit of an of claims 1 -9, wherein the addition circuit is one of a plurality of modular arithmetic units, each for a different modulus value and each configured to receive a corresponding component of input values in a residual number format system.11 . The addition circuit of an of claims 1 -10, further comprising: a plurality of level restore circuits, each configured to receive two outputs of a row of the crossbar adder circuit, one of outputs active and the other outputs inactive, and provide the output of each of the rows as a strong logic value.

12. The addition circuit of an of claims 1 -11 , wherein p is an odd number.

13. The addition circuit of an of claims 1 -12, further comprising: a buffer configured connected to the crossbar adder circuit and configured to store the determined magnitude of the sum of the first modulo p input number and the second modulo p input number, wherein the magnitude of the second modulo p input number is the stored determined magnitude.

14. A method of performing modulo p addition, comprising: receiving a first modulo p input number in a sign-magnitude format; receiving a second modulo p input number in the sign-magnitude format; determining a magnitude of a sum of the first modulo p input number and the second modulo p input number by providing the magnitude of the first modulo p input number and the second modulo p input number as respective first and second inputs of a crossbar multiplier circuit; anddetermining a sign value of the sum of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

15. The method of claim 14, further comprising: storing the determined magnitude of the sum in a buffer; and providing the stored determined magnitude of the sum in the buffer as the magnitude of the second modulo p input number.

16. The method of any of claims 14-15, further comprising: generating the first modulo p input number by a modulo p multiplier circuit.

17. The method of any of claims 14-16, wherein p is an odd number.

18. The method of any of claims 14-17, wherein: receiving the first modulo p input number in the sign-magnitude format comprises: receiving the first modulo p input number as a binary encoded value; and converting the magnitude of the first modulo p input number to a first binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero, and receiving the second modulo p input number in the sign-magnitude format comprises: receiving the second modulo p input number as a binary encoded value; and converting the magnitude of the second modulo p input number to a second binary valued vector, wherein, for non-zero values, one of the values of the vector being one and other values of the vector being zero.

19. The method of claim 18, further comprising: selecting between a first input value and a second input value for input of the second modulo p input number inputs into the crossbar array for non-zero values of the second modulo p input number.

20. The method of any of claims 14-19, further comprising: receiving at each of a plurality of level restore circuit two outputs of a corresponding row of the crossbar multiplier circuit, one of outputs active and the other outputs inactive; and provide by each of the level restore circuits the output of the corresponding row as a strong logic value.21 . A multiply and accumulate circuit, comprising: a multiplication circuit configured to determine a product of a first modulo p input number and a second modulo p input number from a multiplication circuit; and an addition circuit, comprising: a buffer configured to store an output of the addition circuit; a crossbar adder circuit configured to: receive a magnitude of the product of the first modulo p input number and a second modulo p input number from the multiplication circuit; receive a magnitude of the stored output of the addition circuit from the buffer; and determine a magnitude of a sum of the product of the first modulo p input number and the second modulo p input number and the stored output of the addition circuit; and a sign determination circuit configured to: receive a sign value of the product of the first modulo p input number and the second modulo p input number from the multiplication circuit; receive a sign value of the stored output of the addition circuit from the buffer; and determine a sign value of the sum of the product of the first modulo p input number and the second modulo p input number and the stored output of the addition circuit.

22. The multiply and accumulate circuit of claim 21 , further comprising:the multiplication circuit, comprising: a crossbar multiplier circuit configured to: receive a magnitude of the first modulo p input number and a magnitude of the second modulo p input number; and determine the magnitude of the product of the first modulo p input number and the second modulo p input number from the magnitude of the of the first modulo p input number and the magnitude of the of the second modulo p input number; and a sign determination circuit configured to: receive a sign value of the first modulo p input number and a sign value of a second modulo p input number; and determine the sign value of the product of the first modulo p input number and the second modulo p input number from the sign value of the of the first modulo p input number and the sign value of the of the second modulo p input number.

23. The multiply and accumulate circuit of any of claims 21 -22, wherein the crossbar adder circuit is a (p+1 ) / 2 by (p+1 ) / 2 crossbar array of switches.

24. The multiply and accumulate circuit of claim 23, wherein the switches are NMOS transistors.

25. The multiply and accumulate circuit of any of claims 23-24, wherein the switches are implemented as one or more of finFET transistors, Gate-AII-Around (GAA) transistors, or nanowire or nanosheet transistors.

26. The multiply and accumulate circuit of any of claims 21 -25, wherein the crossbar adder circuit is further configured to: select between a first input value and a second input value for the magnitude of the product of the first modulo p input number and a second modulo p input number for input into the crossbar array for non-zero values of the magnitude of the product of the first modulo p input number and a second modulo p input number.

27. The multiply and accumulate circuit of any of claims 21-26, wherein p is a prime number.

Citation Information

Patent Citations

  • Arithmetic circuits for use with the residue number system

    US20050182809A1