Simulation time flip coverage data collection method, electronic device, and storage medium

By registering a value change callback function for each flip variable and deleting it when coverage reaches 100%, the problem of limited simulation performance in the prior art is solved, and simulation efficiency and resource utilization are improved.

CN121070739BActive Publication Date: 2026-03-24BEIJING NORI INTEGRATED CIRCUIT DESIGN CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies for VLSI design verification, the method of flipping the coverage data acquisition during simulation leads to unnecessary computational overhead and memory access, slowing down simulation performance.

Method used

Register a value change callback function for each flipped variable, monitor the sub-variables of scalar or aggregate variables, and delete the callback function when coverage reaches 100% to reduce unnecessary calls.

Benefits of technology

It improves simulation efficiency and resource utilization, and reduces system overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121070739B_ABST
    Figure CN121070739B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of electronic design automation, in particular to a simulation time flip coverage data collection method, an electronic device and a storage medium, which registers a value change callback function for each instantiated flip variable; when the flip variable is a scalar variable, the monitoring object of the value change callback function is the scalar variable; when the flip variable is an aggregate variable, the monitoring object of the value change callback function is each sub-variable; during simulation, if the value of the monitoring object in the flip variable changes, the coverage state data of the target monitoring object is collected through the value change callback function, and the target bit corresponding to the target monitoring object in the coverage state bit is updated according to the coverage state data; when all coverage data of the coverage state bit are valid data, the value change callback function registered for the target flip variable is deleted, thereby improving the simulation efficiency and resource utilization.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of electronic design automation, in particular to a simulation-time toggle coverage data collection method, an electronic device and a storage medium. BACKGROUND

[0002] In the design verification process of very large scale integrated circuits, code coverage is one of the important indicators to measure the completeness of verification. Among them, toggle coverage, as a key component of structural coverage, is used to count the logic level toggle behavior of each node in the design during simulation running, such as toggling from low to high or from high to low, and whether it meets the expected toggle requirements. The current mainstream technical solution usually relies on the simulation tool to automatically insert additional probe logic during the compilation and expansion stages of the design, in order to realize the monitoring of the target signal. During the simulation running, the probe logic triggers in real time when the monitored signal changes state through the event callback mechanism coupled with the simulation scheduler, thereby realizing real-time capture and recording of signal state changes. The collection process of toggle coverage is usually divided into two stages: data recording during simulation and post-processing after simulation. During the simulation stage, the value change callback function of all preset monitoring points is registered at the initialization time and remains active thereafter to continuously capture and respond to all update events of the toggle variable during the simulation process, thereby continuously collecting coverage data regardless of whether the coverage has reached 100%. After a single simulation ends, the coverage data collected in this run is summarized in the post-processing stage, the toggle coverage of each node is calculated, and a visual report is generated.

[0003] However, the existing technology has obvious efficiency defects: since the value change callback function is globally registered at the start of simulation and remains effective, its execution runs throughout the entire simulation period, even if the toggle coverage of some nodes has reached 100%, the related callback will still be repeatedly triggered. This results in unnecessary computational overhead and memory access, especially in large-scale SoC designs, a large number of nodes that have completed stimulation continue to generate event interrupts, significantly slowing down the simulation performance. Therefore, there is an urgent need for a simulation-time toggle coverage data collection method that can improve simulation efficiency and resource utilization. SUMMARY

[0004] In view of the above technical problems, the technical solution adopted by the present application is: a simulation-time toggle coverage data collection method, the method comprising the following steps:

[0005] S100, obtaining each toggle variable, the toggle variable including scalar variables and aggregate variables, the aggregate variable including a plurality of sub-variables.

[0006] S200, register a value change callback function for each instantiated flip variable; when the flip variable is a scalar variable, the monitoring object of the value change callback function is the scalar variable; when the flip variable is an aggregate variable, the monitoring object of the value change callback function is each sub-variable; the value change callback function can access a public data structure, the public data structure includes coverage state bits for collecting coverage state data of each monitoring object in the flip variable.

[0007] S300, during simulation, if the value of the monitored object in the flip variable changes, the monitored object whose value has changed is taken as the target monitored object, and the flip variable to which the target monitored object belongs is taken as the target flip variable. The coverage status data of the target monitored object is collected through the value change callback function, and the target bit corresponding to the target monitored object in the coverage status bit of the target flip variable is updated according to the coverage status data. When all the coverage data of the coverage status bit of the target flip variable are valid data, the value change callback function registered for the target flip variable is deleted.

[0008] Furthermore, the present invention also provides a non-transitory computer-readable storage medium storing at least one instruction or at least one program segment, wherein the at least one instruction or the at least one program segment is loaded and executed by a processor to implement the above-described method.

[0009] In addition, the present invention provides an electronic device including a processor and the aforementioned non-transitory computer-readable storage medium.

[0010] The present invention has at least the following beneficial effects:

[0011] This invention provides a method, electronic device, and storage medium for acquiring flip-over coverage data during simulation. It registers a value change callback function for each instantiated flip-over variable and configures different monitoring objects based on whether the flip-over variable is a scalar or aggregate variable. During simulation, if the value of a monitored object changes, its coverage status data is acquired through the value change callback function. When all coverage data is valid, the value change callback function is deleted. This ensures that while acquiring flip-over coverage status data, the number of calls to the value change callback function is reduced, system overhead is lowered, and simulation efficiency and resource utilization are improved. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is a flowchart of a simulation-based method for acquiring flipped coverage data, provided as an embodiment of the present invention. Detailed Implementation

[0014] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] Unless otherwise defined, all technical and scientific terms used in the embodiments of this invention have the same meaning as commonly understood by those skilled in the art.

[0016] Please see Figure 1 It illustrates a method for acquiring flip coverage data during simulation, the method comprising the following steps:

[0017] S100, obtain each flipped variable, the flipped variable includes scalar variables and aggregate variables, the aggregate variables include multiple sub-variables.

[0018] In this context, a flip variable refers to a type of hardware variable whose value changes need to be monitored during simulation to evaluate coverage. A flip is determined to have occurred when the current value of the variable is inconsistent with its previous sampled value. In this embodiment of the invention, the collected flip states include flips from 0 to 1 and flips from 1 to 0. The flip variable is the basic monitoring unit for collecting coverage status data in the value change callback function.

[0019] In this context, a scalar variable refers to a variable whose value at any given time is represented by a single, independent numerical value and cannot be further decomposed into smaller logical components. Examples include single-bit signals and integer variables. Other types of scalar variables also fall within the scope of protection of this invention.

[0020] Aggregate variables refer to composite structured inverted variables composed of two or more sub-variables. Their overall value is determined by multiple distinguishable sub-variables, and each sub-variable can be independently addressed and its status monitored. Examples include arrays, vectors, or structures. Other types of aggregate variables also fall within the scope of this invention.

[0021] In one implementation, the variable name of the flipped variable in S100 is the full name, and the registered value change callback function is registered with the full name of each flipped variable to ensure that one value change callback function is registered for each flipped variable. When the coverage of the flipped variable reaches 100%, the value change callback function is deleted, instead of registering a value change callback function for each sub-variable. This can ensure that the state data is covered during the acquisition of simulation data, while also avoiding the slowdown of simulation efficiency and the consumption of a lot of resources due to the registration and calling of value change callback functions, thereby achieving the purpose of improving simulation efficiency and reducing resource consumption.

[0022] In one implementation, the full name of the flip variable is formed by concatenating the full instance name and the flip variable name with dimensions. The separator is either "." or " / ". Other types of separators also fall within the scope of this invention.

[0023] It should be noted that the full name of the flip variable needs to be obtained in both the public data structure establishment stage and the registration value change callback function stage. Specifically, the full name of the flip variable is obtained by loading the original design information and the flip coverage index file in the public data structure establishment stage, while the full name of the flip variable is obtained by accessing the public data structure in the registration value change callback function stage.

[0024] In one implementation, the public data structure includes an instance full name mapping table, a module instance mapping table, and a flip variable information mapping table. The instance full name mapping table includes multiple mapping entries, each representing a mapping between a unique identifier of an instance and its instance information, including the instance's full name and the name of its module. The module instance mapping table includes multiple mapping entries, each representing a mapping between a module and a set of instances obtained after instantiation, where the instance set includes one or more unique identifiers of instances. The flip variable information mapping table includes multiple mapping entries, each representing a mapping between a unique identifier of an instance and a set of flip variable information, where each instance includes multiple flip variables, and each flip variable's information includes a dimensional flip variable name and its width, the previous state value of the current flip variable, and the state transition corresponding to the current flip variable.

[0025] In one implementation, the steps for establishing the instance full name mapping table include: obtaining the instance hierarchy, traversing from the top-level instance node to each leaf instance node, concatenating the instance names at each level in the traversed complete instance path to generate the full name of each instance; and obtaining the module name of the module to which each leaf instance node belongs by searching the module instance mapping table; the full name of the instance corresponding to each leaf instance node and the module name of its module constitute instance information, and establishing a unique identifier for the instance and a mapping relationship between the instance information and the instance information.

[0026] As an example, if the top-level instance is named topinst, topinst includes a lower-level instance named inst1, inst1 includes a lower-level instance named inst1-1, and inst1-1 includes a flip variable, if the concatenation separator is ".", then the full name of the instance corresponding to the flip variable is topinst.inst1.inst1-1.

[0027] In one implementation, the steps for establishing the module instance mapping table include: traversing the instance hierarchy; for each instance, searching the module instance mapping table for the instance set corresponding to its module name based on the module name it belongs to; if it exists, adding the unique identifier of the current instance to the instance set; if it does not exist, creating a new instance set; after traversal, a module instance mapping table containing all modules and their corresponding instance sets is obtained. It should be noted that a module can be instantiated as one or more instances.

[0028] In one implementation, the steps for establishing the flipped variable information mapping table include: loading the flipped coverage index file extracted during the compilation phase; traversing all flipped variables under each module in the flipped coverage index file to obtain the variable name and dimension information of each flipped variable; generating a flipped variable name with dimensions based on the variable name and dimension information of the current flipped variable; traversing and obtaining all state values ​​and all flipped states of each flipped variable; obtaining the corresponding instance set from the module instance mapping table based on the module name; traversing the instance set; adding all variable information related to each instance in the instance set to the flipped variable information mapping table; and establishing a mapping relationship between the unique identifier of the instance and the flipped variable information.

[0029] In one implementation, the dimension information includes a start index and an end index, wherein the start index indicates the starting position of the dimension and the end index indicates the ending position of the dimension, used to determine the logical arrangement range and access boundaries of the sub-variables within the flipped variable.

[0030] The width information refers to the data width of the variable being flipped. As an example, when the variable name is var1[7:0], its starting index is 0, its ending index is 7, and its width information is 8.

[0031] In one implementation, S100 is the flipped variable obtained during the registration value change callback function phase. The flipped variable in S100 is uniquely identified by its fully qualified name. The steps for obtaining the fully qualified name of the flipped variable include: traversing the flipped variable information mapping table to obtain a set of flipped variable information; searching for and obtaining the instance's fully qualified name in the instance fully qualified name mapping table based on the unique identifier of the instance in the flipped variable information mapping table; traversing each dimensioned flipped variable name in the flipped variable information set, and concatenating the instance's fully qualified name with each dimensioned flipped variable name to obtain the fully qualified name of all flipped variables.

[0032] S200, register a value change callback function for each instantiated flip variable; when the flip variable is a scalar variable, the monitoring object of the value change callback function is the scalar variable; when the flip variable is an aggregate variable, the monitoring object of the value change callback function is each sub-variable; the value change callback function can access a public data structure, the public data structure includes coverage state bits for collecting coverage state data of each monitoring object in the flip variable.

[0033] It should be noted that, whether it is a scalar variable or an aggregate variable, the registration of its value change callback function is based on the flip variable as the basic unit. It's just that there are more monitoring objects for aggregate variables than for scalar variables, so each monitoring object needs to be monitored. The same value change callback function can monitor multiple monitoring objects under a flip variable at the same time.

[0034] In one implementation, the registration step of the value change callback function includes: obtaining the initial value of the variable based on its full name and setting it to the previous value; and registering a value change callback function for each of the full names of the variable.

[0035] S300, during simulation, if the value of the monitored object in the flip variable changes, the monitored object whose value has changed is taken as the target monitored object, and the flip variable to which the target monitored object belongs is taken as the target flip variable. The coverage status data of the target monitored object is collected through the value change callback function, and the target bit corresponding to the target monitored object in the coverage status bit of the target flip variable is updated according to the coverage status data. When all the coverage data of the coverage status bit of the target flip variable are valid data, the value change callback function registered for the target flip variable is deleted.

[0036] As an example, data is valid when the target bit is set to "1" and invalid when it is set to "0". When a toggle variable is a scalar variable `var`, it is represented by two overlay status bits. The high bit indicates the toggle state from high to low, and the low bit indicates the toggle state from low to high. When the overlay status bit is "10", it means that the toggle state from high to low has been overwritten, and the toggle state from low to high has not yet been overwritten. When the overlay status bit is "11", it means that both have been overwritten, and the value change callback function registered for `var` is deleted. When the flipped variable is a one-dimensional array arr[1:0], arr[1:0] includes two sub-variables arr[1] and arr[0]. The value change callback function needs to monitor the flipping state of these two sub-variables. The overlay status bit of the flipped variable arr[1:0] includes four bits, of which the high two bits are used to identify the two flipping states of arr[1] and the low two bits are used to identify the two flipping states of arr[0]. When the overlay status bit is "1111", it means that all the overlay data of the overlay status bit is valid data. At this time, the value change callback function registered for arr[1:0] is deleted.

[0037] It should be noted that by deleting the value change callback function registered for the target flip variable, the simulated test cases will no longer call the value change callback function registered for the target flip variable, thereby reducing the number of times the value change callback function is called, saving resource overhead, and improving simulation efficiency.

[0038] In one implementation, in S300, the coverage status bit of the coverage status data of each monitored object occupies two bits, one bit is used to indicate the transition from high level to low level, and the other bit is used to indicate the transition from low level to high level; the coverage status bits corresponding to all monitored objects of the same transition variable are arranged sequentially according to the index order of the monitored objects in the transition variable.

[0039] In one implementation, the step of collecting the coverage status data of the target monitoring object through the value change callback function includes:

[0040] S310, obtain the unique identifier of the current instance, the full name of the flip variable, and the current state value of the target monitoring object through the value change callback function.

[0041] S320, based on the unique identifier of the current instance and the full name of the flip variable, look up the previous state value of the target monitoring object from the flip variable information mapping table.

[0042] S330, based on the current state value and the previous state value of the target monitoring object, the flip state is obtained, and the target bit corresponding to the flip state in the overlay state bit of the target flip variable is set to valid.

[0043] S340, update the previous state value of the target monitoring object in the flip variable information mapping table to the current state value.

[0044] In summary, this invention provides a method for acquiring flip coverage data during simulation. It registers a value change callback function for each instantiated flip variable and configures different monitoring objects based on whether the flip variable is a scalar or aggregate variable. During simulation, if the value of a monitored object changes, its coverage status data is acquired through the value change callback function. When all coverage data is valid, the value change callback function is deleted. This ensures that while acquiring flip coverage status data, the number of calls to the value change callback function is reduced, system overhead is lowered, and simulation efficiency and resource utilization are improved.

[0045] Embodiments of the present invention also provide a non-transitory computer-readable storage medium that can be disposed in an electronic device to store at least one instruction or at least one program related to implementing a method in the method embodiments, wherein the at least one instruction or the at least one program is loaded and executed by the processor to implement the method provided in the above embodiments.

[0046] Embodiments of the present invention also provide an electronic device, including a processor and the aforementioned non-transitory computer-readable storage medium.

[0047] Embodiments of the present invention also provide a computer program product including program code, which, when the program product is emulated on an electronic device, causes the electronic device to perform the steps of the methods described above in various exemplary embodiments of the present invention.

[0048] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0049] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. Those skilled in the art should also understand that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of this invention is defined by the appended claims.

Claims

1. A method for acquiring coverage data during simulation, characterized in that, The method includes the following steps: S100, obtain each flip variable, the flip variable includes scalar variables and aggregate variables, the aggregate variable includes multiple sub-variables; wherein, the scalar variable refers to the value of which is represented by an independent numerical value at any time and cannot be further decomposed into smaller logical components; the aggregate variable refers to a composite structure flip variable composed of two or more sub-variables, the overall value of which is composed of multiple distinguishable sub-variables. S200, register a value change callback function for each instantiated flip variable; when the flip variable is a scalar variable, the monitoring object of the value change callback function is the scalar variable; when the flip variable is an aggregate variable, the monitoring object of the value change callback function is each sub-variable; the value change callback function can access a public data structure, the public data structure includes coverage state bits for collecting coverage state data of each monitoring object in the flip variable; S300, during simulation, if the value of the monitored object in the flip variable changes, the monitored object whose value has changed is taken as the target monitored object, and the flip variable to which the target monitored object belongs is taken as the target flip variable. The coverage status data of the target monitored object is collected through the value change callback function, and the target bit corresponding to the target monitored object in the coverage status bit of the target flip variable is updated according to the coverage status data. When all the coverage data of the coverage status bit of the target flip variable are valid data, the value change callback function registered for the target flip variable is deleted. The flipped variable described in S100 is uniquely identified by its full name. The steps for obtaining the full name of the flipped variable include: traversing the flipped variable information mapping table to obtain the flipped variable information set; searching for and obtaining the instance full name in the instance full name mapping table based on the unique identifier of the instance in the flipped variable information mapping table; traversing each flipped variable name with dimension in the flipped variable information set, and concatenating the instance full name and each flipped variable name with dimension to obtain the full name of all flipped variables.

2. The method according to claim 1, characterized in that, The dimension information includes a start index and an end index, where the start index indicates the starting position of the dimension and the end index indicates the ending position of the dimension.

3. The method according to claim 1, characterized in that, In S300, the coverage status bit of the coverage status data of each monitored object occupies two bits. One bit is used to indicate the transition from high level to low level, and the other bit is used to indicate the transition from low level to high level. The coverage status bits of all monitored objects corresponding to the same transition variable are arranged in the order of the index of the monitored object in the transition variable.

4. The method according to claim 1, characterized in that, In S200, the registration step of the value change callback function includes: obtaining the initial value of the variable based on its full name and setting it as the previous value; and registering a value change callback function for each variable's full name.

5. The method according to claim 1, characterized in that, The steps for collecting coverage status data of the target monitoring object through a value change callback function include: S310, obtain the unique identifier of the current instance, the full name of the flip variable, and the current state value of the target monitoring object through the value change callback function; S320, based on the unique identifier of the current instance and the full name of the flip variable, look up the previous state value of the target monitoring object from the flip variable information mapping table; S330, based on the current state value and the previous state value of the target monitoring object, the flip state is obtained, and the target bit corresponding to the flip state in the overlay state bit of the target flip variable is set to valid.

6. The method according to claim 5, characterized in that, The steps for establishing the flipped variable information mapping table include: loading the flipped coverage index file extracted during the compilation phase; traversing all flipped variables under each module in the flipped coverage index file to obtain the variable name and dimension information of each flipped variable; generating flipped variable names with dimensions based on the variable name and dimension information of the current flipped variable; traversing and obtaining all state values ​​and all flipped states of each flipped variable; obtaining the corresponding instance set from the module instance mapping table based on the module name; traversing the instance set; adding all variable information related to each instance in the instance set to the flipped variable information mapping table to establish the mapping relationship between the unique identifier of the instance and the flipped variable information.

7. A non-transitory computer-readable storage medium, wherein the storage medium stores at least one instruction or at least one program segment, characterized in that, The at least one instruction or the at least one program segment is loaded and executed by the processor to implement the method as described in any one of claims 1-6.

8. An electronic device, characterized in that, Includes a processor and the non-transitory computer-readable storage medium as described in claim 7.

Citation Information

Patent Citations

  • Code coverage rate acquisition method and system

    CN116501648A

  • Monitoring method and device, verification equipment, medium and program

    CN120704982A