Simulation method based on software compiling library, electronic equipment and medium
By constructing virtual library dependency information, the problem of frequent updates to the prototype file path in high-level language development is solved, thereby improving the simulation efficiency and accuracy based on software compilation libraries.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-16
- Publication Date
- 2026-04-10
AI Technical Summary
In existing technologies, during simulations based on software compilation libraries, the paths of prototype files developed in high-level languages are frequently updated and difficult to manage, resulting in low simulation efficiency and accuracy, and the path information is easily missed due to its singular transmission.
By constructing virtual library dependency information and establishing the correspondence between virtual libraries and software compilation libraries, users only need to add the default simulation instruction identifier or branch simulation instruction identifier of the virtual library in the simulation instructions to automatically load the corresponding software compilation libraries for simulation operations.
It simplifies user operations, improves simulation efficiency and accuracy, and reduces maintenance costs.
Smart Images

Figure CN121833140A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the chip technical field, and particularly to a simulation method based on a software compilation library, an electronic device and a medium. BACKGROUND
[0002] In the chip development process, a simulation process needs to be implemented based on a software compilation library, for example, a hardware-software co-simulation. The software compilation library is generated by compiling a prototype file developed based on a high-level language. In the chip development process, the prototype file developed based on the high-level language can be frequently updated, and the path can be frequently changed. In addition, because the number of the prototype file developed based on the high-level language is large, it is inconvenient to manage. In the prior art, the prototype file developed based on the high-level language is visible to each user, and the maintenance cost is high. In the process of using the software compilation library, the path of each prototype file developed based on the high-level language that needs to be used needs to be input in a simulation command, which leads to a single transmission mode of the path information of the prototype file developed based on the high-level language that needs to be used, and the prototype file developed based on the high-level language that needs to be used is easily missed, thereby reducing the efficiency and accuracy of the simulation based on the software compilation library. Therefore, how to improve the efficiency and accuracy of the simulation based on the software compilation library becomes a technical problem to be solved. SUMMARY
[0003] The present application aims to provide a simulation method based on a software compilation library, an electronic device and a medium, and improve the efficiency and accuracy of the simulation based on the software compilation library.
[0004] According to a first aspect of the present application, a simulation method based on a software compilation library is provided, comprising: Step S1, constructing virtual library dependency information {A0, A1, A2,..., An,..., AN}, wherein A0 is virtual library default dependency information, An is the n-th branch of the virtual library corresponding dependency information, n is in the range of 1 to N, N is the total number of virtual library branches, A0={B0, A10, A20,..., An0,..., AN0}, B0 is a virtual library default simulation instruction identifier, An0={Bi, Ai1, Ai2,..., Aif(0)}, i is in the range of 1 to f(0), f(0) is the total number of software compilation libraries that the virtual library depends on by default, and Ai1, Ai2,..., Aif(0) are the first to the f(0)-th software compilation library names that the virtual library depends on by default. n ,...,A N} n ,...,A 0 0 0 ,...,A i 0 ,...,A f(0) 0} is the n-th branch of the virtual library corresponding dependency information, n is in the range of 1 to N, N is the total number of virtual library branches, A0={B0, A10, A20,..., An0,..., AN0}, B0 is a virtual library default simulation instruction identifier, An0={Bi, Ai1, Ai2,..., Aif(0)}, i is in the range of 1 to f(0), f(0) is the total number of software compilation libraries that the virtual library depends on by default, and Ai1, Ai2,..., Aif(0) are the first to the f(0)-th software compilation library names that the virtual library depends on by default. 0 i 0 n n n n j n ..., A g(n) n}, B n is an identification of a simulation instruction corresponding to the nth branch of the virtual library, A j n is the jth software compiled library name relied on by the nth branch of the virtual library, j is in the range of 1 to g(n), and g(n) is the total number of software compiled libraries relied on by the nth branch of the virtual library; Step S2, obtaining virtual library dependency information corresponding to the test case set to be run, if the corresponding virtual library dependency information is A0, executing step S3, if the corresponding virtual library dependency information is A n , executing step S4; Step S3, adding B 0 in the simulation instruction, and based on B 0 , using a preset loading instruction to index each A i 0 corresponding path, based on each A i 0 corresponding path to load A i 0 corresponding software compiled library for the test case set to be run to perform a simulation operation, and ending the process; Step S4, adding B 0 and target B n in the simulation instruction, and based on B 0 and target B n , using a preset loading instruction to index each target B n corresponding each target A j n corresponding path, based on each target A j n corresponding path to load each target A j n corresponding software compiled library for the test case set to be run to perform a simulation operation, and ending the process.
[0005] According to the second aspect of the present application, an electronic device is provided, comprising: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executed by the at least one processor, and the instructions are configured to execute the method of the first aspect of the present application.
[0006] According to the third aspect of the present application, a computer readable storage medium is provided, which stores computer executable instructions, and the computer executable instructions are used to execute the method of the first aspect of the present application.
[0007] The application has obvious advantages and beneficial effects compared with the prior art. By means of the technical scheme, the simulation method based on software compilation library, the electronic device and the medium provided by the application can achieve considerable technical progress and practicability, and have wide industrial utilization value, and at least have the following beneficial effects: The application establishes the corresponding dependency information of the virtual library and the virtual library branch, establishes the corresponding relationship between the virtual library and the virtual library branch and the software compilation library, and only needs to add the virtual library default simulation instruction identifier or the virtual library default simulation instruction identifier and the branch corresponding simulation instruction identifier in the simulation instruction when the user runs the test case set, so that the corresponding software compilation library can be obtained based on the combination of the virtual library default simulation instruction identifier or the virtual library default simulation instruction identifier and the branch corresponding simulation instruction identifier, and the simulation operation of the test case set to be executed is performed, which simplifies the user operation and improves the efficiency and accuracy of the simulation based on the software compilation library. BRIEF DESCRIPTION OF DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in the embodiments of the application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0009] Figure 1 The simulation method based on software compilation library provided by the embodiment of the application is shown in the flowchart. DETAILED DESCRIPTION
[0010] The technical solutions in the embodiments of the application will be described clearly and completely in combination with the drawings in the embodiments of the application. Obviously, the described embodiments are only some embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the application.
[0011] The embodiment of the application provides a simulation method based on software compilation library, as shown in Figure 1 , which comprises: Step S1, constructing virtual library dependency information {A0, A1, A2,..., An,..., An+1,..., An+N}, wherein A0 is virtual library default dependency information, An is the dependency information corresponding to the nth branch of the virtual library, n is in the range of 1 to N, N is the total number of virtual library branches, and A0={B0, B1, B2,..., Bn,..., Bn+N}. n ,...,A N}, wherein A0 is virtual library default dependency information, An is the dependency information corresponding to the nth branch of the virtual library, n is in the range of 1 to N, N is the total number of virtual library branches, and A0={B0, B1, B2,..., Bn,..., Bn+N}. n 0 0 0 ,...,Ai 0 ..., A f(0) 0}, B 0 is a virtual library default emulation instruction identifier, A i 0 is the i-th software compiled library name of the virtual library default dependency, i is in the range of 1 to f(0), f(0) is the total number of software compiled libraries of the virtual library default dependency, A n = {B n , A1 n , A2 n ..., A j n ..., A g(n) n}, B n is the n-th branch of the virtual library corresponding emulation instruction identifier, A j n is the j-th software compiled library name of the n-th branch of the virtual library dependency, j is in the range of 1 to g(n), g(n) is the total number of software compiled libraries of the n-th branch of the virtual library dependency.
[0012] It should be noted that different projects can build different virtual libraries, each project corresponds to a virtual library, and the virtual library can have branches. In most cases, the default virtual library used by the user in a project can meet the simulation requirements, and in a small number of cases, there is a need to set branches, and the number of branches is usually not too much, preferably, 0≤N≤3.B 0 Specifically, it can be set as a dynamic link library identifier.
[0013] Step S2, obtain the virtual library dependency information corresponding to the test case set to be run, if the corresponding virtual library dependency information is A0, execute step S3, if the corresponding virtual library dependency information is A n , execute step S4.
[0014] It should be noted that each user sets a corresponding test case set in the project, and each test case set sets corresponding virtual library dependency information according to the running requirement, which can be virtual library default dependency information or branch corresponding dependency information of the virtual library, which is determined according to the specific running requirement.
[0015] Step S3, add B 0 in the simulation instruction, based on B 0 , each A i 0 corresponding path is indexed by a preset loading instruction, based on each A i 0 corresponding path loads A i0 The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
[0016] It should be noted that B 0 Corresponding to a storage space, A1 0 A2 0 ,...,A i 0 ,...,A f(0) 0 The corresponding software libraries are all stored in B 0 In the corresponding storage space.
[0017] Step S4: Add B to the simulation command 0 and Target B n Based on B 0 and Target B n The target B is indexed using a preset loading instruction. n Each corresponding target A j n The corresponding path, based on each target A j n Load each target A along the corresponding path. j n The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
[0018] It should be noted that B 0 and Target B n The corresponding combination corresponds to a storage space, target B n Corresponding A1 n A2 n ,...,A j n ,...,A g(n) n The corresponding software compilation libraries are all stored in B. 0 and Target B n The corresponding combination resides in the corresponding storage space. As an example, the simulation operation can specifically be a hardware-software co-simulation operation during chip simulation.
[0019] As one embodiment, step S1 includes: Step S11: Obtain a list of prototype files developed using a high-level language.
[0020] Specifically, the high-level language can be C++, C, Rust, etc.
[0021] Step S12: Compile each prototype file in the prototype file list to generate the corresponding software compilation library.
[0022] It should be noted that when a software library needs to be updated, the prototype file developed based on the high-level language is updated first, and then the corresponding software library file to be updated is compiled based on the updated prototype file developed based on the high-level language.
[0023] Step S13: Divide incompatible software libraries into different software library sets, divide related software libraries into the same software library set, and allow the same software libraries to exist in different software library sets.
[0024] It's important to note that software libraries are generally compatible. Only in a few special cases, such as when a small number of users have test case sets with specific runtime requirements that the default libraries cannot meet, will incompatible libraries exist. Storing incompatible libraries in the same storage space will cause conflicts; therefore, incompatible libraries should be partitioned into different library sets. Furthermore, running test case sets may require multiple related libraries; therefore, related libraries should be grouped into the same library set. However, it's understandable that the same library might be used in multiple library sets; therefore, it needs to be stored separately in different library sets.
[0025] Step S14: Store the software libraries in each software library set in the corresponding storage space.
[0026] It is understandable that, through the above processing, each storage space stores related software compilation libraries, and there are no incompatible software compilation libraries.
[0027] Step S15: Select the software compilation library from the storage space most frequently used by the software compilation library and set B. 0 Generate A0.
[0028] It should be noted that in the same project, most users' test case sets need to use the default virtual library, while a small number of users' test case sets need to use branches of the virtual library. The default virtual library is used most frequently, and the corresponding storage space required is also used most frequently. Therefore, the software compilation library is selected from the storage space required by the software compilation library with the highest frequency of use, and B is set. 0 This generates A0. It's understandable that the software libraries in the storage space can be used by multiple projects. Therefore, for a single project, some or all of the software libraries can be selected from the storage space to generate A0, depending on the specific application requirements.
[0029] Step S15: Select the software compilation library from a storage space other than the storage space with the highest frequency of use required by the software compilation library and set the corresponding B. n Generate A n .
[0030] It should be noted that B 0 and B n The corresponding combination corresponds to a storage space, for each A n All of these require selecting the software compilation library from a storage space other than the storage space used most frequently by the software compilation library to generate A. n .
[0031] As one embodiment, step S3 includes: Step S31: Add B to the simulation command 0 .
[0032] It should be noted that when using the software compilation library corresponding to the default virtual library, the user only needs to add B to the simulation command during the execution of the test case set. 0 It eliminates the need to focus on specific software compilation libraries, greatly simplifying user operations.
[0033] Step S32: If the software compilation library has an overwrite path, specify the path corresponding to the software compilation library based on the environment variable used to specify the library file path.
[0034] It should be noted that in some application scenarios, there may be situations where it is necessary to partially modify the software compilation library that needs to be obtained. In this case, it is only necessary to specify the path of the software compilation library through the environment variable used to specify the path of the library file. As an example, the environment variable used to specify the path of the library file can be LD_LIBRARY_PATH.
[0035] Step S33, if A i 0 If a corresponding coverage path exists, then A i 0 The corresponding software library is retrieved from the corresponding coverage path; otherwise, the preset loading instructions are used in B. 0 Index A in the corresponding storage space i 0 The corresponding path loads A. i 0 The corresponding software compilation library.
[0036] It should be noted that the coverage path can specifically be B. 0 The path in the corresponding storage space can also be a path in other storage spaces.
[0037] Step S34, based on all Ai 0 The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
[0038] As one embodiment, step S4 includes: Step S41: Add B to the simulation command 0 and Target B n .
[0039] It should be noted that when using the software compilation library corresponding to the virtual library branch, the user only needs to add B and target B to the simulation command during the execution of the test case set. n It eliminates the need to focus on specific software compilation libraries, greatly simplifying user operations.
[0040] Step S42: If the software compilation library has an overwrite path, specify the path corresponding to the software compilation library based on the environment variable used to specify the library file path.
[0041] It should be noted that in some application scenarios, there may be situations where it is necessary to partially modify the software compilation library that needs to be obtained. In this case, it is only necessary to specify the path of the software compilation library through the environment variable used to specify the path of the library file. As an example, the environment variable used to specify the path of the library file can be LD_LIBRARY_PATH.
[0042] Step S43, if A j n If a corresponding coverage path exists, then based on A j n The corresponding software library is retrieved from the corresponding coverage path; otherwise, the preset loading instructions are used in B. 0 and Target B n Index A in the storage space corresponding to the combination j n The corresponding path loads A. j n The corresponding software compilation library.
[0043] It should be noted that the coverage path can specifically be B. 0 and Target B n The path can be combined with the path in the corresponding storage space, or it can be a path in other storage spaces.
[0044] Step S44, based on all A j n The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
[0045] It should be noted that when it is necessary to update the compiled library files, the S1 section also includes: Step S10: Obtain the software compilation library file to be updated. The software compilation library file to be updated corresponds to the software compilation library that the virtual library depends on by default or the software compilation library that the branch of the corresponding virtual library depends on.
[0046] Specifically, the software compilation library file to be updated can be a software compilation library that the virtual library depends on by default or a software compilation library that the corresponding branch of the virtual library depends on. First, update the corresponding prototype file developed based on the high-level language, and then compile and generate the software compilation library file to be updated based on the updated prototype file developed based on the high-level language.
[0047] Step S20: Run the first test case set corresponding to the software compilation library file to be updated based on the software compilation library file to be updated. The first test case set is used to detect whether the new functions corresponding to the software compilation library to be updated are implemented. If all tests pass, proceed to step S30; otherwise, return to update the software compilation library file to be updated.
[0048] It should be noted that each software library file has a corresponding first test case set. The software library to be updated needs to pass the first test case set test. If it fails, it is necessary to go back and modify the prototype file developed in the high-level language, recompile and generate the software library file to be updated, until it passes the first test case set test before step S30 can be executed.
[0049] Step S30: Run the second test case set corresponding to the software compilation library file to be updated based on the software compilation library file to be updated. The second test case set is used to detect whether the software compilation library to be updated still supports the existing functions. If all tests pass, the software compilation library file to be updated will overwrite the corresponding original software compilation library file.
[0050] It should be noted that the software library file to be updated needs to pass the second test case set to ensure that the update does not affect other existing functions. If it fails, the prototype file developed in the high-level language needs to be modified and recompiled to generate the software library file to be updated. Only after passing the second test case set can the software library file to be updated overwrite the corresponding original software library file. The update process is imperceptible to the user. The user still only needs to add B to the simulation command. 0 Alternatively, add B to the simulation command. 0 and Target B n That's all.
[0051] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0052] This invention also provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being configured to perform the method described in this invention.
[0053] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.
[0054] This invention establishes dependency information corresponding to virtual libraries and their branches, and establishes a correspondence between virtual libraries, their branches, and software compiler libraries. When running a set of test cases, users only need to add a default virtual library simulation instruction identifier or a combination of the default virtual library simulation instruction identifier and the simulation instruction identifier corresponding to the branch to the simulation instruction. Based on the default virtual library simulation instruction identifier or the combination of the default virtual library simulation instruction identifier and the simulation instruction identifier corresponding to the branch, the corresponding software compiler library can be obtained for the set of test cases to be run to perform simulation operations. This simplifies user operations and improves the efficiency and accuracy of simulation based on software compiler libraries.
[0055] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A simulation method based on a software compilation library, characterized in that, include: Step S1: Construct virtual library dependency information {A0, A1, A2, ..., A n ,...,A N }, where A0 represents the default dependency information for the virtual library, A n This refers to the dependency information corresponding to the nth branch of the virtual library, where n ranges from 1 to N, and N is the total number of branches in the virtual library. A0 = {B} 0 A1 0 A2 0 ,...,A i 0 ,...,A f(0) 0 }, B 0 A is the default simulation instruction identifier for the virtual library. i 0 Let A be the name of the i-th software library that the virtual library depends on by default, where i ranges from 1 to f(0), and f(0) is the total number of software libraries that the virtual library depends on by default. n ={B n A1 n A2 n ,...,A j n ,...,A g(n) n }, B n A is the simulation instruction identifier corresponding to the nth branch of the virtual library. j n Let g(n) be the name of the j-th software library that the n-th branch of the virtual library depends on, where j ranges from 1 to g(n), and g(n) is the total number of software libraries that the n-th branch of the virtual library depends on. Step S2: Obtain the virtual library dependency information corresponding to the set of test cases to be run. If the corresponding virtual library dependency information is A0, then proceed to step S3. If the corresponding virtual library dependency information is A... n Then proceed to step S4; Step S3: Add B to the simulation command 0 Based on B 0 Each A is indexed using a preset loading instruction. i 0 The corresponding path, based on each A i 0 Load A at the corresponding path i 0 The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends. Step S4: Add B to the simulation command 0 and Target B n Based on B 0 and Target B n The target B is indexed using a preset loading instruction. n Each corresponding target A j n The corresponding path, based on each target A j n Load each target A along the corresponding path. j n The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
2. The method according to claim 1, characterized in that, Step S1 includes: Step S11: Obtain a list of prototype files developed using a high-level language; Step S12: Compile each prototype file in the prototype file list to generate the corresponding software compilation library; Step S13: Divide incompatible software libraries into different software library sets, divide related software libraries into the same software library set, and allow the same software libraries to exist in different software library sets; Step S14: Store the software libraries in each software library set in the corresponding storage space; Step S15: Select the software compilation library from the storage space most frequently used by the software compilation library and set B. 0 Generate A0; Step S15: Select the software compilation library from a storage space other than the storage space with the highest frequency of use required by the software compilation library and set the corresponding B. n Generate A n .
3. The method according to claim 2, characterized in that, The high-level languages include C++, C, and Rust.
4. The method according to claim 1, characterized in that, 0≤N≤3。 5. The method according to claim 1, characterized in that, Step S3 includes: Step S31: Add B to the simulation command 0 ; Step S32: If the software compilation library has an overwrite path, specify the path corresponding to the software compilation library based on the environment variable used to specify the library file path; Step S33, if A i 0 If a corresponding coverage path exists, then A i 0 The corresponding software library is retrieved from the corresponding coverage path; otherwise, the preset loading instructions are used in B. 0 Index A in the corresponding storage space i 0 The corresponding path loads A. i 0 The corresponding software compilation library; Step S34, based on all A i 0 The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
6. The method according to claim 1, characterized in that, Step S4 includes: Step S41: Add B to the simulation command 0 and Target B n ; Step S42: If the software library has an overwrite path, specify the path corresponding to the software library based on the environment variable used to specify the library file path; Step S43, if A j n If a corresponding coverage path exists, then based on A j n The corresponding software library is retrieved from the corresponding coverage path; otherwise, the preset loading instructions are used in B. 0 and Target B n Index A in the storage space corresponding to the combination j n The corresponding path loads A. j n The corresponding software compilation library; Step S44, based on all A j n The corresponding software compilation library is used to perform simulation operations on the set of test cases to be run, and the process ends.
7. The method according to claim 1, characterized in that, Following S1, the following also includes: Step S10: Obtain the software compilation library file to be updated. The software compilation library file to be updated corresponds to the default software compilation library of the virtual library or the software compilation library that the branch of the corresponding virtual library depends on. Step S20: Run the first test case set corresponding to the software compilation library file to be updated based on the software compilation library file to be updated. The first test case set is used to detect whether the new functions corresponding to the software compilation library to be updated are implemented. If all tests pass, proceed to step S30; otherwise, return to update the software compilation library file to be updated. Step S30: Run the second test case set corresponding to the software compilation library file to be updated based on the software compilation library file to be updated. The second test case set is used to detect whether the software compilation library to be updated still supports the existing functions. If all tests pass, the software compilation library file to be updated will overwrite the corresponding original software compilation library file.
8. The method according to claim 1, characterized in that, The simulation operation is a combined hardware and software simulation operation.
9. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that are executed by the at least one processor, the instructions being configured to perform the method of any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions for performing the method of any one of claims 1-8.
Citation Information
Patent Citations
Compilation simulation method and device for front-end verification and electronic equipment
CN117032886A
Front-end low-power-consumption verification environment generation method, electronic equipment and medium
CN120562352A
Chip automatic verification method and device, storage medium and electronic equipment
CN120670237A
Verification system, verification method, electronic device, and storage medium
US20250200259A1