A method for pre-fetching read cache of FLASH controller
By introducing a prefetch read cache mechanism in the FLASH controller, using PreFetch Cache for single-channel or multi-channel prefetch, the problem of slow response speed of FSI command sequences is solved, and read access efficiency and system performance are improved.
Patent Information
- Application Number
- CN202410685866.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-05-30
AI Technical Summary
When the existing FLASH controller reads data, the response speed of the FSI command sequence is slower than that of the AXI bus, causing the CPU to wait, affecting the system performance. Especially in SSD scenarios with a high proportion of sequential reads, the lack of read pre-read function will lead to Reading time increases.
Using the prefetch read cache method, single-channel or multi-channel prefetch is implemented in the FLASH controller through PreFetch Cache, supporting flexible prefetch strategies and replacement widths, using idle time to fill the cache, adapt to different read access scenarios, and reduce prefetching. Bumping.
It improves read access efficiency and reduces the possibility that prefetched data space is contaminated and bumped. Most of the data prefetching is performed in the idle state of the controller, with small performance losses and supports efficient flowing read access.
Smart Images

Figure CN118656309B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of memory, in particular to a method for pre-fetching and reading cache of a FLASH controller. Background Art
[0002] In order to support XIP, the CPU needs to be able to read data directly from FLASH. The interface between the CPU and the FLASH controller is usually the AXI bus, and the interface for the FLASH controller to read data from the FLASH particles is the FSI command sequence. Usually, the response of FSI to read access is slower than that of AXI bus read access, forcing the CPU to wait.
[0003] In the existing technology, the proportion of SSD sequential reads is very high, so the controller will add a pre-read function to optimize the performance to a certain extent and prepare these data in advance. When a read request arrives, the SSD can respond quickly and send the data directly to the user, thereby greatly shortening the response time. If the pre-read function is not available, the SSD needs to read the corresponding data from NAND after receiving the read command, which will undoubtedly take more time. Usually, NAND reading is also the most time-consuming part of the entire read command processing process.
[0004] At the same time, if Figure 1 As shown in the figure, in the design of FLASH controller, in order to support fast data reading, the data will be taken out in advance and placed in SRAM, and then provided to the AHB bus. For DDR prefetch data prefetching, the core frequency of DDR is generally difficult to increase, so the n-prefetch method is adopted to read n times more data at the core frequency. Prefetch literally means prefetching, a technical solution used in DDR memory chip. DDR1 uses 2n prefetch, DDR2 uses 4n prefetch, and DDR3 uses 8n prefetch. In addition, the reading speed of NAND Flash directly affects the performance and response time of the system. Optimizing the reading speed of NAND Flash is crucial to improving the overall performance of the system.
[0005] Based on this, the present application proposes a method for pre-fetching read cache of a FLASH controller to solve the above problem. Summary of the invention
[0006] 1. Technical issues to be resolved
[0007] In view of the deficiencies of the prior art, the present invention provides a method for pre-fetching read cache of a FLASH controller. The method adopts pre-fetching read data to realize pipeline read access and improve read access efficiency.
[0008] To achieve the above object, the present invention provides the following technical solution: a method for pre-fetching read cache of a FLASH controller, the method comprising:
[0009] The CPU accesses the FLASH controller through the AXI bus to obtain read data. The CPU configures the FLASH controller through the APB. The FLASH controller is provided with a PreFetch Cache for caching read data. The PreFetch Cache supports two modes: single-channel prefetch or multi-channel prefetch.
[0010] Preferably, the multi-channel prefetching is as follows: the CPU informs the FLASH controller of multiple addresses to be prefetched in the form of APB configuration prefetch addresses, and the FLASH controller completes data prefetching of these different non-continuous addresses;
[0011] The single-channel prefetching is as follows: the FLASH controller determines a prefetch address according to a pre-set prefetching strategy, and the prefetched data has continuous addresses.
[0012] Preferably, the PreFetch Cache can cache a maximum of 1024 bits of data, and each 128 bits of data corresponds to an address, that is, the granularity is 128 bits.
[0013] Preferably, the PreFetch Cache prefetch can set the prefetch replacement width to 256 / 512 / 1024 bits, and the PreFetch Cache prefetch can set the prefetch depth to 256 / 512 / 1024 bits.
[0014] Preferably, the PreFetch Cache supports a PreFetch Cachee clear operation, and the PreFetchCache supports enabling and disabling of prefetching.
[0015] Preferably, the PreFetch Cache is pre-filled using the idle time of the FLASH controller.
[0016] Preferably, the multi-channel prefetch is used to support multiple AXI master read accesses or scenarios with branch jump reads, which can significantly reduce prefetch jitter. When set to multi-channel prefetch mode, the prefetch replacement width and prefetch address need to be set. When prefetch is enabled, the hardware completes the content filling of the Prefetch Cache according to the prefetch setting.
[0017] Preferably, the single-channel prefetch is used to adapt to different bus access burst scenarios. The single-channel prefetch Cache performs prefetching according to an address increment algorithm. The default start prefetch address is 0x0. The start prefetch address can also be set by software and prefetching can be started.
[0018] Compared with the prior art, the present invention provides a method for pre-fetching read cache of a FLASH controller, which has the following beneficial effects:
[0019] 1. Flexible pre-fetching of data realizes efficient bus read access and adapts different pre-fetching strategies to different read access scenarios, while reducing the possibility of contamination and turbulence of pre-fetched data space;
[0020] 2. Most data prefetching is done when the controller is idle, resulting in little performance loss;
[0021] 3. Prefetching data supports efficient pipeline read access. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a structural diagram of the FLASH controller design in the prior art of the present invention;
[0023] Figure 2 It is a structural schematic diagram of the present invention;
[0024] Figure 3 and Figure 4 This is a schematic diagram of the present invention when the pre-fetch replacement width is 256 bits;
[0025] Figure 5 and Figure 6 This is a schematic diagram of the present invention when the pre-fetch replacement width is 512 bits;
[0026] Figure 7 and Figure 8 This is a schematic diagram of the present invention when the pre-fetch replacement width is 1024 bits;
[0027] Fig. 9 and Fig.10 This is a schematic diagram of the present invention when the pre-fetch replacement width = 128 bits & the pre-fetch depth = 1024 bits;
[0028] Fig.11 and Fig.12 This is a schematic diagram of the present invention when the pre-fetch replacement width = 256 bits & the pre-fetch depth = 1024 bits;
[0029] Fig.13 and Fig.14 This is a schematic diagram of the present invention when the pre-fetch replacement width = 512 bits & the pre-fetch depth = 1024 bits;
[0030] Fig.15 and Fig.16 This is a schematic diagram of the present invention when the pre-fetch replacement width = 1024 bits & the pre-fetch depth = 1024 bits;
[0031] Fig.17 This is a schematic diagram of the present invention when the CPU reads and accesses size=64bit and burst=4'b0000;
[0032] Fig.18 This is a schematic diagram of the present invention when the CPU reads and accesses size=64bit and burst=4'b0100. DETAILED DESCRIPTION
[0033] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0034] See also Figure 2 The present invention proposes a method for pre-fetching read cache of a FLASH controller, and the specific method includes:
[0035] The CPU accesses the FLASH controller through the AXI bus to obtain read data. The CPU configures the FLASH controller through the APB. The FLASH controller is equipped with a PreFetch Cache for caching read data. The PreFetch Cache supports two modes: single-channel prefetch or multi-channel prefetch.
[0036] Among them, multi-channel prefetch means that the CPU informs the FLASH controller of multiple addresses that need to be prefetched in the form of APB configuration prefetch address, and the FLASH controller completes the data prefetch of these different non-continuous addresses; while single-channel prefetch means that the FLASH controller determines a prefetch address based on a pre-set prefetch strategy, and the prefetched data has a continuous address.
[0037] PreFetch Cache includes the following features:
[0038] A. PreFetch Cache can cache up to 1024 bits of data, and each 128 bits of data corresponds to one address, that is, the granularity is 128 bits;
[0039] B. The pre-fetch replacement width can be set to 256 / 512 / 1024 bits;
[0040] C. The prefetch depth can be set to 256 / 512 / 1024bit;
[0041] D. Support single-channel prefetching and multi-channel prefetching;
[0042] E. Support PreFetch Cachee clearing operation;
[0043] F. Support enabling and disabling of prefetching;
[0044] G. Use the idle time of the FLASH controller to fill the PreFetch Cache.
[0045] For multi-channel prefetching, multi-channel prefetching is used to support multiple AXI master read accesses or scenarios with branch jump reads, which can significantly reduce prefetch jitter. When set to multi-channel prefetching mode, you need to set the prefetch replacement width and prefetch address. When prefetching is enabled, the hardware completes the content filling of the Prefetch Cache according to the prefetching settings.
[0046] The following describes the working process under different configurations:
[0047] ①Configuration: Prefetch replacement width = 256 bits
[0048] Please refer to Figure 3 and Figure 4 If the replacement width is set to 256 bits, the PreFetch Cache is divided into 4 blocks: PreFetch Cache0, PreFetch Cache1, PreFetch Cache2, and PreFetch Cache3, supporting a total of 4 prefetch addresses. The data addresses in the block are continuous. After prefetching is enabled, the controller will start filling the Prefetch Cache. Every time the bus read access address hits in the PreFetch Cache, the data is directly returned to the bus. If the controller is idle at this time, and when the bus read accesses [128:255] in the block, the controller will pre-read the subsequent data to complete the update filling of [0:127];
[0049] When the bus read access address does not hit in the PreFetch Cache, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in the oldest PreFetch Cache block. If the controller is idle at this time, a read access to the next address of the current access address is initiated, and the data is stored in the PreFetch Cache block to fill the PreFetch Cache block.
[0050] ②Configuration: Prefetch replacement width = 512 bits
[0051] Please refer to Figure 5 and Figure 6 ,If the replacement width is set to 512bit (adapting to the system cache line), the PreFetchCache is divided into 2 blocks: PreFetch Cache0 and PreFetch Cache1, supporting a total of 2 prefetch addresses. The data addresses in the block are continuous. After enabling prefetch, the controller will start filling the Prefetch Cache;
[0052] Each time the bus read access address hits in the PreFetch Cache, the data is directly returned to the bus. If the controller is idle at this time, and when the bus read accesses the block [128:255], the controller will read the subsequent data to complete the update filling of [0:127]. When the bus read accesses the block [256:383], the controller will pre-read the subsequent data to complete the update filling of [128:255].
[0053] When the bus read access address does not hit in the PreFetch Cache, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in the oldest PreFetch Cache block. If the controller is idle at this time, a read access is initiated for the next three addresses of the current access address, and the data is stored in the PreFetch Cache block to fill the PreFetch Cache block.
[0054] ③Configuration: Prefetch replacement width = 1024 bits
[0055] See also Figure 7 and Figure 8 ,If the replacement width is set to 1024 bits, the Prefetch Cache is not divided into blocks, and supports 1 prefetch address. The data addresses in the block are continuous. After prefetching is enabled, the controller will pre-read data to fill the Prefetch Cache;
[0056] Each time the bus read access address hits in the PreFetch Cache, the data is directly returned to the bus. If the controller is idle at this time, and when the bus read accesses the block [128:255], the controller will read the subsequent data to complete the update filling of [0:127]. When the bus read accesses the block [256:383], the controller will read the subsequent data to complete the update filling of [128:255]. When the bus read accesses the block [384:511], the controller will read the subsequent data to complete the update filling of [256:383]. When the bus read accesses the block [ When the bus read accesses the block [512:639], the controller will read the subsequent data to complete the update filling of [384:511]. When the bus read accesses the block [640:767], the controller will read the subsequent data to complete the update filling of [512:639]. When the bus read accesses the block [768:895], the controller will read the subsequent data to complete the update filling of [640:767]. When the bus read accesses the block [896:1023], the controller will read the subsequent data to complete the update filling of [768:895].
[0057] When the bus read access address does not hit in the PreFetch Cache, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in the PreFetch Cache at the same time. If the controller is idle at this time, a read access is initiated for the next seven addresses of the current access address, and the data is stored in the PreFetch Cache block to fill the PreFetchCache block.
[0058] For single-channel prefetch, single-channel prefetch is used to adapt to different bus access burst scenarios. The single-channel prefetch cache performs prefetching according to the address increment algorithm. The default start prefetch address is 0x0, and the start prefetch address can also be set by software to start prefetching.
[0059] The following describes the working process under different configurations:
[0060] ①Configuration: Prefetch replacement width = 128bit & Prefetch depth = 1024bit
[0061] See also Fig. 9 and Fig.10 , 8 blocks, namely PreFetch Cache0, PreFetch Cache1, PreFetchCache2, PreFetch Cache3, PreFetch Cache4, PreFetch Cache5, PreFetch Cache6, PreFetch Cache7;
[0062] Each time the bus read access address hits the PreFetch Cache, 128 bits of data are returned to the bus. If the controller is idle at this time and the prefetch depth is 1024 bits, subsequent data are read sequentially until all cache blocks are filled. When the bus read accesses PreFetch Cache1, PreFetch Cache0 can initiate a refill action to prefetch subsequent data. The subsequent PreFetch Cache refill actions are similar.
[0063] When the bus read access address does not hit in the PreFetch Cache, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in PreFetch Cache0 at the same time. If the controller is idle at this time, a read access is initiated for the next seven addresses of the current access address, and the data is stored in the PreFetch Cache to fill up the PreFetch Cache.
[0064] ②Configuration: Prefetch replacement width = 256bit & Prefetch depth = 1024bit
[0065] See also Fig.11 and Fig.12 ,When the prefetch replacement width is 256 bits and the prefetch depth is 1024 bits, the PreFetch Cache is divided into 4 blocks, namely PreFetch Cache0, PreFetch Cache1, PreFetch Cache2, and PreFetch Cache3;
[0066] Each time the bus read access address hits the address in the PreFetch Cache, 128 bits of data are returned to the bus. If the controller is idle at this time and the prefetch depth is 1024 bits, the subsequent data is read sequentially until all cache blocks are filled. When the bus read accesses PreFetch Cache1, PreFetch Cache0 can initiate a refill action to prefetch subsequent data. The subsequent PreFetch Cache refill actions are similar.
[0067] When the bus read access address does not hit in the PreFetch Cache, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in PreFetch Cache0 at the same time. If the controller is idle at this time, a read access is initiated for the next seven addresses of the current access address, and the data is stored in the PreFetch Cache.
[0068] ③Configuration: Prefetch replacement width = 512bit & Prefetch depth = 1024bit
[0069] See also Fig.13 and Fig.14 ,When the prefetch replacement width is 512 bits and the prefetch depth is 1024 bits, the PreFetch Cache is divided into two blocks, namely PreFetch Cache0 and PreFetch Cache1;
[0070] Each time the bus read access address hits the PreFetch Cache, 128 bits of data are returned to the bus. If the controller is idle at this time, a read access to the next seven addresses of the current access address is initiated to the Flash Memory, and the data is stored in the PreFetch Cache. When the bus read accesses PreFetch Cache1, PreFetch Cache0 can initiate a refill action to prefetch subsequent data.
[0071] When the bus read access address does not hit in the PreFetch Cache, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in PreFetch Cache0 at the same time. If the controller is idle at this time, it will continue to initiate read access to the next seven addresses and store the returned data in PreFetch Cache0 and PreFetch Cache1.
[0072] ④Configuration: Prefetch replacement width = 1024bit & Prefetch depth = 1024bit
[0073] See also Fig.15 and Fig.16 , when the prefetch replacement width is 1024 bits and the prefetch depth is 1024 bits, the PreFetch Cache is not divided into blocks. Every time the bus read access address hits, 128 bits of data are returned to the bus. If the controller is idle at this time, and the bus accesses PreFetch Cache [896:1023], a read access to the next address of the current access address is initiated to the Flash Memory, and the data is stored in PreFetch Cache [0:127] to complete the refilling action, and the subsequent updates are similar;
[0074] When the bus read access does not hit, the Flash Memory is accessed directly. When the data is returned to the bus, the data is cached in the PreFetch Cache[0:127]. If the controller is idle at this time, it will continue to initiate read access to the next seven addresses and store the returned data in the PreFetch Cache.
[0075] ⑤Other prefetch depth configurations
[0076] If the prefetch depth is 256 bits, only the data of the next address is prefetched into the PreFetch Cache;
[0077] If the prefetch depth is 512 bits, only the data of the next three addresses are prefetched into the PreFetch Cache;
[0078] This can support pipeline operations for bus read access, support caching of axi burst 1-16 read access data, and support flexible prefetch depth to adapt to different read data scenarios, thereby improving read access efficiency.
[0079] Experimental example:
[0080] Take CPU read access size = 64bit, burst = 4'b0000 as an example, see Fig.17 ;
[0081] Take CPU read access size = 64bit, burst = 4'b0100 as an example, see Fig.18 .
[0082] The present invention uses a flexible way of pre-fetching data to achieve efficient bus read access and the adaptation of different pre-fetching strategies to different read access scenarios, while reducing the possibility of contamination and turbulence of the pre-fetched data space. Most of the data is pre-fetched when the controller is idle, with little performance loss. In addition, the pre-fetched data supports efficient pipeline read access.
[0083] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A method for pre-fetching read cache of a FLASH controller, characterized in that: The method comprises: The CPU accesses the FLASH controller through the AXI bus to obtain read data. The CPU configures the FLASH controller through the APB. The FLASH controller is provided with a PreFetch Cache for caching read data. The PreFetch Cache supports two modes: single-channel prefetching or multi-channel prefetching; The multi-channel prefetching is as follows: the CPU informs the FLASH controller of multiple addresses to be prefetched in the form of APB configuration prefetching addresses, and the FLASH controller completes data prefetching of these different non-continuous addresses; The single-channel prefetching is as follows: the FLASH controller determines a prefetch address according to a pre-set prefetching strategy, and the prefetched data has a continuous address; The multi-channel prefetch is used to support multiple AXI master read accesses or scenarios with branch jump reads, which can significantly reduce prefetch jitter. When set to multi-channel prefetch mode, the prefetch replacement width and prefetch address need to be set. When prefetch is enabled, the hardware completes the content filling of the Prefetch Cache according to the prefetch settings. The single-channel prefetch is used to adapt to different bus access burst scenarios. The single-channel prefetch Cache performs prefetching according to an address increment algorithm. The default start prefetch address is 0x0. The start prefetch address can also be set by software and prefetching can be started.
2. The method for pre-fetching and reading cache of a FLASH controller according to claim 1, characterized in that: The PreFetch Cache can cache a maximum of 1024 bits of data, and each 128 bits of data corresponds to one address, that is, the granularity is 128 bits.
3. The method for pre-fetching and reading cache of a FLASH controller according to claim 1, characterized in that: The PreFetch Cache prefetch can set the prefetch replacement width to 256 / 512 / 1024 bits, and the PreFetch Cache prefetch can set the prefetch depth to 256 / 512 / 1024 bits.
4. The method for pre-fetching and reading cache of a FLASH controller according to claim 1, characterized in that: The PreFetch Cache supports a PreFetch Cache clear operation, and the PreFetch Cache supports enabling and disabling of prefetching.
5. The method for pre-fetching and reading cache of a FLASH controller according to claim 1, characterized in that: The PreFetch Cache is pre-filled using the idle time of the FLASH controller.
Citation Information
Patent Citations
Apparatus and method for performing tile-based rendering using prefetched graphics data
CN109978977A
Processor data prefetching design based on embedded DMA
CN111538679A
Application processor, system-on-chip and operation method thereof
CN117785726A
Processing Quality-of-Service (QoS) Information of Memory Transactions
US20120159088A1
