Verification instance generation method, device, electronic device and storage medium
By performing constraint configuration and function replacement processing on instances in the verification environment, verification instances that meet complex constraints are generated, which solves the problems of performance reduction and debugging in the random constraint verification method, and improves the performance and debugging convenience of the verification platform.
Patent Information
- Application Number
- CN202111055784.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-09
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-09-09
AI Technical Summary
As the size and complexity of constraints increase, the performance of the verification platform in the random constraint verification method decreases, resulting in inconvenient post-debugging.
Generate verification instances by performing constraint configuration processing on configured classes required by instances in the verification environment and using functions in the constraint configuration as a substitute function library.
The generated verification instances not only satisfy complex constraints, but also improve the performance of the constraint part in the verification platform, providing high post-debugging convenience.
Smart Images

Figure CN113850046B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a verification instance generation method, device, electronic device and storage medium. Background Art
[0002] As chip designs become larger and more complex, random constraint verification methods are used in related technologies to meet verification requirements.
[0003] However, in the random constraint verification method, as the size and complexity of constraints increase, the performance of the verification platform also decreases, which brings great inconvenience to the later debugging. Summary of the invention
[0004] The present application aims to solve one of the technical problems in the above-mentioned technology at least to some extent.
[0005] The present application proposes a verification instance generation method to implement constraint configuration processing for configured classes required by instances in a verification environment, and to replace functions in the constraint configuration with functions in an alternative function library to generate a verification instance. In this way, the generated verification instance can satisfy complex constraints while improving the performance of the constraint part in the verification platform, which can provide higher convenience for later debugging.
[0006] The first aspect of the present application proposes a verification instance generation method, including: for each class in the verification environment, configuring each variable in the class; for each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on the variables in the class; for each constraint configuration in the instance, replacing each function in the constraint configuration with a corresponding substitute function in a substitute function library to generate a verification instance.
[0007] The verification instance generation method of the embodiment of the present application configures each variable in the class for each class in the verification environment; for each instance in the verification environment, loads the configured class required by the instance, and performs constraint configuration processing on the variables in the class; for each constraint configuration in the instance, replaces each function in the constraint configuration with a corresponding substitute function in the substitute function library to generate a verification instance. This method generates a verification instance by performing constraint configuration processing on the configured class required by the instance in the verification environment, and replacing the function in the constraint configuration with a function in the substitute function library. As a result, the generated verification instance can satisfy complex constraints while improving the performance of the constraint part in the verification platform, which can provide higher convenience for later debugging.
[0008] Optionally, for each class in the verification environment, configuring each variable in the class includes: for each class in the verification environment, determining the target variable in the class and the configuration type corresponding to the target variable based on each variable defined in the class and the relationship between the variables; and configuring each target variable in the class according to the corresponding configuration type.
[0009] Optionally, for each class in the verification environment, the target variable in the class and the configuration type corresponding to the target variable are determined according to the variables defined in the class and the relationship between the variables, including: for each class in the verification environment, for each variable in the class, judging whether the variable meets a preset configuration condition, wherein the preset configuration condition is that the variable can be calculated based on other variables in the class; when the variable meets the preset configuration condition, determining that the variable is the target variable; and determining the configuration type corresponding to the target variable according to the number of bits required for the parameters defined by the target variable.
[0010] Optionally, determining the configuration type corresponding to the target variable based on the bit number requirement of the parameter defined by the target variable includes: when the bit number requirement of the parameter defined by the target variable is that the number of bits is less than or equal to a preset bit number threshold, determining that the configuration type corresponding to the target variable is a bit type; when the bit number requirement of the parameter defined by the target variable is that the number of bits is greater than the preset bit number threshold, determining that the configuration type corresponding to the target variable is an integer type.
[0011] Optionally, for each instance in the verification environment, the configured classes required by the instance are loaded, and the variables in the class are constrained and configured, including: for each instance in the verification environment, the configured classes required by the instance are loaded; for each class loaded in the instance, all variables in the class are constrained and configured.
[0012] Optionally, for each constraint configuration in the instance, each function in the constraint configuration is replaced by a corresponding substitute function in the substitute function library to generate a verification instance, including: for each function in each constraint configuration in the instance, determining whether there is a substitute function corresponding to the function in the substitute function library; when there is a substitute function corresponding to the function in the substitute function library, replacing the function in the instance with the corresponding substitute function.
[0013] Optionally, the alternative function library includes functions and corresponding alternative functions, and the functions include at least one of the following functions: nested functions, functions that process the same variable with different mechanisms, functions containing specified operators, and functions containing specified keywords; the specified operators include at least one of the following operators: inequality operator, multiplication operator, rounding operator, remainder operator.
[0014] Optionally, the method further includes: obtaining an existing verification instance; and for each constraint configuration in the existing verification instance, performing substitution processing on each function in the constraint configuration using a corresponding substitution function in a substitution function library.
[0015] The second aspect of the present application proposes a verification instance generation device, including: a configuration module, used to configure each variable in each class in the verification environment; a processing module, used to load the configured class required by each instance in the verification environment, and perform constraint configuration processing on the variables in the class; a generation module, used to replace each function in the constraint configuration with a corresponding substitute function in a substitute function library for each constraint configuration in the instance, so as to generate a verification instance.
[0016] The verification instance generation device of the embodiment of the present application configures each variable in the class for each class in the verification environment; for each instance in the verification environment, loads the configured class required by the instance and performs constraint configuration processing on the variables in the class; for each constraint configuration in the instance, replaces each function in the constraint configuration with a corresponding substitute function in the substitute function library to generate a verification instance. This method generates a verification instance by performing constraint configuration processing on the configured class required by the instance in the verification environment and replacing the function in the constraint configuration with a function in the substitute function library. Thus, the generated verification instance can satisfy complex constraints while improving the performance of the constraint part in the verification platform, which can provide higher convenience for later debugging.
[0017] The third aspect embodiment of the present application proposes an electronic device, comprising: 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, and the instructions are executed by the at least one processor so that the at least one processor can execute the verification instance generation method proposed in the first aspect embodiment of the present application.
[0018] The fourth aspect embodiment of the present application proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the verification instance generation method proposed in the first aspect embodiment of the present application.
[0019] The fifth aspect embodiment of the present application proposes a computer program product. When the instruction processor in the computer program product executes, the verification instance generation method proposed in the first aspect embodiment of the present application is executed.
[0020] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0022] Figure 1 A flowchart of a verification instance generation method provided in Embodiment 1 of the present application;
[0023] Figure 2 A flowchart of a verification instance generation method provided in Embodiment 2 of the present application;
[0024] Figure 3 A flowchart of a verification instance generation method provided in Embodiment 3 of the present application;
[0025] Figure 4 A flowchart of a verification instance generation method provided in Embodiment 4 of the present application;
[0026] Figure 5 A schematic diagram of the structure of a verification instance generating device provided in Embodiment 5 of the present application;
[0027] Figure 6 The invention is a block diagram of an electronic device for a verification instance generation method according to an exemplary embodiment. DETAILED DESCRIPTION
[0028] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0029] Figure 1 The flowchart of the verification instance generation method provided in the first embodiment of the present application is as follows. It should be noted that the verification instance generation method can be applied to a verification instance generation device. The device can be configured in an electronic device. The electronic device can be a mobile terminal, for example, a mobile phone, a tablet computer, a personal digital assistant, and other hardware devices with various operating systems.
[0030] like Figure 1 As shown, the verification instance generation method includes the following steps:
[0031] Step 101: for each class in the verification environment, configure each variable in the class.
[0032] In an embodiment of the present application, in order to generate a verification instance, for each class in the verification environment, it is necessary to configure each variable in the class, where some variables in the class are randomly configured. In order to reduce the time of random solution and improve the performance of the constraint part in the verification platform, the variables to be randomly configured in the class can be configured according to the configuration type corresponding to the variable.
[0033] Step 102 : for each instance in the verification environment, load the configured class required by the instance, and perform constraint configuration processing on the variables in the class.
[0034] It is important to understand that instances in the verification environment can be constructed based on classes in the verification environment, and different instances can correspond to different classes.
[0035] In the embodiment of the present application, for each instance in the verification environment, the classes required by the instance and configured can be loaded, and the variables in the loaded classes can be constrained and configured.
[0036] Step 103: for each constraint configuration in the instance, each function in the constraint configuration is substituted with a corresponding substitute function in the substitute function library to generate a verification instance.
[0037] Furthermore, for each constraint configuration in the instance, each function in the constraint configuration is replaced by a corresponding substitute function in the substitute function library to generate a verification instance. The substitute function library includes functions and corresponding substitute functions, and the functions may include at least one of the following functions: nested functions, functions that process the same variable with different mechanisms, functions that contain specified operators, and functions that contain specified keywords. The specified operator may include at least one of the following operators: an inequality operator, a multiplication operator, a rounding operator, and a remainder operator. There are functions that process the same variable with different mechanisms, for example, functions that perform bit operations and non-bit operations on the same variable; functions that contain specified keywords, for example, functions that contain the "solve..before" keyword; nested functions, for example, may be the function foreach.
[0038] In summary, by performing constraint configuration processing on the configured classes required by the instances in the verification environment, and replacing the functions in the constraint configuration with functions in the alternative function library to generate verification instances, the generated verification instances can not only meet the complex constraints but also improve the performance of the constraint part in the verification platform, which can provide higher convenience for later debugging.
[0039] To accurately configure the variables in the class in the verification environment, such as Figure 2 As shown, Figure 2 This is a flow chart of the verification instance generation method provided in the second embodiment of the present application. In the embodiment of the present application, the target variable in the class and the variable type corresponding to the target variable can be determined first, and the target variable is configured according to the configuration type corresponding to the target variable. Figure 2 The illustrated embodiment may include the following steps:
[0040] Step 201 , for each class in the verification environment, according to the variables defined in the class and the relationship between the variables, determine the target variable in the class and the configuration type corresponding to the target variable.
[0041] In an embodiment of the present application, for each class in the verification environment, the variables defined in the class can be analyzed to determine the relationship between the variables. Based on the relationship between the variables, the target variable in the class can be determined, and the target variable can be configured according to the configuration type corresponding to the target variable.
[0042] Optionally, for each class in the verification environment and for each variable in the class, determine whether the variable meets a preset configuration condition, wherein the preset configuration condition is that the variable can be calculated based on other variables in the class; when the variable meets the preset configuration condition, determine the variable as a target variable; and determine the configuration type corresponding to the target variable based on the number of bits required for the parameters defined by the target variable.
[0043] That is to say, for each variable in each class in the verification environment, determine whether the value corresponding to the variable can be calculated based on other randomly configured variables in the class. When the value corresponding to the variable can be calculated based on other randomly configured variables in the class, the variable calculated based on other randomly configured variables in the class can be used as the target variable. The number of digits of the parameter defined by the target variable can be determined based on the value corresponding to the variable, and then the configuration type corresponding to the target variable can be determined based on the number of digits required for the parameter defined by the target variable.
[0044] For example, take the following variables in the class as an example,
[0045] “rand bit ch_en; / / channel from ripp enable
[0046] rand bit ch_scaler_en;
[0047] rand bit[11:0]ch_win_h; / / window height
[0048] rand bit[11:0]ch_win_w; / / window width
[0049] rand bit ch_upsize_en;
[0050] rand bit[11:0]pic0_target_height; / / target height
[0051] rand bit[11:0]pic0_target_width; / / target width”
[0052] Among them, the window size of the channel needs to be randomly generated, the enable flag, whether the channel needs to be enlarged or reduced (channel enlargement corresponds to the variable scaler_en, channel reduction corresponds to the variable upsize_en), and the target window size (corresponding to the variables pic0_target_height and pic0_target_width). If all related variables are of rand random type, when no other constraints are defined, the number of possible solutions contained in the solution space matrix is 2*2*2^12*2^12*2*2^12*2^12. Through analysis, it can be known that when the randomly generated window size is smaller than the target window size, the channel needs to be enlarged, otherwise it needs to be reduced. Therefore, the variables ch_scaler_en and ch_upsize_en can be calculated through subsequent processing after other variables are randomly generated. The variables ch_scaler_en and ch_upsize_en can be defined as bit type. The solution space matrix can be reduced to 1 / 4 of the original value.
[0053] In order to avoid an excessively large solution space matrix caused by defining all target variables as integers, in an embodiment of the present application, when the number of digits required for the parameter defined by the target variable is less than or equal to the preset number of digits threshold, the configuration type corresponding to the target variable is determined to be a bit type; when the number of digits required for the parameter defined by the target variable is greater than the preset number of digits threshold, the configuration type corresponding to the target variable is determined to be an integer type. For example, when the preset number of digits threshold is 32 bits, when the number of digits required for the parameter defined by the target variable is 10 bits, the configuration type corresponding to the target variable can be determined to be a bit type, and when the number of digits required for the parameter defined by the target variable is 64 bits, the configuration type corresponding to the target variable can be determined to be an integer type.
[0054] Step 202: configure each target variable in the class according to the corresponding configuration type.
[0055] In order to reduce the size of the matrix of the solution space, after determining the target variables in the class and the configuration types corresponding to the target variables, each target variable in the class can be configured according to the corresponding configuration type. For example, if the target variables to be randomly configured are ch_scaler_en and ch_upsize_en, and the configuration types corresponding to the variables ch_scaler_en and ch_upsize_en are bit types, the variables ch_scaler_en and ch_upsize_en can be configured as bit types.
[0056] Step 203: for each instance in the verification environment, load the configured class required by the instance and perform constraint configuration on the variables in the class.
[0057] Step 204 , for each constraint configuration in the instance, use a corresponding substitute function in the substitute function library to substitute each function in the constraint configuration to generate a verification instance.
[0058] In the embodiment of the present application, steps 203-204 can be implemented in any of the embodiments of the present application respectively. The embodiment of the present application does not limit this and will not be described in detail.
[0059] In summary, for each class in the verification environment, according to the variables defined in the class and the relationship between the variables, the target variables in the class and the configuration type corresponding to the target variables are determined; each target variable in the class is configured according to the corresponding configuration type. In this way, the variables in the class in the verification environment can be accurately configured to avoid random configuration leading to an excessively large solution space matrix.
[0060] In order to further reduce the size of the solution space matrix, such as Figure 3 As shown, Figure 3This is a flow chart of the verification instance generation method provided in Embodiment 3 of the present application. In the embodiment of the present application, constraint configuration processing can be performed on all variables in the class. Figure 3 The illustrated embodiment may include the following steps:
[0061] Step 301, for each class in the verification environment, configure each variable in the class.
[0062] Step 302: For each instance in the verification environment, load the configured class required by the instance.
[0063] In the embodiment of the present application, in the process of generating a verification instance, the configured classes required by each instance in the verification environment may be loaded.
[0064] Step 303: for each class loaded in the instance, constraint configuration processing is performed on all variables in the class.
[0065] It is important to understand that when creating a randomly configured class, not all variables in the class are constrained. Instead, some variables are randomly configured. When the class is overloaded in a verification instance, some of the randomly configured variables are constrained. When overloading, generally only the random variables of interest in the verification instance are constrained, while random variables of no interest are not constrained. For example, some random variables are not restricted in their value range, making the size of the solution space matrix much larger than the actual need.
[0066] For example, take the following variables loaded in the class as an example:
[0067] "rand bit[3:0]pic_num;
[0068] rand bit[4:0]pic_en;
[0069] rand bit array_pop_mode;
[0070] rand bit pop_mode;
[0071] rand bit pop_enable;
[0072] rand bit pip_enable;"
[0073] When the class is reloaded, no constraints are configured for the variables pic_num and pic_en, causing the size of the solution space matrix to increase by 2^4*2^5 times.
[0074] Therefore, in order to further reduce the matrix size of the solution space, constraint configuration processing can be performed on all variables in each class loaded in the instance.
[0075] Step 304: for each constraint configuration in the instance, each function in the constraint configuration is substituted with a corresponding substitute function in the substitute function library to generate a verification instance.
[0076] In the embodiment of the present application, steps 301 and 304 can be implemented in any way in the embodiments of the present application respectively. The embodiment of the present application does not limit this and will not be repeated.
[0077] In summary, by loading the configured classes required by each instance in the verification environment and performing constraint configuration on all variables in each class loaded in the instance, the matrix size of the solution space can be further reduced.
[0078] In order to further reduce the size of the solution space matrix of the verification instance, such as Figure 4 As shown, Figure 4 A flowchart of the verification instance generation method provided in the fourth embodiment of the present application. In the embodiment of the present application, each function in the constraint configuration can be replaced by an alternative function, wherein the function includes at least one of the following functions: a nested function, a function that processes the same variable by different mechanisms, a function that contains a specified operator, and a function that contains a specified keyword. Figure 4 The illustrated embodiment may include the following steps:
[0079] Step 401, for each class in the verification environment, configure each variable in the class.
[0080] Step 402: for each instance in the verification environment, load the configured class required by the instance and perform constraint configuration on the variables in the class.
[0081] Step 403: for each function in each constraint configuration in the instance, determine whether there is a substitute function corresponding to the function in the substitute function library.
[0082] In the embodiment of the present application, for each function of each constraint configuration in the instance, a judgment can be made in the substitute function library according to the function of the function to determine whether there is a substitute function corresponding to the function in the substitute function library. The substitute function library includes functions and corresponding substitute functions, and the functions include at least one of the following functions: nested functions, functions that process the same variable with different mechanisms, functions that contain specified operators, and functions that contain specified keywords.
[0083] Step 404: When there is a substitute function corresponding to the function in the substitute function library, the function in the instance is substituted using the corresponding substitute function.
[0084] For example, a nested foreach function for an array of N elements will generate N^2 constraints, such as, "foreach(ua[i]) / / For every element
[0085] foreach(ua[j])
[0086] if(i!=j) / / except the diagonals
[0087] ua[i]!=ua[j];";
[0088] The foreach function can be replaced by the randc function in the alternative function library or other methods.
[0089] For example, performing both bit operations and non-bit operations on the same random variable will result in a decrease in verification performance. For example, "constraint cst{
[0090] randomUpper==(TraceBufferLimit-TraceBufferBase+1);
[0091] TraceAddrPtr==((TraceBufferLimit[15:0]&16'h3FFF)<<16)|random13_6);
[0092] }", this code performs both bit and non-bit operations on the variable TraceBufferLimit, which will cause the verification performance to deteriorate. To address this problem, you can introduce another variable to avoid performing both bit and non-bit operations on the variable TraceBufferLimit. For example, the above code can be modified to the following code:
[0093]
[0094] For example, for functions containing multiplication operators, integer operators, or modulo operators, use shift and logical operations instead when possible.
[0095] For another example, functions containing keywords such as "solve..before" can be replaced with corresponding alternative functions in the alternative function library.
[0096] For another example, for a function containing an inequality operator, the greater-than operator or the less-than operator in the alternative function library can be used for substitution.
[0097] In addition, it should be noted that in some verification examples, nested functions are more concise and readable. In such cases, the greater-than operator or the less-than operator can be used to replace the inequality operator, which can reduce the complexity of the solution by half.
[0098] For example, "class packet;
[0099] rand int hdr[SIZE];
[0100] constraint cst{
[0101] foreach(hdr[i]){
[0102] hdr[i]inside{[1:SIZE-1]};
[0103] foreach(hdr[j]){
[0104] (i!=j)->hdr[i]!=hdr[j];
[0105] }
[0106] }
[0107] hdr[0] == ETHERNET;}
[0108] ", the complexity of solving this verification example is O(N^2). When using i < j to replace i!= j, the complexity can be reduced to O(N). For example, the following code can be used for replacement, "class packet;
[0109] rand int hdr[SIZE];
[0110] function self(int arg);
[0111] return(arg);
[0112] endfunction
[0113] constraint cst{
[0114] foreach(hdr[i]){
[0115] hdr[i]inside{[1:SIZE-1]};
[0116] foreach(hdr[j]){
[0117] (i<j)-> hdr[i]!=self(hdr[j]);
[0118] }
[0119] }
[0120] hdr[0] == ETHERNET;
[0121] }", after the introduction of the function self, the constraints of the nested function foreach are simplified to a single-layer foreach constraint. The second-layer foreach is equivalent to making a constant range constraint for each hdr[i], without involving other array members. Therefore, without changing the readability of the constraints, the complexity of the solution can be reduced to O(N).
[0122] In order to better reduce the solution space matrix size of the verification instance, in an embodiment of the present application, an existing verification instance can be obtained, and for each constraint configuration in the existing verification instance, each function in the constraint configuration is replaced by a corresponding substitute function in the substitute function library.
[0123] In the embodiment of the present application, steps 401-402 can be implemented in any of the ways in the embodiments of the present application respectively, and the embodiment of the present application does not limit this and will not be described in detail.
[0124] In summary, for each function in each constraint configuration in the instance, it is determined whether there is an alternative function corresponding to the function in the alternative function library; when there is an alternative function corresponding to the function in the alternative function library, the function in the instance is replaced by the corresponding alternative function. In this way, the size of the solution space matrix of the verification instance can be further reduced.
[0125] The verification instance generation method of the embodiment of the present application configures each variable in the class for each class in the verification environment; for each instance in the verification environment, loads the configured class required by the instance, and performs constraint configuration processing on the variables in the class; for each constraint configuration in the instance, replaces each function in the constraint configuration with a corresponding substitute function in the substitute function library to generate a verification instance. This method generates a verification instance by performing constraint configuration processing on the configured class required by the instance in the verification environment, and replacing the function in the constraint configuration with a function in the substitute function library. As a result, the generated verification instance can satisfy complex constraints while improving the performance of the constraint part in the verification platform, which can provide higher convenience for later debugging.
[0126] Figure 5This is a schematic diagram of the structure of the verification instance generating device provided in Example 5 of the present application.
[0127] like Figure 5 As shown, the verification instance generating device 500 includes: a configuration module 510 , a processing module 520 and a generating module 530 .
[0128] Among them, the configuration module 510 is used to configure each variable in the class for each class in the verification environment; the processing module 520 is used to load the configured class required by each instance in the verification environment, and perform constraint configuration processing on the variables in the class; the generation module 530 is used to replace each function in the constraint configuration with the corresponding substitute function in the substitute function library for each constraint configuration in the instance, and generate a verification instance.
[0129] As a possible implementation method of an embodiment of the present application, the configuration module 510 is specifically used to: for each class in the verification environment, determine the target variables in the class and the configuration type corresponding to the target variables based on the variables defined in the class and the relationship between the variables; configure each target variable in the class according to the corresponding configuration type.
[0130] As a possible implementation method of an embodiment of the present application, the configuration module 510 is also used to: for each class in the verification environment and for each variable in the class, determine whether the variable meets a preset configuration condition, wherein the preset configuration condition is that the variable can be calculated based on other variables in the class; when the variable meets the preset configuration condition, determine that the variable is the target variable; and determine the configuration type corresponding to the target variable based on the number of bits required for the parameters defined by the target variable.
[0131] As a possible implementation method of an embodiment of the present application, the configuration module 510 is also used to: when the number of bits required for the parameter defined by the target variable is less than or equal to a preset number of bits threshold, determine that the configuration type corresponding to the target variable is a bit type; when the number of bits required for the parameter defined by the target variable is greater than a preset number of bits threshold, determine that the configuration type corresponding to the target variable is an integer type.
[0132] As a possible implementation method of the embodiment of the present application, the processing module 520 is specifically used to: for each instance in the verification environment, load the configured class required by the instance; for each class loaded in the instance, constrain configuration processing is performed on all variables in the class.
[0133] As a possible implementation method of an embodiment of the present application, generation module 530 is specifically used to: for each function in each constraint configuration in the instance, determine whether there is an alternative function corresponding to the function in the alternative function library; when there is an alternative function corresponding to the function in the alternative function library, use the corresponding alternative function to replace the function in the instance.
[0134] As a possible implementation method of an embodiment of the present application, the alternative function library includes functions and corresponding alternative functions, and the functions include at least one of the following functions: nested functions, functions that process the same variable with different mechanisms, functions containing specified operators, and functions containing specified keywords; the specified operators include at least one of the following operators: an inequality operator, a multiplication operator, a rounding operator, and a remainder operator.
[0135] As a possible implementation of the embodiment of the present application, the verification instance generating device 500 further includes: an acquisition module and a replacement module.
[0136] The acquisition module is used to acquire an existing verification instance; the substitution module is used to substitute each function in each constraint configuration in the existing verification instance with a corresponding substitution function in the substitution function library.
[0137] The verification instance generation device of the embodiment of the present application configures each variable in each class in the verification environment; for each instance in the verification environment, loads the configured class required by the instance and performs constraint configuration processing on the variables in the class; for each constraint configuration in the instance, replaces each function in the constraint configuration with a corresponding substitute function in the substitute function library to generate a verification instance. The device can generate a verification instance by performing constraint configuration processing on the configured class required by the instance in the verification environment and replacing the function in the constraint configuration with a function in the substitute function library. Thus, the generated verification instance can satisfy complex constraints while improving the performance of the constraint part in the verification platform, which can provide higher convenience for later debugging.
[0138] In order to implement the above embodiments, the present application also proposes an electronic device, such as Figure 6 As shown, Figure 6 The invention is a block diagram of an electronic device for a verification instance generation method according to an exemplary embodiment.
[0139] like Figure 6 As shown, the electronic device 600 includes:
[0140] The memory 610 and the processor 620, a bus 630 connecting different components (including the memory 610 and the processor 620), the memory 610 stores a computer program, and when the processor 620 executes the program, the verification instance generation method described in the embodiment of the present application is implemented.
[0141] Bus 630 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0142] The electronic device 600 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 600, including volatile and non-volatile media, removable and non-removable media.
[0143] The memory 610 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 640 and / or cache memory 650. The electronic device 600 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 660 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical medium) may be provided. In these cases, each drive may be connected to bus 630 via one or more data medium interfaces. Memory 610 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of each embodiment of the present application.
[0144] A program / utility 680 having a set (at least one) of program modules 670 may be stored, for example, in the memory 610, such program modules 670 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 670 generally perform the functions and / or methods of the embodiments described herein.
[0145] The electronic device 600 may also communicate with one or more external devices 690 (e.g., keyboard, pointing device, display 1091, etc.), one or more devices that enable a user to interact with the electronic device 600, and / or any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 692. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 693. Figure 6 As shown, the network adapter 693 communicates with other modules of the electronic device 600 via the bus 630. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0146] The processor 620 executes various functional applications and data processing by running the programs stored in the memory 610 .
[0147] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the above-mentioned explanation of the generation of the verification example of the embodiment of the present application, and will not be repeated here.
[0148] In order to implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium storing computer instructions, where the computer instructions are used to enable a computer to execute the verification instance generation method described in the above embodiments.
[0149] In order to implement the above embodiments, the present application also provides a computer program product. When an instruction processor in the computer program product is executed, the verification instance generation method described in the above embodiments is executed.
[0150] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0151] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0152] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0153] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute the instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purpose of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0154] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0155] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0156] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0157] The storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A verification instance generation method, characterized in that: include: For each class in the chip verification environment, configure each variable in the class; For each instance in the chip verification environment, load the configured class required by the instance, and perform constraint configuration processing on the variables in the class; For each constraint configuration in the instance, each function in the constraint configuration is substituted by a corresponding substitute function in a substitute function library to generate a verification instance; The configuring of each variable in each class in the chip verification environment includes: For each class in the chip verification environment, for each variable in the class, determine whether the variable meets a preset configuration condition, wherein the preset configuration condition is that the variable can be calculated based on other variables in the class; When the variable satisfies the preset configuration condition, determining the variable as a target variable; Determine the configuration type corresponding to the target variable according to the bit number requirement of the parameter defined by the target variable; Each of the target variables in the class is configured according to the corresponding configuration type.
2. The method according to claim 1, characterized in that The determining, according to the bit number requirement of the parameter defined by the target variable, the configuration type corresponding to the target variable includes: When the number of digits of the parameter defined by the target variable is required to be less than or equal to a preset number of digits threshold, determining that the configuration type corresponding to the target variable is a bit type; When the number of digits required for the parameter defined by the target variable is greater than the preset number of digits threshold, it is determined that the configuration type corresponding to the target variable is an integer type.
3. The method according to claim 1, characterized in that For each instance in the chip verification environment, loading the configured class required by the instance and performing constraint configuration processing on the variables in the class include: For each instance in the chip verification environment, loading the configured class required by the instance; For each class loaded in the instance, constraint configuration processing is performed on all variables in the class.
4. The method according to claim 1, characterized in that: For each constraint configuration in the instance, performing substitution processing on each function in the constraint configuration using a corresponding substitution function in a substitution function library to generate a verification instance, including: For each function in each constraint configuration in the instance, determining whether there is an alternative function corresponding to the function in the alternative function library; When there is a substitute function corresponding to the function in the substitute function library, the function in the instance is substituted by the corresponding substitute function.
5. The method according to claim 4, wherein the substitute function library includes functions and corresponding substitute functions, wherein the functions include at least one of the following functions: a nested function, a function that processes the same variable by different mechanisms, a function that includes a specified operator, and a function that includes a specified keyword; The specified operator includes at least one of the following operators: an inequality operator, a multiplication operator, a rounding operator, and a remainder operator.
6. The method according to claim 1, characterized in that Also includes: Get an existing verification instance; For each constraint configuration in the existing verification instance, each function in the constraint configuration is substituted by a corresponding substitute function in a substitute function library.
7. A verification instance generating device, characterized in that: include: A configuration module, used for configuring each variable in each class in the chip verification environment; A processing module, used for loading a configured class required by each instance in a chip verification environment, and performing constraint configuration processing on variables in the class; A generation module, for performing substitution processing on each function in the constraint configuration using a corresponding substitution function in a substitution function library for each constraint configuration in the instance, so as to generate a verification instance; The configuration module is specifically used for: For each class in the chip verification environment, for each variable in the class, determine whether the variable meets a preset configuration condition, wherein the preset configuration condition is that the variable can be calculated based on other variables in the class; When the variable satisfies the preset configuration condition, determining the variable as a target variable; Determine the configuration type corresponding to the target variable according to the bit number requirement of the parameter defined by the target variable; Each of the target variables in the class is configured according to the corresponding configuration type.
8. The device according to claim 7, characterized in that The configuration module is also used for: When the number of digits of the parameter defined by the target variable is required to be less than or equal to a preset number of digits threshold, determining that the configuration type corresponding to the target variable is a bit type; When the number of digits required for the parameter defined by the target variable is greater than the preset number of digits threshold, it is determined that the configuration type corresponding to the target variable is an integer type.
9. The device according to claim 7, characterized in that The processing module is specifically used for: For each instance in the chip verification environment, loading the configured class required by the instance; For each class loaded in the instance, constraint configuration processing is performed on all variables in the class.
10. The device according to claim 7, characterized in that The generating module is specifically used for: For each function in each constraint configuration in the instance, determining whether there is an alternative function corresponding to the function in the alternative function library; When there is a substitute function corresponding to the function in the substitute function library, the function in the instance is substituted by the corresponding substitute function.
11. The device according to claim 10, wherein the substitute function library includes functions and corresponding substitute functions, wherein the functions include at least one of the following functions: a nested function, a function that processes the same variable with different mechanisms, a function that includes a specified operator, and a function that includes a specified keyword; The specified operator includes at least one of the following operators: an inequality operator, a multiplication operator, a rounding operator, and a remainder operator.
12. The device according to claim 7, characterized in that Also includes: The acquisition module is used to obtain the existing verification instance; The substitution module is used to substitute each function in each constraint configuration in the existing verification instance by using a corresponding substitution function in a substitution function library.
13. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
SPI verification platform based on UVM
CN112463497A