CONCURRENT MULTI-BIT ADDER
20230333815 · 2023-10-19
Inventors
Cpc classification
G06F2207/5063
PHYSICS
International classification
Abstract
A method for an associative memory device includes performing in parallel multi-bit operations of P pairs of multi-bit operands stored in columns of a memory array, each pair is stored in a different column, each bit i of each multi-bit operands of each pair is stored in a row of a section i in the column and each operation occurs in its associated column. A system includes a non-destructive associative memory array with multiple sections, each section j includes cells arranged in rows and columns, to store a bit j from a first multi-bit number in a first row and a bit j from a second multi-bit number in a second row of a same column, and a concurrent adder to, in parallel, perform per-section operations in each section, that includes one or more Boolean operations between a plurality of bits stored in rows of the section.
Claims
1. A method for an associative memory device, the method comprising: in parallel, performing multi-bit operations of P pairs of multi-bit operands stored in columns of a memory array, wherein each pair of said P pairs is stored in a different column of said array and each operation of said multi-bit operations occurs in its associated different column, wherein each bit i of each of said multi-bit operands of each of said P pairs is stored in a row of a section i in said column.
2. The method of claim 1 wherein said each multi-bit operation of said multi-bit operations comprises a plurality of per-section operations, and wherein each per-section operation comprises one or more Boolean operations between a plurality of bits stored in said section.
3. The method of claim 2 wherein said performing comprises concurrently performing said per-section operations on a plurality of sections.
4. The method of claim 1 wherein said multi-bit operation is a multi-bit add operation.
5. A system comprising: a non-destructive associative memory array comprising a plurality of sections, each section j comprising cells arranged in rows and columns, to store a bit j from a first multi-bit number in a first row and a bit j from a second multi-bit number in a second row of a same column; and a concurrent adder to, in parallel perform per-section operations in each section, wherein each per-section operation comprises one or more Boolean operations between a plurality of bits stored in rows of said section.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The subject matter regarded as the invention is particularly pointed out and distinctly claimed in the concluding portion of the specification. The invention, however, both as to organization and method of operation, together with objects, features, and advantages thereof, may best be understood by reference to the following detailed description when read with the accompanying drawings in which:
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024] It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not necessarily been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. Further, where considered appropriate, reference numerals may be repeated among the figures to indicate corresponding or analogous elements.
DETAILED DESCRIPTION OF THE PRESENT INVENTION
[0025] In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the invention. However, it will be understood by those skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known methods, procedures, and components have not been described in detail so as not to obscure the present invention.
[0026] It is known in the art that the sum, S, and the carry out, C.sub.out, of a one-bit computation can be expressed by equations 1 and 2:
S=A⊕B⊕C.sub.in Equation 1
C.sub.out=A*B+C.sub.in*(A+B) Equation 2
[0027] Where the symbol ⊕ indicates a Boolean XOR, the symbol * indicates a Boolean AND and the symbol + indicates a Boolean OR. The carry out signal may be calculated in advance by a procedure, known in the art, called Carry Look Ahead (CLA). The CLA calculation is based on the value of all previous input bits A.sub.i and B.sub.i (0<i<N) of variables A and B, and on the value of the first C.sub.in The computation of the CLA is expressed in equation 3.
C.sub.out-N=A.sub.N*B.sub.N+A.sub.N-1*B.sub.N-1*(A.sub.N+B.sub.N)+A.sub.N-2*B.sub.N-2*(A.sub.N-1+B.sub.N-1)*(A.sub.N+B.sub.N)+ . . . +C.sub.in*(A.sub.0+B.sub.0)*(A.sub.1+B.sub.1) . . . (A.sub.N+B.sub.N) Equation 3
[0028] Using this technique, the bits of the variables may be split into groups (nibbles for example) and the carry of the group, referred herein as C.sub.out-group, i.e. the carry from the last bit in the group, may be calculated without waiting for each bit computation to be completed. Using the CLA, the performance of a multi-bit adder may be improved (compared to the ripple carry); however, the CLA may only be implemented using specialized hardware, explicitly designed to calculate the expected carry out of a group using all the input bits of the group i.e. all the bits of variable A, all the bits of variable B and the C.sub.in of the group referred herein as C.sub.in-group.
[0029] Applicant has realized that a similar carry propagation functionality, that improves the computation efficiency of a multi-bit adder compared to a ripple carry adder, may be provided by a multi-purpose associative memory replacing the specialized hardware, by performing a calculation using a prediction regarding the value of a carry in as described hereinbelow.
[0030] Multi-purpose associative memory devices are described in U.S. Pat. No. 8,238,173, (entitled “USING STORAGE CELLS TO PERFORM COMPUTATION”) issued on Aug. 7, 2012; U.S. Patent Publication No. US 2015/0131383, (entitled “NON-VOLATILE IN-MEMORY COMPUTING DEVICE”) published on May 14, 2015, now issued as U.S. Pat. No. 10,832,746 on Nov. 10, 2020; U.S. Pat. No. 9,418,719 (entitled “IN-MEMORY COMPUTATIONAL DEVICE”), issued on Aug. 16, 2016 and U.S. Pat. No. 9,558,812 (entitled “SRAM MULTI-CELL OPERATIONS”) issued on Jan. 31, 2017, all assigned to the common assignee of the present invention and incorporated herein by reference.
[0031] Applicant has further realized that the computation may be parallelized, using bit line processors, one per bit, as described in U.S. patent application Ser. No. 15/650,935 filed on Jul. 16, 2017 (entitled “IN-MEMORY COMPUTATIONAL DEVICE WITH BIT LINE PROCESSORS”) and published on Nov. 2, 2017 as US 2017/0316829, now issued as U.S. Pat. No. 10,153,042 on Dec. 11, 2018, assigned to the common assignee of the present invention and incorporated herein by reference.
[0032]
[0033]
[0034] Concurrent adder 310 (of
[0035] In C0, C1 and C.sub.out, concurrent adder 310 may store a value related to the carry out. Predictor 314 may use row C0 to store a value of C.sub.out, calculated using a prediction that the value of the carry in (to the group) will be 0. Predictor 314 may use row C1 to store a value of C.sub.out, calculated using a prediction that the value of the carry in (to the group) will be 1. Selector 316 may select the actual value used by summer 318 for calculating the sum and may store it in row C.sub.out after the actual value of the carry in is known, when the calculation of the carry out of the previous group is completed. In row Sum, summer 318 may store the sum of bit x from operand B, bit x from operand A and the carry out from the previous computation, used as carry in.
[0036] As already mentioned before, all data relevant to a specific sum computation may be stored in a single column of each section, and each column may store different variables to concurrently perform multiple add operations, such that a computation regarding a specific pair of variables may be performed in col 0, while a completely unrelated computation on two other variables may be performed in a different column, such as col 1.
[0037] According to a preferred embodiment of the present invention, concurrent adder 310 (of
[0038]
[0039] Concurrent adder 310 may store each bit of variable A in a dedicated section 330. The LSB of variable A is stored in row A of section 0, the next bit is stored in row A in section 1 and so on until the MSB of variable A is stored in row A of section 7. Variable B is stored similarly in row B of sections 1 to 7. Variables A and B may be divided into two groups of 4 bits: nibble0 comprising sections 0, 1, 2 and 3 and nibble1, comprising sections 4, 5, 6, and 7. In step #1 concurrent adder 310 may write variable A to rows A. The first four bits, 0110 may be stored in nibble0 and the other bits, 0111 may be stored in nibble1. Similarly, in step #2, concurrent adder 310 may write the first group of bits of variable B, which are 1011, to nibble0 and the second group of variable B, which are 1110, to nibble1.
[0040] Concurrent adder 310 may then calculate the result of a Boolean OR in, step #3, and a Boolean AND, in step #4, between the bits of operands A and B in each section as defined in equations 4 and 5.
AorB=A.sub.i+B.sub.i Equation 4
AandB=A.sub.i*B.sub.i Equation 5
[0041] Concurrent adder 310 may store the results of equations 4 and 5 in rows AorB and AandB, respectively. It may be appreciated that concurrent adder 310 may concurrently perform the calculation of each of the steps on all sections, i.e. equation 4 is calculated in a single step on all sections storing bits of operands A and B. In addition, equation 4 may be concurrently performed on all columns of associative memory array 320.
[0042] After calculating and storing values in rows AorB and AandB, concurrent adder 310 may calculate the carry out inside all groups in parallel, using the standard ripple carry formula of equation 6.
C.sub.out=A*B+C.sub.in*(A+B)=AandB+(C.sub.in*AorB) Equation 6
[0043] The ripple carry inside a group may take M steps for a group of size M.
[0044] Since the carry in of all groups, except for the first one, is not known in advance, the ripple carry may be calculated inside each group twice. Predictor 314 may perform the first calculation under the prediction that the input carry of the group is 0 (C.sub.group-in=0) and the second calculation under the prediction that the input carry of the group is 1 (C.sub.group-in=1). Predictor 314 may store the calculated carry outs in dedicated rows in each section. Predictor 314 may store the carry value calculated assuming C.sub.group-in=0 in row C0 and the carry value calculated assuming C.sub.group-in=1 in row C1.
[0045] The standard ripple carry of equation 6 may be performed assuming C.sub.group-in=0 in step 5 on the first section of each group, in step 6 on the second section of each group, in step 7 on the third section of each group and in step 8 on the fourth section of each group.
[0046] The standard ripple carry of equation 6 may be performed assuming C.sub.group-in=1 in step 6 on the first section of each group, in step 7 on the second section of each group, in step 8 on the third section of each group and in step 9 on the fourth section of each group.
[0047] Thus, the two ripple carry operations may be performed in merely M+1 steps as concurrent adder 310 may start the calculation under the assumption of C.sub.group-in=1, immediately after calculating the carry out of the first bit of the group using C.sub.group-in=0 as the bits may be stored in different sections and a calculation may be done concurrently on any number of sections.
[0048] After the standard ripple carry is completed inside the groups, and rows C0 and C1 store values for all the bits of the group, concurrent adder 310 may perform a ripple carry between groups.
[0049] The C.sub.group-in of the first group may be zero, if there is no carry in from a previous computation, and may be the carry out of a previous computation if the current computation is a step in a multi-step process, such as adding a 64 bit number using 4 rounds of concurrent adding of 16 bit numbers. Selector 316 may write, in step 9, the values of the correct row of the first nibble to row C.sub.out according to the actual value of the C.sub.in of the first group. Since the actual value of the C.sub.group-in is known only once the carry out of the last bit of the previous group is calculated, selector 312 may select the relevant values of the carry bits for the group, i.e. from row C0 or row C1, after the C.sub.group-out of the previous group is known. In the example, the C.sub.group-out of the first group (the value stored in row C0 of section 3) is 1 and selector 316 may select row C1 of the second group as the actual values of the carry bits of nibble1. Selector 316 may then write the values of row C1 of the sections of nibble1 (sections 4, 5, 6 and 7) to row C.sub.out of the relevant sections in step 10.
[0050] In a preferred embodiment of the present invention, selector 316 may choose the value for C.sub.out of each group using equation 7.
Cout=(C1*C.sub.prev-group-out)+(C0*(NOT(C.sub.prev-group-out)) Equation 7
[0051] The C.sub.group-out of the first group is provided after M steps of a standard ripple carry adder (4 steps for a nibble as in the example of
[0052] Once all values of the carry are, known in all sections of all groups, summer 318 may concurrently compute, in step 11, the sum of all bits in all sections using equation 8.
S=A⊕B⊕C.sub.in Equation 8
where C.sub.in is the C.sub.out of the previous section.
[0053]
[0054] It may be appreciated by the person skilled in the art that the steps shown are not intended to be limiting and that the flow may be practiced with more or less steps, or with a different sequence of steps, or any combination thereof.
[0055] It may be appreciated that, for adding two 16-bit operands divided into four nibbles, concurrent adder 310 may perform the following procedures: [0056] A. Calculate A+B (in parallel for all bits) [0057] B. Calculate A*B (in parallel for all bits) [0058] C. Calculate C.sub.in (in parallel for all groups) (total 8 steps) [0059] a. ripple carry inside nibble (total 5 steps) [0060] i. nibble 0: nibble ripple carry C1=0 (4 steps) [0061] ii. nibbles 1-3: nibble ripple carry C.sub.in=0 and C.sub.in=1 (5 steps) [0062] b. ripple carry between nibbles (3 steps) [0063] D. calculate sum: S=A⊕B⊕Cin (in parallel for all bits)
[0064] It may be appreciated that concurrent adder 310 may perform the same steps for computing the sum of a 16 bit variable as in the example of the 8 bit numbers with 2 additional steps of “ripple carry between groups” for the third and fourth groups. It may also be appreciated that concurrent adder 310 may use a concurrent adder in two phases. In the first phase, the carry out of the least significant bits of the variables are calculated and the carry out of the last bit, or the overflow of the calculation, is an input carry in value used in the calculation of the most significant bits of the variables.
[0065] It may further be appreciated that the total carry ripple computation time may include a) the steps needed to perform a standard ripple carry inside a single group, equal to the number of bits M in the group (4 steps in a nibble in the example), b) the computation of a second standard ripple carry inside the group assuming another value of the C.sub.in, that may take one additional step, as the computation for the first bit in a group may start immediately after the previous computation of that bit is completed, and c) number of groups minus 1 ripples between groups, as the C.sub.out of each group needs to ripple to the next group. For example, the computation complexity of ripple carry when adding two 16 bit numbers divided into four nibbles (the size of each nibble is 4), may be 4+1+3=8, while the computation complexity using a standard ripple carry for the same computation may be 16.
[0066] It may be appreciated that multi-bit concurrent adder 300 may concurrently perform multiple add operations on multiple pairs of operands stored in multiple columns of memory array 320, each pair stored in a different column. A complete add operation may be performed on a single column. Memory array 320 may comprise P columns and multi-bit concurrent adder 300 may concurrently operate on all columns, thereby performing P multi-bit add operations at the time.
[0067] While certain features of the invention have been illustrated and described herein, many modifications, substitutions, changes, and equivalents will now occur to those of ordinary skill in the art. It is, therefore, to be understood that the appended claims are intended to cover all such modifications and changes as fall within the true spirit of the invention.