[go: up one dir, main page]

CN106708747A - Memory switching method and device - Google Patents

Memory switching method and device Download PDF

Info

Publication number
CN106708747A
CN106708747A CN201510791122.1A CN201510791122A CN106708747A CN 106708747 A CN106708747 A CN 106708747A CN 201510791122 A CN201510791122 A CN 201510791122A CN 106708747 A CN106708747 A CN 106708747A
Authority
CN
China
Prior art keywords
ram
tcm
cache
memory
request
Prior art date
Legal status (The legal status 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 status listed.)
Withdrawn
Application number
CN201510791122.1A
Other languages
Chinese (zh)
Inventor
赵世凡
孙志文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sanechips Technology Co Ltd
Original Assignee
Shenzhen ZTE Microelectronics Technology Co Ltd
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 Shenzhen ZTE Microelectronics Technology Co Ltd filed Critical Shenzhen ZTE Microelectronics Technology Co Ltd
Priority to CN201510791122.1A priority Critical patent/CN106708747A/en
Priority to PCT/CN2016/098115 priority patent/WO2017084415A1/en
Publication of CN106708747A publication Critical patent/CN106708747A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

本发明提供了一种存储器切换方法,所述方法包括:将高速缓冲存储器Cache RAM配置为紧耦合存储器TCM RAM;判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;将生成的访问请求发送到对应的RAM。本发明还提供了一种存储器切换装置。

The invention provides a memory switching method, the method comprising: configuring the high-speed cache memory Cache RAM as a tightly coupled memory TCM RAM; judging the memory to be accessed by the received request, when the memory to be accessed by the received request is Cache When using RAM, generate a request to access Cache RAM; when the type of memory to be accessed by the received request is TCM RAM, generate a request to access TCM RAM; send the generated access request to the corresponding RAM. The invention also provides a memory switching device.

Description

一种存储器切换方法及装置A memory switching method and device

技术领域technical field

本发明涉及数据存储技术,尤其涉及一种实现高速缓冲存储器(Cache)和紧耦合存储器(TCM,Tightly Coupled Memory)动态切换的存储器切换方法及装置。The invention relates to data storage technology, in particular to a memory switching method and device for realizing dynamic switching between a cache memory (Cache) and a tightly coupled memory (TCM, Tightly Coupled Memory).

背景技术Background technique

处理器架构中,存储系统是分层次的,离核心越近的存储器,规模越小,读写速度越快。现有的处理器系统中,除了L1 Cache,L2 Cache之外,大多数处理器系统还有L1 TCM;L1 TCM的速度很快,访问时间是确定的,但是通常规模较小,无法完全满足实际需求。当对访问速度要求较高的程序工作或者数据在L1 TCM放不下时,通常的做法是将程序或对应的数据定义为可Cache的属性,存储到Cache中。但是,这样做的缺点是Cache经过查询的延时之后,如果命中则访问时间相对较短,如果没有命中则访问时间依然很长。In the processor architecture, the storage system is hierarchical. The closer the memory is to the core, the smaller the scale and the faster the read and write speed. In the existing processor system, in addition to L1 Cache and L2 Cache, most processor systems also have L1 TCM; L1 TCM is fast and the access time is deterministic, but it is usually small in scale and cannot fully meet the actual requirements. need. When a program that requires high access speed works or the data cannot fit in the L1 TCM, the usual practice 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 query delay, the access time is relatively short if there is a hit, and the access time is still very long if there is no hit.

发明内容Contents of the invention

有鉴于此,本发明实施例期望提供一种存储器切换方法及装置,能够有效缩短存储器的访问时间,提高访问性能。In view of this, the embodiments of the present invention expect to provide a memory switching method and device, which can effectively shorten memory access time and improve access performance.

为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, technical solution of the present invention is achieved in that way:

本发明实施例提供了一种存储器切换方法,包括:An embodiment of the present invention provides a memory switching method, including:

将Cache RAM配置为TCM RAM;Configure Cache RAM as TCM RAM;

判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;Determine the memory to be accessed by the received request, when the memory to be accessed by the received request is Cache RAM, generate a request to access Cache RAM; when the type of memory to be accessed by the received request is TCM RAM, generate a request to access TCM RAM ask;

将生成的访问请求发送到对应的RAM。Send the generated access request to the corresponding RAM.

上述方案中,所述将Cache RAM配置为TCM RAM包括:In the above solution, the configuration of Cache RAM as TCM RAM includes:

将部分Cache RAM配置为TCM RAM;或者,Configure part of Cache RAM as TCM RAM; or,

将全部Cache RAM配置为TCM RAM。Configure all Cache RAM as TCM RAM.

上述方案中,所述将Cache RAM配置为TCM RAM包括:In the above solution, the configuration of Cache RAM as 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 that will be configured as TCM RAM;

将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCM RAM的一一映射,将所述Cache RAM配置为TCM RAM。A one-to-one mapping between the TCM address space and the TCM RAM is established for the Cache RAM that does not perform query and allocation, and the Cache RAM is configured as a TCM RAM.

上述方案中,所述方法还包括:将所述将要配置为TCM RAM的Cache RAM中的数据转移到内存。In the above solution, the method further includes: transferring the data in the Cache RAM to be configured as TCM RAM to memory.

上述方案中,所述方法还包括:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。In the above solution, 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 present invention also provides a memory switching device, which includes: a configuration module and a control module, wherein,

所述配置模块,用于将Cache RAM配置为TCM RAM;The configuration module is configured to configure the Cache RAM as TCM RAM;

所述控制模块,用于判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;将生成的访问请求发送到对应的RAM。The control module is used to determine the memory to be accessed by the received request, and when the memory to be accessed by the received request is Cache RAM, generate a request for accessing Cache RAM; when the memory type to be accessed by the received request is TCM RAM, generating a request to access the TCM RAM; sending the generated access request to the corresponding RAM.

上述方案中,所述配置模块具体用于:将部分Cache RAM配置为TCMRAM;或者,将全部Cache RAM配置为TCM RAM。In the above solution, the configuration module is specifically configured to: configure part of the Cache RAM as TCM RAM; or configure all the Cache RAM as TCM RAM.

上述方案中,所述配置模块具体用于:In the above solution, the configuration module is specifically used for:

改变Cache RAM的分配算法,对将要配置为TCM RAM的Cache RAM不进行查询和分配;Change the allocation algorithm of Cache RAM, and do not query and allocate the Cache RAM that will be configured as TCM RAM;

将所述不进行查询和分配的Cache RAM建立TCM地址空间和TCM RAM的一一映射,将所述Cache RAM配置为TCM RAM。A one-to-one mapping between the TCM address space and the TCM RAM is established for the Cache RAM that does not perform query and allocation, and the Cache RAM is configured as a TCM RAM.

上述方案中,所述配置模块还用于:将所述将要配置为TCM RAM的CacheRAM中的数据转移到内存。In the above solution, the configuration module is further configured to: transfer the data in the CacheRAM to be configured as TCM RAM to memory.

上述方案中,所述配置模块还用于:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。In the above solution, the configuration module is further configured to: restore the TCM RAM to Cache RAM, and transfer the data in the TCM RAM to the memory.

本发明实施例所提供的存储器切换方法及装置,将Cache RAM配置为TCMRAM;判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为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 provided by the embodiments of the present invention configure the Cache RAM as TCMRAM; judge the memory to be accessed by the received request, and generate a request to access the Cache RAM when the memory to be accessed by the received request is Cache RAM ; When the memory type to be accessed by the received request is TCM RAM, generate a request for accessing 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 TCM, and the dynamic switching between TCM and Cache can be realized without increasing the cost of RAM; the access to Cache RAM and TCM RAM can be realized at the same time, and the data access speed is significantly improved , and ensure data consistency.

附图说明Description of drawings

图1为本发明实施例一存储器切换方法流程示意图;FIG. 1 is a schematic flow chart of a memory switching method according to Embodiment 1 of the present invention;

图2为本发明实施例二存储器切换方法流程示意图;FIG. 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的请求;当接收到的请求所要访问的存储器类型为TCMRAM,生成访问TCM RAM的请求,然后将生成的访问请求发送到对应的RAM。In the embodiment of the present invention, first Cache RAM is configured as TCM RAM; Then judge the memory that the request that receives needs to visit, when the memory that the request that receives needs to visit is Cache RAM, generate the request of accessing Cache RAM; When receiving The type of memory to be accessed by the request is TCMRAM, a request for accessing the TCM RAM is generated, and then the generated access request is sent to the corresponding RAM.

下面结合附图及具体实施例,对本发明技术方案的实施作进一步的详细描述。图1为本发明实施例一存储器切换方法流程示意图,如图1所示,本实施例存储器切换方法包括以下步骤:The implementation of the technical solutions of the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. FIG. 1 is a schematic flow chart of a memory switching method according to Embodiment 1 of the present invention. As shown in FIG. 1 , the memory switching method of this embodiment includes the following steps:

步骤101:将Cache RAM配置为TCM RAM;Step 101: Cache RAM is configured as TCM RAM;

所述将Cache RAM配置为TCM RAM包括:将部分Cache RAM配置为TCM RAM;或者,将全部Cache RAM配置为TCM RAM;在实际应用中,可以根据实际需求,选择将部分或全部Cache RAM配置为TCM RAM,例如,当系统对数据读写的速度要求较高,且涉及的数据量较大时,可以将全部CacheRAM配置为TCM RAM;当系统对数据读写的速度要求一般,且涉及的数据量较小时,可以将一部分Cache RAM配置为TCM RAM,并根据实际需求确定将要配置为TCM RAM的Cache RAM地址范围。The described configuration of Cache RAM as TCM RAM includes: configuring part of Cache RAM as TCM RAM; or, configuring all of Cache RAM as TCM RAM; in practical applications, you can choose to configure part or all of Cache RAM as TCM RAM, for example, when the system requires high data read and write speed and involves a large amount of data, all CacheRAM can be configured as TCM RAM; when the system requires general data read and write speed, and the data involved When the amount is small, a part of Cache RAM can be configured as TCM RAM, and the address range of Cache RAM to be configured as TCM RAM can be 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, change the allocation algorithm of Cache RAM by changing the lockdown by way configuration of Cache RAM, and do not query and allocate the Cache RAM that will be configured as TCM RAM; establish the TCM address for the Cache RAM that will not be queried and allocated One-to-one mapping between 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 configuring 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.

步骤102:判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,执行步骤103;当接收到的请求所要访问的存储器类型为TCM RAM,执行步骤104;Step 102: judging 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 type of memory to be accessed by the received request is TCM RAM, perform step 104;

步骤103:生成访问Cache RAM的请求;Step 103: generate a request for accessing the Cache RAM;

步骤104:生成访问TCM RAM的请求;Step 104: Generate a request for accessing 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 mapped one by one, that is, accessing the TCM RAM is equivalent to a 100% hit, therefore, a request for accessing the TCM RAM can be directly generated; while accessing the Cache RAM, it is necessary to first inquire whether it is a hit , if hit, a request to access 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 the request for accessing the TCM RAM are generated, arbitration processing is performed respectively, 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 for the TCM RAM and the Cache RAM are independent of each other, thereby improving parallelism. In the case of accessing TCM RAM and Cache RAM at the same time, TCM RAM and Cache RAM may return data at the same time. Therefore, the data needs to be processed at the same time, the data read operation and/or write operation are completed, and the data and response are returned.

本发明实施例中,所述方法还包括:将所述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 the TCM RAM, the Cache RAM is configured as the TCM RAM; when the system no longer needs the TCM RAM, the TCM RAM can be recovered as the Cache RAM; When the RAM is configured as a TCM RAM, the data in the Cache RAM can be transferred (flush) 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 maintaining data consistency .

图2为本发明实施例二存储器切换方法流程示意图,如图2所示,本实施例存储器切换方法包括以下步骤:FIG. 2 is a schematic flow chart of a memory switching method in Embodiment 2 of the present invention. As shown in FIG. 2 , the memory switching method in this embodiment includes the following steps:

步骤201:关闭Cache RAM;Step 201: close Cache RAM;

步骤202:将要配置为TCM RAM的TCM RAM的数据转移(flush)到内存;Step 202: transfer (flush) the data of the TCM RAM to be configured as the TCM RAM to the memory;

步骤203:将所述Cache RAM配置为TCM RAM;Step 203: configure the Cache RAM as TCM RAM;

本步骤中,可以根据实际需求,选择将全部Cache RAM或部分Cache RAM配置为TCM RAM;In this step, you can choose to configure all or part of the Cache RAM as TCM RAM according to actual needs;

步骤204:打开Cache RAM;Step 204: open Cache RAM;

本步骤中,如果是初次开Cache,则还需要完成Cache的初始化;In this step, if it is the first time to open the Cache, you also need to complete the initialization of the Cache;

步骤205:初始化TCM RAM;Step 205: Initialize TCM RAM;

本步骤中,可以通过DMA从内存搬运数据来填充TCM;也可以采用其他初始化方式,并不限于此范围。In this step, the TCM can be filled by transferring data from the memory through DMA; 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 for accessing the TCM RAM and Cache RAM, and access the corresponding TCM RAM and Cache RAM according to the request;

具体的,根据接收到的请求,产生访问TCM RAM和Cache RAM的访问请求,访问对应TCM RAM和Cache RAM。Specifically, an access request for accessing the TCM RAM and the Cache RAM is generated according to the received request, and the corresponding TCM RAM and Cache RAM are accessed.

步骤207:当不需要使用TCM时,将TCM中的数据转移到内存;Step 207: When the TCM is not needed, transfer the data in the TCM to the memory;

本步骤中,如果还需要保存TCM中的数据,可以通过DMA将TCM中的数据其移到内存。In this step, if the data in the TCM needs to be saved, the data in the TCM can be moved to the memory through DMA.

步骤208:将所述TCM RAM恢复为Cache RAM。Step 208: Restore the TCM RAM to 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, then jump 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 as the TCM RAM dynamically, without adding new RAM, and without increasing the cost of the RAM, the dynamic switching between the TCM RAM and the Cache RAM can be realized, and the Cache RAM can be accessed at the same time part and TCM RAM part, can significantly improve data access speed. Since the address of the TCM RAM part is part of the entire address space, the memory switching method in the embodiment of the present invention can also ensure data consistency.

本发明实施例还提供了一种存储器切换装置结构示意图,所述装置Cache控制器,图3为本发明实施例存储器切换装置结构示意图,如图3所示,所述装置包括:配置模块31、控制模块32,其中,The embodiment of the present invention also provides a schematic structural diagram of a memory switching device, the device Cache controller, 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: control module 32, wherein,

所述配置模块31,用于将Cache RAM配置为TCM RAM;The configuration module 31 is configured to configure the Cache RAM as TCM RAM;

本发明实施例中,所述配置模块具体用于:将部分Cache RAM配置为TCMRAM;或者,将全部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 specifically configured to: configure part of the Cache RAM as TCM RAM; or configure all the Cache RAM as TCM RAM. In practical applications, you can choose to configure part or all of the Cache RAM as TCM RAM according to actual needs. For example, when the system requires high data read and write speed and the amount of data involved is large, all Configure as TCM RAM; when the system requires general data read and write speed and the amount of data involved is small, you can configure a part of Cache RAM as TCM RAM, and determine the address range of Cache RAM to be configured as TCM RAM 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 allocation algorithm of the Cache RAM through the configuration of the lockdown by way of the changed Cache RAM, and does not inquire and allocate the Cache RAM to be configured as TCM RAM; The Cache RAM establishes a one-to-one mapping between 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 the Cache RAM is configured as TCM RAM, the configuration module 31 is further configured to transfer the data in the Cache RAM to be configured as TCM RAM to the internal memory.

所述控制模块32,用于判断接收到的请求所要访问的存储器,当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;当接收到的请求所要访问的存储器类型为TCM RAM,生成访问TCM RAM的请求;将生成的访问请求发送到对应的RAM。Described control module 32 is used for judging the memory that the request that receives will visit, when the memory that the request that receives will visit is Cache RAM, generate the request of accessing Cache RAM; When the memory that the request that receives needs to visit is The TCM RAM generates a request for accessing the TCM RAM; and sends the generated access request to the corresponding RAM.

图4为本发明实施例所述控制模块结构示意图,如图4所示,所述控制模块32包括请求接收子模块321、第一请求生成子模块322、第二请求生成子模块323、第一仲裁子模块324、第二仲裁子模块325、响应子模块326,其中,Fig. 4 is a structural diagram of the control module according to the 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, a second request generating submodule 323, a first The arbitration submodule 324, the second arbitration submodule 325, and the response submodule 326, wherein,

所述请求接收子模块321,用于接收请求,并判断接收到的请求所要访问的存储器,当所接收到的请求所要访问的存储器为Cache RAM时,通知第一请求生成子模块322,当接收到的请求所要访问的存储器类型为TCM RAM时,通知第二请求生成子模块323;The request receiving submodule 321 is used to receive a request, and judge the memory to be accessed by the received request, and when the memory to be accessed by the received request is Cache RAM, notify the first request generation submodule 322, when receiving When the memory type to be accessed by the request is TCM RAM, notify the second request generating submodule 323;

所述第一请求生成子模块322,用于当接收到的请求所要访问的存储器为Cache RAM时,生成访问Cache RAM的请求;并将所述访问Cache RAM的请求发送到第一仲裁子模块324;The first request generating 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 generating submodule 323 is configured to generate a request for accessing TCM RAM when the memory type to be accessed by the received request is TCM RAM; and send the request for accessing 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 mapped one by one, that is, accessing the TCM RAM is equivalent to a 100% hit, therefore, a request for accessing the TCM RAM can be directly generated; while accessing the Cache RAM, it is necessary to first inquire whether it is a hit , if hit, a request to access 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 submodule 324 is configured to arbitrate the received request for accessing the Cache RAM, and send the arbitrated request to the Cache RAM;

所述第二仲裁子模块325,用于对接收到的访问TCM RAM的请求进行仲裁处理,并将进行仲裁处理后的请求发送到TCM RAM;The second arbitration submodule 325 is configured to arbitrate the received request for accessing the TCM RAM, and send the arbitrated request to the TCM RAM;

响应子模块326,用于对TCM RAM和Cache RAM返回的数据进行处理,完成数据的读操作和/或写操作,并返回数据和响应;The response sub-module 326 is used to process the data returned by the TCM RAM and the Cache RAM, complete the data read operation and/or write operation, 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 the request for accessing the TCM RAM are generated, arbitration processing is performed respectively, 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 for the TCM RAM and the Cache RAM are independent of each other, thereby improving parallelism. In the case of accessing TCM RAM and Cache RAM at the same time, TCM RAM and Cache RAM may return data at the same time. Therefore, the data needs to be processed at the same time, the data read operation and/or write operation are completed, and the data and response are returned.

所述配置模块31还用于:将所述TCM RAM恢复为Cache RAM,并将所述TCM RAM中的数据转移到内存。The configuration module 31 is further configured to: restore the TCM RAM to Cache RAM, and transfer the data in the TCM RAM to the 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 Cache RAM as TCM RAM according to actual needs when the system needs TCM RAM; when the system no longer needs TCM RAM, the TCM RAM can be restored as Cache RAM; when the Cache RAM is configured as the TCM RAM, the data in the Cache RAM can be transferred (flush) to the internal memory; when the TCM RAM is recovered as the Cache RAM, the data in the TCM RAM can be transferred to the internal memory, thereby Maintain data consistency.

图3和中所示的存储器切换装置中的各处理模块的实现功能,可参照前述存储器切换方法的相关描述而理解。本领域技术人员应当理解,图3所示的存储器切换装置中各处理模块的功能可通过运行于处理器上的程序而实现,也可通过具体的逻辑电路而实现,比如:可由中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)、或现场可编程门阵列(FPGA)实现。The implementation functions of each processing module in the memory switching device shown in FIGS. Those skilled in the art should understand that the functions of each processing module in the memory switching device shown in FIG. 3 can be realized by a program running on a processor, or by a specific logic circuit. 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 methods and devices can be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or May be integrated into another system, or some features may be ignored, or not implemented. In addition, the communication connection among the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or modules may be in electrical, mechanical or other forms.

上述作为分离部件说明的模块可以是、或也可以不是物理上分开的,作为模块显示的部件可以是、或也可以不是物理模块,即可以位于一个地方,也可以分布到多个网络模块上;可以根据实际的需要选择其中的部分或全部模块来实现本实施例方案的目的。The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place or distributed to multiple network modules; Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本发明各实施例中的各功能模块可以全部集成在一个处理模块中,也可以是各模块分别单独作为一个模块,也可以两个或两个以上模块集成在一个模块中;上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention can be integrated into one processing module, or each module can be used as a module separately, or two or more modules can be integrated into one module; the above-mentioned integration The modules can be implemented in the form of hardware, or in the form of hardware plus software function modules.

本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps to realize the above method embodiments can be completed by hardware related to program instructions, and the aforementioned programs can be stored in computer-readable storage media. When the program is executed, the execution includes The steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: various media capable of storing program codes such as a removable storage device, a read-only memory (ROM, Read-Only Memory), a magnetic disk or an optical disk.

或者,本发明实施例上述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated modules in the embodiments of the present invention are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for Make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the methods described in various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program codes such as removable storage devices, ROMs, magnetic disks or optical disks.

本发明实施例中记载的存储器切换方法、装置只以上述实施例为例,但不仅限于此,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。The memory switching method and device described in the embodiments of the present invention only take the above embodiments as examples, but are not limited thereto. Those of ordinary skill in the art should understand that the technical solutions described in the foregoing embodiments can still be modified. Or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (10)

1. A memory switching method, the method comprising:
configuring a Cache RAM (random access memory) into a tightly coupled memory TCM RAM;
judging a memory to be accessed by the received request, and generating a request for accessing the Cache RAM when the memory to be accessed by the received request is the Cache RAM; when the type of a memory to be accessed by the received request is TCM RAM, generating a request for accessing the TCM RAM;
and sending the generated access request to the corresponding RAM.
2. The method of claim 1, wherein the configuring the Cache RAM as a TCMRAM comprises:
configuring part of Cache RAM into TCM RAM; or,
and configuring all Cache RAMs as TCM RAMs.
3. The method according to claim 1 or 2, wherein the configuring the Cache RAM as TCM RAM comprises:
changing the allocation algorithm of the Cache RAM, and not inquiring and allocating the Cache RAM to be configured into the TCM RAM;
and establishing one-to-one mapping between the TCM address space and the TCM RAM by using the Cache RAM which is not queried and distributed, and configuring the Cache RAM into the TCM RAM.
4. The method of claim 3, further comprising: and transferring the data in the Cache RAM to be configured into the TCM RAM to the memory.
5. The method of claim 1, further comprising: and recovering the TCMRAM into a Cache RAM, and transferring data in the TCM RAM to a memory.
6. A memory switching apparatus, the apparatus comprising: a configuration module and a control module, wherein,
the configuration module is used for configuring the Cache RAM into a tightly coupled memory TCM RAM;
the control module is used for judging a memory to be accessed by the received request, and generating a request for accessing the Cache RAM when the memory to be accessed by the received request is the Cache RAM; when the type of a memory to be accessed by the received request is TCM RAM, generating a request for accessing the TCM RAM; and sending the generated access request to the corresponding RAM.
7. The apparatus of claim 6, wherein the configuration module is specifically configured to: configuring part of Cache RAM into TCM RAM; alternatively, all Cache RAM is configured as TCM RAM.
8. The apparatus according to claim 6 or 7, wherein the configuration module is specifically configured to:
changing the allocation algorithm of the Cache RAM, and not inquiring and allocating the Cache RAM to be configured into the TCM RAM;
and establishing one-to-one mapping between the TCM address space and the TCM RAM by using the Cache RAM which is not queried and distributed, and configuring the Cache RAM into the TCM RAM.
9. The apparatus of claim 1, wherein the configuration module is further configured to: and transferring the data in the Cache RAM to be configured into the TCM RAM to the memory.
10. The apparatus of claim 6, wherein the configuration module is further configured to: and restoring the TCM RAM into a Cache RAM, and transferring data in the TCM RAM to a memory.
CN201510791122.1A 2015-11-17 2015-11-17 Memory switching method and device Withdrawn CN106708747A (en)

Priority Applications (2)

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

Applications Claiming Priority (1)

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

Publications (1)

Publication Number Publication Date
CN106708747A true CN106708747A (en) 2017-05-24

Family

ID=58717288

Family Applications (1)

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

Country Status (2)

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

Cited By (1)

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

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1521631A (en) * 2003-02-13 2004-08-18 上海汉芯半导体科技有限公司 Digital Signal Processor with Reswitchable Buffer
CN1521632A (en) * 2003-02-13 2004-08-18 上海汉芯半导体科技有限公司 Digital Signal Processor with Reconfigurable Cache
CN101763316A (en) * 2009-12-25 2010-06-30 东南大学 Method for dynamically distributing isomerism storage resources on instruction parcel based on virtual memory mechanism
CN201540564U (en) * 2009-12-21 2010-08-04 东南大学 A circuit for dynamically allocating on-chip heterogeneous storage resources using the virtual memory mechanism
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
CN102298567A (en) * 2010-06-28 2011-12-28 安凯(广州)微电子技术有限公司 Mobile processor architecture integrating central operation and graphic acceleration
CN103246542A (en) * 2012-02-01 2013-08-14 中兴通讯股份有限公司 Intelligent cache and intelligent terminal
CN104636268A (en) * 2013-11-08 2015-05-20 上海芯豪微电子有限公司 Reconfigurable caching organization structure
CN104951043A (en) * 2014-03-26 2015-09-30 联发科技股份有限公司 Wearable controller and operation method thereof

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1763727A (en) * 2004-10-22 2006-04-26 瑞昱半导体股份有限公司 Internal memory access method and device of processor
US8266409B2 (en) * 2009-03-03 2012-09-11 Qualcomm Incorporated Configurable cache and method to configure same
CN102567220A (en) * 2010-12-10 2012-07-11 中兴通讯股份有限公司 Cache access control method and Cache access control device

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1521631A (en) * 2003-02-13 2004-08-18 上海汉芯半导体科技有限公司 Digital Signal Processor with Reswitchable Buffer
CN1521632A (en) * 2003-02-13 2004-08-18 上海汉芯半导体科技有限公司 Digital Signal Processor with Reconfigurable Cache
US20100217935A1 (en) * 2009-02-25 2010-08-26 Sung-Goo Cho System on chip and electronic system having the same
CN201540564U (en) * 2009-12-21 2010-08-04 东南大学 A circuit for dynamically allocating on-chip heterogeneous storage resources using the virtual memory mechanism
CN101763316A (en) * 2009-12-25 2010-06-30 东南大学 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
CN102073596A (en) * 2011-01-14 2011-05-25 东南大学 Method for managing reconfigurable on-chip unified memory aiming at instructions
CN103246542A (en) * 2012-02-01 2013-08-14 中兴通讯股份有限公司 Intelligent cache and intelligent terminal
CN104636268A (en) * 2013-11-08 2015-05-20 上海芯豪微电子有限公司 Reconfigurable caching organization structure
CN104951043A (en) * 2014-03-26 2015-09-30 联发科技股份有限公司 Wearable controller and operation method thereof

Cited By (2)

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

Also Published As

Publication number Publication date
WO2017084415A1 (en) 2017-05-26

Similar Documents

Publication Publication Date Title
US12335142B2 (en) Network interface for data transport in heterogeneous computing environments
CN103902486B (en) System, device and method for implementation of remote direct memory access
EP3706394A1 (en) Writes to multiple memory destinations
US20220206969A1 (en) Data forwarding chip and server
US9459798B2 (en) Data processing system and data processing method
US9304896B2 (en) Remote memory ring buffers in a cluster of data processing nodes
CN107250995B (en) Memory management device
CN105518631B (en) EMS memory management process, device and system and network-on-chip
CA2987807C (en) Computer device and method for reading/writing data by computer device
CN104850502A (en) Method, apparatus and device for accessing data
TWI505183B (en) Shared memory system
JP2017537404A (en) Memory access method, switch, and multiprocessor system
CN107861888B (en) DDR method, system and device for FPGA card and readable storage medium
US11157191B2 (en) Intra-device notational data movement system
CN102393838B (en) Data processing method and device, PCI-E (peripheral component interface-express) bus system, and server
CN105264608B (en) Method, Memory Controller Hub and the central processing unit of data storage
JP6676052B2 (en) System and method for enabling improved latency in a non-uniform memory architecture
CN105988871B (en) Remote memory allocation method, device and system
CN106708747A (en) Memory switching method and device
KR102780719B1 (en) Flash-based storage device and copy-back operation method thereof
US20210056062A1 (en) Switch-based inter-device notational data movement system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20170524