Multiplication methods between signed multi-bit numbers, their memory circuits and chips
By using radix-4 Booth encoding rules and sliding window sampling to generate control signals, the in-memory computing circuit is optimized, solving the accuracy and efficiency problems of floating-point mantissa multiplication operations, reducing hardware overhead and power consumption, and making it suitable for high-performance AI inference chips and edge computing macrocells.
Patent Information
- Application Number
- CN202611323961.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-11-17
AI Technical Summary
Existing in-memory computing circuits cannot achieve accurate and efficient floating-point mantissa multiplication, and the overhead of external circuits is too large when processing floating-point mantissa formats.
A signed multi-bit multiplication method is adopted, combined with the radix-4 Booth encoding rule, and the operation logic is optimized by bit extension, sliding window sampling, generation of control signals and compensation codes. An in-memory computing circuit is designed to realize the multiplication operation of BF16 floating-point mantissa.
While ensuring computational accuracy, it simplifies circuit design, reduces hardware overhead and memory access power consumption, and is suitable for high-performance AI inference chips and edge computing macrocells.
Smart Images

Figure CN123115046A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of in-memory computing, and in particular to a method for multiplication of signed multi-bit numbers, as well as in-memory computing circuits and chips designed using this method. Background Technology
[0002] Recently, with the continuous expansion of deep learning models in artificial intelligence training and inference, high-performance digital signal processing, and other scenarios, the demand for computing power has grown exponentially. The "memory wall" problem of the traditional von Neumann architecture has become increasingly prominent, becoming a bottleneck restricting the improvement of computing system energy efficiency. In-memory computing technology, by embedding computing logic inside the storage array, completes data operations directly at the storage end, significantly reducing the power consumption and latency overhead caused by data movement. It has become one of the core technical paths to overcome the memory wall bottleneck and achieve high-energy-efficiency computing.
[0003] The BF16 (BrainFloating-Point16) format, with its advantages of wide dynamic range, simple hardware implementation, and strong adaptability, has become one of the mainstream floating-point data formats in artificial intelligence training and inference scenarios. In floating-point operations, the multiplication and accumulation operations of the mantissa account for the core computational load and are key to determining the energy efficiency and throughput of floating-point operations. Based on this, researchers have designed various in-memory computing circuits adapted to floating-point numbers to improve the speed of artificial intelligence training and inference. Among them, Fengbin Tu, Yiqi Wang, et al., published in January 2023 in IEEE JOURNAL OF SOLID-STATECIRCUITS, VOL.58, NO.1, entitled "ReDCIM: Reconfigurable Digital Computing In-Memory Processor With Unified FP / INTPipeline for Cloud AI Acceleration," pre-finds the maximum values of the input and weight exponents and shifts the mantissa. The shifted weight mantissa is stored in a memory array, and the Booth algorithm is used to calculate the mantissa multiplication. While this method can implement floating-point multiplication and multiply-accumulate operations in an in-memory computing architecture, it does not handle the hidden bits of floating-point numbers, lacking a set of partial product accumulations. Furthermore, since floating-point numbers are stored in sign-magnitude form, this circuit is not compatible with BF16 and INT8 formats for multiplication, and its encoding circuit has certain problems when applied to BF16 mantissa calculations. Considering these two points, this circuit cannot accurately calculate floating-point mantissa multiplication. Wang X, Jiao T, et al., published in July 2026 in a paper titled "SNAP-FPCIM: A 28-nmEmbedded-Serial-Alignment and Non-2's-Complement-MAC Floating-Point Compute-in-Memory MacroWith Adjustable Computation Precision," uses mantissa multiplication every two bits, and its multiplication cycle count is similar to Booth's algorithm. However, it requires converting the input to two's complement form, and in addition to compensating for the partial product's two's complement plus one, it also requires compensation for the sign bit. This adds extra circuit overhead, increasing the overall circuit area and energy consumption. Summary of the Invention
[0004] To address the problems of existing in-memory computing circuits struggling to achieve accurate and efficient floating-point mantissa multiplication and the excessive overhead of external circuits caused by processing floating-point mantissa formats, this invention provides a method for multiplication between signed multi-bit numbers, as well as an in-memory computing circuit and chip designed using this method.
[0005] The technical solution provided by this invention is as follows: A method for multiplication between signed multi-bit numbers, comprising: Obtain the numerical bits of the input IN, and perform bit extension on it according to the radix-4 Booth encoding rule to obtain the input sequence.
[0006] The input sequence is sampled using a sliding window with a window length of 3 and a step length of 2 to obtain multiple 3-bit input segments.
[0007] According to the first encoding rule, and combining the values of the sign bits of the input and weight W, a set of corresponding control signals NEG, ZERO and ONE are generated for each input segment.
[0008] According to the second encoding rule, the high-order compensation code HC and low-order compensation code LC corresponding to the partial product of each input segment and weight are generated based on NEG, ZERO and ONE.
[0009] According to the preset gating rules, the original code or inverse code of each bit of the gating weight is obtained based on the control signal NEG; the gating result is ORed with ZERO to obtain the suboperation result OUT of the radix-4 Booth multiplication.
[0010] The output signal SOUT is obtained by shifting OUT according to the control signal ONE.
[0011] SOUT, HC, and LC are aligned by weight and added together to obtain the partial product of the input segment and the weights.
[0012] The partial products of each input segment and its weight are shifted and added together to obtain the product of IN and W.
[0013] As a further improvement of the present invention, the operation logic of bit expansion of the numerical bits of the input IN according to the radix-4 Booth encoding rule to obtain the input sequence includes: padding the least significant bit of the input numerical bits with 0 and the most significant bit with 001 to obtain the required input sequence.
[0014] As a further improvement of the present invention, the first encoding rule includes: NEG = 1 if there are an odd number of 1s in the sign bit of the input and weights, as well as in the highest bit of the input segment; otherwise, NEG = 0.
[0015] If all the values in the input field are the same, then ZERO=1; otherwise, ZERO=0.
[0016] If there are an odd number of 1s in the lower two bits of the input segment, then ONE=1; otherwise, ONE=0.
[0017] As a further improvement to the present invention, the second encoding rule includes: When ZERO=1, HC=000, LC=00.
[0018] When ZERO=0, ONE=0, NEG=0, HC=010, LC=00.
[0019] When ZERO=0, ONE=0, NEG=1, HC=100, LC=10.
[0020] When ZERO=0, ONE=1, NEG=0, then HC=001, LC=00.
[0021] When ZERO=0, ONE=1, NEG=1, then HC=110, LC=01.
[0022] As a further improvement of the present invention, the preset gating rules include: If NEG=1, select the original code of the gating weight; if NEG=0, select the inverse code of the gating weight.
[0023] As a further improvement of the present invention, the output signal SOUT is obtained by shifting OUT according to the control signal ONE, including: If ONE=1, then add "0" before the most significant bit of OUT to get SOUT; if ONE=0, then add "0" after the least significant bit of OUT to get SOUT.
[0024] The present invention also includes an in-memory computing circuit, which uses the aforementioned signed multi-bit multiplication method to realize multiplication and multiply-accumulate operations for BF16 floating-point mantissas.
[0025] As a further improvement of the present invention, the in-memory computing circuit includes: at least one input encoding circuit, at least one compensation term generation circuit, in-memory array, at least one controllable shift circuit, and result generation circuit.
[0026] The input encoding circuit is used to perform bit expansion and sliding window sampling on the numerical bits of the input IN according to the radix-4 Booth encoding rule to obtain multiple input segments. It then generates a set of corresponding control signals NEG, ZERO, and ONE for each input segment based on the sign bits of the input and weights.
[0027] The compensation term generation circuit generates high-order compensation code HC and low-order compensation code LC based on the control signals NEG, ZERO, and ONE. The high-order compensation code is used for hidden bit compensation of the weight mantissa; the low-order compensation code is used for two's complement plus one compensation of the negative partial product.
[0028] The memory array consists of multiple memory cells arranged in an array; the memory cells in the same column form a computation column and are used to pre-store the sign bit of the weight W and the values of each numerical bit from high to low in sequence. Each memory cell is used to generate the sub-operation result OUT of the radix-4 Booth multiplication based on the control signals NEG and ZERO corresponding to the input segment.
[0029] The controllable shift circuit is used to shift OUT according to the control signal ONE corresponding to the input segment to obtain the output signal SOUT; The result generation circuit is used to align and add SOUT, HC, and LC according to their weights to obtain the partial product of each input segment and its weight; and to shift and add the partial products of each input segment and its weight to obtain the product of input IN and weight W.
[0030] As a further improvement of the present invention, the operation logic for implementing the multiplication operation between the input IN and the weight W includes: Select one of the calculated columns and store the sign and value bits of the weights sequentially into the calculation cells of each row.
[0031] In the first calculation cycle, the control signals NEG, ZERO and ONE of the first input segment generated by the input encoding circuit are transmitted to the compensation term generation circuit, the storage unit array and the controllable shift circuit, and the result generation circuit generates the partial product of the current input segment and the weight.
[0032] In subsequent calculation cycles, the control signals NEG, ZERO, and ONE of the remaining input segments generated by the input encoding circuit are transmitted to the compensation term generation circuit, the storage unit array, and the controllable shift circuit; the result generation circuit generates the partial product of the current input segment and the weight, and shifts and accumulates the partial product of this round with the sum of the partial products of the previous round.
[0033] After the last calculation cycle ends, the result generation circuit outputs the product between IN and W.
[0034] As a further improvement of the present invention, the in-memory computing circuit includes multiple input encoding circuits, a compensation term generation circuit, and a controllable shift circuit; each computing column in the in-memory array is provided with an independent input encoding circuit, a compensation term generation circuit, and a controllable shift circuit. The operation logic for implementing the multiplication and accumulation operation between multiple inputs IN1~INn and multiple weights W1~Wn based on the above-mentioned in-memory computing circuit includes: Select n calculation columns and store the sign and value bits of each weight sequentially into the storage unit of each calculation column.
[0035] In the first calculation cycle, the multiplication operation between the first input segment of each input and the corresponding weight is performed in each calculation column, and the resulting partial products are added together.
[0036] In subsequent calculation cycles, the radix-4 Booth multiplication suboperation between each input segment and its corresponding weight is implemented in each calculation column; the partial products obtained in this round are added together and then added to the accumulated result of all partial products in the previous round by shifting.
[0037] After the last calculation cycle ends, the result generation circuit outputs the result of the multiplication and accumulation operation between multiple inputs IN1~INn and multiple weights W1~Wn.
[0038] As a further improvement of the present invention, the input encoding circuit includes a control signal generation circuit, which is used to generate a control signal based on the input sign bit IN. sigh The sign bit W of the weight sigh And the value X of each bit in the 3-bit input segment.<i+1> , X <i-1>Generate the control signals NEG, ZERO, and ONE corresponding to the current input segment.
[0039] The control signal generation circuit includes a three-input AND gate (AND1), a two-input OR gate (OR), a three-input NOR gate (NOR1), a three-input XOR gate (XOR1), and a two-input XOR gate (XOR2). The circuit connection is as follows: One of the inputs of AND1, XOR1, or NOR1 is connected to X<i+1> The second input of AND1 and NOR1 is connected to one of the inputs of XOR2. The third input of AND1 and NOR1 is connected to the other input of XOR2. <i-1>The second input of XOR1 is connected to IN. sigh The third input of XOR1 is connected to W. sigh The outputs of AND1 and NOR1 are connected to the two inputs of OR, respectively; the output of XOR1 is used to output NEG; the output of OR is used to output ZERO; and the output of XOR2 is used to output ONE.
[0040] As a further improvement of the present invention, the compensation term generation circuit includes one two-input XOR gate XOR3, two two-input NOR gates NOR2 and NOR3, two three-input NOR gates NOR4 and NOR5, and one three-input AND gate AND2. The circuit connection is as follows: One input of XOR3 is connected to NEG, and the other input is connected to ONE. One input of NOR2 is connected to ZERO, and the other input is connected to the inverted signal of NEG; the output of NOR2 is the most significant bit of HC. One input of NOR3 is connected to ZERO, and the other input is connected to the output of XOR3; the output of NOR2 is the second most significant bit of HC. One input of NOR4 is connected to ZERO, the second input is connected to NEG, and the third input is connected to the inverted signal of ONE; the output of NOR4 is the least significant bit of HC. One input of NOR5 is connected to ZERO, the second input is connected to ONE, and the third input is connected to the inverted signal of NEG; the output of NOR5 is the most significant bit of LC. One input of AND2 is connected to the inverted signal of ZERO, the second input is connected to NEG, and the third input is connected to ONE; the output of AND2 is the least significant bit of LC.
[0041] As a further improvement of the present invention, the in-memory computing unit includes a 6T-SRAM cell, a 2-to-1 selector MUX, and a NOR gate NOR0. The selection terminal of MUX is connected to NEG; the two input terminals of MUX are respectively connected to the storage node Q and the inverting storage node QB of the 6T-SRAM cell; the output terminal of MUX is connected to one of the input terminals of NOR0; the other input terminal of NOR0 is connected to ONE; the output terminal of NOR0 serves as the output port of OUT.
[0042] As a further improvement of the present invention, each memory cell in the same column of the memory array shares bit lines BL and BLB; the control signals NEG and ZERO output by the input encoding circuit are synchronously transmitted to all memory cells in the same column through BL and BLB of each column, respectively.
[0043] The present invention also includes a chip packaged from the in-memory computing circuit described above; thereby supporting the use of the signed multi-bit multiplication method described above to realize multiplication and multiply-accumulate operations for BF16 floating-point mantissas.
[0044] The present invention has the following beneficial effects: Compared to traditional floating-point mantissa multiplication and accumulation circuits and existing SRAM floating-point in-memory computation schemes, this invention deeply integrates the radix-4 Booth encoding mechanism with the SRAM digital domain in-memory array. While ensuring the accuracy of BF16 floating-point mantissa multiplication and accumulation operations, the optimized computation logic simplifies circuit design, thereby effectively reducing hardware overhead and memory access power consumption. This invention is applicable to high-performance AI inference chips and edge computing macrocell designs with stringent requirements for both accuracy and energy efficiency.
[0045] The signed multi-bit number multiplication method and storage circuit provided by this invention are designed based on the radix-4 Booth multiplication algorithm. The multiplicand and multiplier in this algorithm are replaced with signed floating-point multi-bit weight mantissas and floating-point multi-bit input mantissas, respectively. Bit extension processing is performed on the input mantissa, adding an extra high-order extension code 001, and the encoding logic of the NEG signal is modified. The new encoding logic treats the hidden bits of the weights as compensation terms, without occupying additional storage space. Attached Figure Description
[0046] Figure 1 This is a flowchart of the multiplication method between signed multi-bit numbers provided in Embodiment 1 of the present invention.
[0047] Figure 2 This is a schematic diagram of the input sequence obtained by bit expansion of the numerical bits of the input IN.
[0048] Figure 3 This is a circuit block diagram of the in-memory computing circuit provided in Embodiment 2 of the present invention.
[0049] Figure 4 This is a circuit diagram of the input encoding circuit in Embodiment 2 of the present invention.
[0050] Figure 5 This is a circuit diagram of the control signal generation circuit provided in Embodiment 2 of the present invention.
[0051] Figure 6 This is a circuit diagram of the compensation term generation circuit provided in Embodiment 2 of the present invention.
[0052] Figure 7 This is an architecture diagram of the in-memory computing circuit provided in Embodiment 2 of the present invention.
[0053] Figure 8 This is a circuit diagram of the memory computing unit used in Embodiment 2 of the present invention.
[0054] Figure 9 for Figure 8 The circuit diagram of the 2-to-1 selector and NOR gate in the memory cell. Detailed Implementation
[0055] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0056] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the specification of this invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.
[0057] Example 1 To address the lack of in-memory computing circuits in existing technologies that can efficiently and with low power consumption handle floating-point mantissa multiplication, this embodiment provides a method for multiplication between signed multi-bit numbers. This method readjusts the operational logic of the circuit in handling multiplication between two signed multi-bit numbers. This new operational logic can lay the foundation for designing more efficient in-memory computing circuits that can support multiplication between floating-point numbers.
[0058] Specifically, the signed multi-bit multiplication method provided in this embodiment is used to calculate the product between the input IN and the weight W, where the highest bit of IN and W is the sign bit, and the remaining bits are the numerical bits. For example... Figure 1 As shown, this multiplication method includes the following steps: 1. Obtain the numerical bits of the input IN and perform bit extension on it according to the radix-4 Booth encoding rule to obtain the input sequence.
[0059] In this embodiment, the operation logic for bit-expanding the numerical bits of the input IN according to the radix-4 Booth encoding rule to obtain the input sequence includes: padding the least significant bit of the input numerical bits with 0s and the most significant bit with 001s to obtain the desired input sequence. For example, assuming that the input IN in a certain operation is 8 bits, including the sign bit and 7-bit numerical bits, the numerical bits can be represented in descending order as: M6M5M4M3M2M1M0. At this time, if... Figure 2 As shown, the input sequence obtained after bit expansion is denoted as: 001M6M5M4M3M2M1M00.
[0060] 2. Perform sliding window sampling on the input sequence with a window length of 3 and a step length of 2 to obtain multiple 3-bit input segments.
[0061] The multiplication logic provided in this embodiment is still implemented according to the radix-4 Booth multiplication strategy. Therefore, the bit-extended input sequence needs to be sampled by a sliding window with a step size of 2 according to the rule of three bits per group. Each group generates an encoded value, which is referred to as the input segment in this embodiment. The result of the input segment can correspond to five control signals: -2, -1, 0, 1, and 2.
[0062] Specifically, still in Figure 2 Taking the input sequence shown as an example, in this embodiment, after sampling the input sequence by sliding window from back to front, 5 input segments can be obtained, which are denoted as: M1M00, M3M2M1, M5M4M3, 1M6M5, 001.
[0063] Third, according to the first encoding rule, and combining the value of the sign bit of the input and weight W, generate a set of corresponding control signals NEG, ZERO and ONE for each input segment.
[0064] In this embodiment, assuming an input segment is denoted as IN<2k+1>IN<2k>IN<2k-1>, the sign bit of the corresponding input IN is denoted as H. sigh The sign bit of the weight W multiplied with the input IN is denoted as W. sigh Then according to H sigh W sigh The first encoding rule for generating the corresponding control signals NEG, ZERO, and ONE from the current input segment IN<2k+1>IN<2k>IN<2k-1> is as follows: (1) NEG = 1 if there are an odd number of 1s in the sign bit of the input and weight and the value of the highest bit of the input segment; otherwise, NEG = 0.
[0065] Specifically, the level of the control signal NEG mainly depends on H. sigh W sigh The value of the three bits IN<2k+1> is considered. If there are an odd number of 1s in the three bits, the NEG level is high, i.e., NEG=1. Conversely, if there are an even number of 1s in the three bits, the NEG level is low, i.e., NEG=0. The corresponding truth table is shown in Table 1 below: Table 1: Truth Table of NEG Signal in the First Encoding Rule (2) If all the values in the input segment are the same, then ZERO=1; otherwise, ZERO=0.
[0066] Specifically, the level of the control signal ZERO mainly depends on the values of the three bits IN<2k+1>, IN<2k>, and IN<2k-1> in the input segment. If all three bits in the input segment are 0 or all are 1 (i.e., all three bits are equal), ZERO is in a high-level state, i.e., ZERO=1. Conversely, if not all three bits are 0 or not all are 1 (i.e., not all three bits are equal), ZERO is in a low-level state, i.e., ZERO=0. The corresponding truth table is shown in Table 2 below: Table 2: Truth Table of ZERO Signal in the First Encoding Rule (3) If there are an odd number of 1s in the lower two bits of the input segment, then ONE=1; otherwise, ONE=0.
[0067] Specifically, the level state of the control signal ONE mainly depends on the values of the two bits IN<2k> and IN<2k-1>. If there are an odd number of 1s in the two values, the level state of ONE is high, i.e., ONE=1. Conversely, if there are an even number of 1s in the two values, the level state of ONE is low, i.e., ONE=0. The corresponding truth table is shown in Table 3 below: Table 3: Truth Table of ONE Signal in the First Encoding Rule Fourth, according to the second encoding rule, generate the high-order compensation code HC and low-order compensation code LC corresponding to the partial product of each input segment and weight based on NEG, ZERO and ONE.
[0068] When calculating signed multi-bit number multiplication using radix-4 Booth multiplication, the weights and input segments are used to calculate the partial product. The three-bit input segment uniquely determines whether the weight is multiplied by -2, -1, 0, 1, or 2; the result is the partial product generated in that cycle. In this embodiment, after the sub-operation result OUT of the radix-4 Booth multiplication calculated using a specific method, it needs to be shifted and then combined with the high-order compensation code HC and low-order compensation code LC generated by the control signals (ZERO, NEG, ONE) encoded from the three-bit input to obtain the correct partial product of the floating-point mantissa multiplication. HC is mainly used for hidden bit compensation of the weights when no hidden bits are introduced during the calculation; LC is used to perform two's complement increment compensation on the weight data when NEG=1.
[0069] In this embodiment, the second encoding rule includes: When ZERO=1, HC=000, LC=00.
[0070] When ZERO=0, ONE=0, NEG=0, HC=010, LC=00.
[0071] When ZERO=0, ONE=0, NEG=1, HC=100, LC=10.
[0072] When ZERO=0, ONE=1, NEG=0, then HC=001, LC=00.
[0073] When ZERO=0, ONE=1, NEG=1, then HC=110, LC=01.
[0074] The underlying logic of the second encoding rule is as follows: When ZERO is 1, the current partial product is 0×W, and the high-order compensation code is 000. When ZERO is 0, ONE is 0, and NEG is 0, the current partial product is 2×W, and the high-order compensation code is 010 (the hidden bit is shifted left by one bit). When ZERO is 0, ONE is 0, and NEG is 1, the current partial product is -2×W, and the high-order compensation code is 100 (the first two bits of the high-order compensation code are inverted after shifting the hidden bit left by one bit; the least significant bit of HC is not affected by the inversion after the shift). When ZERO=0, ONE=1, and NEG=0, the current partial product is 1×W, and the high-order compensation code is 001 (the hidden bit is in the current position). When ZERO=0, ONE=1, and NEG=1, the current partial product is -1×W, and the high-order compensation code is 110 (all 3 bits of the high-order compensation code are inverted).
[0075] Correspondingly, when ZERO is 1, it means the currently calculated partial product is 0×W, and the low-order compensation code is 00; when ZERO is 0, ONE is 0, and NEG is 0, it means the currently calculated partial product is 2×W, and the low-order compensation code is 00 (no inversion, no padding with 1); when ZERO is 0, ONE is 0, and NEG is 1, it means the currently calculated partial product is -2×W, and the low-order compensation code is 10 (inverted, padding with 1, then left-shifted by one bit); when ZERO=0, ONE=1, and NEG=0, it means the currently calculated partial product is 1×W, and the low-order compensation code is 00 (no inversion, no padding with 1); when ZERO=0, ONE=1, and NEG=1, it means the currently calculated partial product is -1×W, and the low-order compensation code is 01 (inverted, padding with 1).
[0076] In summary, the truth tables for the second encoding rule used to generate the high-order compensation code HC and the low-order compensation code LC based on the control signals ZERO, NEG, and ONE are shown in Tables 4 and 5: Table 4: Truth table of 3-bit high-order compensation code HC<2:0> Table 5: Truth table of 3-bit low-order compensation code LC<1:0> 5. According to the preset gating rules, select the original or inverse value of each bit of the gating weight based on the control signal NEG; perform bitwise OR operation with ZERO to obtain the suboperation result OUT of the radix-4 Booth multiplication.
[0077] In this embodiment, the preset gating rule is: if NEG=1, the original value of each bit of the gating weight is selected; if NEG=0, the inverse value of each bit of the gating weight is selected. Based on this, the calculation process of the sub-operation result OUT in this embodiment can be represented by the following expression: ; In the above formula, W i The numerical value representing the weight is the first bit. i The value of the bit; express W i The inverse code; OUT i express W i The result of the suboperation of the radix-4 Booth multiplication between the input segments corresponding to the current control signals NEG and ZERO.
[0078] 6. OUT is shifted according to the control signal ONE to obtain the output signal SOUT.
[0079] In this embodiment, shifting OUT according to the control signal ONE to obtain the output signal SOUT includes: If ONE=1, then add "0" before the most significant bit of OUT to get SOUT; that is: SOUT={0,OUT}; if ONE=0, then add "0" after the least significant bit of OUT to get SOUT; that is: SOUT={OUT,0}.
[0080] In this embodiment, the shift operation essentially means that when ONE=1, the sub-operation result OUT is directly used as the output signal SOUT. At this time, in order to ensure that the length of SOUT is consistent under different operations, 0 is padded before the most significant bit of OUT to obtain the final output signal SOUT. When ONE=0, the sub-operation result OUT is shifted left by one bit (i.e., ×2) to obtain the output signal SOUT.
[0081] 7. Align SOUT, HC, and LC according to their weights and add them together to obtain the partial product of the input segment and the weights.
[0082] As previously mentioned, when performing signed multi-bit multiplication using radix-4 Booth multiplication, the partial product of the weights and the input segment should be obtained by adding the shifted value SOUT of the sub-operation result to the high-order compensation code HC and the low-order compensation code LC. The high-order compensation code is used for weight hiding bit compensation; the low-order compensation code is used for two's complement plus one compensation for the negative partial product.
[0083] 8. Shift and add the partial products of each input segment and the weights to obtain the product of IN and W.
[0084] In this embodiment, for each input segment scanned from the input sequence after the input IN bit extension, the partial product between each input segment and the weight W is calculated according to the same strategy. Next, these partial products are added with weights shifted; the final result is the product of IN and W.
[0085] Example 2 Based on the signed multi-bit multiplication method provided in Embodiment 1, this embodiment further provides a novel in-memory computing circuit with a new architecture designed based on this multiplication strategy. For the input IN and weight W input to the circuit, the in-memory computing circuit will use the signed multi-bit multiplication method as in Embodiment 1 to complete the multiplication operation and even the multiply-accumulate operation between the two.
[0086] In practical applications, the in-memory computing circuit provided in this embodiment is mainly designed for the multiplication and multiply-accumulate operations of BF16 (Brain FloatingPoint 16) floating-point mantissas; it belongs to the digital domain in-memory computing circuit. The basic idea of digital domain in-memory computing is to embed digital operation logic into the storage array, and perform data operations directly within the storage unit, avoiding the frequent data transfer between storage and computing units in the traditional von Neumann architecture, thereby significantly improving throughput and energy efficiency.
[0087] In one typical solution provided in this embodiment, such as Figure 3 As shown, the in-memory computing circuit includes: at least one input encoding circuit, at least one compensation term generation circuit, in-memory array, at least one controllable shift circuit, and result generation circuit.
[0088] The input encoding circuit is used to perform bit expansion and sliding window sampling on the numerical bits of the input IN according to the radix-4 Booth encoding rule to obtain multiple input segments. It then generates a set of corresponding control signals NEG, ZERO, and ONE for each input segment based on the sign bits of the input and weights. In practical applications, the in-memory computing circuit of this embodiment does not limit the specific circuit structure and principle of the input encoding circuit; it only needs to be able to obtain each input segment under the radix-4 Booth rule and its corresponding three control signals NEG, ZERO, and ONE based on the numerical bits of the input IN.
[0089] In an optional embodiment, such as Figure 4 As shown, the input IN and weight W to be processed are first processed by the input encoding circuit. The input encoding circuit can be divided into two parts: a sampling circuit and a control signal generation circuit. The sampling circuit is used to perform bit expansion on the numerical bits of the input IN according to the radix-4 Booth encoding rule, and then performs sliding window sampling on the bit-expanded input sequence with a window length of 3 and a step size of 2, thereby obtaining input segments with different weights. The control signal generation circuit is used to generate the input IN based on the sign bit IN. sigh The sign bit of weight W sigh And the value X of each bit in the 3-bit input segment.<i+1> , X <i-1>Generate the control signals NEG, ZERO, and ONE corresponding to the current input segment.
[0090] In the specific solution of this embodiment, the control signal generation circuit can adopt the following... Figure 5 The circuit structure shown includes a three-input AND gate (AND1), a two-input OR gate (OR), a three-input NOR gate (NOR1), a three-input XOR gate (XOR1), and a two-input XOR gate (XOR2). The corresponding circuit connections are as follows: One of the inputs of AND1, XOR1, or NOR1 is connected to X<i+1> The second input of AND1 and NOR1 is connected to one of the inputs of XOR2. The third input of AND1 and NOR1 is connected to the other input of XOR2. <i-1>The second input of XOR1 is connected to IN. sigh The third input of XOR1 is connected to W. sigh The outputs of AND1 and NOR1 are connected to the two inputs of OR, respectively; the output of XOR1 is used to output NEG; the output of OR is used to output ZERO; and the output of XOR2 is used to output ONE.
[0091] Based on the circuit principle, it can be seen that the control signal generation circuit receives different IN signals. sigh W sigh and X<i+1> , X <i-1>The signals are processed, and the control signals NEG, ZERO, and ONE corresponding to the current input segment are generated according to the first encoding rules shown in Tables 1-3.
[0092] It should be noted that, in practical applications, designs different from those in other applications can also be further developed. Figure 5 And it can process the input signal IN according to the first encoding rule. sigh W sigh and X<i+1> , X <i-1>The circuits are processed to obtain the corresponding control signals NEG, ZERO, and ONE; and these circuits are used as the control signal generation circuits required by the in-memory computing circuit in this embodiment.
[0093] The compensation term generation circuit is used to generate high-order compensation code HC and low-order compensation code LC based on the control signals NEG, ZERO, and ONE. The high-order compensation code is used for hidden bit compensation of the weights; the low-order compensation code is used for two's complement plus one compensation of the negative partial product.
[0094] In this embodiment, to process the input control signals NEG, ZERO, and ONE to obtain the corresponding high-order compensation code HC and low-order compensation code LC, a compensation term generation circuit is designed. Specifically, as follows... Figure 6 As shown, the compensation term generation circuit includes one two-input XOR gate (XOR3), two two-input NOR gates (NOR2 and NOR3), two three-input NOR gates (NOR4 and NOR5), and one three-input AND gate (AND2). The corresponding circuit connections are as follows: One input of XOR3 is connected to NEG, and the other input is connected to ONE. One input of NOR2 is connected to ZERO, and the other input is connected to the inverted signal of NEG; the output of NOR2 is the most significant bit of HC. One input of NOR3 is connected to ZERO, and the other input is connected to the output of XOR3; the output of NOR2 is the second most significant bit of HC. One input of NOR4 is connected to ZERO, the second input is connected to NEG, and the third input is connected to the inverted signal of ONE; the output of NOR4 is the least significant bit of HC. One input of NOR5 is connected to ZERO, the second input is connected to ONE, and the third input is connected to the inverted signal of NEG; the output of NOR5 is the most significant bit of LC. One input of AND2 is connected to the inverted signal of ZERO, the second input is connected to NEG, and the third input is connected to ONE; the output of AND2 is the least significant bit of LC.
[0095] Combination Figure 6 Analysis of the circuit principle of the above compensation term generation circuit shows that it can convert different input control signals into corresponding 3-bit high-order compensation code HC and 2-bit low-order compensation code LC in one go, according to the second encoding rules described in Tables 4 and 5.
[0096] It should be noted that, similar to the control signal generation circuit, in practical applications, circuits different from those used in the control signal generation circuit can also be designed. Figure 6 Furthermore, it is a circuit that can convert the input control signals NEG, ZERO, and ONE with different code values into the corresponding high-order compensation code HC and low-order compensation code LC according to the second encoding rule; and uses it as the compensation term generation circuit required by the in-memory calculation circuit in this embodiment.
[0097] In this embodiment, please refer to Figure 7 The memory array consists of multiple memory cells arranged in an array. Each memory cell in the same column forms a computation column and is used to pre-store the sign bit of the weight W and the values of each numerical bit from high to low in sequence. Each memory cell is used to generate the sub-operation result OUT of the radix-4 Booth multiplication based on the control signals NEG and ZERO corresponding to the input segment.
[0098] Specifically, in practical applications, each memory unit in the memory array of this embodiment is as follows: Figure 7 and Figure 8 As shown, it includes a 6T-SRAM cell, a 2-to-1 multiplexer MUX, and a NOR gate NOR0. The selection terminal of the MUX is connected to NEG; the two input terminals of the MUX are connected to the storage node Q and the inverting storage node QB of the 6T-SRAM cell, respectively; the output terminal of the MUX is connected to one input terminal of the NOR0; the other input terminal of the NOR0 is connected to ONE; and the output terminal of the NOR0 serves as the OUT output port. Furthermore, in practical applications… Figure 8 The 2-to-1 selector MUX and NOR gate NOR0 in the shown memory unit can be implemented using a full CMOS-based circuit. Specifically, their circuits are as follows: Figure 9 As shown.
[0099] In this storage unit, the 6T-SRAM cell serves as both the basic structure for data storage and for pre-storing one bit of the weight value. W i Pre-deposit W i Subsequently, driven by the input control signals NEG and ONE, MUX and NOR0 can generate and output the suboperation result OUT of the radix-4 Booth multiplication between the current input segment and the weight.
[0100] In this embodiment, each memory cell in the same column of the memory array shares bit lines BL and BLB. Based on this, the control signals NEG and ZERO output by the input encoding circuit can be synchronously transmitted to all memory cells in the same column via BL and BLB, respectively. In this structure, BL and BLB can be used as bit lines in storage mode to complete output writing and reading. In operation mode, they serve as signal transmission lines between the input encoding circuit and the memory cells for transmitting control signals NEG and ZERO. This design allows for the multiplexing of existing signal lines, optimizing the area and power consumption of the in-memory computing circuit.
[0101] The controllable shift circuit is used to shift the OUT signal according to the control signal ONE corresponding to the input segment to obtain the output signal SOUT. In this embodiment, the controllable shift circuit can be an array circuit consisting of multiple shift units. The output port of OUT in each memory unit in the memory array is electrically connected to one of the shift units. The shift unit is used to shift the OUT output of each memory unit according to the control signal ONE on the column to obtain the corresponding SOUT.
[0102] In this embodiment, the result generation circuit is used to add SOUT, HC, and LC according to their weights to obtain the partial product of each input segment and its weight. Then, the partial products of each input segment and its weight are shifted and added to obtain the product of input IN and weight W. In this embodiment, the result generation circuit may include a compensation term adder tree, a shift module, and a partial product adder tree; wherein, the compensation term adder tree is used to add the high-order compensation code HC and the low-order compensation code LC in each partial product to obtain the total compensation amount; the partial product adder tree is used to add the total compensation amount to SOUT to obtain a partial product, and then the shift module is used to shift and align the partial products of different input segments and their weights according to their weights before adding them to obtain the product of input IN and weight W.
[0103] In the in-memory computing circuit provided in this embodiment, a multiplication operation between a single input IN and a weight W can be achieved using a single computation column in the in-memory array, an input encoding circuit, a compensation term generation circuit, a controllable shift circuit, and a result generation circuit. In this circuit architecture, the input encoding circuit receives a 3-bit input segment in each computation cycle, generates corresponding NEG, ZERO, and ONE signals based on the received input segment, and connects to the corresponding column of the in-memory array via bit lines BL and BLB, outputting control signals NEG and ZERO to it. The compensation term generation circuit is electrically connected to the input encoding circuit to receive its output control signals NEG, ZERO, and ONE, and then generates corresponding high-order control code HC and low-order control code LC based on NEG, ZERO, and ONE, and outputs them to the result generation circuit. The controllable shift circuit is electrically connected to the output of OUT in each memory unit to receive the sub-operation result OUT of the radix-4 Booth multiplication. The controllable shift circuit is also electrically connected to the compensation term generation circuit to receive the control signal ONE output by it. This allows the output signal SOUT to be shifted in each memory unit according to the control signal ONE and output to the result generation circuit. The result generation circuit adds up the SOUT, HC and LC received for each calculation cycle, and then adds the calculation results of different calculation cycles according to the weight shift, thereby obtaining the product of the input IN and the weight W.
[0104] Specifically, in this embodiment, the operation logic for implementing the multiplication operation between the input IN and the weight W includes: (I) Select one of the calculation columns and store the sign bit and value bit of the weight into the calculation cell of each row in sequence.
[0105] (II) In the first calculation cycle, the control signals NEG, ZERO and ONE of the first input segment generated by the input encoding circuit are transmitted to the compensation term generation circuit, the storage unit array and the controllable shift circuit, and the result generation circuit generates the partial product of the current input segment and the weight.
[0106] (III) In each subsequent calculation cycle, the control signals NEG, ZERO and ONE of the remaining input segments generated by the input encoding circuit are transmitted to the compensation term generation circuit, the storage unit array and the controllable shift circuit; the result generation circuit generates the partial product of the current input segment and the weight, and shifts and accumulates the partial product of this round with the sum of the partial products of the previous round.
[0107] (IV) After the last calculation cycle ends, the result generation circuit outputs the product between IN and W.
[0108] In a more optimized solution of this embodiment, such as Figure 7 As shown, the in-memory computing circuit may further include multiple input encoding circuits, compensation term generation circuits, and controllable shift circuits; each computing column in the in-memory array is equipped with an independent input encoding circuit, compensation term generation circuit, and controllable shift circuit. The operational logic for implementing the multiplication and accumulation operation between multiple inputs IN1~INn and multiple weights W1~Wn based on the above in-memory computing circuit includes: (i) Select n calculation columns and store the sign bit and value bit of each weight into the storage unit of each calculation column in sequence.
[0109] (ii) In the first calculation cycle, the multiplication operation between the first input segment of each input and the corresponding weight is performed in each calculation column, and the resulting partial products are added together.
[0110] (iii) In each subsequent calculation cycle, the sub-operation of the radix-4 Booth multiplication between each input segment and the corresponding weight is implemented in each calculation column; after adding the partial products obtained in this round, it is added to the cumulative result of all partial products in the previous round by shifting.
[0111] (iv) After the last calculation cycle ends, the result generation circuit outputs the result of the multiplication and accumulation operation between multiple inputs IN1~INn and multiple weights W1~Wn.
[0112] Example 3 To better utilize the in-memory computing circuit provided in Embodiment 2, this embodiment further provides a chip, which is packaged from the in-memory computing circuit as described in Embodiment 2; thereby supporting the use of the signed multi-bit multiplication operation method as described in Embodiment 1, and realizing multiplication and multiply-accumulate operations for BF16 floating-point mantissas.
[0113] When using this chip to process BF16 floating-point mantissa multiplication and multiply-accumulate operations, the input encoding circuit receives the 7-bit mantissa of the external input activation value, as well as the sign bits of the activation value and weights. Following the radix-4 Booth rule, it slides from the least significant bit (LSB) with a step size of 2, encoding a 3-bit window each cycle. The LSB window is always padded with logic 0 to meet the Booth algorithm boundary requirements. The encoding circuit outputs three sets of control signals: NEG (invert), ONE (1x / 2x weight selection), and ZERO (zero value). The TWO signal in the traditional radix-4 Booth algorithm is combined with the ONE signal (i.e., ONE=0 is equivalent to TWO=1 in the traditional radix-4 Booth algorithm). The ONE and ZERO signals are generated in the same way as in the traditional radix-4 Booth algorithm. The NEG signal, based on the traditional radix-4 Booth encoding logic, undergoes an additional three-input XOR operation with the sign bits of the activation value and weights, eliminating redundant inversion operations.
[0114] The compensation term generation circuit receives NEG, ONE, and ZERO signals and generates a 3-bit high-order compensation code HC (weight hidden bit compensation) and a 2-bit low-order compensation code LC (negative partial product complement + 1 compensation). These are then merged by the compensation term adder tree and fed into the partial product adder tree, avoiding the addition of complex addition logic within the array.
[0115] The in-memory array stores the sign bit and mantissa of the weights. Each column of 8 cells stores one weight data, and each column is equipped with an input encoding circuit and a compensation term generation circuit. The entire array has 8 columns. The in-memory array performs the calculation of the weight values under the control of the NEG and ZERO signals, and outputs the results of each column to the respective shift modules. In the shift modules, the array output result SOUT under the control of the ONE signal is calculated. The partial integrator tree receives the results from each shift module and the compensation term adder tree, accumulates them in the current cycle, and stores them in the register group for shift accumulation in the next cycle.
[0116] The above-described embodiments are merely one implementation of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the inventive concept, and these all fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.
Claims
1. A method for multiplication between signed multi-bit numbers, characterized in that, It includes: Obtain the numerical bits of the input IN, and perform bit extension on it according to the radix-4 Booth encoding rule to obtain the input sequence; The input sequence is sampled using a sliding window with a window length of 3 and a step length of 2 to obtain multiple 3-bit input segments; According to the first encoding rule, and combining the value of the sign bit of the input and weight W, a set of corresponding control signals NEG, ZERO and ONE are generated for each input segment; According to the second encoding rule, the high-bit compensation code HC and low-bit compensation code LC corresponding to the partial product of each input segment and weight are generated based on NEG, ZERO and ONE. According to the preset gating rules, the original or inverse values of each bit of the gating weight are selected based on the control signal NEG; the gating result of the weight value is then bitwise ORed with ZERO to obtain the suboperation result OUT of the radix-4 Booth multiplication. The output signal SOUT is obtained by shifting OUT according to the control signal ONE. SOUT, HC, and LC are aligned by weight and added together to obtain the partial product of the input segment and the weights; The partial products of each input segment and its weight are shifted and added together to obtain the product of IN and W.
2. The multiplication method between signed multi-bit numbers according to claim 1, characterized in that: The step of bit-extending the input sequence according to the radix-4 Booth encoding rule includes: The input sequence is obtained by padding the least significant bit with 0 and the most significant bit with 001. And / or, the first encoding rule includes: NEG = 1 if there are an odd number of 1s in the sign bit of the input and weights and the value of the highest bit of the input segment; otherwise, NEG = 0. If all the values in the input field are the same, then ZERO=1; otherwise, ZERO=0. If there are an odd number of 1s in the lower two bits of the input segment, then ONE=1; otherwise, ONE=0. And / or, the second encoding rule includes: When ZERO=1, HC=000, LC=00; When ZERO=0, ONE=0, NEG=0, HC=010, LC=00; When ZERO=0, ONE=0, NEG=1, HC=100, LC=10; When ZERO=0, ONE=1, NEG=0, then HC=001, LC=00; When ZERO=0, ONE=1, NEG=1, then HC=110, LC=01; And / or, the preset gating rules include: If NEG=1, select the original code of the gating weight; if NEG=0, select the inverse code of the gating weight. And / or, the step of shifting OUT according to the control signal ONE to obtain the output signal SOUT includes: If ONE=1, then add "0" before the highest bit of OUT to get SOUT; If ONE=0, then add "0" after the least significant bit of OUT to get SOUT.
3. An in-memory computing circuit, characterized in that, It employs the signed multi-bit multiplication method as described in claim 1 or 2 to implement multiplication and multiply-accumulate operations for BF16 floating-point mantissas.
4. The in-memory computing circuit according to claim 3, characterized in that, It includes: At least one input encoding circuit is used to perform bit expansion and sliding window sampling on the numerical bits of the input IN according to the radix-4 Booth encoding rule to obtain multiple input segments; and to generate a set of corresponding control signals NEG, ZERO and ONE for each input segment according to the sign bits of the input and weights; At least one compensation term generation circuit is used to generate a high-order compensation code HC and a low-order compensation code LC based on control signals NEG, ZERO, and ONE; the high-order compensation code is used for weight hidden bit compensation; the low-order compensation code is used for negative partial product complement plus one compensation. The storage array consists of multiple storage units arranged in an array; the storage units in the same column form a computing column and are used to pre-store the sign bit of the weight W and the values of each numerical bit from high to low in sequence; each storage unit is used to generate the sub-operation result OUT of the radix-4 Booth multiplication according to the control signals NEG and ZERO corresponding to the input segment. At least one controllable shift circuit is used to shift OUT according to the control signal ONE corresponding to the input segment to obtain the output signal SOUT; The result generation circuit is used to add SOUT, HC and LC according to their weights to obtain the partial product of each input segment and its weight; and to shift and add the partial products of each input segment and its weight to obtain the product of input IN and weight W.
5. The in-memory computing circuit according to claim 4, characterized in that, The operational logic for implementing the multiplication operation between the input IN and the weight W includes: Select one of the calculated columns and store the sign bit and value bit of the weight in the storage cells of each row in sequence; In the first calculation cycle, the control signals NEG, ZERO and ONE of the first input segment generated by the input encoding circuit are transmitted to the compensation term generation circuit, the storage unit array and the controllable shift circuit, and the result generation circuit generates the partial product of the current input segment and the weight. In subsequent calculation cycles, the control signals NEG, ZERO, and ONE of the remaining input segments generated by the input encoding circuit are transmitted to the compensation term generation circuit, the storage unit array, and the controllable shift circuit; the result generation circuit generates the partial product of the current input segment and the weight, and shifts and accumulates the partial product of this round with the accumulated results of the partial products of the previous round. After the last calculation cycle ends, the result generation circuit outputs the product between IN and W.
6. The in-memory computing circuit according to claim 5, characterized in that: It includes multiple input encoding circuits, compensation term generation circuits, and controllable shift circuits; each computation column in the memory array is equipped with an independent input encoding circuit, compensation term generation circuit, and controllable shift circuit. The operational logic for implementing the multiplication and accumulation operation between multiple inputs IN1~INn and multiple weights W1~Wn includes: Select n calculation columns and store the sign bit and value bit of each weight into the storage unit of each calculation column in sequence. In the first calculation cycle, the multiplication operation between the first input segment of each input and the corresponding weight is performed in each calculation column, and the resulting partial products are added together. In subsequent calculation cycles, the sub-operation of radix-4 Booth multiplication between each input segment and its corresponding weight is implemented in each calculation column; the partial products obtained in this round are added together and then added to the accumulated result of all partial products in the previous round by shifting; After the last calculation cycle ends, the result generation circuit outputs the result of the multiplication and accumulation operation between multiple inputs IN1~INn and multiple weights W1~Wn.
7. The in-memory computing circuit according to claim 4, characterized in that: The input encoding circuit includes a control signal generation circuit, which is used to generate a control signal based on the input sign bit IN. sigh The sign bit W of the weight sigh And the value X of each bit in the 3-bit input segment.<i+1> , X <i-1> Generate the control signals NEG, ZERO, and ONE corresponding to the current input segment; The control signal generation circuit includes a three-input AND gate AND1, a two-input OR gate OR, a three-input NOR gate NOR1, a three-input XOR gate XOR1, and a two-input XOR gate XOR2, and the circuit connection is as follows: One of the inputs of AND1, XOR1, or NOR1 is connected to X<i+1> ; The second input of AND1 and NOR1 is connected to one of the inputs of XOR2. ; The third input of AND1 and NOR1 is connected to the other input of XOR2. <i-1> ;< / i-1> The second input of XOR1 is connected to IN. sigh The third input of XOR1 is connected to W. sigh ; The outputs of AND1 and NOR1 are connected to the two inputs of OR, respectively. The output of XOR1 is used to output NEG; the output of OR is used to output ZERO; and the output of XOR2 is used to output ONE.
8. The in-memory computing circuit according to claim 4, characterized in that: The compensation term generation circuit includes one two-input XOR gate (XOR3), two two-input NOR gates (NOR2 and NOR3), two three-input NOR gates (NOR4 and NOR5), and one three-input AND gate (AND2); the circuit connection is as follows: One input of XOR3 is connected to NEG, and the other input is connected to ONE; One input of NOR2 is connected to ZERO, and the other input is connected to the inverted signal of NEG; the output of NOR2 outputs the most significant bit of HC. One input of NOR3 is connected to ZERO, and the other input is connected to the output of XOR3; the output of NOR2 outputs the second most significant bit of HC. One input of NOR4 is connected to ZERO, the second input is connected to NEG, and the third input is connected to the inverted signal of ONE; the output of NOR4 outputs the least significant bit of HC. One input of the NOR5 is connected to ZERO, the second input is connected to ONE, and the third input is connected to the inverted signal of NEG; the output of the NOR5 is the most significant bit of LC. One input of AND2 is connected to the inverted signal of ZERO, the second input is connected to NEG, and the third input is connected to ONE; the output of AND2 is the least significant bit of LC.
9. The in-memory computing circuit according to claim 4, characterized in that: The in-memory computing unit includes a 6T-SRAM cell, a 2-to-1 multiplexer MUX, and a NOR gate NOR0; the selection terminal of MUX is connected to NEG; the two input terminals of MUX are respectively connected to the storage node Q and the inverting storage node QB of the 6T-SRAM cell; the output terminal of MUX is connected to one of the input terminals of NOR0; the other input terminal of NOR0 is connected to ONE; the output terminal of NOR0 serves as the output port of OUT. And / or, each memory cell in the same column of the memory array shares bit lines BL and BLB; the control signals NEG and ZERO output by the input encoding circuit are synchronously transmitted to all memory cells in the same column through BL and BLB of each column, respectively.
10. A chip, characterized in that: It is packaged with an in-memory computing circuit as described in any one of claims 4-9; and thus supports the use of the signed multi-bit multiplication operation method as described in claim 1 or 2 to realize multiplication and multiply-accumulate operations for BF16 floating-point mantissas.
