WO2015021822A1 - 扩大mcu程序地址空间的方法及装置 - Google Patents

扩大mcu程序地址空间的方法及装置 Download PDF

Info

Publication number
WO2015021822A1
WO2015021822A1 PCT/CN2014/080536 CN2014080536W WO2015021822A1 WO 2015021822 A1 WO2015021822 A1 WO 2015021822A1 CN 2014080536 W CN2014080536 W CN 2014080536W WO 2015021822 A1 WO2015021822 A1 WO 2015021822A1
Authority
WO
WIPO (PCT)
Prior art keywords
mcu
address
pram
program address
program
Prior art date
Application number
PCT/CN2014/080536
Other languages
English (en)
French (fr)
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 WO2015021822A1 publication Critical patent/WO2015021822A1/zh

Links

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/0223User address space allocation, e.g. contiguous or non contiguous base addressing

Definitions

  • the present invention belongs to the field of communications, and in particular, to a method and apparatus for expanding an address space of an MCU program. Background technique
  • the MCU Micro Control Unit
  • the internal program memory of the chip is small, usually consisting of 4K bytes of PROM and 4K bytes of PRAM, a total of 8K bytes.
  • the program address space of 8K bytes can meet the needs of use, but in a few cases, there will still be cases where the actual demand cannot be met, and the size of the PRAM is increased for a small number of applications, considering the chip area and cost. Not economical. Summary of the invention
  • the purpose of the embodiments of the present invention is to provide a method and an apparatus for expanding an address space of an MCU program, which is to solve the problem that an existing MCU program address space is small and cannot meet the demand.
  • the embodiment of the present invention is implemented as an apparatus for expanding an address space of an MCU program, where the apparatus includes a cache controller and MCUs, PRAMs, and EERPOMs respectively connected to the cache controllers;
  • the cache controller is configured to perform, during program execution, when the program address that the MCU needs to access is not in the PRAM, and the program address is Cacheable, according to the preset EEPROM address and the PRAM address
  • the mapping relationship moves the program address required by the MCU from the EEPROM to the PRAM, so that the MCU reads the program address to be accessed from the PRAM.
  • the cache controller includes a TAG memory, a hit arbiter, a DMA request trigger, and a TAG An update module, the TAG memory, the hit arbitrator, and the DMA request trigger are sequentially connected, and the TAG update module is respectively connected to the TAG memory and the DMA request trigger;
  • the TAG memory is configured to store a mapping relationship between the EEPROM address and the PRAM address;
  • the hit arbitrator is configured to determine whether a program address that the MCU needs to access is in the PRAM; and when a program address that the MCU needs to access is not in the PRAM, and the program address is Cacheable, Calculating first DMA request information according to a mapping relationship between the EEPROM address and the PRAM address, and sending the DMA request trigger to the DMA request trigger;
  • the DMA request trigger is set to transfer a program address that the MCU needs to access from the EEPROM to the PRAM according to the first DMA request information;
  • the TAG update module is configured to update a mapping relationship between the EEPROM address and the PRAM address in the TAG memory after the DMA request trigger ends, and return the hit arbitrator to continue to determine that the MCU needs next time The accessed program address is in the PRAM until the program is executed.
  • the cache controller further includes an internal register, and the hit arbitrator is further configured to calculate a second DMA request when a program address that the MCU needs to access is not in the PRAM and an internal register, and the program address is Noncacheable And sending the information to the DMA request trigger; the DMA request trigger is further configured to: transfer, from the EEPROM, a program address that the MCU needs to access to the internal register according to the second DMA request information, In order for the MCU to read from the internal register the address of the program that needs to be accessed.
  • the cache controller communicates with the EEPROM via an I2C interface.
  • the invention also proposes a method for expanding an address space of an MCU program, which is set as the above device for expanding an address space of an MCU program; the method comprises the steps of:
  • the buffer controller maps the preset EEPROM address to the PRAM address according to the preset Relationship, the program address required by the MCU is from the The EEPROM is moved into the PRAM so that the MCU reads the program address to be accessed from the PRAM.
  • the buffer controller moves the program address required by the MCU from the EEPROM to the PRAM according to the mapping relationship between the EEPROM address and the PRAM address, including:
  • the buffer controller calculates first DMA request information according to a mapping relationship between the EEPROM address and the PRAM address.
  • the program address that the MCU needs to access from the EEPROM is transferred to the PRAM;
  • the method further includes:
  • the program address that the MCU needs to access is in the PRAM
  • the program address that the MCU needs to access is directly read from the PRAM and fed back to the MCU.
  • the method further includes:
  • the buffer controller transfers the program address that the MCU needs to access from the EEPROM to a preset internal register, such that the MCU reads the program address to be accessed from the internal register.
  • the buffer controller transfers the program address that the MCU needs to access from the EEPROM to a preset internal register, including:
  • C2 Transfer, from the EEPROM, a program address that the MCU needs to access to the internal register according to the second DMA request information.
  • the buffer controller transfers the program address that the MCU needs to access from the EEPROM to a preset
  • the internal registers also include:
  • the PRAM becomes CACHE through the address mapping relationship between the PRAM and the external EEPROM, and the EERPOM is expanded into a program address space.
  • the address space where the program is located can be set to Noncacheable.
  • the part of the program is to be executed, the part of the program is directly returned from the external EEPROM.
  • the MCU in this way, can make the program mapped to the corresponding address space in the PRAM not replaced, thereby improving efficiency.
  • the CACHE function of the embodiment of the present invention satisfies the demand for a larger program space.
  • FIG. 1 is a structural diagram of an apparatus for expanding an address space of an MCU program according to Embodiment 1 of the present invention
  • FIG. 2 is a structural diagram of a cache controller in an apparatus for expanding an address space of an MCU according to Embodiment 1 of the present invention
  • FIG. 3 is a schematic diagram showing an address mapping relationship between an EEPROM and a PRAM in an apparatus for expanding an address space of an MCU according to Embodiment 1 of the present invention
  • FIG. 4 is a flowchart of a method for expanding an address space of an MCU program according to Embodiment 2 of the present invention
  • FIG. 5 is a flowchart of step S4 in a method for expanding an address space of an MCU according to Embodiment 2 of the present invention
  • FIG. 6 is a flowchart of step S5 in the method for expanding the address space of the MCU program according to the second embodiment of the present invention. detailed description
  • Embodiment 1 of the present invention provides an apparatus for expanding an address space of an MCU program.
  • the apparatus includes a cache controller 10 and an MCU 30, a PRAM 20, and an EEPROM 40 respectively connected to the cache controller 10, and the cache controller 10 can communicate with the EEPROM 40 through an I2C interface or an FPI interface.
  • the cache controller 10 includes a TAG memory 13, a hit arbitrator 11, a DMA request trigger 12, a TAG update module 14, a TAG update module 14, and a TAG memory 13 connected in series.
  • the cache controller also includes an internal register 15 coupled to the hit arbitrator 11.
  • FIG. 3 is an example of an address mapping relationship between the EEPROM 40 and the PRAM 20 in the first embodiment of the present invention.
  • This example uses 32K for EEPROM40 (only 28K can be used), and 4K for PRAM20.
  • the space of EEPROM40 and PRAM20 is divided into Cache Line (each Cache Line size is 32*16bits).
  • EEPROM40 448 Cache Lines, PRAM20 total 64 Cache Lines.
  • the size of EEPROM40, PRAM20 and Cache Line can be set as needed.
  • Noncacheable settings can be achieved by setting the Noncacheable start Cache Line and Noncacheable End Cache Line ⁇ After the configuration, all Cache Lines between the Noncacheable start Cache Line and the Noncacheable End Cache Line cannot be moved to the PRAM 20, but only when the MCU 30 accesses the corresponding long word address, the corresponding long word is transferred from the external EEPROM 40 through the DMA. The internal register 15 is returned to the MCU 30.
  • the address space where the program is located can be set to Noncacheable.
  • the part of the program is directly returned from the external EEPROM 40 to the long word. MCU30, instead of moving it to the corresponding Cache Line of PRAM20, this can be mapped to the same Cache Line in PRAM20. The program is not replaced, which improves efficiency.
  • the hit arbiter 11 determines whether the program space address to be accessed by the current MCU 30 is Cacheable or Noncacheable.
  • the first DMA request information is calculated and sent to the DMA request trigger 12, and after the DMA request ends and the TAG update module 14 updates the address mapping relationship between the EEPROM 40 and the PRAM 20 in the TAG memory 13, the clock of the MCU is released.
  • the first DMA request information includes the source address, destination address, and request length of the DMA (in the example of Figure 3, the Cache Line is the request unit, so the length is 32 long words).
  • the second DMA request information is sent to the DMA request trigger 12, and after the DMA request ends and the TAG update module 14 updates the TAG memory 13, the clock of the MCU 30 is released.
  • the second DMA request information includes the source address, destination address, and request length of the DMA (in the example of Figure 3, the Cache Line is the request unit, so the length is 32 long words).
  • the external EERPOM is used to expand the addressing space of the program.
  • the program address space of the MCU30 is extended from 8K (the MCU30's original PRAM20 4K, PROM4K) to 32 ⁇ (the EEPROAM40 28K, PROM 4K), which greatly expands the program address space of the MCU30.
  • a second embodiment of the present invention provides a method for expanding an address space of an MCU program, which is applied to the apparatus of the first embodiment of the present invention. As shown in FIG. 4, the method in the second embodiment of the present invention includes the following steps:
  • Step S1 During the execution of the program, it is determined that the program address that the MCU needs to access is not in the PRAM, and then proceeds to step S2, otherwise proceeds to step S3.
  • Step S2 When the program address that the MCU needs to access is in the PRAM, the program address that the MCU needs to access is directly read from the PRAM, and is fed back to the MCU.
  • Step S3 Determine whether the program address that the MCU needs to access is Cacheable, if yes, go to step S4, otherwise go to step S5.
  • Step S4 The buffer controller moves the program address required by the MCU from the EEPROM to the PRAM according to the mapping relationship between the EEPROM address and the PRAM address, and the MCU reads the program address required by the MCU from the PRAM.
  • step S4 may include:
  • Step S41 The buffer controller calculates the first DMA request information according to the mapping relationship between the EEPROM address and the PRAM address.
  • the buffer controller stops the clock of the MCU through Clock Gating in the current clock cycle, keeps the program storing the data on the bus returned to the MCU, and then initiates the first DMA request, and simultaneously calculates the source address and destination of the first DMA request information. Address, request length.
  • Step S42 according to the first DMA request information, the program address that the MCU needs to access is sent from the EEPROM to the PRAM;
  • Step S43 updating the mapping relationship between the EEPROM address and the PRAM address, and returning to step A1 until the execution of the program is completed.
  • the program address that the MCU needs to access has been moved to the PRAM, and the mapping relationship between the EEPROM address and the PRAM address is updated.
  • the program address required by the MCU is taken out from the PRAM, and the clock of the MCU is released. The MCU is able to continue to operate correctly.
  • Step S5 The buffer controller transfers the program address that the MCU needs to access from the EEPROM to a preset internal register, and the MCU reads the program address required by the MCU from the internal register.
  • step S5 may include:
  • Step S51 determining whether the program address required by the MCU is in an internal register
  • Step S52 when the program address that the MCU needs to access is not in the internal register, the second DMA request information is calculated; the buffer controller stops the clock of the MCU through Clock Gating in the current clock cycle, and keeps the program storage back to the bus of the MCU. Data, then initiate a DMA request, simultaneously The source address, the destination address, and the request length of the second DMA request information are calculated.
  • Step S53 Transfer the program address that the MCU needs to access from the EEPROM to the internal register according to the second DMA request information. After the DMA request ends, the program address that the MCU needs to access has been stored in the internal register. The buffer controller returns the data to the MCU, and then releases the clock of the MCU, so that the MCU can continue to operate correctly.
  • Step S54 When the program address that the MCU needs to access is in the internal register, the program address that the MCU needs to access is directly read from the internal register and fed back to the MCU without any control on the MCU. This allows the program mapped to the same Cache Line in PRAM 20 to be replaced, thereby improving efficiency.
  • the PRAM becomes CACHE through the address mapping relationship between the PRAM and the external EEPROM, and the EERPOM is expanded into a program address space.
  • the address space where the program is located can be set to Noncacheable.
  • the part of the program is to be executed, the part of the program is directly returned from the external EEPROM.
  • the MCU in this way, can make the program mapped to the corresponding address space in the PRAM not replaced, thereby improving efficiency.
  • the CACHE function of the embodiment of the present invention satisfies the demand for a larger program space.

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

一种扩大MCU程序地址空间的方法及装置,适用于通信领域,所述装置包括一缓存控制器以及分别与所述缓存控制器连接的MCU、PRAM和EERPOM;其中,所述缓存控制器,用于程序执行过程中,当所述MCU需要访问的程序地址不在所述PRAM中,且所述程序地址为Cacheable时,根据预设的所述EEPROM地址与所述PRAM地址的映射关系将所述MCU需要的程序地址从所述EEPROM搬至所述PRAM中,以便所述MCU从所述PRAM中读取需要访问的程序地址。该方法及装置可扩大MCU程序地址空间。

Description

说 明 书 扩大 MCU程序地址空间的方法及装置 技术领域
本发明属于通信领域, 尤其涉及一种扩大 MCU程序地址空间的方法及装 置。 背景技术
通常 MCU ( Micro Control Unit, 微控制单元)本身并没 CACHE功能。 芯 片内部的程序存储器容量较小,通常由 4K bytes的 PROM与 4K bytes的 PRAM 组成, 共 8K bytes。 在绝大多数应用中, 8K bytes的程序地址空间可以满足使 用需求, 但是在少数情况下, 仍会出现无法满足实际需求的情况, 而为了少数 应用增大 PRAM的大小, 从芯片面积和成本考虑并不经济。 发明内容
本发明实施例的目的在于提供一种扩大 MCU程序地址空间的方法及装置, 旨在解决现有的 MCU程序地址空间较小无法满足需求的问题。
本发明实施例是这样实现的, 一种扩大 MCU程序地址空间的装置, 所述装 置包括一緩存控制器以及分别与所述緩存控制器连接的 MCU、 PRAM和 EERPOM; 其中,
所述緩存控制器, 设置为程序执行过程中, 当所述 MCU需要访问的程序 地址不在所述 PRAM 中, 且所述程序地址为 Cacheable 时, 根据预设的所述 EEPROM地址与所述 PRAM地址的映射关系将所述 MCU需要的程序地址从所 述 EEPROM搬至所述 PRAM中, 以便所述 MCU从所述 PRAM中读取需要访 问的程序地址。
所述緩存控制器包括 TAG存储器、 命中仲裁器、 DMA请求触发器、 TAG 更新模块, 所述 TAG存储器、 命中仲裁器、 DMA请求触发器依次连接, 所述 TAG更新模块分别连接所述 TAG存储器和 DMA请求触发器; 其中,
所述 TAG存储器,设置为存储所述 EEPROM地址与所述 PRAM地址的映 射关系;
所述命中仲裁器, 设置为判断所述 MCU需要访问的程序地址是否在所述 PRAM中; 以及当所述 MCU需要访问的程序地址不在所述 PRAM中, 且该程 序地址为 Cacheable时,才艮据所述 EEPROM地址与所述 PRAM地址的映射关系 计算第一 DMA请求信息, 并发送至所述 DMA请求触发器;
所述 DMA 请求触发器, 设置为根据所述第一 DMA 请求信息从所述 EEPROM中将所述 MCU需要访问的程序地址搬运至所述 PRAM;
所述 TAG更新模块,设置为在 DMA请求触发器结束搬运后更新所述 TAG 存储器中所述 EEPROM地址与所述 PRAM地址的映射关系, 并返回所述命中 仲裁器继续判断所述 MCU下一次需要访问的程序地址是否在所述 PRAM中直 到程序执行完毕。
所述緩存控制器还包括一内部寄存器, 所述命中仲裁器还设置为当所述 MCU需要访问的程序地址不在所述 PRAM和内部寄存器中, 且该程序地址为 Noncacheable时, 计算第二 DMA请求信息, 并发送至所述 DMA请求触发器; 所述 DMA请求触发器还设置为根据所述第二 DMA请求信息从所述 EEPROM 中将所述 MCU需要访问的程序地址搬运至所述内部寄存器,以便所述 MCU从 所述内部寄存器中读取需要访问的程序地址。
所述緩存控制器通过 I2C接口与所述 EEPROM通信。
本发明还提出一种扩大 MCU程序地址空间的方法,设置为上述扩大 MCU 程序地址空间的装置; 所述方法包括步骤:
程序执行过程中, 当所述 MCU需要访问的程序地址不在所述 PRAM中, 且所述程序地址为 Cacheable时, 所述緩冲控制器根据预设的所述 EEPROM地 址与所述 PRAM 地址的映射关系, 将所述 MCU 需要的程序地址从所述 EEPROM搬至所述 PRAM中, 以便所述 MCU从所述 PRAM中读取需要访问 的程序地址。
所述緩冲控制器根据 EEPROM地址与 PRAM地址的映射关系, 将 MCU 需要的程序地址从 EEPROM搬至 PRAM中包括:
A1、 所述緩冲控制器根据所述 EEPROM地址与所述 PRAM地址的映射关 系计算第一 DMA请求信息;
Bl、根据所述第一 DMA请求信息从所述 EEPROM中将所述 MCU需要访 问的程序地址搬运至所述 PRAM;
A1直到程序执行完毕。
所述方法还包括:
当所述 MCU需要访问的程序地址在所述 PRAM中, 直接从所述 PRAM中读 取所述 MCU需要访问的程序地址, 并反馈至所述 MCU。
所述方法还包括:
当所述 MCU需要访问的程序地址不在所述 PRAM中,且所述 MCU需要访问 的程序地址为 Noncacheable时, 所述緩冲控制器从所述 EEPROM中将所述 MCU 需要访问的程序地址搬运至一预设的内部寄存器, 以便所述 MCU从所述内部寄 存器中读取需要访问的程序地址。
所述緩冲控制器从 EEPROM中将 MCU需要访问的程序地址搬运至一预设 的内部寄存器包括:
A2、 判断所述 MCU需要的程序地址是否在所述内部寄存器中;
B2、 当所述 MCU需要访问的程序地址不在所述内部寄存器中, 计算第二
DMA请求信息;
C2、 根据所述第二 DMA请求信息从所述 EEPROM中将所述 MCU需要访问 的程序地址搬运至所述内部寄存器。
所述緩冲控制器从 EEPROM中将 MCU需要访问的程序地址搬运至一预设 的内部寄存器还包括:
D2、 当所述 MCU需要访问的程序地址在所述内部寄存器中, 直接从所述内 部寄存器中读取所述 MCU需要访问的程序地址, 并反馈至所述 MCU。
在本发明实施例中, 通过 PRAM 与外部 EEPROM 的地址映射关系, 使 PRAM 成为 CACHE , EERPOM 扩展成为程序地址空间。 另外一方面, 当 EERPOM中的某段程序被执行的几率很低时,可将该段程序所在的地址空间设 置为 Noncacheable, 当要执行该部分程序时, 将这部分程序从外部 EEPROM 直接返回给 MCU,如此可以使映射到 PRAM中对应地址空间的程序不被替换, 从而提高效率。 本发明实施例的 CACHE功能满足了对更大程序空间的需求。 附图说明
图 1是本发明实施例一提供的扩大 MCU程序地址空间的装置的结构图; 图 2是本发明实施例一提供的扩大 MCU程序地址空间的装置中緩存控制 器的结构图;
图 3是本发明实施例一提供的扩大 MCU程序地址空间的装置中 EEPROM 和 PRAM之间的地址映射关系示意图;
图 4是本发明实施例二提供的扩大 MCU程序地址空间的方法的流程图; 图 5是本发明实施例二提供的扩大 MCU程序地址空间的方法中步骤 S4的 流程图;
图 6是本发明实施例二提供的扩大 MCU程序地址空间的方法中步骤 S5的 流程图。 具体实施方式
为了使本发明的目的、 技术方案及优点更加清楚明白, 以下结合附图及实 施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体实施例仅 仅用以解释本发明, 并不用于限定本发明。 实施例一
本发明实施例一提出一种扩大 MCU程序地址空间的装置。 如图 1所示, 该装置包括緩存控制器 10以及分别与緩存控制器 10连接的 MCU30、 PRAM20 和 EEPROM40, 上述緩存控制器 10可通过 I2C接口或 FPI接口与 EEPROM40 通信。
如图 2所示, 緩存控制器 10包括依次连接的 TAG存储器 13、 命中仲裁器 11、 DMA请求触发器 12、 TAG更新模块 14, TAG更新模块 14和 TAG存储 器 13连接。 緩存控制器还包括一与命中仲裁器 11连接的内部寄存器 15。
本发明实施例一中, 预先配置 EEPROM40和 PRAM20之间的地址映射关 系并保存于 TAG存储器 13中, 图 3所示为本发明实施例一中 EEPROM40和 PRAM20之间的地址映射关系一示例。 该示例以 EEPROM40为 32K (其中仅 有 28K可以使用), PRAM20为 4K为例, 以 Cache Line为单位对 EEPROM40 和 PRAM20 的空间进行划分(每一 Cache Line 大小为 32*16bits ) , 如此, EEPROM40共 448个 Cache Line, PRAM20共 64个 Cache Line。 其实应用中, 并不以图 3所示之示例为限, EEPROM40、 PRAM20及 Cache Line的大小可根 据需要进行设置。
对某些 EEPROM40中的 Cache Line, 可以将其设置为 Cacheable (地址空 间可搬运 )或 Noncacheable (地址空间不可搬运 ) , Noncacheable的设置通过 酉己置 Noncacheable start Cache Line 与 Noncacheable End Cache Line 々方式来 实现的,配置之后,从 Noncacheable start Cache Line 与 Noncacheable End Cache Line之间的所有 Cache Line无法搬到 PRAM20中, 而只能 MCU30访问相应长 字地址时, 从外部 EEPROM40中通过 DMA搬对应的长字到内部寄存器 15, 再返回给 MCU30。 当 EERPOM40中的某段程序被执行的几率很低时, 可以将 该段程序所在的地址空间设置为 Noncacheable, 当要执行该部分程序时, 将这 部分程序逐个长字的从外部 EEPROM40直接返回给 MCU30, 而不将其先搬到 PRAM20的相应 Cache Line中, 这样可使映射到 PRAM20中同样 Cache Line 的程序不被替换, 从而提高效率。
在 MCU30执行程序过程中, 命中仲裁器 11判断当前 MCU30要访问的程 序空间地址是 Cacheable还是 Noncacheable。
若当前 MCU30要访问的程序空间地址是 Cacheable, 读取 TAG存储器 13 中相应的数据判断命中与否, 命中, 则直接从 PRAM20返回数据给 MCU30; 没有命中, 则立刻通过 Clocking Gating停掉 MCU30的时钟,计算出第一 DMA 请求信息送给 DMA请求触发器 12, 在 DMA请求结束并且 TAG更新模块 14 更新 TAG存储器 13中的 EEPROM40和 PRAM20之间的地址映射关系之后, 再释放 MCU的时钟。 第一 DMA请求信息包括 DMA的源地址、 目的地址以及 请求长度(图 3示例中以 Cache Line为请求单位, 因此长度为 32个长字) 。
若当前 MCU30要访问的程序空间地址是 Noncacheable, 判断上一次是否 取出过该程序空间地址的数据, 是, 则直接由内部寄存器 15返回给 MCU30; 否则立刻通过 Clocking Gating停掉 MCU30的时钟, 计算出第二 DMA请求信 息送给 DMA请求触发器 12,在 DMA请求结束并且 TAG更新模块 14更新 TAG 存储器 13之后, 再释放 MCU30的时钟。 第二 DMA请求信息包括 DMA的源 地址、 目的地址以及请求长度(图 3示例中以 Cache Line为请求单位, 因此长 度为 32个长字) 。
本发明实施例一在 MCU30 内部的程序存储器大小不变的情况下, 利用外 部的 EERPOM, 扩大程序的寻址空间。 以图 3所示为例, MCU30的程序地址 空间由 8K (其中, MCU30原有的 PRAM20 4K, PROM4K )扩展到 32Κ (其 中, EEPROAM40 28K, PROM 4K ) , 大大扩展了 MCU30的程序地址空间。
实施例二
本发明实施例二提出一种扩大 MCU程序地址空间的方法, 应用于本发明 实施例一的装置。 如图 4所示, 本发明实施例二的方法包括如下步骤:
步骤 S 1、 程序执行过程中, 判断 MCU需要访问的程序地址在不在 PRAM 中, 在则进入步骤 S2, 否则进入步骤 S3。 步骤 S2、 当 MCU需要访问的程序地址在 PRAM中, 直接从 PRAM中读 取 MCU需要访问的程序地址, 并反馈至 MCU。
步骤 S3、判断 MCU需要访问的程序地址是否为 Cacheable,是则进入步骤 S4, 否则进入步骤 S5。
步骤 S4、 緩冲控制器根据 EEPROM地址与 PRAM地址的映射关系, 将 MCU需要的程序地址从 EEPROM搬至 PRAM中, MCU再从 PRAM中读取 MCU需要的程序地址。
如图 5所示, 步骤 S4可包括:
步骤 S41、 緩冲控制器根据 EEPROM地址与 PRAM地址的映射关系计算 第一 DMA请求信息。 緩冲控制器在当前时钟周期通过 Clock Gating停掉 MCU 的时钟, 保持住程序存储返回给 MCU 的总线上的数据, 然后发起第一 DMA 请求, 同时计算出第一 DMA请求信息的源地址、 目的地址、 请求长度。
步骤 S42、 根据第一 DMA请求信息从 EEPROM中将 MCU需要访问的程 序地址般运至 PRAM;
步骤 S43、 更新 EEPROM地址与 PRAM地址的映射关系, 并返回步骤 A1 直到程序执行完毕。 等到 DMA请求结束后, MCU需要访问的程序地址已被搬 到了 PRAM中, 对 EEPROM地址与 PRAM地址的映射关系进行更新, 接着, 从 PRAM中取出 MCU所需要的程序地址, 释放 MCU的时钟, 从而 MCU得 以正确的继续运行。
步骤 S5、 緩冲控制器从 EEPROM中将 MCU需要访问的程序地址搬运至 一预设的内部寄存器, MCU再从内部寄存器中读取 MCU需要的程序地址。
如图 6所示, 步骤 S5可包括:
步骤 S51、 判断 MCU需要的程序地址是否在内部寄存器中;
步骤 S52、当 MCU需要访问的程序地址不在内部寄存器中,计算第二 DMA 请求信息; 緩冲控制器在当前时钟周期通过 Clock Gating停掉 MCU的时钟, 保持住程序存储返回给 MCU的总线上的数据, 然后发起 DMA请求, 同时计 算出第二 DMA请求信息的源地址、 目的地址、 请求长度。
步骤 S53、 根据第二 DMA请求信息从 EEPROM中将 MCU需要访问的程 序地址搬运至内部寄存器。 等到 DMA请求结束后, MCU需要访问的程序地址 已经被存放在内部寄存器中,緩冲控制器将该数据返回给 MCU,然后释放 MCU 的时钟, 从而 MCU得以正确的继续运行。
步骤 S54、 当 MCU需要访问的程序地址在内部寄存器中, 直接从内部寄 存器中读取 MCU需要访问的程序地址, 并反馈至 MCU, 而不对 MCU进行任 何控制。 这样可使映射到 PRAM20中同样 Cache Line的程序不被替换,从而提 高效率。
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本发 明的精神和原则之内所作的任何修改、 等同替换和改进等, 均应包含在本发明 的保护范围之内。 工业实用性
在本发明实施例中, 通过 PRAM 与外部 EEPROM 的地址映射关系, 使 PRAM 成为 CACHE , EERPOM 扩展成为程序地址空间。 另外一方面, 当 EERPOM中的某段程序被执行的几率很低时,可将该段程序所在的地址空间设 置为 Noncacheable, 当要执行该部分程序时, 将这部分程序从外部 EEPROM 直接返回给 MCU,如此可以使映射到 PRAM中对应地址空间的程序不被替换, 从而提高效率。 本发明实施例的 CACHE功能满足了对更大程序空间的需求。

Claims

权 利 要 求 书
1、 一种扩大 MCU程序地址空间的装置, 包括一緩存控制器以及分别与所 述緩存控制器连接的 MCU、 PRAM和 EERPOM; 其中,
所述緩存控制器, 设置为程序执行过程中, 当所述 MCU需要访问的程序 地址不在所述 PRAM 中, 且所述程序地址为 Cacheable 时, 根据预设的所述 EEPROM地址与所述 PRAM地址的映射关系将所述 MCU需要的程序地址从所 述 EEPROM搬至所述 PRAM中, 以便所述 MCU从所述 PRAM中读取需要访 问的程序地址。
2、 如权利要求 1所述的装置, 其中, 所述緩存控制器包括 TAG存储器、 命中仲裁器、 DMA请求触发器、 TAG更新模块, 所述 TAG存储器、 命中仲裁 器、 DMA请求触发器依次连接, 所述 TAG更新模块分别连接所述 TAG存储 器和 DMA请求触发器; 其中,
所述 TAG存储器,设置为存储所述 EEPROM地址与所述 PRAM地址的映 射关系;
所述命中仲裁器, 设置为判断所述 MCU需要访问的程序地址是否在所述 PRAM中; 以及当所述 MCU需要访问的程序地址不在所述 PRAM中, 且该程 序地址为 Cacheable时,才艮据所述 EEPROM地址与所述 PRAM地址的映射关系 计算第一 DMA请求信息, 并发送至所述 DMA请求触发器;
所述 DMA 请求触发器, 设置为根据所述第一 DMA 请求信息从所述 EEPROM中将所述 MCU需要访问的程序地址搬运至所述 PRAM;
所述 TAG更新模块,设置为在 DMA请求触发器结束搬运后更新所述 TAG 存储器中所述 EEPROM地址与所述 PRAM地址的映射关系, 并返回所述命中 仲裁器继续判断所述 MCU下一次需要访问的程序地址是否在所述 PRAM中直 到程序执行完毕。
3、如权利要求 2所述的装置,其中,所述緩存控制器还包括一内部寄存器, 所述命中仲裁器还设置为当所述 MCU需要访问的程序地址不在所述 PRAM和 内部寄存器中, 且该程序地址为 Noncacheable时, 计算第二 DMA请求信息, 并发送至所述 DMA请求触发器; 所述 DMA请求触发器还设置为根据所述第 二 DMA请求信息从所述 EEPROM中将所述 MCU需要访问的程序地址搬运至 所述内部寄存器, 以便所述 MCU从所述内部寄存器中读取需要访问的程序地 址。
4、 如权利要求 1至 3 中任一项所述的装置, 其中, 所述緩存控制器通过 I2C接口与所述 EEPROM通信。
5、 一种扩大 MCU程序地址空间的方法, 用于权利要求 1至 4中任一项所 述的装置; 所述方法包括步骤:
程序执行过程中, 当所述 MCU需要访问的程序地址不在所述 PRAM中, 且所述程序地址为 Cacheable时, 所述緩冲控制器根据预设的所述 EEPROM地 址与所述 PRAM 地址的映射关系, 将所述 MCU 需要的程序地址从所述 EEPROM搬至所述 PRAM中, 以便所述 MCU从所述 PRAM中读取需要访问 的程序地址。
6、 如权利要求 5所述的方法, 其中, 所述緩冲控制器根据 EEPROM地址 与 PRAM地址的映射关系, 将 MCU需要的程序地址从 EEPROM搬至 PRAM 中包括:
A1、 所述緩冲控制器根据所述 EEPROM地址与所述 PRAM地址的映射关 系计算第一 DMA请求信息;
Bl、根据所述第一 DMA请求信息从所述 EEPROM中将所述 MCU需要访 问的程序地址搬运至所述 PRAM;
A1直到程序执行完毕。
7、 如权利要求 5或 6所述的方法, 其中, 所述方法还包括: 当所述 MCU需要访问的程序地址在所述 PRAM中,直接从所述 PRAM中 读取所述 MCU需要访问的程序地址, 并反馈至所述 MCU。
8、 如权利要求 5所述的方法, 其中, 所述方法还包括:
当所述 MCU需要访问的程序地址不在所述 PRAM中, 且所述 MCU需要 访问的程序地址为 Noncacheable时, 所述緩冲控制器从所述 EEPROM中将所 述 MCU需要访问的程序地址搬运至一预设的内部寄存器,以便所述 MCU从所 述内部寄存器中读取需要访问的程序地址。
9、 如权利要求 8所述的方法, 其中, 所述緩冲控制器从 EEPROM中将 MCU 需要访问的程序地址搬运至一预设的内部寄存器包括:
A2、 判断所述 MCU需要的程序地址是否在所述内部寄存器中;
B2、 当所述 MCU需要访问的程序地址不在所述内部寄存器中, 计算第二 DMA请求信息;
C2、根据所述第二 DMA请求信息从所述 EEPROM中将所述 MCU需要访 问的程序地址搬运至所述内部寄存器。
10、如权利要求 9所述的方法,其中,所述緩冲控制器从 EEPROM中将 MCU 需要访问的程序地址搬运至一预设的内部寄存器还包括:
D2、 当所述 MCU需要访问的程序地址在所述内部寄存器中, 直接从所述内 部寄存器中读取所述 MCU需要访问的程序地址, 并反馈至所述 MCU。
PCT/CN2014/080536 2013-08-16 2014-06-23 扩大mcu程序地址空间的方法及装置 WO2015021822A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310357621.0A CN103412829B (zh) 2013-08-16 2013-08-16 扩大mcu程序地址空间的方法及装置
CN201310357621.0 2013-08-16

Publications (1)

Publication Number Publication Date
WO2015021822A1 true WO2015021822A1 (zh) 2015-02-19

Family

ID=49605842

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/080536 WO2015021822A1 (zh) 2013-08-16 2014-06-23 扩大mcu程序地址空间的方法及装置

Country Status (2)

Country Link
CN (1) CN103412829B (zh)
WO (1) WO2015021822A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210105207A1 (en) * 2020-11-18 2021-04-08 Intel Corporation Direct memory access (dma) engine with network interface capabilities

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103412829B (zh) * 2013-08-16 2016-12-28 深圳市汇顶科技股份有限公司 扩大mcu程序地址空间的方法及装置
CN108021514B (zh) * 2016-10-28 2020-11-06 华为技术有限公司 一种缓存替换的方法和设备
FR3065304A1 (fr) 2017-04-12 2018-10-19 Stmicroelectronics (Rousset) Sas Procede d'adressage d'une memoire non-volatile sur un bus i²c et dispositif de memoire correspondant
EP3557422A4 (en) * 2018-03-09 2020-01-08 Shenzhen Goodix Technology Co., Ltd. METHOD FOR ACCESSING CODE SRAM AND ELECTRONIC DEVICE
CN116049047B (zh) * 2022-12-30 2024-04-12 成都电科星拓科技有限公司 一种eeprom访问方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1700192A (zh) * 2004-05-18 2005-11-23 华为技术有限公司 一种使用外部程序存储器的方法
CN101334758A (zh) * 2008-07-03 2008-12-31 深圳市中兴集成电路设计有限责任公司 用于嵌入式系统扩展存储空间的装置和方法
CN101446925A (zh) * 2008-12-29 2009-06-03 中国科学院计算技术研究所 一种复用二级Cache和DSP的RAM的方法及系统
CN102880553A (zh) * 2012-09-18 2013-01-16 武汉虹信通信技术有限责任公司 一种基于mcu的片外flash文件系统的读写方法
CN103412829A (zh) * 2013-08-16 2013-11-27 深圳市汇顶科技股份有限公司 扩大mcu程序地址空间的方法及装置

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5535360A (en) * 1994-08-31 1996-07-09 Vlsi Technology, Inc. Digital computer system having an improved direct-mapped cache controller (with flag modification) for a CPU with address pipelining and method therefor

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1700192A (zh) * 2004-05-18 2005-11-23 华为技术有限公司 一种使用外部程序存储器的方法
CN101334758A (zh) * 2008-07-03 2008-12-31 深圳市中兴集成电路设计有限责任公司 用于嵌入式系统扩展存储空间的装置和方法
CN101446925A (zh) * 2008-12-29 2009-06-03 中国科学院计算技术研究所 一种复用二级Cache和DSP的RAM的方法及系统
CN102880553A (zh) * 2012-09-18 2013-01-16 武汉虹信通信技术有限责任公司 一种基于mcu的片外flash文件系统的读写方法
CN103412829A (zh) * 2013-08-16 2013-11-27 深圳市汇顶科技股份有限公司 扩大mcu程序地址空间的方法及装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210105207A1 (en) * 2020-11-18 2021-04-08 Intel Corporation Direct memory access (dma) engine with network interface capabilities

Also Published As

Publication number Publication date
CN103412829A (zh) 2013-11-27
CN103412829B (zh) 2016-12-28

Similar Documents

Publication Publication Date Title
WO2015021822A1 (zh) 扩大mcu程序地址空间的方法及装置
US11461048B2 (en) Memory controller with programmable atomic operations
US10120832B2 (en) Direct access to local memory in a PCI-E device
US10031857B2 (en) Address translation services for direct accessing of local memory over a network fabric
JP6685323B2 (ja) 拡張メモリにアクセスするための方法、デバイス及びシステム
JP5144542B2 (ja) アドレス変換バイパスを有するデータ処理システム及びその方法
US20150012607A1 (en) Techniques to Replicate Data between Storage Servers
JP5939305B2 (ja) 情報処理装置,並列計算機システム及び情報処理装置の制御方法
US20170371787A1 (en) Contended lock request elision scheme
TW200421089A (en) Method and apparatus for injecting write data into a cache
WO2013109640A1 (en) Techniques for command validation for access to a storage device by a remote client
US9753872B2 (en) Information processing apparatus, input and output control device, and method of controlling information processing apparatus
US20170269875A1 (en) Memory system and operating method thereof
TWI634417B (zh) 選擇性轉譯後備暫存器搜尋及分頁錯誤
US10268416B2 (en) Method and systems of controlling memory-to-memory copy operations
JP2008510246A (ja) バーストリードライト動作による処理装置
TWI624787B (zh) 用於包括記憶體節點之分散式記憶體系統之裝置及方法
KR102144185B1 (ko) 상용 메모리 버스를 이용하는 프로세싱 인 메모리 장치
US20230041362A1 (en) Memory Controller with Programmable Atomic Operations
US11755338B2 (en) Systems and methods for operating data processing units
US20100106911A1 (en) Methods and systems for communication between storage controllers
US10789001B1 (en) Posted operation data control
JP2011113163A (ja) Ioアクセス通信システムにおけるエンドポイント間通信制御装置および方法
US20140136796A1 (en) Arithmetic processing device and method for controlling the same
US8760941B2 (en) Data transfer circuit and data transfer method

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: 14836587

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: 14836587

Country of ref document: EP

Kind code of ref document: A1