[go: up one dir, main page]

CN118885412A - CMOS instruction execution circuit for L2 cache of RISC-V processor - Google Patents

CMOS instruction execution circuit for L2 cache of RISC-V processor Download PDF

Info

Publication number
CN118885412A
CN118885412A CN202411388571.7A CN202411388571A CN118885412A CN 118885412 A CN118885412 A CN 118885412A CN 202411388571 A CN202411388571 A CN 202411388571A CN 118885412 A CN118885412 A CN 118885412A
Authority
CN
China
Prior art keywords
instruction
cmo
risc
cache
processor
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.)
Granted
Application number
CN202411388571.7A
Other languages
Chinese (zh)
Other versions
CN118885412B (en
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.)
Guangdong Saifang Technology Co ltd
Original Assignee
Guangdong Saifang 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 Guangdong Saifang Technology Co ltd filed Critical Guangdong Saifang Technology Co ltd
Priority to CN202411388571.7A priority Critical patent/CN118885412B/en
Publication of CN118885412A publication Critical patent/CN118885412A/en
Application granted granted Critical
Publication of CN118885412B publication Critical patent/CN118885412B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0815Cache consistency protocols
    • G06F12/0831Cache consistency protocols using a bus scheme, e.g. with bus monitoring or watching means
    • 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/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0811Multiuser, multiprocessor or multiprocessing cache systems with multilevel cache hierarchies
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1012Design facilitation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1028Power efficiency
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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

The invention relates to the technical field of processors, in particular to a CMO instruction execution circuit for a secondary cache of a RISC-V processor, which comprises the following components: the CMO instruction execution monitoring module is used for receiving the CMO instruction from the secondary cache kernel of the RISC-V processor; the competition logic module is used for carrying out competition judgment on a request of the CMO instruction entering the main pipeline and an instruction being executed by the current main pipeline, and placing the CMO instruction without competition into the consistency maintenance logic module; the consistency maintenance logic module is used for judging cache consistency of actions executed by the CMO instruction in the main pipeline and placing the CMO instruction which does not violate the cache consistency into the bus request queue module; and the bus request queue module is used for placing the CMO instruction into a bus request queue of a main pipeline so as to execute the CMO instruction. The invention reduces the impact of CMO instruction execution on processor performance.

Description

用于RISC-V处理器二级缓存的CMO指令执行电路CMOS instruction execution circuit for L2 cache of RISC-V processor

技术领域Technical Field

本发明涉及处理器技术领域,尤其涉及一种用于RISC-V处理器二级缓存的CMO指令执行电路。The present invention relates to the field of processor technology, and in particular to a CMOS instruction execution circuit for a secondary cache of a RISC-V processor.

背景技术Background Art

现代处理器系统为了平衡硬件实现的成本与性能需求,通常会将缓存分为一级缓存(first cache)和二级缓存(secondary cache,又称level2 cache或L2C)等缓存层级,其中一级缓存最靠近处理器内核,速度更快更昂贵;而二级缓存则速度稍慢但容量更大,同时还可能会被多个处理器内核共享,因此二级缓存还需要负责维护各一级缓存间的数据一致性以及不同请求间的竞争仲裁。In order to balance the cost and performance requirements of hardware implementation, modern processor systems usually divide cache into cache levels such as first cache and secondary cache (also known as level 2 cache or L2C). The first cache is closest to the processor core and is faster and more expensive. The second cache is slightly slower but has a larger capacity and may be shared by multiple processor cores. Therefore, the second cache is also responsible for maintaining data consistency between the first caches and contention arbitration between different requests.

在RISC-V指令体系问世后,二级缓存需要负责执行一些独有的指令,其中就包括符合RISC-V标准的CMO(cache maintenance operation)指令集。CMO指令用于维护目标缓存行(cacheline)在各处理器内核视角中的状态及数据一致性。一般的,除了编写程序的人员会主动在程序中插入CMO指令外,Linux等操作系统在软件编译过程中也会加入这些指令。因此在二级缓存中实现相关电路时,不仅要保证指令执行的正确性,还必须考虑这些指令执行时对正常程序运行性能的影响,这在处理器逻辑设计中是一个难点。相关技术中,对于二级缓存处理CMO指令时,往往需要较大的电路逻辑设计,这样的设计不可避免地会对处理器的功耗和执行复杂度带来影响。After the advent of the RISC-V instruction system, the second-level cache is responsible for executing some unique instructions, including the CMO (cache maintenance operation) instruction set that complies with the RISC-V standard. The CMO instruction is used to maintain the state and data consistency of the target cache line from the perspective of each processor core. Generally, in addition to the programmer who actively inserts CMO instructions into the program, operating systems such as Linux will also add these instructions during the software compilation process. Therefore, when implementing related circuits in the second-level cache, not only the correctness of the instruction execution must be guaranteed, but also the impact of these instructions on the normal program running performance must be considered, which is a difficult point in the processor logic design. In related technologies, when the second-level cache processes CMO instructions, a larger circuit logic design is often required, and such a design will inevitably affect the power consumption and execution complexity of the processor.

发明内容Summary of the invention

本发明旨在解决现有的处理器二级缓存处理CMO指令集时存在的复杂度和执行功耗难以控制的问题。The present invention aims to solve the problems of complexity and difficulty in controlling execution power consumption when the existing processor secondary cache processes a CM0 instruction set.

为解决上述技术问题,本发明提供一种用于RISC-V处理器二级缓存的CMO指令执行电路,所述CMO指令执行电路包括:In order to solve the above technical problems, the present invention provides a CM0 instruction execution circuit for a secondary cache of a RISC-V processor, the CM0 instruction execution circuit comprising:

CMO指令执行监测模块,用于接收来自RISC-V处理器的二级缓存内核的CMO指令,所述CMO指令执行监测模块初始化为待机状态,并根据所述CMO指令的执行过程在所述待机状态和处理状态之间切换;A CM0 instruction execution monitoring module, used for receiving a CM0 instruction from a secondary cache core of a RISC-V processor, wherein the CM0 instruction execution monitoring module is initialized to a standby state and switches between the standby state and a processing state according to an execution process of the CM0 instruction;

竞争逻辑模块,用于对所述CMO指令进入主流水线的请求进行与当前所述主流水线正在执行的指令进行竞争判断,并将不存在竞争的所述CMO指令放入一致性维护逻辑模块;A competition logic module, used to judge the competition between the request of the CM0 instruction to enter the mainstream pipeline and the instruction currently being executed by the mainstream pipeline, and put the CM0 instruction without competition into the consistency maintenance logic module;

一致性维护逻辑模块,用于判断所述CMO指令在所述主流水线中执行的动作的缓存一致性,并将不违反缓存一致性的所述CMO指令放入总线请求队列模块;A consistency maintenance logic module, used for determining the cache consistency of the action executed by the CM0 instruction in the main pipeline, and placing the CM0 instruction that does not violate the cache consistency into a bus request queue module;

总线请求队列模块,用于将所述CMO指令放入所述主流水线的总线请求队列,以执行所述CMO指令。The bus request queue module is used to put the CM0 instruction into the bus request queue of the main pipeline to execute the CM0 instruction.

更进一步地,所述CMO指令执行监测模块还用于:Furthermore, the CM0 instruction execution monitoring module is also used for:

在获取到所述CMO指令时,判断所述CMO指令执行监测模块自身的运行状态是否为所述待机状态、且所述CMO指令是否为RISC-V处理器的二级缓存内核的请求队列中排序最先的指令,若是,则将所述CMO指令执行监测模块自身的运行状态设置为所述处理状态,并保存所述CMO指令的指令信息。When the CMO instruction is obtained, it is determined whether the running state of the CMO instruction execution monitoring module itself is the standby state, and whether the CMO instruction is the first instruction sorted in the request queue of the secondary cache core of the RISC-V processor. If so, the running state of the CMO instruction execution monitoring module itself is set to the processing state, and the instruction information of the CMO instruction is saved.

更进一步地,所述总线请求队列模块还用于:Furthermore, the bus request queue module is also used for:

将所述CMO指令放入所述总线请求队列后,通知所述CMO指令执行监测模块将自身的运行状态设置为所述待机状态。After the CM0 instruction is placed into the bus request queue, the CM0 instruction execution monitoring module is notified to set its own operating state to the standby state.

更进一步地,所述CMO指令的所述指令信息包括指令地址,所述CMO指令执行监测模块还用于:Furthermore, the instruction information of the CM0 instruction includes an instruction address, and the CM0 instruction execution monitoring module is further used for:

当所述CMO指令执行监测模块自身的运行状态为所述处理状态、且接收到的新的CMO指令的指令地址与所述CMO指令执行监测模块已保存的指令地址相同,则将新的CMO指令返回RISC-V处理器的二级缓存内核的请求队列。When the running state of the CMO instruction execution monitoring module itself is the processing state, and the instruction address of the received new CMO instruction is the same as the instruction address saved by the CMO instruction execution monitoring module, the new CMO instruction is returned to the request queue of the secondary cache core of the RISC-V processor.

更进一步地,不同CMO指令的指令地址的相同判断基于缓存行的地址实现。Furthermore, the same determination of instruction addresses of different CM0 instructions is implemented based on the address of the cache line.

更进一步地,所述一致性维护逻辑模块的缓存一致性检测基于缓存行的mesi协议字段实现。Furthermore, the cache consistency detection of the consistency maintenance logic module is implemented based on the mesi protocol field of the cache line.

更进一步地,若所述CMO指令为cbo.clean请求,且RISC-V处理器的二级缓存中存在所述CMO指令对应目标指令地址的旧数据,所述总线请求队列模块还用于:Furthermore, if the CMO instruction is a cbo.clean request, and there is old data of the target instruction address corresponding to the CMO instruction in the secondary cache of the RISC-V processor, the bus request queue module is further used to:

在所述总线请求队列写入所述旧数据,通过所述CMO指令执行监测模块标记所述旧数据,并禁止任何CMO指令读取所述旧数据,之后,将所述CMO指令放入所述总线请求队列。The old data is written into the bus request queue, the old data is marked by the CM0 instruction execution monitoring module, and any CM0 instruction is prohibited from reading the old data, and then the CM0 instruction is put into the bus request queue.

更进一步地,若所述CMO指令为cbo.flush请求,且RISC-V处理器的二级缓存中存在所述CMO指令对应目标指令地址的旧数据,所述总线请求队列模块还用于:Furthermore, if the CMO instruction is a cbo.flush request, and there is old data of the target instruction address corresponding to the CMO instruction in the secondary cache of the RISC-V processor, the bus request queue module is further used to:

在所述总线请求队列写入所述旧数据,并将所述CMO指令对应的缓存行在RISC-V处理器的二级缓存的标签记录中删除,之后,将所述CMO指令放入所述总线请求队列。The old data is written into the bus request queue, and the cache line corresponding to the CM0 instruction is deleted from the tag record of the secondary cache of the RISC-V processor. After that, the CM0 instruction is placed into the bus request queue.

更进一步地,若所述CMO指令为cbo.invalid请求,所述总线请求队列模块还用于:Furthermore, if the CMO instruction is a cbo.invalid request, the bus request queue module is further configured to:

无论所述CMO指令是否在RISC-V处理器的二级缓存中存在对应目标指令地址的旧数据,都将所述旧数据以及对应的缓存行在RISC-V处理器的二级缓存的标签记录中删除。Regardless of whether there is old data corresponding to the target instruction address in the secondary cache of the RISC-V processor for the CMO instruction, the old data and the corresponding cache line will be deleted from the tag record of the secondary cache of the RISC-V processor.

本发明所达到的有益效果,在于提出了一种带有CMO指令执行监测模块的用于RISC-V处理器二级缓存的CMO指令执行电路,该执行电路中的模块在CMO指令被二级缓存执行期间将检测并借用主流水线已有的相关控制逻辑,因此在CMO指令被二级缓存执行期间不会影响主流水线正常执行其他指令,同时只需要较少的硬件资源即可实现,从而控制执行电路带来的处理器实际电路面积及功耗,并且较大程度地减小CMO指令执行对处理器流水线性能的影响。The beneficial effect achieved by the present invention is that a CMO instruction execution circuit for the secondary cache of a RISC-V processor is proposed, which is provided with a CMO instruction execution monitoring module. The module in the execution circuit will detect and borrow the existing related control logic of the main pipeline during the period when the CMO instruction is executed by the secondary cache. Therefore, during the period when the CMO instruction is executed by the secondary cache, the normal execution of other instructions by the main pipeline will not be affected. At the same time, only fewer hardware resources are needed to implement it, thereby controlling the actual circuit area and power consumption of the processor brought by the execution circuit, and greatly reducing the impact of the CMO instruction execution on the processor pipeline performance.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1是本发明实施例提供的用于RISC-V处理器二级缓存的CMO指令执行电路的逻辑示意图;FIG1 is a logic diagram of a CM0 instruction execution circuit for a secondary cache of a RISC-V processor provided by an embodiment of the present invention;

图2是本发明实施例所提出的用于RISC-V处理器二级缓存的CMO指令执行电路的执行示意图。Figure 2 is an execution diagram of the CM0 instruction execution circuit for the secondary cache of a RISC-V processor proposed in an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

请参照图1,图1是本发明实施例提供的用于RISC-V处理器二级缓存的CMO指令执行电路的逻辑示意图,RISC-V是一个基于精简指令集原则提出的开源指令集架构,具有指令精简,低功耗等优点,所述CMO指令执行电路100包括:Please refer to FIG. 1 , which is a logic diagram of a CM0 instruction execution circuit for a secondary cache of a RISC-V processor provided in an embodiment of the present invention. RISC-V is an open source instruction set architecture proposed based on the principle of a reduced instruction set, which has the advantages of simplified instructions and low power consumption. The CM0 instruction execution circuit 100 includes:

CMO指令执行监测模块101(CMO Monitor),用于接收来自RISC-V处理器的二级缓存内核的CMO指令,所述CMO指令执行监测模块初始化为待机状态,并根据所述CMO指令的执行过程在所述待机状态和处理状态(busy)之间切换;A CMO instruction execution monitoring module 101 (CMO Monitor), configured to receive a CMO instruction from a secondary cache core of a RISC-V processor, wherein the CMO instruction execution monitoring module is initialized to a standby state and switches between the standby state and a processing state (busy) according to an execution process of the CMO instruction;

竞争逻辑模块102,用于对所述CMO指令进入主流水线的请求进行与当前所述主流水线正在执行的指令进行竞争判断,并将不存在竞争的所述CMO指令放入一致性维护逻辑模块103;The competition logic module 102 is used to judge the competition between the request of the CM0 instruction to enter the mainstream pipeline and the instruction currently being executed by the mainstream pipeline, and put the CM0 instruction without competition into the consistency maintenance logic module 103;

一致性维护逻辑模块103,用于判断所述CMO指令在所述主流水线中执行的动作的缓存一致性,并将不违反缓存一致性的所述CMO指令放入总线请求队列模块104;A consistency maintenance logic module 103, used to determine the cache consistency of the action executed by the CM0 instruction in the main pipeline, and put the CM0 instruction that does not violate the cache consistency into the bus request queue module 104;

总线请求队列模块104,用于将所述CMO指令放入所述主流水线的总线请求队列,以执行所述CMO指令。The bus request queue module 104 is used to put the CM0 instruction into the bus request queue of the main pipeline to execute the CM0 instruction.

更进一步地,所述CMO指令执行监测模块101还用于:Furthermore, the CM0 instruction execution monitoring module 101 is also used for:

在获取到所述CMO指令时,判断所述CMO指令执行监测模块101自身的运行状态是否为所述待机状态、且所述CMO指令是否为RISC-V处理器的二级缓存内核的请求队列中排序最先的指令,若是,则将所述CMO指令执行监测模块101自身的运行状态设置为所述处理状态,并保存所述CMO指令的指令信息。When the CMO instruction is obtained, it is determined whether the running state of the CMO instruction execution monitoring module 101 itself is the standby state, and whether the CMO instruction is the first instruction sorted in the request queue of the secondary cache core of the RISC-V processor. If so, the running state of the CMO instruction execution monitoring module 101 itself is set to the processing state, and the instruction information of the CMO instruction is saved.

可以理解的是,实际处理器电路中,为了实现数据处理和保存,所述CMO指令执行监测模块101包含用于控制CMO指令执行流程的状态机、以及用于保存CMO指令地址及类型等信息的寄存器组等。It can be understood that in an actual processor circuit, in order to realize data processing and storage, the CM0 instruction execution monitoring module 101 includes a state machine for controlling the CM0 instruction execution process, and a register group for storing information such as the CM0 instruction address and type.

更进一步地,所述总线请求队列模块104还用于:Furthermore, the bus request queue module 104 is also used for:

将所述CMO指令放入所述总线请求队列后,通知所述CMO指令执行监测模块101将自身的运行状态设置为所述待机状态。After the CM0 instruction is placed into the bus request queue, the CM0 instruction execution monitoring module 101 is notified to set its own operating state to the standby state.

需要说明的是,由于RISC-V标准的CMO指令均携带地址,属于针对某一特定缓存行执行的指令,因此所述CMO指令执行监测模块101会保存获得当前执行权限的CMO指令的地址等信息,如果在CMO指令执行期间进入主流水线的其他非CMO指令与当前所述CMO指令执行监测模块101保存的指令地址不一致,则仍可正常进行访存行为。It should be noted that since the RISC-V standard CMO instructions all carry addresses and are instructions executed for a specific cache line, the CMO instruction execution monitoring module 101 will save information such as the address of the CMO instruction that has obtained the current execution permission. If other non-CMO instructions entering the mainstream pipeline during the execution of the CMO instruction are inconsistent with the instruction address currently saved by the CMO instruction execution monitoring module 101, memory access can still be performed normally.

更进一步地,所述CMO指令的所述指令信息包括指令地址,所述CMO指令执行监测模块还用于:Furthermore, the instruction information of the CM0 instruction includes an instruction address, and the CM0 instruction execution monitoring module is further used for:

当所述CMO指令执行监测模块自身的运行状态为所述处理状态、且接收到的新的CMO指令的指令地址与所述CMO指令执行监测模块已保存的指令地址相同,则将新的CMO指令返回RISC-V处理器的二级缓存内核的请求队列。When the running state of the CMO instruction execution monitoring module itself is the processing state, and the instruction address of the received new CMO instruction is the same as the instruction address saved by the CMO instruction execution monitoring module, the new CMO instruction is returned to the request queue of the secondary cache core of the RISC-V processor.

更进一步地,不同CMO指令的指令地址的相同判断基于缓存行的地址实现。Furthermore, the same determination of instruction addresses of different CM0 instructions is implemented based on the address of the cache line.

更进一步地,所述一致性维护逻辑模块103的缓存一致性检测基于缓存行的mesi协议字段实现。Mesi是一种常用的缓存一致性维护协议,m/e/s/i分别表示缓存行在当前存储器层级的状态,其中m(modified)表示缓存行被独享且修改过数据;e(exclusive)表示缓存行被独享且数据未被修改过;s(shared)表示缓存行被共享,任何处理器都不应有改写缓存行的权限;i(invalidated)表示缓存行在该存储器层级无效。Furthermore, the cache consistency detection of the consistency maintenance logic module 103 is implemented based on the mesi protocol field of the cache line. Mesi is a commonly used cache consistency maintenance protocol, where m/e/s/i respectively represent the status of the cache line at the current memory level, where m (modified) means that the cache line is exclusive and the data has been modified; e (exclusive) means that the cache line is exclusive and the data has not been modified; s (shared) means that the cache line is shared, and no processor should have the authority to rewrite the cache line; i (invalidated) means that the cache line is invalid at this memory level.

缓存一致性维护(Cacheline coherency maintenance)通过判断缓存行的mesi信息确定缓存行是否还有效,同时通过判断及维护处理器内核的mesi信息来保证任意一条缓存行的状态和数据在所有处理器视角看都是一致的。Cacheline coherency maintenance determines whether a cache line is still valid by judging the mesi information of the cache line. At the same time, it ensures that the status and data of any cache line are consistent from the perspective of all processors by judging and maintaining the mesi information of the processor core.

具体的,访存请求获得二级缓存Tag ram中保存的缓存行信息后,根据请求类型及缓存行状态等信息,判断所述CMO指令的请求将要进行的操作(tag compare)。Specifically, after the memory access request obtains the cache line information stored in the secondary cache Tag ram, the operation (tag compare) to be performed by the request of the CM0 instruction is determined according to information such as the request type and the cache line status.

基于上述模块所实现的功能,本发明实施例所提出的用于RISC-V处理器二级缓存的CMO指令执行电路的执行示意图如图2所示。Based on the functions implemented by the above modules, the execution diagram of the CM0 instruction execution circuit for the secondary cache of the RISC-V processor proposed in an embodiment of the present invention is shown in Figure 2.

更进一步地,若所述CMO指令为cbo.clean请求,且RISC-V处理器的二级缓存中存在所述CMO指令对应目标指令地址的旧数据(dirty data),所述总线请求队列模块104还用于:Furthermore, if the CMO instruction is a cbo.clean request, and there is old data (dirty data) corresponding to the target instruction address of the CMO instruction in the secondary cache of the RISC-V processor, the bus request queue module 104 is further used to:

在所述总线请求队列写入所述旧数据,通过所述CMO指令执行监测模块标记所述旧数据,并禁止任何CMO指令读取所述旧数据,之后,将所述CMO指令放入所述总线请求队列。The old data is written into the bus request queue, the old data is marked by the CM0 instruction execution monitoring module, and any CM0 instruction is prohibited from reading the old data, and then the CM0 instruction is put into the bus request queue.

更进一步地,若所述CMO指令为cbo.flush请求,且RISC-V处理器的二级缓存中存在所述CMO指令对应目标指令地址的旧数据,所述总线请求队列模块104还用于:Furthermore, if the CMO instruction is a cbo.flush request, and there is old data corresponding to the target instruction address of the CMO instruction in the secondary cache of the RISC-V processor, the bus request queue module 104 is further used to:

在所述总线请求队列写入所述旧数据,并将所述CMO指令对应的缓存行在RISC-V处理器的二级缓存的标签记录中删除,之后,将所述CMO指令放入所述总线请求队列。The old data is written into the bus request queue, and the cache line corresponding to the CM0 instruction is deleted from the tag record of the secondary cache of the RISC-V processor. After that, the CM0 instruction is placed into the bus request queue.

更进一步地,若所述CMO指令为cbo.invalid请求,所述总线请求队列模块104还用于:Furthermore, if the CMO instruction is a cbo.invalid request, the bus request queue module 104 is further configured to:

无论所述CMO指令是否在RISC-V处理器的二级缓存中存在对应目标指令地址的旧数据,都将所述旧数据以及对应的缓存行在RISC-V处理器的二级缓存的标签记录中删除。Regardless of whether there is old data corresponding to the target instruction address in the secondary cache of the RISC-V processor for the CM0 instruction, the old data and the corresponding cache line will be deleted from the tag record of the secondary cache of the RISC-V processor.

需要说明的是,即使二级缓存在不作为LLC(最后一层缓存)的情况下,本发明实施例所设计的执行电路也可以在CMO指令被LLC处理完成前,在内部先自行完成一致性维护,并通知处理器内核解除CMO指令造成的指令fence;因此即使下一缓存层级需要较长时间处理二级缓存下发的CMO指令,只要二级缓存已完成该条指令相关的缓存行的一致性维护,处理器系统就可以继续后续指令的运行,从而最大程度保证系统的性能。It should be noted that even if the secondary cache is not used as LLC (last level cache), the execution circuit designed in the embodiment of the present invention can complete the consistency maintenance internally before the CMO instruction is processed by the LLC, and notify the processor core to release the instruction fence caused by the CMO instruction; therefore, even if the next cache level needs a longer time to process the CMO instruction issued by the secondary cache, as long as the secondary cache has completed the consistency maintenance of the cache line related to the instruction, the processor system can continue to run subsequent instructions, thereby maximizing the system performance.

相较于现有技术,由于RISC-V标准的CMO指令规定处理器内核在当前CMO指令完成前,该处理器内核不能提交其他更新的指令,而本发明实施例提供的技术方案只需要CMO指令在二级缓存层级完成一致性维护操作后,即可基于所述CMO指令执行监测模块101和所述总线请求队列模块104通知处理器内核当前CMO指令可以提交并完成,无需等待当前指令进一步下发到下一存储器层级再进行操作的时间,因此能较大程度地减小CMO指令执行对系统性能的影响。Compared with the prior art, since the CMO instruction of the RISC-V standard stipulates that the processor core cannot submit other updated instructions before the current CMO instruction is completed, the technical solution provided by the embodiment of the present invention only needs the CMO instruction to complete the consistency maintenance operation at the secondary cache level, and then the processor core can be notified based on the CMO instruction execution monitoring module 101 and the bus request queue module 104 that the current CMO instruction can be submitted and completed, without waiting for the current instruction to be further sent to the next memory level for operation, thereby greatly reducing the impact of CMO instruction execution on system performance.

本发明所达到的有益效果,在于提出了一种带有CMO指令执行监测模块的用于RISC-V处理器二级缓存的CMO指令执行电路,该执行电路中的模块在CMO指令被二级缓存执行期间将检测并借用主流水线已有的相关控制逻辑,因此在CMO指令被二级缓存执行期间不会影响主流水线正常执行其他指令,同时只需要较少的硬件资源即可实现,从而控制执行电路带来的处理器实际电路面积及功耗,并且较大程度地减小CMO指令执行对处理器流水线性能的影响。The beneficial effect achieved by the present invention is that a CMO instruction execution circuit for the secondary cache of a RISC-V processor is proposed, which is provided with a CMO instruction execution monitoring module. The module in the execution circuit will detect and borrow the existing related control logic of the main pipeline during the period when the CMO instruction is executed by the secondary cache. Therefore, during the period when the CMO instruction is executed by the secondary cache, the normal execution of other instructions by the main pipeline will not be affected. At the same time, only fewer hardware resources are needed to implement it, thereby controlling the actual circuit area and power consumption of the processor brought by the execution circuit, and greatly reducing the impact of the CMO instruction execution on the processor pipeline performance.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

上面结合附图对本发明的实施例进行了描述,所揭露的仅为本发明较佳实施例而已,但是本发明并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本发明的启示下,在不脱离本发明宗旨和权利要求所保护的范围情况下,还可做出很多形式用等同变化,均属于本发明的保护之内。The embodiments of the present invention are described above in conjunction with the accompanying drawings. What is disclosed is only the preferred embodiment of the present invention. However, the present invention is not limited to the above-mentioned specific implementation manner. The above-mentioned specific implementation manner is only illustrative rather than restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms and equivalent changes without departing from the scope of protection of the purpose of the present invention and the claims, all of which are within the protection of the present invention.

Claims (9)

1.一种用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,所述CMO指令执行电路包括:1. A CM0 instruction execution circuit for a secondary cache of a RISC-V processor, characterized in that the CM0 instruction execution circuit comprises: CMO指令执行监测模块,用于接收来自RISC-V处理器的二级缓存内核的CMO指令,所述CMO指令执行监测模块初始化为待机状态,并根据所述CMO指令的执行过程在所述待机状态和处理状态之间切换;A CM0 instruction execution monitoring module, used for receiving a CM0 instruction from a secondary cache core of a RISC-V processor, wherein the CM0 instruction execution monitoring module is initialized to a standby state and switches between the standby state and a processing state according to an execution process of the CM0 instruction; 竞争逻辑模块,用于对所述CMO指令进入主流水线的请求进行与当前所述主流水线正在执行的指令进行竞争判断,并将不存在竞争的所述CMO指令放入一致性维护逻辑模块;A competition logic module, used to judge the competition between the request of the CM0 instruction to enter the mainstream pipeline and the instruction currently being executed by the mainstream pipeline, and put the CM0 instruction without competition into the consistency maintenance logic module; 一致性维护逻辑模块,用于判断所述CMO指令在所述主流水线中执行的动作的缓存一致性,并将不违反缓存一致性的所述CMO指令放入总线请求队列模块;A consistency maintenance logic module, used for determining the cache consistency of the action executed by the CM0 instruction in the main pipeline, and placing the CM0 instruction that does not violate the cache consistency into a bus request queue module; 总线请求队列模块,用于将所述CMO指令放入所述主流水线的总线请求队列,以执行所述CMO指令。The bus request queue module is used to put the CM0 instruction into the bus request queue of the main pipeline to execute the CM0 instruction. 2.根据权利要求1所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,所述CMO指令执行监测模块还用于:2. The CM0 instruction execution circuit for the L2 cache of a RISC-V processor according to claim 1, wherein the CM0 instruction execution monitoring module is further used for: 在获取到所述CMO指令时,判断所述CMO指令执行监测模块自身的运行状态是否为所述待机状态、且所述CMO指令是否为RISC-V处理器的二级缓存内核的请求队列中排序最先的指令,若是,则将所述CMO指令执行监测模块自身的运行状态设置为所述处理状态,并保存所述CMO指令的指令信息。When the CMO instruction is obtained, it is determined whether the running state of the CMO instruction execution monitoring module itself is the standby state, and whether the CMO instruction is the first instruction sorted in the request queue of the secondary cache core of the RISC-V processor. If so, the running state of the CMO instruction execution monitoring module itself is set to the processing state, and the instruction information of the CMO instruction is saved. 3.根据权利要求2所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,所述总线请求队列模块还用于:3. The CM0 instruction execution circuit for the secondary cache of a RISC-V processor according to claim 2, wherein the bus request queue module is further used for: 将所述CMO指令放入所述总线请求队列后,通知所述CMO指令执行监测模块将自身的运行状态设置为所述待机状态。After the CM0 instruction is placed into the bus request queue, the CM0 instruction execution monitoring module is notified to set its own operating state to the standby state. 4.根据权利要求2所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,所述CMO指令的所述指令信息包括指令地址,所述CMO指令执行监测模块还用于:4. The CM0 instruction execution circuit for the secondary cache of a RISC-V processor according to claim 2, wherein the instruction information of the CM0 instruction includes an instruction address, and the CM0 instruction execution monitoring module is further used for: 当所述CMO指令执行监测模块自身的运行状态为所述处理状态、且接收到的新的CMO指令的指令地址与所述CMO指令执行监测模块已保存的指令地址相同,则将新的CMO指令返回RISC-V处理器的二级缓存内核的请求队列。When the running state of the CMO instruction execution monitoring module itself is the processing state, and the instruction address of the received new CMO instruction is the same as the instruction address saved by the CMO instruction execution monitoring module, the new CMO instruction is returned to the request queue of the secondary cache core of the RISC-V processor. 5.根据权利要求4所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,不同CMO指令的指令地址的相同判断基于缓存行的地址实现。5. The CM0 instruction execution circuit for the secondary cache of a RISC-V processor according to claim 4 is characterized in that the judgment of the same instruction addresses of different CM0 instructions is implemented based on the address of the cache line. 6.根据权利要求5所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,所述一致性维护逻辑模块的缓存一致性检测基于缓存行的mesi协议字段实现。6. The CM0 instruction execution circuit for the secondary cache of a RISC-V processor according to claim 5 is characterized in that the cache consistency detection of the consistency maintenance logic module is implemented based on the mesi protocol field of the cache line. 7.根据权利要求1所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,若所述CMO指令为cbo.clean请求,且RISC-V处理器的二级缓存中存在所述CMO指令对应目标指令地址的旧数据,所述总线请求队列模块还用于:7. The CM0 instruction execution circuit for the secondary cache of a RISC-V processor according to claim 1, characterized in that if the CM0 instruction is a cbo.clean request, and there is old data of the target instruction address corresponding to the CM0 instruction in the secondary cache of the RISC-V processor, the bus request queue module is further used to: 在所述总线请求队列写入所述旧数据,通过所述CMO指令执行监测模块标记所述旧数据,并禁止任何CMO指令读取所述旧数据,之后,将所述CMO指令放入所述总线请求队列。The old data is written into the bus request queue, the old data is marked by the CM0 instruction execution monitoring module, and any CM0 instruction is prohibited from reading the old data, and then the CM0 instruction is put into the bus request queue. 8.根据权利要求1所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,若所述CMO指令为cbo.flush请求,且RISC-V处理器的二级缓存中存在所述CMO指令对应目标指令地址的旧数据,所述总线请求队列模块还用于:8. The CM0 instruction execution circuit for the secondary cache of a RISC-V processor according to claim 1, characterized in that if the CM0 instruction is a cbo.flush request, and there is old data of the target instruction address corresponding to the CM0 instruction in the secondary cache of the RISC-V processor, the bus request queue module is further used to: 在所述总线请求队列写入所述旧数据,并将所述CMO指令对应的缓存行在RISC-V处理器的二级缓存的标签记录中删除,之后,将所述CMO指令放入所述总线请求队列。The old data is written into the bus request queue, and the cache line corresponding to the CM0 instruction is deleted from the tag record of the secondary cache of the RISC-V processor. After that, the CM0 instruction is placed into the bus request queue. 9.根据权利要求1所述的用于RISC-V处理器二级缓存的CMO指令执行电路,其特征在于,若所述CMO指令为cbo.invalid请求,所述总线请求队列模块还用于:9. The CM0 instruction execution circuit for the L2 cache of a RISC-V processor according to claim 1, wherein if the CM0 instruction is a cbo.invalid request, the bus request queue module is further used to: 无论所述CMO指令是否在RISC-V处理器的二级缓存中存在对应目标指令地址的旧数据,都将所述旧数据以及对应的缓存行在RISC-V处理器的二级缓存的标签记录中删除。Regardless of whether there is old data corresponding to the target instruction address in the secondary cache of the RISC-V processor for the CM0 instruction, the old data and the corresponding cache line will be deleted from the tag record of the secondary cache of the RISC-V processor.
CN202411388571.7A 2024-10-08 2024-10-08 CMOS instruction execution circuit for RISC-V processor L2 cache Active CN118885412B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411388571.7A CN118885412B (en) 2024-10-08 2024-10-08 CMOS instruction execution circuit for RISC-V processor L2 cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411388571.7A CN118885412B (en) 2024-10-08 2024-10-08 CMOS instruction execution circuit for RISC-V processor L2 cache

Publications (2)

Publication Number Publication Date
CN118885412A true CN118885412A (en) 2024-11-01
CN118885412B CN118885412B (en) 2025-04-11

Family

ID=93232835

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411388571.7A Active CN118885412B (en) 2024-10-08 2024-10-08 CMOS instruction execution circuit for RISC-V processor L2 cache

Country Status (1)

Country Link
CN (1) CN118885412B (en)

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101794271A (en) * 2010-03-31 2010-08-04 华为技术有限公司 Implementation method and device of consistency of multi-core internal memory
CN102388372A (en) * 2009-04-07 2012-03-21 想象技术有限公司 Ensuring consistency between a data cache and a main memory
CN103488563A (en) * 2013-09-05 2014-01-01 龙芯中科技术有限公司 Data race detection method and device for parallel programs and multi-core processing system
US20150089155A1 (en) * 2013-09-26 2015-03-26 International Business Machines Corporation Centralized management of high-contention cache lines in multi-processor computing environments
CN107977766A (en) * 2017-10-09 2018-05-01 中国电子科技集团公司第二十八研究所 A kind of city operations emulation and overall planning system
CN108596515A (en) * 2018-05-11 2018-09-28 湖南城市学院 A kind of two three-dimensional integratedization urban planning decision support systems
US20190095204A1 (en) * 2013-07-15 2019-03-28 Texas Instruments Incorporated Cache Management Operations Using Streaming Engine
CN111274337A (en) * 2019-12-31 2020-06-12 北方信息控制研究院集团有限公司 Two-dimensional and three-dimensional integrated GIS system based on live-action three-dimension
US20210064529A1 (en) * 2019-09-04 2021-03-04 Xilinx, Inc. Producer-to-consumer active direct cache transfers
CN113892090A (en) * 2019-05-24 2022-01-04 德州仪器公司 Multi-level cache security
CN114241143A (en) * 2021-11-25 2022-03-25 苏州规划设计研究院股份有限公司 Smart city planning platform and method based on multi-dimensional data and three-dimensional modeling
CN115718743A (en) * 2022-11-23 2023-02-28 重庆大学 A visual urban and rural spatial planning system
CN116308942A (en) * 2022-12-20 2023-06-23 上海市大数据中心 A government information system construction method based on platform informatization
CN116401183A (en) * 2023-03-24 2023-07-07 山东云海国创云计算装备产业创新中心有限公司 Storage control system and storage server
CN116701247A (en) * 2022-03-03 2023-09-05 三星电子株式会社 Near-Data Processing Accelerators Based on Cache-Coherent Interconnects

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102388372A (en) * 2009-04-07 2012-03-21 想象技术有限公司 Ensuring consistency between a data cache and a main memory
CN101794271A (en) * 2010-03-31 2010-08-04 华为技术有限公司 Implementation method and device of consistency of multi-core internal memory
US20190095204A1 (en) * 2013-07-15 2019-03-28 Texas Instruments Incorporated Cache Management Operations Using Streaming Engine
CN103488563A (en) * 2013-09-05 2014-01-01 龙芯中科技术有限公司 Data race detection method and device for parallel programs and multi-core processing system
US20150089155A1 (en) * 2013-09-26 2015-03-26 International Business Machines Corporation Centralized management of high-contention cache lines in multi-processor computing environments
CN107977766A (en) * 2017-10-09 2018-05-01 中国电子科技集团公司第二十八研究所 A kind of city operations emulation and overall planning system
CN108596515A (en) * 2018-05-11 2018-09-28 湖南城市学院 A kind of two three-dimensional integratedization urban planning decision support systems
CN113892090A (en) * 2019-05-24 2022-01-04 德州仪器公司 Multi-level cache security
US20210064529A1 (en) * 2019-09-04 2021-03-04 Xilinx, Inc. Producer-to-consumer active direct cache transfers
CN111274337A (en) * 2019-12-31 2020-06-12 北方信息控制研究院集团有限公司 Two-dimensional and three-dimensional integrated GIS system based on live-action three-dimension
CN114241143A (en) * 2021-11-25 2022-03-25 苏州规划设计研究院股份有限公司 Smart city planning platform and method based on multi-dimensional data and three-dimensional modeling
CN116701247A (en) * 2022-03-03 2023-09-05 三星电子株式会社 Near-Data Processing Accelerators Based on Cache-Coherent Interconnects
CN115718743A (en) * 2022-11-23 2023-02-28 重庆大学 A visual urban and rural spatial planning system
CN116308942A (en) * 2022-12-20 2023-06-23 上海市大数据中心 A government information system construction method based on platform informatization
CN116401183A (en) * 2023-03-24 2023-07-07 山东云海国创云计算装备产业创新中心有限公司 Storage control system and storage server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
东野长磊;: "基于现场可编程门阵列的RISC处理器设计", 计算机工程, no. 11, 5 June 2011 (2011-06-05), pages 242 - 244 *

Also Published As

Publication number Publication date
CN118885412B (en) 2025-04-11

Similar Documents

Publication Publication Date Title
US6918012B2 (en) Streamlined cache coherency protocol system and method for a multiple processor single chip device
US5761734A (en) Token-based serialisation of instructions in a multiprocessor system
US8131980B2 (en) Structure for dynamic livelock resolution with variable delay memory access queue
CN1866230B (en) Memory arbiter, processor system and memory arbitration method
JP4764360B2 (en) Techniques for using memory attributes
US11113065B2 (en) Speculative instruction wakeup to tolerate draining delay of memory ordering violation check buffers
US20040123078A1 (en) Method and apparatus for processing a load-lock instruction using a scoreboard mechanism
US20080294412A1 (en) Design structure for performing cacheline polling utilizing store with reserve and load when reservation lost instructions
CN116049034A (en) Verification method and device for cache consistency of multi-core processor system
US9009420B2 (en) Structure for performing cacheline polling utilizing a store and reserve instruction
US9983874B2 (en) Structure for a circuit function that implements a load when reservation lost instruction to perform cacheline polling
CN116171432A (en) Monitoring memory locations to identify whether data stored at the memory locations has been modified
CN118885412B (en) CMOS instruction execution circuit for RISC-V processor L2 cache
CN103210377B (en) Information processing system
JP2001034533A (en) Cache coherency controller, secondary cache memory, central processor, multiprocessing system, processor node, and cache coherency control method
CN117940875A (en) Power savings through delayed message processing
JPH06282528A (en) Method and system for transfer of data
KR100246864B1 (en) Computer memory system with cache flush method and cache memory for second cache memory
US7356647B1 (en) Cache with integrated capability to write out entire cache
KR20250132461A (en) A device including an interrupt tracking circuit
JP2024538196A (en) Cache Line Coherence State Upgrade
JP3517884B2 (en) Data processing device
EP4409415A1 (en) Suppressing cache line modification
JP2024538195A (en) Cache Line Coherency State Downgrade
KR20240067955A (en) Weak cache line invalidation requests to speculatively execute instructions.

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Country or region after: China

Address after: Room 06, 5th floor (actual 4th floor), elevator floor 2, Zhangrun Building, Lane 61, Shengxia Road, Pudong New Area, Shanghai, China (Shanghai) Pilot Free Trade Zone, 200000

Applicant after: Shanghai Saifang Semiconductor Technology Co.,Ltd.

Address before: Room S201, Zone A, No. 2 Haoyang Road, Yunlu Community, Daliang Street, Shunde District, Foshan City, Guangdong Province, 528000

Applicant before: Guangdong saifang Technology Co.,Ltd.

Country or region before: China

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant