Disclosure of Invention
In view of the above problems, an object of the present invention is to provide a MAC array based on a resistive random access memory, so as to solve the problem that the actual size of the resistive random access memory array usually exceeds 1Mb, wherein a long WL/BL wiring causes a large amount of parasitic resistance/capacitance, which causes a large current drift when the products of memory cells at different positions in the array and WL input signals are the same during calculation, and further reduces the discrimination between different products and corresponding total currents, which even causes the overlapping of different products and corresponding current ranges in severe cases, resulting in read errors; the range of the MAC summation current is seriously overlapped, so that reading errors are caused, the difficulty and the test cost of circuit design are increased, and the accuracy of MAC operation is seriously reduced.
The invention provides a MAC array based on a resistive random access memory, which comprises a 1T1R resistive random access memory unit, word lines, source lines, bit lines, an ADC module and a shift adder, and is characterized in that,
1T1R resistance variable memory cells storing same bits with different weights are distributed on a plurality of adjacent continuous bit lines; wherein the spacing of the bit lines is less than or equal to 8;
the 1T1R resistive memory cells storing different bits with the same weight are distributed on the same bit line and have a value of 2nThe strip word lines are at intervals; n is less than or equal to 5;
each 1T1R resistive random access memory unit comprises a transistor-resistive random access memory;
the resistive random access memory comprises a resistor, wherein the resistor is connected with the transistor and can be high or low;
the word line is connected with the gate end of the transistor, is controlled by a decoder and is used for transmitting an input signal;
the source line and the 1T1R resistive memory cell, and the source line is used for applying voltage to the resistor to form bias current on the bit line;
the ADC module is connected with the bit lines, all the bit lines share one ADC module, and the ADC module is used for converting the bias current in the bit lines to form a digital product operation result;
the shift adder is used for summing the digital product operation results to obtain a MAC operation result.
Preferably, the bias current is generated based on the input signal and the voltage, reflecting a product of the input signal and the resistance.
Preferably, the device also comprises a control unit,
the control unit is used for simultaneously opening a row of word lines and a plurality of bit lines to carry out MAC operation.
Preferably, the control unit is further configured to perform a set operation and a reset operation on a row of word lines before a simultaneous row of word lines.
Preferably, the set operation is: applying high voltage to the bit line and the word line, and grounding the source line;
the reset operation is: the word line and the source line apply high voltage, and the bit line is grounded.
Preferably, a voltage value of the word line in the set operation is less than half of a voltage value in the reset operation.
The invention also provides an MAC array operation method based on the resistive random access memory, which is realized based on the MAC array based on the resistive random access memory and comprises the following steps:
simultaneously opening a row of word lines, bit lines and source lines at preset intervals in the MAC array based on the resistive random access memory;
applying a voltage to a resistor in the resistive random access memory based on the source line based on the word line transmission input signal to form a bias current on the bit line;
the ADC module in the MAC array based on the resistive random access memory is used for converting the bias current in the bit line to form a digital product operation result;
and summing the digital product operation result through a shift adder in the MAC array based on the resistive random access memory to obtain an MAC operation result.
Preferably, before a row of word lines is simultaneously turned on, the row of word lines is subjected to a set operation and a reset operation;
the setting operation is as follows: the bit line and the word line apply high voltage, and the source line is grounded;
the reset operation is: the word line and the source line apply high voltage, and the bit line is grounded.
According to the technical scheme, the MAC array based on the resistive random access memory comprises 1T1R resistive random access memory units, word lines, source lines, bit lines, an ADC module and a shift adder, wherein the 1T1R resistive random access memory units storing the same bits with different weights are distributed on a plurality of adjacent continuous bit lines; wherein the spacing of the bit lines is less than or equal to 8; the 1T1R resistive memory cells storing different bits with the same weight are distributed on the same bit line and have a value of 2nThe strip word lines are at intervals; each 1T1R resistive random access memory unit comprises a transistor-resistive random access memory; the resistive random access memory comprises a resistor, wherein the resistor is connected with the transistor and can be high or low; the word line is connected with the gate end of the transistor and is controlled by a decoder, and the word line is used for transmitting an input signal; the source line and the 1T1R resistance change type memory unit are used for applying voltage to a resistor to form bias current on a bit line, the ADC module is connected with the bit line, all the bit lines share one ADC module, the ADC module is used for converting the bias current in the bit line to form a digital product operation result, and the shift adder is used for summing the digital product operation result to obtain an MAC operation result; at the same time, for all 1T1R cells of the same WL, their BL parasitic parameters are substantially identical, so when calculating their current sums, the parasitic parameters bring aboutThe influence of (a) is greatly reduced.
Detailed Description
Because the actual size of the resistive random access memory array usually exceeds 1Mb, a large amount of parasitic resistance/capacitance is caused by long WL/BL wiring, so that when the product of memory cells at different positions in the array and WL input signals is the same, the current can also greatly drift, the discrimination between different products and corresponding total current is further reduced, and in severe cases, even different products and corresponding current ranges can be overlapped, and reading errors can be generated; in a 1Mb RRAM MAC array in a 28nm process, under the condition that the current reading difference of the traditional method at the optimal/worst position of WL/BL parasitics is optimal/worst, the range of MAC summation current is seriously overlapped, so that reading errors are caused; in order to solve the problem, each ADC needs to be modulated separately, but this greatly increases the difficulty of circuit design and test cost and seriously reduces the accuracy of MAC operation under the requirement of a large computational power array. In view of the above problems, the present invention provides a MAC array based on a resistive random access memory, and the following describes in detail a specific embodiment of the present invention with reference to the accompanying drawings.
In order to illustrate the MAC array based on the resistive random access memory and the operation method thereof provided by the present invention, fig. 1 schematically indicates the MAC array based on the resistive random access memory according to the embodiment of the present invention; fig. 2 shows an example of an operation method of a MAC array based on a resistive random access memory according to an embodiment of the present invention.
The following description of the exemplary embodiment(s) is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses. Techniques and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail, but are intended to be considered a part of the specification where appropriate.
As shown in fig. 1, the MAC array based on the resistive random access memory according to the embodiment of the present invention includes 1T1R resistive random access memory cells, word lines, source lines, bit lines, an ADC module, and a shift adder, where the 1T1R resistive random access memory cells storing identical bits with different weights are distributed on a plurality of adjacent continuous bit lines; wherein the spacing of the bit lines is less than or equal to 8; the 1T1R resistive memory cells storing different bits with the same weight are distributed on the same bit line and have a value of 2nThe word lines are intervals; in this embodiment, the 1T1R cells storing the same bits with different weights are distributed on the adjacent BL (bit line), that is, the 1T1R resistive memory cells storing the same bits with different weights are distributed on the adjacent consecutive bit lines, so that the parasitic parameters between the 1T1R cells are very close when the MAC operation is performed on the same bit, and the summation error of the product of the same bit can be avoided. Different bits with the same weight are distributed on the same BL and are not distributed continuously, but are spaced by 4/8/16/32 WLs, and the spacing of bit lines is less than or equal to 8 in the embodiment; taking 4 WLs as an interval for example, WL0 is connected with weight B00Corresponding cell, WL4 connection weight B01Correspondingly, WL8 is connected to the weight B02The corresponding unit 8230effectively improves the precision of high-order operation by the scattered distribution of different bits with the same weight. In the AI operation, the operation error of the lower bits can be generally ignored, therefore, the method can effectively improve the overall operation precision.
In the embodiment shown in fig. 1, each 1T1R resistance change memory cell includes a transistor-resistance change memory; the resistive random access memory comprises a resistor, wherein the resistor is connected with the transistor and can be high or low; the word line is connected with the grid end of the transistor and controlled by the decoder, and the word line is used for transmitting an input signal; the source line and the 1T1R resistance change type memory unit are used for applying voltage to the resistor so as to form bias current on the bit line; the ADC module is connected with the bit line and is used for converting the bias current in the bit line to form a digital product operation result; the shift adder is used for summing the digital product operation result to obtain an MAC operation result; in this embodiment, all bit lines are connected to the same ADC, and a plurality of BLs are connected to the same ADC, so that analog-to-digital conversion sum of multi-bit product sums of a plurality of weights and a plurality of input signals is realized, and larger-scale summation is performed through an addition tree in the periphery, thereby reducing the occupied space, improving the space utilization rate, and improving the operation speed.
In actual operation, only one row of WLs is opened at a time, a plurality of BL are connected to the same ADC, analog-to-digital conversion and summation operation are realized, and larger-scale summation is carried out through an addition tree at the periphery. The method has the advantage of high parallelism of analog summation, and can effectively limit the error within an allowable range.
Specifically, each transistor-resistive random access memory (1T 1R) cell is used to hold one bit of weight, representing 0 when the R resistance is high and 1 when the R resistance is low; WL (word line) is controlled by decoder for transmitting input signal; the SL (source line) is used for applying a fixed reading voltage and forming a bias current on the BL (bit line), and then the bias current is processed by the ADC to generate an MAC operation result; when the WL of the 1T1R cell is taken high, it indicates that the input signal is 1; since the 1T1R cell stores a 1, this current is large, indicating that the product of the input signal and the 1T1R cell is 1; when the 1T1R unit stores 0 or the WL is not gated, the BL current of the unit is very low, which indicates that the product of the input signal and the 1T1R unit is 0; in this embodiment, a bias current is generated based on the input signal and the voltage, reflecting the product of the input signal and the resistance, and by simultaneously opening a row WL, these currents representing the product can be formed into a total current, thereby achieving a summation of the products.
In this embodiment, the apparatus further includes a control unit, configured to open a row of word lines and a plurality of bit lines at preset intervals at the same time, so as to perform a subsequent MAC operation, and complete a summation operation of a product of the input signal and the resistance; the control unit is also used for carrying out setting operation and resetting operation on a row of word lines before simultaneously opening the row of word lines; wherein the set operation is: applying high voltage to the bit line and the word line, and grounding the source line; the reset operation is: applying high voltage to the word line and the source line, and grounding the bit line; wherein a voltage value of the word line in the set operation is less than half of a voltage value in the reset operation.
In one embodiment, during the operation, a row of WL is opened simultaneously each time, the WL interval is 4, the bl interval is 8, and the actual condition can be adjusted to be equal to 4,8, 16, 32, and is calculated as int8 (which can be adjusted according to the actual application). The 0 th bits of B0-B7 are distributed on WL0, the 0 th-7 th bits of B0 are distributed on BL0, the WL0, WL4, WL8, WL12, WL16, WL20, WL24, WL28, the rest weights are repeated, and the like, when in each calculation, a certain WL (such as WL 0) is opened, meanwhile BL0-BL7 input the 0 th-7 th bits of A0-A7 in sequence, and then output currents of a plurality of BL are converted into product sum through ADC. As shown in fig. 1, since the ADC performs current sum conversion on the results of multiple BLs, an ADC in a current mode needs to be used, but the ADC density is significantly reduced compared to fig. 1, which is beneficial to the design of layout wiring, and meanwhile, for all 1T1R cells of the same WL, the BL parasitic parameters are substantially consistent, so that the influence of the parasitic parameters when calculating their current sum is greatly reduced.
Moreover, since the ADC module is shared by a plurality of BLs, the space of the ADC module in the transverse length is greatly expanded, and compared with the design in which one BL corresponds to one ADC as shown in fig. 1, the present invention has a greater advantage in space utilization. Therefore, the ADC module with higher precision and larger area can be configured to realize the summation of more BL, and the parallelism, namely the overall operation speed, is effectively improved.
As described above, the MAC array based on the resistive random access memory provided by the present invention includes 1T1R resistive random access memory cells, word lines, source lines, bit lines, ADC modules, and shift adders, where the 1T1R resistive random access memory cells storing identical bits with different weights are distributed on a plurality of adjacent and consecutive bit lines; wherein the spacing of the bit lines is less than or equal to 8; the 1T1R resistive memory cells storing different bits with the same weight are distributed on the same bit line and have a value of 2nThe strip word lines are at intervals; each 1T1R resistive random access memory unit comprises a transistor-resistive random access memory; resistance changeThe memory comprises a resistor which is connected with the transistor and can be high or low; the word line is connected with the gate end of the transistor and is controlled by a decoder, and the word line is used for transmitting an input signal; the source line and the 1T1R resistance change type memory unit are used for applying voltage to a resistor to form bias current on the bit line, the ADC module is connected with the bit line, all the bit lines share one ADC module, the ADC module is used for converting the bias current in the bit line to form a digital product operation result, and the shift adder is used for summing the digital product operation result to obtain an MAC operation result; meanwhile, for all 1T1R units of the same WL, BL parasitic parameters are basically consistent, so when calculating the current sum of the BL parasitic parameters, the influence brought by the parasitic parameters is greatly reduced.
As shown in fig. 2, the present invention further provides an operation method of an MAC array based on a resistive random access memory, which is implemented based on the MAC array based on the resistive random access memory, and includes:
s1: simultaneously opening a row of word lines, bit lines at preset intervals and source lines in the MAC array based on the resistive random access memory;
s2: applying a voltage to a resistor in the resistive random access memory based on the source line based on the word line transmission input signal to form a bias current on the bit line;
s3: the ADC module in the MAC array based on the resistive random access memory is used for converting the bias current in the bit line to form a digital product operation result;
s4: and summing the digital product operation result through a shift adder in the MAC array based on the resistive random access memory to obtain an MAC operation result.
Before a row of word lines are opened simultaneously, carrying out setting operation and resetting operation on the row of word lines;
the setting operation is as follows: the bit line and the word line apply high voltage, and the source line is grounded;
the reset operation is: the word line and the source line apply high voltage, and the bit line is grounded.
Specifically, during operation, all bit lines are connected to the same ADC, a plurality of BL are connected to the same ADC, analog-to-digital conversion sum of multi-bit product sums of a plurality of weights and a plurality of input signals is achieved, large-scale summation is carried out through an addition tree in the periphery, so that the occupied space can be reduced, the space utilization rate is improved, and the operation speed is increased.
In actual operation, only one row of WLs is opened at a time, a plurality of BL are connected to the same ADC, analog-to-digital conversion and summation operation are realized, and larger-scale summation is carried out through an addition tree at the periphery. The method has the advantage of high parallelism of analog summation, and can effectively limit the error within an allowable range.
In one embodiment, during the operation, a row of WL is opened simultaneously each time, the WL interval is 4, the bl interval is 8, and the actual condition can be adjusted to be equal to 4,8, 16, 32, and is calculated as int8 (which can be adjusted according to the actual application). The 0 th bits of B0-B7 are distributed on WL0, the 0 th-7 th bits of B0 are distributed on BL0, the WL0, WL4, WL8, WL12, WL16, WL20, WL24, WL28, the rest weights are repeated, and the like, when in each calculation, a certain WL (such as WL 0) is opened, meanwhile BL0-BL7 input the 0 th-7 th bits of A0-A7 in sequence, and then output currents of a plurality of BL are converted into product sum through ADC. As shown in fig. 1, since the ADC performs current sum conversion on the results of multiple BLs, an ADC in a current mode needs to be used, but the ADC density is significantly reduced compared to fig. 1, which is beneficial to the design of layout wiring, and meanwhile, for all 1T1R cells of the same WL, the BL parasitic parameters are substantially consistent, so that the influence of the parasitic parameters when calculating their current sum is greatly reduced.
Moreover, since the ADC module is shared by multiple BLs, the space of the ADC module in the transverse length is greatly expanded, and compared with the design shown in fig. 1 in which one BL corresponds to one ADC, the present invention has a greater advantage in space utilization. Therefore, the ADC module with higher precision and larger area can be configured to realize the summation of more BL, and the parallelism, namely the overall operation speed, is effectively improved.
According to the embodiment, the operation method of the MAC array based on the resistive random access memory is realized based on the MAC array based on the resistive random access memory, and a row of word lines, bit lines at preset intervals and source lines in the MAC array based on the resistive random access memory are opened at the same time; then transmitting an input signal based on the word line, and applying voltage to the resistor in the MAC array based on the resistance change memory based on the source line so as to form bias current on the bit line; then converting the bias current in the bit line through an ADC module in the MAC array based on the resistive random access memory to form a digital product operation result; finally, the digital product operation result is summed through a shift adder in the resistance random access memory-based MAC array to obtain an MAC operation result, so that only one row of WL (word line) is opened each time during actual operation, a plurality of BL (bit lines) are connected to the same ADC, analog-to-digital conversion and summation operation are realized, large-scale summation is carried out on the periphery through an addition tree, the advantage of high parallelism of analog summation is achieved, and errors can be effectively limited within an allowable range; meanwhile, for all 1T1R units of the same WL, the BL parasitic parameters are basically consistent, so when calculating the current sum of the 1T1R units, the influence brought by the parasitic parameters is greatly reduced.
The MAC array based on the resistance change memory and the operating method according to the present invention are described above by way of example with reference to the accompanying drawings. However, it should be understood by those skilled in the art that various modifications can be made to the MAC array and the operation method based on the resistive random access memory proposed in the present invention without departing from the scope of the present invention. Accordingly, the scope of the invention should be determined from the content of the appended claims.