A signal waveform storage method for logic simulation system
By compiling and analyzing the source code of the hardware description language, generating association conversion functions and marking signals, the problem of huge volume of signal waveform files in large logic simulation projects is solved, and space optimization and efficiency improvement of signal waveform storage is achieved.
Patent Information
- Application Number
- CN202210467097.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2042-04-29
AI Technical Summary
In large-scale logic simulation projects, the generated signal waveform file is huge in size, resulting in slow file opening and affecting subsequent analysis and research efficiency.
The source code of the hardware description language is compiled through the compiler front-end to generate an abstract syntax tree, and analyze the correlation relationship between signals based on the control flow diagram and the data flow diagram to generate an association transformation function. The signal is marked based on the analysis results, and only the waveform value of the signal that needs to be recorded separately and the correlation conversion function of the signal that does not need to be recorded separately during storage.
It greatly reduces the size of waveform files that need to be stored, and theoretically provides 10-50% space optimization, improving the efficiency of signal waveform storage.
Smart Images

Figure CN114818558B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of communications, and in particular relates to a signal waveform storage method for a logic simulation system. Background Art
[0002] The purpose of signal waveform storage is to save the results after logic simulation, so as to facilitate detailed analysis, research and reproduction of the simulation. The common signal waveform storage method is to export and save all signal waveforms generated in the simulation logic system, without involving the optimization of signal waveform processing and storage. The relatively better signal waveform storage method allows users to set signal export before simulation, including signals that need to be recorded.
[0003] For large-scale logic simulation projects, there are many signal waveforms that need to be observed, and the simulation time and density are relatively large, which will result in very large waveform files, which are very slow to open, and will also affect the efficiency of subsequent analysis and research. Therefore, it is urgent to provide an optimized waveform storage method to significantly reduce the size of the waveform files that need to be stored. Summary of the invention
[0004] In view of the above technical problems, the present invention provides a signal waveform storage method for a logic simulation system.
[0005] The technical solution adopted by the present invention to solve the technical problem is:
[0006] A signal waveform storage method for a logic simulation system, the method comprising the following steps:
[0007] Step S100: using a compiler front end to compile the source code of the hardware description language to be logically simulated to obtain a corresponding abstract syntax tree;
[0008] Step S200: based on the abstract syntax tree, traverse all nodes on the tree, generate corresponding control flow and data flow nodes based on the semantics of the nodes, so as to obtain a control flow graph and a data flow graph corresponding to the abstract syntax tree;
[0009] Step S300: Based on the control flow graph and the data flow graph, correlation analysis is performed on all signals in the logic simulation to obtain correlation conversion functions between the signals;
[0010] Step S400: During the logic simulation process, the waveforms of all signals are recorded in sequence to confirm the correctness of the associated transfer function;
[0011] Step S500: After the logic simulation is completed, based on the waveforms of all recorded signals and the associated conversion functions, the correctness analysis of the associated conversion functions is performed to obtain analysis results, and the signals are marked according to the analysis results and the corresponding associated conversion functions are saved;
[0012] Step S600: receiving a signal waveform storage request initiated by a user, and storing the corresponding signal waveform according to the request.
[0013] Preferably, the nodes in step S200 include conditional statements, control statements and assignment statements, corresponding to the control conditions, branches and data flows in the generated flow graph.
[0014] Preferably, step S300 includes:
[0015] Step S310: extracting from the control flow graph the possible execution order of all basic blocks of the simulation;
[0016] Step S320: extracting all possible flow directions of the simulation signal data from the data flow graph;
[0017] Step S330: Obtain the correlation conversion function between signals according to the possible execution order of all basic blocks in the simulation and all possible flows of the simulation signal data.
[0018] Preferably, in step S500, marking the signal according to the analysis result and saving the corresponding correlation conversion function includes:
[0019] When the analysis result is that the recorded signal waveform is consistent with the waveform calculated by the associated transfer function, the signal is marked as a signal that does not need to be recorded separately and its associated transfer function is saved; when the analysis result is that the recorded signal waveform is inconsistent with the waveform calculated by the associated transfer function, the signal is marked as a signal that needs to be recorded separately.
[0020] Preferably, step S300 further includes: when there is a signal that cannot be calculated through the associated conversion function and other signals, or the complexity of the associated conversion function is greater than a preset threshold, the corresponding signal is regarded as a signal that needs to be recorded separately.
[0021] Preferably, step S600 includes:
[0022] When the user initiates a request to store the waveforms of all signals, the waveform file only records the waveform values of all signals marked as needing to be recorded separately and the associated conversion functions of all signals that do not need to be recorded separately;
[0023] When the user initiates a request to store the waveforms of several individual signals, a comparison is made between the number of input signals of all associated conversion functions and the number of directly recorded signals, and the waveforms of the several individual signals are stored in a manner that records fewer signals while satisfying the user's request.
[0024] The above-mentioned signal waveform storage method for logic simulation system based on data flow graph and control flow graph analysis can significantly reduce the size of waveform files to be stored. Based on the correlation between signals, it can theoretically provide 10-50% space optimization. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 The present invention is a flow chart of a signal waveform storage method for a logic simulation system. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings.
[0027] In one embodiment, a signal waveform storage method for a logic simulation system includes the following steps:
[0028] Step S100: using a compiler front end to compile the source code of the hardware description language to be logically simulated to obtain a corresponding abstract syntax tree.
[0029] Specifically, lexical and syntactic analysis is performed through the compiler front-end tool. Lexical analysis includes: scanning the source code, using regular expressions to identify useful parts of the source code as lexical units according to word formation rules, and generating a sequence composed of lexical units; syntactic analysis includes: converting the lexically analyzed source code into sentence units according to grammatical rules, and constructing an abstract syntax tree.
[0030] Step S200: Based on the abstract syntax tree, traverse all nodes on the tree, and generate corresponding control flow and data flow nodes based on the semantics of the nodes, so as to obtain a control flow graph and a data flow graph corresponding to the abstract syntax tree.
[0031] Furthermore, the nodes in step S200 include conditional statements, control statements and assignment statements, corresponding to the control conditions, branches and data flows in the generated flow graph.
[0032] Step S300: Based on the control flow graph and the data flow graph, correlation analysis is performed on all signals in the logic simulation to obtain correlation conversion functions between the signals.
[0033] Specifically, for example, the assign statement in the Verilog language and the operators in the statement clearly reveal the association between two signals. For example, there is such a statement, assign b =! a, which clearly shows that b is the logical inversion of a. Therefore, compared with recording all the information of the two signals a and b, recording the signal a and the association function b =! a can save nearly half of the space. Of course, the actual situation is much more complicated than this. The relationship between signals may include simple logical assignment, conditional control assignment, and conditional control assignment with sensitivity list.
[0034] Further, step S300 includes:
[0035] Step S310: extracting from the control flow graph the possible execution order of all basic blocks of the simulation;
[0036] Step S320: extracting all possible flow directions of the simulation signal data from the data flow graph;
[0037] Step S330: Obtain the correlation conversion function between signals according to the possible execution order of all basic blocks in the simulation and all possible flows of the simulation signal data.
[0038] Furthermore, step S300 also includes: when there is a signal that cannot be calculated through the associated conversion function and other signals, or the complexity of the associated conversion function is greater than a preset threshold, the corresponding signal is regarded as a signal that needs to be recorded separately.
[0039] Specifically, not all signals can be calculated by associating conversion functions and other signals. There are also cases where the complexity of the associated conversion function is too high. In these cases, the signal is regarded as a signal that needs to be recorded separately. Based on all the associated conversion functions, it can be known whether the waveform of each signal needs to be recorded separately. Furthermore, the complexity of the associated conversion function refers to too many control conditions, too high calculation complexity, or too many source data, etc., and a preset threshold can be set according to the actual situation for judgment.
[0040] Step S400: During the logic simulation process, the waveforms of all signals are recorded in sequence to confirm the correctness of the associated transfer function.
[0041] Step S500: After the logic simulation is completed, based on the waveforms of all recorded signals and the associated conversion functions, the correctness analysis of the associated conversion functions is performed to obtain analysis results, and the signals are marked according to the analysis results and the corresponding associated conversion functions are saved.
[0042] Specifically, when the analysis result is that the recorded signal waveform is consistent with the waveform calculated by the associated conversion function, the signal is marked as a signal that does not need to be recorded separately and its associated conversion function is saved; when the analysis result is that the recorded signal waveform is inconsistent with the waveform calculated by the associated conversion function, the signal is marked as a signal that needs to be recorded separately.
[0043] Step S600: receiving a signal waveform storage request initiated by a user, and storing the corresponding signal waveform according to the request.
[0044] Further, step S600 includes:
[0045] When the user initiates a request to store the waveforms of all signals, the waveform file only records the waveform values of all signals marked as needing to be recorded separately and the associated conversion functions of all signals that do not need to be recorded separately;
[0046] When the user initiates a request to store the waveforms of several individual signals, a comparison is made between the number of input signals of all associated conversion functions and the number of directly recorded signals, and the waveforms of the several individual signals are stored in a manner that records fewer signals while satisfying the user's request.
[0047] Specifically, if the waveforms of several individual signals are to be stored, a comparison should be made between the number of input signals of all associated conversion functions and the number of directly recorded signals to compare whether it is more efficient to directly record the signal waveforms or to record the signal waveforms plus associated conversion functions. Suppose there are three signals a, b, and c, and there is an associated function of c=a+b. When the user needs the waveforms of all signals, the associated functions of recording a, b and c=a+b perform best. However, when the user specifies that only the c signal is needed, it will be more direct and convenient to directly record the waveform of the c signal. The comparison method is to meet the needs of the user. The method that requires fewer signals to be recorded is better because the consumption of the conversion function is almost negligible compared to the recording of the complete signal.
[0048] The above-mentioned signal waveform storage method for logic simulation system based on data flow graph and control flow graph analysis can significantly reduce the size of waveform files to be stored. Based on the correlation between signals, it can theoretically provide 10-50% space optimization.
[0049] The above is a detailed introduction to a signal waveform storage method for a logic simulation system provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the core idea of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
Claims
1. A signal waveform storage method for a logic simulation system, characterized in that: The method comprises the following steps: Step S100: using a compiler front end to compile the source code of the hardware description language to be logically simulated to obtain a corresponding abstract syntax tree; Step S200: based on the abstract syntax tree, traverse all nodes on the tree, generate corresponding control flow and data flow nodes based on the semantics of the nodes, so as to obtain a control flow graph and a data flow graph corresponding to the abstract syntax tree; Step S300: Based on the control flow graph and the data flow graph, all signals in the logic simulation are subjected to correlation analysis to obtain correlation conversion functions between the signals; Step S300 includes: Step S310: extracting possible execution orders of all basic blocks of the simulation from the control flow graph; Step S320: extracting all possible flow directions of the simulation signal data from the data flow graph; Step S330: obtaining a correlation conversion function between signals according to the possible execution order of all basic blocks of the simulation and all possible flow directions of the simulation signal data; Step S400: During the logic simulation process, the waveforms of all signals are recorded in sequence to confirm the correctness of the associated transfer function; Step S500: After the logic simulation is completed, based on the waveforms of all recorded signals and the associated conversion function, a correctness analysis of the associated conversion function is performed to obtain an analysis result, and the signal is marked according to the analysis result and the corresponding associated conversion function is saved; Step S600: receiving a signal waveform storage request initiated by a user, and storing a corresponding signal waveform according to the request.
2. The method according to claim 1, characterized in that The nodes in step S200 include conditional statements, control statements and assignment statements, corresponding to the control conditions, branches and data flows in the generated flow graph.
3. The method according to claim 2, characterized in that In step S500, the signal is marked according to the analysis result and the corresponding correlation conversion function is saved, including: When the analysis result is that the recorded signal waveform is consistent with the waveform calculated by the associated transfer function, the signal is marked as a signal that does not need to be recorded separately and its associated transfer function is saved; when the analysis result is that the recorded signal waveform is inconsistent with the waveform calculated by the associated transfer function, the signal is marked as a signal that needs to be recorded separately.
4. The method according to claim 3, characterized in that Step S300 also includes: when there is a signal that cannot be calculated through the associated conversion function and other signals, or the complexity of the associated conversion function is greater than a preset threshold, the corresponding signal is regarded as a signal that needs to be recorded separately.
5. The method according to claim 4, characterized in that Step S600 includes: When the user initiates a request to store the waveforms of all signals, the waveform file only records the waveform values of all signals marked as needing to be recorded separately and the associated conversion functions of all signals that do not need to be recorded separately; When the user initiates a request to store the waveforms of several individual signals, a comparison is made between the number of input signals of all associated conversion functions and the number of directly recorded signals, and the waveforms of the several individual signals are stored in a manner that records fewer signals while satisfying the user's request.
Citation Information
Patent Citations
C language defect detection method and device based on multi-level analysis
CN111104335A
High-performance signal monitoring method for logic simulation system
CN114328061A