Processor, device, and apparatus

By introducing a counting module and control logic into the processor to monitor the number and time of memory row accesses and only refresh or rewrite when a specific threshold is reached, the impact of rowhammer attacks on memory is solved and the security and efficiency of memory are improved. .

WO2024198775A1PCT designated stage expired Publication Date: 2024-10-03HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/077831
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-28
Filing Date
2024-02-20
Publication Date
2024-10-03

AI Technical Summary

Technical Problem

When existing technology prevents rowhammer attacks in DRAM memory, the memory is frequently refreshed to reduce the possibility of errors. However, this affects the processor's efficiency in reading and writing the memory and fails to completely prevent the attack.

Method used

A processor is designed that includes a memory controller and a protective device. It uses a counting module and control logic to monitor the number and time of memory row accesses, and only refreshes or rewrites when a specific threshold is reached to prevent rowhammer attacks and ensure the security of the memory. performance and literacy efficiency.

Benefits of technology

It effectively reduces the possibility of errors caused by rowhammer attacks, while maintaining efficient memory read and write performance and providing better preventive measures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024077831_03102024_PF_FP_ABST
    Figure CN2024077831_03102024_PF_FP_ABST
Patent Text Reader

Abstract

A processor, a device, and an apparatus. The processor comprises a memory controller, a control logic, and a counting module, wherein the control logic is connected to the counting module. The memory controller sends to the counting module multiple row addresses of a memory to be accessed, and the counting module obtains a count value according to the number of accesses to the same row address among the multiple row addresses of said memory. The counting module notifies the control logic when the count value reaches a first threshold. The control logic notifies the memory controller. The memory controller determines a target row according to the same row address among the multiple row addresses of said memory, and performs refreshing or rewriting on the target row. The processor is provided with a built-in protective apparatus capable of predicting possible rowhammer attacks and notifying the memory controller of the attacks in time, so that the memory controller performs refreshing or rewriting on the target row in time, thereby reducing the possibility of memory errors caused by rowhammer attacks.
Need to check novelty before this filing date? Find Prior Art

Description

Processor, device, and apparatus

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on March 28, 2023, with application number 202310324616.3 and application name “A Processor, Device and Apparatus”, the entire contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of memory control technology, and in particular to a processor, device, and apparatus. Background Art

[0004] Memory security has always been a key concern for users. When using dynamic random access memory (DRAM) as memory, rowhammer attacks are common, making memory prone to errors.

[0005] In a rowhammer attack, a row of memory is accessed repeatedly and intensively within a single refresh cycle, causing errors in the data stored in the adjacent rows of the row.

[0006] Currently, to prevent memory errors during rowhammer attacks, you can increase the memory refresh frequency. While increasing the refresh frequency can mitigate the impact of rowhammer attacks on memory to a certain extent, it still falls short of achieving ideal protection. Increasing the memory refresh frequency also further impacts the processor's ability to read and write memory.

[0007] Summary of the Invention

[0008] The present application provides a processor, device, and apparatus for effectively preventing rowhammer attacks.

[0009] In the first aspect, an embodiment of the present application provides a processor, which includes a memory controller and a protection device, wherein the protection device includes control logic and a counting module, and the control logic is connected to the counting module. The protection device can be located in the memory controller or outside the memory controller. Here, the protection device is located outside the memory controller as an example. In addition, the memory controller can also be located outside the processor. Here, the memory controller is placed in the processor as an example, but the same is applicable when the memory controller is located outside the processor. The only difference is that the control logic in the processor sends a notification to the memory controller outside the processor. This situation will not be described in detail in the embodiment of the present application.

[0010] The memory controller can send multiple row addresses of the memory to be accessed to the counting module. The counting module obtains the multiple row addresses of the memory to be accessed from the control logic and obtains a count value based on the number of accesses to the same row address in the multiple row addresses of the memory to be accessed. When the count value reaches a first threshold, the counting module notifies the control logic that any row address in the multiple row addresses of the memory to be accessed is used to locate a bank and its row in the memory.

[0011] After receiving the notification from the counting module, the control logic notifies the memory controller (e.g., notifies the memory controller that the count value reaches a first threshold). The memory controller determines a target row based on the same row address among the multiple row addresses of the memory to be accessed, and refreshes or rewrites the target row.

[0012] The processor has a built-in protection device that can predict possible rowhammer attacks (for example, when the control logic determines that the count value reaches a first threshold, a rowhammer attack may occur) and promptly notify the memory controller so that the memory controller can refresh or rewrite the target row in a timely manner. This method does not require frequent memory refreshes, and only needs to refresh the memory in specific circumstances (such as when the count value reaches the first threshold). This can effectively reduce the possibility of errors caused by rowhammer attacks, while also ensuring the read and write efficiency of the memory, and can better prevent rowhammer attacks.

[0013] In one possible implementation, the control logic can control the working duration of the counting module. The control logic starts timing when the counting module starts working; when the timing reaches a time threshold T, the control logic resets the count value of the counting module to zero.

[0014] Through the above processor, the control logic can effectively detect rowhammer attacks that exist in a short period of time by controlling the working time of the computing module.

[0015] In one possible implementation, the control logic can control the operating duration of the counting module via a timer. For example, the protective device may further include a timer connected to the control logic. The control logic starts the timer when the counting module begins operating and resets the count value of the counting module to zero when the timer reaches a time threshold T.

[0016] Through the above-mentioned processor, the protection device is provided with a timer, and the control logic can control the working time of the counting module more simply and effectively through the timer.

[0017] In one possible implementation, the control logic may further control the number of row addresses of the memory to be accessed obtained by the counting module. When the counting module begins operation, the control logic counts the row addresses of the memory to be accessed; when the count value generated by the counting reaches a second threshold, the control logic clears the count value of the counting module.

[0018] Through the above processor, the control logic can effectively detect the rowhammer attack that exists when the memory is accessed multiple times and frequently by controlling the number of multiple row addresses of the memory to be accessed.

[0019] In one possible implementation, the protection device further includes a first counter. The first counter can count the number of row addresses of the memory to be accessed obtained by the counting module. When the counting module begins operation, the control logic starts the first counter; when the count value of the first counter reaches a second threshold, the control logic clears the count value obtained by the counting module.

[0020] Through the above-mentioned processor, the protection device is provided with a first counter, which can count the multiple row addresses of the memory to be accessed received by the counting module after startup. The counting method is simpler, which facilitates the control logic to clear the count value of the counting module in time when the multiple row addresses of the memory to be accessed received by the counting module reach the second threshold.

[0021] In a possible implementation, the counting module includes at least one address comparison module, a calculation trigger module, and a second counter.

[0022] One of the at least one address comparison modules compares multiple row addresses of the memory to be accessed with a reference row address of the address comparison module, and outputs a comparison result to the calculation trigger module. The address comparison module may output a comparison result when any row address of the memory to be accessed is identical to the reference row address of the address comparison module. The address comparison module outputs a comparison result each time a received row address is identical to the reference row address of the address comparison module.

[0023] The calculation trigger module receives the comparison results output by the address comparison module and triggers a second counter to count based on any comparison result output by the address comparison module. When the address comparison module outputs a comparison result between any row address of the memory to be accessed and the reference row address of the address comparison module, the calculation trigger module triggers the second counter to count, incrementing the count value by one, for each comparison result received. The second counter counts under the triggering of the calculation trigger module to obtain a count value.

[0024] Through the above processor, in the counting module, the address comparison module only needs to perform a simple comparison and can trigger the second counter to count through the calculation trigger module. The calculation logic is simple and the circuit logic of the counting module is easy to implement.

[0025] In a possible implementation, the counting module includes at least one address comparison module and a second counter.

[0026] One of the at least one address comparison modules compares multiple row addresses of the memory to be accessed with a reference row address of the address comparison module and outputs a comparison result to the control logic. The address comparison module may output a comparison result when any row address of the memory to be accessed is identical to the reference row address of the address comparison module. The address comparison module outputs a comparison result each time a received row address is identical to the reference row address of the address comparison module.

[0027] The control logic receives the comparison results output by the address comparison module and triggers a second counter based on any comparison result output by the address comparison module. When the address comparison module outputs a comparison result between any row address of the memory to be accessed and the reference row address of the address comparison module, the control logic triggers the second counter to count, incrementing the count value by one, for each comparison result received. The second counter counts under the triggering of the control logic to obtain a count value.

[0028] Through the above processor, in the counting module, the address comparison module enables the second counter to count through the control logic after comparing the row addresses. The counting triggering method is simple and the circuit logic of the counting module is easy to implement.

[0029] In a possible implementation, the address comparison module includes a memory and a comparator, and the memory is connected to the comparator.

[0030] The memory stores a reference row address for the address comparison module.

[0031] The comparator receives multiple row addresses of the memory to be accessed, compares the multiple row addresses of the memory to be accessed with the reference row address stored in the memory, and outputs the comparison result to the calculation trigger module or the control logic. The comparator can output the comparison result when any row address of the memory to be accessed is the same as the reference row address of the address comparison module. The comparator outputs a comparison result each time a received row address is the same as the reference row address of the address comparison module.

[0032] Through the above processor, the internal structure of the address comparison module is simple and the difficulty of establishing the address comparison module is relatively low.

[0033] In one possible implementation, the memory may be a register or a latch. The reference row address of the address comparison module stored in the register or latch may be configured by the control logic. Taking the latch as an example, the memory controller may send multiple row addresses of the memory to be accessed to the latch. Before the latch is locked, the multiple row addresses received by the latch will flow in from the input end and out from the output end. The control logic may control the latch to lock one or more row addresses received by the latch, and the row address locked by the latch is the reference row address of the address comparison module.

[0034] Through the above processor, the memory selection is more flexible and applicable to different scenarios. The latch can lock the received row address, making it more convenient to save the reference row address.

[0035] In a possible implementation, when there are multiple address comparison modules, the latches of the multiple address comparison modules are connected in series. The first latch among the multiple latches may be any latch located at both ends of the multiple latches connected in series.

[0036] The first latch can obtain one or more row addresses of the memory to be accessed from the memory controller. For the second latch connected to the first latch, the second latch no longer needs to obtain one or more row addresses of the memory to be accessed from the memory controller, and only needs to receive the row address transmitted by the first latch from the first latch. The manner in which the latch connected in series with the second latch receives the row address is similar to the manner in which the second latch receives the row address, that is, for a latch other than the first latch, the latch can receive the row address from the latch connected in series with it, and can also lock the received row address under the control of the control logic.

[0037] Through the above-mentioned processor, the latches are connected in series. Only one latch among the multiple latches connected in series needs to obtain one or more row addresses of the memory to be accessed from the memory controller. The other latches can obtain the row address from the latches connected in series. The memory controller does not need to transmit the row address to each latch. This connection method is relatively simple and easy to implement.

[0038] In a possible implementation, still taking the first latch and the second latch as an example, the manner in which the latches lock the row address when the latches of multiple address comparison modules are connected in series is described.

[0039] When the control logic controls the first latch to latch the row address received by the first latch, the first latch may transfer the row address previously latched by the first latch to the second latch.

[0040] The control logic controls the second latch to lock the row address transmitted by the first latch, and the row address locked by the second latch is the reference row address of the address comparison module where it is located.

[0041] Through the above processor, the control logic can control each latch to lock the received row address respectively. The implementation method is relatively fast, so that the row address can flow between the latches, achieving the effect of the latch dynamically locking the row address.

[0042] In one possible implementation, the comparator in the address comparison module where the first latch is located is used as an example to illustrate how the comparator outputs a comparison result. When the comparator obtains the address of any row of memory to be accessed from the memory controller, it compares the address of any row of memory to be accessed with the row address currently locked by the first latch and outputs the comparison result.

[0043] With the processor, as the row address locked by the latch changes, the comparator compares the received row address with the row address currently locked by the latch during address comparison, ensuring the accuracy of the comparison result. Rowhammer attacks do not simply repeatedly access a row address, but instead employ a relatively regular row address sequence, such as ABCDABCD or ABCABC. The dynamic changes in the row address locked by the latch and the real-time comparison method of the comparator can effectively identify rowhammer attacks employing regular row address sequences, thereby improving the effectiveness of rowhammer attack prevention.

[0044] In a second aspect, an embodiment of the present application provides a protection device, which includes a counting module and control logic. The protection device can be located in a processor. The beneficial effects can be found in the relevant description of the first aspect and will not be repeated here. In the protection device, the control logic is connected to the counting module.

[0045] A counting module is used to obtain multiple row addresses of the memory to be accessed from the memory controller, and obtain a count value based on the number of accesses to the same row address among the multiple row addresses of the memory to be accessed; when the count value reaches a first threshold, the control logic is notified that any row address among the multiple row addresses of the memory to be accessed is used to locate the bank and the row of the bank in the memory.

[0046] The control logic is configured to notify the memory controller that the count value reaches a first threshold after receiving a notification from the counting module.

[0047] In a possible implementation, the control logic starts timing when the counting module starts working; when the timing duration reaches a time threshold T, the count value obtained by the counting module is cleared.

[0048] In a possible implementation manner, the protection device further includes a timer, and the timer is connected to the control logic.

[0049] The control logic starts the timer when the counting module starts working; when the timer reaches the time threshold T, the control logic clears the count value obtained by the counting module.

[0050] In one possible implementation, the control logic counts multiple row addresses of the memory to be accessed when the counting module starts working, and clears the count value obtained by the counting module when the count value generated by the counting reaches a second threshold.

[0051] In a possible implementation, the control logic further includes a first counter.

[0052] The first counter counts the number of multiple row addresses of the memory to be accessed obtained by the counting module.

[0053] The control logic starts the first counter when the counting module starts working; when the count value of the first counter reaches the second threshold, the control logic clears the count value obtained by the counting module.

[0054] In a possible implementation, the counting module includes at least one address comparison module, a calculation trigger module, and a second counter.

[0055] One of the at least one address comparison modules compares a plurality of row addresses of the memory to be accessed with a reference row address of the address comparison module, and outputs a comparison result to the calculation trigger module.

[0056] The calculation trigger module triggers the second counter to count according to the comparison result output by any address comparison module.

[0057] The second counter counts under the triggering of the calculation trigger module to obtain a count value.

[0058] In a possible implementation, the address comparison module includes a memory and a comparator.

[0059] The memory stores a reference row address of the address comparison module. The comparator receives multiple row addresses of the memory to be accessed, compares the multiple row addresses of the memory to be accessed with the reference row address stored in the memory, and outputs a comparison result.

[0060] In one possible implementation, the memory is a latch. A memory controller sends multiple row addresses of memory to be accessed to the latch. Control logic controls the latch to lock the received row addresses, and the row addresses locked by the latch serve as reference row addresses for the address comparison module.

[0061] In one possible implementation, the latches of at least one address comparison module are connected in series. A first latch in the latches of the at least one address comparison module obtains one or more row addresses of the memory to be accessed from a memory controller. A second latch in the latches of the at least one address comparison module receives the row address transmitted by the first latch from the first latch connected in series with the second latch.

[0062] In a possible implementation, when the control logic controls the first latch to latch the row address received by the first latch, the first latch transmits the row address previously latched by the first latch to the second latch.

[0063] The control logic controls the second latch to lock the row address transmitted by the first latch, and the row address locked by the second latch is the reference row address of the address comparison module where it is located.

[0064] In one possible implementation, when the comparator in the address comparison module where the first latch is located obtains any row address of the memory to be accessed from the memory controller, it compares any row address of the memory to be accessed with the row address currently locked by the first latch and outputs the comparison result.

[0065] In a third aspect, an embodiment of the present application provides a memory protection method, which can be executed by a processor in a computing device, the processor including a memory controller, a control logic, and a counting module. The beneficial effects can be found in the relevant description of the first aspect and will not be repeated here. In this memory protection method, the counting module obtains multiple row addresses of the memory to be accessed from the memory controller, and obtains a count value based on the number of accesses to the same row address in the multiple row addresses of the memory to be accessed; when the count value reaches a first threshold, the control logic is notified that any row address in the multiple row addresses of the memory to be accessed is used to locate the BANK and the row of the BANK in the memory;

[0066] After receiving the notification from the counting module, the control logic notifies the memory controller. After receiving the notification from the control logic, the memory controller determines the target row based on the same row address among the multiple row addresses of the memory to be accessed, and refreshes or rewrites the target row.

[0067] In a possible implementation, the control logic starts timing when the counting module starts working; when the timing duration reaches a time threshold T, the control logic clears the count value obtained by the counting module.

[0068] In a possible implementation, the processor further includes a timer. When the counting module starts working, the control logic starts the timer; when the timer reaches a time threshold T, the control logic clears the count value obtained by the counting module.

[0069] In a possible implementation, the control logic counts multiple row addresses of the memory to be accessed when the counting module starts working; when the count value generated by the counting reaches a second threshold, the control logic clears the count value obtained by the counting module.

[0070] In a possible implementation, the processor further includes a first counter.

[0071] The first counter counts the number of row addresses of the memory to be accessed obtained by the counting module. The control logic starts the first counter when the counting module starts working; when the count value of the first counter reaches the second threshold, the count value of the counting module is cleared.

[0072] In a possible implementation, the counting module includes at least one address comparison module, a calculation trigger module, and a second counter.

[0073] One of the at least one address comparison modules compares a plurality of row addresses of the memory to be accessed with a reference row address of the address comparison module, and outputs a comparison result to the calculation trigger module.

[0074] The calculation trigger module triggers the second counter to count according to the comparison result output by any address comparison module.

[0075] The second counter counts under the triggering of the calculation trigger module to obtain a count value.

[0076] In a possible implementation, the counting module includes at least one address comparison module and a second counter.

[0077] One of the at least one address comparison modules compares multiple row addresses of the memory to be accessed with a reference row address of the address comparison module and outputs a comparison result to the control logic. The control logic triggers a second counter to count based on the comparison result output by any of the address comparison modules. The second counter counts under the triggering of the control logic to obtain a count value.

[0078] In one possible implementation, the address comparison module includes a memory and a comparator. The comparator receives multiple row addresses of the memory to be accessed, compares the multiple row addresses of the memory to be accessed with a reference row address stored in the memory, and outputs a comparison result.

[0079] In one possible implementation, the memory is a latch. A memory controller sends multiple row addresses of memory to be accessed to the latch. Control logic controls the latch to lock the received row addresses, and the row addresses locked by the latch serve as reference row addresses for the address comparison module.

[0080] In one possible implementation, latches of at least one address comparison module are connected in series; a first latch in the latches of the at least one address comparison module obtains one or more row addresses of the memory to be accessed from a memory controller. A second latch in the latches of the at least one address comparison module receives the row address transmitted by the first latch from the first latch connected in series with the second latch.

[0081] In one possible implementation, when the control logic controls the first latch to lock the row address received by the first latch, the first latch transmits the row address previously locked by the first latch to the second latch. The control logic controls the second latch to lock the row address transmitted by the first latch, and the row address locked by the second latch serves as a reference row address for the address comparison module within the latch.

[0082] In one possible implementation, the comparator in the address comparison module where the first latch is located is used to compare any row address of the memory to be accessed with the row address currently locked by the first latch when obtaining the address of any row of the memory to be accessed from the memory controller, and output the comparison result.

[0083] In a fourth aspect, an embodiment of the present application further provides a computing device, which includes the processor and memory mentioned in the first aspect.

[0084] In a fifth aspect, the present application also provides a computer chip, which is connected to a memory, and the upper part of the chip has a memory controller, control logic, and counting module as in the first aspect and various possible implementations of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0085] FIG1 is a schematic diagram of the structure of a memory provided by the present application;

[0086] FIG2 is a schematic diagram of the structure of a processor provided by the present application;

[0087] 3A and 3B are schematic structural diagrams of a protective device provided in this application;

[0088] FIG4 is a schematic structural diagram of a counting module provided by the present application;

[0089] FIG5 is a schematic diagram of the structure of an address comparison module provided by the present application;

[0090] Figures 6 and 7 are schematic structural diagrams of a protective device provided by the present application;

[0091] FIG8 is a schematic diagram of a memory protection method provided in this application. DETAILED DESCRIPTION

[0092] Before describing a processor, device, and apparatus according to an embodiment of the present application, the memory addressing method involved in the embodiment of the present application is first described.

[0093] As shown in FIG1 , it is a schematic diagram of the structure of a memory. From the hardware structure, the memory includes multiple memory chips.

[0094] A memory chip is the smallest physical unit in memory. A specific number of memory chips constitutes a rank. For example, a rank can include 8 memory chips. Another example is a rank that includes 8 memory chips and one redundant memory chip. A memory chip can include multiple rank. For example, a memory chip can include two rank.

[0095] The memory chips in a RANK can form a data storage space. Logically, this storage space can be divided into multiple banks. Each bank can be considered a storage matrix, which is like a grid array. This "grid array" has many columns and many rows. When you need to access a piece of data in this storage space, you only need to specify the row and column in the "grid array." This is also the basic principle of memory addressing.

[0096] Signal lines are provided between the memory controller and the memory, and these signal lines are used to transmit control signals, address signals, data signals, or clock signals, etc. Usually, the memory controller is integrated into the processor.

[0097] Control signals primarily monitor and control the memory state. Address signals notify the memory of the address to be accessed, represented by a bank, row, and column. Data signals are used to transmit data, such as data to be written to or read from the memory.

[0098] In the embodiments of the present application, the type of memory is not limited. The memory can be a dynamic random access memory (DRAM). In addition to DRAM, the memory can also be a double data rate (DDR) memory, such as a low power double data rate synchronous dynamic random-access memory (LPDDR) and a graphics double data rate (GDDR). The present application does not limit the type of memory. Any memory based on capacitor storage for data storage can be used as a memory.

[0099] It should be noted that the embodiments of this application only use the prevention of rowhammer attacks on memory as an example. In fact, the processor, protection device, and system provided in the embodiments of this application are also applicable to other memories, such as high-bandwidth memory (HBM) and other memories that use capacitors to store charge for data storage.

[0100] In an embodiment of the present application, a protection device can be deployed outside the memory. The protection device can record the processor's access to the rows of BANK in the memory, detect possible rowhammer attacks, and notify the memory controller. The memory controller can determine the target row that may be attacked and refresh or rewrite the target row to reduce the impact of the rowhammer attack on the memory.

[0101] In the embodiment of the present application, the protective device can be deployed in the processor. The protective device can be concentrated in the memory controller and be part of the circuit logic in the memory controller; it can also be deployed outside the memory controller and connected to the memory controller. The embodiment of the present application does not limit the deployment location of the protective device. In this application, the protective device and the memory controller are only regarded as relatively independent components for illustration. In actual applications, the protective device can be designed in the memory controller or outside the memory controller. Of course, in some scenarios, part or all of the protective device can be deployed outside the processor, and the remaining part is located inside the processor. The present application does not limit the deployment location of the protective device.

[0102] As shown in FIG2 , a processor provided in an embodiment of the present application includes a protection device 10 and a memory controller 20 . The protection device 10 includes a control logic 100 and a counting module 200 . The control logic 100 is connected to the counting module 200 . The protection device 10 is connected to the memory controller 20 .

[0103] The counting module 200 obtains a count value based on the number of times the processor 30 accesses the same row in each row of the memory. The counting module 200 can obtain from the memory controller 20 a plurality of row addresses transmitted to the memory when the processor 30 accesses the memory, that is, a plurality of row addresses of the memory to be accessed. The counting module 200 obtains a count value based on the number of times the same row address is accessed in the plurality of row addresses of the memory to be accessed. After the obtained count value reaches a set threshold value N, the counting module 200 notifies the control logic 100 that the count value reaches the threshold value N. Among them, the row address mentioned in the embodiment of the present application refers to the address of the bank in the memory and the row in the bank.

[0104] The control logic 100 can control the operating state of the counting module 200, such as triggering the counting module 200 to start counting or controlling the counting module 200 to clear the count value and restart counting. The control logic 100 can also set a threshold N for the counting module 200 and assign the threshold N to the counting module 200.

[0105] After receiving the notification from the counting module 200, the control logic 100 determines that the count value of the counting module 200 has reached the threshold value N. Upon learning that the count value of the counting module 200 has reached the threshold value N, the control logic 100 may notify the memory controller 20 so that the memory controller 20 can locate the target row that may be attacked. For example, the memory controller 20 can determine the target row based on the multiple row addresses. The memory controller 20 then refreshes or rewrites the target row.

[0106] The present application does not limit the specific types of the counting module 200 and the control logic 100. The counting module 200 and the control logic 100 can be a digital signal processor (DSP), an application specific integrated circuit (ASIC), an integrated operational amplifier (integrated operational amplifier), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, artificial intelligence chips, and chips on chips.

[0107] The row address locates the address of the bank and the row of the bank. The protection device 10 may include only one counting module 200, which can obtain a count value based on the number of times the processor 30 accesses the same row in part or all of the banks of the memory.

[0108] In some application scenarios, the counting module 200 can be divided into multiple counting submodules, each corresponding to one or more banks in the memory. The counting submodules can obtain a count value based on the number of times the processor 30 accesses the same row in the corresponding bank. Each counting submodule only needs to obtain the multiple row addresses transmitted to the memory when the processor 30 accesses the corresponding bank.

[0109] Optionally, the protection device 10 further includes a timer 300 or a first counter 400 .

[0110] As shown in FIG3A , a protective device 10 provided in an embodiment of the present application includes a control logic 100, a counting module 200, and a timer 300. The control logic 100 is connected to the counting module 200 and the timer 300, respectively. The functions of the control logic 100 and the counting module 200 can be found in the previous description and will not be further elaborated here.

[0111] The timer 300 is used to measure the operating time of the counting module 200. The control logic 100 can set a time threshold T for the timer 300. When the counting module 200 starts operating, the control logic 100 starts the timer 300. When the timer 300 reaches the time threshold T (i.e., the duration recorded by the timer 300 is equal to the time threshold T), the control logic 100 can control the counting module 200 to stop operating or reset the count value recorded by the counting module 200. The counting module 200 starts operating when it begins to obtain a count value based on the number of accesses to the same row among multiple row addresses of the memory to be accessed. In an application, the counting module 200 may start working when the counting module 200 begins to obtain multiple row addresses of the memory to be accessed, or when the count value obtained by the counting module 200 becomes 1, or when the address comparison module 210 in the counting module 200 begins to compare the received row address with the reference row address. Alternatively, the counting module 200 may start working when the counting module 200 is powered on or when the processor 30 is powered on, and may subsequently start working again when the timer 300 reaches the time threshold T or when the count value of the counting module 200 reaches the first threshold. This application does not limit the method for setting the time when the counting module 200 starts working; the above is only an example.

[0112] As shown in FIG3B , a protection device 10 provided in an embodiment of the present application includes a control logic 100, a counting module 200, and a first counter 400. The control logic 100 is connected to the counting module 200 and the first counter 400, respectively. The functions of the control logic 100 and the counting module 200 can be found in the previous description and will not be further elaborated here.

[0113] The first counter 400 is used to count the number of times the processor 30 accesses the memory. Specifically, the first counter 400 can count the number of the multiple row addresses of the memory to be accessed, as obtained by the counting module 200. The control logic 100 can set a threshold M for the first counter 400. When the counting module 200 begins operating, the control logic 100 starts the first counter 400. When the count value of the first counter 400 reaches the threshold M, indicating that the number of the multiple row addresses of the memory to be accessed is equal to the threshold M, the control logic 100 can control the counting module 200 to stop operating or clear the count value recorded by the counting module 200.

[0114] As can be seen from the description of the timer 300 and the first counter 400, they function similarly. The timer 300 controls the number of row addresses of the memory to be accessed obtained by the counting module 200 based on the time dimension. The larger the time threshold T, the greater the number of row addresses that the counting module 200 can obtain. The first counter 400 controls the number of row addresses obtained by the counting module 200 based on the number of row address transmissions. Regarding the structural design of the protection device 10, the protection device 10 can include either the timer 300 or the first counter 400. Of course, in actual applications, the protection device 10 may also not include the timer 300 or the first counter 400. Instead, the control logic 100 may directly control the number of row addresses of the memory to be accessed obtained by the counting module 200 based on the time dimension or the number of row address transmissions. In other words, the control logic 100 can have the functionality of either the timer 300 or the first counter 400.

[0115] The structure of the counting module 200 is described below. Referring to FIG4 , which is a schematic diagram of the structure of a counting module 200 provided in an embodiment of the present application, the counting module 200 includes a second counter 220 , at least one address comparison module 210 , and optionally, a counting trigger module 230 .

[0116] If the counting module 200 does not include the counting trigger module 230 , the control logic 100 is connected to at least one address comparison module 210 , and the control logic 100 is connected to the second counter 220 . The at least one address comparison module 210 and the second counter 220 may not be connected.

[0117] If the counting module 200 includes a counting trigger module 230 , the at least one address comparison module 210 is connected to the control logic 100 , and the counting trigger module 230 is respectively connected to the at least one address comparison module 210 and the second counter 220 . The control logic 100 is connected to the second counter 220 .

[0118] For any address comparison module 210, the address comparison module 210 is used to compare multiple row addresses of the memory to be accessed with the reference row address of the address comparison module 210 and output a comparison result. If the row address of the memory to be accessed is the same as the reference row address of the address comparison module 210, the address comparison module 210 triggers the second counter 220 to count via the control logic 100 or the count trigger module 230. If any row address of the memory to be accessed is the same as the reference row address, the count value of the second counter 220 is triggered to increase by one.

[0119] The reference row address of the address comparison module 210 may be pre-configured to the address comparison module 210 by the control logic 100 or the memory controller 20. For example, the control logic 100 or the memory controller 20 may pre-send the reference row address of the address comparison module 210 to the address comparison module 210, and the address comparison module 210 saves the reference row address after obtaining the reference row address. The reference row address of the address comparison module 210 may also be determined by the address comparison module 210 based on multiple row addresses of the memory to be accessed. For example, the address comparison module 210 is allowed to set a reference row address. If no reference row address has been saved in the address comparison module 210, the address comparison module 210 may use a row address of the memory to be accessed that is currently received as the reference row address of the address comparison module 210.

[0120] The embodiment of the present application does not limit the number of reference row addresses of the address comparison module 210 . The number of reference row addresses of the address comparison module 210 can be one or more.

[0121] The counting triggering module 230 can obtain the comparison result output by the at least one address comparing module 210 , and trigger the second counter to count according to the comparison result output by each address comparing module 210 .

[0122] The second counter 220 counts under the triggering of the control logic 100 or the counting trigger module 230 . The count value recorded by the second counter 220 is determined according to the same row address among the multiple row addresses of the memory to be accessed.

[0123] In an embodiment of the present application, the count value can reflect the total number of identical row addresses in the multiple row addresses of the memory to be accessed. The total number refers to the sum of the number of times each row address in the multiple row addresses of the memory to be accessed is identical. The specific value of the count value is related to the number of address comparison modules 210 in the counting module 200 and the setting method of the reference row address in the address comparison module 210. The count value is equal to the sum of the number of times the multiple row addresses of the memory to be accessed are identical to the reference row address in each address comparison module 210. When the number of address comparison modules 210 is small, the specific value of the count value may be less than the total number of identical row addresses in the multiple row addresses of the memory to be accessed. For example, when the multiple row addresses of the memory to be accessed are A, B, C, D, E, A, B, C, D, E in order, and four address comparison modules 210 are provided in the counting module 200, and the reference row addresses of the four address comparison modules 210 are A, B, C, D, respectively, the count value obtained by the counting module 200 is equal to 8, while the total number of identical row addresses in the multiple row addresses of the memory to be accessed is 10. When the reference row addresses of multiple address comparison modules 210 are identical, the specific count value may be greater than the total number of identical row addresses in the multiple row addresses of the memory to be accessed. For example, when the multiple row addresses of the memory to be accessed are A, A, A, A, A, A, A, A, and four address comparison modules 210 are provided in the counting module 200, and the reference row addresses of these four address comparison modules 210 are A, A, A, A, and A, respectively, the count value obtained by the counting module 200 is equal to 32, while the total number of identical row addresses in the multiple row addresses of the memory to be accessed is 8.

[0124] Although the count value obtained by the counting module 200 may not be equal to the total number of identical row addresses in the multiple row addresses of the memory to be accessed, it can still reflect the total number of identical row addresses in the multiple row addresses of the memory to be accessed to a certain extent. In the embodiment of the present application, by dynamically changing the reference row address of the address comparison module 210, the count value obtained by the counting module 200 can more accurately predict the potential existence of a rowhammer attack. The method for dynamically changing the reference row address of the address comparison module 210 will be described below.

[0125] It should be noted that, in the embodiment of the present application, the division of modules in the protective device 10 (such as the control logic 100, the counting module 200, the counting trigger module 230, and the address comparison module 210 in the counting module 200) is divided from a functional perspective, which is only one possible division method. The embodiment of the present application does not limit the division method of the modules. In some scenarios, some of the modules mentioned above can be concentrated together, such as the control logic 100 and the address comparison module 210 can be concentrated in one module. In some scenarios, some of the modules mentioned above can also be further divided.

[0126] The timing manner of the second counter 220 is described below in two cases: the protection device 10 includes the counting trigger module 230 and the counting module 200 does not include the counting trigger module 230 .

[0127] Case 1: The protection device 10 does not include the counting trigger module 230 .

[0128] When the address comparison module 210 compares multiple row addresses of the memory to be accessed with the reference row address, it sends the comparison result to the control logic 100. The control logic 100 controls the second counter 220 to count based on the comparison result. For example, if the comparison result indicates that a row address of the memory to be accessed is the same as the reference row address, the control logic 100 sends a trigger signal to the second counter 220. The trigger signal is used to instruct the second counter 220 to count. After receiving the trigger signal, the second counter 220 counts, and the count value is increased by one.

[0129] In the process of comparing multiple row addresses of the memory to be accessed with the reference row address, the address comparison module 210 can send the comparison result of the row address and the reference row address to the control logic 100 each time a row address of the memory to be accessed is compared with the reference row address. The comparison result indicates whether the row address is the same as or different from the reference row address. When the comparison result indicates that the row address is the same as the reference row address, the control logic 100 triggers the second counter 220 to count by sending a trigger signal to the second counter 220, and the count value is increased by one.

[0130] In the process of the address comparison module 210 comparing multiple row addresses of the memory to be accessed with the reference row address, the address comparison module 210 may also send a comparison result indicating that a row address is identical to the reference row address to the control logic 100 only when a row address transmitted to the memory when the processor 30 accesses the memory is identical to the reference row address; the control logic 100 sends a trigger signal to the second counter 220, and the trigger signal is used to indicate counting. After receiving the trigger signal, the second counter 220 counts, and the count value increases by one.

[0131] Case 2: The protection device 10 includes a counting trigger module 230 .

[0132] When the address comparison module 210 compares multiple row addresses of the memory to be accessed with the reference row address, it can send the comparison result to the counting trigger module 230. Whenever the comparison result indicates that a row address of the memory to be accessed is the same as the reference row address, the counting trigger module 230 triggers the second counter 220 to count, and the count value is incremented by 1. The counting trigger module 230 controls the second counter 220 to count in a manner similar to the control logic 100 controls the second counter 220 to count. For details, please refer to the above description and will not be repeated here.

[0133] When the counting trigger module 230 determines, based on the comparison result output by any address comparison module 210 , that a row address of the memory to be accessed is the same as the reference row address of the address comparison module 210 , it triggers the second counter 220 to count, and the count value is increased by one.

[0134] The embodiments of the present application do not limit the specific type of the counting trigger module 230. The counting trigger module 230 can be a DSP, ASIC, integrated operational amplifier, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, artificial intelligence chip, or chip on chip.

[0135] The structure of the address comparison module 210 is described below. As shown in Figure 5, it is a schematic diagram of the structure of an address comparison module 210 provided in an embodiment of the present application. The address comparison module 210 includes a memory 211 and a comparator 212. The memory 211 is connected to the control logic 100, and the memory 211 is connected to the comparator 212. When a counting trigger module 230 is provided in the protection device 10, the comparator 212 is connected to the counting trigger module 230. When the counting trigger module 230 is not provided in the protection device 10, the comparator 212 is connected to the control logic 100.

[0136] The memory 211 is used to store the reference row address of the address comparison module 210. The reference row address can be transmitted to the memory 211 by the memory controller 20 or pre-stored in the memory 211. The memory 211 can be a register or a latch. The embodiments of the present application do not limit the specific type of the memory 211; any module capable of storing data can serve as the memory 211.

[0137] The comparator 212 is connected to the memory controller 20 and can obtain multiple row addresses of the memory to be accessed from the memory controller 20. The memory 211 is connected to the comparator 212 and can obtain the reference row address stored in the memory 211. The comparator 212 can compare the multiple row addresses of the memory to be accessed with the reference row address and output the comparison result.

[0138] When the protection device 10 includes the counting trigger module 230, the comparator 212 is connected to the counting trigger module 230 and transmits the comparison result to the counting trigger module 230. When the protection device 10 does not include the counting trigger module 230, the comparator 212 is connected to the control logic 100 and transmits the comparison result to the control logic 100.

[0139] Based on the above description of the various parts included in the protection device 10, two specific protection devices 10 are introduced below.

[0140] FIG6 is a schematic diagram of the structure of a protection device 10 provided in an embodiment of the present application. The protection device 10 includes a control logic 100, a counting module 200, and a timer 300. The counting module 200 includes the plurality of address comparison modules 210 and a second counter 220. The address comparison module 210 includes interconnected latches and a comparator 212. Optionally, the counting module 200 may further include a count trigger module 230.

[0141] For the counting module 200, the memory controller 20 is connected to the latches and comparators 212 in each address comparison module 210. For any address comparison module 210, the memory controller 20 can transmit multiple row addresses of the memory to be accessed to the comparators 212 in each address comparison module 210. The memory controller 20 can also transmit multiple row addresses of the memory to be accessed to the latches in each address comparison module 210.

[0142] The memory controller 20 transmits one or more row addresses of the memory to be accessed to the latches in each address comparison module 210. The control logic 100 can control the latches in each address comparison module 210 to lock the row address received at the input end of each latch in the latch. The row address locked by the latch is the reference row address of the address comparison module 210. For the latch, the meaning of the latch locking the row address or the latch latching the row address is the same, both indicating that the latch stores the row address. The embodiments of the present application do not distinguish between these two expressions.

[0143] The embodiment of the present application does not limit the manner in which the control logic 100 controls the latches in each address comparison module 210 to lock the reference row address of the address comparison module 210. Two possible manners are listed below.

[0144] Method 1: The memory controller 20 transmits the row address of the memory to be accessed to the latches in each address comparison module 210 respectively, and the control logic 100 controls the latches in the address comparison module 210 to latch the row address received by the latches.

[0145] In this way, the control logic 100 can be connected to each latch in the control address comparison module 210. Each time the memory controller 20 obtains a row address of the memory to be accessed, it transmits the row address of the memory to be accessed to a latch in an address comparison module 210. The control logic 100 controls the latch to latch the row address of the memory to be accessed transmitted to the latch.

[0146] For example, the memory controller 20 successively obtains four row addresses of the memory to be accessed, namely row address A, row address B, row address C, and row address D. Taking the protection device 10 as an example, the protection device 10 includes four address comparison modules 210, that is, the protection device 10 includes four latches, and the four latches are respectively referred to as the first latch, the second latch, the third latch, and the fourth latch. When the memory controller 20 obtains row address A, it transmits row address A to the first latch, and the control logic 100 controls the first latch to lock row address A, while the other latches temporarily do not latch the row address; when the memory controller 20 obtains row address B, it transmits row address B to the second latch, and the control logic 100 controls the second latch to lock row address B, while the third latch and the fourth latch do not lock the row address. When the memory controller 20 obtains row address C, it transmits row address C to the third latch. The control logic 100 controls the third latch to lock row address C, while the fourth latch does not lock the row address. When the memory controller 20 obtains row address D, it transmits row address D to the fourth latch. The control logic 100 controls the fourth latch to lock row address D. At this point, the first latch, the second latch, the third latch, and the fourth latch all latch row addresses: row address A, row address B, row address C, and row address D, respectively. After the memory controller 20 sends row address D, all four latches lock the row address.

[0147] When the memory controller 20 transmits the row address of the memory to be accessed to the latch in the address comparison module 210, it also transmits the row address of the memory to be accessed to the comparator 212 in each address comparison module 210. When the comparator 212 in each address comparison module 210 receives the row address of the memory to be accessed, it obtains the row address locked by the latch from the connected latch and compares the received row address of the memory to be accessed with the row address locked by the latch. In other words, the control logic 100 controls the latches to lock the row addresses and the comparators 212 in each address comparison module 210 to compare the row addresses synchronously.

[0148] For example, when the memory controller 20 transmits row address A to the first latch, it also transmits row address A to the comparator 212 in each address comparison module 210. Since the latches in each address comparison module 210 have not yet locked the row address, the comparator 212 in each address comparison module 210 cannot perform comparisons. When the memory controller 20 transmits row address B to the second latch, it also transmits row address B to the comparator 212 in each address comparison module 210. Since the first latch has already locked row address A, the comparator 212 in the address comparison module 210 where the first latch is located can obtain row address A from the first latch, compare the row address A latched by the first latch with the row address B received from the memory controller 20, and output a comparison result. The other latches have not yet locked the row address, and the comparators 212 in the other address comparison modules 210 cannot perform comparisons. When the memory controller 20 transmits row address C to the third latch, it also simultaneously transmits row address C to the comparators 212 in each address comparison module 210. At this point, since the first latch has already latched row address A, the comparator 212 in the address comparison module 210 where the first latch resides can obtain row address A from the first latch, compare row address A latched by the first latch with row address C received from the memory controller 20, and output a comparison result. Since the second latch has already latched row address B, the comparator 212 in the address comparison module 210 where the second latch resides can obtain row address B from the second latch, compare row address B latched by the second latch with row address C received from the memory controller 20, and output a comparison result. When the memory controller 20 transmits row address D to the fourth latch, it also simultaneously transmits row address D to the comparators 212 in each address comparison module 210. At this point, since the first latch has already latched row address A, the comparator 212 in the address comparison module 210 where the first latch resides can obtain row address A from the first latch, compare the row address A latched by the first latch with the row address D received from the memory controller 20, and output a comparison result. Since the second latch has already latched row address B, the comparator 212 in the address comparison module 210 where the second latch resides can obtain row address B from the second latch, compare the row address B latched by the second latch with the row address D received from the memory controller 20, and output a comparison result. The third latch has locked the row address C. The comparator 212 in the address comparison module 210 where the third latch is located can obtain the row address C from the third latch, compare the row address C latched by the third latch with the row address D received from the memory controller 20, and output the comparison result.The fourth latch has not been controlled by the control logic 100 to lock the row address D when receiving the row address D, and the comparator 212 in the address comparison module 210 where the fourth latch is located will not output a comparison result temporarily.

[0149] Subsequently, the memory controller 20 obtains the row address of the memory to be accessed, and the memory controller 20 may transmit the row address to one of the latches. Thereafter, the control logic 100 controls the latch to replace the row address previously locked by the latch.

[0150] In this manner, control logic 100 can specifically and precisely control each latch to ensure that the latch effectively latches the row address transmitted when accessing memory, effectively defending against possible rowhammer attacks. Furthermore, protection device 10 only requires a limited number of latches to effectively defend against various possible rowhammer attacks, resulting in a simple and easy-to-implement structure.

[0151] Mode 2: The latches in each address comparison module 210 are connected in series, and the previous latch can transmit the row address to the next latch. The control logic 100 controls the latches in the address comparison module 210 to lock the row address of the memory to be accessed.

[0152] In the protection device shown in FIG6 , the latches in each address comparison module 210 are connected in series. In this connection mode, when the previous latch unlocks the row address under the control of the control logic 100, the previous latch will transfer the previously locked row address to the next latch in the series connection, and the previous latch will remain unlocked.

[0153] In this connection mode, the memory controller 20 does not need to transmit the row address of the memory to be accessed to each latch in the address comparison module 210, but only needs to transmit the multiple row addresses of the memory to be accessed to any latch at both ends of the multiple latches connected in series. With the help of the series connection between the latches, the multiple row addresses of the memory to be accessed can flow in the multiple latches, and the control logic 100 then controls each latch so that the latch can lock the received row address.

[0154] Still taking the example of the protection device 10 including four address comparison modules 210, that is, the protection device 10 includes four latches, which are respectively labeled as latch 0, latch 1, latch 2, and latch 3. Latch 0, latch 1, latch 2, and latch 3 are connected in series, with latch 0 and latch 3 being the latches at the two ends. The control logic 100 can send the row address of the memory to be accessed to latch 0 or latch 3.

[0155] For example, the memory controller 20 successively obtains four row addresses of the memory to be accessed, namely row address A, row address B, row address C, and row address D. When the memory controller 20 obtains row address A, it transmits row address A to latch 0. The control logic 100 controls latch 0 to lock row address A, and the other latches temporarily do not latch the row address. When the memory controller 20 obtains row address B, it transmits row address B to latch 0. The control logic 100 controls latch 0 to no longer latch row address A. Latch 0 transmits row address A to latch 1. The control logic 100 controls latch 0 to lock row address B. The control logic 100 controls latch 1 to lock row address A received from latch 0. At this time, latches 2 and 3 do not latch the row address. The control logic 100 obtains the row address C and transmits the row address C to latch 0. The control logic 100 controls latch 0 to no longer latch the row address B. Latch 0 transmits the row address B to latch 1. The control logic 100 controls latch 1 to no longer latch the row address A. Latch 1 transmits the row address A to latch 2. The control logic 100 controls latch 0 to lock the row address C. The control logic 100 controls latch 1 to lock the row address B received from latch 0. The control logic 100 controls latch 2 to lock the row address A received from latch 1. At this time, latch 3 does not latch the row address. When the control logic 100 obtains the row address D, the control logic 100 controls latch 0 to no longer latch the row address C, latch 0 transmits the row address C to latch 1, the control logic 100 controls latch 1 to no longer latch the row address B, latch 1 transmits the row address B to latch 2, the control logic 100 controls latch 2 to no longer latch the row address A, latch 2 transmits the row address A to latch 3, the control logic 100 controls latch 0 to lock the row address D, the control logic 100 controls latch 1 to lock the row address C received from latch 0, the control logic 100 controls latch 2 to lock the row address B received from latch 1, and the control logic 100 controls latch 3 to lock the row address A received from latch 2. At this time, latch 0, latch 1, latch 2, and latch 3 all latch the row addresses, which are row address D, row address C, row address B, and row address A, respectively.

[0156] When the memory controller 20 transmits the row address of the memory to be accessed to the latch in the address comparison module 210, it also transmits the row address of the memory to be accessed to the comparator 212 in each address comparison module 210. When the comparator 212 in each address comparison module 210 receives the row address of the memory to be accessed, it obtains the row address locked by the latch from the connected latch and compares the received row address of the memory to be accessed with the row address locked by the latch. In other words, the control logic 100 controls the latches to lock the row addresses and the comparators 212 in each address comparison module 210 to compare the row addresses synchronously.

[0157] For example, when the memory controller 20 transmits row address A to latch 0, it also transmits row address A to the comparator 212 in each address comparison module 210. Since the latch in each address comparison module 210 has not locked the row address at this time, the comparator 212 in each address comparison module 210 cannot perform comparison. When the memory controller 20 transmits row address B to latch 0, it also transmits row address B to the comparator 212 in each address comparison module 210. Since latch 0 has already locked row address A when receiving row address B, the comparator 212 in the address comparison module 210 where latch 0 is located can obtain row address A from latch 0, compare row address A latched by latch 0 with row address B received from the memory controller 20, and output the comparison result. When memory controller 20 transmits row address C to latch 0, it also transmits row address C to comparators 212 in each address comparison module 210. Since latch 0 has already locked row address B upon receiving row address C, comparator 212 in address comparison module 210 containing latch 0 can obtain row address B from latch 0, compare row address B latched by latch 0 with row address C received from memory controller 20, and output a comparison result. Latch 1 has already locked row address A upon receiving row address B. Comparator 212 in address comparison module 210 containing latch 1 can obtain row address A from latch 1, compare row address A latched by latch 1 with row address C received from memory controller 20, and output a comparison result. When memory controller 20 transmits row address D to latch 0, it also transmits row address D to comparators 212 in each address comparison module 210. Since latch 0 has already locked row address C upon receiving row address D, comparator 212 in address comparison module 210 containing latch 0 can obtain row address C from latch 0, compare row address C latched by latch 0 with row address D received from memory controller 20, and output a comparison result. Latch 1 has already locked row address B upon receiving row address C. Comparator 212 in address comparison module 210 containing latch 1 can obtain row address B from latch 1, compare row address B latched by latch 1 with row address D received from memory controller 20, and output a comparison result. Latch 2 has already locked row address A when it receives row address B. Comparator 212 in address comparison module 210 where latch 2 is located can obtain row address A from latch 2, compare row address A latched by latch 2 with row address D received from memory controller 20, and output a comparison result. Latch 3 has not yet locked row address A when it receives row address A, so comparator 212 in address comparison module 210 where latch 3 is located will not output a comparison result for the time being.

[0158] Subsequently, the memory controller 20 obtains the row address of the memory to be accessed. The memory controller 20 can transmit the row address to any latch at both ends of the multiple latches connected in series, so that the row address can flow in the multiple latches. The control logic 100 then controls each latch so that the latch can receive the received row address.

[0159] Similar to Method 1, under the control of control logic 100, the latches can latch the row address transmitted when accessing the memory, effectively defending against possible rowhammer attacks. Similarly, protection device 10 only needs to deploy a limited number of latches to defend against various possible rowhammer attacks, resulting in a simple and easy-to-implement structure. Compared to Method 1, control logic 100 does not need to independently control each latch, making the control method simpler.

[0160] Inside any address comparison module 210 , the comparator 212 compares the reference row address stored in the latch with multiple row addresses of the memory to be accessed received from the memory controller 20 , and outputs the comparison result to the count trigger module 230 or the control logic 100 .

[0161] The counting trigger module 230 or the control logic 100 triggers the second counter 220 to count according to the obtained comparison result. The manner in which the counting trigger module 230 or the control logic 100 controls the second counter 220 to count can be found in the above description and will not be repeated here.

[0162] The following describes the process of the second counter 220 counting and generating a count value in an actual scenario, where the counting module 200 includes four address comparison modules 210 and the memory 211 in the address comparison module 210 is a latch.

[0163] In scenario 1, the memory row addresses to be accessed are a, b, c, d, a, b, c, d, in order. Row address a, row address b, row address c, and row address d represent different row addresses. The row addresses latched in the four latches are row address a, row address b, row address c, and row address d, respectively.

[0164] In this case, the comparator 212 in each address comparison module 210 receives the row addresses a, b, c, d, a, b, c, d in sequence. The comparator 212 obtains the row address locked in the connected latch and outputs the comparison result to the counting trigger module 230 or the control logic 100. The counting trigger module 230 or the control logic 100 triggers the second counter 220 to count. Ultimately, the count value of the second counter 220 is 8.

[0165] In scenario 2, the row addresses of the memory to be accessed are a, b, a, b, a, b, a, b, in order, where row address a and row address b represent different row addresses. The row addresses latched in the four latches are row address a, row address b, row address a, and row address b.

[0166] In this case, the comparator 212 in each address comparison module 210 receives the row addresses a, b, a, b, a, b, a, b in sequence. The comparator 212 obtains the row address locked in the connected latch and outputs the comparison result to the counting trigger module 230 or the control logic 100. The counting trigger module 230 or the control logic 100 triggers the second counter 220 to count. Ultimately, the count value of the second counter 220 is 16.

[0167] In scenario 3, the row addresses of the memory to be accessed are a, a, a, a, a, a, a, a, a, in order, where row address a represents a specific row address. The row address latched in each of the four latches is row address a.

[0168] In this case, the comparator 212 in each address comparison module 210 receives row addresses a, a, a, a, a, a, a, a, a, in sequence. The comparator 212 obtains the row address a locked in the connected latch and outputs the comparison result to the counting trigger module 230 or the control logic 100. The counting trigger module 230 or the control logic 100 triggers the second counter 220 to count. Ultimately, the count value of the second counter 220 is 32.

[0169] As can be seen, the count value generated by the second counter 220 is equal to the total number of times the multiple row addresses of the memory to be accessed match the row addresses latched by all the latches in the address comparison modules 210. This counting method takes into account the order of the multiple row addresses of the memory to be accessed. In the event of a potential rowhammer attack, the count value generated by the second counter 220 will quickly reach the threshold value N, which facilitates the timely and rapid detection of rowhammer attacks.

[0170] For example, assume that the counting module 200 includes four address comparison modules 210, each including a latch and a comparator 212. When the memory controller 20 transmits multiple row addresses of the memory to be accessed, namely A, B, C, D, E, A, B, C, D, E, A, B, to the counting module 200, in this order, (initially, the latch has not latched a row address or has latched an invalid row address), according to the control method of the aforementioned method 1 or method 2, the count value generated by the second counter 220 is 0. This is because the first four row addresses A, B, C, and D are latched by the four latches. After the first four row addresses are received by the comparators 212, the comparison results are inconsistent, and the second counter 220 does not count. The fifth row address E is transmitted to a latch that latches the row address, and the row address latched in the latch becomes E (in the first method, the row address E is transmitted to the latch that previously latched the row address A, and the row address latched by the latch changes from A to E. In the second method, the row address E is transmitted to the latch that previously latched the row address D, and the row address D latched by the latch will be transmitted to the next latch, that is, the latch that previously latched the row address C. Ultimately, the latch that previously latched the row address A will receive the row address B latched by the previous latch, and the row address latched by the latch that previously latched the row address A will change from A to B). When the sixth row address A is transmitted to each comparator 212, since the row address latched by any latch is not A, the comparison results are inconsistent, and the second counter 220 still does not count. The second counter 220 does not count any subsequent row addresses. Finally, the count value generated by the second counter 220 is equal to 0. That is, the total number of times that the row addresses of the memory to be accessed are the same as the row address latched by the latch in the address comparison module 210 is 0.

[0171] When the memory controller 20 transmits a plurality of row addresses of the memory to be accessed to the counting module 200 in the order of A, B, C, D, A, B, C, D, A, B, C, D, in this case, according to the control method of the first or second method, the count value generated by the second counter 220 is 12.

[0172] When the memory controller 20 transmits multiple row addresses of the memory to be accessed to the counting module 200 in the order of A, B, A, B, A, B, A, B, A, B, A, B, A, B, in this case (initial, the row address has not yet been latched in the latch), according to the control method of the aforementioned method 1 or method 2, the count value generated by the second counter 220 is 24.

[0173] When the memory controller 20 transmits multiple row addresses of the memory to be accessed to the counting module 200 in sequence of A, A, A, A, A, A, A, A, A, A, A, A, A. In this case, according to the control method of the first or second method, the count value generated by the second counter 220 is 48.

[0174] In addition, in actual applications, taking into account factors such as specific scenarios, the performance of the control logic 100 or the counting trigger module 230, the control logic 100 or the counting trigger module 230 is allowed to reduce the number of triggering the second counter 220 when triggering the second counter 220 to count, that is, the count value can be less than the count value that needs to be generated theoretically. The "count value that needs to be generated theoretically" here refers to the count value that should be generated according to the counting process of the second counter 220 described above, such as the count values ​​8, 16, 32, 0, 12, and 48 mentioned above.

[0175] When the count value of the second counter 220 reaches the threshold value N (that is, the count value of the second counter 220 is equal to the threshold value N), the control logic 100 can notify the memory controller 20, and the memory controller 20 can determine the target row based on the multiple row addresses of the memory to be accessed received by the counting module 200 or the reference row addresses latched by each latch. The target row can be the row indicated by the reference row addresses latched by each latch, or it can be a row within the address range that includes the reference row addresses latched by each latch, wherein the length of the address range can be preset, such as including one or more adjacent rows of the reference row addresses latched by the latch within the address range. The embodiment of the present application is not limited to the method in which the memory controller 20 determines the target row based on the multiple row addresses of the memory to be accessed. The target row is a row that has a certain correlation with the multiple row addresses of the memory to be accessed received by the counting module 200.

[0176] After determining the target row, the memory controller 20 can directly suspend the read and write operations on the memory and refresh or rewrite the target row; the memory controller 20 can also suspend the read and write operations on the memory when the processor 30 is idle and refresh or rewrite the target row (wherein, the rewriting of the target row is achieved through the cooperation of the memory controller 20 and the processor 30).

[0177] When the count value of the second counter 220 reaches the threshold N (ie, the count value of the second counter 220 is equal to the threshold N), the control logic 100 will also clear the count value of the second counter 220 to enable the second counter 220 to count again.

[0178] In Figure 6, the protection device 10 controls the number of row addresses received by the counting module 200 through the timer 300. The control logic 100 will start the timer 300 at the same time when the counting module 200 starts working. The time when the counting module 200 starts working can be the time when the control logic 100 controls the latch to save the reference row address, or the time when the count value of the second counter 220 becomes 1. When the control logic 100 asynchronously controls each latch to save the reference row address, the time when the counting module 200 starts working can be the time when the control logic 100 controls the latch to save the reference row address for the last time or the time when the control logic 100 controls the latch to save the reference row address for the first time. The setting of the time when the counting module 200 starts working is only an example, and the embodiment of the present application does not limit the setting method of the time when the counting module 200 starts working.

[0179] When the control logic 100 starts the timer 300, if the duration recorded by the timer 300 reaches the time threshold T (that is, the duration recorded by the timer 300 is equal to the time threshold T), regardless of whether the count value of the second counter 220 reaches the threshold N, the control logic 100 clears the count value of the second counter 220 and restarts the timer 300.

[0180] If the count value of the second counter 220 reaches the threshold N and the duration recorded by the timer 300 does not reach the time threshold T (that is, the duration recorded by the timer 300 is less than the time threshold T), the control logic 100 clears the count value of the second counter 220 and restarts the timer 300.

[0181] In the protection device 10 shown in FIG6 , when the duration recorded by the timer 300 reaches the time threshold T, the control logic 100 clears the count value of the second counter 220, and the counting module 200 restarts counting from zero. In some scenarios, when the duration recorded by the timer 300 reaches the time threshold T, the control logic 100 may also suspend the operation of the counting module 200, reconfigure the reference row address of each address comparison module 210, and trigger the counting module 200 to resume operation after reconfiguring the reference row address in each address comparison module 210. For example, when the duration recorded by the timer 300 reaches the time threshold T, the control logic 100 may control the latch in each address comparison module 210 to not latch the row address. The memory controller 20 continues to transmit multiple row addresses of the memory to be accessed to the latch in each address comparison module 210. Thereafter, the control logic 100 controls the latch in each address comparison module 210 to latch the row address input from the latch into the latch. When the control logic 100 controls the latches in each address comparison module 210 to latch the row address, the control logic 100 clears the count value of the second counter 220, and the counting module 200 starts counting from 0. The control logic 100 also restarts the timer 300 to restart the timer 300.

[0182] FIG7 is a schematic diagram of the structure of a protection device 10 provided in an embodiment of the present application. The protection device 10 includes a control logic 100, a counting module 200, and a first counter 400. The counting module 200 includes the plurality of address comparison modules 210 and a second counter 220. The address comparison module 210 includes interconnected latches and a comparator 212. Optionally, the counting module 200 may further include a count trigger module 230.

[0183] Unlike the protection device 10 shown in FIG6 , the protection device 10 in FIG7 utilizes a first counter 400 to control the number of row addresses received by the counting module 200. The first counter 400 is connected to the control logic 100 and is capable of receiving row addresses transmitted by the memory controller 20 to the counting module 200, that is, multiple row addresses of the memory to be accessed transmitted by the memory controller 20. The first counter 400 is used to count the number of row addresses received by the counting module 200.

[0184] In the protection device 10 shown in Figure 7, the connection method and working method of the other components except the first counter 400 are similar to the connection method and working method of the other components except the timer 300 in the protection device 10 described in Figure 6. Please refer to the instructions for details and will not be repeated here.

[0185] In FIG7 , the protection device 10 controls the number of row addresses received by the counting module 200 via the first counter 400. The control logic 100 activates the first counter 400 when the counting module 200 begins operation, causing the first counter 400 to count the row addresses received by the control logic 100 from the counting module 200. The specific meaning of the moment when the counting module 200 begins operation can be found in the previous description and will not be repeated here.

[0186] When the control logic 100 starts the first counter 400, if the count value recorded by the first counter 400 reaches the threshold M (that is, the count value recorded by the first counter 400 is equal to the threshold M), regardless of whether the count value of the second counter 220 reaches the threshold N, the control logic 100 clears the count value of the second counter 220 and restarts the first counter 400. The control logic 100 can also control the latch in the address comparison module 210 to re-latch the row address.

[0187] If the count value of the second counter 220 reaches the threshold value N and the duration recorded by the first counter 400 does not reach the threshold value M (that is, the count value recorded by the first counter 400 is less than the threshold value M), the control logic 100 clears the count value of the second counter 220 and restarts the first counter 400. The control logic 100 can also control the latch in the address comparison module 210 to re-latch the row address.

[0188] In the protection device 10 shown in FIG7 , when the count value recorded by the first counter 400 reaches the threshold M, the control logic 100 clears the count value of the second counter 220, and the counting module 200 restarts counting from zero. In some scenarios, when the count value recorded by the first counter 400 reaches the threshold M, the control logic 100 may also suspend the operation of the counting module 200 and reconfigure the reference row address of each address comparison module 210. After reconfiguring the reference row address of each address comparison module 210, the control logic 100 triggers the counting module 200 to resume operation. For example, when the count value recorded by the first counter 400 reaches the threshold M, the control logic 100 may control the latch in each address comparison module 210 to not latch the row address, and the memory controller 20 continues to transmit the multiple row addresses of the memory to be accessed to the latch in each address comparison module 210. The control logic 100 then controls the latch in each address comparison module 210 to latch the row address input from the latch into the latch. When the control logic 100 controls the latches in each address comparison module 210 to latch the row address, the control logic 100 clears the count value of the second counter 220, and the counting module 200 starts counting from 0. The control logic 100 can also restart the first counter 400 to make it count again.

[0189] The following describes a memory protection method according to an embodiment of the present application based on FIG6 or FIG7. FIG8 shows a memory protection method according to an embodiment of the present application. The method shown in FIG8 illustrates the memory protection method according to an embodiment of the present application. The method includes:

[0190] Step 800 : The processor 30 or the memory controller 20 determines the number of address comparison modules 210 that need to be enabled.

[0191] Multiple address comparison modules 210 may be pre-deployed within the protection device 10. When executing the memory protection method, the processor 30 or the memory controller 20 may first determine, either on its own or under user configuration, the number of address comparison modules 210 to be activated. Here, the processor 30 executing step 800 is taken as an example.

[0192] When the processor 30 independently determines the number of address comparison modules 210 that need to be activated, it may determine the number of address comparison modules 210 that need to be activated based on the type, attributes, and performance of the memory, the actual application scenario, and part or all of the performance of the protection device 10 itself. For example, when the processor 30 determines that the capacity of the connected memory is large and greater than a capacity threshold, the processor 30 may determine that the number of address comparison modules 210 that need to be activated is a first set value, which is a value pre-configured in the processor 30. When the processor 30 determines that the capacity of the connected memory is small and less than the capacity threshold, the processor 30 may determine that the number of address comparison modules 210 that need to be activated is a second set value, which is a value pre-configured in the processor 30 and is less than the first set value.

[0193] For another example, when the processor 30 determines that the current time period is a busy time period, it means that the processor 30 needs to frequently access the memory. The processor 30 determines that the number of address comparison modules 210 that need to be started is a first set value, which is a value pre-configured in the memory controller 20 or the processor 30. When the processor 30 determines that the current time period is an idle time period, it means that the processor 30 performs fewer data read and write operations on the memory. The processor 30 determines that the number of address comparison modules 210 that need to be started is a second set value, which is smaller than the first set value.

[0194] When the processor 30 determines the number of address comparison modules 210 that need to be started under the user's configuration, the user can determine the number of address comparison modules 210 that need to be started based on his or her own needs, the type, properties and performance of the memory, the actual application scenario, and part or all of the performance of the protection device 10 itself. The user can configure the determined number of address comparison modules 210 that need to be started to the processor 30. After detecting the user's configuration operation or the number of address comparison modules 210 that need to be started configured by the user in the processor 30, the processor 30 can determine the number of address comparison modules 210 that need to be started. In some scenarios, the number of address comparison modules 210 that need to be started can also be a default value, and the processor 30 records the default value. When the address comparison module 210 needs to be started, the processor 30 can determine that the number of address comparison modules 210 that need to be started is the default value.

[0195] The address comparison module 210 that needs to be activated is the address comparison module 210 that needs to transmit multiple row addresses of the memory to be accessed.

[0196] The above-mentioned method in which the processor 30 determines the number of address comparison modules 210 that need to be started is only an example, and the embodiments of the present application do not limit the method in which the processor determines the number of address comparison modules 210 that need to be started. In some possible scenarios, the processor 30 can determine it by itself, or it can determine it under the instruction of other devices. The processor 30 can determine it by itself during the operation process (such as during the operation of the operating system on the processor 30), and the processor 30 can also determine it before the operation (that is, before the operation of the operating system on the processor 30). In addition, the processor 30 can also dynamically adjust the number of address comparison modules 210 in the working state during the operation process, that is, the processor 30 can add some address comparison modules 210 that need to be started, so that these address comparison modules 210 start working, or it can control a certain number of address comparison modules 210 to stop working, thereby reducing the number of working address comparison modules 210.

[0197] Step 801: The control logic 100 performs an initialization operation. The initialization operation performed by the control logic 100 includes some or all of the following:

[0198] Set the initial value for the latch, clear the timer 300 , clear the first counter 400 , clear the second counter 220 , configure the time threshold T for the timer 300 , configure the threshold M for the first counter 400 , and configure the threshold N for the second counter 220 .

[0199] The control logic 100 may or may not execute the operation of setting the latch to an initial value. The initial value configured by the control logic 100 for the latch may be an invalid row address or a valid row address.

[0200] The time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 may be pre-stored in the control logic 100. For example, a user may pre-configure the time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 in the control logic 100. The control logic 100 then configures the time threshold T for the timer 300, the threshold M for the first counter 400, and the threshold N for the second counter 220. For another example, the time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 may also be default values. The control logic 100 may directly set the time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 to the default values.

[0201] The time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 may also be partially or fully determined by the memory controller 20 or the processor 30 based on the type, attributes, and performance of the memory, the actual application scenario, and the performance of the protection device 10 itself. The time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 are then notified to the control logic 100. For example, if the memory controller 20 or the processor 30 determines that the connected memory has strong rowhammer resistance, the memory controller 20 or the processor 30 may set the time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 to larger values ​​and notify the control logic 100. If the memory controller 20 or the processor 30 determines that the connected memory has weak rowhammer resistance, the memory controller 20 or the processor 30 may set the time threshold T of the timer 300, the threshold M of the first counter 400, and the threshold N of the second counter 220 to smaller values ​​and notify the control logic 100.

[0202] Step 802: The processor 30 reads and writes data to the memory.

[0203] Step 803: The memory controller 20 transmits multiple row addresses of the memory to be accessed to the comparator 212 and latch in the address comparison module 210. The control logic 100 controls the latch to latch the row address input to the latch. The row address latched by the latch serves as the reference row address for the corresponding address comparison module 210. Step 803 can be executed simultaneously with step 802. That is, while the processor 30 is reading or writing data to the memory, the row address of the memory to be accessed transmitted by the processor when accessing the memory is transmitted to the address comparison module 210.

[0204] In step 803 , the number of the address comparison modules 210 that receive the multiple row addresses of the memory to be accessed transmitted by the memory controller 20 is equal to the number of the address comparison modules 210 determined in step 800 .

[0205] Step 804: The control logic 100 starts the timer 300 or the first counter 400. Step 804 can be performed synchronously when the control logic 100 controls the latch to latch the row address.

[0206] Step 805: For any address comparison module 210, the comparator 212 in the address comparison module 210 compares the received multiple row addresses of the memory to be accessed with the reference row address.

[0207] Step 806: For any address comparison module 210, the comparator 212 determines whether a row address of the memory to be accessed is the same as the reference row address. If yes, step 807 is executed; if not, step 805 is continued.

[0208] Step 807 : If they are the same, the address comparison module 210 (comparator 212 ) triggers the second counter 220 to count via the control logic 100 or the count trigger module 230 , and the count value of the second counter 220 increases by one.

[0209] Step 808 : The control logic 100 determines whether the count value of the second counter 220 reaches the threshold N. If so, step 809 is executed; if not, step 805 is continued.

[0210] When the count value of the second counter 220 reaches the threshold N, the second counter 220 notifies the control logic 100 ; after receiving the notification from the second counter 220 , the control logic 100 determines that the count value of the second counter 220 reaches the threshold N.

[0211] Step 809 : The control logic 100 notifies the memory controller 20 that the count value of the second counter 220 reaches the threshold N.

[0212] Step 810: The memory controller 20 determines a target row based on multiple row addresses of the memory to be accessed. The control logic 100 may select a row within an address range that includes the reference row addresses latched by the latches in each address comparison module 210 as the target row. The address range may include one or more adjacent rows of the reference row addresses latched by the latches. Alternatively, the length of the address range may be preset.

[0213] Step 811: The memory controller 20 refreshes the target row, or the memory controller 20 interacts with the processor 30 to control the memory to rewrite the target row.

[0214] Step 812: The control logic 100 clears the second counter 220. After the second counter 220 is cleared, the second counter 220 restarts counting from zero.

[0215] Step 813: After executing step 804 and before executing step 810, the control logic 100 determines whether the duration recorded by the timer 300 reaches the time threshold T or whether the count value recorded by the first counter 400 reaches the threshold M. If the duration recorded by the timer 300 reaches the time threshold T or the count value recorded by the first counter 400 reaches the threshold M, step 812 is executed. If the duration recorded by the timer 300 does not reach the time threshold T or the count value recorded by the first counter 400 does not reach the threshold M, step 805 is continued.

[0216] Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include these modifications and variations.

Claims

1. A processor, characterized in that: The processor includes a memory controller, a control logic, and a counting module, wherein the control logic is connected to the counting module; The counting module is used to obtain multiple row addresses of the memory to be accessed from the memory controller, and obtain a count value according to the number of accesses to the same row address among the multiple row addresses of the memory to be accessed; when the count value reaches a first threshold, notify the control logic that any row address among the multiple row addresses of the memory to be accessed is used to locate a BANK in the memory and a row of the BANK; The control logic is used to notify the memory controller after receiving the notification from the counting module; The memory controller is used to determine a target row according to the same row address among the multiple row addresses of the memory to be accessed, and refresh or rewrite the target row.

2. The processor according to claim 1, wherein: The control logic is also used to start timing when the counting module starts working; when the timing duration reaches a time threshold T, the counting value obtained by the counting module is cleared.

3. The processor according to claim 1 or 2, characterized in that The processor further includes a timer, wherein the timer is connected to the control logic; The control logic is also used to start the timer when the counting module starts working; when the timer reaches a time threshold T, the count value obtained by the counting module is cleared.

4. The processor according to claim 1, wherein: The control logic is also used to count multiple row addresses of the memory to be accessed when the counting module starts working; when the count value generated by the counting reaches a second threshold, the count value obtained by the counting module is cleared.

5. The processor according to claim 1 or 4, characterized in that: The processor also includes a first counter; The first counter is used to count the number of the multiple row addresses of the memory to be accessed obtained by the counting module; The control logic is further used to start the first counter when the counting module starts to work; and to clear the counting value of the counting module when the counting value of the first counter reaches a second threshold.

6. The processor according to any one of claims 1 to 5, characterized in that: The counting module includes at least one address comparison module, a calculation trigger module and a second counter; An address comparison module in the at least one address comparison module is used to compare the multiple row addresses of the memory to be accessed with the reference row address of the address comparison module, and output the comparison result to the calculation trigger module; The calculation trigger module is used to trigger the second counter to count according to the comparison result output by any of the address comparison modules; The second counter is used to count under the triggering of the calculation trigger module to obtain the count value.

7. The processor according to any one of claims 1 to 5, characterized in that: The counting module includes at least one address comparison module and a second counter; An address comparison module in the at least one address comparison module is used to compare the multiple row addresses of the memory to be accessed with the reference row address of the address comparison module, and output the comparison result to the control logic; The second counter is used to count under the triggering of the control logic to obtain the count value; The control logic is further used to trigger the second counter to count according to a comparison result output by any of the address comparison modules.

8. The processor according to claim 6 or 7, characterized in that The address comparison module includes a memory and a comparator; The memory is used to store the reference row address of the address comparison module; The comparator is used to receive a plurality of row addresses of the memory to be accessed, compare the plurality of row addresses of the memory to be accessed with the reference row address stored in the memory, and output the comparison result.

9. The processor of claim 8, wherein: The memory is a latch; The latch is used to obtain one or more row addresses of the memory to be accessed; The control logic is further used to control the latch to lock the row address received by the latch, and the row address locked by the latch is the reference row address of the address comparison module.

10. The processor of claim 9, wherein: The latches of the at least one address comparison module are connected in series; A first latch in the latches of the at least one address comparison module is used to obtain one or more row addresses of the memory to be accessed from the memory controller; The second latch in the latches of the at least one address comparison module is used to receive the row address transmitted by the first latch from the first latch connected in series with the second latch.

11. The processor of claim 10, wherein: The first latch is used to: when the control logic controls the first latch to lock the row address received by the first latch, transmit the row address previously locked by the first latch to the second latch; The control logic is further used to control the second latch to lock the row address transmitted by the first latch, and the row address locked by the second latch is a reference row address of the address comparison module where the second latch is located.

12. The processor according to claim 10 or 11, characterized in that The comparator in the address comparison module where the first latch is located is used to compare any row address of the memory to be accessed with the row address currently locked by the first latch when obtaining any row address of the memory to be accessed from the memory controller, and output the comparison result.

13. A computing device, characterized in that: The computing device comprises a memory and a processor as claimed in any one of claims 1 to 12.

14. A protective device, characterized in that: The protection device is deployed in a processor of a computing device, and the protection device includes a control logic and a counting module, wherein the control logic is connected to the counting module; The counting module is used to obtain multiple row addresses of the memory to be accessed from the memory controller, and obtain a counting value according to the number of accesses to the same row address among the multiple row addresses; When the count value reaches a first threshold, the control logic is notified that the row address to be counted is used to locate a BANK in the memory and a row of the BANK; The control logic is used to notify the memory controller that the count value reaches a first threshold after receiving a notification from the counting module.

15. The protection device according to claim 14, characterized in that The protection device further comprises a timer, wherein the timer is connected to the control logic; The control logic is also used to start the timer when the counting module starts working; when the timer reaches a time threshold T, the count value obtained by the counting module is cleared.

16. The protection device according to claim 14, characterized in that The protection device also includes a first counter; The first counter is used to count the number of row addresses obtained by the counting module; The control logic is further configured to start the first counter when the counting module starts to work; and to clear the count value obtained by the counting module when the count value of the first counter reaches a second threshold.

17. The protection device according to any one of claims 14 to 16, characterized in that: The counting module includes at least one address comparison module, a calculation trigger module and a second counter; An address comparison module in the at least one address comparison module is used to compare the multiple row addresses of the memory to be accessed with the reference row address of the address comparison module, and output the comparison result to the calculation trigger module; The calculation trigger module is used to trigger the second counter to count according to the comparison result output by any of the address comparison modules; The second counter is used to count under the triggering of the calculation trigger module to obtain the count value.

18. The protection device according to any one of claims 14 to 16, characterized in that: The counting module includes at least one address comparison module and a second counter; An address comparison module in the at least one address comparison module is used to compare the multiple row addresses of the memory to be accessed with the reference row address of the address comparison module, and output the comparison result to the control logic; The second counter is used to count under the triggering of the control logic to obtain the count value; The control logic is further used to trigger the second counter to count according to a comparison result output by any of the address comparison modules.

Citation Information

Patent Citations

  • Access count device, memory system, and access count method

    CN104934057A

  • Memory device, memory system and method for refreshing memory device

    CN110473577A

  • Hammer refresh row address detector, and semiconductor memory device and memory module including the same

    US11568917B1

  • Row hammer condition monitoring

    US20140006704A1