Virtual prototype framework generation method and system, terminal and storage medium

By analyzing the collaborative simulation code to generate a virtual prototype framework, the problems of steep learning curve, memory leakage and inconvenience in virtual prototype design are solved, and memory-safe and efficient virtual prototype design are achieved.

CN119494295AInactive Publication Date: 2025-02-21SHENZHEN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510077470.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-17
Publication Date
2025-02-21
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

SystemC faces steep learning curves, risk of memory leaks, and inconvenient interaction with RTL code in virtual prototype design, resulting in the inability to implement virtual prototypes properly.

Method used

By obtaining the collaborative simulation code, the target syntax tree is obtained, the port information is analyzed and saved, the target language process macros generate an interactive interface, and a virtual prototype framework containing the interactive interface between the collaborative simulation code and the target language is generated, and the business code and target system is based on the business code and target system. Interface functions generate executable files.

Benefits of technology

It solves the problems of memory leakage risks and interaction inconvenience, provides a memory-safe virtual prototype framework generation method, and improves the efficiency and reliability of virtual prototype design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494295A_ABST
    Figure CN119494295A_ABST
Patent Text Reader

Abstract

The invention discloses a virtual prototype frame generation method and system, a terminal and a storage medium, and the method comprises the steps: obtaining a co-simulation code, and analyzing the co-simulation code to obtain a target syntax tree; analyzing the target syntax tree to obtain port information, and storing the port information in a corresponding target file; according to the target file, an interactive interface is generated through a process macro of a target language, a target virtual prototype frame is generated according to the interactive interface, and the target virtual prototype frame comprises the interactive interface between the co-simulation code and the target language; and obtaining a business code and a target interface function, and generating a target executable file according to the target virtual prototype framework, the business code and the target interface function. According to the method, the target language is adopted to guarantee the security of the memory, and meanwhile, the interaction interface is correspondingly constructed to solve the inconvenience of code interaction between the target language and the co-simulation code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of virtual prototype framework generation, and in particular to a virtual prototype framework generation method, system, terminal and storage medium. Background Art

[0002] When designing digital circuits, it is usually necessary to use HDL (Hardware Description Language, a language used to describe electronic systems, especially the structure and behavior of digital circuits, which allows the function, structure and timing characteristics of circuits to be defined in text form. Common HDLs include VHDL, Verilog, and SystemVerilog) language to write RTL code (Register Transfer Level, a level of abstraction used to describe digital circuits, focusing on the transmission and processing of data between registers. RTL is usually used in hardware description languages ​​to help designers express the functions and timing characteristics of circuits more clearly) after clarifying the design specifications, so as to realize specific hardware functional logic. However, the RTL code design process is often time-consuming and labor-intensive, involving a lot of coding and repeated verification. For some complex modules, if you need to wait for the RTL code to be fully written before starting the functional verification process, it will slow down the progress of the entire project. Virtual prototyping technology should show great advantages in improving design verification efficiency. Virtual prototyping refers to creating a model with complete functional behavior (that is, virtualizing a specific hardware module) through a language corresponding to non-RTL code, such as SystemC (a system-level design language based on C++, which is widely used in the creation of virtual prototypes) or other high-level modeling languages. The virtual prototype implemented in this way can often match the final hardware design in terms of functionality. Through virtual prototyping, the function verification and performance evaluation of the entire system can be carried out in the early development stage without waiting for the completion of the actual hardware.

[0003] However, currently SystemC faces the problems of steep learning curve, memory leakage risk, and inconvenient interaction with RTL code in virtual prototyping, which makes it impossible to properly implement the virtual prototype.

[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0005] The main purpose of the present invention is to provide a virtual prototype framework generation method, system, terminal and computer-readable storage medium, aiming to solve the problems of steep learning curve, memory leakage risk and inconvenient interaction with RTL code faced by SystemC in virtual prototype design in the prior art, which leads to the problem that the virtual prototype cannot be properly implemented.

[0006] To achieve the above object, the present invention provides a virtual prototype framework generation method, the virtual prototype framework generation method comprising the following steps: Acquire the co-simulation code, parse the co-simulation code, and obtain a target syntax tree; Analyze the target syntax tree to obtain port information, and save the port information into a corresponding target file; Generate an interactive interface using a process macro of a target language according to the target file, and generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; The service code and the target interface function are obtained, and a target executable file is generated according to the target virtual prototype framework, the service code and the target interface function.

[0007] Optionally, the acquiring the co-simulation code and parsing the co-simulation code to obtain a target syntax tree specifically includes: Acquire a collaborative simulation code, and perform lexical analysis on the collaborative simulation code to obtain a word set; After preprocessing the word set, a target syntax tree is obtained through syntax analysis.

[0008] Optionally, analyzing the target syntax tree to obtain port information, and saving the port information to a corresponding target file specifically includes: Analyze the target syntax tree to obtain port information, wherein the port information includes a signal name, a signal bit width, and a signal direction of the port; The port information is saved in the target file.

[0009] Optionally, generating an interactive interface according to the target file using a process macro of a target language, and generating a target virtual prototype framework according to the interactive interface specifically includes: defining a structure in a target language, and using the procedural macro on the structure to obtain interactive code; The target file is loaded into the interactive code to generate the interactive interface, and a target virtual prototype framework is generated according to the interactive interface.

[0010] Optionally, the acquiring of the service code and the target interface function, and generating a target executable file according to the target virtual prototype framework, the service code and the target interface function, specifically includes: Acquire multiple business collaborative simulation codes, generate multiple business codes based on the target virtual prototype framework, and compile each of the business codes to obtain a shared library; Obtaining a target interface function, and obtaining a target collaborative simulation code according to the target interface function and the target syntax tree; The target executable file is obtained according to the target co-simulation code and the shared library.

[0011] Optionally, the acquiring the target interface function, and obtaining the target collaborative simulation code according to the target interface function and the target syntax tree, specifically includes: Obtain a target interface function, and insert the target interface function into the target syntax tree to obtain the inserted target syntax tree; The inserted target syntax tree is restored to obtain the target collaborative simulation code.

[0012] Optionally, obtaining the target executable file according to the target co-simulation code and the shared library specifically includes: According to the shared library, converting the parameters to be transmitted by the target co-simulation code into target parameters in the shared library; The target executable file is generated based on the target language according to the target parameters corresponding to the parameters in the shared library.

[0013] In addition, to achieve the above-mentioned purpose, the present invention also provides a virtual prototype framework generation system, wherein the virtual prototype framework generation system comprises: A target syntax tree generation module is used to obtain the co-simulation code, parse the co-simulation code, and obtain a target syntax tree; A port information acquisition module is used to analyze the target syntax tree to obtain port information and save the port information into a corresponding target file; A target virtual prototype framework generation module is used to generate an interactive interface according to the target file using a process macro of a target language, and to generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; The target virtual prototype framework application module is used to obtain the service code and the target interface function, and generate a target executable file according to the target virtual prototype framework, the service code and the target interface function.

[0014] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a virtual prototype framework generation program stored in the memory and executable on the processor, and when the virtual prototype framework generation program is executed by the processor, the steps of the virtual prototype framework generation method as described above are implemented.

[0015] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a virtual prototype framework generation program, and when the virtual prototype framework generation program is executed by a processor, the steps of the virtual prototype framework generation method as described above are implemented.

[0016] In the present invention, the co-simulation code is obtained, the co-simulation code is parsed to obtain a target syntax tree; the target syntax tree is analyzed to obtain port information, and the port information is saved in a corresponding target file; according to the target file, an interactive interface is generated using a process macro of the target language, and a target virtual prototype framework is generated according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the co-simulation code and the target language; business code and target interface function are obtained, and a target executable file is generated according to the target virtual prototype framework, the business code and the target interface function. The present invention uses Rust as the target language, and implements a set of interfaces for virtual prototype modeling therein. Rust language is a memory-safe language, and there will be no memory leakage problem, so the risk of memory leakage is fundamentally solved; and the present invention solves the problem of inconvenient interaction of co-simulation code by pre-defining the co-simulation code port that needs to be co-simulated with virtual prototypes, and performing syntax analysis on the co-simulation code, and automatically generating an interactive interface between Rust and the co-simulation code. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flow chart of a preferred embodiment of the method for generating a virtual prototype framework of the present invention; Figure 2 It is a schematic diagram of a processing flow of an embodiment of a method for generating a virtual prototype framework of the present invention; Figure 3 It is a schematic diagram of the analysis process in the virtual prototype framework generation method of the present invention; Figure 4 It is a processing schematic diagram of an embodiment of the virtual prototype framework generation method of the present invention; Figure 5 It is a structural diagram of a preferred embodiment of the virtual prototype framework generation system of the present invention; Figure 6 It is a structural diagram of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION

[0018] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0019] When designing digital circuits, it is usually necessary to use HDL language to write RTL code, i.e., co-simulation code, after clarifying the design specifications, so as to realize the specific hardware functional logic. However, the RTL design process is often time-consuming and laborious, involving a lot of coding and repeated verification. For some complex modules, if you need to wait for the RTL code to be fully written before starting the functional verification process, it will slow down the progress of the entire project. Virtual prototyping technology should show great advantages in improving the efficiency of design verification. Virtual prototyping refers to the use of non-RTL languages, such as SystemC (a hardware description language for system-level design and modeling, based on the C++ language extension, providing a high-level abstraction method, allowing hardware and system modeling and simulation at a level closer to software) or other high-level modeling languages ​​to create a model with complete functional behavior (that is, virtualizing a specific hardware module). The virtual prototype implemented in this way can often match the final hardware design in terms of function. Through virtual prototyping, the entire system can be functionally verified and performance evaluated in the early development stage without waiting for the completion of the actual hardware. Virtual prototyping provides a highly configurable and debuggable virtual environment, enabling designers to quickly iterate and verify designs, discover and correct potential problems in a timely manner, and save significant time. Virtual prototyping also allows software development teams to conduct parallel development and testing in parallel with hardware design, which not only speeds up development progress, but also improves overall design efficiency.

[0020] Among the existing virtual prototype technologies, SystemC is a system-level design language based on C++, which is widely used in the creation of virtual prototypes. The main advantages of SystemC include: high level of abstraction, which allows design at a higher level of abstraction, so that designers can perform system-level verification and performance evaluation earlier; flexibility and scalability, based on C++, SystemC uses the object-oriented features of C++ to create flexible and scalable models; and extensive tool support, SystemC is supported by many EDA tools. However, SystemC also has some obvious disadvantages. Currently, SystemC faces a steep learning curve and the risk of memory leakage in virtual prototype design. Virtual prototype modeling of hardware often requires the model to have high reliability. Secondly, SystemC was originally designed to be used as a C++ library, and did not emphasize the interaction between the virtual prototype and the actual RTL code after SystemC modeling. This means that if the designer uses SystemC for modeling, he or she needs to find another solution (such as using SystemVerilog's interface function) to connect the SystemC model to the actual RTL code in order to perform joint simulation of the virtual prototype and the real hardware module. There is no automated and sufficiently abstract process to implement this entire process, which leads to inconvenient interaction with RTL code in SystemC and other solutions.

[0021] In response to one or more of the above problems, the present invention obtains a collaborative simulation code, parses the collaborative simulation code to obtain a target syntax tree; analyzes the target syntax tree to obtain port information, and saves the port information to a corresponding target file; generates an interactive interface based on the target file using a process macro of a target language, and generates a target virtual prototype framework based on the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; obtains a business code and a target interface function, and generates a target executable file based on the target virtual prototype framework, the business code and the target interface function.

[0022] The virtual prototype framework generation method described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the virtual prototype framework generation method includes the following steps: Step S10: Acquire the collaborative simulation code, parse the collaborative simulation code, and obtain a target syntax tree.

[0023] It should be noted that the specific implementation process of the present invention is as follows Figure 2 As shown, at the beginning, it is necessary to obtain the co-simulation code, that is, the RTL code, and parse it accordingly to obtain the corresponding target syntax tree, that is, Figure 2The abstract syntax tree (AST: Abstract Syntax Tree, Abstract Syntax Tree, is a tree data structure used to represent the structure of program source code. It is widely used in compilers and interpreters to help analyze and process the grammatical structure of the program).

[0024] Further, the acquiring of the collaborative simulation code and parsing of the collaborative simulation code to obtain a target syntax tree specifically includes: Acquire a collaborative simulation code, and perform lexical analysis on the collaborative simulation code to obtain a word set; After preprocessing the word set, a target syntax tree is obtained through syntax analysis.

[0025] Specifically, the co-simulation code is first parsed into a target syntax tree, namely, an abstract syntax tree (AST), and then additional operations need to be performed on the syntax tree information (reading port information, inserting target functions, etc.); Figure 3 As shown in the figure, when parsing, it is implemented through lexical analysis (Lexing) and grammatical analysis (Parsing), so as to obtain the corresponding abstract syntax tree, that is, the target syntax tree; the preprocessing is to expand the macros in the word set (Token).

[0026] Step S20: Analyze the target syntax tree to obtain port information, and save the port information into a corresponding target file.

[0027] Specifically, Figure 2 As shown, the target syntax tree, i.e., the abstract syntax tree, is analyzed to extract the port information of the module corresponding to the RTL code: the signal name of the port, the signal bit width, the signal direction, and the input and output type of the port, etc., and store this information in a target file. In a preferred embodiment of the present invention, the target file is a JSON file.

[0028] Further, the target syntax tree is analyzed to obtain port information, and the port information is saved in a corresponding target file, specifically including: Analyze the target syntax tree to obtain port information, wherein the port information includes a signal name, a signal bit width, and a signal direction of the port; The port information is saved in the target file.

[0029] Specifically, for the target syntax tree, the corresponding port information is obtained therefrom and saved in a JSON file for subsequent processing.

[0030] Step S30: Generate an interactive interface according to the target file using a process macro of the target language, and generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language.

[0031] Specifically, a procedural macro is written in Rust (a system programming language) to read an external JSON file when compiling the interactive code, parse the file content to generate interactive code (mainly including port definitions, etc.) for describing the co-simulation RTL, and finally generate a target virtual prototype framework of Rust.

[0032] Further, the process macro of the target language is used to generate an interactive interface according to the target file, and the target virtual prototype framework is generated according to the interactive interface, which specifically includes: defining a structure in a target language, and using the procedural macro on the structure to obtain interactive code; The target file is loaded into the interactive code to generate the interactive interface, and a target virtual prototype framework is generated according to the interactive interface.

[0033] Specifically, Rust's procedural macros are a metaprogramming tool that allows developers to generate code at compile time; unlike traditional macros (such as macros in C language), procedural macros can accept input Rust code and generate corresponding Rust code, and can also input various parameters provided by the user, such as files, values, and strings, and dynamically generate code based on this information. In the present invention, the procedural macro used here is a special procedural macro provided by the present invention. For this procedural macro, in the present invention, when the name of the virtual prototype module to be generated is Test, then a structure (struct) is defined in Rust, and a procedural macro (called: virtual_rtl) provided by the present invention is used on this struct, then the following code can be obtained: #[virtual_rtl(<JSON file containing port information>)] pub struct { / / ... }.

[0034] The process macro will automatically insert the port information of the module required for virtual prototype generation into this struct.

[0035] Step S40: Obtain the service code and the target interface function, and generate a target executable file according to the target virtual prototype framework, the service code and the target interface function.

[0036] Specifically, based on the target virtual prototype framework generated in the above steps, other Rust business codes can be written to implement specific virtual prototype logic functions. This target virtual prototype framework is used for the interaction between Rust business code and RTL code, mainly involving the assignment of RTL code module ports. After writing the Rust business code, it can be compiled into a shared library for use in subsequent simulation executable files.

[0037] Further, the acquiring of the service code and the target interface function, and generating a target executable file according to the target virtual prototype framework, the service code and the target interface function, specifically includes: Acquire multiple business collaborative simulation codes, generate multiple business codes based on the target virtual prototype framework, and compile each of the business codes to obtain a shared library; Obtaining a target interface function, and obtaining a target collaborative simulation code according to the target interface function and the target syntax tree; The target executable file is obtained according to the target co-simulation code and the shared library.

[0038] Specifically, Figure 2 As shown, in the process of generating the target executable file, based on the target virtual prototype framework, other RTL codes, namely business collaborative simulation codes, are introduced accordingly to obtain business codes, which can be compiled to obtain a shared library.

[0039] Further, the acquiring the target interface function, and obtaining the target collaborative simulation code according to the target interface function and the target syntax tree, specifically includes: Obtain a target interface function, and insert the target interface function into the target syntax tree to obtain the inserted target syntax tree; The inserted target syntax tree is restored to obtain the target collaborative simulation code.

[0040] Specifically, the abstract syntax tree is code-inserted to insert DPI-C interface functions, i.e., target interface functions. These interface functions are mainly responsible for signal transmission with Rust (transferring signal values ​​in RTL to Rust). The code-insertion process is actually an operation on the syntax tree, which will be subsequently restored to RTL code. At this time, the RTL code includes the code after the DPI-C interface function is inserted.

[0041] Among them, DPI-C, namely Direct Programming Interface for C, is an interface standard for interacting C language with SystemVerilog (SV language); it is mainly used to realize the communication between C code and SystemVerilog code in hardware design and verification; DPI-C allows designers to call C functions in SystemVerilog, and call SystemVerilog tasks and functions in C language. Since Rust can provide a function interface of C language, the present invention can use the DPI-C interface to interact with SystemVerilog. The RTL code mainly targeted in the present invention is SystemVerilog, but because most hardware simulators now also support the use of DPI-C for Verilog, the present invention is also applicable to Verilog (a hardware description language).

[0042] Further, obtaining the target executable file according to the target co-simulation code and the shared library specifically includes: According to the shared library, converting the parameters to be transmitted by the target co-simulation code into target parameters in the shared library; The target executable file is generated based on the target language according to the target parameters corresponding to the parameters in the shared library.

[0043] like Figure 2 As shown in the figure, after obtaining the corresponding shared library and target co-simulation code, the target co-simulation code and the shared library generated by Rust can be compiled to obtain the target executable file, that is, the executable file, and the virtual prototype is simulated through the target executable file. Among them, the relationship between the DPI-C interface function and the shared library in the RTL code is: in the target co-simulation code, the declaration of the DPI-C interface function needs to match the corresponding C function defined in the shared library, which means that the parameter type and return value type must be consistent to ensure that the data can be correctly passed when calling; when the DPI-C interface function is called, the simulation tool will transfer control to the corresponding C function through the shared library. At this time, any parameter passed to the DPI-C function will be converted to the type of the C language defined in the shared library, and vice versa.

[0044] Furthermore, if Figure 4As shown, in the present invention, an L2Cache (secondary cache) is developed using the method of the present invention. A processor core (RTL code has been written) is already available, but various components under the third-level cache have not yet been developed. Therefore, the entire processor system cannot run because of incomplete components. Among them, L2Cache, i.e., the second-level cache, is an important cache level in computer architecture, located between the processor core and the main memory. Its main function is to increase the data access speed and reduce the processor's access delay to the main memory; L3Cache, i.e., the third-level cache, is similar to L2Cache, located between the second-level cache and the running memory, and is mainly used to further improve the data access speed and system performance; DDR memory (Double Data Rate SDRAM), i.e., a memory specification.

[0045] We chose to develop the third-level cache as well, that is, to develop a third-level cache RTL code at the same time, but this will take a long time (there are various debugging issues), and this will also limit the integrated testing of the second-level cache (that is, integrating the processor core + second-level cache + third-level cache) for testing, slowing down the progress of the entire project. In order to solve this problem, when developing the second-level cache, a virtual prototype is written for the third-level cache. This virtual prototype is not implemented by RTL code, so it is much faster to develop and debug than by RTL code. Here, the framework provided by the present invention is used to first define the interaction interface between the third-level cache and the second-level cache, and then write it into an empty RTL file. Next, the port information therein is extracted using the tool provided by the framework, and a JSON file is generated to store the port information. Then, Rust can be used to write the business code of the third-level cache. In the process of writing the business code, the relevant Rust-related macros provided by the framework can be used to generate a virtual prototype structure, thereby providing an interaction interface from Rust to RTL code, so that the Rust business code can interact with the RTL code signal. After the Rust code is written, it is generated as a shared library, which can be loaded during simulation later, so that the third-level cache described by the virtual prototype can be used during RTL code simulation. There is no need to spend a lot of time to develop the RTL version of the third-level cache, thereby reducing the development time.

[0046] The present invention obtains the co-simulation code, parses the co-simulation code, and obtains the target syntax tree; analyzes the target syntax tree, obtains port information, and saves the port information into the corresponding target file; according to the target file, uses the process macro of the target language to generate an interactive interface, and generates a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes the interactive interface between the co-simulation code and the target language; obtains the business code and the target interface function, and generates a target executable file according to the target virtual prototype framework, the business code and the target interface function. The present invention uses Rust as the target language, and implements a set of interfaces for virtual prototype modeling therein. Rust language is a memory-safe language, and there will be no memory leakage problem, so the risk of memory leakage is fundamentally solved; and the present invention solves the problem of inconvenient interaction of co-simulation code by pre-defining the co-simulation code port that needs to be co-simulated by virtual prototype, and performing syntax analysis on the co-simulation code, and automatically generating the interactive interface between Rust and the co-simulation code.

[0047] Furthermore, if Figure 5 As shown, based on the above virtual prototype framework generation method, the present invention also provides a virtual prototype framework generation system, wherein the virtual prototype framework generation system includes: A target syntax tree generation module 51 is used to obtain the co-simulation code, parse the co-simulation code, and obtain a target syntax tree; A port information acquisition module 52 is used to analyze the target syntax tree to obtain port information and save the port information into a corresponding target file; A target virtual prototype framework generation module 53 is used to generate an interactive interface according to the target file using a process macro of a target language, and to generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; The target virtual prototype framework application module 54 is used to obtain the service code and the target interface function, and generate a target executable file according to the target virtual prototype framework, the service code and the target interface function.

[0048] Furthermore, if Figure 6 As shown, based on the above virtual prototype framework generation method and system, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Figure 6 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0049] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a virtual prototype framework generation program 40 is stored on the memory 20, and the virtual prototype framework generation program 40 can be executed by the processor 10, thereby realizing the virtual prototype framework generation method in the present invention.

[0050] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, and is used to run the program code or process data stored in the memory 20, such as executing the virtual prototype framework generation method.

[0051] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface.

[0052] In one embodiment, when the processor 10 executes the virtual prototype framework generation program 40 in the memory 20 , the steps of the above virtual prototype framework generation method are implemented.

[0053] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a virtual prototype framework generation program, and when the virtual prototype framework generation program is executed by a processor, the following steps are implemented: Acquire the co-simulation code, parse the co-simulation code, and obtain a target syntax tree; Analyze the target syntax tree to obtain port information, and save the port information into a corresponding target file; Generate an interactive interface using a process macro of a target language according to the target file, and generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; The service code and the target interface function are obtained, and a target executable file is generated according to the target virtual prototype framework, the service code and the target interface function.

[0054] The step of obtaining the collaborative simulation code and parsing the collaborative simulation code to obtain a target syntax tree specifically includes: Acquire a collaborative simulation code, and perform lexical analysis on the collaborative simulation code to obtain a word set; After preprocessing the word set, a target syntax tree is obtained through syntax analysis.

[0055] The step of analyzing the target syntax tree to obtain port information and saving the port information to a corresponding target file specifically includes: Analyze the target syntax tree to obtain port information, wherein the port information includes a signal name, a signal bit width, and a signal direction of the port; The port information is saved in the target file.

[0056] The step of generating an interactive interface according to the target file using a process macro of a target language, and generating a target virtual prototype framework according to the interactive interface specifically includes: defining a structure in a target language, and using the procedural macro on the structure to obtain interactive code; The target file is loaded into the interactive code to generate the interactive interface, and a target virtual prototype framework is generated according to the interactive interface.

[0057] The acquiring of the service code and the target interface function, and generating a target executable file according to the target virtual prototype framework, the service code and the target interface function, specifically includes: Acquire multiple business collaborative simulation codes, generate multiple business codes based on the target virtual prototype framework, and compile each of the business codes to obtain a shared library; Obtaining a target interface function, and obtaining a target collaborative simulation code according to the target interface function and the target syntax tree; The target executable file is obtained according to the target co-simulation code and the shared library.

[0058] The step of acquiring the target interface function and obtaining the target collaborative simulation code according to the target interface function and the target syntax tree specifically includes: Obtain a target interface function, and insert the target interface function into the target syntax tree to obtain the inserted target syntax tree; The inserted target syntax tree is restored to obtain the target collaborative simulation code.

[0059] Wherein, obtaining the target executable file according to the target co-simulation code and the shared library specifically includes: According to the shared library, converting the parameters to be transmitted by the target co-simulation code into target parameters in the shared library; The target executable file is generated based on the target language according to the target parameters corresponding to the parameters in the shared library.

[0060] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or terminal including the element.

[0061] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the program can be stored in a computer-readable storage medium that can be read by a computer, and the program can include the processes of the above-mentioned method embodiments when executed. The computer-readable storage medium can be a memory, a disk, an optical disk, etc.

[0062] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A method for generating a virtual prototype framework, characterized in that: The virtual prototype framework generation method comprises: Acquire the co-simulation code, parse the co-simulation code, and obtain a target syntax tree; Analyze the target syntax tree to obtain port information, and save the port information into a corresponding target file; Generate an interactive interface using a process macro of a target language according to the target file, and generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; The service code and the target interface function are obtained, and a target executable file is generated according to the target virtual prototype framework, the service code and the target interface function.

2. The method for generating a virtual prototype framework according to claim 1, characterized in that: The acquiring of the co-simulation code and parsing of the co-simulation code to obtain a target syntax tree specifically includes: Acquire a collaborative simulation code, and perform lexical analysis on the collaborative simulation code to obtain a word set; After preprocessing the word set, a target syntax tree is obtained through syntax analysis.

3. The method for generating a virtual prototype framework according to claim 1, characterized in that: The analyzing the target syntax tree to obtain port information and saving the port information to a corresponding target file specifically includes: Analyze the target syntax tree to obtain port information, wherein the port information includes a signal name, a signal bit width, and a signal direction of the port; The port information is saved in the target file.

4. The method for generating a virtual prototype framework according to claim 1, characterized in that: The step of generating an interactive interface according to the target file using a process macro of a target language, and generating a target virtual prototype framework according to the interactive interface specifically includes: defining a structure in a target language, and using the procedural macro on the structure to obtain interactive code; The target file is loaded into the interactive code to generate the interactive interface, and a target virtual prototype framework is generated according to the interactive interface.

5. The method for generating a virtual prototype framework according to claim 1, characterized in that: The acquiring of the service code and the target interface function, and generating a target executable file according to the target virtual prototype framework, the service code and the target interface function, specifically includes: Acquire multiple business collaborative simulation codes, generate multiple business codes based on the target virtual prototype framework, and compile each of the business codes to obtain a shared library; Obtaining a target interface function, and obtaining a target collaborative simulation code according to the target interface function and the target syntax tree; The target executable file is obtained according to the target co-simulation code and the shared library.

6. The method for generating a virtual prototype framework according to claim 5, characterized in that: The acquiring of the target interface function, and obtaining the target collaborative simulation code according to the target interface function and the target syntax tree, specifically includes: Obtain a target interface function, and insert the target interface function into the target syntax tree to obtain the inserted target syntax tree; The inserted target syntax tree is restored to obtain the target collaborative simulation code.

7. The method for generating a virtual prototype framework according to claim 5, characterized in that: The step of obtaining the target executable file according to the target co-simulation code and the shared library specifically includes: According to the shared library, converting the parameters to be transmitted by the target co-simulation code into target parameters in the shared library; The target executable file is generated based on the target language according to the target parameters corresponding to the parameters in the shared library.

8. A virtual prototype framework generation system, characterized in that: The virtual prototype framework generation system comprises: A target syntax tree generation module is used to obtain the co-simulation code, parse the co-simulation code, and obtain a target syntax tree; A port information acquisition module is used to analyze the target syntax tree to obtain port information and save the port information into a corresponding target file; A target virtual prototype framework generation module is used to generate an interactive interface according to the target file using a process macro of a target language, and to generate a target virtual prototype framework according to the interactive interface, wherein the target virtual prototype framework includes an interactive interface between the collaborative simulation code and the target language; The target virtual prototype framework application module is used to obtain the service code and the target interface function, and generate a target executable file according to the target virtual prototype framework, the service code and the target interface function.

9. A terminal, characterized in that: The terminal includes: a memory, a processor, and a virtual prototype framework generation program stored in the memory and executable on the processor. When the virtual prototype framework generation program is executed by the processor, the steps of the virtual prototype framework generation method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a virtual prototype framework generation program, and when the virtual prototype framework generation program is executed by a processor, the steps of the virtual prototype framework generation method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Code integration method, system and device for register conversion circuit and medium

    CN114968202A

  • System and method for automatically generating device drivers for run time environments

    US20170115969A1