The present invention relates to a memory control apparatus and a memory control method.
Dynamic random access memories (DRAMs) are widespread and employed as main storage devices of computer systems. Due to the increasing speed and functionality of computer systems, demand for DRAM access performance is increasing and DRAMs that operates at a higher speed are being developed. Meanwhile, DRAMs are memory devices that need refresh (memory holding operation) to continuously hold data. In DRAMs complying with up to the DDR2 standard, all banks are simultaneously refreshed on a regular basis and memory access during the refresh is prohibited, resulting in a factor of deterioration in memory access performance.
To suppress deterioration in memory access performance due to refresh, in the LPDDR2 standard, a function of performing refresh per DRAM bank has been added. Also, in the LPDDR4 standard, a function of designating a refresh bank when performing per-bank refresh has been added. Japanese Patent Laid-Open No. 2021-047829 discloses a memory controller that controls a memory including a plurality of banks, in which a bank is selected based on the state of memory access of the bank and refresh is performed on the selected bank. According to Japanese Patent Laid-Open No. 2021-047829, deterioration in memory access efficiency due to refresh is reduced or prevented.
The refresh control method disclosed in Japanese Patent Laid-Open No. 2021-047829 is silent about memory access to which priority is given by an initiator. Accordingly, a case may arise in which a bank to which memory access should be executed with a higher priority than other banks coincides with a bank that needs to be refreshed. As a result, the memory access that should be executed with a high priority will be delayed, causing a situation in which latency requirements and the like cannot be satisfied.
The present invention was made in view of the above-described problem and provides a technique for controlling issuance of refresh requests so as to enable more efficient memory access.
According to one aspect of the present invention, there is provided a memory control apparatus that controls access to a DRAM including a plurality of banks, the memory control apparatus comprising: a first generation unit configured to generate an access command in response to an access request for the DRAM, and store the generated access command in a buffer; a second generation unit configured to generate a bank-designated refresh request for the DRAM; and an issuing unit configured to issue a DRAM command to the DRAM based on the access command stored in the buffer and the refresh request generated by the second generation unit, wherein the second generation unit determines a bank to which the refresh request is to be given, from among banks remaining after a bank selected based on attribute information added to the access request has been excluded from the plurality of banks.
Further features of the present invention will become apparent from the following description of exemplary embodiments (with reference to the attached drawings).
Hereinafter, embodiments will be described in detail with reference to the attached drawings. Note, the following embodiments are not intended to limit the scope of the claimed invention. Multiple features are described in the embodiments, but limitation is not made to an invention that requires all such features, and multiple such features may be combined as appropriate. Furthermore, in the attached drawings, the same reference numerals are given to the same or similar configurations, and redundant description thereof is omitted.
In the following embodiments, descriptions are given taking, as an example of a memory control apparatus, a DRAM control apparatus that controls DRAM access complying with LPDDR4.
First, refresh operation needed for a DRAM to continuously hold data is described.
A DRAM can hold data by performing refresh at every average refresh interval defined according to the specification, as in a case of an average refresh issuance 100. Common command signals are used for refresh and memory access of a DRAM. Also, there are many timing restrictions for issuance of commands other than refreshes, and thus it is difficult to perform refresh at an average refresh interval on a consistent basis.
Also, as in a case of an advanced refresh issuance 101, a DRAM allows refreshes to be issued at timings earlier than the respective timings of the average refresh issuance. Also, as in a case of a delayed refresh issuance 102, a DRAM allows refreshes to be issued at timings later than the respective timings of the average refresh issuance. The number of refreshes allowed to be issued at earlier timings and the number of refreshes allowed to be issued at later timings are defined by the specification, and the DRAM control apparatus can change the refresh issuance timings within this allowable range.
A bus interface (hereinafter, abbreviated as bus I/F) 302 receives a memory access request issued by the initiator, converts it into an access command per row address designating an area, called a page, of the DRAM 301, and transmits it to a command storage unit 303. The command storage unit 303 includes a buffer that holds a plurality of access commands generated by the bus I/F 302. When an access command has been stored in the buffer, the command storage unit 303 notifies the command issuing unit 304 of completion of preparation for command transmission, and upon receiving a response from the command issuing unit 304, the command storage unit 303 transmits the access command to the command issuing unit 304. Note that a configuration is also possible in which the order of received memory access requests is changed to improve the efficiency in DRAM access or realize memory access requests according to the degrees of urgency. Also, the change in the order of received memory access requests may be realized by changing the order of storing access commands into the buffer.
A priority information determination unit 305 monitors access command priority information stored in the command storage unit 303 and notifies a refresh generation unit 307 of the priority information. The access command priority information will be described later with reference to
The command issuing unit 304 generates a DRAM access command for accessing the DRAM 301 based on the access command per row address received from the command storage unit 303. Also, the command issuing unit 304 generates a refresh command for refreshing the DRAM 301 in response to the per-bank refresh request generated by the refresh generation unit 307. Also, the command issuing unit 304 issues the DRAM command (a DRAM access command or a refresh command) to the DRAM 301 by adjusting the timing of issuing the DRAM access command or the refresh command.
The transfer ID 406 and the priority value 407 are information to be added to a memory access request when issued by an initiator (not shown). For example, if the initiator executes a plurality of tasks and issues a memory access for each of the tasks, adding a transfer ID specific for each task allows the initiator to recognize the relationship between the memory access and the task. In the command storage unit 303, access commands per row address generated by the bus I/F 302 are stored. The priority value 407 indicates the priority of memory access requests using numerical values such as 1, 2, 3, and the like. In the present example, the greater the numerical value is, the higher the priority is.
In step S800, the refresh generation unit 307 determines whether or not the number of advanced refreshes is greater than or equal to a predetermined number of times, and if the number of advanced refreshes is greater than the predetermined number of times, the refresh generation unit 307 repeats the determination. If the number of advanced refreshes is less than the predetermined number of times, the procedure moves to step S801. This is because the DRAM specification specifies that the number of advanced refreshes should be less than the predetermined number of times, and refresh needs to be stopped if the number of advanced refreshes is greater than or equal to the predetermined number of times. Note that, as described above, the refresh generation unit 307 recognizes, using the refresh state counter, whether the current refresh issuance situation is the advanced refresh state or the delayed refresh state. If the counter value of the refresh state counter is a positive value, this counter value is used as the number of advanced refreshes.
Steps S801 to S803 indicate an example of processing for determining refresh candidates by the refresh generation unit 307. In step S801, the refresh generation unit 307 selects banks to be refreshed (refresh candidates) based on the number of DRAM commands for each bank and determines the order of priority. More specifically, the refresh generation unit 307 calculates the sum total of the number of commands for each bank based on address information and information on the transfer length of the access commands stored in the command storage unit 303. Note that the number of commands is a numerical value obtained taking into consideration the transfer length of an access command, and will be described in detail later. Based on the number of commands obtained by this calculation, the refresh generation unit 307 selects banks serving as refresh candidates and determines the order of priority. Selection of refresh candidates and determination of the order of priority based on the number of commands will be described later with reference to
In step S802, the refresh generation unit 307 determines, from among the banks (prioritized banks) selected as refresh candidates in step S801, a refresh exclusion bank based on the priority value of the access command. The priority value is as described with reference to
In step S803, the refresh generation unit 307 determines refresh candidates. More specifically, the refresh generation unit 307 determines, as the refresh candidates, banks remaining after the bank determined as the refresh exclusion bank in step S802 has been excluded from the refresh candidates (prioritized banks) selected in step S801. The refresh generation unit 307 sets the priority for the determined refresh candidate banks in accordance with the order of priority determined in step S801. Thus, the refresh generation unit 307 determines the refresh candidates based on the sum total of read commands and write commands for each bank, the sum total of read commands and write commands of the banks other than a focused bank, and the priority value. A specific example of the above-described processing from steps S801 to S803 will be described later with reference to
In step S804, the refresh generation unit 307 determines whether or not there is any refresh candidate. If it is determined that there is any refresh candidate (Yes, in step S804), the procedure moves to step S808. On the other hand, if it is determined that there is no refresh candidate (No, in step S804), the procedure moves to step S805 since it is necessary to wait for issuance of a refresh or determine whether or not to issue a refresh.
In step S805, the refresh generation unit 307 determines whether or not the number of delayed refreshes is greater than or equal to a predetermined number of times, with reference to the counter value of the refresh state counter. This is because the DRAM specification specifies the number of delayed refreshes. If the counter value of the refresh state counter is a negative value, this counter value is used as the number of delayed refreshes. If it is determined that the number of delayed refreshes is greater than or equal to the predetermined number of times (Yes, in step S805), the procedure moves to step S806. On the other hand, if it is determined that the number of delayed refreshes is less than the predetermined number of times (No, in step S805), the refresh generation unit 307 does not need to urgently issue a refresh command and ends the procedure without generating any refresh.
In step S806, the refresh generation unit 307 determines a refresh bank. The refresh generation unit 307 checks the refresh management tables described with reference to
In step S808, the refresh generation unit 307 determines whether or not the refresh candidate is able to be refreshed. That is to say, the refresh generation unit 307 checks the refresh management tables described with reference to
In step S809, the refresh generation unit 307 determines a refresh bank, which is to be refreshed, from among the refresh candidates determined to be able to be refreshed in step S808. For example, the refresh candidate to which the highest order of priority is added can be determined as the refresh bank. In step S810, the refresh generation unit 307 generates a refresh request to the refresh bank determined in step S809, notifies the command issuing unit 304 of the refresh request, and waits for a response from the command issuing unit 304. The processing in step S810 is the same as the processing in step S807. The refresh generation unit 307 ends this procedure upon receiving the response from the command issuing unit 304.
The refresh generation unit 307 selects, based on the sum total 903, refresh candidates and determines a priority order 904. In the present embodiment, the banks whose sum total 903 is greater than or equal to a predetermined number are selected as refresh candidates. For example, N is assumed to be the number of read commands and write commands that, while a bank is being refreshed, can be issued to other banks. In this case, if banks whose sum total 903 of read commands and write commands to other banks is greater than or equal to N are selected as refresh banks, read commands and write commands to other banks can be issued continuously in parallel with the refresh. In other words, it is possible to suppress degradation in memory access performance due to refresh. Accordingly, banks whose sum total 903 of read commands and write commands to other banks is greater than or equal to N are selected as refresh candidates. In the present example, the predetermined number N is defined as 50, and banks whose sum total 903 of commands to other banks is greater than or equal to “50” are defined as refresh candidates.
Also, the priority order 904 is given to the refresh candidates (banks whose sum total 903 of commands to other banks is greater than or equal to N namely, “50”) in the descending order of the sum total 903 of commands to other banks. In the example of
On the other hand, the priority information determination unit 305 checks the priority value in the command storage unit 303, and notifies the refresh generation unit 307 of the priority value of access commands to each bank. The refresh generation unit 307 holds the priority value given from the priority information determination unit 305 as a priority value 901. Note that the priority value 901 of “1, 3” of Bank 0 indicates that the commands of Bank 0 include a command with the priority value of 1 and a command with the priority value of 3. Note that a configuration is also possible in which the priority information determination unit 305 notifies the refresh generation unit 307 of the largest value of the priority values of access command for each of the banks. In this case, for the priority value 901 in
The refresh generation unit 307 excludes, from the refresh candidates, banks to be accessed by access commands whose priority value 901 is greater than or equal to a threshold. In this example, a case is described in which the priority value threshold for use in exclusion from refresh candidates is set to “2”. In the example of
Note that when the buffer of the command storage unit 303 is empty, there is no memory access and there is no need of taking into consideration degradation in memory access performance due to refresh, and thus all banks are set as refresh candidates. Also, no degradation in memory access performance occurs no matter to which of the three banks (Bank 2, Bank 3, and Bank 5) a refresh is issued. Therefore, there is no need to give the refresh priority 906.
In step S1000, the command storage unit 303 monitors a refresh request and a response between the refresh generation unit 307 and the command issuing unit 304 to determine whether or not bank-designated refresh is being executed. Of course, the method of recognizing whether or not bank-designated refresh is being executed is not limited to this, and the command storage unit 303 may also determine whether or not bank-designated refresh is being executed, based on the state of the command issuing unit 304. If it is determined that bank-designated refresh is being executed (Yes, in step S1000), the procedure moves to step S1001, and if it is determined that bank-designated refresh is not being executed (No, in step S1000), the procedure moves to step S1002.
In step S1001, in the access command issuance order control, the command storage unit 303 performs control such that the memory access requests to banks other than a refresh bank are prioritized. For example, the command storage unit 303 performs control such that no memory access request to a bank (refresh bank) that is being refreshed is output to the command issuing unit 304. More specifically, the command storage unit 303 excludes an access command for accessing a bank that is being refreshed, from issuance order control targets. In step S1002, in the access command issuance order control, the command storage unit 303 performs issuance order control on all of the memory access requests. Note that in the access command issuance order control, memory access requests that do not deteriorate any memory access performance are prioritized, but it is also possible that a memory access request having a high priority value is prioritized. It is clear that the issuance order control described with reference to
As describe above, according to the first embodiment, bank-designated refresh is executed by selecting banks so that memory access for which the priority value is greater than or equal to a threshold is not affected. Also, the order of memory access requests is changed according to the refresh execution status. With this configuration, more efficient memory access can be realized and it is possible to suppress degradation in performance of memory access with a high priority value due to refresh.
In the first embodiment, the refresh generation unit 307 excludes, from refresh candidates, banks to be accessed by access commands whose priority value is greater than or equal to a threshold and determines banks to be refreshed. The second embodiment describes a configuration in which the refresh generation unit 307 excludes, from refresh candidates, banks to be accessed by access commands with the largest priority value in the command storage unit 303. Note that the configuration of the DRAM control apparatus 300 and the processing performed by the refresh generation unit 307 in the second embodiment are the same as those in the first embodiment (
As described above, in
As described above, according to the second embodiment, bank-designated refresh is executed on banks that do not affect memory access having the largest priority value in the command storage unit 303. With this configuration, it is possible to suppress degradation in performance of memory access having the largest priority value due to refresh operation, making it possible to realize efficient memory access. Note that, similar to the first embodiment, the refresh priority 906 may be omitted.
The first embodiment and the second embodiment have described the methods in which the refresh generation unit 307 determines refresh candidates using priority values of access commands. The third embodiment describes a method in which the refresh generation unit 307 excludes a bank to be accessed by an access command having a specific transfer ID and determines refresh candidates. Note that the configuration of the DRAM control apparatus 300 and the processing performed by the refresh generation unit 307 in the third embodiment are the same as those in the first embodiment (
As described above, according to the third embodiment, the refresh generation unit 307 selects banks that do not affect memory access having a specific transfer ID in the command storage unit 303 and bank-designated refresh is executed thereon. That is, refresh is executed so that memory access to a specific transfer destination is prioritized. Note that although the third embodiment describes a case where a bank of one type of transfer ID is excluded from refresh candidates, it is apparent that banks of multiple types of transfer IDs may also be excluded from refresh candidates. Also, similar to the first embodiment, the refresh priority 906 may be omitted.
The fourth embodiment describes a method in which the refresh generation unit 307 determines refresh candidates, if access commands are in a dependency relationship and there is an access command to be performed prior to an access command having the largest priority value.
A dependency relationship between access commands will be described with reference to
The command issuing unit 304 receives information on dependent access commands from the dependency relationship determination unit 1301, and issues the access commands so that the dependent access commands are issued in the same order as the order of reception.
The dependency relationship determination unit 1301 checks the access type and the transfer ID 1401 of access commands, specifies banks having dependent access commands, and notifies the refresh generation unit 307 of the specified banks. Because dependent access commands need to be issued with the order of reception maintained, the refresh generation unit 307 determines an additional exclusion bank based on the notified dependency relationship.
In the example of
Note that, in the description above, processing in which a bank to be accessed by an access command having the largest priority value is selected as an exclusion bank (second embodiment) has been used, but the present invention is not limited to this. For example, processing in which a bank to be accessed by an access command whose priority value is greater than or equal to a predetermined threshold is regarded as an exclusion bank (first embodiment) may be used, or processing in which a bank to be accessed by an access command having a predetermined transfer ID is regarded as an exclusion bank (third embodiment) may be used. Also, in the description above, the order of reception of dependent access commands has been taken into consideration, but the present invention is not limited to this. For example, a bank having an access command that is in a dependency relationship with the access command of an exclusion bank selected based on the priority value may be regarded as an exclusion bank, regardless of the order of reception of the dependent access commands. Also, a bank determined as a bank to be excluded based on the priority value is further determined based on its dependency relationship, but the present invention is not limited to this. For example, a configuration is also possible in which all banks to be accessed by dependent access commands are added to the exclusion banks selected using the methods of first to third embodiments.
Note that when the buffer of the command storage unit 303 is empty, there is no memory access and there is no need of taking into consideration degradation in memory access performance due to refresh, and thus all banks are set as refresh candidates.
As described above, according to the fourth embodiment, a bank to be accessed by an access command that is in a dependency relationship with an access command that is to access a bank excluded from refresh candidates based on the priority value and the like is also excluded from the refresh candidates. For example, a bank to be accessed by an access command that needs to be issued earlier than an access command that is to access a bank excluded from refresh candidates based on the priority value and the like is also excluded from the refresh candidates. As a result of refresh being executed while avoiding banks to which dependent access commands are to access, deterioration in impact of an access command with the highest priority value due to refresh issuance is reduced, for example.
Note that the present embodiment has described the refresh candidate determination method executed when a bank is excluded from refresh candidates, but a refresh candidate determination method other than this determination method is also applicable.
According to the present invention, issuance of refresh requests is controlled so that more efficient memory access is possible.
Embodiment(s) of the present invention can also be realized by a computer of a system or apparatus that reads out and executes computer executable instructions (e.g., one or more programs) recorded on a storage medium (which may also be referred to more fully as a ‘non-transitory computer-readable storage medium’) to perform the functions of one or more of the above-described embodiment(s) and/or that includes one or more circuits (e.g., application specific integrated circuit (ASIC)) for performing the functions of one or more of the above-described embodiment(s), and by a method performed by the computer of the system or apparatus by, for example, reading out and executing the computer executable instructions from the storage medium to perform the functions of one or more of the above-described embodiment(s) and/or controlling the one or more circuits to perform the functions of one or more of the above-described embodiment(s). The computer may comprise one or more processors (e.g., central processing unit (CPU), micro processing unit (MPU)) and may include a network of separate computers or separate processors to read out and execute the computer executable instructions. The computer executable instructions may be provided to the computer, for example, from a network or the storage medium. The storage medium may include, for example, one or more of a hard disk, a random-access memory (RAM), a read only memory (ROM), a storage of distributed computing systems, an optical disk (such as a compact disc (CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™), a flash memory device, a memory card, and the like.
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application No. 2023-066619, filed Apr. 14, 2023 which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2023-066619 | Apr 2023 | JP | national |