Verification instance generation method and device, electronic equipment and storage medium

文档序号:449825 发布日期:2021-12-28 浏览:27次 中文

阅读说明:本技术 验证实例生成方法、装置、电子设备及存储介质 (Verification instance generation method and device, electronic equipment and storage medium ) 是由 索健 王正 于 2021-09-09 设计创作,主要内容包括:本申请提出一种验证实例生成方法、装置、电子设备及存储介质,其中方法包括:针对验证环境中的每个类,配置所述类中的各个变量;针对验证环境中的每个实例,对实例需要的已配置的类进行加载处理,并对类中的变量进行约束配置处理;针对实例中的每个约束配置,对约束配置中的各个函数采用替代函数库中对应的替代函数进行替代处理,生成验证实例。该方法通过对验证环境中的实例需要的已配置的类进行约束配置处理,并对约束配置中的函数采用替代函数库中的函数进行替代,以生成验证实例。由此,可使生成的验证实例既满足复杂约束同时可提高验证平台中约束部分的性能,可对后期调试提供较高的便利性。(The application provides a verification example generation method, a verification example generation device, electronic equipment and a storage medium, wherein the method comprises the following steps: for each class in a verification environment, configuring respective variables in the class; for each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on variables in the class; and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example. The method generates the verification example by performing constraint configuration processing on configured classes required by the example in the verification environment and replacing functions in the constraint configuration with functions in a replacement function library. Therefore, the generated verification example can meet complex constraint, the performance of a constraint part in a verification platform can be improved, and higher convenience can be provided for later debugging.)

1. A verification instance generation method, comprising:

for each class in a verification environment, configuring respective variables in the class;

for each instance in a verification environment, loading a configured class required by the instance, and performing constraint configuration processing on variables in the class;

and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in a substitution function library to generate a verification example.

2. The method of claim 1, wherein configuring, for each class in a verification environment, individual variables in the class comprises:

aiming at each class in a verification environment, determining a target variable in the class and a configuration type corresponding to the target variable according to each variable defined in the class and a relationship between the variables;

and configuring each target variable in the class according to the corresponding configuration type.

3. The method according to claim 2, wherein the determining, for each class in the verification environment, the target variable to be randomly configured in the class and the configuration type corresponding to the target variable according to the respective variables and relationships between the variables defined in the class includes:

for each class in a verification environment, judging whether the variable meets a preset configuration condition or not for each variable in the class, wherein the preset configuration condition is that the variable can be obtained by calculation according to other variables in the class;

when the variable meets the preset configuration condition, determining the variable as the target variable;

and determining the configuration type corresponding to the target variable according to the bit requirement of the parameter defined by the target variable.

4. The method according to claim 3, wherein the determining the configuration type corresponding to the target variable according to the bit requirement of the parameter defined by the target variable comprises:

when the digit requirement of the parameter defined by the target variable is that the digit is less than or equal to a preset digit threshold value, determining that the configuration type corresponding to the target variable is a bit type;

and when the digit requirement of the parameter defined by the target variable is that the digit is greater than the preset digit threshold value, determining that the configuration type corresponding to the target variable is an integer type.

5. The method of claim 1, wherein for each instance in the verification environment, loading the configured class required by the instance and performing constraint configuration on variables in the class, comprises:

for each instance in the verification environment, loading the configured class required by the instance;

and for each class loaded in the example, carrying out constraint configuration processing on all variables in the class.

6. The method according to claim 1, wherein for each constraint configuration in the instance, performing substitution processing on each function in the constraint configuration by using a corresponding substitution function in a substitution function library to generate a verification instance, comprises:

for each function in each constraint configuration in the instance, judging whether a substitute function corresponding to the function exists in the substitute function library;

and when a substitute function corresponding to the function exists in the substitute function library, performing substitute processing on the function in the example by adopting the corresponding substitute function.

7. The method of claim 6, the library of alternative functions comprising functions and corresponding alternative functions, the functions comprising at least one of: nesting functions, functions for performing different mechanism processing on the same variable, functions containing specified operators and functions containing specified keywords;

the specified operators include at least one of the following operators: not equal operator, multiplication operator, rounding operator, and remainder operator.

8. The method of claim 1, further comprising:

acquiring an existing verification example;

and aiming at each constraint configuration in the existing verification example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in a substitution function library.

9. An authentication instance generation apparatus, comprising:

a configuration module to configure, for each class in a verification environment, each variable in the class;

the processing module is used for loading the configured class required by each instance in the verification environment and carrying out constraint configuration processing on variables in the class;

and the generating module is used for carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in a substitution function library aiming at each constraint configuration in the example to generate the verification example.

10. The apparatus of claim 9, wherein the configuration module is specifically configured to:

aiming at each class in a verification environment, determining a target variable in the class and a configuration type corresponding to the target variable according to each variable defined in the class and a relationship between the variables;

and configuring each target variable in the class according to the corresponding configuration type.

11. The method of claim 10, wherein the configuration module is further configured to:

for each class in a verification environment, judging whether the variable meets a preset configuration condition or not for each variable in the class, wherein the preset configuration condition is that the variable can be obtained by calculation according to other variables in the class;

when the variable meets the preset configuration condition, determining the variable as the target variable;

and determining the configuration type corresponding to the target variable according to the bit requirement of the parameter defined by the target variable.

12. The apparatus of claim 11, wherein the configuration module is further configured to:

when the digit requirement of the parameter defined by the target variable is that the digit is less than or equal to a preset digit threshold value, determining that the configuration type corresponding to the target variable is a bit type;

and when the digit requirement of the parameter defined by the target variable is that the digit is greater than the preset digit threshold value, determining that the configuration type corresponding to the target variable is an integer type.

13. The apparatus of claim 9, wherein the processing module is specifically configured to:

for each instance in the verification environment, loading the configured class required by the instance;

and for each class loaded in the example, carrying out constraint configuration processing on all variables in the class.

14. The apparatus of claim 9, wherein the generating module is specifically configured to:

for each function in each constraint configuration in the instance, judging whether a substitute function corresponding to the function exists in the substitute function library;

and when a substitute function corresponding to the function exists in the substitute function library, performing substitute processing on the function in the example by adopting the corresponding substitute function.

15. The apparatus of claim 14, the library of alternative functions comprising functions and corresponding alternative functions, the functions comprising at least one of: nesting functions, functions for performing different mechanism processing on the same variable, functions containing specified operators and functions containing specified keywords;

the specified operators include at least one of the following operators: not equal operator, multiplication operator, rounding operator, and remainder operator.

16. The apparatus of claim 9, further comprising:

the acquisition module is used for acquiring the existing verification examples;

and the replacing module is used for replacing each function in the constraint configuration by adopting a corresponding replacing function in a replacing function library aiming at each constraint configuration in the existing verification example.

17. An electronic device, comprising:

at least one processor; and

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.

18. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-8.

Technical Field

The present application relates to the field of computer technologies, and in particular, to a verification instance generation method and apparatus, an electronic device, and a storage medium.

Background

As chip design scales become larger and more complex, in the related art, a random constraint verification method is used to meet verification requirements.

However, in the random constraint verification method, as the size and complexity of constraints (constraints) increase, the performance of the verification platform also decreases, which brings great inconvenience to later debugging.

Disclosure of Invention

The present application aims to solve at least to some extent one of the technical problems in the above-mentioned technology.

The application provides a verification example generation method, which is used for realizing constraint configuration processing on configured classes required by examples in a verification environment and replacing functions in a constraint configuration by adopting functions in a replacement function library to generate verification examples.

An embodiment of a first aspect of the present application provides a verification instance generating method, including: for each class in a verification environment, configuring respective variables in the class; for each instance in a verification environment, loading a configured class required by the instance, and performing constraint configuration processing on variables in the class; and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in a substitution function library to generate a verification example.

According to the verification example generation method, each variable in each class is configured aiming at each class in the verification environment; for each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on variables in the class; and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example. According to the method, the configured classes required by the examples in the verification environment are subjected to constraint configuration processing, and the functions in the constraint configuration are replaced by the functions in the replacement function library to generate the verification examples, so that the generated verification examples can meet complex constraints and improve the performance of the constraint part in the verification platform, and higher convenience can be provided for later debugging.

Optionally, for each class in the verification environment, configuring respective variables in the class includes: aiming at each class in a verification environment, determining a target variable in the class and a configuration type corresponding to the target variable according to each variable defined in the class and a relationship between the variables; and configuring each target variable in the class according to the corresponding configuration type.

Optionally, the determining, for each class in the verification environment, a target variable in the class and a configuration type corresponding to the target variable according to each variable and a relationship between the variables defined in the class includes: for each class in a verification environment, judging whether the variable meets a preset configuration condition or not for each variable in the class, wherein the preset configuration condition is that the variable can be obtained by calculation according to other variables in the class; when the variable meets the preset configuration condition, determining the variable as the target variable; and determining the configuration type corresponding to the target variable according to the bit requirement of the parameter defined by the target variable.

Optionally, the determining a configuration type corresponding to the target variable according to the bit requirement of the parameter defined by the target variable includes: when the digit requirement of the parameter defined by the target variable is that the digit is less than or equal to a preset digit threshold value, determining that the configuration type corresponding to the target variable is a bit type; and when the digit requirement of the parameter defined by the target variable is that the digit is greater than the preset digit threshold value, determining that the configuration type corresponding to the target variable is an integer type.

Optionally, for each instance in the verification environment, the loading a configured class required by the instance and performing constraint configuration processing on variables in the class include: for each instance in the verification environment, loading the configured class required by the instance; and for each class loaded in the example, carrying out constraint configuration processing on all variables in the class.

Optionally, for each constraint configuration in the instance, performing substitution processing on each function in the constraint configuration by using a corresponding substitution function in a substitution function library to generate a verification instance, where the method includes: for each function in each constraint configuration in the instance, judging whether a substitute function corresponding to the function exists in the substitute function library; and when a substitute function corresponding to the function exists in the substitute function library, performing substitute processing on the function in the example by adopting the corresponding substitute function.

Optionally, the substitute function library includes a function and a corresponding substitute function, where the function includes at least one of the following functions: nesting functions, functions for performing different mechanism processing on the same variable, functions containing specified operators and functions containing specified keywords; the specified operators include at least one of the following operators: not equal operator, multiplication operator, rounding operator, and remainder operator.

Optionally, the method further comprises: acquiring an existing verification example; and aiming at each constraint configuration in the existing verification example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in a substitution function library.

An embodiment of a second aspect of the present application provides a verification instance generating apparatus, including: a configuration module to configure, for each class in a verification environment, each variable in the class; the processing module is used for loading the configured class required by each instance in the verification environment and carrying out constraint configuration processing on variables in the class; and the generating module is used for carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in a substitution function library aiming at each constraint configuration in the example to generate the verification example.

The verification example generation device of the embodiment of the application configures each variable in a class aiming at each class in a verification environment; for each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on variables in the class; and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example. According to the method, the configured classes required by the examples in the verification environment are subjected to constraint configuration processing, and the functions in the constraint configuration are replaced by the functions in the replacement function library to generate the verification examples, so that the generated verification examples can meet complex constraints and improve the performance of the constraint part in the verification platform, and higher convenience can be provided for later debugging.

An embodiment of a third aspect of the present application provides an electronic device, including: at least one processor; and a memory communicatively coupled to the at least one processor; 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 provided by the embodiment of the first aspect of the present application.

A fourth aspect of the present application provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the verification instance generation method provided in the first aspect of the present application.

An embodiment of a fifth aspect of the present application provides a computer program product, which, when executed by an instruction processor in the computer program product, performs the verification instance generation method provided in the embodiment of the first aspect of the present application.

Additional aspects and advantages of the present application will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the present application.

Drawings

The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:

fig. 1 is a schematic flowchart of a verification example generation method according to an embodiment of the present application;

fig. 2 is a schematic flowchart of a verification example generation method provided in the second embodiment of the present application;

fig. 3 is a schematic flowchart of a verification example generation method provided in the third embodiment of the present application;

fig. 4 is a schematic flowchart of a verification example generation method provided in the fourth embodiment of the present application;

fig. 5 is a schematic structural diagram of a verification example generation apparatus according to a fifth embodiment of the present application;

FIG. 6 is a block diagram illustrating an electronic device for a verification instance generation method in accordance with an exemplary embodiment.

Detailed Description

Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary and intended to be used for explaining the present application and should not be construed as limiting the present application.

Fig. 1 is a schematic flow chart of a verification example generation method provided in an embodiment of the present application, and it should be noted that the verification example generation method can be applied to a verification example generation apparatus. Wherein the apparatus can be configured in an electronic device. The electronic device may be a mobile terminal, for example, a mobile phone, a tablet computer, a personal digital assistant, and other hardware devices with various operating systems.

As shown in fig. 1, the verification instance generation method includes the following steps:

step 101, for each class in the verification environment, configuring each variable in the class.

In the embodiment of the application, in order to generate a verification instance, for each class in a verification environment, each variable in the class needs to be configured, wherein some variables in the class are configured randomly, and in order to reduce time for random solution and improve performance of a constraint part in a verification platform, a variable to be configured randomly in the class can be configured according to a configuration type corresponding to the variable.

Step 102, aiming at each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on variables in the class.

It is to be appreciated that depending on the class in the verification environment, instances in the verification environment can be constructed, and different instances can correspond to different classes.

In the embodiment of the application, for each instance in the verification environment, the class required and configured by the instance can be loaded, and the variables in the loaded class can be subjected to constraint configuration processing.

And 103, aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example.

Further, for each constraint configuration in the instance, the corresponding substitute function in the substitute function library is adopted for each function in the constraint configuration to perform substitution processing, so as to generate the verification instance. The substitute function library comprises functions and corresponding substitute functions, and the functions can comprise at least one of the following functions: nested functions, functions with different mechanisms for processing the same variable, functions containing specified operators, and functions containing specified keywords. Wherein the designated operator may comprise at least one of the following operators: not equal operator, multiplication operator, rounding operator, and remainder operator. There are functions that process the same variable with different mechanisms, for example, functions that perform bit operation and non-bit operation on the same variable; functions containing specified keywords, such as functions containing "solve. The nested function may be, for example, the function foreach.

In summary, the configured classes required by the instances in the verification environment are subjected to constraint configuration processing, and the functions in the constraint configuration are replaced by the functions in the replacement function library to generate the verification instances, so that the generated verification instances can meet complex constraints and improve the performance of the constraint part in the verification platform, and higher convenience can be provided for later debugging.

In order to accurately configure the variables in the classes in the verification environment, as shown in fig. 2, fig. 2 is a schematic flowchart of a verification example generation method provided in the second embodiment of the present application. In the embodiment of the application, a target variable in a class and a variable type corresponding to the target variable can be determined first, and the type configuration is performed on the target variable according to a configuration type corresponding to the target variable. The embodiment shown in fig. 2 may include the following steps:

step 201, aiming at each class in the verification environment, determining a target variable in the class and a configuration type corresponding to the target variable according to each variable and a relation between the variables defined in the class.

In the embodiment of the application, for each class in the verification environment, each variable defined in the class can be analyzed, the relationship among the variables is determined, the target variable in the class can be determined according to the relationship among the variables, and the target variable is configured according to the configuration type corresponding to the target variable.

Optionally, for each class in the verification environment, for each variable in the class, determining whether the variable meets a preset configuration condition, where the preset configuration condition is that the variable can be calculated according to other variables in the class; when the variable meets a preset configuration condition, determining the variable as a target variable; and determining the configuration type corresponding to the target variable according to the digit requirement of the parameter defined by the target variable.

That is, for each variable in each class in the verification environment, it is determined whether a value corresponding to the variable can be calculated from other randomly configured variables in the class, and when the value corresponding to the variable can be calculated from other randomly configured variables in the class, the variable calculated from other randomly configured variables in the class can be used as the target variable. The digit of the parameter defined by the target variable can be determined according to the value corresponding to the variable, and further, the configuration type corresponding to the target variable is determined according to the digit requirement of the parameter defined by the target variable.

For example, using the variables in the class as the following variables,

“rand bit ch_en; //channel from ripp enable

rand bit ch_scaler_en;

rand bit[11:0]ch_win_h; //window height

rand bit[11:0]ch_win_w; //window width

rand bit ch_upsize_en;

rand bit[11:0]pic0_target_height; //target height

rand bit[11:0]pic0_target_width; //target width”

wherein, the window size of the channel, enable flag, whether the channel needs to be enlarged or reduced (channel enlargement corresponding variable scaler _ en, channel reduction corresponding variable upsize _ en), the window size of the target (corresponding variables pic0_ target _ height and pic0_ target _ width) are generated randomly. If all dependent variables are rand random, the number of possible solutions contained in the solution space matrix is 2 x 12 x 2 x 12 without defining other constraints. It can be known through analysis that when the randomly generated window size is smaller than the target window size, the channel needs to be enlarged, otherwise, the channel needs to be reduced, therefore, the two variables ch _ scaler _ en and ch _ upsize _ en can be calculated through subsequent processing after other variables are randomly generated, and the variables ch _ scaler _ en and ch _ upsize _ en can be defined as bit type. The solution space matrix may be reduced to 1/4 size of the original values.

In order to avoid an overlarge solution space matrix caused by defining all target variables as integer types, in the embodiment of the application, when the digit requirement of the parameter defined by the target variables is that the digit is less than or equal to a preset digit threshold value, determining that the configuration type corresponding to the target variables is a bit type; and when the digit requirement of the parameter defined by the target variable is that the digit is greater than a preset digit threshold value, determining that the configuration type corresponding to the target variable is an integer type. For example, the preset bit number threshold is 32 bits, when the bit number requirement of the parameter defined by the target variable is 10 bits, the configuration type corresponding to the target variable may be determined to be a bit type, and when the bit number requirement of the parameter defined by the target variable is 64 bits, the configuration type corresponding to the target variable may be determined to be an integer type.

Step 202, configuring each target variable in the class according to the corresponding configuration type.

In order to reduce the size of the matrix of the solution space, after the target variables in the class and the configuration types corresponding to the target variables are determined, each target variable in the class can be configured according to the corresponding configuration type. For example, the target variables to be randomly configured are ch _ scaler _ en and ch _ upsize _ en, the configuration types corresponding to the variables ch _ scaler _ en and ch _ upsize _ en are bit types, and the variables ch _ scaler _ en and ch _ upsize _ en can be configured as bit types.

Step 203, for each instance in the verification environment, the configured class required by the instance is loaded, and the constraint configuration processing is performed on the variables in the class.

And 204, aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example.

In the embodiment of the present application, the steps 203-204 may be implemented by any one of the embodiments of the present application, which is not limited in this embodiment and will not be described herein again.

In summary, for each class in the verification environment, according to the variables and the relationships between the variables defined in the class, determining a target variable in the class and a configuration type corresponding to the target variable; and configuring each target variable in the class according to the corresponding configuration type. Therefore, variables in the classes in the verification environment can be accurately configured, and an overlarge solution space matrix caused by random configuration is avoided.

To further reduce the size of the solution space matrix, as shown in fig. 3, fig. 3 is a schematic flow chart of a verification example generation method provided in the third embodiment of the present application. In the embodiment of the present application, constraint configuration processing may be performed on all variables in a class. The embodiment shown in fig. 3 may include the following steps:

step 301, for each class in the verification environment, configuring each variable in the class.

Step 302, for each instance in the verification environment, load the configured classes needed by the instance.

In the embodiment of the present application, in the process of generating the verification instance, the configured class required by each instance in the verification environment may be loaded.

Step 303, for each class loaded in the instance, constraint configuration processing is performed on all variables in the class.

It should be understood that, when creating a randomly configured class, not all variables in the class are subjected to constraint configuration processing, but some variables are subjected to random configuration, and when the class is reloaded in a verification example, some randomly configured variables are subjected to constraint configuration processing, and generally only the random variables concerned in the verification example are subjected to constraint configuration processing, but the random variables not concerned are not subjected to constraint configuration processing, for example, some random variables are not subjected to value range limitation, so that the size of a solution space matrix is far larger than the actual requirement.

For example, taking the variables loaded in a class as the following variables,

“rand bit[3:0]pic_num;

rand bit[4:0]pic_en;

rand bit array_pop_mode;

rand bit pop_mode;

rand bit pop_enable;

rand bit pip_enable;”;

when reloading the class, the variables pic _ num and pic _ en are not configured in a constrained manner, resulting in a solution space matrix size that is 2^4 ^ 2^5 times larger.

Thus, to further reduce the matrix size of the solution space, a constraint configuration process may be performed on all variables in each class loaded in the instance.

And step 304, aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example.

In this embodiment of the present application, steps 301 and 304 may be implemented by any one of the embodiments of the present application, which is not limited in this embodiment and is not described again.

In summary, by aiming at each instance in the verification environment, the configured class required by the instance is loaded; for each class loaded in an instance, constraint configuration processing is performed on all variables in the class. Thereby, the matrix size of the solution space can be further reduced.

To further reduce the size of the solution space matrix of the verification example, as shown in fig. 4, fig. 4 is a schematic flow chart of a verification example generation method provided in the fourth embodiment of the present application. In the embodiment of the present application, each function in the constraint configuration may be replaced by a replacement function, where the function includes at least one of the following functions: nested functions, functions with different mechanisms for processing the same variable, functions containing specified operators, and functions containing specified keywords. The embodiment shown in fig. 4 may include the following steps:

step 401, for each class in the verification environment, configuring each variable in the class.

Step 402, for each instance in the verification environment, load the configured class required by the instance, and perform constraint configuration processing on variables in the class.

Step 403, for each function in each constraint configuration in the instance, determining whether a substitute function corresponding to the function exists in the substitute function library.

In the embodiment of the present application, for each function configured for each constraint in an instance, a judgment may be made in the substitute function library according to the function of the function, and it is determined whether a substitute function corresponding to the function exists in the substitute function library. The substitute function library comprises functions and corresponding substitute functions, and the functions comprise at least one of the following functions: nested functions, functions with different mechanisms for processing the same variable, functions containing specified operators, and functions containing specified keywords.

And step 404, when the substitute function corresponding to the function exists in the substitute function library, performing substitution processing on the function in the example by adopting the corresponding substitute function.

For example, a nested function, foreach, of an array of N elements, For example, produces N ^2 constraints, e.g., "foreach (ua [ i ])// For event element

foreach(ua[j])

if(i!=j)//except the diagonals

ua[i]!=ua[j];”;

The foreach function may be replaced with a randc function in an alternative library of functions or in other ways.

For another example, performing a bit operation and a non-bit operation on the same random variable simultaneously may result in a reduced verification performance, e.g., a "constraint cst

randomUpper==(TraceBufferLimit-TraceBufferBase+1);

TraceAddrPtr==((TraceBufferLimit[15:0]&16'h3FFF)<<16)|random13_6);

That code performs both bit and non-bit operations on the variable TraceBufferLimit, resulting in a degradation of verification performance. To address this issue, additional variables may be introduced to avoid performing bit and non-bit operations on the variable TraceBufferLimit simultaneously. For example, the above code may be modified to the following code:

for another example, functions including a multiplication operator, a rounding operator, or a remainder operator may be replaced with a shift and logical operation.

For another example, for a function containing a keyword such as "solve.

For another example, for a function containing an operator that is not equal to an operator, a greater than operator or a less than operator in the library of alternative functions may be used instead.

In addition, it should be noted that in some verification examples, nested functions are easier and easier to read, and for this case, a greater than operator or a smaller than operator may be used instead of an unequal operator, which may reduce the complexity of the solution by half.

For example, "class packet;

rand int hdr[SIZE];

constraint cst{

foreach(hdr[i]){

hdr[i]inside{[1:SIZE-1]};

foreach(hdr[j]){

(i!=j)->hdr[i]!=hdr[j];

}

}

hdr[0]==ETHERNET;}

", the complexity of the verification instance solution is O (N ^2), when i < j is substituted for i! After j, the complexity can be reduced to O ((N), for example, the following code can be substituted for "class packet;

rand int hdr[SIZE];

function self(int arg);

return(arg);

endfunction

constraint cst{

foreach(hdr[i]){

hdr[i]inside{[1:SIZE-1]};

foreach(hdr[j]){

(i<j)->hdr[i]!=self(hdr[j]);

}

}

hdr[0]==ETHERNET;

and in the verification example, after a function self is introduced, the constraint of the nested function foreach is simplified into a single-layer foreach constraint, the second layer foreach is equivalent to a constraint of a constant range on each hdr [ i ], and no other array members are involved, so that the complexity of the solution can be reduced to O (N) on the premise of not changing the readability of the constraint.

In order to better reduce the size of the solution space matrix of the verification example, in the embodiment of the present application, an existing verification example may be obtained, and for each constraint configuration in the existing verification example, a corresponding substitute function in the substitute function library is used for each function in the constraint configuration to perform substitution processing.

In the embodiment of the present application, the steps 401-402 may be implemented by any one of the embodiments of the present application, which is not limited in the embodiment of the present application and will not be described herein again.

In summary, by aiming at each function in each constraint configuration in the example, whether a substitute function corresponding to the function exists in the substitute function library is judged; and when the substitute function corresponding to the function exists in the substitute function library, performing substitution processing on the function in the example by adopting the corresponding substitute function. Thus, the solution space matrix size of the verification instance may be further reduced.

According to the verification example generation method, each variable in each class in a verification environment is configured; for each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on variables in the class; and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example. According to the method, the configured classes required by the examples in the verification environment are subjected to constraint configuration processing, and the functions in the constraint configuration are replaced by the functions in the replacement function library to generate the verification examples, so that the generated verification examples can meet complex constraints and improve the performance of the constraint part in the verification platform, and higher convenience can be provided for later debugging.

Fig. 5 is a schematic structural diagram of a verification example generating device according to the fifth embodiment of the present application.

As shown in fig. 5, the verification instance generation apparatus 500 includes: a configuration module 510, a processing module 520, and a generation module 530.

Wherein, the configuration module 510 is configured to configure each variable in a class for each class in the verification environment; a processing module 520, configured to load a configured class required by an instance and perform constraint configuration processing on variables in the class for each instance in the verification environment; a generating module 530, configured to perform, for each constraint configuration in the instance, replacement processing on each function in the constraint configuration by using a corresponding replacement function in the replacement function library, so as to generate a verification instance.

As a possible implementation manner of the embodiment of the present application, the configuration module 510 is specifically configured to: aiming at each class in the verification environment, determining a target variable in the class and a configuration type corresponding to the target variable according to each variable defined in the class and the relationship among the variables; and configuring each target variable in the class according to the corresponding configuration type.

As a possible implementation manner of the embodiment of the present application, the configuration module 510 is further configured to: aiming at each class in the verification environment, judging whether the variable meets a preset configuration condition or not aiming at each variable in the class, wherein the preset configuration condition is that the variable can be obtained by calculation according to other variables in the class; when the variable meets a preset configuration condition, determining the variable as the target variable; and determining the configuration type corresponding to the target variable according to the digit requirement of the parameter defined by the target variable.

As a possible implementation manner of the embodiment of the present application, the configuration module 510 is further configured to: when the digit requirement of the parameter defined by the target variable is that the digit is less than or equal to a preset digit threshold value, determining that the configuration type corresponding to the target variable is a bit type; and when the digit requirement of the parameter defined by the target variable is that the digit is greater than a preset digit threshold value, determining that the configuration type corresponding to the target variable is an integer type.

As a possible implementation manner of the embodiment of the present application, the processing module 520 is specifically configured to: for each instance in the verification environment, loading the configured classes required by the instance; for each class loaded in an instance, constraint configuration processing is performed on all variables in the class.

As a possible implementation manner of the embodiment of the present application, the generating module 530 is specifically configured to: for each function in each constraint configuration in an instance, judging whether a substitute function corresponding to the function exists in a substitute function library; and when the substitute function corresponding to the function exists in the substitute function library, performing substitution processing on the function in the example by adopting the corresponding substitute function.

As a possible implementation manner of the embodiment of the present application, the substitute function library includes functions and corresponding substitute functions, and the functions include at least one of the following functions: nesting functions, functions for performing different mechanism processing on the same variable, functions containing specified operators and functions containing specified keywords; the designated operator includes at least one of the following operators: not equal operator, multiplication operator, rounding operator, and remainder operator.

As a possible implementation manner of the embodiment of the present application, the verification instance generating apparatus 500 further includes: an acquisition module and a substitution module.

The system comprises an acquisition module, a verification module and a verification module, wherein the acquisition module is used for acquiring an existing verification example; and the replacing module is used for replacing each function in the constraint configuration by adopting a corresponding replacing function in the replacing function library aiming at each constraint configuration in the existing verification example.

The verification example generation device of the embodiment of the application configures each variable in each class in a verification environment by aiming at each class; for each instance in the verification environment, loading the configured class required by the instance, and performing constraint configuration processing on variables in the class; and aiming at each constraint configuration in the example, carrying out substitution processing on each function in the constraint configuration by adopting a corresponding substitution function in the substitution function library to generate a verification example. The device can realize the constraint configuration processing of configured classes required by the examples in the verification environment, and replace the functions in the constraint configuration by adopting the functions in the substitute function library to generate the verification examples, so that the generated verification examples can meet complex constraints and improve the performance of the constraint part in the verification platform, and higher convenience can be provided for later debugging.

In order to implement the foregoing embodiments, the present application further proposes an electronic device, as shown in fig. 6, where fig. 6 is a block diagram of an electronic device for a verification instance generation method according to an exemplary embodiment.

As shown in fig. 6, the electronic device 600 includes:

a memory 610 and a processor 620, and a bus 630 connecting different components (including the memory 610 and the processor 620), wherein the memory 610 stores a computer program, and when the processor 620 executes the program, the verification example generation method described in the embodiment of the present application is implemented.

Bus 630 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.

Electronic device 600 typically includes a variety of electronic device readable media. Such media may be any available media that is accessible by electronic device 600 and includes both volatile and nonvolatile media, removable and non-removable media.

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/nonvolatile computer system storage media. By way of example only, storage system 660 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard disk drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 630 by one or more data media 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 carry out the functions of embodiments of the application.

A program/utility 680 having a set (at least one) of program modules 670 may be stored, for example, in 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 examples or some combination thereof may comprise an implementation of a network environment. The program modules 670 generally perform the functions and/or methods of the embodiments described herein.

The electronic device 600 may also communicate with one or more external devices 690 (e.g., keyboard, pointing device, display 1091, etc.), with one or more devices that enable a user to interact with the electronic device 600, and/or with any devices (e.g., network card, modem, etc.) that enable the electronic device 600 to communicate with one or more other computing devices. Such communication may be through input/output (I/O) interfaces 692. Also, the electronic device 600 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 693. As shown in FIG. 6, the network adapter 693 communicates with the other modules of the electronic device 600 via the bus 630. It should be appreciated that although not shown in FIG. 6, 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, among others.

The processor 620 executes various functional applications and data processing by executing programs stored in the memory 610.

It should be noted that, for the implementation process and the technical principle of the electronic device of this embodiment, reference is made to the foregoing explanation of the generation of the verification example of the embodiment of the present application, and details are not described here again.

In order to implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the verification instance generation method described in the above embodiments.

In order to implement the foregoing embodiments, the present application further provides a computer program product, which when executed by an instruction processor in the computer program product, executes the verification instance generation method described in the foregoing embodiments.

In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.

Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.

Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.

The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.

It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.

It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.

In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.

The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

19页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于印刷电路板的仿真系统及方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类