CN114036877A - Method for compiling DPI function into comprehensive language, simulation method and system - Google Patents
Method for compiling DPI function into comprehensive language, simulation method and system Download PDFInfo
- Publication number
- CN114036877A CN114036877A CN202111250171.6A CN202111250171A CN114036877A CN 114036877 A CN114036877 A CN 114036877A CN 202111250171 A CN202111250171 A CN 202111250171A CN 114036877 A CN114036877 A CN 114036877A
- Authority
- CN
- China
- Prior art keywords
- function
- dpi
- software
- hardware
- data
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000004088 simulation Methods 0.000 title claims abstract description 33
- 230000006870 function Effects 0.000 claims abstract description 80
- 238000004891 communication Methods 0.000 claims abstract description 32
- 230000008676 import Effects 0.000 claims description 46
- 230000005540 biological transmission Effects 0.000 claims description 21
- 230000002457 bidirectional effect Effects 0.000 claims description 8
- 238000012360 testing method Methods 0.000 claims description 3
- 238000012905 input function Methods 0.000 claims description 2
- 238000012546 transfer Methods 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 5
- 238000011161 development Methods 0.000 description 4
- 238000012795 verification Methods 0.000 description 3
- 230000015572 biosynthetic process Effects 0.000 description 2
- 230000000630 rising effect Effects 0.000 description 2
- 238000003786 synthesis reaction Methods 0.000 description 2
- 239000011800 void material Substances 0.000 description 2
- 230000008859 change Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/31—Design entry, e.g. editors specifically adapted for circuit design
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/34—Circuit design for reconfigurable circuits, e.g. field programmable gate arrays [FPGA] or programmable logic devices [PLD]
- G06F30/343—Logical level
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Design And Manufacture Of Integrated Circuits (AREA)
Abstract
The invention discloses a method, a simulation method and a system for compiling a DPI function into a comprehensive language. The method for compiling the DPI function into the comprehensive language compiles the DPI function on the software side into a bottom layer communication function which can call the software side to communicate with the hardware side according to the type of the DPI function on the software side, and realizes that the software side sends data to the hardware side and/or receives data; and modifying the code on the hardware side according to the type of the DPI function on the hardware side, so that the DPI function becomes a channel capable of sending and/or receiving data. The invention compiles the DPI function into a method of comprehensive language, and applies the method to a software and hardware combined simulation system, the comprehensive language corresponding to the compiled DPI function is comprehensively analyzed into a net list by using an FPGA comprehensive tool, and the software and hardware can be communicated and simulated through the DPI function after the net list is realized to the FPGA.
Description
Technical Field
The invention relates to the technical field of software and hardware joint simulation, in particular to a method for compiling a DPI function into a comprehensive language, and a method and a system for realizing software and hardware joint simulation by utilizing the method for compiling the DPI function into the comprehensive language.
Background
When the chip scale is small, the chip software simulation is used for comprehensively simulating the chip functions, and then the chip prototype verification is used for verifying partial functions of the chip, so that the development requirements of partial chips can be met. However, as the chip scale becomes larger, the time consumed by the conventional chip simulation and verification method becomes larger in proportion to the chip development. To solve this problem, a more suitable method is to use a simulation accelerator (Emulation). The simulation accelerator mainly has two implementation methods, one is a method implemented based on a special processor, and the other is an implementation method using an FPGA. The method of using FPGA relates to software and hardware co-simulation technology.
One difficulty in chip software and hardware co-simulation is the problem of software and hardware communication. The SCE-MI 2 protocol provides a simple communication method, which uses dpi (direct Program interface) interface function of System Verilog to perform software and hardware communication, and the interface function allows the System Verilog language to be directly called with C language. This is well achieved in software simulation, since the software simulation does not require a real circuit, but rather a software simulation. However, in a software and hardware collaborative simulation environment, a hardware part needs to be implemented as a hardware circuit, but the existing FPGA synthesis tool for implementing the hardware circuit can only synthesize a description language which can be synthesized, and cannot synthesize a behavior description language such as a DPI function into a netlist, so that a hardware side and a software side cannot communicate by using the DPI function.
Disclosure of Invention
In order to solve the technical problem that software and hardware cannot communicate by using a DPI function in the prior art, the invention provides a method for compiling the DPI function into a comprehensive language, a simulation method and a simulation system. The invention compiles the DPI function into a synthesizable language, applies the synthesizable language corresponding to the DPI function into a net list by using an FPGA synthesis tool, realizes the net list to the FPGA, and can realize the communication and the simulation of the software and the hardware through the DPI function.
The invention provides a method for compiling a DPI function into a comprehensive language, which comprises the following steps:
according to the type of the DPI function of the software side, the DPI function of the software side is compiled into a bottom layer communication function which can call the software side to communicate with the hardware side, and the purpose that the software side sends data to the hardware side and/or receives data is achieved;
and modifying the code on the hardware side according to the type of the DPI function on the hardware side, so that the DPI function becomes a channel capable of sending and/or receiving data.
Further, when the DPI function on the hardware side comprises a unidirectional import DPI function, the import DPI function is compiled into a data trigger signal or a data trigger signal and a data signal statement.
Further, when the DPI function on the hardware side is a bidirectional import DPI function, copying an always statement block containing the import DPI function to obtain two always statement blocks;
removing a time sequence clock and an assignment statement of one always statement block, and adding a data statement to be sent to software and a trigger signal statement to send data;
and replacing the time sequence clock of the other always statement block with a controllable clock, compiling the statement reserved in the always statement block into a data trigger signal or a data trigger signal and a data signal statement, and waiting for receiving data returned by the software side.
Further, when the DPI function on the hardware side is an export DPI function, the export DPI function is directly replaced by an always statement block for compiling, and the always statement block is driven by a non-controllable clock to receive data on the software side, or after the data are received, the operation result is sent to the software side after the entity operation of the export DPI function on the hardware side.
Further, when the DPI function of the software side comprises an import function, a thread is created for a function entity corresponding to each DPI function on the software side, and the DPI function of the hardware side and the function entity of the software side are communicated with each other by calling a bottom layer communication function communicated between the software side and the hardware side through the thread.
Further, the calling of the underlying communication function of the software side and the hardware side by the thread comprises:
establishing an input parameter variable of a corresponding function entity in a thread;
the thread assigns an input function for receiving data at a hardware side in the bottom communication function to the input parameter variable;
and/or the thread takes the output result of the function entity as an input parameter variable of an output function which sends data to a hardware side in the bottom layer communication function.
The invention provides a software and hardware combined simulation method, which comprises the following steps:
adding a DPI function at a hardware side, and adding a DPI function corresponding to the DPI function at the hardware side at a software side;
the method for compiling the DPI function into the comprehensive language in the technical scheme is adopted to compile the software side and the hardware side, so that the DPI function on the hardware side is converted into the comprehensive language;
converting a synthesizable language corresponding to the DPI function on the hardware side into a netlist by using an FPGA synthesizer;
and then, realizing the netlist corresponding to the DPI function of the hardware side to the circuit, so that the software side and the hardware side communicate through the corresponding DPI function to realize joint simulation.
The system for simulating by adopting the software and hardware combined simulation method provided by the invention comprises the following steps:
the test script is compiled by software, the DPI function is positioned on the software side, and the bottom layer communication function is communicated with the hardware side;
the device comprises a circuit to be designed, an interface circuit, a data transmission module and a controllable clock generation circuit, wherein the circuit to be designed is positioned on a hardware side, the interface circuit is formed through a DPI function, the data transmission module is communicated with a software side, and the controllable clock generation circuit is used for generating a clock.
Further, the underlying communication function includes at least one of a send API function and a receive API function.
Further, the data transmission module comprises at least one of a data receiving control circuit and a data sending control circuit.
Further, the bottom layer communication function and the data transmission module communicate in any one of PCIe, ethernet, USB, CXL, parallel port, and PCI.
The invention converts the DPI function into a comprehensive language, so that software and hardware can communicate through the DPI function. The implementation mode of the invention is very simple, the DPI interface function of the non-synthesizable behavior description language System Verilog is compiled into the synthesizable HDL, and the compiled simulation code can be programmed into the FPGA by the invention, thereby realizing the purpose of accelerating the simulation. And when the simulation code is written, the System Verilog of a behavior description mode can be used for writing, the code of a synthesizable language HDL mode with a strict format is not required for writing, and the chip development speed and the simulation verification speed are greatly accelerated.
Drawings
The invention is described in detail below with reference to examples and figures, in which:
FIG. 1 is a partial code diagram of an embodiment of the invention prior to compilation.
Fig. 2 is a schematic diagram of a portion of the compiled code of fig. 1.
FIG. 3 is a clock control schematic of the present invention.
FIG. 4 is a schematic diagram of a simulation system framework of the present invention.
FIG. 5 is a partial code diagram of another embodiment of the present invention before compilation.
Fig. 6 is a schematic diagram of a portion of the compiled code of fig. 5.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Thus, a feature indicated in this specification will serve to explain one of the features of one embodiment of the invention, and does not imply that every embodiment of the invention must have the stated feature. Further, it should be noted that this specification describes many features. Although some features may be combined to show a possible system design, these features may also be used in other combinations not explicitly described. Thus, the combinations illustrated are not intended to be limiting unless otherwise specified.
The principles of the present invention will be described in detail below with reference to the accompanying drawings and embodiments.
The method for compiling the DPI function into the comprehensive language comprises the steps of compiling the DPI function on a hardware side and compiling on a software side, wherein the emphasis is on the hardware side. The DPI function defined by the System Verilog is divided into two types, wherein one type is a function realized by calling C/C + + by the System Verilog, namely an import DPI function; the other is a function realized by System Verilog, C/C + + calls are carried out, namely an export DPI function. By using the DPI function, the System Verilog language and the C/C + + language can directly communicate. Currently, most software emulators (simulators) support two languages to call each other. The invention is a method for realizing that the DPI function is also applied to a software and hardware combined simulator (Emulator), which ensures that the development of software and hardware communication codes is very convenient, namely, software and hardware can mutually call the DPI function for communication.
In order to realize the communication between software and hardware by using the DPI function, the DPI function on the hardware side needs to be converted into a hardware circuit, and the DPI function on the software side needs to be converted into a driving function for communicating with the hardware side. The difficulty is to convert the DPI function on the hardware side into a hardware circuit, because the DPI function cannot be converted into the hardware circuit by using the comprehensive software of the FPGA, the comprehensive software of the FPGA can only convert the synthesizable code into a netlist, but cannot convert the DPI function into the netlist. The DPI function can be converted into the comprehensive language, so that the DPI function converted into the comprehensive language can be converted into a net list by using the FPGA synthesizer, and the net list is realized to a circuit through FPGA layout and wiring software, so that the DPI function can be converted into the circuit.
According to the type of the DPI function at the software side, the DPI function at the software side is compiled into a bottom layer communication function which can call the software side to communicate with the hardware side, so that the software side can send data to the hardware side and/or receive data. And simultaneously modifying the code of the hardware side according to the type of the DPI function of the hardware side, so that the DPI function becomes a channel capable of sending and/or receiving data.
The DPI functions comprise a one-way import DPI function, a two-way import DPI function, a one-way export DPI function and a two-way export function. When the hardware side contains an import DPI function, the corresponding function entity of the DPI function is called by the hardware side on the software side. When the hardware side contains an export DPI function, the corresponding function entity is on the hardware side, and the software side needs to call the function entity on the hardware side.
The following describes a method for compiling import DPI function into a comprehensive language.
When the hardware side contains the unidirectional import DPI function, namely the hardware side only sends data to the software side, the unidirectional import DPI function is compiled into a data trigger signal or a data trigger signal and a data signal statement. When the import DPI Function of the hardware side has no input and output, such as a void DPI Function (void), that is, the hardware side only calls a DPI Function entity of the software side, the import DPI Function is directly replaced by a data trigger signal, and when the import DPI Function of the hardware side has output, that is, data needs to be sent to the software side, the hardware side needs to send the data to the software side when a condition in a corresponding entry statement block of the hardware side is satisfied (that is, the import DPI Function of the hardware side is called), so that the import DPI Function of the hardware side needs to be replaced by the data trigger signal and the data signal statement. The compilation method does not change other logic code designed by the user and only changes the DPI function. The following explains a simple example, in which the code designed on the hardware side before compiling in fig. 1 is compiled into the code compiled in fig. 2, and it is ensured that the logic functions before and after compiling are consistent. Generally, this type of code is a logic function that converts a transaction of software to a clock accurate, and is therefore called a server. When a compiler detects an import DPI function, namely a function of a software side is imported to a hardware side and called by the hardware side, the DPI function is directly replaced by a data trigger (i _ receive _ trigger = ~ i _ receive _ trigger) and a data signal data statement (destAddr = o _ receive _ data). The Trigger has the function of ensuring that the Trigger can be inverted once (i _ receive _ Trigger = -i _ receive _ Trigger in fig. 2) when the DPI function is triggered each time, so that when a subsequent circuit detects that the Trigger signal is inverted, data can be taken from a software side and then put into data, and the data is transmitted to a user data signal at a hardware side, specifically realized as a data signal statement, and destAddr = o _ receive _ data in fig. 2. The Data is used for transmitting Data (output Data of the import DPI function) transmitted by the software to the user logic signal (destAddr).
When the hardware side contains the bidirectional import DPI function, namely the import DPI function needs to send data to the software side first, and the data is processed at the software side and then transmitted to the hardware side. Copying the always statement block containing the import DPI function during compiling to obtain two always statement blocks. And removing a time sequence clock and an assignment statement of one always statement block, and adding a data statement needing to be sent to the software and a trigger signal statement for sending data so as to send the data to the software side in advance. And replacing the time sequence clock of the other always statement block with a controllable clock, compiling the statement reserved in the always statement block into a data trigger signal or a data trigger signal and a data signal statement, and waiting for receiving data returned by the software side.
The above always statement block without clock changes the original sequential logic into combinational logic, the characteristic of the combinational logic is that the combinational logic can finish the data operation by one cycle ahead of the sequential logic, therefore, the always statement block without clock can send the data of the hardware side to the software side in advance. In fig. 2, the condition of the sequential logic always block containing the import DPI function is preserved, the clock is removed, and the sequential logic always block is changed into combinational logic, so that data can be sent one clock cycle in advance without changing the function of the user logic. However, this is far from enough because the hardware side sends data to the software side, the time spent is long, the combinational logic is used to replace the sequential logic only one clock cycle faster than the sequential logic, and it is likely that the data transmission is not completed yet, and one clock cycle is reached, and at this time, the hardware side cannot achieve the data that the hardware side wants to acquire the data that the software side has operated. In addition, the hardware side receives data from the software side, which consumes longer time, but the definition of the DPI function of the Sistem Verilog does not consume any simulation time.
To solve this problem, a controllable clock of another always statement block is given to the pause. As shown in fig. 3, after the controllable clock is used to control the clock of the always statement block, the controllable clock can be kept from the period by suspending the controllable clock (cclock) based view angle observation, because the controllable clock is suspended when the software and hardware communicate. In this case, in order to control the on or off of the controllable clock and to drive the hardware to perform data communication with the software, another uncontrolled clock (uclock) is used for drive transmission.
When the software side contains an import DPI function (a unidirectional import DPI function and/or a bidirectional import DPI function), a thread is created for each import DPI function, a parameter variable of the corresponding import DPI function is created in the thread, and hardware side data received by PCIe is transmitted to an input variable (the unidirectional import DPI function) of the import DPI function in the thread or transmitted to the input variable of the import DPI function in the thread by utilizing the calling of the thread to a bottom communication function communicated with the software side and the hardware side, and then the operation result of the import DPI function in the thread is transmitted to PCIe and transmitted to the hardware side (the bidirectional import DPI function) by the PCIe. The DPI function also needs to be compiled on a software side, the import DPI function realized by the software side cannot be called by a hardware side, and the DPI function is called by creating a thread, data sent by the hardware side is transmitted to the DPI function on the software side, and the data of the DPI function on the software side is transmitted to the hardware side again. Therefore, the compiling method of the software side is to reserve the original DPI function of the software side, create a thread for each import DPI function, and the thread realizes that the import DPI function entity of the software side communicates with a circuit called by the DPI function of the hardware side, namely, data are interacted with the hardware through a PCIe sending function (pci _ send _ data) and a PCIe receiving function (pci _ receive _ data). Therefore, in fig. 2, a parameter variable of an import DPI function is created in a thread, data received by PCIe is transmitted to an input variable (destAddr) of the DPI function, and an operation result (PortID (& destAddr)) of the DPI function is sent to PCIe, that is, a code is:
svBitVecVal32 destAddr;
destAddr = pcie_receive_data();
pcie_send_data(PortID(&destAddr ))。
when the hardware side contains an export DPI function, the export DPI function is directly replaced by an always statement block for compiling. And (4) realizing an export DPI function on a hardware side, and calling the export DPI function by a software side.
When the software side contains an export DPI function, the software side can receive data sent by the hardware side only by calling the underlying communication function because the function entity is on the hardware side. The export DPI function of the software side is also distinguished in a bidirectional mode and a unidirectional mode, when the export DPI function of the software side is a unidirectional export DPI function, data are only sent to the hardware side, and when the export DPI function of the software side is a bidirectional export DPI function, the software side sends the data to the hardware side and then receives corresponding operation result data through operation of a DPI function entity of the hardware side.
The following explains a simple example, which compiles the pre-compilation code on the hardware side in fig. 5 into the compiled code in fig. 6, and ensures that the logic functions before and after compiling are consistent. Generally, this type of code is a logic function that converts a transaction of software to a clock accurate, and is therefore called a server. When the compiler detects an export DPI function on the hardware side, the export DPI function is directly replaced by an always statement block for compilation, and then the always statement block is driven by a non-controllable clock to receive data on the software side, or after the data is received, the operation result is sent to the software side after the entity operation of the export DPI function on the hardware side.
As shown in FIG. 6, using the uclk clock rising edge trigger, uclk is a non-controllable clock. The always statement block fetches ({ enablepartpart } = data _ in, where the data _ in is driven by the data transmission module) input variables of all export DPI functions from the data transmission module in fig. 4, drives all output data of the export functions to the data transmission module in fig. 4 (data _ out = { configpart }, where the data _ out will drive the data transmission module, and puts all contents in the function body in the middle of the above two statements, keeping the format unchanged.
An Export DPI function does not need a control clock, and uses uclk to drive a function, so that a trigger signal similar to an import function is not needed, when the Export function is called by software, PCIe transmits input parameter data to data _ in of a hardware side after a period of time, the input signal of the Export function can acquire data at the rising edge of uclk, at the moment, a pci _ send _ data () function of the software side exits, and a pci _ receive _ data () function is executed in sequence.
The underlying communication function and the data transmission module of the present invention can communicate in any manner such as PCI, ethernet, USB, CXL, parallel port, PCI, and the like, and are not limited to the above manner, and any interface that enables the FPGA and the software side to communicate is available, so the underlying communication function is not limited to the above listed PCI _ receive _ data () function and PCI _ send _ data () function, and the specific function to be selected differs according to the manner of communication.
The software and hardware combined simulation method needs to add DPI functions into a software side and a hardware side respectively, and adopts the method to compile the DPI functions on the hardware side into synthesizable languages, so that the DPI functions on the hardware side are converted into the synthesizable languages, an FPGA synthesizer is used for converting the synthesizable languages corresponding to the DPI functions on the hardware side into a netlist, and then the netlist corresponding to the DPI functions on the hardware side is realized to a circuit, so that the software side and the hardware side communicate through the corresponding DPI functions to realize combined simulation. The following illustrates the addition of DPI functions on the software side and the hardware side, respectively. When the hardware side adds the import DPI function, the software side adds a DPI function entity corresponding to the import DPI function of the hardware side. When the hardware side is an export DPI function, the fact that the DPI function entity is on the hardware side is shown, and the export DPI function on the software side calls the DPI function entity on the hardware side.
As shown in fig. 4, the software and hardware co-simulation system of the present invention uses the above software and hardware co-simulation method for simulation. The system comprises a test script written by software on a software side, a DPI function and an underlying communication function which communicates with a hardware side through PCIe, wherein the underlying function comprises at least one of a sending API function and a receiving API function.
The system also comprises a circuit to be designed, which is positioned on the hardware side, an interface circuit formed by a DPI function, a data transmission module communicated with the software side through PCIe, a controllable clock generation circuit used for generating a clock and a clock control circuit. The data transmission module comprises at least one of a data receiving control circuit and a data sending control circuit. The controllable clock generating circuit is used for generating the controllable clock, and the DUT and the interface circuit formed by the import DPI function adopt the controllable clock. The data transmission module adopts a controllable clock on the right side and adopts an uncontrolled clock on the left side which needs to communicate with the software side, so that the clock control circuit is used for controlling the switch of the clock generation circuit, and the clock generation circuit can generate a signal to generate a clock by using the uncontrolled clock. The control of the clock control circuit is determined by the data transmission condition, when the data needs to be transmitted but cannot be transmitted, the clock needs to be turned off, otherwise, the clock is turned on. If there are multiple channels, all the clock control circuits are required to be turned on, and the clock generation circuit generates clocks to ensure the synchronization of all the modules.
When the data transmission module calls a DPI function (namely an interface circuit formed by the DPI function is used), when a Trigger signal sent by the interface circuit (which is called as the interface circuit formed by the DPI function) generated after the data sending control circuit receives the compiled code of the compiler is inverted, the data is considered to be valid, if PCIe can transmit the data, the data is forwarded to a software side, and if the data does not need to be returned by the software, the process is ended; if data needs to be returned, the data receiving control circuit forwards the data to the compiled interface circuit after waiting for the data to be returned, and the clock control circuit needs to close the controllable clock in the transmission process.
After the compiler converts the DPI function at the hardware side, the compiled code has two groups of interfaces, one group is a data channel (such as a Trigger signal and a group of data signals) sent to the software side by the hardware side, and the other group is a data channel (such as a Trigger signal and a group of data signals) sent by the software side by the hardware side receiving the software side.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
Claims (11)
1. A method for compiling a DPI function into a synthesizable language, comprising:
according to the type of the DPI function of the software side, the DPI function of the software side is compiled into a bottom layer communication function which can call the software side to communicate with the hardware side, and the purpose that the software side sends data to the hardware side and/or receives data is achieved;
and modifying the code on the hardware side according to the type of the DPI function on the hardware side, so that the DPI function becomes a channel capable of sending and/or receiving data.
2. The method of compiling DPI functions into a synthesizable language of claim 1 wherein when the hardware-side DPI functions include a unidirectional import DPI function, the unidirectional import DPI function is compiled into a data trigger, or a data trigger and a data signal statement.
3. The method of compiling DPI functions into a synthesizable language of claim 1, wherein when the DPI function of the hardware side includes a bidirectional import DPI function, copying always statement blocks containing the bidirectional import DPI function to obtain two always statement blocks;
removing a time sequence clock and an assignment statement of one always statement block, and adding a data statement to be sent to software and a trigger signal statement to send data;
and replacing the time sequence clock of the other always statement block with a controllable clock, compiling the statement reserved in the always statement block into a data trigger signal or a data trigger signal and a data signal statement, and waiting for receiving data returned by the software side.
4. The method of claim 1, wherein when the DPI function of the hardware side includes an egress DPI function, the egress DPI function is directly replaced with an always statement block for compilation, and then the always statement block is driven by a non-controllable clock to receive data of the software side, or after receiving the data, the operation result is sent to the software side after the physical operation of the hardware side egress DPI function.
5. The method of compiling DPI functions into a synthesizable language according to claim 1, wherein when the DPI function of the software side includes an import function, a thread is created for a function entity corresponding to each DPI function at the software side, and the DPI function of the hardware side and the function entity of the software side communicate with each other by using a call of the thread to an underlying communication function of the software side and the hardware side.
6. The method of compiling a DPI function into a synthesizable language of claim 5 wherein utilizing the thread to call an underlying communication function that the software side communicates with the hardware side comprises:
establishing an input parameter variable of a corresponding function entity in a thread;
the thread assigns an input function for receiving data at a hardware side in the bottom communication function to the input parameter variable;
and/or the thread takes the output result of the function entity as an input parameter variable of an output function which sends data to a hardware side in the bottom layer communication function.
7. A method for joint simulation of software and hardware is characterized by comprising the following steps:
adding a DPI function at a hardware side, and adding a DPI function corresponding to the DPI function at the hardware side at a software side;
compiling the software side and the hardware side by the method for compiling the DPI function into the synthesizable language according to any one of claims 1 to 6, so that the DPI function on the hardware side is converted into the synthesizable language;
converting a synthesizable language corresponding to the DPI function on the hardware side into a netlist by using an FPGA synthesizer;
and then, realizing the netlist corresponding to the DPI function of the hardware side to the circuit, so that the software side and the hardware side communicate through the corresponding DPI function to realize joint simulation.
8. A system for simulation by the method of software and hardware co-simulation according to any one of claims 1 to 7, comprising:
the test script is compiled by software, the DPI function is positioned on the software side, and the bottom layer communication function is communicated with the hardware side;
the device comprises a circuit to be designed, an interface circuit, a data transmission module and a controllable clock generation circuit, wherein the circuit to be designed is positioned on a hardware side, the interface circuit is formed through a DPI function, the data transmission module is communicated with a software side, and the controllable clock generation circuit is used for generating a clock.
9. The system of claim 8, wherein the underlying communication function comprises at least one of a send API function and a receive API function.
10. The system of claim 8, wherein the data transmission module comprises at least one of a data reception control circuit and a data transmission control circuit.
11. The system of claim 8, wherein the underlying communication function and data transfer module communicate via any one of PCIe, ethernet, USB, CXL, parallel, PCI.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111250171.6A CN114036877A (en) | 2021-10-26 | 2021-10-26 | Method for compiling DPI function into comprehensive language, simulation method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111250171.6A CN114036877A (en) | 2021-10-26 | 2021-10-26 | Method for compiling DPI function into comprehensive language, simulation method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114036877A true CN114036877A (en) | 2022-02-11 |
Family
ID=80141995
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111250171.6A Pending CN114036877A (en) | 2021-10-26 | 2021-10-26 | Method for compiling DPI function into comprehensive language, simulation method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114036877A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115879402A (en) * | 2022-12-16 | 2023-03-31 | 无锡亚科鸿禹电子有限公司 | A Communication Method for Software-Hardware Co-simulation |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4748617A (en) * | 1985-12-20 | 1988-05-31 | Network Systems Corporation | Very high-speed digital data bus |
CN102725735A (en) * | 2011-11-02 | 2012-10-10 | 华为技术有限公司 | Method and system for multithreading collaborative simulations |
CN113343629A (en) * | 2021-06-25 | 2021-09-03 | 海光信息技术股份有限公司 | Integrated circuit verification method, code generation method, system, device, and medium |
-
2021
- 2021-10-26 CN CN202111250171.6A patent/CN114036877A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4748617A (en) * | 1985-12-20 | 1988-05-31 | Network Systems Corporation | Very high-speed digital data bus |
CN102725735A (en) * | 2011-11-02 | 2012-10-10 | 华为技术有限公司 | Method and system for multithreading collaborative simulations |
CN113343629A (en) * | 2021-06-25 | 2021-09-03 | 海光信息技术股份有限公司 | Integrated circuit verification method, code generation method, system, device, and medium |
Non-Patent Citations (1)
Title |
---|
蒋心祝: "软硬件协同仿真的自动化验证平台设计", 中国优秀硕士学位论文全文数据库信息科技辑(月刊)2020 年 第02期, 15 February 2020 (2020-02-15), pages 2 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115879402A (en) * | 2022-12-16 | 2023-03-31 | 无锡亚科鸿禹电子有限公司 | A Communication Method for Software-Hardware Co-simulation |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109783954B (en) | IES (information engineering System) combined FPGA (field programmable Gate array) hardware simulation acceleration system | |
CN108038294B (en) | UVM environment building method and system | |
US5600579A (en) | Hardware simulation and design verification system and method | |
Vanmeerbeeck et al. | Hardware/software partitioning of embedded system in OCAPI-xl | |
Wakabayashi | C-based synthesis experiences with a behavior synthesizer,“Cyber” | |
JPH10116302A (en) | Integrated circuit designing method and integrated circuit designed by it | |
CN101174283A (en) | A network-based software-hardware co-simulation platform | |
JP2009524138A (en) | Modeling and simulation methods | |
CN112560377A (en) | Simulation verification method and system based on combination of virtual platform and FPGA | |
CN102480467A (en) | SOC software and hardware collaborative simulation verification method based on network communication protocol | |
CN110134561B (en) | Method and device for outputting debugging information in software and hardware collaborative verification | |
CN116029242A (en) | Cloud native hardware logic simulation FPGA acceleration method and system | |
CN105653409B (en) | A kind of hardware emulator verify data extraction system based on data type conversion | |
WO2022125978A1 (en) | Machine learning delay estimation for emulation systems | |
CN116090372B (en) | FPGA-based chip simulation acceleration method and system | |
Kudlugi et al. | A transaction-based unified simulation/emulation architecture for functional verification | |
CN105956267B (en) | An embedded simulation serial port and modeling method based on device modeling language | |
CN114036877A (en) | Method for compiling DPI function into comprehensive language, simulation method and system | |
CN111062173A (en) | GPU chip-oriented rendering output unit function simulation method and platform | |
CN115659906A (en) | Chip verification system, method and related equipment | |
Gibeling et al. | The RAMP architecture & description language | |
US10324740B1 (en) | Enhanced control system for flexible programmable logic and synchronization | |
CN113204929B (en) | Method, electronic device and storage medium for realizing AHB VIP based on SV and UVM | |
Balarin et al. | Functional verification methodology based on formal interface specification and transactor generation | |
Wenban | A software development system for FPGA-based data acquisition systems |
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 |