CN116450570A - 32-bit RISC-V processor based on FPGA and electronic equipment - Google Patents
32-bit RISC-V processor based on FPGA and electronic equipment Download PDFInfo
- Publication number
- CN116450570A CN116450570A CN202310725778.8A CN202310725778A CN116450570A CN 116450570 A CN116450570 A CN 116450570A CN 202310725778 A CN202310725778 A CN 202310725778A CN 116450570 A CN116450570 A CN 116450570A
- Authority
- CN
- China
- Prior art keywords
- bus
- module
- processor
- fpga
- soft core
- 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
Links
- 238000004891 communication Methods 0.000 claims abstract description 15
- 238000000034 method Methods 0.000 claims description 21
- 238000007781 pre-processing Methods 0.000 claims description 16
- 230000005540 biological transmission Effects 0.000 claims description 5
- 238000012546 transfer Methods 0.000 claims description 2
- 238000012545 processing Methods 0.000 abstract description 15
- 230000003993 interaction Effects 0.000 abstract description 5
- 238000012827 research and development Methods 0.000 abstract description 4
- 230000002093 peripheral effect Effects 0.000 description 16
- 238000010586 diagram Methods 0.000 description 5
- 238000013461 design Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 230000008901 benefit Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 230000000903 blocking effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000009897 systematic effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/76—Architectures of general purpose stored program computers
- G06F15/78—Architectures of general purpose stored program computers comprising a single central processing unit
- G06F15/7807—System on chip, i.e. computer system on a single chip; System in package, i.e. computer system on one or more chips in a single package
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F15/00—Digital computers in general; Data processing equipment in general
- G06F15/76—Architectures of general purpose stored program computers
- G06F15/78—Architectures of general purpose stored program computers comprising a single central processing unit
- G06F15/7867—Architectures of general purpose stored program computers comprising a single central processing unit with reconfigurable architecture
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Microelectronics & Electronic Packaging (AREA)
- Advance Control (AREA)
Abstract
Description
技术领域technical field
本申请涉及计算架构领域,具体涉及基于FPGA的32位RISC-V处理器及电子设备。This application relates to the field of computing architecture, in particular to FPGA-based 32-bit RISC-V processors and electronic equipment.
背景技术Background technique
近年来随着航空航天、汽车电子等领域的发展,微控制器的用途越来越广泛。除了开源之外,RISC-V指令架构的开发和维护人员在总结了过去几十年的精简指令集发展后,提炼出了模块化,增量型、去冗余化的RISC-V指令集规范,这是RISC-V指令架构的另一个重大优势。In recent years, with the development of aerospace, automotive electronics and other fields, the use of microcontrollers has become more and more extensive. In addition to open source, the developers and maintainers of the RISC-V instruction architecture have refined the modular, incremental, and de-redundant RISC-V instruction set specification after summarizing the development of the simplified instruction set over the past few decades. , which is another major advantage of the RISC-V instruction architecture.
但现有的采用RISC-V开源指令架构的通常采用单周期控制,由于一条指令从取指到写回的整个流程大多是组合逻辑,数据流会产生一定的延迟。同时,因该架构的处理器的总线控制相对复杂,总线传输延迟较大,使得在现有指令处理方式下进一步受总线速率的限制而出现系统性的制约,导致采用RISC-V开源指令架构的处理器的整体数据处理速率难以提升。However, the existing RISC-V open source instruction architecture usually adopts single-cycle control. Since the entire process of an instruction from fetching to writing back is mostly combinational logic, the data flow will cause a certain delay. At the same time, because the bus control of the processor with this architecture is relatively complex, and the bus transmission delay is relatively large, the existing instruction processing method is further restricted by the bus speed and there are systematic constraints, resulting in the adoption of RISC-V open source instruction architecture. The overall data processing rate of the processor is difficult to increase.
发明内容Contents of the invention
本申请提供基于FPGA的32位RISC-V处理器及电子设备,可以提高基于FPGA的32位RISC-V处理器的数据处理效率。The application provides an FPGA-based 32-bit RISC-V processor and electronic equipment, which can improve the data processing efficiency of the FPGA-based 32-bit RISC-V processor.
第一方面,本申请公开了一种基于FPGA的32位RISC-V处理器,所述处理器包括:至少一个软核,具有32位RISC-V架构;以及In a first aspect, the present application discloses an FPGA-based 32-bit RISC-V processor, the processor comprising: at least one soft core with a 32-bit RISC-V architecture; and
总线,与所述软核通信连接,用于与外部设备进行连接通信;A bus, connected to the soft core for communication with external devices;
其中,所述软核包括依次连接并形成五级流水线控制方式的取指模块、译码模块、执行模块、访存模块以及写回模块;Wherein, the soft core includes an instruction fetch module, a decoding module, an execution module, a memory access module and a write-back module connected in sequence to form a five-stage pipeline control mode;
所述总线包括总线控制器,所述总线控制器通过基于一主多从的总线控制方式,使得所述软核通过总线与外部设备进行连接通信;所述总线控制方式,至少包括:The bus includes a bus controller, and the bus controller enables the soft core to communicate with external devices through the bus through a bus control method based on one master and multiple slaves; the bus control method at least includes:
给外部设备预定义外部设备地址,所述外部设备地址用于作为所述外部设备的唯一访问标识;Predefining an external device address for the external device, where the external device address is used as a unique access identifier for the external device;
获取的总线地址信号,将所述总线地址信号与外部设备地址进行匹配;The obtained bus address signal is matched with the address of the external device;
根据匹配成功的外部设备地址确定对应的目标外部设备;Determine the corresponding target external device according to the successfully matched external device address;
访问所述目标外部设备并实现数据传输。Accessing the target external device and implementing data transfer.
在一实施例中,所述取指模块还包括:In one embodiment, the fetching module further includes:
预取指子模块,用于对读取进入所述软核的指令进行预处理。The prefetching submodule is used for preprocessing the instructions read into the soft core.
在一实施例中,所述预取指子模块,具体用于:In one embodiment, the prefetching submodule is specifically used for:
获取预处理指令中预设位置的比特位信息,根据所述比特位信息判断所述预处理指令是否为分支跳转指令;Obtaining bit information at a preset position in the preprocessing instruction, and judging whether the preprocessing instruction is a branch jump instruction according to the bit information;
若是,则产生跳转后的与所述预处理指令对应的指令地址,并对下一条预处理指令进行预读取。If yes, generate the jump instruction address corresponding to the preprocessing instruction, and prefetch the next preprocessing instruction.
在一实施例中,所述软核还包括:In one embodiment, the soft core also includes:
流水线控制模块,用于通过独热码进行流水线控制。Pipeline control module for pipeline control through one-hot encoding.
在一实施例中,所述取指模块、译码模块、执行模块、访存模块以及写回模块均设有使能端;In one embodiment, the instruction fetching module, the decoding module, the execution module, the memory access module and the write-back module are all provided with enabling terminals;
所述流水线控制模块与所述使能端进行连接,用于将独热码作为使能信号分别对取指模块、译码模块、执行模块、访存模块以及写回模块的通断控制。The pipeline control module is connected to the enabling terminal, and is used for using the one-hot code as an enabling signal to respectively control the on-off of the instruction fetch module, the decoding module, the execution module, the memory access module and the write-back module.
在一实施例中,所述总线地址信号中设有标记位,所述将所述总线地址信号与外部设备地址进行匹配,包括:In one embodiment, the bus address signal is provided with a flag bit, and the matching of the bus address signal with the external device address includes:
将所述总线地址信号中的标记位与外部设备地址进行匹配。A flag bit in the bus address signal is matched with an external device address.
在一实施例中,所述总线地址信号为8位信号,所述标记位为高四位。In one embodiment, the bus address signal is an 8-bit signal, and the flag bit is the upper four bits.
在一实施例中,所述访问所述目标外部设备并实现数据传输,包括:In an embodiment, the accessing the target external device and implementing data transmission includes:
当所述目标外部设备为RAM时,将软核的写使能信号传递为RAM的写使能信号;When the target external device is RAM, the write enable signal of the soft core is transferred as the write enable signal of RAM;
将RAM返回的数据赋值给总线作为输出,以传递给所述软核。The data returned by the RAM is assigned to the bus as an output to be passed to the soft core.
在一实施例中,所述总线还包括多路选择器,所述软核通过所述多路选择器与所述外部设备连接。In an embodiment, the bus further includes a multiplexer, and the soft core is connected to the external device through the multiplexer.
在一实施例中,所述外部设备至少包括ROM、RAM、UART以及GPIO的至少一个。In an embodiment, the external device at least includes at least one of ROM, RAM, UART and GPIO.
在一实施例中,所述软核还包括算数运算单元。In an embodiment, the soft core further includes an arithmetic operation unit.
本申请还包括一种基于FPGA的电子设备,所述电子设备包括如上任一项所述的基于FPGA的32位RISC-V处理器。The present application also includes an FPGA-based electronic device, which includes the FPGA-based 32-bit RISC-V processor described in any one of the above.
由上可知,本申请中的基于FPGA的32位RISC-V处理器及电子设备,通过五级流水线控制方式的软核配合对总线控制的改进设计,能够从系统整体的角度提升RISC-V处理器的数据处理效率,并且,采用RISC-V开源指令架构的32位五级流水线软核处理器部署在FPGA芯片后,通过总线和板载资源交互,可以迅速搭建SOC,提升研发效率。It can be seen from the above that the FPGA-based 32-bit RISC-V processor and electronic equipment in this application can improve the RISC-V processing from the perspective of the whole system through the soft core of the five-stage pipeline control mode and the improved design of the bus control. In addition, the 32-bit five-stage pipeline soft-core processor adopting the RISC-V open source instruction architecture is deployed behind the FPGA chip, and through the interaction between the bus and onboard resources, the SOC can be quickly built and the research and development efficiency can be improved.
附图说明Description of drawings
图1为本申请实施例提供的基于FPGA的32位RISC-V处理器的架构示意图。FIG. 1 is a schematic diagram of an architecture of an FPGA-based 32-bit RISC-V processor provided in an embodiment of the present application.
图2为本申请实施例提供的基于FPGA的32位RISC-V处理器的另一架构示意图。FIG. 2 is a schematic diagram of another architecture of an FPGA-based 32-bit RISC-V processor provided by an embodiment of the present application.
图3为本申请实施例提供的部分总线结构图。FIG. 3 is a partial bus structure diagram provided by the embodiment of the present application.
图4为本申请实施例提供的总线控制方法的时序示意图。FIG. 4 is a schematic timing diagram of a bus control method provided by an embodiment of the present application.
图5为本申请实施例提供的电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面结合附图和实施例对本申请的技术方案做进一步的说明。The technical solution of the present application will be further described below in conjunction with the drawings and embodiments.
请参阅图1,图中示出了本申请实施例提供的一种基于FPGA的32位RISC-V处理器的架构。Please refer to FIG. 1 , which shows the architecture of an FPGA-based 32-bit RISC-V processor provided by an embodiment of the present application.
其中,基于FPGA的32位RISC-V处理器包括至少一个软核1以及与软核1通信连接的总线2。Wherein, the FPGA-based 32-bit RISC-V processor includes at least one soft core 1 and a bus 2 communicating with the soft core 1 .
该软核1可以具有32位RISC-V架构,具体的可以采用RISC-V开源指令架构子集RV32I指令集设计的软核1;该软核1基于FPGA硬件,通过在FPGA的硬件基础上利用总线2和板载资源进行交互以实现迅速构建SOC的目的。The soft core 1 may have a 32-bit RISC-V architecture, specifically the soft core 1 designed using the RISC-V open source instruction architecture subset RV32I instruction set; the soft core 1 is based on the FPGA hardware, by using Bus 2 interacts with onboard resources to achieve the purpose of rapidly building an SOC.
该总线2用于与外部设备进行连接通信;其中,外部设备可以包括ROM(Read-OnlyMemory,只读存储器)、RAM(random access memory,随机存取存储器)、UART(UniversalAsynchronous Receiver/Transmitter,通用异步收发器)以及GPIO(General-purposeinput/output,通用输入/输出端口)的至少一个。其中,常见的外部设备至少包括ROM与RAM,还可以挂载其他通信接口或者通信模块,抑或是其他功能模块,本申请在此不进行限定。The bus 2 is used to connect and communicate with external devices; where the external devices can include ROM (Read-Only Memory, read-only memory), RAM (random access memory, random access memory), UART (Universal Asynchronous Receiver/Transmitter, universal asynchronous Transceiver) and at least one of GPIO (General-purpose input/output, general-purpose input/output port). Among them, common external devices include at least ROM and RAM, and other communication interfaces or communication modules, or other functional modules may also be mounted, which are not limited in this application.
其中,该软核1包括依次连接并形成五级流水线控制方式的取指模块11、译码模块12、执行模块13、访存模块14以及写回模块15,上述模块之间通过构件五级流水线控制方式,指令经由总线2传递至取指部分,再由译码模块12翻译,经过执行,再决定是否需要访存和写回。本申请通过将处理周期进行分解,从而获得更高的指令或数据的处理速度,减少不同指令或数据的资源占用不同导致的延迟过大的问题。具体的,在处理指令的过程中,若第一指令经取指模块11的取指后,可以转入到译码模块12执行译码阶段的动作,此时取指模块11可以对下一指令进行取指动作。通过上述分级方式,可以实现在有限的硬件资源下提升指令的处理效率。Among them, the soft core 1 includes an instruction fetch module 11, a decoding module 12, an execution module 13, a memory access module 14, and a write-back module 15 that are sequentially connected to form a five-stage pipeline control mode. In the control mode, the instruction is transmitted to the instruction fetching part through the bus 2, and then translated by the decoding module 12, and after execution, it is determined whether memory access and write-back are required. The present application decomposes the processing cycle to obtain higher instruction or data processing speed and reduce the problem of excessive delay caused by different instruction or data resource occupation. Specifically, in the process of processing instructions, if the first instruction is fetched by the instruction fetching module 11, it can be transferred to the decoding module 12 to perform the actions in the decoding stage. Perform finger fetching action. Through the above-mentioned hierarchical manner, the processing efficiency of instructions can be improved under limited hardware resources.
请结合图2,图中示出了本申请实施例提供的基于FPGA的32位RISC-V处理器的另一架构。Please refer to FIG. 2 , which shows another architecture of the FPGA-based 32-bit RISC-V processor provided by the embodiment of the present application.
如图2所示,软核1的流水线组成主要由取指模块、译码模块、执行模块、访存模块以及写回五个模块构成,同时参与构成处理器的软核1的还有寄存器堆、控制状态寄存器、各个级间缓存、冲突仲裁模块、多路选择器、程序计数器以及控制流水线阻塞的流水线控制模块,还有进行中断控制仲裁的中断模块。As shown in Figure 2, the pipeline of soft core 1 is mainly composed of five modules: instruction fetch module, decoding module, execution module, memory access module and write back, and the register file is also involved in the formation of soft core 1 of the processor. , control status register, each inter-stage cache, conflict arbitration module, multiplexer, program counter, pipeline control module for controlling pipeline blocking, and interrupt module for interrupt control arbitration.
其中,该级间缓存包括取指译码级间缓存、译码执行级间缓存、执行访存级间缓存以及访存写回级间缓存,不同的级间缓存用于存储经上一模块处理后获得的指令信息。Among them, the inter-level cache includes instruction fetch and decoding inter-level cache, decoding execution inter-level cache, execution memory access inter-level cache, and memory access and write-back inter-level cache. Different inter-level caches are used to store data processed by the previous module. command information obtained later.
在一实施例中,该流水线控制模块用于通过独热码进行流水线控制。该流水线控制方式以独热码的形式,分别对各个流水级进行通断控制,该独热码可以减少信号跳变过程的出错概率,并且设立流水线控制模块可以对各个流水级的工作进行协调,提高指令的处理效率。In one embodiment, the pipeline control module is used for pipeline control through one-hot encoding. The pipeline control method uses one-hot code to control the on-off of each pipeline stage respectively. The one-hot code can reduce the error probability of the signal jump process, and the pipeline control module can be set up to coordinate the work of each pipeline stage. Improve the processing efficiency of instructions.
进一步的,取指模块、译码模块、执行模块、访存模块以及写回模块均设有使能端,该流水线控制模块与所述使能端进行连接,用于将独热码作为使能信号分别对取指模块、译码模块、执行模块、访存模块以及写回模块的通断控制。相比于传统设计中在每一级流水中单独添加流水级通断控制的使能信号,通过设置流水线控制模块的方式能够减少硬件资源的占用。Further, the instruction fetching module, the decoding module, the execution module, the memory access module and the write-back module are all provided with an enabling terminal, and the pipeline control module is connected to the enabling terminal for using the one-hot code as an enabling terminal. The signals respectively control the on-off of the instruction fetch module, the decoding module, the execution module, the memory access module and the write-back module. Compared with the traditional design of separately adding the enable signal of the on-off control of the pipeline level in each level of pipeline, the occupation of hardware resources can be reduced by setting the pipeline control module.
在另一实施例中,取指模块还可以包括预取指子模块,该预取指子模块用于对读取进入软核1的指令进行预处理。其中,这里的预处理包括对下一条指令进行预读取,也包括对需要跳转的指令地址进行预生成。通过预取指子模块可以提前对指令的分支跳转指令进行预处理,能够进一步提升后续指令的处理与执行效率,进而提升处理器的处理效率。In another embodiment, the instruction fetching module may further include a prefetching submodule for preprocessing the instructions read into the soft core 1 . Wherein, the preprocessing here includes pre-reading the next instruction, and also includes pre-generating the address of the instruction that needs to jump. The pre-fetching sub-module can preprocess the branch and jump instructions of the instruction in advance, which can further improve the processing and execution efficiency of subsequent instructions, thereby improving the processing efficiency of the processor.
具体的,该预取指子模块,具体用于:获取预处理指令中预设位置的比特位信息,根据比特位信息判断预处理指令是否为分支跳转指令;若是,则产生跳转后的与预处理指令对应的指令地址,并对下一条预处理指令进行预读取。Specifically, the prefetching submodule is specifically used to: obtain bit information of a preset position in the preprocessing instruction, and judge whether the preprocessing instruction is a branch jump instruction according to the bit information; if so, generate a jump instruction The instruction address corresponding to the preprocessing instruction, and prefetch the next preprocessing instruction.
其中,在五级流水线结构的处理器的软核1中,一条指令的执行至少需要五个时钟周期,对于分支跳转指令,如果等待其执行完毕后再去取下一条指令,显然会浪费多个时钟,而通过引入预取指子模块,不论是否发生分支跳转,都会提前将下一条指令从指令寄存器中读取出来,交由下一流水级使用,从而提升了流水线的吞吐率。Among them, in the soft core 1 of the processor of the five-stage pipeline structure, the execution of an instruction needs at least five clock cycles. For the branch jump instruction, if you wait for the execution to finish and then fetch the next instruction, it will obviously waste a lot of time. By introducing the prefetch sub-module, regardless of whether a branch jump occurs, the next instruction will be read from the instruction register in advance and handed over to the next pipeline stage for use, thereby improving the throughput of the pipeline.
在一实施例中,总线2包括总线控制器,该总线控制器通过基于一主多从的总线2控制方式,使得软核1通过总线2与外部设备进行连接通信。该总线2控制方式,至少包括:In an embodiment, the bus 2 includes a bus controller, and the bus controller enables the soft core 1 to communicate with external devices through the bus 2 through a bus 2 control method based on a master and multiple slaves. The bus 2 control method at least includes:
给外部设备预定义外部设备地址,该外部设备地址用于作为外部设备的唯一访问标识;获取的总线2地址信号,将总线2地址信号与外部设备地址进行匹配;根据匹配成功的外部设备地址确定对应的目标外部设备;访问目标外部设备并实现数据传输。Predefine the external device address for the external device, which is used as the unique access identifier of the external device; obtain the bus 2 address signal, match the bus 2 address signal with the external device address; determine according to the successfully matched external device address The corresponding target external device; accessing the target external device and realizing data transmission.
其中,该外部设备可以包括ROM、RAM、UART以及GPIO的至少一个。例如,常见的外部设备至少包括ROM与RAM,还可以挂载其他通信接口或者通信模块,抑或是其他功能模块,本申请在此不进行限定。Wherein, the external device may include at least one of ROM, RAM, UART and GPIO. For example, common external devices include at least ROM and RAM, and can also be mounted with other communication interfaces or communication modules, or other functional modules, which are not limited in this application.
该一主多从的总线2控制方式,即处理器的软核1作为主机,其他外部设备作为从机。处理器的软核1拥有对总线2的控制权,通过对外部设备分配唯一且固定的地址,完成对特定外部设备的访问。The one-master-multiple-slave bus 2 control mode, that is, the soft core 1 of the processor acts as the master, and other external devices act as slaves. The soft core 1 of the processor has control over the bus 2, and completes access to specific external devices by assigning unique and fixed addresses to the external devices.
具体的,给外部设备预定义外部设备地址,可以是在外部设备与处理器进行连接通信后,处理器执行相应的程序给外部设备分配一个能用于通信的外部设备地址,例如:0x0000_0000对应外围设备中的ROM;0x1000_0000对应外围设备中的RAM;0x2000_0000对应外围设备中的UART;0x3000_0000对应外围设备中的GPIO。上述方式仅用于示例,实际上可以根据需要进行地址设置,并将该地址与外部设备进行绑定。Specifically, the external device address is predefined for the external device. After the external device communicates with the processor, the processor executes the corresponding program to assign an external device address that can be used for communication to the external device, for example: 0x0000_0000 corresponds to the peripheral ROM in the device; 0x1000_0000 corresponds to the RAM in the peripheral; 0x2000_0000 corresponds to the UART in the peripheral; 0x3000_0000 corresponds to the GPIO in the peripheral. The above method is only used as an example, in fact, the address can be set as required, and the address can be bound with the external device.
在一些实施例中,自定义总线2的位宽为16位,用高四位表示处理器控制的从设备的地址,而在本实施例中可以挂载四个外部设备,实际使用中可根据具体情况,分配额外的外设地址以完成对其他外部设备的控制。具体的外部设备控制方式为,RISC-V处理器的软核1通过系统自定义的总线2,同时各种外围设备能且只能响应从处理器的软核1发出的各种命令,因而每个外围设备都要预先定义一个固定的地址以作为处理器的软核1对该指定外围设备的特定访问标识。In some embodiments, the bit width of the custom bus 2 is 16 bits, and the upper four bits are used to represent the address of the slave device controlled by the processor. In this embodiment, four external devices can be mounted. In actual use, the Specifically, allocate additional peripheral addresses to complete the control of other external devices. The specific external device control method is that the soft core 1 of the RISC-V processor passes through the system-defined bus 2, and various peripheral devices can and can only respond to various commands issued from the soft core 1 of the processor. Each peripheral device must pre-define a fixed address as the specific access identification of the designated peripheral device by the soft core 1 of the processor.
本实施例中,结合图3-4,图中示出了本申请实施例提供的部分总线结构及总线控制方法的时序。In this embodiment, with reference to FIGS. 3-4 , the figures show a part of the bus structure and the timing sequence of the bus control method provided by the embodiment of the present application.
其中,如图3所示,该总线结构可以采用多路选择器(MUX)的控制方式实现,包括输入多路选择器以及输出多路选择器,其中,输入多路选择器与软核输入通道连接,并与只读存储器(ROM)、随机存取存储器(RAM)、通用异步收发器(UART)以及通用输入/输出端口(GPIO)连接。输出多路选择器与软核输出通道连接,并与只读存储器(ROM)、随机存取存储器(RAM)、通用异步收发器(UART)以及通用输入/输出端口(GPIO)连接。当然,也可以采用其他总线结构,本申请对此不做限定。Among them, as shown in Figure 3, the bus structure can be realized by using a multiplexer (MUX) control method, including an input multiplexer and an output multiplexer, wherein the input multiplexer and the soft-core input channel Connect and interface with read-only memory (ROM), random-access memory (RAM), universal asynchronous transceiver (UART), and general-purpose input/output ports (GPIO). The output multiplexer interfaces with the soft core output channels and interfaces with read-only memory (ROM), random-access memory (RAM), universal asynchronous transceiver (UART), and general-purpose input/output ports (GPIO). Of course, other bus structures may also be used, which is not limited in this application.
自定义总线为外部设备分配的地址空间:0x0000_0000对应外围设备中的ROM;0x1000_0000对应外围设备中的RAM;0x2000_0000对应外围设备中的UART;0x3000_0000对应外围设备中的GPIO。根据地址空间分配可以清晰看出,总线根据地址的高四位的值就可以分辨出处理器的软核所访问的具体外部设备。The address space allocated by the custom bus for external devices: 0x0000_0000 corresponds to the ROM in the peripheral device; 0x1000_0000 corresponds to the RAM in the peripheral device; 0x2000_0000 corresponds to the UART in the peripheral device; 0x3000_0000 corresponds to the GPIO in the peripheral device. According to the allocation of address space, it can be clearly seen that the bus can distinguish the specific external device accessed by the soft core of the processor according to the value of the upper four bits of the address.
如图4所示,其中,系统信号包括系统时钟信号(sys_clk)以及系统总线地址信号(cpu_sysbus_addr),当总线仲裁模块的32位处理器的软核到系统总线地址信号(cpu_sysbus_addr)输入的高四位为4’h0000时,访问的外围设备为ROM,此时将ROM返回的数据(rom_data)赋值给系统总线数据输出信号(cpu_sysbus_data_o)作为输出;当总线仲裁模块的32位处理器的软核到系统总线地址信号(cpu_sysbus_addr)输入的高四位为4’h0001(或写为32’h0001)时,访问的外围设备为RAM,此时将软核的处理器写使能信号(cpu_sysbus_wen)传递给RAM的随机存取存储器写使能信号(ram_wen),同时将RAM返回的随机存取存储器数据信号(ram_data)赋值给系统总线数据输出信号(cpu_sysbus_data_o)作为输出;当总线仲裁模块的32位处理器的软核到系统总线地址信号(cpu_sysbus_addr)输入的高四位为4’h0002和4’h0003时分别为对UART和GPIO的控制,控制方式于上述两种外部设备完全相同,不再赘述。进一步的,由于16位自定义总线地址具体访问的外设由最高四位决定,因此本申请中自定义总线最多可以实现16个从属设备的拓展。As shown in Figure 4, the system signals include the system clock signal (sys_clk) and the system bus address signal (cpu_sysbus_addr), when the soft core of the 32-bit processor of the bus arbitration module enters the high four When the bit is 4'h0000, the accessed peripheral device is ROM. At this time, the data returned by ROM (rom_data) is assigned to the system bus data output signal (cpu_sysbus_data_o) as output; when the soft core of the 32-bit processor of the bus arbitration module arrives When the upper four bits of the system bus address signal (cpu_sysbus_addr) input are 4'h0001 (or written as 32'h0001), the peripheral device to be accessed is RAM, and the processor write enable signal (cpu_sysbus_wen) of the soft core is passed to The random access memory write enable signal (ram_wen) of the RAM, and at the same time assign the random access memory data signal (ram_data) returned by the RAM to the system bus data output signal (cpu_sysbus_data_o) as an output; when the 32-bit processor of the bus arbitration module When the upper four bits of the soft core to the system bus address signal (cpu_sysbus_addr) input are 4'h0002 and 4'h0003, they control the UART and GPIO respectively. The control method is exactly the same as the above two external devices, and will not be described again. Further, since the peripherals specifically accessed by the 16-bit custom bus address are determined by the highest four bits, the custom bus in this application can realize expansion of up to 16 slave devices.
可以理解的,上述指令地址的识别与匹配方式仅是其中一种实现方式,本领域技术人员可以根据实际情况对上述参数进行自定义,以确保总线地址信号与外部设备的外设地址进行匹配即可。上述总线设计与总线控制方法,通过简单的输入输出和仅由简单的组合逻辑进行控制使得本申请中自定义总线在实际应用中综合出来的电路具有面积小,节约资源,去冗余化的特点,能够节约下来的足够多的FPGA片上资源来进行实际应用中其他功能的实现。It can be understood that the identification and matching method of the above instruction address is only one of the implementation methods, and those skilled in the art can customize the above parameters according to the actual situation, so as to ensure that the bus address signal matches the peripheral address of the external device. Can. The above-mentioned bus design and bus control method, through simple input and output and only simple combinational logic control, make the circuit synthesized by the self-defined bus in this application have the characteristics of small area, resource saving, and de-redundancy , can save enough resources on the FPGA chip to implement other functions in practical applications.
并且,处理器的软核从指令寄存器取指需要通过总线的交互,由于本申请的处理器是在FPGA上搭建,因此采用FPGA板载的ROM作为指令寄存器,采用FPGA板载RAM作为处理器的软核的高速缓存,为了完成处理器的软核与外部的交互通信,在总线上挂载了UART控制器便于将CPU总线的并行数据转换为串行数据,再发送至其他设备的UART接收端。由于本申请中SOC面积相对而言比较小,因此在一些工业控制领域,可以在一个FPGA芯片上部署多个处理器的软核,并借由总线上的串口进行多核间的数据交互。Moreover, the soft core of the processor needs to interact with the bus to fetch instructions from the instruction register. Since the processor of this application is built on the FPGA, the ROM on the FPGA board is used as the instruction register, and the RAM on the FPGA board is used as the processor. The cache of the soft core, in order to complete the interactive communication between the soft core of the processor and the outside, a UART controller is mounted on the bus to convert the parallel data of the CPU bus into serial data, and then send it to the UART receiving end of other devices . Since the SOC area in this application is relatively small, in some industrial control fields, the soft cores of multiple processors can be deployed on one FPGA chip, and the data exchange between multiple cores can be performed through the serial port on the bus.
由上可知,本申请的基于FPGA的32位RISC-V处理器,通过五级流水线控制方式的软核配合对总线控制的改进设计,能够从系统整体的角度提升RISC-V处理器的数据处理效率,并且,采用RISC-V开源指令架构的32位五级流水线软核处理器部署在FPGA芯片后,通过总线和板载资源交互,可以迅速搭建SOC,提升研发效率。It can be seen from the above that the FPGA-based 32-bit RISC-V processor of the present application can improve the data processing of the RISC-V processor from the perspective of the whole system through the soft core of the five-stage pipeline control mode and the improved design of the bus control. In addition, the 32-bit five-stage pipeline soft-core processor adopting the RISC-V open source instruction architecture is deployed behind the FPGA chip, and through the interaction between the bus and onboard resources, the SOC can be quickly built to improve the efficiency of research and development.
请参阅图5,图中示出了本申请实施例提供的电子设备的结构,该结构中的电子设备100包括如上任意一项所述的基于FPGA的32位RISC-V处理器10。Please refer to FIG. 5 , which shows the structure of the electronic device provided by the embodiment of the present application. The electronic device 100 in this structure includes the FPGA-based 32-bit RISC-V processor 10 described above.
该基于FPGA的32位RISC-V处理器10可以根据存储在存储器的程序,也即可以是根据存储在只读存储器(Read-Only Memory,ROM)中的程序或者从存储部分加载到随机存取存储器(Random Access Memory,RAM)中的程序而执行各种适当的动作和处理,例如执行上述实施例中的方法:This FPGA-based 32-bit RISC-V processor 10 can be based on the program stored in the memory, that is, according to the program stored in the read-only memory (Read-Only Memory, ROM) or loaded from the storage part to random access memory (Random Access Memory, RAM) to perform various appropriate actions and processing, such as performing the method in the above-mentioned embodiment:
给外部设备预定义外部设备地址,所述外部设备地址用于作为所述外部设备的唯一访问标识;获取的总线地址信号,将所述总线地址信号与外部设备地址进行匹配;根据匹配成功的外部设备地址确定对应的目标外部设备;访问所述目标外部设备并实现数据传输。Predefine an external device address for the external device, and the external device address is used as a unique access identifier for the external device; obtain the bus address signal, and match the bus address signal with the external device address; The device address determines the corresponding target external device; accesses the target external device and realizes data transmission.
在RAM中,还存储有系统操作所需的各种程序和数据。基于FPGA的32位RISC-V处理器10、存储器与通过总线彼此相连。输入/输出(Input/Output,I/O)接口也连接至总线。In RAM, various programs and data necessary for system operation are also stored. The FPGA-based 32-bit RISC-V processor 10, the memory, and the bus are connected to each other. Input/Output (I/O) interfaces are also connected to the bus.
在一些实施例中,以下部件可以连接至I/O接口:包括键盘、鼠标等的输入部分;包括诸如液晶显示器(Liquid Crystal Display,LCD)等以及扬声器等的输出部分;包括硬盘等的存储部分;以及包括诸如LAN(Local AreaNetwork,局域网)卡、调制解调器等的网络接口卡的通信部分。通信部分经由诸如因特网的网络执行通信处理。In some embodiments, the following components can be connected to the I/O interface: an input section including a keyboard, a mouse, etc.; an output section including a liquid crystal display (Liquid Crystal Display, LCD) etc. and a speaker; a storage section including a hard disk, etc. ; and a communication part including a network interface card such as a LAN (Local Area Network, local area network) card, a modem, or the like. The communication section performs communication processing via a network such as the Internet.
由上可知,本申请的基于FPGA的电子设备,能够从系统整体的角度提升RISC-V处理器的数据处理效率,并且,采用RISC-V开源指令架构的32位五级流水线软核处理器部署在FPGA芯片后,通过总线和板载资源交互,可以迅速搭建SOC,提升研发效率。It can be seen from the above that the FPGA-based electronic device of the present application can improve the data processing efficiency of the RISC-V processor from the perspective of the overall system, and adopt the 32-bit five-stage pipeline soft-core processor deployment of the RISC-V open source instruction architecture After the FPGA chip, through the interaction between the bus and onboard resources, the SOC can be quickly built to improve the efficiency of research and development.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The occurrences of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is understood explicitly and implicitly by those skilled in the art that the embodiments described herein can be combined with other embodiments.
在本申请的描述中,需要说明的是,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接或可以相互通讯;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通或两个元件的相互作用关系。对于本领域的普通技术人员而言,可以根据具体情况理解上述术语在本申请中的具体含义。In the description of this application, it should be noted that unless otherwise specified and limited, the terms "installation", "connection", and "connection" should be understood in a broad sense, for example, it can be a fixed connection or a detachable connection. Connected, or integrally connected; it can be mechanically connected, or electrically connected, or can communicate with each other; it can be directly connected, or indirectly connected through an intermediary, and it can be the internal communication of two components or the interaction of two components relation. Those of ordinary skill in the art can understand the specific meanings of the above terms in this application according to specific situations.
显然,本申请的上述实施例仅仅是为清楚地说明本申请所作的举例,而并非是对本申请的建设完成方式的限定。对于所属领域的普通技术人员来说,在上述说明的基础上还可以做出其它不同形式的变化或变动。这里无需也无法对所有的建设完成方式予以穷举。凡在本申请的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本申请权利要求的保护范围之内。Apparently, the above-mentioned embodiments of the present application are only examples for clearly illustrating the present application, rather than limiting the way of completing the construction of the present application. For those of ordinary skill in the art, other changes or changes in different forms can be made on the basis of the above description. It is not necessary and impossible to exhaustively list all construction completion methods here. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included within the protection scope of the claims of the present application.
Claims (12)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310725778.8A CN116450570B (en) | 2023-06-19 | 2023-06-19 | FPGA-based 32-bit RISC-V processors and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310725778.8A CN116450570B (en) | 2023-06-19 | 2023-06-19 | FPGA-based 32-bit RISC-V processors and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116450570A true CN116450570A (en) | 2023-07-18 |
CN116450570B CN116450570B (en) | 2023-10-17 |
Family
ID=87124169
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310725778.8A Active CN116450570B (en) | 2023-06-19 | 2023-06-19 | FPGA-based 32-bit RISC-V processors and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116450570B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5430862A (en) * | 1990-06-29 | 1995-07-04 | Bull Hn Information Systems Inc. | Emulation of CISC instructions by RISC instructions using two pipelined stages for overlapped CISC decoding and RISC execution |
US5781753A (en) * | 1989-02-24 | 1998-07-14 | Advanced Micro Devices, Inc. | Semi-autonomous RISC pipelines for overlapped execution of RISC-like instructions within the multiple superscalar execution units of a processor having distributed pipeline control for speculative and out-of-order execution of complex instructions |
US6738892B1 (en) * | 1999-10-20 | 2004-05-18 | Transmeta Corporation | Use of enable bits to control execution of selected instructions |
CN102063290A (en) * | 2010-12-23 | 2011-05-18 | 中国科学院苏州纳米技术与纳米仿生研究所 | Systematized RISC CPU (Reduced Instruction-Set Computer Central Processing unit) production line control method |
CN103984530A (en) * | 2014-05-15 | 2014-08-13 | 中国航天科技集团公司第九研究院第七七一研究所 | Assembly line structure and method for improving execution efficiency of store command |
CN105830054A (en) * | 2013-10-31 | 2016-08-03 | 斯利肯泰勒有限公司 | Pipelined configurable processor |
CN110781119A (en) * | 2019-10-22 | 2020-02-11 | 广东高云半导体科技股份有限公司 | I2C bus expansion interface, control method thereof and system on chip |
CN111008101A (en) * | 2019-10-18 | 2020-04-14 | 苏州浪潮智能科技有限公司 | Debugging verification platform and testing method of RISC-V processor system |
-
2023
- 2023-06-19 CN CN202310725778.8A patent/CN116450570B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5781753A (en) * | 1989-02-24 | 1998-07-14 | Advanced Micro Devices, Inc. | Semi-autonomous RISC pipelines for overlapped execution of RISC-like instructions within the multiple superscalar execution units of a processor having distributed pipeline control for speculative and out-of-order execution of complex instructions |
US5430862A (en) * | 1990-06-29 | 1995-07-04 | Bull Hn Information Systems Inc. | Emulation of CISC instructions by RISC instructions using two pipelined stages for overlapped CISC decoding and RISC execution |
US6738892B1 (en) * | 1999-10-20 | 2004-05-18 | Transmeta Corporation | Use of enable bits to control execution of selected instructions |
CN102063290A (en) * | 2010-12-23 | 2011-05-18 | 中国科学院苏州纳米技术与纳米仿生研究所 | Systematized RISC CPU (Reduced Instruction-Set Computer Central Processing unit) production line control method |
CN105830054A (en) * | 2013-10-31 | 2016-08-03 | 斯利肯泰勒有限公司 | Pipelined configurable processor |
CN103984530A (en) * | 2014-05-15 | 2014-08-13 | 中国航天科技集团公司第九研究院第七七一研究所 | Assembly line structure and method for improving execution efficiency of store command |
CN111008101A (en) * | 2019-10-18 | 2020-04-14 | 苏州浪潮智能科技有限公司 | Debugging verification platform and testing method of RISC-V processor system |
CN110781119A (en) * | 2019-10-22 | 2020-02-11 | 广东高云半导体科技股份有限公司 | I2C bus expansion interface, control method thereof and system on chip |
Non-Patent Citations (2)
Title |
---|
PHANGESTU, A.E 等: "Five-Stage Pipelined 32-Bit RISC-V Base Integer Instruction Set Architecture Soft Microprocessor Core in VHDL", 《 2022 INTERNATIONAL SEMINAR ON INTELLIGENT TECHNOLOGY AND ITS APPLICATIONS (ISITIA)》, pages 304 - 309 * |
刘先强: "基于RISC-V的五级流水线处理器的设计与研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, no. 12, pages 15 * |
Also Published As
Publication number | Publication date |
---|---|
CN116450570B (en) | 2023-10-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7062587B2 (en) | Unidirectional bus architecture for SoC applications | |
US10437739B2 (en) | Low-latency accelerator | |
CN109154924B (en) | Multiple uplink port devices | |
JP6311164B2 (en) | Integration component interconnect | |
CN106815151B (en) | High Performance Interconnect Coherent Protocol | |
US7958298B2 (en) | System and method for providing address decode and virtual function (VF) migration support in a peripheral component interconnect express (PCIE) multi-root input/output virtualization (IOV) environment | |
KR101964350B1 (en) | Multiple register memory access instructions, processors, methods, and systems | |
KR101814412B1 (en) | Providing snoop filtering associated with a data buffer | |
CN111400986B (en) | Integrated circuit computing equipment and computing processing system | |
US8055805B2 (en) | Opportunistic improvement of MMIO request handling based on target reporting of space requirements | |
CN110806899B (en) | Assembly line tight coupling accelerator interface structure based on instruction extension | |
CN112631657B (en) | Byte comparison method for character string processing and instruction processing device | |
JP2003296191A (en) | Integrated circuit operable as general purpose processor and processor of peripheral device | |
CN107391400A (en) | A kind of memory expanding method and system for supporting complicated access instruction | |
JP2001092662A (en) | Processor core and processor using the same | |
CN101097559A (en) | A system and method for realizing interface and interconnection between main processor and coprocessor | |
JPH0359749A (en) | Bus controller | |
JPH0135367B2 (en) | ||
US20030023794A1 (en) | Cache coherent split transaction memory bus architecture and protocol for a multi processor chip device | |
CN102184290A (en) | Cycle accurate and bit accurate system level model for embedded micro-processor | |
US6738837B1 (en) | Digital system with split transaction memory access | |
JPH07200457A (en) | Computer system | |
US8843728B2 (en) | Processor for enabling inter-sequencer communication following lock competition and accelerator registration | |
CN112256331B (en) | Virtual machine instruction parsing acceleration method, device and computer storage medium | |
CN116450570B (en) | FPGA-based 32-bit RISC-V processors and electronic equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |