WO2017084415A1 - Memory switching method, device, and computer storage medium - Google Patents

Memory switching method, device, and computer storage medium Download PDF

Info

Publication number
WO2017084415A1
WO2017084415A1 PCT/CN2016/098115 CN2016098115W WO2017084415A1 WO 2017084415 A1 WO2017084415 A1 WO 2017084415A1 CN 2016098115 W CN2016098115 W CN 2016098115W WO 2017084415 A1 WO2017084415 A1 WO 2017084415A1
Authority
WO
WIPO (PCT)
Prior art keywords
ram
tcm
cache
memory
request
Prior art date
Application number
PCT/CN2016/098115
Other languages
French (fr)
Chinese (zh)
Inventor
赵世凡
孙志文
Original Assignee
深圳市中兴微电子技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市中兴微电子技术有限公司 filed Critical 深圳市中兴微电子技术有限公司
Publication of WO2017084415A1 publication Critical patent/WO2017084415A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0638Combination of memories, e.g. ROM and RAM such as to permit replacement or supplementing of words in one module by words in another module

Definitions

  • the present invention relates to data storage technologies, and in particular, to a memory switching method, apparatus, and computer storage medium for implementing dynamic switching of a cache and a Tightly Coupled Memory (TCM).
  • TCM Tightly Coupled Memory
  • the storage system is hierarchical, and the closer to the core, the smaller the size, the faster the read and write speed.
  • L1Cache and L2Cache most processor systems also have L1TCM; L1TCM is fast and the access time is determined, but usually it is small in size and cannot fully meet the actual needs.
  • the program with high access speed is required to work or the data cannot be placed in the L1TCM
  • the usual method is to define the program or the corresponding data as a Cacheable attribute and store it in the Cache.
  • the disadvantage of this is that after the Cache has passed the delay of the query, if the hit, the access time is relatively short, and if there is no hit, the access time is still very long.
  • embodiments of the present invention are expected to provide a memory switching method, apparatus, and computer storage medium, which can effectively shorten the access time of the memory and improve the access performance.
  • the embodiment of the invention provides a memory switching method, including:
  • Determining the memory to be accessed by the received request when the memory to be accessed by the received request is Cache RAM, generating a request to access the Cache RAM; when receiving the request The type of memory to be accessed is TCM RAM, generating a request to access the TCM RAM;
  • the generated access request is sent to the corresponding RAM.
  • the configuring the Cache RAM as the TCM RAM includes:
  • the configuring the Cache RAM as the TCM RAM includes:
  • the Cache RAM that does not perform query and allocation establishes a one-to-one mapping of the TCM address space and the TCM RAM, and configures the Cache RAM as a TCM RAM.
  • the method further includes: transferring data in the Cache RAM to be configured as a TCM RAM to a memory.
  • the method further includes: restoring the TCM RAM to a Cache RAM, and transferring data in the TCM RAM to a memory.
  • the embodiment of the invention further provides a memory switching device, the device comprising: a configuration module and a control module, wherein
  • the configuration module is configured to configure the Cache RAM as a TCM RAM
  • the control module is configured to determine a memory to be accessed by the received request, and generate a request for accessing the Cache RAM when the memory to be accessed by the received request is a Cache RAM; and the memory type to be accessed when the received request is TCM
  • the RAM generates a request to access the TCM RAM; the generated access request is sent to the corresponding RAM.
  • the configuration module is configured to: configure a part of the Cache RAM as a TCM RAM; or configure the entire Cache RAM as a TCM RAM.
  • the configuration module is configured to:
  • the Cache RAM that does not perform query and allocation establishes a one-to-one mapping of the TCM address space and the TCM RAM, and configures the Cache RAM as a TCM RAM.
  • the configuration module is further configured to: transfer data in the Cache RAM to be configured as a TCM RAM to a memory.
  • the configuration module is further configured to: restore the TCM RAM to a Cache RAM, and transfer data in the TCM RAM to a memory.
  • the embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the memory switching method according to the embodiment of the invention.
  • the memory switching method and device and the computer storage medium provided by the embodiments of the present invention configure the Cache RAM as the TCM RAM; determine the memory to be accessed by the received request, and generate the memory to be accessed when the received request is the Cache RAM.
  • the existing Cache RAM can be dynamically used as the TCM, and the TCM and the Cache can be dynamically switched without increasing the RAM cost; the access to the Cache RAM and the TCM RAM can be simultaneously realized, and the data access speed is significantly improved. And guarantee data consistency.
  • FIG. 1 is a schematic flowchart of a memory switching method according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a memory switching method according to Embodiment 2 of the present invention.
  • FIG. 3 is a schematic structural diagram of a memory switching device according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of a control module according to an embodiment of the present invention.
  • the Cache RAM is first configured as a TCM RAM; then, the memory to be accessed by the received request is determined, and when the memory to be accessed by the received request is the Cache RAM, a request for accessing the Cache RAM is generated; when receiving The type of memory to be accessed by the request is TCM RAM, a request to access the TCM RAM is generated, and the generated access request is sent to the corresponding RAM.
  • FIG. 1 is a schematic flowchart of a memory switching method according to an embodiment of the present invention. As shown in FIG. 1 , the memory switching method in this embodiment includes the following steps:
  • Step 101 Configure the Cache RAM as TCM RAM.
  • the configuring the Cache RAM as the TCM RAM includes: configuring a part of the Cache RAM as the TCM RAM; or configuring all the Cache RAMs as the TCM RAM; in actual applications, selecting some or all of the Cache RAMs according to actual needs may be configured as TCM RAM, for example, when the system requires high speed of data reading and writing, and the amount of data involved is large, all Cache RAMs can be configured as TCM RAM; when the system requires data reading and writing speed is general, and involved When the amount of data is small, a part of the Cache RAM can be configured as TCM RAM, and the Cache RAM address range to be configured as TCM RAM is determined according to actual needs.
  • the method before the Cache RAM is configured as the TCM RAM, the method further includes: transferring the data in the Cache RAM to be configured as the TCM RAM to the memory.
  • Step 102 Determine the memory to be accessed by the received request, when the memory to be accessed by the received request is Cache RAM, perform step 103; when the received request is to be accessed
  • the memory type is TCM RAM, and step 104 is performed.
  • Step 103 Generate a request to access the Cache RAM.
  • Step 104 Generate a request to access the TCM RAM.
  • the request for accessing the TCM RAM can be directly generated; and accessing the Cache RAM requires first querying whether to hit. If the hit, a request to access the Cache RAM is generated to access the corresponding RAM; if there is no hit, it is necessary to access the next-level storage structure.
  • Step 105 Send the generated access request to the corresponding RAM.
  • the TCM RAM and the Cache RAM can be accessed at the same time, and the access control processes of the TCM RAM and the Cache RAM are independent of each other, thereby improving parallelism.
  • the TCM RAM and the Cache RAM may return data at the same time. Therefore, it is necessary to simultaneously process the data, complete the data read operation and/or write operation, and return the data and response.
  • the method further includes: restoring the TCM RAM to a Cache RAM, and transferring data in the TCM RAM to a memory.
  • the Cache RAM is configured as TCM RAM; when the system no longer needs TCM RAM, the TCM RAM can be restored to Cache RAM; When the RAM is configured as TCM RAM, the data in the Cache RAM can be flushed to the memory; when the TCM RAM is restored to the Cache RAM, the data in the TCM RAM can be transferred to the memory to maintain data consistency. .
  • An embodiment memory switching method includes the following steps:
  • Step 201 Close the Cache RAM.
  • Step 202 Flush the data of the TCM RAM to be configured as the TCM RAM into the memory.
  • Step 203 Configure the Cache RAM as a TCM RAM.
  • Step 204 Open the Cache RAM.
  • Step 205 Initialize the TCM RAM.
  • the TCM can be filled by the DMA to transfer data from the memory; other initialization methods can also be used, and are not limited to this range.
  • Step 206 Receive a request to access the TCM RAM and the Cache RAM, and access the corresponding TCM RAM and the Cache RAM according to the request.
  • an access request for accessing the TCM RAM and the Cache RAM is generated, and the corresponding TCM RAM and the Cache RAM are accessed.
  • Step 207 When the TCM is not needed, the data in the TCM is transferred to the memory.
  • Step 208 Restore the TCM RAM to a Cache RAM.
  • Step 209 Access the Cache RAM.
  • the existing Cache RAM is used dynamically as the TCM RAM, and no new RAM is needed, and the dynamic switching between the TCM RAM and the Cache RAM is realized without increasing the RAM cost, and the Cache RAM is simultaneously accessed.
  • Part and TCM RAM part Can significantly improve data access speed. Since the address of the TCM RAM portion is a part of the entire address space, the memory switching method according to the embodiment of the present invention can also ensure data consistency.
  • the embodiment of the present invention further provides a structure diagram of a memory switching device, the device Cache controller, and FIG. 3 is a schematic structural diagram of a memory switching device according to an embodiment of the present invention.
  • the device includes: a configuration module 31 and Control module 32, wherein
  • the configuration module 31 is configured to configure the Cache RAM as a TCM RAM
  • the control module 32 is configured to determine a memory to be accessed by the received request, and when the memory to be accessed by the received request is a Cache RAM, generate a request to access the Cache RAM; when the received request is to access the memory type is The TCM RAM generates a request to access the TCM RAM; the generated access request is sent to the corresponding RAM.
  • the configuration module is configured to: configure part of the Cache RAM as TCM RAM; or configure all Cache RAMs as TCM RAM.
  • some or all of the Cache RAM can be configured as TCM RAM according to actual needs. For example, when the system requires high data read/write speed and the amount of data involved is large, all Cache RAMs can be used. Configured as TCM RAM; when the system requires normal data read/write speed and the amount of data involved is small, a part of the Cache RAM can be configured as TCM RAM, and the Cache RAM address range to be configured as TCM RAM is determined according to actual needs.
  • the configuration module 31 changes the Cache RAM allocation algorithm by changing the lockdown by way configuration of the Cache RAM, and does not query and allocate the Cache RAM to be configured as the TCM RAM; and the query and allocation are not performed.
  • the Cache RAM establishes a one-to-one mapping of the TCM address space and the TCM RAM, and configures the Cache RAM as a TCM RAM.
  • the configuration module 31 before configuring the Cache RAM as the TCM RAM, the configuration module 31 is further configured to transfer data in the Cache RAM to be configured as the TCM RAM to the memory.
  • control module 32 includes: a request receiving submodule 321, a first request generating submodule 322, and a second request generating submodule 323, An arbitration sub-module 324, a second arbitration sub-module 325, and a response sub-module 326, wherein
  • the request receiving sub-module 321 is configured to receive the request and determine the memory to be accessed by the received request, and notify the first request generating sub-module 322 when the received memory to be accessed is the Cache RAM, when received When the type of memory to be accessed by the request is TCM RAM, the second request generating submodule 323 is notified;
  • the first request generation submodule 322 is configured to generate a request for accessing the Cache RAM when the memory to be accessed by the received request is a Cache RAM; and send the request for accessing the Cache RAM to the first arbitration submodule 324 ;
  • the second request generation submodule 323 is configured to generate a request for accessing the TCM RAM when the received memory type of the request is TCM RAM, and send the request for accessing the TCM RAM to the second arbitration submodule 325. ;
  • the request for accessing the TCM RAM can be directly generated; and accessing the Cache RAM requires first querying whether to hit. If the hit, a request to access the Cache RAM is generated to access the corresponding RAM; if there is no hit, it is necessary to access the next-level storage structure.
  • the first arbitration sub-module 324 is configured to perform arbitration processing on the received request for accessing the Cache RAM, and send the request after the arbitration processing to the Cache RAM;
  • the second arbitration sub-module 325 is configured to perform arbitration processing on the received request for accessing the TCM RAM, and send the request after the arbitration processing to the TCM RAM;
  • the response sub-module 326 is configured to process data returned by the TCM RAM and the Cache RAM, complete a read operation and/or a write operation of the data, and return data and a response;
  • the TCM RAM and the Cache RAM can be accessed at the same time, and the access control processes of the TCM RAM and the Cache RAM are independent of each other, thereby improving parallelism.
  • the TCM RAM and the Cache RAM may return data at the same time. Therefore, it is necessary to simultaneously process the data, complete the data read operation and/or write operation, and return the data and response.
  • the configuration module 31 is further configured to: restore the TCM RAM to a Cache RAM, and transfer data in the TCM RAM to a memory.
  • the configuration module 31 configures the Cache RAM as TCM RAM when the system requires TCM RAM according to actual needs; when the system no longer needs TCM RAM, the TCM RAM can be restored to Cache. RAM; when the Cache RAM is configured as TCM RAM, the data in the Cache RAM can be flushed to the memory; when the TCM RAM is restored to the Cache RAM, the data in the TCM RAM can be transferred to the memory, thereby Keep data consistent.
  • the implementation functions of the respective processing modules in the memory switching device shown in FIG. 3 can be understood by referring to the related description of the foregoing memory switching method. It should be understood by those skilled in the art that the functions of the processing modules in the memory switching device shown in FIG. 3 can be implemented by a program running on the processor, or can be implemented by a specific logic circuit, for example, by a central processing unit ( CPU), microprocessor (MPU), digital signal processor (DSP), or field programmable gate array (FPGA) implementation.
  • CPU central processing unit
  • MPU microprocessor
  • DSP digital signal processor
  • FPGA field programmable gate array
  • the disclosed method and apparatus may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division.
  • there may be another division manner for example, multiple modules or components may be combined, or Can be integrated into another system, Or some features can be ignored or not executed.
  • the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.
  • the modules described above as separate components may or may not be physically separated.
  • the components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module;
  • the module can be implemented in the form of hardware or in the form of hardware plus software function modules.
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and the like, which can store program codes.
  • ROM read-only memory
  • the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
  • the technical solution of the embodiment of the present invention can dynamically use the existing Cache RAM as a TCM, realize dynamic switching of the TCM and the Cache without increasing the RAM cost, and can simultaneously access the Cache RAM and the TCM RAM. Significantly increase data access speed and ensure data consistency.

Abstract

A memory switching method, apparatus and computer storage medium. The method comprises: configuring a Cache RAM to be a TCM RAM (101); determining a memory to be accessed by a received request (102); generating a request for accessing the Cache RAM when the memory to be accessed by the received request is the Cache RAM (103); generating a request for accessing the TCM RAM when the memory type to be accessed by the received request is the TCM RAM (104); and sending the generated access request to a corresponding RAM (105).

Description

一种存储器切换方法、装置及计算机存储介质Memory switching method, device and computer storage medium 技术领域Technical field
本发明涉及数据存储技术,尤其涉及一种实现高速缓冲存储器(Cache)和紧耦合存储器(TCM,Tightly Coupled Memory)动态切换的存储器切换方法、装置及计算机存储介质。The present invention relates to data storage technologies, and in particular, to a memory switching method, apparatus, and computer storage medium for implementing dynamic switching of a cache and a Tightly Coupled Memory (TCM).
背景技术Background technique
处理器架构中,存储系统是分层次的,离核心越近的存储器,规模越小,读写速度越快。现有的处理器系统中,除了L1Cache,L2Cache之外,大多数处理器系统还有L1TCM;L1TCM的速度很快,访问时间是确定的,但是通常规模较小,无法完全满足实际需求。当对访问速度要求较高的程序工作或者数据在L1TCM放不下时,通常的做法是将程序或对应的数据定义为可Cache的属性,存储到Cache中。但是,这样做的缺点是Cache经过查询的延时之后,如果命中则访问时间相对较短,如果没有命中则访问时间依然很长。In the processor architecture, the storage system is hierarchical, and the closer to the core, the smaller the size, the faster the read and write speed. In the existing processor system, in addition to L1Cache and L2Cache, most processor systems also have L1TCM; L1TCM is fast and the access time is determined, but usually it is small in size and cannot fully meet the actual needs. When the program with high access speed is required to work or the data cannot be placed in the L1TCM, the usual method is to define the program or the corresponding data as a Cacheable attribute and store it in the Cache. However, the disadvantage of this is that after the Cache has passed the delay of the query, if the hit, the access time is relatively short, and if there is no hit, the access time is still very long.
发明内容Summary of the invention
有鉴于此,本发明实施例期望提供一种存储器切换方法、装置及计算机存储介质,能够有效缩短存储器的访问时间,提高访问性能。In view of this, embodiments of the present invention are expected to provide a memory switching method, apparatus, and computer storage medium, which can effectively shorten the access time of the memory and improve the access performance.
为达到上述目的,本发明实施例的技术方案是这样实现的:To achieve the above objective, the technical solution of the embodiment of the present invention is implemented as follows:
本发明实施例提供了一种存储器切换方法,包括:The embodiment of the invention provides a memory switching method, including:
将Cache RAM配置为TCM RAM;Configure the Cache RAM as TCM RAM;
判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所 要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;Determining the memory to be accessed by the received request, when the memory to be accessed by the received request is Cache RAM, generating a request to access the Cache RAM; when receiving the request The type of memory to be accessed is TCM RAM, generating a request to access the TCM RAM;
将生成的访问请求发送到对应的RAM。The generated access request is sent to the corresponding RAM.
作为一种实施方式,所述将Cache RAM配置为TCM RAM包括:As an implementation manner, the configuring the Cache RAM as the TCM RAM includes:
将部分Cache RAM配置为TCM RAM;或者,Configure some of the Cache RAM as TCM RAM; or,
将全部Cache RAM配置为TCM RAM。Configure all Cache RAM as TCM RAM.
作为一种实施方式,所述将Cache RAM配置为TCM RAM包括:As an implementation manner, the configuring the Cache RAM as the TCM RAM includes:
改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM不进行查询和分配;Change the allocation algorithm of Cache RAM, and do not query and allocate the Cache RAM to be configured as TCM RAM;
将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCM RAM的一一映射,将所述Cache RAM配置为TCM RAM。The Cache RAM that does not perform query and allocation establishes a one-to-one mapping of the TCM address space and the TCM RAM, and configures the Cache RAM as a TCM RAM.
作为一种实施方式,所述方法还包括:将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。As an implementation manner, the method further includes: transferring data in the Cache RAM to be configured as a TCM RAM to a memory.
作为一种实施方式,所述方法还包括:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。As an embodiment, the method further includes: restoring the TCM RAM to a Cache RAM, and transferring data in the TCM RAM to a memory.
本发明实施例还提供了一种存储器切换装置,所述装置包括:配置模块和控制模块,其中,The embodiment of the invention further provides a memory switching device, the device comprising: a configuration module and a control module, wherein
所述配置模块,配置为将Cache RAM配置为TCM RAM;The configuration module is configured to configure the Cache RAM as a TCM RAM;
所述控制模块,配置为判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;将生成的访问请求发送到对应的RAM。The control module is configured to determine a memory to be accessed by the received request, and generate a request for accessing the Cache RAM when the memory to be accessed by the received request is a Cache RAM; and the memory type to be accessed when the received request is TCM The RAM generates a request to access the TCM RAM; the generated access request is sent to the corresponding RAM.
作为一种实施方式,所述配置模块配置为:将部分Cache RAM配置为TCM RAM;或者,将全部Cache RAM配置为TCM RAM。As an implementation manner, the configuration module is configured to: configure a part of the Cache RAM as a TCM RAM; or configure the entire Cache RAM as a TCM RAM.
作为一种实施方式,所述配置模块配置为:As an implementation manner, the configuration module is configured to:
改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM 不进行查询和分配;Change the Cache RAM allocation algorithm for the Cache RAM that will be configured as TCM RAM Do not query and assign;
将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCM RAM的一一映射,将所述Cache RAM配置为TCM RAM。The Cache RAM that does not perform query and allocation establishes a one-to-one mapping of the TCM address space and the TCM RAM, and configures the Cache RAM as a TCM RAM.
作为一种实施方式,所述配置模块还配置为:将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。As an implementation manner, the configuration module is further configured to: transfer data in the Cache RAM to be configured as a TCM RAM to a memory.
作为一种实施方式,所述配置模块还配置为:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。As an implementation manner, the configuration module is further configured to: restore the TCM RAM to a Cache RAM, and transfer data in the TCM RAM to a memory.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的存储器切换方法。The embodiment of the invention further provides a computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the memory switching method according to the embodiment of the invention.
本发明实施例所提供的存储器切换方法、装置及计算机存储介质,将Cache RAM配置为TCM RAM;判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求,然后将生成的访问请求发送到对应的RAM。如此,能够将已有的Cache RAM来动态的作为TCM使用,在不增加RAM成本的情况下,实现TCM和Cache的动态切换;能够同时实现对Cache RAM和TCM RAM的访问,显著提高数据访问速度,并且保证数据一致性。The memory switching method and device and the computer storage medium provided by the embodiments of the present invention configure the Cache RAM as the TCM RAM; determine the memory to be accessed by the received request, and generate the memory to be accessed when the received request is the Cache RAM. The request to access the Cache RAM; when the received request is to access the memory type TCM RAM, generate a request to access the TCM RAM, and then send the generated access request to the corresponding RAM. In this way, the existing Cache RAM can be dynamically used as the TCM, and the TCM and the Cache can be dynamically switched without increasing the RAM cost; the access to the Cache RAM and the TCM RAM can be simultaneously realized, and the data access speed is significantly improved. And guarantee data consistency.
附图说明DRAWINGS
图1为本发明实施例一存储器切换方法流程示意图;1 is a schematic flowchart of a memory switching method according to an embodiment of the present invention;
图2为本发明实施例二存储器切换方法流程示意图;2 is a schematic flowchart of a memory switching method according to Embodiment 2 of the present invention;
图3为本发明实施例存储器切换装置结构示意图;3 is a schematic structural diagram of a memory switching device according to an embodiment of the present invention;
图4为本发明实施例控制模块结构示意图。 FIG. 4 is a schematic structural diagram of a control module according to an embodiment of the present invention.
具体实施方式detailed description
本发明实施例中,先将Cache RAM配置为TCM RAM;再判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求,然后将生成的访问请求发送到对应的RAM。In the embodiment of the present invention, the Cache RAM is first configured as a TCM RAM; then, the memory to be accessed by the received request is determined, and when the memory to be accessed by the received request is the Cache RAM, a request for accessing the Cache RAM is generated; when receiving The type of memory to be accessed by the request is TCM RAM, a request to access the TCM RAM is generated, and the generated access request is sent to the corresponding RAM.
下面结合附图及具体实施例,对本发明技术方案的实施作进一步的详细描述。图1为本发明实施例一存储器切换方法流程示意图,如图1所示,本实施例存储器切换方法包括以下步骤:The implementation of the technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. FIG. 1 is a schematic flowchart of a memory switching method according to an embodiment of the present invention. As shown in FIG. 1 , the memory switching method in this embodiment includes the following steps:
步骤101:将Cache RAM配置为TCM RAM。Step 101: Configure the Cache RAM as TCM RAM.
所述将Cache RAM配置为TCM RAM包括:将部分Cache RAM配置为TCM RAM;或者,将全部Cache RAM配置为TCM RAM;在实际应用中,可以根据实际需求,选择将部分或全部Cache RAM配置为TCM RAM,例如,当系统对数据读写的速度要求较高,且涉及的数据量较大时,可以将全部Cache RAM配置为TCM RAM;当系统对数据读写的速度要求一般,且涉及的数据量较小时,可以将一部分Cache RAM配置为TCM RAM,并根据实际需求确定将要配置为TCM RAM的Cache RAM地址范围。The configuring the Cache RAM as the TCM RAM includes: configuring a part of the Cache RAM as the TCM RAM; or configuring all the Cache RAMs as the TCM RAM; in actual applications, selecting some or all of the Cache RAMs according to actual needs may be configured as TCM RAM, for example, when the system requires high speed of data reading and writing, and the amount of data involved is large, all Cache RAMs can be configured as TCM RAM; when the system requires data reading and writing speed is general, and involved When the amount of data is small, a part of the Cache RAM can be configured as TCM RAM, and the Cache RAM address range to be configured as TCM RAM is determined according to actual needs.
具体的,通过更改的Cache RAM的lockdown by way配置,改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM不进行查询和分配;将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCM RAM的一一映射,将所述Cache RAM配置为TCM RAM。Specifically, by changing the lockdown by way configuration of the Cache RAM, changing the allocation algorithm of the Cache RAM, not querying and allocating the Cache RAM to be configured as the TCM RAM; establishing the TCM address of the Cache RAM not being queried and allocated. A one-to-one mapping of space and TCM RAM, configuring the Cache RAM as TCM RAM.
本发明实施例中,在将Cache RAM配置为TCM RAM之前,所述方法还包括:将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。In the embodiment of the present invention, before the Cache RAM is configured as the TCM RAM, the method further includes: transferring the data in the Cache RAM to be configured as the TCM RAM to the memory.
步骤102:判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,执行步骤103;当接收到的请求所要访问 的存储器类型为TCM RAM,执行步骤104。Step 102: Determine the memory to be accessed by the received request, when the memory to be accessed by the received request is Cache RAM, perform step 103; when the received request is to be accessed The memory type is TCM RAM, and step 104 is performed.
步骤103:生成访问Cache RAM的请求。Step 103: Generate a request to access the Cache RAM.
步骤104:生成访问TCM RAM的请求。Step 104: Generate a request to access the TCM RAM.
本发明实施例中,由于TCM地址空间和TCM RAM是一一映射的,即访问TCM RAM相当于100%命中,因此,可以直接产生访问TCM RAM的请求;而访问Cache RAM则需要先查询是否命中,如果命中则生成访问Cache RAM的请求去访问对应的RAM;如果没有命中还需要去访问下一级存储结构。In the embodiment of the present invention, since the TCM address space and the TCM RAM are one-to-one mapping, that is, accessing the TCM RAM is equivalent to 100% hit, therefore, the request for accessing the TCM RAM can be directly generated; and accessing the Cache RAM requires first querying whether to hit. If the hit, a request to access the Cache RAM is generated to access the corresponding RAM; if there is no hit, it is necessary to access the next-level storage structure.
步骤105:将生成的访问请求发送到对应的RAM。Step 105: Send the generated access request to the corresponding RAM.
本发明实施例中,访问Cache RAM和访问TCM RAM的请求产生后,分别进行仲裁处理,得到仲裁后的请求,并发送到相应的RAM。本发明实施例中,TCM RAM和Cache RAM可以同时访问,对TCM RAM和Cache RAM的访问控制过程相互独立,从而提高了并行性。在同时访问TCM RAM和Cache RAM的情况下,TCM RAM和Cache RAM可能同时返回数据时,因此,需要同时对数据进行处理,完成数据的读操作和/或写操作,并返回数据和响应。In the embodiment of the present invention, after the request for accessing the Cache RAM and accessing the TCM RAM is generated, arbitration processing is performed separately, and the arbitrated request is obtained and sent to the corresponding RAM. In the embodiment of the present invention, the TCM RAM and the Cache RAM can be accessed at the same time, and the access control processes of the TCM RAM and the Cache RAM are independent of each other, thereby improving parallelism. In the case of simultaneous access to the TCM RAM and Cache RAM, the TCM RAM and the Cache RAM may return data at the same time. Therefore, it is necessary to simultaneously process the data, complete the data read operation and/or write operation, and return the data and response.
本发明实施例中,所述方法还包括:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。In the embodiment of the present invention, the method further includes: restoring the TCM RAM to a Cache RAM, and transferring data in the TCM RAM to a memory.
本发明实施例中,根据实际需求,当系统需要TCM RAM时,将Cache RAM时就配置为TCM RAM;当系统不再需要TCM RAM时,可以将所述TCM RAM恢复为Cache RAM;在将Cache RAM配置为TCM RAM时,可以将Cache RAM中的数据转移(flush)到内存;在将所述TCM RAM恢复为Cache RAM时,可以将TCM RAM中的数据转移到内存,从而保持数据的一致性。In the embodiment of the present invention, according to actual needs, when the system needs TCM RAM, the Cache RAM is configured as TCM RAM; when the system no longer needs TCM RAM, the TCM RAM can be restored to Cache RAM; When the RAM is configured as TCM RAM, the data in the Cache RAM can be flushed to the memory; when the TCM RAM is restored to the Cache RAM, the data in the TCM RAM can be transferred to the memory to maintain data consistency. .
图2为本发明实施例二存储器切换方法流程示意图,如图2所示,本 实施例存储器切换方法包括以下步骤:2 is a schematic flowchart of a memory switching method according to Embodiment 2 of the present invention, as shown in FIG. 2, An embodiment memory switching method includes the following steps:
步骤201:关闭Cache RAM。Step 201: Close the Cache RAM.
步骤202:将要配置为TCM RAM的TCM RAM的数据转移(flush)到内存。Step 202: Flush the data of the TCM RAM to be configured as the TCM RAM into the memory.
步骤203:将所述Cache RAM配置为TCM RAM。Step 203: Configure the Cache RAM as a TCM RAM.
本步骤中,可以根据实际需求,选择将全部Cache RAM或部分Cache RAM配置为TCM RAM。In this step, you can choose to configure all Cache RAM or part of Cache RAM as TCM RAM according to actual needs.
步骤204:打开Cache RAM。Step 204: Open the Cache RAM.
本步骤中,如果是初次开Cache,则还需要完成Cache的初始化。In this step, if the Cache is opened for the first time, the initialization of the Cache needs to be completed.
步骤205:初始化TCM RAM。Step 205: Initialize the TCM RAM.
本步骤中,可以通过DMA从内存搬运数据来填充TCM;也可以采用其他初始化方式,并不限于此范围。In this step, the TCM can be filled by the DMA to transfer data from the memory; other initialization methods can also be used, and are not limited to this range.
步骤206:接收访问TCM RAM和Cache RAM的请求,根据所述请求访问对应TCM RAM和Cache RAM。Step 206: Receive a request to access the TCM RAM and the Cache RAM, and access the corresponding TCM RAM and the Cache RAM according to the request.
具体的,根据接收到的请求,产生访问TCM RAM和Cache RAM的访问请求,访问对应TCM RAM和Cache RAM。Specifically, according to the received request, an access request for accessing the TCM RAM and the Cache RAM is generated, and the corresponding TCM RAM and the Cache RAM are accessed.
步骤207:当不需要使用TCM时,将TCM中的数据转移到内存。Step 207: When the TCM is not needed, the data in the TCM is transferred to the memory.
本步骤中,如果还需要保存TCM中的数据,可以通过DMA将TCM中的数据其移到内存。In this step, if you need to save the data in the TCM, you can move the data in the TCM to memory through DMA.
步骤208:将所述TCM RAM恢复为Cache RAM。Step 208: Restore the TCM RAM to a Cache RAM.
步骤209:访问Cache RAM。Step 209: Access the Cache RAM.
如果想重新将Cache RAM配置为TCM RAM,则跳转到步骤201。If you want to reconfigure the Cache RAM as TCM RAM, go to step 201.
本发明实施例,使用已有的Cache RAM来动态的作为TCM RAM使用,无需新增RAM,在不增加RAM成本的情况想,实现TCM RAM和Cache RAM之间的动态切换,并且同时访问Cache RAM部分和TCM RAM部分, 能够显著提高数据访问速度。由于TCM RAM部分的地址是整个地址空间的一部分,因此,本发明实施例所述存储器切换方法还能够保证数据的一致性。In the embodiment of the present invention, the existing Cache RAM is used dynamically as the TCM RAM, and no new RAM is needed, and the dynamic switching between the TCM RAM and the Cache RAM is realized without increasing the RAM cost, and the Cache RAM is simultaneously accessed. Part and TCM RAM part, Can significantly improve data access speed. Since the address of the TCM RAM portion is a part of the entire address space, the memory switching method according to the embodiment of the present invention can also ensure data consistency.
本发明实施例还提供了一种存储器切换装置结构示意图,所述装置Cache控制器,图3为本发明实施例存储器切换装置结构示意图,如图3所示,所述装置包括:配置模块31和控制模块32,其中,The embodiment of the present invention further provides a structure diagram of a memory switching device, the device Cache controller, and FIG. 3 is a schematic structural diagram of a memory switching device according to an embodiment of the present invention. As shown in FIG. 3, the device includes: a configuration module 31 and Control module 32, wherein
所述配置模块31,配置为将Cache RAM配置为TCM RAM;The configuration module 31 is configured to configure the Cache RAM as a TCM RAM;
所述控制模块32,配置为判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;将生成的访问请求发送到对应的RAM。The control module 32 is configured to determine a memory to be accessed by the received request, and when the memory to be accessed by the received request is a Cache RAM, generate a request to access the Cache RAM; when the received request is to access the memory type is The TCM RAM generates a request to access the TCM RAM; the generated access request is sent to the corresponding RAM.
本发明实施例中,所述配置模块配置为:将部分Cache RAM配置为TCM RAM;或者,将全部Cache RAM配置为TCM RAM。在实际应用中,可以根据实际需求,选择将部分或全部Cache RAM配置为TCM RAM,例如,当系统对数据读写的速度要求较高,且涉及的数据量较大时,可以将全部Cache RAM配置为TCM RAM;当系统对数据读写的速度要求一般,且涉及的数据量较小时,可以将一部分Cache RAM配置为TCM RAM,并根据实际需求确定将要配置为TCM RAM的Cache RAM地址范围。In the embodiment of the present invention, the configuration module is configured to: configure part of the Cache RAM as TCM RAM; or configure all Cache RAMs as TCM RAM. In practical applications, some or all of the Cache RAM can be configured as TCM RAM according to actual needs. For example, when the system requires high data read/write speed and the amount of data involved is large, all Cache RAMs can be used. Configured as TCM RAM; when the system requires normal data read/write speed and the amount of data involved is small, a part of the Cache RAM can be configured as TCM RAM, and the Cache RAM address range to be configured as TCM RAM is determined according to actual needs.
具体的,所述配置模块31通过更改的Cache RAM的lockdown by way配置,改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM不进行查询和分配;将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCM RAM的一一映射,将所述Cache RAM配置为TCM RAM。Specifically, the configuration module 31 changes the Cache RAM allocation algorithm by changing the lockdown by way configuration of the Cache RAM, and does not query and allocate the Cache RAM to be configured as the TCM RAM; and the query and allocation are not performed. The Cache RAM establishes a one-to-one mapping of the TCM address space and the TCM RAM, and configures the Cache RAM as a TCM RAM.
本发明实施例中,在将Cache RAM配置为TCM RAM之前,所述配置模块31还配置为将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。 In the embodiment of the present invention, before configuring the Cache RAM as the TCM RAM, the configuration module 31 is further configured to transfer data in the Cache RAM to be configured as the TCM RAM to the memory.
图4为本发明实施例所述控制模块结构示意图,如图4所示,所述控制模块32包括:请求接收子模块321、第一请求生成子模块322、第二请求生成子模块323、第一仲裁子模块324、第二仲裁子模块325和响应子模块326,其中,4 is a schematic structural diagram of a control module according to an embodiment of the present invention. As shown in FIG. 4, the control module 32 includes: a request receiving submodule 321, a first request generating submodule 322, and a second request generating submodule 323, An arbitration sub-module 324, a second arbitration sub-module 325, and a response sub-module 326, wherein
所述请求接收子模块321,配置为接收请求,并判断接收到的请求所要访问的存储器,当所接收到的请求所要访问的存储器为Cache RAM时,通知第一请求生成子模块322,当接收到的请求所要访问的存储器类型为TCM RAM时,通知第二请求生成子模块323;The request receiving sub-module 321 is configured to receive the request and determine the memory to be accessed by the received request, and notify the first request generating sub-module 322 when the received memory to be accessed is the Cache RAM, when received When the type of memory to be accessed by the request is TCM RAM, the second request generating submodule 323 is notified;
所述第一请求生成子模块322,配置为当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;并将所述访问Cache RAM的请求发送到第一仲裁子模块324;The first request generation submodule 322 is configured to generate a request for accessing the Cache RAM when the memory to be accessed by the received request is a Cache RAM; and send the request for accessing the Cache RAM to the first arbitration submodule 324 ;
所述第二请求生成子模块323,配置为当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;并将所述访问TCM RAM的请求发送到第二仲裁子模块325;The second request generation submodule 323 is configured to generate a request for accessing the TCM RAM when the received memory type of the request is TCM RAM, and send the request for accessing the TCM RAM to the second arbitration submodule 325. ;
本发明实施例中,由于TCM地址空间和TCM RAM是一一映射的,即访问TCM RAM相当于100%命中,因此,可以直接产生访问TCM RAM的请求;而访问Cache RAM则需要先查询是否命中,如果命中则生成访问Cache RAM的请求去访问对应的RAM;如果没有命中还需要去访问下一级存储结构。In the embodiment of the present invention, since the TCM address space and the TCM RAM are one-to-one mapping, that is, accessing the TCM RAM is equivalent to 100% hit, therefore, the request for accessing the TCM RAM can be directly generated; and accessing the Cache RAM requires first querying whether to hit. If the hit, a request to access the Cache RAM is generated to access the corresponding RAM; if there is no hit, it is necessary to access the next-level storage structure.
所述第一仲裁子模块324,配置为对接收到的访问Cache RAM的请求进行仲裁处理,并将进行仲裁处理后的请求发送到Cache RAM;The first arbitration sub-module 324 is configured to perform arbitration processing on the received request for accessing the Cache RAM, and send the request after the arbitration processing to the Cache RAM;
所述第二仲裁子模块325,配置为对接收到的访问TCM RAM的请求进行仲裁处理,并将进行仲裁处理后的请求发送到TCM RAM;The second arbitration sub-module 325 is configured to perform arbitration processing on the received request for accessing the TCM RAM, and send the request after the arbitration processing to the TCM RAM;
所述响应子模块326,配置为对TCM RAM和Cache RAM返回的数据进行处理,完成数据的读操作和/或写操作,并返回数据和响应; The response sub-module 326 is configured to process data returned by the TCM RAM and the Cache RAM, complete a read operation and/or a write operation of the data, and return data and a response;
本发明实施例中,访问Cache RAM和访问TCM RAM的请求产生后,分别进行仲裁处理,得到仲裁后的请求,并发送到相应的RAM。本发明实施例中,TCM RAM和Cache RAM可以同时访问,对TCM RAM和Cache RAM的访问控制过程相互独立,从而提高了并行性。在同时访问TCM RAM和Cache RAM的情况下,TCM RAM和Cache RAM可能同时返回数据时,因此,需要同时对数据进行处理,完成数据的读操作和/或写操作,并返回数据和响应。In the embodiment of the present invention, after the request for accessing the Cache RAM and accessing the TCM RAM is generated, arbitration processing is performed separately, and the arbitrated request is obtained and sent to the corresponding RAM. In the embodiment of the present invention, the TCM RAM and the Cache RAM can be accessed at the same time, and the access control processes of the TCM RAM and the Cache RAM are independent of each other, thereby improving parallelism. In the case of simultaneous access to the TCM RAM and Cache RAM, the TCM RAM and the Cache RAM may return data at the same time. Therefore, it is necessary to simultaneously process the data, complete the data read operation and/or write operation, and return the data and response.
所述配置模块31还配置为:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。The configuration module 31 is further configured to: restore the TCM RAM to a Cache RAM, and transfer data in the TCM RAM to a memory.
本发明实施例中,所述配置模块31根据实际需求,当系统需要TCM RAM时,将Cache RAM时就配置为TCM RAM;当系统不再需要TCM RAM时,可以将所述TCM RAM恢复为Cache RAM;在将Cache RAM配置为TCM RAM时,可以将Cache RAM中的数据转移(flush)到内存;在将所述TCM RAM恢复为Cache RAM时,可以将TCM RAM中的数据转移到内存,从而保持数据的一致性。In the embodiment of the present invention, the configuration module 31 configures the Cache RAM as TCM RAM when the system requires TCM RAM according to actual needs; when the system no longer needs TCM RAM, the TCM RAM can be restored to Cache. RAM; when the Cache RAM is configured as TCM RAM, the data in the Cache RAM can be flushed to the memory; when the TCM RAM is restored to the Cache RAM, the data in the TCM RAM can be transferred to the memory, thereby Keep data consistent.
图3和中所示的存储器切换装置中的各处理模块的实现功能,可参照前述存储器切换方法的相关描述而理解。本领域技术人员应当理解,图3所示的存储器切换装置中各处理模块的功能可通过运行于处理器上的程序而实现,也可通过具体的逻辑电路而实现,比如:可由中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)、或现场可编程门阵列(FPGA)实现。The implementation functions of the respective processing modules in the memory switching device shown in FIG. 3 and can be understood by referring to the related description of the foregoing memory switching method. It should be understood by those skilled in the art that the functions of the processing modules in the memory switching device shown in FIG. 3 can be implemented by a program running on the processor, or can be implemented by a specific logic circuit, for example, by a central processing unit ( CPU), microprocessor (MPU), digital signal processor (DSP), or field programmable gate array (FPGA) implementation.
在本发明所提供的几个实施例中,应该理解到,所揭露的方法及装置,可以通过其他的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个模块或组件可以结合,或可以集成到另一个系统, 或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的通信连接可以是通过一些接口,设备或模块的间接耦合或通信连接,可以是电性的、机械的或其他形式的。In the several embodiments provided by the present invention, it should be understood that the disclosed method and apparatus may be implemented in other manners. The device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be another division manner, for example, multiple modules or components may be combined, or Can be integrated into another system, Or some features can be ignored or not executed. In addition, the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.
上述作为分离部件说明的模块可以是、或也可以不是物理上分开的,作为模块显示的部件可以是、或也可以不是物理模块,即可以位于一个地方,也可以分布到多个网络模块上;可以根据实际的需要选择其中的部分或全部模块来实现本实施例方案的目的。The modules described above as separate components may or may not be physically separated. The components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各实施例中的各功能模块可以全部集成在一个处理模块中,也可以是各模块分别单独作为一个模块,也可以两个或两个以上模块集成在一个模块中;上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module; The module can be implemented in the form of hardware or in the form of hardware plus software function modules.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。It will be understood by those skilled in the art that all or part of the steps of implementing the foregoing method embodiments may be performed by hardware related to program instructions. The foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and the like, which can store program codes.
或者,本发明实施例上述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions. A computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention. The foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
本发明实施例中记载的存储器切换方法、装置只以上述实施例为例, 但不仅限于此,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。The memory switching method and apparatus described in the embodiments of the present invention are only exemplified by the above embodiments. However, it is not limited thereto, and those skilled in the art should understand that the technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or replacements are not The essence of the corresponding technical solutions is deviated from the scope of the technical solutions of the embodiments of the present invention.
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.
工业实用性Industrial applicability
本发明实施例的技术方案能够将已有的Cache RAM来动态的作为TCM使用,在不增加RAM成本的情况下,实现TCM和Cache的动态切换;能够同时实现对Cache RAM和TCM RAM的访问,显著提高数据访问速度,并且保证数据一致性。 The technical solution of the embodiment of the present invention can dynamically use the existing Cache RAM as a TCM, realize dynamic switching of the TCM and the Cache without increasing the RAM cost, and can simultaneously access the Cache RAM and the TCM RAM. Significantly increase data access speed and ensure data consistency.

Claims (11)

  1. 一种存储器切换方法,所述方法包括:A memory switching method, the method comprising:
    将高速缓冲存储器Cache RAM配置为紧耦合存储器TCM RAM;Configuring the cache Cache RAM as a tightly coupled memory TCM RAM;
    判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;Determining the memory to be accessed by the received request, when the memory to be accessed by the received request is Cache RAM, generating a request to access the Cache RAM; when the received request is to access the memory type TCM RAM, generating access to the TCM RAM request;
    将生成的访问请求发送到对应的RAM。The generated access request is sent to the corresponding RAM.
  2. 根据权利要求1所述方法,其中,所述将Cache RAM配置为TCMRAM包括:The method of claim 1 wherein said configuring the Cache RAM as a TCMRAM comprises:
    将部分Cache RAM配置为TCM RAM;或者,Configure some of the Cache RAM as TCM RAM; or,
    将全部Cache RAM配置为TCM RAM。Configure all Cache RAM as TCM RAM.
  3. 根据权利要求1或2所述方法,其中,所述将Cache RAM配置为TCM RAM包括:The method of claim 1 or 2, wherein the configuring the Cache RAM as the TCM RAM comprises:
    改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM不进行查询和分配;Change the allocation algorithm of Cache RAM, and do not query and allocate the Cache RAM to be configured as TCM RAM;
    将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCMRAM的一一映射,将所述Cache RAM配置为TCM RAM。The Cache RAM that does not perform query and allocation establishes a one-to-one mapping of the TCM address space and the TCMRAM, and configures the Cache RAM as a TCM RAM.
  4. 根据权利要求3所述方法,其中,所述方法还包括:将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。The method of claim 3 wherein the method further comprises transferring data in the Cache RAM to be configured as TCM RAM to memory.
  5. 根据权利要求1所述方法,其中,所述方法还包括:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。The method of claim 1 wherein the method further comprises restoring the TCM RAM to a Cache RAM and transferring data in the TCM RAM to memory.
  6. 一种存储器切换装置,所述装置包括:配置模块和控制模块,其中,A memory switching device, the device comprising: a configuration module and a control module, wherein
    所述配置模块,配置为将高速缓冲存储器Cache RAM配置为紧耦合存储器TCM RAM;The configuration module is configured to configure the cache cache RAM as a tightly coupled memory TCM RAM;
    所述控制模块,配置为判断接收到的请求所要访问的存储器,当接收 到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCMRAM的请求;将生成的访问请求发送到对应的RAM。The control module is configured to determine a memory to be accessed by the received request, when receiving When the memory to be accessed by the request is Cache RAM, a request for accessing the Cache RAM is generated; when the received memory type of the request is TCM RAM, a request for accessing the TCMRAM is generated; and the generated access request is sent to the corresponding RAM.
  7. 根据权利要求6所述装置,其中,所述配置模块配置为:将部分Cache RAM配置为TCM RAM;或者,将全部Cache RAM配置为TCMRAM。The apparatus of claim 6, wherein the configuration module is configured to: configure a portion of the Cache RAM as a TCM RAM; or configure the entire Cache RAM as a TCMRAM.
  8. 根据权利要求6或7所述装置,其中,所述配置模块配置为:The apparatus according to claim 6 or 7, wherein said configuration module is configured to:
    改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM不进行查询和分配;Change the allocation algorithm of Cache RAM, and do not query and allocate the Cache RAM to be configured as TCM RAM;
    将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCMRAM的一一映射,将所述Cache RAM配置为TCM RAM。The Cache RAM that does not perform query and allocation establishes a one-to-one mapping of the TCM address space and the TCMRAM, and configures the Cache RAM as a TCM RAM.
  9. 根据权利要求6所述装置,其中,所述配置模块还配置为:将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。The apparatus of claim 6 wherein said configuration module is further configured to: transfer data in said Cache RAM to be configured as TCM RAM to memory.
  10. 根据权利要求6所述装置,其中,所述配置模块还配置为:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。The apparatus of claim 6 wherein said configuration module is further configured to: restore said TCM RAM to Cache RAM and transfer data in said TCM RAM to memory.
  11. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1至5任一项所述的存储器切换方法。 A computer storage medium having stored therein computer executable instructions for performing the memory switching method of any one of claims 1 to 5.
PCT/CN2016/098115 2015-11-17 2016-09-05 Memory switching method, device, and computer storage medium WO2017084415A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510791122.1A CN106708747A (en) 2015-11-17 2015-11-17 Memory switching method and device
CN201510791122.1 2015-11-17

Publications (1)

Publication Number Publication Date
WO2017084415A1 true WO2017084415A1 (en) 2017-05-26

Family

ID=58717288

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/098115 WO2017084415A1 (en) 2015-11-17 2016-09-05 Memory switching method, device, and computer storage medium

Country Status (2)

Country Link
CN (1) CN106708747A (en)
WO (1) WO2017084415A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114758687B (en) * 2022-06-15 2022-09-02 南京低功耗芯片技术研究院有限公司 Self-adaptive Cache access circuit and implementation method thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1763727A (en) * 2004-10-22 2006-04-26 瑞昱半导体股份有限公司 Processor memory access method and access apparatus thereof
US20100217935A1 (en) * 2009-02-25 2010-08-26 Sung-Goo Cho System on chip and electronic system having the same
CN102073596A (en) * 2011-01-14 2011-05-25 东南大学 Method for managing reconfigurable on-chip unified memory aiming at instructions
CN102341794A (en) * 2009-03-03 2012-02-01 高通股份有限公司 Configurable cache and method to configure same
CN102567220A (en) * 2010-12-10 2012-07-11 中兴通讯股份有限公司 Cache access control method and Cache access control device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1251089C (en) * 2003-02-13 2006-04-12 上海交通大学 Digital signal processor with a repeatable switching buffer memory
CN1267824C (en) * 2003-02-13 2006-08-02 上海交通大学 Digital signal processor with a reconfigurable cache
CN201540564U (en) * 2009-12-21 2010-08-04 东南大学 Dynamic distribution circuit for distributing on-chip heterogenous storage resources by utilizing virtual memory mechanism
CN101763316B (en) * 2009-12-25 2011-06-29 东南大学 Method for dynamically distributing isomerism storage resources on instruction parcel based on virtual memory mechanism
CN102298567A (en) * 2010-06-28 2011-12-28 安凯(广州)微电子技术有限公司 Mobile processor architecture integrating central operation and graphic acceleration
CN103246542B (en) * 2012-02-01 2017-11-14 中兴通讯股份有限公司 Intelligent buffer and intelligent terminal
CN104636268B (en) * 2013-11-08 2019-07-26 上海芯豪微电子有限公司 The restructural caching product of one kind and method
US9588507B2 (en) * 2014-03-26 2017-03-07 Mediatek Inc. Low-power mechanism for wearable controller and associated control method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1763727A (en) * 2004-10-22 2006-04-26 瑞昱半导体股份有限公司 Processor memory access method and access apparatus thereof
US20100217935A1 (en) * 2009-02-25 2010-08-26 Sung-Goo Cho System on chip and electronic system having the same
CN102341794A (en) * 2009-03-03 2012-02-01 高通股份有限公司 Configurable cache and method to configure same
CN102567220A (en) * 2010-12-10 2012-07-11 中兴通讯股份有限公司 Cache access control method and Cache access control device
CN102073596A (en) * 2011-01-14 2011-05-25 东南大学 Method for managing reconfigurable on-chip unified memory aiming at instructions

Also Published As

Publication number Publication date
CN106708747A (en) 2017-05-24

Similar Documents

Publication Publication Date Title
WO2020247042A1 (en) Network interface for data transport in heterogeneous computing environments
TW201214105A (en) Scalable storage devices
CN110825320A (en) Virtualizing isolated regions of solid-state storage media
AU2015402888B2 (en) Computer device and method for reading/writing data by computer device
JP6674460B2 (en) System and method for improved latency in a non-uniform memory architecture
JP2017537404A (en) Memory access method, switch, and multiprocessor system
US11157191B2 (en) Intra-device notational data movement system
TWI505183B (en) Shared memory system
US20180004668A1 (en) Searchable hot content cache
US10318448B2 (en) Scalable, parameterizable, and script-generatable buffer manager architecture
JP6676052B2 (en) System and method for enabling improved latency in a non-uniform memory architecture
WO2017084415A1 (en) Memory switching method, device, and computer storage medium
WO2023186143A1 (en) Data processing method, host, and related device
US20160314073A1 (en) Technologies for scalable remotely accessible memory segments
US20210117114A1 (en) Memory system for flexibly allocating memory for multiple processors and operating method thereof
US10936219B2 (en) Controller-based inter-device notational data movement system
US20200348874A1 (en) Memory-fabric-based data-mover-enabled memory tiering system
US11281612B2 (en) Switch-based inter-device notational data movement system
US20240143498A1 (en) Methods, devices, and systems for allocating memory space
TW202340931A (en) Direct swap caching with noisy neighbor mitigation and dynamic address range assignment
CN117311591A (en) Method for accessing storage device and related product
KR20240035325A (en) Data storage device operation method, storage apparatus and host

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16865593

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16865593

Country of ref document: EP

Kind code of ref document: A1