An instruction acceleration device and method based on FPGA

By combining the FPGA circuit with the RISC-V soft core, choosing to use the FPGA or CPU computing channel, and instantiating high-frequency code segments through the code matching unit, the problem of low computing efficiency of the RISC-V processor in complex computing scenarios is solved. It accelerates specific computing tasks without increasing the number of CPU circuit gates.

CN118409797BActive Publication Date: 2024-09-17EHIWAY MICROELECTRONIC SCI & TECH (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410850410.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-09-17
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

Existing RISC-V processors have low computing efficiency in complex computing scenarios, and expanding dedicated computing units increases the number of CPU circuit gates, resulting in a bloated CPU that cannot achieve instruction acceleration based on the original code.

Method used

The FPGA circuit is combined with the RISC-V soft core to collect instructions through the bus control unit. The instruction hit detection unit cooperates with the channel switching unit to select the FPGA circuit or CPU calculation channel, and the code matching unit identifies the high-frequency code segment and instantiates it as FPGA circuit to achieve data calculation acceleration.

Benefits of technology

Without modifying the original RISC-V instruction set and code, the FPGA circuit computing unit is added to improve computing efficiency, reduce the number of CPU circuit gates, and accelerate specific computing tasks, and the circuit mapping table is continuously improved through the code matching unit. Improve fast computing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118409797B
    Figure CN118409797B
Patent Text Reader

Abstract

The present invention provides an instruction acceleration device based on FPGA, including a RISC-V soft core and a DDR memory that use a bus for signal transmission, a bus control unit connected to the bus, and the bus control unit collects RISC-V instructions issued by the RISC-V soft core; an instruction hit detection unit that receives the RISC-V instructions transmitted by the bus control unit, and retrieves and matches the RISC-V instruction access address with the instruction address in the code circuit mapping table; and a channel switching unit that selects to open an FPGA circuit calculation channel or a RISC-V soft core CPU calculation channel according to the RISC-V instruction access address hitting the instruction address in the code circuit mapping table. The beneficial effect of this technical solution is that, without changing the original RISC-V instruction set, unique computing requirements can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of processors, and in particular relates to an instruction acceleration device and method based on FPGA. Background Art

[0002] RISC-V is an open instruction set architecture (ISA) based on the principle of reduced instruction set computing (RISC). It has the advantages of simple architecture and small number of instructions. Although the RISC-V basic instruction set has only more than 40 instructions, it can be combined in a modular way to meet various application scenarios through a unified architecture. Users can flexibly choose different module combinations to meet the needs of their own customized devices.

[0003] In the prior art, RISC-V performs calculations mostly by using the CPU in the RISC-V soft core to identify the data stored in the DDR memory according to the RISC-V instructions and perform calculations on the read data. For the specific structure, see Figure 2 This calculation method requires the CPU to perform operations, and the complex calculation modules collected in the CPU will cause the CPU to become bloated.

[0004] At the same time, RISC-V implements complex instructions by the collaborative work of multiple simple instructions. Its arithmetic logic unit ALU is also a general addition, subtraction, and, or unit. In some computing scenarios, there is a problem of low computing efficiency. Therefore, some architectures with dedicated instruction sets have emerged, such as the multiplication and accumulation instructions and modulo addressing instructions and bit reversal instructions in DSP, which are widely used in convolution, dot product, FFT, etc. Dedicated computing units have a faster computing speed than instruction set calculations. However, the existing technical solutions for expanding dedicated computing units have the following defects: 1) Adding dedicated computing units using new instructions can solve some problems and improve computing performance. However, the addition of new instructions is very dependent on the cooperation of the supporting compiler and the programmer's full understanding of the instructions. It is impossible to realize the acceleration function of some instructions based on the original code. 2) Some complex circuit computing units can use dedicated circuit computing units for calculation, but it is difficult to make them into separate computing units such as adders and multipliers, and incorporate them into the existing instruction set. This computing unit will greatly increase the number of circuit gates of the CPU, causing the CPU to be bloated.

[0005] Therefore, it is necessary to develop a new instruction acceleration device and method that can accelerate some instructions without increasing the CPU area and based on the original code. Summary of the invention

[0006] The present invention provides an instruction acceleration device and method for FPGA, which can accelerate instructions without modifying codes.

[0007] Other purposes and advantages of the present invention can be further understood from the technical features disclosed in the present invention.

[0008] To achieve one or part or all of the above purposes or other purposes, a technical solution of the present invention provides an instruction acceleration device based on FPGA, including a RISC-V soft core and a DDR memory that use a bus for signal transmission, and also includes: a bus control unit connected to the bus, the bus control unit collects RISC-V instructions issued by the RISC-V soft core; an instruction hit detection unit, receiving the RISC-V instructions transmitted by the bus control unit, and searching and matching the RISC-V instruction access address with the instruction address in the code circuit mapping table; a channel switching unit, according to the RISC-V instruction access address hitting the instruction address in the code circuit mapping table, selects to open the FPGA circuit calculation channel or the RISC-V soft core CPU calculation channel. The beneficial effect of this technical solution is that the FPGA circuit is used to calculate the data corresponding to the frequently accessed address in the code circuit mapping table, and the FPGA circuit can add a new circuit calculation unit, which can achieve unique calculation requirements without changing the original RISC-V instruction set.

[0009] The channel switching unit is connected to the instruction hit detection unit signal; the RISC-V instruction access address hits the instruction address in the code circuit mapping table, and the channel switching unit opens the FPGA circuit calculation channel to calculate the data in the RISC-V instruction; the RISC-V instruction access address does not hit the instruction address in the code circuit mapping table, and the channel switching unit opens the RISC-V soft core CPU calculation channel to read the data in the DDR memory and calculate.

[0010] The RISC-V instruction access address hits the instruction address in the code circuit mapping table, the instruction hit detection unit gives the FPGA circuit storage address corresponding to the RISC-V instruction access address in the code circuit mapping table, and the FPGA circuit storage unit in the FPGA circuit mapping unit uses the FPGA circuit corresponding to the FPGA circuit storage address to calculate the data in the RISC-V instruction.

[0011] The instruction acceleration device also includes a read-back and write-back unit; when the FPGA circuit calculation channel is turned on, the read-back unit reads the RISC-V soft core register data, DDR memory data and calculation site required for calculation; when the FPGA circuit calculation channel is turned off, the write-back unit writes the FPGA circuit calculation result into the data area of ​​the DDR memory and / or the RISC-V soft core register, and restores the calculation site.

[0012] When the FPGA circuit calculation channel is opened, the readback unit reads data from the RISC-V register or the DDR source memory address to the temporary memory specified address of the FPGA calculation unit, and the FPGA calculation unit reads parameters from the temporary memory specified address and writes the calculation results to the temporary memory of the FPGA calculation unit.

[0013] After the FPGA circuit calculation unit completes the calculation, the write-back unit receives a write-back signal, writes the data in the write-back address of the temporary memory of the calculation unit back to the RISC-V register or the data segment of the DDR memory according to the data type, and restores the calculation site.

[0014] The instruction acceleration device also includes a code matching unit, which processes the RISC-V instruction access address that does not hit the instruction address of the code circuit mapping table.

[0015] The code matching unit includes a feature code matching unit and a RISC-V feature code table; the feature code matching unit identifies the code segments in the RISC-V instruction access addresses collected by the bus control unit that do not hit the instruction addresses in the code circuit mapping table, matches the high-frequency codes in the RISC-V instruction access addresses with the RISC-V feature code table, and instantiates the FPGA netlist file corresponding to the RISC-V feature code matched by the high-frequency code into an FPGA circuit; the feature code matching unit saves the RISC-V instruction access address corresponding to the matched high-frequency code and the storage address of the instantiated FPGA circuit in the code circuit mapping table.

[0016] The feature code matching unit also includes a high-hit rate code detection unit that identifies and marks the high-frequency code in the RISC-V instruction access address; a feature code recognition unit that matches and identifies the marked high-frequency code with the RISC-V feature code matching table; and a netlist instantiation unit that instantiates the FPGA netlist file corresponding to the RISC-V feature code that matches the marked high-frequency code into an FPGA circuit.

[0017] A monitoring unit is provided in the bus control unit, and the monitoring unit determines whether the control bus points to the DDR memory. When the bus points to the DDR memory, the monitoring unit collects the RISC-V instruction access address and RISC-V instruction data and passes the RISC-V instruction access address and RISC-V instruction data to the instruction hit detection unit.

[0018] The monitoring unit collects the address bus in the bus to obtain the RISC-V instruction access address; the monitoring unit collects the data bus in the bus to obtain the RISC-V instruction data.

[0019] Another embodiment of the present invention provides an instruction acceleration method based on FPGA, which uses the above-mentioned instruction acceleration device to accelerate instructions, and the instruction acceleration method includes the following steps: step 1: obtaining instructions issued by a RISC-V soft core from a bus, and obtaining a RISC-V instruction access address in an address bus and RISC-V instruction data in a data bus; step 2: comparing the RISC-V instruction access address with a code circuit mapping table; when the RISC-V instruction access address hits the instruction address in the code circuit mapping table, extracting the FPGA circuit storage address corresponding to the RISC-V instruction access address from the code circuit mapping table, activating the FPGA circuit corresponding to the FPGA circuit storage address in the FPGA circuit storage unit, and the FPGA circuit reading the RISC-V instruction data for calculation; when the RISC-V instruction access address does not hit the instruction address in the code circuit mapping table, the RISC-V soft core accesses the DDR memory, and the RISC-V soft core CPU calculates.

[0020] The calculation results of the FPGA circuit are written into the data area of ​​the DDR memory and / or the RISC-V soft core register.

[0021] When the RISC-V instruction access address does not hit the instruction address of the code circuit mapping table, the code segment of the RISC-V instruction access address is identified and counted, and the same code segment that is executed multiple times within a certain period of time is marked as a high-hit rate code segment when the number of executions exceeds a predetermined value; it is queried whether the high-hit rate code segment is a feature code segment in the RISC-V feature code table, and if the high-hit rate code segment is a feature code segment in the RISC-V feature code table, the high-hit rate code segment is instantiated into an FPGA circuit.

[0022] The instantiated FPGA circuit is stored in the FPGA circuit storage unit of the FPGA circuit mapping unit; the RISC-V instruction access address corresponding to the high hit rate code segment and the FPGA circuit storage address are stored in the code circuit mapping table.

[0023] Compared with the prior art, the beneficial effects of the present invention mainly include: 1. The FPGA circuit is used to calculate the data corresponding to the frequently accessed addresses in the code circuit mapping table. The FPGA circuit can add new circuit calculation units. On the basis of not changing the original RISC-V instruction set, it can accelerate the special calculation tasks in the original code without changing the original code.

[0024] 2. The instruction rapid device has a code matching unit, which identifies the high-frequency code in the instructions issued by the RISC-V soft core, instantiates the FPGA netlist file corresponding to the RISC-V characteristic code matched by the high-frequency code into the FPGA circuit, and saves the RISC-V instruction access address and the storage address of the instantiated FPGA circuit in the code circuit mapping table, so that the FPGA circuit can be directly called for calculation next time the high-frequency code is encountered. The code circuit mapping table is continuously improved, and for the access addresses that are not hit, for some addresses that are frequently accessed and meet the instantiation rules, their codes are instantiated into FPGA circuits, and the characteristics of the FPGA circuit are used to achieve fast calculation.

[0025] In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the specific embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0027] Figure 1 It is a schematic diagram of the circuit structure of the instruction acceleration device of the present invention.

[0028] Figure 2 It is a schematic diagram of the instruction calculation structure in the prior art.

[0029] Figure 3 Schematic diagram of the circuit structure details of the instruction acceleration device of the present invention.

[0030] Figure 4 It is a schematic diagram of the bus structure of the present invention. DETAILED DESCRIPTION

[0031] The above and other technical contents, features and effects of the present invention will be clearly presented in the following detailed description of a preferred embodiment with reference to the drawings. The directional terms mentioned in the following embodiments, such as up, down, left, right, front or back, etc., are only referenced to the directions of the attached drawings. Therefore, the directional terms used are used to illustrate and not to limit the present invention.

[0032] Embodiment 1 provides a RISC-V instruction acceleration device based on FPGA, see Figure 1 , including a RISC-V soft core and DDR memory (Double Data Rate SDRAM) that use the bus for signal transmission, and a bus control unit is connected to the bus, see Figure 4 , wherein the bus includes an address bus, a control bus, and a data bus, and the bus control unit collects RISC-V instructions issued by the RISC-V soft core, and collects the RISC-V instruction access address of the bus address line and the RISC-V instruction data in the bus data line; an instruction hit detection unit connected to the bus control unit signal receives the RISC-V instruction transmitted by the bus control unit, and retrieves and matches the RISC-V instruction access address with the instruction address in the code circuit mapping table, and if the RISC-V instruction access address hits the instruction address in the code circuit mapping table, then the FPGA circuit storage address corresponding to the RISC-V instruction access address in the code circuit mapping table is given, and the data in the instruction issued by the RISC-V soft core is calculated using the FPGA circuit corresponding to the FPGA circuit storage address in the FPGA circuit storage unit in the FPGA circuit mapping unit;

[0033] If the access address does not hit the instruction address in the code circuit mapping table, the data in the memory is sent directly to the RISC-V soft-core CPU, and the RISC-V soft-core CPU reads the data in the DDR memory to calculate the RISC-V instruction.

[0034] In order to facilitate the switching of the calculation mode, a channel switching unit is also provided on the transmission bus. The channel switching unit selects to open the FPGA circuit calculation channel or the RISC-V soft core CPU calculation channel according to the situation that the RISC-V instruction access address hits the instruction address in the code circuit mapping table. Specifically, when the RISC-V instruction access address hits the instruction address in the code circuit mapping table, the channel switching unit opens the FPGA circuit calculation channel to calculate the data in the instruction issued by the RISC-V soft core. When the RISC-V instruction access address does not hit the instruction address in the code circuit mapping table, the channel switching module opens the CPU calculation path, and the RISC-V soft core CPU reads the data in the DDR memory for calculation. The FPGA circuit mapping unit is also signal-connected to the read-back write-back unit, which is used for reading and restoring the calculation site. When the FPGA calculation channel is opened, the read-back unit reads the RISC-V soft core register and DDR memory data required for calculation, and reads the calculation site; when the FPGA channel is closed, the write-back unit writes the FPGA calculation result into the data area of ​​the DDR memory and the RISC-V soft core register to restore the calculation site. Because the original bus directly inputs data into the DDR memory for calculation, the calculation site is completely maintained by the CPU. Since this embodiment 1 is equivalent to using an FPGA circuit instead of the CPU to complete a part of the calculation, in order to ensure that the subsequent tasks of the CPU are not interfered with by this replacement, it is necessary to restore the calculation site, and the calculation results must be written into the DDR memory or the RISC-V soft core register before the calculation task is considered completed.

[0035] Embodiment 1 When using an FPGA circuit for calculation, the readback unit is responsible for inputting the data source from the DDR source memory address or the RISC-V soft core register to the temporary memory specified address of the FPGA circuit calculation unit. The FPGA calculation unit completes the accelerated calculation by reading the input parameters from the temporary memory and writing the calculation results to the temporary memory. After the FPGA circuit unit completes the calculation, the writeback unit receives a writeback signal, and writes the data in the writeback address in the temporary memory of the calculation unit back to the RISC-V register or the data segment of the DDR memory according to the writeback type, restores the calculation site, and completes the calculation.

[0036] In Example 1, the bus control unit collects instructions from the RISC-V soft core bus, and the instruction hit detection unit detects the RISC-V instruction access address in the address line. If it is an address in the code circuit mapping table, the FPGA circuit is used for calculation. Of course, for addresses that are not frequently accessed, the RISC-V soft core is still used for calculation. Through this method of exchanging space for time, the computing task is transferred from the CPU to the FPGA circuit unit, which realizes the acceleration of special computing tasks in the original code without changing the original code.

[0037] In order to facilitate rapid calculation of data, embodiment 1 further includes a code matching unit, which can instantiate the code segment corresponding to the access address whose access times reach the threshold into an FPGA circuit and save it in the code circuit mapping table. Figure 3 The detailed diagram of the instruction calculation circuit structure in the code matching unit also includes a feature code matching unit and a RISC-V feature code table. The RISC-V feature code table stores the feature code in the RISC-V instruction and the FPGA netlist file corresponding to the feature code. The feature code is a binary program code segment that can be recognized by the CPU and executes a specific function; the feature code matching unit is used to identify and detect the code segment in the RISC-V instruction access address when the RISC-V instruction access address does not hit the instruction address in the code circuit mapping table. When the frequency of the same code segment exceeds a preset value within a certain period of time, it is determined whether the code segment matches the RISC-V feature code table. If the code segment is a feature code segment in the RISC-V feature code table, the FPGA netlist file corresponding to the feature code segment is instantiated as an FPGA circuit, and the access address and the storage address of the instantiated FPGA circuit are saved in the code circuit mapping table.

[0038] The feature code matching unit includes a high-hit rate code detection unit, a feature code recognition unit and a netlist file instantiation unit; the high-hit rate code detection unit is used to identify and count the code segments in the RISC-V instruction access address, and for the same code segment that is executed multiple times within a certain period of time, when the number of executions exceeds a preset value, it is marked as a high-hit rate code segment; the feature code recognition unit is used to detect whether the code segment marked as a high-hit rate is a feature code segment in the RISC-V feature code table, and if so, mark the code segment as an instantiable code segment; the netlist file instantiation unit is used to instantiate the netlist file corresponding to the code segment stored in the RISC-V feature code table as an FPGA circuit for the feature code segment marked as an instantiable code segment.

[0039] The purpose of adding feature code matching units is to continuously improve the code circuit mapping table. For access addresses that do not hit, for some addresses that are frequently accessed and meet the instantiation rules, their codes are instantiated into FPGA circuits, and the characteristics of FPGA circuits are used to achieve fast calculations. The feature code table is set to pre-store some netlist files corresponding to feature codes, so as long as these high-frequency feature codes are in the feature code table, they can be instantiated into FPGA circuits through pre-stored netlist files. In this way, for some complex circuit calculation units, dedicated FPGA circuit calculation units can be used for calculations, which is convenient and fast, improves the calculation speed, and realizes the acceleration function of some instructions on the basis of the original code.

[0040] At the same time, when the bus control unit collects the instructions issued by the RISC-V soft core, it needs to determine whether the control bus points to the DDR memory. If so, it collects the access address of the address line and the data in the data line. For the specific structure, see Figure 4 The monitoring unit determines whether the control bus points to the DDR memory. If it points to the DDR memory, the monitoring unit records the RISC-V instruction access address in the address bus and the RISC-V data in the data bus. Because there may be other devices on the bus, whether the instruction points to the DDR is determined to confirm whether the instruction needs to be hit detected.

[0041] Embodiment 2 provides an instruction acceleration method based on FPGA. The instruction acceleration method uses the instruction acceleration device in embodiment 1 to accelerate instructions. The specific instruction acceleration method includes the following steps:

[0042] Step 1: Get the instruction issued by the RISC-V soft core from the bus, and obtain the RISC-V instruction access address in the address bus and the RISC-V instruction data in the data bus;

[0043] Step 2: Compare the RISC-V instruction access address with the code circuit mapping table; when the RISC-V instruction access address hits the instruction address of the code circuit mapping table, extract the FPGA circuit storage address corresponding to the RISC-V instruction access address from the code circuit mapping table, activate the FPGA circuit corresponding to the FPGA circuit storage address in the FPGA circuit storage unit, and the FPGA circuit reads the RISC-V instruction data for calculation; and write the FPGA circuit calculation result into the data area of ​​the DDR memory, and / or the RISC-V soft core register;

[0044] When the RISC-V instruction access address does not hit the instruction address of the code circuit mapping table, the RISC-V soft core accesses the DDR memory, and the RISC-V soft core CPU calculates; and the RISC-V instruction access address code segment is identified and counted, and the same code segment that is executed multiple times within a certain period of time is marked as a high hit rate code segment when the number of executions exceeds a predetermined value;

[0045] It is queried whether the high-hit rate code segment is a feature code segment in the RISC-V feature code table. If the high-hit rate code segment is a feature code segment in the RISC-V feature code table, the high-hit rate code segment is instantiated into an FPGA circuit, and the instantiated FPGA circuit is stored in the FPGA circuit storage unit of the FPGA circuit mapping unit; the RISC-V instruction access address corresponding to the high-hit rate code segment and the FPGA circuit storage address are stored in the code circuit mapping table.

[0046] The above is a device and method for accelerating instructions based on FPGA provided by the present invention. The structure and working principle of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. An instruction acceleration device based on FPGA, comprising a RISC-V soft core and a DDR memory using a bus for signal transmission, characterized in that: Also includes: A bus control unit connected to the bus, wherein the bus control unit collects RISC-V instructions issued by the RISC-V soft core; An instruction hit detection unit receives the RISC-V instruction transmitted by the bus control unit, and searches and matches the RISC-V instruction access address with the instruction address in the code circuit mapping table; A channel switching unit selects to open an FPGA circuit computing channel or a RISC-V soft core CPU computing channel according to the instruction address in the code circuit mapping table hit by the RISC-V instruction access address; The instruction acceleration device also includes a code matching unit, which processes the RISC-V instruction access address that does not hit the code circuit mapping table instruction address; The code matching unit includes a feature code matching unit and a RISC-V feature code table; The feature code matching unit identifies the code segments in the RISC-V instruction access address collected by the bus control unit that do not hit the instruction address of the code circuit mapping table, matches the high-frequency code in the RISC-V instruction access address with the RISC-V feature code table, and instantiates the FPGA netlist file corresponding to the RISC-V feature code matched by the high-frequency code as an FPGA circuit; The feature code matching unit saves the RISC-V instruction access address corresponding to the matched high-frequency code and the instantiated FPGA circuit storage address in the code circuit mapping table.

2. The FPGA-based instruction acceleration device according to claim 1, characterized in that: The channel switching unit is signal-connected to the instruction hit detection unit; The RISC-V instruction access address hits the instruction address in the code circuit mapping table, and the channel switching unit opens the FPGA circuit calculation channel to calculate the data in the RISC-V instruction; The RISC-V instruction access address does not hit the instruction address in the code circuit mapping table, and the channel switching unit opens the RISC-V soft core CPU calculation channel to read the data in the DDR memory and calculate.

3. The FPGA-based instruction acceleration device according to claim 2, characterized in that: The RISC-V instruction access address hits the instruction address in the code circuit mapping table, the instruction hit detection unit gives the FPGA circuit storage address corresponding to the RISC-V instruction access address in the code circuit mapping table, and the FPGA circuit storage unit in the FPGA circuit mapping unit uses the FPGA circuit corresponding to the FPGA circuit storage address to calculate the data in the RISC-V instruction.

4. The FPGA-based instruction acceleration device according to claim 2, characterized in that: The instruction acceleration device also includes a read-back and write-back unit; When the FPGA circuit calculation channel is turned on, the readback unit reads the RISC-V soft core register data, DDR memory data and calculation site required for calculation; When the FPGA circuit calculation channel is closed, the write-back unit writes the FPGA circuit calculation result into the data area of ​​the DDR memory and / or the RISC-V soft core register, and restores the calculation site.

5. The FPGA-based instruction acceleration device according to claim 4, characterized in that: When the FPGA circuit calculation channel is opened, the readback unit reads data from the RISC-V register or the DDR source memory address to the temporary memory specified address of the FPGA calculation unit, and the FPGA calculation unit reads parameters from the temporary memory specified address and writes the calculation results to the temporary memory of the FPGA calculation unit.

6. The FPGA-based instruction acceleration device according to claim 5, characterized in that: After the FPGA circuit calculation unit completes the calculation, the write-back unit receives a write-back signal, writes the data in the write-back address of the temporary memory of the FPGA circuit calculation unit back to the RISC-V register or the data segment of the DDR memory according to the data type, and restores the calculation site.

7. The FPGA-based instruction acceleration device according to claim 1, characterized in that: The feature code matching unit also includes a high hit rate code detection unit that identifies and marks the high frequency code in the RISC-V instruction access address; A feature code recognition unit matches and recognizes the marked high-frequency code with the RISC-V feature code matching table; The netlist instantiation unit instantiates the FPGA netlist file corresponding to the RISC-V feature code that matches the marked high-frequency code into an FPGA circuit.

8. The FPGA-based instruction acceleration device according to claim 1, characterized in that: A monitoring unit is provided in the bus control unit, and the monitoring unit determines whether the control bus points to the DDR memory. When the bus points to the DDR memory, the monitoring unit collects the RISC-V instruction access address and RISC-V instruction data and passes the RISC-V instruction access address and RISC-V instruction data to the instruction hit detection unit.

9. The FPGA-based instruction acceleration device according to claim 8, characterized in that: The monitoring unit collects the address bus in the bus to obtain the RISC-V instruction access address; The monitoring unit collects data from the bus to obtain the RISC-V instruction data.

10. An instruction acceleration method based on FPGA, characterized in that: The instruction acceleration method uses the instruction acceleration device according to any one of claims 1 to 9 to accelerate instructions, and the instruction acceleration method comprises the following steps: Step 1: Get the instruction issued by the RISC-V soft core from the bus, and obtain the RISC-V instruction access address in the address bus and the RISC-V instruction data in the data bus; Step 2: Compare the RISC-V instruction access address with the code circuit mapping table; When the RISC-V instruction access address hits the instruction address of the code circuit mapping table, the FPGA circuit storage address corresponding to the RISC-V instruction access address is extracted from the code circuit mapping table, and the FPGA circuit corresponding to the FPGA circuit storage address in the FPGA circuit storage unit is activated, and the FPGA circuit reads the RISC-V instruction data for calculation; When the RISC-V instruction access address does not hit the instruction address of the code circuit mapping table, the RISC-V soft core accesses the DDR memory and is calculated by the RISC-V soft core CPU.

11. The FPGA-based instruction acceleration method according to claim 10, characterized in that: The calculation results of the FPGA circuit are written into the data area of ​​the DDR memory and / or the RISC-V soft core register.

12. The FPGA-based instruction acceleration method according to claim 10, characterized in that: When the RISC-V instruction access address does not hit the instruction address of the code circuit mapping table, the code segment of the RISC-V instruction access address is identified and counted, and the same code segment that is executed multiple times within a certain period of time is marked as a high hit rate code segment when the number of executions exceeds a predetermined value; It is queried whether the high hit rate code segment is a feature code segment in the RISC-V feature code table. If the high hit rate code segment is a feature code segment in the RISC-V feature code table, the high hit rate code segment is instantiated into an FPGA circuit.

13. The FPGA-based instruction acceleration method according to claim 12, characterized in that: The instantiated FPGA circuit is stored in the FPGA circuit storage unit of the FPGA circuit mapping unit; the RISC-V instruction access address corresponding to the high hit rate code segment and the FPGA circuit storage address are stored in the code circuit mapping table.