SRAM (Static Random Access Memory)-based in-memory atom operation circuit and control method thereof

Through the SRAM-type in-memory atomic operation circuit that directly completes the calculation in the memory array, the atomic operation efficiency and energy efficiency problems in traditional technology are solved, and efficient atomic operation processing and energy consumption optimization are achieved.

CN118918932AActive Publication Date: 2024-11-08SUN YAT SEN UNIV

Patent Information

Application Number
CN202410941342.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-15
Publication Date
2024-11-08
Estimated Expiration
2044-07-15

AI Technical Summary

Technical Problem

Traditional computing architectures and circuits are difficult to meet the efficient atomic operation requirements for large-scale data, especially due to the difference in data transmission speed caused by memory wall problems and frequent data transfer across memory hierarchies, which limit the performance and energy efficiency of atomic operations.

Method used

Design an in-memory atomic operation circuit based on SRAM, including 8T SRAM array, switch control circuit, near-memory computing logic and data drive control circuit. By directly completing calculations in the memory array, it supports switching between SRAM mode and atomic operation mode. , realize in-situ storage and calculation of data, and reduce data transmission.

Benefits of technology

It improves the efficiency of atomic operation and processing, reduces the energy consumption required for data transmission, realizes energy consumption optimization and conservation, and improves overall performance and system flexibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918932A_ABST
    Figure CN118918932A_ABST
Patent Text Reader

Abstract

The invention discloses an SRAM (Static Random Access Memory)-based in-memory atomic operation circuit and a control method thereof. The circuit comprises an 8T SRAM array, a switch control circuit, a near memory computational logic, a data driving control circuit and an SRAM peripheral circuit. The control method comprises the steps of obtaining an operation instruction type; if the type of the operation instruction is a common memory access instruction, the control mode of the switching circuit is an SRAM (Static Random Access Memory) mode, and if the type of the operation instruction is an atomic operation instruction, the control mode of the switching circuit is an atomic operation mode; if the control mode of the circuit is an atomic operation mode, executing in-memory atomic operation until the in-memory atomic operation is finished, switching the control mode of the circuit into an SRAM mode, and executing common memory access instruction operation. According to the embodiment of the invention, calculation can be directly completed in the storage array, transmission of data between a storage unit and a calculation unit is reduced, atomic operation processing efficiency is improved, and energy consumption required by data transmission is reduced. The method can be widely applied to the technical field of integrated circuit design.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of integrated circuit design, and in particular to an SRAM-based in-memory atomic operation circuit and a control method thereof. Background Art

[0002] The processors of current intelligent computing systems, such as CPU, GPU and NPU, are mainly based on the von Neumann architecture, which is achieved by separating the memory and computing units. In the von Neumann architecture, atomic operations are limited by the memory wall problem. There is a speed difference between the memory and the processor. The memory access speed is slow, while the processor processing speed is fast. Especially for atomic operations that need to access the memory frequently, the memory access speed is slow, and the processor will waste a lot of time when waiting for memory data transmission. At the same time, atomic operations need to frequently cross multiple memory hierarchies to move and modify data, which will limit the performance of the overall system. Therefore, during the execution of atomic operations, due to the frequent reading, modification, and writing of data across processors and multiple memory hierarchies, traditional computing architectures and circuits have been unable to meet the needs of efficient atomic operations on large-scale data.

[0003] In summary, the technical problems existing in the relevant technologies need to be improved. Summary of the invention

[0004] The main purpose of the embodiments of the present application is to propose an SRAM-based in-memory atomic operation circuit and its control method, which can reduce the transmission of data between storage and computing units by directly completing calculations in the storage array, improve the atomic operation processing efficiency and reduce the energy consumption required for data transmission.

[0005] To achieve the above-mentioned purpose, an embodiment of the present application proposes an SRAM-based in-memory atomic operation circuit on one hand, wherein the in-memory atomic operation circuit includes an 8T SRAM array, a switch control circuit, a near-memory calculation logic, a data drive control circuit and an SRAM peripheral circuit, wherein the SRAM peripheral circuit includes an SRAM interface circuit, a control circuit, a row decoder and a precharge circuit, wherein a first output end of the control circuit is connected to an input end of the precharge circuit, a second output end of the control circuit is connected to an input end of the row decoder, an output end of the row decoder is connected to an input end of the switch control circuit, an output end of the switch control circuit is connected to a first input end of the 8T SRAM array, an output end of the near-memory calculation logic is connected to an input end of the data drive control circuit, an output end of the data drive control circuit is connected to a second input end of the 8T SRAM array, and the precharge circuit is connected to the 8T SRAM array, wherein:

[0006] The 8T SRAM array is used to store data generated by in-memory atomic operations and control the calculation of the in-memory atomic operations;

[0007] The switch control circuit is used to control the switching between the SRAM mode and the atomic operation mode;

[0008] The near memory calculation logic is used to control the carry calculation of the in-memory atomic operation;

[0009] The data drive control circuit is used to control a number of the atomic operations in the memory;

[0010] The SRAM peripheral circuit is used to control the data reading of the in-memory atomic operation, control the data calculation of the in-memory atomic operation, and control the data storage of the in-memory atomic operation.

[0011] In some embodiments, the 8T SRAM array includes several 8T SRAM cells, and the 8T SRAM cells include a first transistor, a second transistor, a third transistor, a fourth transistor, a fifth transistor, a sixth transistor, a seventh transistor, and an eighth transistor, wherein the gate of the first transistor, the drain of the fifth transistor, the drain of the eighth transistor, and the gate of the second transistor are connected, the gate of the third transistor, the source of the seventh transistor, the drain of the sixth transistor, the source of the eighth transistor, and the gate of the fourth transistor are connected, the source of the first transistor, the drain of the seventh transistor, and the drain of the second transistor are connected, and the drain of the third transistor and the source of the eighth transistor are connected to the drain of the fourth transistor.

[0012] In some embodiments, the switch control circuit includes a first NOT gate, a second NOT gate, a first NAND gate, a second NAND gate, a first delay element and a first multiplexer, wherein an input end of the first NOT gate is connected to a first input end of the first NAND gate, a second input end of the first NAND gate is connected to a first input end of the second NAND gate, an output end of the first NOT gate is connected to an input end of the second NAND gate, an output end of the first NAND gate, an input end of the first delay element and a first input end of the first multiplexer are connected, and an output end of the second NAND gate, a second input end of the first multiplexer and an input end of the second NOT gate are connected.

[0013] In some embodiments, the near memory computing logic is formed by cascading several near memory computing units, and the near memory computing units include a third NAND gate, a fourth NAND gate, a fifth NAND gate, a first AND gate, a second AND gate and a third XNOR gate, wherein the output end of the first AND gate and the input end of the third XNOR gate are connected to the input end of the third NAND gate, the output end of the second AND gate is connected to the input end of the fourth NAND gate, the output end of the third NAND gate is connected to the first input end of the fifth NAND gate, and the output end of the fourth NAND gate is connected to the second input end of the fifth NAND gate.

[0014] In some embodiments, the data drive control circuit includes a second multiplexer, a third multiplexer, a fourth multiplexer, a fifth multiplexer, a sixth multiplexer, a first XNOR gate and a second XNOR gate, wherein the output end of the first XNOR gate is connected to the input end of the third multiplexer, the input end of the second multiplexer is connected to the input end of the third multiplexer, the output end of the second multiplexer is connected to the first input end of the fourth multiplexer, the output end of the third multiplexer is connected to the second input end of the fourth multiplexer, the output end of the fourth multiplexer, the input end of the sixth multiplexer and the input end of the second XNOR gate are connected, and the output end of the second XNOR gate is connected to the input end of the fifth multiplexer.

[0015] To achieve the above object, another aspect of the embodiment of the present application provides a control method based on an SRAM-type in-memory atomic operation circuit, the control method comprising the following steps:

[0016] Get the operation instruction type;

[0017] The operation instruction type is judged. If the operation instruction type is a common memory access instruction, the control mode of the switching circuit is an SRAM mode. If the operation instruction type is an atomic operation instruction, the control mode of the switching circuit is an atomic operation mode.

[0018] If the control mode of the circuit is the atomic operation mode, the in-memory atomic operation is performed until the in-memory atomic operation is completed, and the control mode of the circuit is switched to the SRAM mode to perform a normal memory access instruction operation.

[0019] In some embodiments, the atomic operation mode includes an in-memory atomic logical AND operation, an in-memory atomic logical OR operation, an in-memory atomic logical XOR operation, an in-memory atomic arithmetic addition operation, an in-memory atomic arithmetic maximum operation, an in-memory atomic arithmetic minimum operation, and an in-memory atomic arithmetic exchange operation.

[0020] In some embodiments, the atomic operation control method of the in-memory atomic logical AND operation, the in-memory atomic logical OR operation and the in-memory atomic logical XOR operation is the same, as shown below:

[0021] The first input signal, the second input signal and the first switching control signal are pulled down, the atomic operation circuit in the memory is in the on state, QB and Q are both 0, where Q represents the data storage node, and QB represents the inverting node;

[0022] The second switching control signal is pulled down, the first input signal is restored to a ground state, the second input signal is restored to a high level state, and QB and Q are both 0;

[0023] The first switching control signal is pulled high to charge QB, QB is 1, and Q is 0;

[0024] The second switching control signal is pulled high to keep QB at 1 and Q at 0, and the in-memory atomic operation circuit is in a latched state to complete the in-memory atomic logic AND operation, the in-memory atomic logic OR operation and the in-memory atomic logic XOR operation.

[0025] In some embodiments, the atomic operation control method of the in-memory atomic arithmetic addition operation is specifically as follows:

[0026] Get the first operand and the second operand;

[0027] Setting the first operand to be stored in the Mth storage row in the 8T SRAM array;

[0028] Performing an in-memory atomic logical XOR operation on the first operand and the second operand to obtain an operand XOR calculation result;

[0029] Obtain the XOR calculation result of the operands and the negated result of the XOR calculation result of the operands, and obtain the output signal calculation result of the near storage logic of the atomic addition operation through near storage logic calculation;

[0030] An XOR operation is performed on the output signal calculation result of the near-memory logic of the atomic addition operation and the XOR calculation result of the operand to complete the in-memory atomic arithmetic addition operation.

[0031] In some embodiments, the atomic operation control method of the in-memory atomic arithmetic maximum value operation and the in-memory atomic arithmetic minimum value operation is the same, as shown below:

[0032] Based on the first operand and the second operand, an atomic XOR operation is performed to obtain an atomic XOR operation result of the two operands;

[0033] Obtaining an atomic XOR operation result of the two operands and a negated result of the atomic XOR operation result of the two operands, and obtaining a BMAX signal through near-memory logic calculation;

[0034] According to the BMAX signal and the atomic maximum operation indication signal (AMO_MAX), an XOR operation is performed to complete the in-memory atomic arithmetic maximum value operation and the in-memory atomic arithmetic minimum value operation.

[0035] The embodiments of the present application include at least the following beneficial effects: The present application provides an SRAM-based in-memory atomic operation circuit and a control method thereof, the scheme includes an 8T SRAM array with storage and computing functions, and a control and auxiliary circuit mainly including a switch control circuit, a data drive control circuit and a near-memory computing logic. When the 8T SRAM array is written, data can be easily written by simply terminating the latch state of two inverters, and the "read-modify-write" atomic operation of the same memory unit is completed without the need for additional storage space, thereby reducing the transmission of data between storage and computing units and improving the atomic operation processing efficiency. The in-memory atomic operation circuit based on the field storage SRAM directly completes the calculation in the storage array, thereby avoiding frequent atomic operations across the memory hierarchy. Data transfer reduces the energy consumption required for data transmission, and achieves energy optimization and conservation. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 It is a structural principle diagram of an SRAM-based in-memory atomic operation circuit provided in an embodiment of the present application;

[0037] Figure 2 It is a schematic flow chart of the steps of a control method of an SRAM-based in-memory atomic operation circuit provided in an embodiment of the present application;

[0038] Figure 3 Schematic diagram of the principle of atomic operation in SRAM memory provided by an embodiment of the present application;

[0039] Figure 4 is a schematic diagram of the principle of a switch control circuit provided in an embodiment of the present application;

[0040] Figure 5 is a schematic diagram of the principle of a data drive control circuit provided in an embodiment of the present application;

[0041] Figure 6 It is a schematic diagram of the principle of the near-memory computing logic circuit provided in an embodiment of the present application;

[0042] Figure 7 It is a schematic diagram of the in-memory atomic AND, OR, and XOR logic operations provided by an embodiment of the present application;

[0043] Figure 8 is a schematic diagram of an in-memory atomic addition operation provided in an embodiment of the present application;

[0044] Fig. 9 It is a schematic diagram of an in-memory atomic maximum value operation and an in-memory atomic arithmetic minimum value operation provided in an embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of systems and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.

[0046] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".

[0047] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.

[0048] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0049] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are first described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.

[0050] With the popularity of new parallel applications such as artificial intelligence (AI) algorithms, atomic operations have become increasingly important as a key means of completing concurrent processing in AI algorithms. In new parallel applications, atomic operations play a key role in multithreading, concurrent programming, and distributed systems. In AI algorithms, especially when multithreaded environments are involved, concurrent processing of multiple tasks or computing entities is necessary. Since atomic operations can ensure that operations on shared data are atomic, either all executed successfully or all failed, atomic operations can be used to control the behavior of concurrent access to shared resources, ensure that the collaboration between multiple tasks is carried out correctly, and avoid data confusion or inconsistency. Therefore, in parallel computing, atomic operations can be used to synchronize concurrently executed tasks or threads to ensure the correctness of calculations and the accuracy of results, which is very critical for maintaining data consistency and avoiding race conditions, especially in large-scale data processing and distributed computing.

[0051] However, with the increasing demand for atomic operations in the fields of big data, artificial intelligence, etc., traditional computing architectures and circuits have been unable to meet the demand for efficient atomic operations on large-scale data. First, this is reflected in the difference in data transmission speed between the processor and the memory (memory wall), which leads to a bottleneck and limits the increase in the speed of atomic operations. Secondly, the frequent data transmission and computing operations in traditional computing architectures consume a lot of energy.

[0052] In view of this, an SRAM-based in-memory atomic operation circuit is provided in an embodiment of the present application, which aims to integrate a storage unit with a computing unit to improve the efficiency and energy consumption of data processing, and designs a field storage type 8T SRAM storage computing unit to adapt to the inseparable "read-modify-write" characteristics of atomic operations, supports flexible switching between SRAM mode and atomic operation mode, fully supports in-situ storage and in-memory calculation of multiple atomic operations, realizes a full range of in-memory atomic logical operations and in-memory atomic arithmetic operations, and reuses near-memory computing logic, which significantly improves the execution efficiency of atomic operations, reduces circuit area costs, improves overall performance and system flexibility and functionality, and can be applied to a variety of processor architecture designs.

[0053] Reference Figure 1 , Figure 1 A flowchart of an SRAM-based in-memory atomic operation circuit provided by an embodiment of the present invention, referring to Figure 1The circuit includes an 8T SRAM array, a switch control circuit, a near-memory calculation logic, a data drive control circuit and an SRAM peripheral circuit. The SRAM peripheral circuit includes an SRAM interface circuit, a control circuit, a row decoder and a precharge circuit. The first output end of the control circuit is connected to the input end of the precharge circuit, the second output end of the control circuit is connected to the input end of the row decoder, the output end of the row decoder is connected to the input end of the switch control circuit, the output end of the switch control circuit is connected to the first input end of the 8T SRAM array, the output end of the near-memory calculation logic is connected to the input end of the data drive control circuit, the output end of the data drive control circuit is connected to the second input end of the 8T SRAM array, and the precharge circuit is connected to the 8T SRAM array.

[0054] In this embodiment, the atomic operation circuit structure in memory based on field storage type SRAM constructed by the embodiment of the present invention has a size of 256x 512 and is divided into SRAM mode and atomic operation mode (AMO mode). The circuit includes an 8T SRAM array, a switching control circuit, a near memory calculation logic, a data-driven control circuit and a conventional SRAM peripheral circuit, and the conventional SRAM peripheral circuit includes an SRAM interface circuit, a control circuit, a row decoder and a precharge circuit. The 8T SRAM unit is responsible for storing the data of the atomic operation and performing the calculation of the atomic operation in memory; the switch control circuit is responsible for realizing the switching between the SRAM mode and the AMO mode. The near memory calculation logic handles the carry calculation during operations such as atomic addition, atomic maximum value and atomic minimum value. The data-driven control circuit is used to manage the storage array to support multiple atomic operations. The SRAM peripheral circuit is responsible for controlling and managing the in-memory calculation operation of the storage and calculation unit to ensure the correct reading, calculation and storage of data.

[0055] Specifically, Figure 3As shown, when in AMO mode, it supports seven atomic operations, including in-memory atomic logical AND operation, in-memory atomic logical OR operation, in-memory atomic logical XOR operation, in-memory atomic arithmetic addition operation, in-memory atomic arithmetic maximum operation, in-memory atomic arithmetic minimum operation, and in-memory atomic arithmetic exchange operation. According to the description of atomic operations in the RICS-V manual, in this mode, the word at address x[rs1] in the memory is marked as t, and the specified operation is performed on t and x[rs2], the result is updated to the address of x[rd], and x[rd] is set to t with the sign bit extended. In atomic mode, the circuit receives 16 x[rs2] (x[rs2]0~x[rs2]15) from external input, and according to the selected atomic operation instruction, the corresponding atomic operation is performed on the 16 words at address x[rs1] in the unit, and the result is updated to the address of x[rs1].

[0056] in, Figure 3 The data meaning of the input and output signals in are shown in Table 1:

[0057] Table 1 Meaning of data signals in memory atomic operation circuit

[0058]

[0059]

[0060] The 8T SRAM array is used to store data generated by in-memory atomic operations and to control the calculation of in-memory atomic operations;

[0061] In this embodiment, the 8T SRAM array includes a plurality of 8T SRAM cells, and the 8T SRAM cells include a first transistor, a second transistor, a third transistor, a fourth transistor, a fifth transistor, a sixth transistor, a seventh transistor, and an eighth transistor, wherein the gate of the first transistor, the drain of the fifth transistor, and the drain of the eighth transistor are connected to the gate of the second transistor, the gate of the third transistor, the source of the seventh transistor, the drain of the sixth transistor, and the source of the eighth transistor are connected to the gate of the fourth transistor, the source of the first transistor, the drain of the seventh transistor, and the drain of the second transistor are connected, and the drain of the third transistor and the source of the eighth transistor are connected to the drain of the fourth transistor.

[0062] Specifically, in the circuit, the field storage type 8T SRAM cell is as follows Figure 1The middle box position is shown. This unit adds two NMOS tubes (M7 and M8) on the basis of the conventional 6T SRAM unit to control the switching of SRAM mode and AMO mode, which is controlled by Ctr l_L and Ctr l_R. In addition, I N1 and I N2 are connected to the source or drain of M3 and M4 respectively to realize the logic operation inside the unit. Unlike the traditional 6T SRAM, the two coupled inverters in the field storage type 8T SRAM are controlled by M7 and M8. During the write operation, data can be easily written by simply terminating the latch state of the two inverters, and the 8 transistors are all of minimum size.

[0063] When the circuit is in SRAM mode, IN1 and IN2 are kept at VDD and VSS respectively, CTRL_L and CTRL_R are both logic "1", turning on the two NMOS transistors in the middle of the 8-tube unit. According to the input address, the read and write operations of a row of 512 bits of data can be completed at one time.

[0064] The switch control circuit is used to control the switching between the SRAM mode and the atomic operation mode;

[0065] In this embodiment, the switch control circuit includes a first NOT gate NOT1, a second NOT gate NOT2, a first NAND gate NAND1, a second NAND gate NAND2, a first delay element DELAY and a first multiplexer MUX1, an input end of the first NOT gate is connected to a first input end of the first NAND gate, a second input end of the first NAND gate is connected to a first input end of the second NAND gate, an output end of the first NOT gate is connected to an input end of the second NAND gate, an output end of the first NAND gate, an input end of the first delay element and a first input end of the first multiplexer are connected, and an output end of the second NAND gate, a second input end of the first multiplexer and an input end of the second NOT gate are connected.

[0066] Specifically, Figure 4 As shown, the switch control circuit is responsible for controlling Ctr l_L and Ctr l_R in the storage array to switch between SRAM mode and AMO mode, and is used to support flexible configuration of the mode. AMO_MODE is a short pulse input signal provided by the control circuit. The components of the switch control circuit mainly include AND gates, OR gates, NAND gates, delay elements and multiplexers, which perform logical operations and selections on the input signals and finally output the control signal of the switch, where: Figure 4 The data meaning of the input and output signals in are shown in Table 2.

[0067] Table 2 Meaning of switch control circuit data signals

[0068]

[0069]

[0070] Near memory calculation logic is used to control the carry calculation of atomic operations in memory;

[0071] In this embodiment, the near memory computing logic is formed by cascading several near memory computing units, and the near memory computing units include a third NAND gate NAND3, a fourth NAND gate NAND4, a fifth NAND gate NAND5, a first AND gate SA1, a second AND gate SA2 and a third XNOR gate XNOR3, wherein the output end of the first AND gate and the input end of the third XNOR gate are connected to the input end of the third NAND gate, the output end of the second AND gate is connected to the input end of the fourth NAND gate, the output end of the third NAND gate is connected to the first input end of the fifth NAND gate, and the output end of the fourth NAND gate is connected to the second input end of the fifth NAND gate.

[0072] Specifically, the data drive control circuit is used to manage I N1 and I N2 in the storage array to support multiple atomic operations. The data drive control circuit that supports 32-bit atomic operation calculation is as follows: Figure 6 The components of the data drive control circuit mainly include AND gates, OR gates, inverters and multiplexers, which select input signals to perform logical operations on the signals and ultimately control the output signals. Figure 6 The data meaning of the input and output signals in are shown in Table 3.

[0073] Table 3 Data drive control circuit data signal meaning table

[0074]

[0075]

[0076] The data drive control circuit is used to control IN1 and IN2. In different operations, the functions of OP2, CIN and OP1_B are as follows:

[0077] OP2 is used for: single-cycle logic operations (AND / OR / XOR); XOR in the first cycle of ADD / MAX / MIN operations; if the comparison result in MAX / MIN is OP1, OP2 needs to be XORed again in the third cycle, that is, OP1=OP1^OP2^OP2.

[0078] CIN is used to perform XOR in the third cycle of the ADD operation to complete A^B^CIN=SUM.

[0079] OP1_B is used for: If the comparison result in MAX / MIN is OP2, OP2 needs to be XORed again in the third cycle, that is, OP2=OP1^OP2_B^OP1_B.

[0080] The data drive control circuit is used to control a number of atomic operations in memory;

[0081] In this embodiment, the data drive control circuit includes a second multiplexer MUX2, a third multiplexer MUX3, a fourth multiplexer MUX4, a fifth multiplexer MUX5, a sixth multiplexer MUX6, a first XNOR gate XNOR1 and a second XNOR gate XNOR2, wherein the output end of the first XNOR gate is connected to the input end of the third multiplexer, the input end of the second multiplexer is connected to the input end of the third multiplexer, the output end of the second multiplexer is connected to the first input end of the fourth multiplexer, the output end of the third multiplexer is connected to the second input end of the fourth multiplexer, the output end of the fourth multiplexer, the input end of the sixth multiplexer are connected to the input end of the second XNOR gate, and the output end of the second XNOR gate is connected to the input end of the fifth multiplexer.

[0082] Specifically, Figure 5 As shown in FIG. 4 , the component structure of the near-memory calculation logic circuit includes a combination of multiple NAND gates, AND gates, OR gates and inverters, forming a cascade connection of multiple CCL_1b units, which is used to complete the carry calculation during the atomic addition operation or atomic comparison operation. The signals are shown in Table 4.

[0083] Table 4 Data drive control circuit data signal meaning table

[0084]

[0085] The SRAM peripheral circuit is used to control the data reading of the atomic operation in the memory, control the data calculation of the atomic operation in the memory, and control the data storage of the atomic operation in the memory.

[0086] See also Figure 2 The embodiment of the present application further provides a control method for an SRAM-based in-memory atomic operation circuit, which can implement the above-mentioned SRAM-based in-memory atomic operation circuit. The control method includes the following steps:

[0087] S100, obtaining the operation instruction type;

[0088] S200, judging the type of the operation instruction, if the operation instruction type is a common memory access instruction, the control mode of the switching circuit is the SRAM mode, if the operation instruction type is an atomic operation instruction, the control mode of the switching circuit is the atomic operation mode;

[0089] It should be noted that, in some embodiments, the atomic operation mode includes in-memory atomic logical AND operation, in-memory atomic logical OR operation, in-memory atomic logical XOR operation, in-memory atomic arithmetic addition operation, in-memory atomic arithmetic maximum value operation, in-memory atomic arithmetic minimum value operation and in-memory atomic arithmetic exchange operation.

[0090] When the off-chip signal AMO<2:0> is equal to 000, the circuit is in SRAM mode and can perform read and write operations. The operations corresponding to AMO<2:0> are shown in Table 5.

[0091] Table 5 Off-chip signal operation table

[0092]

[0093] In addition, it should be noted that the SRAM circuit mode is the same as the conventional SRAM. The main focus of the embodiment of the present invention is the realization of the AMO mode. In the AMO mode, AND, OR, XOR and SWAP operations are all completed in 1 cycle, where the SWAP operation can be simply considered as writing operand 2 to the address. SWAP is to write operand 2 to the corresponding address, so it also takes 1 cycle to complete the write operation. . The ADD, MAX and MIN operations require 3 cycles to complete. This design aims to achieve efficient support for different operations and ensure the flexibility and performance of the circuit.

[0094] In some specific embodiments, step S200 may include:

[0095] S210, pull the first input signal, the second input signal and the first switching control signal low, the in-memory atomic operation circuit is in the on state, QB and Q are both 0, wherein Q represents the data storage node, and QB represents the inverting node; pull the second switching control signal low, the first input signal is restored to the ground state, the second input signal is restored to the high level state, QB and Q are both 0; pull the first switching control signal high, charge QB, QB is 1, Q is 0; pull the second switching control signal high, keep QB at 1 and Q at 0, the in-memory atomic operation circuit is in the latched state, and complete the in-memory atomic logic AND operation, the in-memory atomic logic OR operation and the in-memory atomic logic XOR operation.

[0096] In this embodiment, during the logic operation, different IN1, ie, the first input signal, and IN2, ie, the second input signal, correspond to different operations, as shown in Table 6. Figure 7 is an example of an atomic AND operation, where operand 1 is 1 and operand 2 is 0. Therefore, Q needs to be replaced from 1 to 0, which is the result of the 1 and 0 operation. The operation flow is as follows Figure 7 The process of other logic operations (AND / OR / XOR) is the same, and all logic operations are completed within one cycle.

[0097] Table 6 Example table of atoms and operations

[0098]

[0099] Reference Figure 7 ,When performing the Atomic AND (1AND 0=0) operation, it is divided into four stages, and the word line is in the off state.

[0100] Figure 7 The serial number ① in the figure indicates that both IN1 and IN2 are pulled low, and CTRL_L, the first switching control signal, is pulled low. Since QB is 0, the PMOS in the upper right corner is turned on, and the latch state of the SRAM is destroyed, the Q point will discharge to IN1, causing Q to become 0;

[0101] Figure 7 The serial number ② in the figure indicates that CTRL_R, the second switching control signal, is then pulled low. At this time, CTRL_L and CTRL_R are both low level, and IN1 and IN2 are restored to VDD and VSS respectively. At this time, the state is two independent inverters, and Q and QB are both 0.

[0102] Figure 7 The serial number ③ in the figure means: pull CTRL_L high and keep CTRL_R low, QB will be charged to 1 by VDD, so Q is 0 and QB is 1;

[0103] Figure 7 Serial number ④ in the figure indicates: pull CTRL_R high, at this time CTRL_L and CTRL_R are both high, the latch state of SRAM is restored, Q is 0 and QB is 1, the function 1AND 0=0 is completed, and the value stored in SRAM is successfully rewritten.

[0104] S220, obtain the first operand and the second operand; set the first operand to be stored in the Mth storage row in the 8T SRAM array; perform an in-memory atomic logical XOR operation on the first operand and the second operand to obtain an operand XOR calculation result; obtain the operand XOR calculation result and the negated result of the operand XOR calculation result, and obtain the output signal calculation result of the near memory logic of the atomic addition operation through near memory logic calculation; perform an XOR operation on the output signal calculation result of the near memory logic of the atomic addition operation and the operand XOR calculation result to complete the in-memory atomic arithmetic addition operation.

[0105] In this embodiment, the addition operation requires 3 cycles to complete, such as Figure 8 shown.

[0106] Assume that A, the first operand, is stored in row m.

[0107] The first cycle completes A^B through an atomic XOR operation, where B represents the second operand and A^B represents the XOR calculation result of the operands;

[0108] The second cycle completes the CIN calculation. The specific operation is to read out A^B and ~(A^B), and complete the CIN calculation corresponding to each column through the near storage logic, where ~(A^B) represents the negation of the XOR calculation result of the operand, and the CIN calculation represents the output signal calculation result of the near storage logic of the atomic addition operation;

[0109] In the third cycle, CIN is XORed with A^B in the mth row to obtain Sum=A^B^Cin. Sum=A^B^Cin.

[0110] S230, based on the first operand and the second operand, perform an atomic XOR operation to obtain the atomic XOR operation result of the two operands; obtain the atomic XOR operation result of the two operands and the inverted result of the atomic XOR operation result of the two operands, and obtain a BMAX signal through near memory logic calculation, wherein the BMAX signal is a larger value indication signal, and when the value is 1, it indicates that the second operand B is the larger value during comparison; perform an XOR operation according to the BMAX signal and the atomic maximum operation indication signal (AMO_MAX), and complete the in-memory atomic arithmetic maximum value operation and the in-memory atomic arithmetic minimum value operation.

[0111] In this embodiment, when performing atomic MAX / MIN operations, we use signed subtraction to implement comparisons. First, the input OP2 is inverted bit by bit, and CIN[0] is set to 1 to convert the addition operation into a subtraction operation OP1-OP2.

[0112] When finding the maximum value, B is larger in the following two cases, otherwise A is larger. The opposite is true when finding the minimum value.

[0113] The first is when A

[31] ^~B

[31] =0 and ~B

[31] =1, that is, the sign bit of A is 1 and the sign bit of B is 0.

[0114] The second is when A

[31] ^~B

[31] =1 and CIN

[31] =0, that is, the sign bits are the same, and SUM

[31] =A

[31] ^~B

[31] ^CIN

[31] =1, indicating that the subtraction result is a negative number, that is, OP2 is larger.

[0115] Atomic maximum / minimum operations require three cycles to complete, such as Fig. 9 shown.

[0116] The first cycle performs an atomic XOR operation to obtain A^~B.

[0117] The second cycle completes the CIN calculation, reads out A^~B and ~(A^~B), calculates the CIN corresponding to each column through the near memory logic, and obtains the BMAX signal, which is 1, indicating that B is larger.

[0118] The third cycle performs XOR of ~B or ~A according to the BMAX signal and AMO_MAX (1 represents atomic MAX, 0 represents atomic MIN), because A^~B^~A=B, A^~B^~B=A.

[0119] S300, if the control mode of the circuit is the atomic operation mode, perform the in-memory atomic operation until the in-memory atomic operation is completed, switch the control mode of the circuit to the SRAM mode, and perform a normal memory access instruction operation;

[0120] Therefore, the control method of the in-memory atomic operation circuit of the present invention is specifically as follows:

[0121] 1) Receive operation instructions: First, receive the operation instruction type from the processor, which can be divided into atomic operation instructions and ordinary memory access instructions.

[0122] 2) Mode judgment and switching: The current operation mode requirement is judged according to the operation instruction type, whether it is the ordinary SRAM mode or the AMO (atomic operation) mode. The switch control circuit will switch the SRAM mode and AMO mode through the control signals (Ctrl_L and Ctrl_R) according to the judgment result. This process ensures that the circuit can flexibly switch between different modes and support different types of operations.

[0123] 3) Perform atomic operations: After entering the AMO mode, the data drive control circuit will receive specific atomic operation instructions (such as atomic logical AND, atomic increment, atomic comparison and exchange, etc.). The data drive control circuit controls M7 and M8 in the 8T SRAM unit to perform corresponding logical operations. IN1 and IN2 are connected to the source or drain poles of M3 and M4 to cooperate with the control to implement logical operations. The near-memory calculation logic generates carry signals and comparison signals as needed to assist in the execution of atomic arithmetic operations.

[0124] 4) Operation execution and result return: During the execution of atomic operations, ensure the indivisibility of the operation, either completely execute successfully or not execute at all, and avoid partial execution. After the atomic operation is completed, write the result back to the original storage unit to ensure data consistency and integrity.

[0125] 5) Mode recovery and operation end: After the operation is completed, the switch control circuit switches the mode back to the normal SRAM mode to restore the normal operation of the system. After the operation is completed, the system can continue to process subsequent regular read and write operations or other atomic operations.

[0126] In summary, the embodiments of the present invention have the following technical differences compared with the prior art:

[0127] 1) In view of the fact that atomic operations need to read data for calculation and then write the results back to the original address, the embodiment of the present invention designs a field storage type 8T SRAM storage and calculation unit and its control and auxiliary circuits. The calculation results can be stored on-site in bit units without the need for additional storage space. This feature is intended to efficiently complete various complex atomic operations.

[0128] 2) The embodiment of the present invention adds two NMOS tubes on the basis of the conventional 6T SRAM cell to support the switching between the SRAM mode and the atomic operation mode (AMO mode). The conventional SRAM mode and the atomic operation mode can be flexibly configured without affecting the conventional functions of the original SRAM array.

[0129] 3) The embodiment of the present invention realizes the full support of the SRAM storage array for commonly used atomic operation types, including a series of in-memory atomic logic operations and in-memory atomic arithmetic operations, among which in-memory atomic arithmetic operations such as in-memory arithmetic addition, in-memory arithmetic maximum value, in-memory arithmetic minimum value and in-memory arithmetic exchange can be completed in only three cycles, and in-memory atomic logic operations such as in-memory logical AND, logical OR, and logical XOR can be completed in only a single cycle. In addition, the near-memory computing logic is reused in the circuit to implement operations such as in-memory logical AND operations, in-memory arithmetic maximum value and in-memory arithmetic minimum value, which reduces the circuit area overhead and improves the overall performance and efficiency.

[0130] The embodiments of the present invention have the following beneficial effects:

[0131] 1) In terms of computing efficiency, the in-memory atomic operation circuit based on field storage SRAM integrates data storage and computing functions, reduces data transmission between storage and computing units, and improves atomic operation processing efficiency.

[0132] 2) In terms of energy consumption optimization, the in-memory atomic operation circuit based on field storage SRAM directly completes the calculation in the storage array, avoiding frequent atomic operations to move data across the memory hierarchy, reducing the energy consumption required for data transmission, and achieving energy consumption optimization and conservation.

[0133] 3) In terms of computing density, the in-memory atomic operation circuit based on field storage SRAM achieves higher computing density, that is, more computing and storage units are integrated within a unit area, thereby improving the utilization of hardware resources.

[0134] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0135] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. An SRAM-based in-memory atomic operation circuit, characterized in that: The in-memory atomic operation circuit includes an 8TSRAM array, a switch control circuit, a near-memory calculation logic, a data drive control circuit and an SRAM peripheral circuit. The SRAM peripheral circuit includes an SRAM interface circuit, a control circuit, a row decoder and a precharge circuit. The first output end of the control circuit is connected to the input end of the precharge circuit, the second output end of the control circuit is connected to the input end of the row decoder, the output end of the row decoder is connected to the input end of the switch control circuit, the output end of the switch control circuit is connected to the first input end of the 8TSRAM array, the output end of the near-memory calculation logic is connected to the input end of the data drive control circuit, the output end of the data drive control circuit is connected to the second input end of the 8T SRAM array, and the precharge circuit is connected to the 8T SRAM array. The 8T SRAM array is used to store data generated by in-memory atomic operations and control the calculation of the in-memory atomic operations; The switch control circuit is used to control the switching between the SRAM mode and the atomic operation mode; The near memory calculation logic is used to control the carry calculation of the in-memory atomic operation; The data drive control circuit is used to control a number of the atomic operations in the memory; The SRAM peripheral circuit is used to control the data reading of the in-memory atomic operation, control the data calculation of the in-memory atomic operation, and control the data storage of the in-memory atomic operation.

2. The in-memory atomic operation circuit according to claim 1, characterized in that: The 8T SRAM array includes a plurality of 8T SRAM cells, and the 8T SRAM cells include a first transistor, a second transistor, a third transistor, a fourth transistor, a fifth transistor, a sixth transistor, a seventh transistor, and an eighth transistor, wherein the gate of the first transistor, the drain of the fifth transistor, the drain of the eighth transistor, and the gate of the second transistor are connected, the gate of the third transistor, the source of the seventh transistor, the drain of the sixth transistor, the source of the eighth transistor, and the gate of the fourth transistor are connected, the source of the first transistor, the drain of the seventh transistor, and the drain of the second transistor are connected, and the drain of the third transistor and the source of the eighth transistor are connected to the drain of the fourth transistor.

3. The in-memory atomic operation circuit according to claim 1, characterized in that: The switch control circuit includes a first NOT gate, a second NOT gate, a first NAND gate, a second NAND gate, a first delay element and a first multiplexer, wherein an input end of the first NOT gate is connected to a first input end of the first NAND gate, a second input end of the first NAND gate is connected to a first input end of the second NAND gate, an output end of the first NOT gate is connected to an input end of the second NAND gate, an output end of the first NAND gate, an input end of the first delay element and a first input end of the first multiplexer are connected, and an output end of the second NAND gate, a second input end of the first multiplexer and an input end of the second NOT gate are connected.

4. The in-memory atomic operation circuit according to claim 1, characterized in that: The near memory computing logic is formed by cascading several near memory computing units, and the near memory computing units include a third NAND gate, a fourth NAND gate, a fifth NAND gate, a first AND gate, a second AND gate and a third XNOR gate, wherein the output end of the first AND gate and the input end of the third XNOR gate are connected to the input end of the third NAND gate, the output end of the second AND gate is connected to the input end of the fourth NAND gate, the output end of the third NAND gate is connected to the first input end of the fifth NAND gate, and the output end of the fourth NAND gate is connected to the second input end of the fifth NAND gate.

5. The in-memory atomic operation circuit according to claim 1, characterized in that: The data drive control circuit includes a second multiplexer, a third multiplexer, a fourth multiplexer, a fifth multiplexer, a sixth multiplexer, a first XNOR gate and a second XNOR gate, wherein the output end of the first XNOR gate is connected to the input end of the third multiplexer, the input end of the second multiplexer is connected to the input end of the third multiplexer, the output end of the second multiplexer is connected to the first input end of the fourth multiplexer, the output end of the third multiplexer is connected to the second input end of the fourth multiplexer, the output end of the fourth multiplexer, the input end of the sixth multiplexer and the input end of the second XNOR gate are connected, and the output end of the second XNOR gate is connected to the input end of the fifth multiplexer.

6. A control method for an atomic operation circuit in a SRAM memory, characterized in that: The control method comprises the following steps: Get the operation instruction type; The operation instruction type is judged. If the operation instruction type is a common memory access instruction, the control mode of the switching circuit is an SRAM mode. If the operation instruction type is an atomic operation instruction, the control mode of the switching circuit is an atomic operation mode. If the control mode of the circuit is the atomic operation mode, the in-memory atomic operation is performed until the in-memory atomic operation is completed, and the control mode of the circuit is switched to the SRAM mode to perform a normal memory access instruction operation.

7. The method according to claim 6, characterized in that The atomic operation modes include in-memory atomic logical AND operation, in-memory atomic logical OR operation, in-memory atomic logical XOR operation, in-memory atomic arithmetic addition operation, in-memory atomic arithmetic maximum value operation, in-memory atomic arithmetic minimum value operation and in-memory atomic arithmetic exchange operation.

8. The method according to claim 7, characterized in that The atomic operation control mode of the in-memory atomic logical AND operation, the in-memory atomic logical OR operation and the in-memory atomic logical XOR operation is the same, which is specifically as follows: The first input signal, the second input signal and the first switching control signal are pulled down, the atomic operation circuit in the memory is in the on state, QB and Q are both 0, where Q represents the data storage node, and QB represents the inverting node; The second switching control signal is pulled down, the first input signal is restored to a ground state, the second input signal is restored to a high level state, and QB and Q are both 0; The first switching control signal is pulled high to charge QB, QB is 1, and Q is 0; The second switching control signal is pulled high to keep QB at 1 and Q at 0, and the in-memory atomic operation circuit is in a latched state to complete the in-memory atomic logic AND operation, the in-memory atomic logic OR operation and the in-memory atomic logic XOR operation.

9. The method according to claim 7, characterized in that: The atomic operation control method of the in-memory atomic arithmetic addition operation is specifically as follows: Get the first operand and the second operand; Setting the first operand to be stored in the Mth storage row in the 8T SRAM array; Performing an in-memory atomic logical XOR operation on the first operand and the second operand to obtain an operand XOR calculation result; Obtain the XOR calculation result of the operands and the negated result of the XOR calculation result of the operands, and obtain the output signal calculation result of the near storage logic of the atomic addition operation through near storage logic calculation; An XOR operation is performed on the output signal calculation result of the near-memory logic of the atomic addition operation and the XOR calculation result of the operand to complete the in-memory atomic arithmetic addition operation.

10. The method according to claim 7, characterized in that The atomic operation control method of the in-memory atomic arithmetic maximum value operation and the in-memory atomic arithmetic minimum value operation is the same, which is specifically as follows: Based on the first operand and the second operand, an atomic XOR operation is performed to obtain an atomic XOR operation result of the two operands; Obtaining an atomic XOR operation result of the two operands and a negated result of the atomic XOR operation result of the two operands, and obtaining a BMAX signal through near-memory logic calculation; According to the BMAX signal and the atomic maximum operation indication signal (AMO_MAX), an XOR operation is performed to complete the in-memory atomic arithmetic maximum value operation and the in-memory atomic arithmetic minimum value operation.

Citation Information

Patent Citations

  • Circuit structure for achieving in-memory operation based on SRAM

    CN111863071A

  • 8T SRAM circuit structure for realizing iterative XOR calculation in memory

    CN113921057A

  • In-memory full adder circuit for magnetic random access memory

    CN116665728A

  • 2T-2MTJ memory calculation unit and MRAM memory calculation circuit

    CN117807021A

Cited By

  • Method for executing atomic addition operation, artificial intelligence chip, computing device, medium and program product

    CN121209825A