A control device and control method for shortening external memory access time

Through the combination of acceleration control module and acceleration cache memory, data at non-consecutive addresses is cached and commands are sent in advance, which solves the problem of low external memory access efficiency and achieves efficient data reading and system performance improvement.

CN113064550BActive Publication Date: 2024-09-20AMICRO SEMICONDUCTOR CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202110294448.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-19
Publication Date
2024-09-20
Estimated Expiration
2041-03-19

AI Technical Summary

Technical Problem

When reading non-consecutive data from an external memory, it is necessary to send a 'command word' and a 'read address', which causes the read-write host to be in a waiting state and reduces the operating efficiency of the system.

Method used

Use the acceleration control module to detect the continuity of access addresses, and use the acceleration cache memory to cache data at non-consecutive addresses when necessary, reduce the number of accesses to external memory, and send 'command words' and 'read addresses' in advance to save settings time.

Benefits of technology

It shortens the access time of external memory, increases the effective bandwidth of the read and write host to 100%, and improves system performance, especially in scenarios with strict program running delay requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113064550B
    Figure CN113064550B
Patent Text Reader

Abstract

The present invention discloses a control device and a control method for shortening the access time of an external memory. The method reduces the requirement for storage space and the cache frequency by caching data at non-continuous addresses, which is beneficial to controlling costs and power consumption. At the same time, because the data at non-continuous addresses are cached, the access time to the external memory can be shortened, and the bandwidth reduction problem caused by the transmission of command words, read addresses and other data is eliminated. The equivalent effective bandwidth of the read-write host reading the external memory can be increased to 100%, the reading speed is stable, and the system performance is improved, which has obvious advantages in scenarios with strict requirements on program running delay.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of memory, and in particular to a control device and a control method for shortening the access time of an external memory. Background Art

[0002] With the development of the Internet of Things and artificial intelligence technologies, the MCUs in terminal products are gradually developing towards high computing power and large program storage space. The large internal memory of the MCU is not a good choice in terms of cost and flexibility, so external memory is generally used. Due to packaging limitations, external memory usually chooses SPI flash with a serial interface. This interface can achieve a higher bandwidth in the case of continuous reading, but when the read data is not continuous, it is necessary to send a "command word" and "read address" before obtaining the program data. During this period, the read-write host will be suspended in a waiting state for data, reducing the operating efficiency of the system. Summary of the invention

[0003] In order to solve the above problems, the present invention provides a control device and a control method for shortening the access time of an external memory, which greatly improves the operation efficiency of the system. The specific technical solution of the present invention is as follows:

[0004] A control method for shortening the access time of an external memory, the method comprising the following steps: S1, an acceleration control module receives an access request from a read-write host, the access request comprising an access address; S2, the acceleration control module detects whether the access address is continuous with the last access address, if so, reads the data through an external storage controller and returns it to the read-write host, if not, enters S3; S3, the acceleration control module detects whether data corresponding to the access address is stored in an acceleration cache memory, if so, reads the data through the acceleration cache memory, and while reading the data, performs a read setting for the data of the next continuous address, and then returns the data to the read-write host, if not, enters S4; S4, the acceleration control module reads the data through the external storage controller and returns it to the read-write host, and at the same time stores the access address and the corresponding data in a storage unit of the acceleration cache memory, so that the data at the non-continuous address can be quickly read from the acceleration cache memory next time. The control method described in the present invention utilizes an accelerated cache memory to cache data at non-continuous addresses, which can reduce the requirements for storage space and cache frequency, and is beneficial to controlling costs and power consumption; at the same time, because the data at non-continuous addresses are cached, the access time to the external memory can be shortened, and the bandwidth reduction problem caused by data transmission is eliminated. The equivalent effective bandwidth of the read-write host reading the external memory can be increased to 100%, the reading speed is stable, and the system performance is improved, which has obvious advantages in scenarios with strict requirements on program running delays.

[0005] Furthermore, in step S2, the method for detecting whether the access address is continuous with the last access address is to compare the access address with the last access address, and if the value of the access address is greater than the value of the last access address by a preset step value, the access address is continuous with the last access address. If the addresses are determined to be continuous, data can be directly read from the external memory, which is faster and reduces the cache frequency.

[0006] Furthermore, in step S2, if it is detected that the last access address does not exist, the acceleration control module controls the external storage controller to send a command word and a read address to the external memory, reads data from the external memory and returns it to the read-write host, and the read-write address is the access address.

[0007] Furthermore, the method for detecting whether the data corresponding to the access address is stored in the acceleration cache memory in step S3 is to compare the access address with the address stored in the acceleration cache memory, and if there is an address with the same numerical value, it means that the data corresponding to the access address is stored. If the required data is stored in the acceleration cache memory, the access request can be completed quickly.

[0008] Furthermore, the method for setting the reading of the data of the next continuous address in step S3 is that while accelerating the cache memory to read the data, the external storage controller sends a command word and a read address to the external memory, saving the setup time of the next access request, and the next access address in the next access request is continuous with the access address. Sending the "command word" and "read address" in advance can save the setup time of the next access request and improve the data reading speed.

[0009] Furthermore, in step S4, before storing the access address and the corresponding data in a storage unit of the acceleration cache memory, it is first detected whether there are any free storage units in the acceleration cache memory. If there are, the access address and the corresponding data are stored in the free storage unit and the valid identification segment is updated. If not, an algorithm is used to find a replacement storage unit, and then the access address and the corresponding data are stored and the valid identification segment is updated. The data at the non-continuous address is stored in the storage unit of the acceleration cache memory, and there is no need to read it through the external memory next time, which shortens the access time to the external memory, eliminates the bandwidth reduction problem caused by the transmission of data such as "command words" and "read addresses", and improves system performance.

[0010] Furthermore, the algorithm for finding a replacement storage unit is a replacement algorithm.

[0011] A control device for shortening the access time of an external memory, the control device comprises an external memory, an external memory controller, an acceleration control module, an acceleration cache memory and a read-write host, wherein the external memory is connected to the external memory controller and is used to store program codes; the external memory controller is connected to the acceleration control module and is used to perform access control on the external memory; the acceleration control module is connected to the acceleration cache memory and the read-write host and is used to receive data access requests from the read-write host and control the external memory controller and the acceleration cache memory to work according to the data access requests; the acceleration cache memory is used to cache data at non-continuous addresses requested by the read-write host; the read-write host is used to initiate access requests. The control device of the present invention uses the acceleration cache memory to cache data at non-continuous addresses, which can reduce the requirements for storage space and cache frequency, and is conducive to controlling costs and power consumption; at the same time, because the data at non-continuous addresses are cached, the access time to the external memory can be shortened, and the bandwidth reduction problem caused by data transmission can be eliminated. The equivalent effective bandwidth of the read-write host reading the external memory can be increased to 100%, the reading speed is stable, the system performance is improved, and there are obvious advantages in the scene with strict requirements on program running delay.

[0012] Furthermore, the acceleration cache memory includes a plurality of storage units for storing the data at the non-continuous addresses, wherein the data at the non-continuous addresses include a set of continuous data of a preset length. The storage units are only used to store the data at the non-continuous addresses, which reduces the requirements for storage space and cache frequency, and is conducive to controlling costs and power consumption.

[0013] Furthermore, the storage unit is composed of an address segment, a data segment and a valid identification segment, wherein the address segment is used to store the first address of a group of continuous data of a preset length at non-continuous addresses read from an external memory; the data segment is used to store data at non-continuous addresses read from an external memory; and the valid identification segment is used to store an identification indicating whether the data in the accelerated cache memory is valid. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 A schematic diagram of a control device for shortening external memory access time according to an embodiment of the present invention.

[0015] Figure 2 This is a flow chart of a control method for shortening external memory access time according to an embodiment of the present invention. DETAILED DESCRIPTION

[0016] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings in the embodiments of the present invention. It should be understood that the specific embodiments described below are only used to explain the present invention and are not used to limit the present invention.

[0017] In the following description, specific details are given to provide a thorough understanding of the embodiments. However, one of ordinary skill in the art will appreciate that the embodiments may be practiced without these specific details. For example, circuits may be shown in block diagrams so as not to obscure the embodiments in unnecessary detail. In other cases, well-known circuits, structures, and techniques may not be shown in detail in order not to obscure the embodiments.

[0018] Reference Figure 1, a control device for shortening the access time of an external memory, the control device includes an external memory, an external memory controller, an acceleration control module, an acceleration cache memory and a read-write host. The external memory is used to store program code, and the read-write host will obtain the program code from the external memory when it is running. Taking GD25LT256E (ultra-high-speed 4-channel SPI NOR Flash product) as an example, when reading data in single-line mode, the read-write host needs to send an 8-bit "command word" first, then send a 24-bit "read address", and then start receiving data. The external memory controller is responsible for directly controlling the access to the external memory. The acceleration control module is the core component of the control device, which is used to receive data access requests from the read-write host and control the external memory controller and the acceleration cache memory to work according to the data access request. The acceleration cache memory is used to cache data at non-continuous addresses requested by the read-write host. Specifically, the data at the non-continuous address is stored in a storage unit of the acceleration cache memory, which consists of three parts: an address segment, a data segment and a valid identification segment. The address segment is used to store the first address of a group of continuous data of a preset length at the non-continuous address read from the external memory. It should be noted that, in order to facilitate the management of the acceleration cache memory and achieve the optimal acceleration performance, the acceleration cache memory will cache a set of continuous data of a preset length into the data segment each time. The length of the continuous data depends on the number of clock cycles occupied by the "command word", "read address" and other links when accessing the external memory and the bus width of the system. Still taking GD25LT256E as an example, when reading data, it is necessary to send an 8-bit "command word" and a 24-bit "read address", a total of 32 bits, and the bus width of the system is 32 bits. At this time, the data segment should cache 4 bytes (or 32 bits, 1 byte equals 8 bits) of data, so that the optimal acceleration performance can be achieved. The length of the continuous data can be designed to be configured through registers to adapt to different external memory timings, and the cached data can be dynamically updated when the program is running, or it can be fixedly configured as needed. If the dynamic update method is adopted, acceleration can be performed on different schemes, but due to the limitation of storage space, the acceleration effect may be variable and uncertain. If the fixed configuration method is adopted, when the firmware is determined, fixed acceleration can be achieved for the places where acceleration is required. Applications that have strict requirements on program running time can use dynamic methods, but fixed configuration methods are better. After the data is stored in the data segment, the valid identification segment will be updated. When the data is valid, the identification is "1" and when the data is invalid, it is "0". The read-write host is the initiating module of the read-write request. The control device needs to receive the request initiated by the read-write host before it starts working.

[0019] Reference Figure 2, a control method for shortening external memory access time, the method comprising the following steps:

[0020] Step S1, the acceleration control module receives an access request from a read / write host, wherein the access request includes an access address. For ease of description, the access address is recorded as ADDR. In this embodiment, one address corresponds to one byte.

[0021] Step S2, the acceleration control module detects whether the access address ADDR is continuous with the last access address. If so, the data is read through the external storage controller and returned to the read-write host. If not, enter S3. After receiving the access address ADDR of the read-write host, the acceleration control module will first compare the size of the access address ADDR with the size of the last access address. When the access address ADDR is increased by a preset step value compared with the size of the last access address, it is considered that the access address ADDR is continuous with the last access address. At this time, the data corresponding to the access address is directly read from the external memory through the external storage controller and returned to the read-write host. The preset step value is determined by the system bit width. Taking GD25LT256E as an example, the preset step value is 4, because the data length cached by the acceleration cache memory is 4 bytes at this time. It should be noted that when the access address is continuous, it is not necessary to send a "command word" or "read address" before reading data from the external memory. Therefore, reading data directly through the external storage controller will not reduce system performance. When the access address is discontinuous, the situation is the opposite. Therefore, a control device and a control method for shortening the external memory access time of the present invention are proposed to solve the problem of reduced system performance when the access address is discontinuous.

[0022] Step S3, the acceleration control module detects whether the data corresponding to the access address is stored in the acceleration cache memory. If so, the data is read through the acceleration cache memory and returned to the read-write host, and while reading the data, the data of the next continuous address is read and set. If not, enter S4. When it is found that the access address ADDR is not continuous with the last access address, the acceleration control module will try to read the requested data from the acceleration cache memory to eliminate the problem of system bandwidth reduction caused by the sending of "command word" and "read address". First, it is necessary to detect whether the requested data is stored in the acceleration cache memory. If there is a stored address equal to the size of the access address in the acceleration cache memory, it means that the requested data can be directly read from the acceleration cache memory. In this way, the access time of the external memory is shortened and the system performance is improved. After reading the requested data, it will be returned to the read-write host. It should be noted that while reading the requested data, the acceleration control module will start the external storage controller to send the "command word" and "read address" to the external memory, in order to save the setting time of the next access request. In this way, if the address of the data requested by the next read / write host is continuous with the current access address, the external storage controller can directly return the data to the read / write host.

[0023] Step S4, the acceleration control module reads the data through the external storage controller and returns it to the read-write host, and at the same time stores the access address and the corresponding data in a storage unit of the acceleration cache memory, so that the data at the non-continuous address can be quickly read from the acceleration cache memory next time. When the access address is discontinuous and there is no required data in the acceleration cache memory, the acceleration control module reads the data through the external storage controller. At this time, it is inevitable to send the "command word" and "read address" to the external memory. Although it will reduce the system performance, after reading the data, the acceleration control module will store the access address and the corresponding data in the acceleration cache memory. If the data access request at the same non-continuous address is encountered next time, it can be quickly read and returned from the acceleration cache memory. In addition, since only the data at the non-continuous address is cached instead of all the data, the cache size requirement for the acceleration cache memory is relatively low (the example code of the program jump will not account for a high proportion in the entire program). Therefore, the cache update frequency will also be reduced, which is conducive to controlling power consumption, because the cache will only be checked when the address jumps, and it is possible to update the cache. It should be noted that before storing the access address and the corresponding data in the acceleration cache memory, it is necessary to detect whether there are any free storage units in the acceleration cache memory. If there are any unused storage units, a new storage unit is allocated and the access address ADDR is stored in the address segment, and then when the external storage controller requests the data, the data is returned to the read-write host and stored in the storage unit where the access address ADDR is located. As mentioned above, taking GD25LT256E as an example, the data segment should cache 4 bytes of data to achieve optimal acceleration performance. Therefore, there are 4 data stored in the storage unit, and the corresponding addresses are ADDR, ADDR+1, ADDR+2 and ADDR+3 respectively. In this embodiment, only the first address of this group of continuous data is stored, that is, the 4 data are all stored in the storage unit where the access address ADDR is located. After the save is successful, the valid identification of the valid identification segment is updated to "1". If the storage unit is used up, the storage unit to be replaced is found through the replacement algorithm, its identification is cleared, and then the access address ADDR and the corresponding data are stored in the replaced storage unit, and then the valid identification segment is updated.

[0024] In summary, the present invention shortens the average access time of the external memory by caching the data at the non-continuous address, and eliminates the bandwidth reduction problem caused by the sending of the "command word" and the "read address". This can increase the effective read and write bandwidth of the read-write host to 100%. In other words, the read-write host can read the required data continuously. The key points are: 1. When the access address is discontinuous with the last access address, the data can be directly read from the accelerated cache memory (assuming it has been stored), saving the time of sending the "command word" and the "read address"; 2. While reading the data at the non-continuous address from the accelerated cache memory, the external storage controller will perform the reading setting of the data at the next continuous address, that is, send the "command word" and the "read address" in advance, thus saving the setting time of the next access request. From the perspective of the read-write host, the read-write host can read the required data continuously and uninterruptedly, without waiting in the middle to cause a pause, affecting the operating efficiency of the system.

[0025] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A control method for shortening external memory access time, It is characterized in that The method comprises the following steps: S1, the acceleration control module receives an access request from a read / write host, wherein the access request includes an access address; S2, the acceleration control module detects whether the access address is continuous with the last access address. If so, the data is read through the external storage controller and returned to the read-write host. If not, the process proceeds to S3; S3, the acceleration control module detects whether the acceleration cache memory stores data corresponding to the access address. If yes, the acceleration cache memory reads the data corresponding to the access address, and while reading the data corresponding to the access address, performs a read setting of the data of the next continuous address, and then returns the data corresponding to the access address to the read-write host. If no, enter S4; S4, the acceleration control module reads data through the external storage controller and returns it to the read-write host, and at the same time stores the access address and corresponding data in a storage unit of the acceleration cache memory, so that the data at the non-continuous address can be quickly read from the acceleration cache memory next time.

2. A control method for shortening external memory access time according to claim 1, It is characterized in that The method for detecting whether the access address is continuous with the last access address in step S2 is to compare the access address with the last access address. If the value of the access address is greater than the value of the last access address by a preset step value, the access address is continuous with the last access address.

3. A control method for shortening external memory access time according to claim 1, It is characterized in that In step S2, if it is detected that the last access address does not exist, the acceleration control module controls the external storage controller to send a command word and a read address to the external memory, reads data from the external memory and returns it to the read-write host, and the read address is the access address.

4. A control method for shortening external memory access time according to claim 1, It is characterized in that The method for detecting whether the data corresponding to the access address is stored in the acceleration cache memory in step S3 is to compare the access address with the address stored in the acceleration cache memory. If there are addresses with equal numerical values, it means that the data corresponding to the access address is stored.

5. A control method for shortening external memory access time according to claim 1, It is characterized in that The method for setting the reading of the data of the next continuous address in step S3 is that while accelerating the cache memory to read the data, the external storage controller sends a command word and a read address to the external memory, saving the setting time of the next access request, and the next access address in the next access request is continuous with the access address.

6. A control method for shortening external memory access time according to claim 1, It is characterized in that In step S4, before storing the access address and the corresponding data in a storage unit of the accelerated cache memory, it is first detected whether there are any free storage units in the accelerated cache memory. If so, the access address and the corresponding data are stored in the free storage unit and the valid identification segment is updated. If not, an algorithm is used to find a replacement storage unit, and then the access address and the corresponding data are stored and the valid identification segment is updated.

7. A control method for shortening external memory access time according to claim 6, It is characterized in that The algorithm for finding a replacement storage unit is called a replacement algorithm.

8. A control device for shortening the access time of an external memory, It is characterized in that The control device executes the control method for shortening the access time of the external memory as described in any one of claims 1 to 7, and the control device includes an external memory, an external memory controller, an acceleration control module, an acceleration cache memory and a read-write host, wherein: An external memory, connected to the external memory controller, for storing program codes; An external storage controller, connected to the acceleration control module, for controlling access to the external storage; An acceleration control module is connected to the acceleration cache memory and the read-write host, and is used to receive a data access request from the read-write host and control the external storage controller and the acceleration cache memory to work according to the data access request; An acceleration cache memory for caching data at non-contiguous addresses requested by a read and write host; Read-write host, used to initiate access requests.

9. A control device for shortening external memory access time according to claim 8, It is characterized in that The acceleration cache memory includes a plurality of storage units for storing data at the non-continuous addresses, wherein the data at the non-continuous addresses includes a group of continuous data of a preset length.

10. A control device for shortening external memory access time according to claim 9, It is characterized in that The storage unit is composed of an address segment, a data segment and a valid identification segment, wherein: An address segment, used for storing the first address of a group of continuous data of a preset length at non-continuous addresses read from an external memory; The data segment is used to store data at non-continuous addresses read from the external memory; The valid identification segment is used to store an identification indicating whether the data in the acceleration cache memory is valid.

Citation Information

Patent Citations

  • Method for access to external memory

    CN101271435A

  • Method and system for queuing transfers of multiple non-contiguous address ranges with a single command

    CN102171649A

  • Data-caching access method and data-caching controller

    CN105183665A

  • Non-volatile memory accelerator and method for speed up data accessing thereof

    CN107025182A

  • Method of direct storage access for non-volatibility storage and its device

    CN1794214A