Method for converting data file in simulation process
By establishing the mapping relationship between data line number and axi bus address during chip simulation, the problem of large zmf files occupying memory in traditional methods is solved, and efficient file conversion is achieved, avoiding the risk of system crash.
Patent Information
- Application Number
- CN202411029285.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-12-13
AI Technical Summary
During the chip simulation process, traditional data file conversion methods require opening large zmf files at once, resulting in excessive memory usage, affecting the conversion speed, and even causing system crashes.
By obtaining the mapping relationship between the data line number in the addr file and the axi bus address in the zmf file, establishing and saving the mapping relationship, avoiding opening the zmf file multiple times, and modifying and reading only when needed, realizing one-time collection and processing.
Effectively saves memory usage, significantly shortens file conversion time, and avoids the risk of system crash.
Smart Images

Figure CN119127786A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of chip simulation, and in particular relates to a method for converting data files during a simulation process. Background Art
[0002] The Zebu simulation platform is one of the most commonly used hardware simulation systems in chip simulation. It is designed to be scalable to more than 19 billion gates, which can quickly realize chip verification and meet the massive chip verification needs of automobiles, 5G, networks, artificial intelligence and data centers.
[0003] Generally, the zebu simulation platform uses zmf files for simulation, while other simulation platforms often use addr file chips for simulation. When the axi protocol is used for intra-chip communication, the line number of the addr file and the axi bus address are in a linear correspondence, while the line number of the zmf file and the axi bus address are in a non-linear correspondence. Therefore, before zebu simulation, the addr file needs to be converted into a zmf file; after the zebu simulation is completed, in order to compare the simulation results, the zmf file needs to be converted into an addr file.
[0004] The traditional conversion procedure is to open all zmf files at once, and find the data corresponding to the axi bus address one by one according to the relationship between the axi bus address and the line number of the zmf file for further processing. However, because zmf files are generally large, opening all zmf files at once will cause the conversion of the two files to occupy a large amount of memory, which not only affects the speed of file conversion, but may even cause the system to crash. Summary of the invention
[0005] In order to solve at least one of the problems mentioned in the above background technology, the present invention proposes a method for data file conversion during simulation.
[0006] A method for data file conversion during a simulation process, comprising the steps of:
[0007] Step S1, converting the addr file into a zmf file, specifically includes the following steps:
[0008] Step S101, obtain the mapping relationship A between the data line number and the data corresponding to the axi bus address in the zmf file, the specific process is:
[0009] First, open each addr file in turn; then, read the data of each line in the addr file and obtain the axi bus address of each line of data; then, calculate the data line number of the axi bus address in the zmf file according to the axi bus address; finally, establish a mapping relationship A between each line of data in the addr file and the data line number in the zmf file, and save the established mapping relationship A;
[0010] Step S102, according to the established mapping relationship A, sort the data row numbers of the zmf file in the mapping relationship A according to the size of the data row numbers, and record the maximum and minimum values of the data row numbers;
[0011] Step S103, determining in turn whether each zmf file needs to be modified, if it needs to be modified, executing the modification program, otherwise executing the determination of the next zmf file;
[0012] The determination of whether the zmf file needs to be modified is based on the comparison between the maximum and minimum values of the recorded data row numbers and the file sequence number of the obtained zmf file. If the file sequence number is less than the minimum value or greater than the maximum value, it is determined that the zmf file does not need to be modified; otherwise, it is determined that the zmf file needs to be modified.
[0013] Specifically, the file sequence number of a zmf file represents the range of data row numbers in the zmf file;
[0014] The modification program is to open the zmf file that needs to be modified, and replace the data of the data line number that needs to be modified with the data in the addr file corresponding to the data line number in the zmf file in the mapping relationship A;
[0015] The traditional conversion procedure is to open all zmf files at once, and find the data corresponding to the axi bus address one by one according to the relationship between the axi bus address and the line number of the zmf file for further processing. However, because zmf files are generally large, opening all zmf files at once will make the conversion of the two files occupy a large amount of memory, which not only affects the speed of file conversion, but may even cause the simulation system to crash.
[0016] The conversion method proposed in the present invention can collect all addr files at one time, establish a mapping relationship between each line of data in all addr files and the data line number in the zmf file, avoid opening the zmf file multiple times, not only can effectively save memory usage, but also significantly reduce the file conversion time.
[0017] Step S2, loading the obtained zmf file into the ZeBu simulation platform for simulation;
[0018] Step S3, converting the simulated zmf file into an addr file, the implementation process includes the following steps:
[0019] Step S301, obtain the mapping relationship X between the data line number and the axi bus address in the zmf file, the specific process is:
[0020] First, obtain the interval value of the axi bus address that needs to be converted; then, calculate the data row number of each axi bus address in the zmf file in the interval value according to the formula, and record the mapping relationship X between the axi bus address and the zmf file row number;
[0021] Step S302, according to the established mapping relationship X, obtain the data corresponding to the data row number from the zmf file, the specific steps are:
[0022] First, sort the data row numbers of the zmf files in the mapping relationship X by size, and record the maximum and minimum values of the data row numbers; then, determine whether each zmf file contains the data to be obtained, if so, execute the recording program, otherwise execute the judgment of the next zmf file;
[0023] The determination of whether the zmf file contains the data to be obtained is based on the maximum and minimum values of the recorded data row numbers and the file sequence number of the obtained zmf file. If the file sequence number is less than the minimum value or greater than the maximum value, it is determined that the zmf file does not contain the data to be obtained; otherwise, it is determined that the zmf file contains the data to be obtained.
[0024] Specifically, the file sequence number of a zmf file represents the range of data row numbers in the zmf file;
[0025] The recording program is to open the corresponding zmf file and read the data of the zmf file, establish a mapping relationship Y between the data line number and the corresponding data, and record the mapping relationship Y;
[0026] The traditional conversion steps will cause the conversion of the two files to occupy a large amount of memory, which not only affects the speed of file conversion, but may even cause the simulation system to crash.
[0027] The conversion method proposed in the present invention can collect all addr files at one time, avoiding multiple readings of zmf files, which can not only effectively save memory usage, but also significantly reduce the file conversion time.
[0028] Step S303, according to the mapping relationship X and the mapping relationship Y, a mapping relationship Z is established between the axi bus address in the mapping relationship X and the data row number corresponding to the data in the mapping relationship Y;
[0029] Step S304, sorting the axi bus addresses in the mapping relationship Z by size, and writing the sorting results into the addr file in sequence.
[0030] The present invention proposes a method for converting data files during simulation, which has the following beneficial effects compared with the existing technology:
[0031] The method for converting between zmf files and addr files during chip simulation proposed by the present invention can avoid operating multiple zmf files simultaneously, which can not only effectively save memory usage, but also significantly shorten the time for converting between zmf files and addr files. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a schematic diagram of the process of implementing the present invention;
[0033] Figure 2 It is a schematic diagram of establishing a mapping relationship in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose and features of the present invention more obvious and easy to understand, the present technical solution is described in detail below through embodiments and in conjunction with the accompanying drawings.
[0035] like Figure 1 As shown, a method for converting data files during a simulation process comprises the steps of:
[0036] Step S1, converting the addr file into a zmf file, the implementation process includes the following steps:
[0037] Step S101, obtain the mapping relationship A between the data line number and the data corresponding to the axi bus address in the zmf file, and the specific implementation process is:
[0038] First, open each addr file in turn; then, read the data of each line in the addr file and obtain the axi bus address of each line of data; then, calculate the data line number of the axi bus address in the zmf file according to the axi bus address; finally, establish a mapping relationship A between each line of data in the addr file and the data line number in the zmf file, and save the established mapping relationship A;
[0039] Step S102: according to the established mapping relationship A, the data row numbers of the zmf file in the mapping relationship A are sorted according to the size of the data row numbers, and the maximum and minimum values of the data row numbers are recorded.
[0040] Step S103, determine in turn whether each zmf file needs to be modified, if it needs to be modified, execute the modification program, otherwise execute the judgment of the next zmf file.
[0041] Among them, whether the zmf file needs to be modified is determined by comparing the maximum and minimum values of the recorded data row numbers with the file sequence number of the obtained zmf file. If the file sequence number is less than the minimum value or greater than the maximum value, it is determined that the zmf file does not need to be modified, otherwise it is determined that the zmf file needs to be modified.
[0042] Specifically, the file sequence number of a zmf file represents the range of data row numbers in the zmf file.
[0043] The modification program is to open the zmf file that needs to be modified, and replace the data of the data line number that needs to be modified with the data in the addr file corresponding to the data line number in the zmf file in the mapping relationship A.
[0044] Step S2, loading the obtained zmf file into the ZeBu simulation platform for simulation.
[0045] Step S3, converting the simulated zmf file into an addr file, the implementation process includes the following steps:
[0046] Step S301, obtain the mapping relationship X between the data line number and the axi bus address in the zmf file, the specific implementation process is:
[0047] First, obtain the interval value of the axi bus address that needs to be converted; then, calculate the data row number of each axi bus address in the zmf file in the interval value according to the formula, and record the mapping relationship X between the axi bus address and the zmf file row number.
[0048] The mapping relationship X diagram is as follows Figure 2 shown.
[0049] Step S302, according to the established mapping relationship X, obtain the data corresponding to the data row number from the zmf file, the specific implementation steps are:
[0050] First, sort the data row numbers of the zmf file in the mapping relationship X by size, and record the maximum and minimum values of the data row numbers;
[0051] Then, determine whether each zmf file contains the data to be obtained. If so, execute the recording program, otherwise execute the judgment of the next zmf file.
[0052] Among them, whether the zmf file contains the data to be obtained is determined by comparing the maximum and minimum values of the recorded data row numbers with the file sequence number of the obtained zmf file. If the file sequence number is less than the minimum value or greater than the maximum value, it is determined that the zmf file does not contain the data to be obtained, otherwise it is determined that the zmf file contains the data to be obtained.
[0053] Specifically, the file sequence number of a zmf file represents the range of data row numbers in the zmf file.
[0054] The recording program opens the corresponding zmf file and reads the data of the zmf file, establishes a mapping relationship Y between the data line number and the corresponding data, and records the mapping relationship Y.
[0055] Step S303, according to the mapping relationship X and the mapping relationship Y, a mapping relationship Z is established between the axi bus address in the mapping relationship X and the data row number corresponding to the data in the mapping relationship Y.
[0056] Step S304, sorting the axi bus addresses in the mapping relationship Z by size, and writing the sorting results into the addr file in sequence.
[0057] In a specific implementation process, optionally, after completing the conversion of the zmf file to the addr file, the converted addr file can be used as a basis for comparing simulation results.
[0058] So far, according to the method disclosed in the present invention, the working process of the present invention has been implemented once.
[0059] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method 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, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0060] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0061] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for data file conversion during simulation, characterized in that: Includes steps: Step S1, converting the addr file into a zmf file; Step S2, loading the obtained zmf file into the ZeBu simulation platform for simulation; Step S3, converting the simulated zmf file into an addr file.
2. The method for data file conversion in a simulation process according to claim 1, characterized in that: Step S1 includes the steps of: Step S101, obtaining a mapping relationship A between the data line number and the data corresponding to the axi bus address in the zmf file; Step S102, according to the established mapping relationship A, sort the data row numbers of the zmf file in the mapping relationship A according to the size of the data row numbers, and record the maximum and minimum values of the data row numbers; Step S103, determine in turn whether each zmf file needs to be modified, if it needs to be modified, execute the modification program, otherwise execute the judgment of the next zmf file.
3. The method for data file conversion in a simulation process according to claim 2, characterized in that: Step S101 includes the steps of: Step A1, open each addr file in turn; Step A2, read the data of each line in the addr file and obtain the axi bus address of each line of data; Step A3, calculating the data row number of the axi bus address in the zmf file according to the axi bus address; Step A4, establish a mapping relationship A between each line of data in the addr file and the data line number in the zmf file, and save the established mapping relationship A.
4. The method for data file conversion in a simulation process according to claim 2, characterized in that: The determination as to whether each zmf file needs to be modified in step S102 is based on comparing the maximum and minimum values of the recorded data row numbers with the file sequence number of the obtained zmf file. If the file sequence number is less than the minimum value or greater than the maximum value, it is determined that the zmf file does not need to be modified. Otherwise, it is determined that the zmf file needs to be modified, wherein the file sequence number of the zmf file represents the range of the data row number in the zmf file.
5. The method for data file conversion in a simulation process according to claim 2, characterized in that: The modification procedure described in step S102 is to open the zmf file that needs to be modified, and replace the data of the data row number that needs to be modified with the data in the addr file corresponding to the data row number in the zmf file in the mapping relationship A.
6. The method for data file conversion in a simulation process according to claim 2, characterized in that: Step S3 includes the steps of: Step S301, obtaining a mapping relationship X between a data row number and an axi bus address in a zmf file; Step S302, according to the established mapping relationship X, obtain the data corresponding to the data row number from the zmf file; Step S303, according to the mapping relationship X and the mapping relationship Y, a mapping relationship Z is established between the axi bus address in the mapping relationship X and the data row number corresponding to the data in the mapping relationship Y; Step S304, sorting the axi bus addresses in the mapping relationship Z by size, and writing the sorting results into the addr file in sequence.
7. The method for data file conversion in a simulation process according to claim 2, characterized in that: Step S301 includes the steps of: Step B1, obtaining the interval value of the axi bus address to be converted; Step B2, calculate the data row number of each axi bus address in the zmf file in the interval value according to the formula, and record the mapping relationship X between the axi bus address and the zmf file row number.
8. The method for data file conversion in a simulation process according to claim 2, characterized in that: Step S302 includes the steps of: Step C1, sort the data row numbers of the zmf file in the mapping relationship X by size, and record the maximum and minimum values of the data row numbers; Step C2, determine whether each zmf file contains the data to be obtained, if yes, execute the recording program, otherwise execute the determination of the next zmf file.
9. The method for data file conversion in a simulation process according to claim 8, characterized in that: The determination of whether each zmf file contains the data to be obtained in step C2 is performed by comparing the maximum and minimum values of the recorded data row numbers with the file sequence number of the obtained zmf file. If the file sequence number is less than the minimum value or greater than the maximum value, it is determined that the zmf file does not contain the data to be obtained; otherwise, it is determined that the zmf file contains the data to be obtained. The file sequence number of the zmf file represents the range of data row numbers in the zmf file.
10. The method for data file conversion in a simulation process according to claim 8, characterized in that: The recording procedure described in step C2 is to open the corresponding zmf file and read the data of the zmf file, establish a mapping relationship Y between the data row number and the corresponding data, and record the mapping relationship Y.
