Summary of the invention
The objective of the invention is to filter does not have the verification vectors of help to improving current coverage rate, only may improve the verification vectors of coverage rate and send into the process that emulation is carried out, reaching under the situation of identical coverage rate, reduced the number that need carry out the verification vectors of emulation, reduce the use of verification vectors as far as possible, shorten simulation time, thereby improve verification efficiency, quicken the checking convergence.
For realizing the optimization method of a kind of verification vectors that purpose of the present invention provides, comprise the following steps:
Step 100 according to the initial authentication vector after the emulation, obtains the information of described initial authentication vector to the coverage rate of defined function point, and initialization covering function point tabulation makes up disaggregated model;
Step 200, newly-generated verification vectors is sent into described disaggregated model, predict the coverage rate of new verification vectors to described function point, and will make the newly-generated verification vectors that the coverage rate of described function point is improved carry out emulation, according to the tabulation of simulation result update functions point, obtain the higher verification vectors of coverage rate.
Described step 100 comprises the following steps:
Step 110, generate the initial authentication vector set that the user specifies number, initial authentication vector is wherein carried out emulation in design to be verified, obtain the information of described initial authentication vector, and the information of the coverage rate that described initial authentication vector sum is corresponding with it is as training sample to the coverage rate of defined function point;
Step 120 is carried out pre-service to described training sample, extracts the verification vectors feature, according to the coverage condition to each defined function point verification vectors is carried out the classification mark simultaneously;
Step 130 is carried out feature selecting to the verification vectors use characteristic selection algorithm that carries out the classification mark in the step 120, obtains set of eigenvectors;
Step 140, according to the set of eigenvectors of selecting in the step 130, the verification vectors that verification vectors is concentrated carries out Feature Mapping, obtains eigenmatrix;
Step 150 is sent into described eigenmatrix in the specific classification device and to be learnt, and obtains disaggregated model.
Described step 120 comprises the following steps:
Step 121 for the training sample of being made up of verification vectors, is obtained the character representation of verification vectors, extracts the verification vectors feature;
Step 122 at defined each function point, in conjunction with the information of verification vectors and coverage rate in the described training sample, marks the coverage condition of this verification vectors to each function point;
In the step 122, described mark is meant that the verification vectors that can cover described function point is marked as positive sample, and the verification vectors that does not cover described function point is marked as negative sample.
Described step 200 comprises the following steps:
Step 210, the feature according to selected proper vector representative in the step 130 is mapped as corresponding proper vector with newly-generated verification vectors;
Step 220, described proper vector by newly-generated verification vectors mapping is sent into described disaggregated model, judge whether described newly-generated verification vectors can cover described function point, thereby prediction obtains the coverage rate of newly-generated verification vectors to described function point, and corresponding list item contrasts one by one in tabulating with described covering function point;
Step 230 judges whether described newly-generated verification vectors can cover new function point, if then enter step 240; Otherwise, it is abandoned, do not carry out emulation;
Step 240 is sent into the described newly-generated verification vectors that can cover new function point and is carried out emulation in the design to be verified, and upgrades covering function point tabulation with the coverage rate result of the verification vectors that has carried out emulation, obtains the higher verification vectors of coverage rate.
For realizing that purpose of the present invention also provides a kind of verification vectors optimization means, described device comprises: verification vectors generation module and coverage rate acquisition module also comprise: disaggregated model makes up module and verification vectors optimal module, wherein:
Described disaggregated model makes up module, be used for according to the initial authentication vector after the process emulation by described verification vectors generation module generation, obtain the information of described initial authentication vector to the coverage rate of defined function point, initialization covering function point tabulation makes up disaggregated model;
Described verification vectors optimal module, be used for and send into the disaggregated model that described disaggregated model makes up module construction by the newly-generated verification vectors that described verification vectors generation module generates, predict the coverage rate of described newly-generated verification vectors to described function point, and will make the newly-generated verification vectors that the coverage rate of described function point is improved carry out emulation, according to the tabulation of simulation result update functions point, obtain the higher verification vectors of coverage rate.
Described disaggregated model makes up module, comprising:
Characteristic extracting module is used to extract the feature of described verification vectors;
Proper vector is selected module, is used for selecting the effective proper vector of classifying according to described verification vectors and to the information of the coverage rate of defined function point;
The proper vector mapping block is used for the proper vector of selecting module to choose according to described proper vector, and the verification vectors collection is mapped as eigenmatrix;
Training module is used for that described eigenmatrix is sent into the specific classification device and trains, and obtains disaggregated model.
Described verification vectors optimal module comprises:
The proper vector acquisition module is used for obtaining the proper vector of newly-generated verification vectors according to the newly-generated verification vectors of described verification vectors generation module and the proper vector of described extraction verification vectors, sends into described disaggregated model;
The coverage rate prediction module is used for the coverage rate according to the newly-generated verification vectors of described disaggregated model prediction, judges whether to cover the function point that never covered;
High coverage rate verification vectors acquisition module, be used for sending into the coverage rate information that obtains behind the described coverage rate acquisition module according to the described newly-generated verification vectors that can cover the function point that never covered, the tabulation of renewal coverage rate, and then obtain the high coverage rate verification vectors.
Beneficial effect of the present invention is:
1. the optimization method of verification vectors of the present invention and device are a kind of verification vectors optimization methods based on machine learning;
2. the optimization method of verification vectors of the present invention and device can reach in proof procedure under the prerequisite that identical coverage rate requires, and reduce the use of verification vectors as far as possible, shorten simulation time, thereby improve verification efficiency, quicken the checking convergence.
Embodiment
In order to make purpose of the present invention, technical scheme and advantage clearer,, the optimization method and the device of a kind of verification vectors of the present invention is further elaborated below in conjunction with drawings and Examples.Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
The optimization method of a kind of verification vectors of the present invention and device, it is artificial intelligence according to the verification vectors that has carried out, coverage rate information to the verification vectors of new generation is predicted, judge in advance whether it may improve current coverage rate, carry out simulation operations if can be sent to design to be verified again, otherwise think redundant verification vectors and generation again.It can reach in proof procedure under the prerequisite that identical coverage rate requires, and reduces the use of verification vectors as far as possible, shortens simulation time, thereby improves verification efficiency, quickens the checking convergence.
Introduce the optimization method of a kind of verification vectors of the present invention in detail below in conjunction with above-mentioned target, it is a kind of verification vectors optimization method based on machine learning, its purpose is, solves in the existing checking flow process owing to a large amount of simulation times has been used in the not high enough problem of verification efficiency that causes in the operation of redundant verification vectors.
Fig. 1 is the process flow diagram of the optimization method of a kind of verification vectors of the present invention, and as shown in Figure 1, described method comprises the following steps:
Step 100 according to the initial authentication vector after the emulation, obtains the information of described initial authentication vector to the coverage rate of defined function point, and initialization covering function point tabulation makes up disaggregated model;
Described function point is the needs definition of user according to design to be verified.
Step 200 is optimized newly-generated verification vectors.Specifically comprise: the proper vector of newly-generated verification vectors is sent into disaggregated model, predict the coverage rate of newly-generated verification vectors to function point, and will make the newly-generated verification vectors that the coverage rate of described function point is improved carry out emulation, according to the tabulation of simulation result update functions point, obtain the higher verification vectors of coverage rate.
Fig. 2 is the process flow diagram that makes up disaggregated model among the present invention, and as shown in Figure 2, described step 100 comprises the following steps:
Step 110, generate the initial authentication vector set that the user specifies number, initial authentication vector is wherein carried out emulation in design to be verified, obtain the coverage rate information of corresponding initial authentication vector, and the coverage rate information that described initial authentication vector sum is corresponding with it is as training sample to defined function point;
In actual verification work, can pass through artificial hand write verification vector, perhaps utilize verification vectors to generate method such as software and generate the initial authentication vector set that the user specifies number.Preferably, as a kind of embodiment, be to utilize instruction to generate engine to generate the initial authentication vector set that the user specifies number among the present invention.
The coverage rate information of described initial authentication vector is meant whether the initial authentication vector covered the situation of user according to a series of function points of the needs definition of design to be verified.
In actual verification work, described coverage rate information can obtain the coverage rate report of corresponding function point automatically by modes such as the self-designed coverage rate sampling instruments of user in simulation process.Preferably, as a kind of embodiment, be to utilize electric design automation (Electronic DesignAutomation, EDA) instrument obtains the coverage rate report of corresponding function point, comprising the information such as degree of covering of each verification vectors to defined all functions point among the present invention.
As a kind of embodiment, in instruction grade stochastic verification, the verification vectors correspondence be to generate the instruction sequence that engine produces by instruction, as mfhi $10; Lb $31,24251 ($2) etc.For function coverage, need write the function coverage model jointly by checking slip-stick artist and deviser.For example, may focus on verifying whether all covered for all instruction operation codes at the Decoder module of little processing, the possible outcome that obtains as: { mfhi 3; Lb 2}, expression be that mfhi instruction has been covered 3 times, and instruction has covered 2 times to lb
Step 120 is carried out pre-service to described training sample, extracts the verification vectors feature, according to the coverage condition to each defined function point verification vectors is carried out the classification mark simultaneously;
For the training sample of forming by verification vectors, train it, at first to obtain the character representation of verification vectors, and extract the verification vectors feature.Then, at defined each function point, the corresponding information of combined training sample marks the coverage condition of this verification vectors to this function point, the verification vectors that wherein can cover this function point is called positive sample, and the verification vectors that does not cover this function point is called negative sample.
Described step 120 comprises the following steps:
Step 121 for the training sample of being made up of verification vectors, is obtained the character representation of verification vectors, extracts the verification vectors feature;
For the instruction grade stochastic verification of microprocessor, verification vectors means a series of instruction sequences that produced by constraint engine.It is exactly its assembly code that instruction sequence is represented the most intuitively, because instruction sequence not only shows the function point that individual instructions can cover to the coverage condition of function point, the more function point is just may be covered by the various combination sequence of instructing simultaneously, and therefore the sequential combination of employing instruction is the mode of comparison nature as the character representation of verification vectors.
In the text-processing field, the general vector space model that adopts is represented sample, i.e. expression becomes the unordered vector of a M dimension, wherein N-Gram uses notion comparatively widely in the text representation, for natural language, be necessary association between the continuous word, so just represent text feature with N-Gram.
Except using N-Gram as character representation, also may adopt other character representation mode to carry out, may different considerations be arranged different devisers, such as the binary sequence that may use verification vectors, with the proper vector of whole 01 sequence, as long as it is just passable it to be expressed as vector space model as this verification vectors.As a kind of embodiment, the compilation of the verification vectors among the present invention represents to use N-Gram can obtain following character representation, and is as shown in table 1:
The 2-Gram character representation of table 1 assembler code
For risc processor, except memory access classes such as load and store instructions, other instruction generally all can only access register, and therefore the operational code of instruction has just stipulated that this instruction can access memory unit or register.For above-mentioned feature,, be unfavorable for that sorter learns owing to having considered that operand makes characteristic distribution too sparse; Simultaneously for some situation, as:
add $19,$20,$24 add?$18,$19,$23
sub $11,$10,$12 sub?$12,$11,$13
More than two kinds of situations function point that can cover there is no very big difference, so after weighing, consider above-mentioned feature is simplified as the verification vectors feature, only use its operation part, therefore the verification vectors feature that obtains is as shown in table 2:
The 2-Gram feature of the assembler code that table 2 is simplified
Step 122 at defined each function point, in conjunction with the information of verification vectors and coverage rate in the described training sample, marks the coverage condition of this verification vectors to each function point;
The verification vectors that can cover function point is marked as positive sample, and the verification vectors that does not cover function point is marked as negative sample.
Step 130 is carried out feature selecting to the verification vectors use characteristic selection algorithm that carries out the classification mark in the step 120, obtains set of eigenvectors;
Because the number of the verification vectors feature of being extracted in the step 120 is very huge, directly it is mapped as proper vector and can makes that the feature space dimension is too much, may cause problems such as " dimension disasters ", influence pace of learning, also have simultaneously the existence of noise contribution, will influence the accuracy of machine learning.Therefore, need from a great selection of feature, extract by feature selecting algorithm and characterize original verification vectors,, reduce intrinsic dimensionality to reduce data noise to distinguishing different classes of even more important feature, make and the speed of training of to guarantee to obtain best classify accuracy simultaneously again.
Described feature selecting algorithm is the prior art in machine learning field, feature selecting mode in the text-processing can adopt, as document frequency (DF), information gain (Informartion Gain), mutual information (Mutual Information), CHI statistics or the like.
As a kind of embodiment, the present invention uses information gain to carry out selecting of proper vector.Information gain comes from information theory, has reflected the significance level of a feature when difference is different classes of, rejects the lower feature of score by the information gain value of calculating each feature, is because these features are very limited to the help of classification.The notion of information gain is based upon on the basis of variable entropy, and the entropy of variable is represented the uncertain degree of this variable, and the entropy of a variable X defines as follows:
X wherein
iThe institute that is variable X might value.
Information gain then is after the observed reading that has increased variable, the situation of change of entropy:
IG(X,Y)=H(X)-H(X|Y)
Correspond to our practical problems, suppose for verification vectors collection S, at certain function point, the sample number that covers this function point is p, the sample number that does not cover this function point is n, and total sample number t=p+n is expressed as for the information gain of certain feature f in sample set S:
Because be two classification problems here, the value of S has only positive sample and two kinds of situations of negative sample, the corresponding respectively sample that covers the sample of certain function point and do not cover certain function point.In addition, feature f has only two kinds of values, values (f)=0, and 1}, representation attribute f appears at the situation that certain sample neutralization does not occur in certain sample respectively.It is as follows to obtain the concrete implication of each symbol thus:
p
0: the positive sample that does not comprise feature f;
n
0: the negative sample that does not comprise feature f;
I
0: do not comprise all samples of feature f, i.e. p
0+ n
0
p
1: the positive sample that comprises feature f;
n
1: the negative sample that comprises feature f;
I
1: comprise all samples of feature f, i.e. p
1+ n
1
After the information gain of all features is calculated, extract 800 wherein the highest set of eigenvectors that conduct is final.
Step 140 according to the set of eigenvectors of selecting in the step 130, concentrates all verification vectors to carry out Feature Mapping to verification vectors, obtains eigenmatrix;
Described Feature Mapping can take that boolean is shone upon, occurrence number mapping (number of times that occurs according to this feature), frequency of occurrences mapping multiple modes such as (frequencies that occurs according to this feature).Preferably, the mapping method that the present invention adopts is directly to carry out boolean (Boolean) mapping: for feature j, if in verification vectors i, occurred, and eigenmatrix m[i then] [j]=1, otherwise m[i] [j]=0.
Step 150 is sent into described eigenmatrix in the specific classification device and to be learnt, and obtains disaggregated model;
The sorter of being used widely in the existing machine Learning Theory, as k neighbour (kNN), naive Bayesian (
Bayes), decision tree (Decision tree) or the like can be trained eigenmatrix, thereby obtains disaggregated model.
Preferably, as a kind of embodiment, the present invention uses support vector machine that the eigenmatrix that obtains in the step 140 is trained, and obtains corresponding disaggregated model.This method is a prior art, gives unnecessary details no longer one by one at this.
Fig. 3 is the process flow diagram that among the present invention newly-generated verification vectors is optimized, and as shown in Figure 3, described step 200 comprises the following steps:
Step 210 according to selected feature in the training process, is mapped as corresponding proper vector with newly-generated verification vectors;
Described feature is the feature of selected proper vector representative in the step 130.
Step 220, described proper vector by newly-generated verification vectors mapping is sent into described disaggregated model, judge whether described newly-generated verification vectors can cover described function point, thereby prediction obtains the coverage rate of newly-generated verification vectors to described function point, and corresponding list item contrasts one by one in tabulating with described covering function point;
In this step 210,220, newly-generated verification vectors is mapped as the method for proper vector and obtains the method for coverage rate with step 140 and 110, just with in the step 110, with the initial authentication vector in design to be verified, carry out emulation change into according to training process in selected feature.Therefore give unnecessary details no longer one by one.
Step 230 judges whether described newly-generated verification vectors can cover new function point, if then enter step 240; Otherwise, it is abandoned, do not carry out emulation;
Described new function point, all function points of never covering of the verification vectors of emulation before referring to promptly do not cover function point in the function point tabulation in the overall situation.
Step 240 is sent into the described newly-generated verification vectors that can cover new function point and is carried out emulation in the design to be verified, and upgrades covering function point tabulation with the coverage rate result of the verification vectors that has carried out emulation, obtains the higher verification vectors of coverage rate.
Verification vectors for all new generations, by constantly repeating above-mentioned forecasting process, can obtain its coverage condition to all functions point of definition, if predict that the function point that this verification vectors can cover all is the function point that has covered in the function point tabulation, illustrate that so this verification vectors is redundant, there is no need to carry out emulation, it is abandoned.If but predict that function point that this verification vectors can cover is not in current covering in the function point tabulation, illustrate that then this verification vectors may can cover new function point, it is carried out emulation, and covered the function point tabulation with result's renewal of emulation.Said process is carried out by machine fully, has realized the verification vectors optimization method based on machine learning.
In this step, according to the coverage rate report of carrying out obtaining after the emulation, the function point tabulation of covering of the overall situation is upgraded, the expression checking proceeds to current accumulation coverage condition to all functions point.Be used to judge whether newly-generated verification vectors increases to current coverage rate.Because what obtain by forecasting process is the verification vectors that possible improve coverage rate, can only know covering whether the situation of this verification vectors through forecasting process to each function point, whether specifically can increase to current coverage rate, be by comparing and obtain with the function point tabulation of covering of the overall situation.Like this in the proof procedure reaching under the prerequisite that identical coverage rate requires, can reduce the use of verification vectors as far as possible, shorten simulation time, thereby improve verification efficiency, quicken the checking convergence.
Corresponding to the optimization method of a kind of verification vectors of the present invention, the present invention also provides a kind of verification vectors optimization means.
Fig. 4 is the structural representation of a kind of verification vectors optimization means of the present invention, and as shown in Figure 4, described verification vectors optimization means comprises: verification vectors generation module 1 is used to generate the verification vectors collection that the user specifies number; Coverage rate acquisition module 2 is used for verification vectors is carried out emulation in design to be verified, obtains the coverage rate information of corresponding verification vectors, also comprises: disaggregated model makes up module 3, verification vectors optimal module 4, wherein:
Described disaggregated model makes up module 3, be used for according to the initial authentication vector after the process emulation by described verification vectors generation module 1 generation, obtain the information of described initial authentication vector to the coverage rate of defined function point, initialization covering function point tabulation makes up disaggregated model;
Described verification vectors optimal module 4, be used for to send into described disaggregated model by the newly-generated verification vectors that described verification vectors generation module 1 generates and make up the disaggregated model that module 3 makes up, predict the coverage rate of described newly-generated verification vectors to described function point, and will make the newly-generated verification vectors that the coverage rate of described function point is improved carry out emulation, according to the tabulation of simulation result update functions point, obtain the higher verification vectors of coverage rate.
Fig. 5 is the structural representation that disaggregated model makes up module among the present invention, and as shown in Figure 5, described disaggregated model makes up module 3, comprising:
Characteristic extracting module 31 is used to extract the feature of described verification vectors;
Proper vector is selected module 32, is used for selecting the effective proper vector of classifying according to described verification vectors and to the information of the coverage rate of defined function point;
Proper vector mapping block 33 is used for the proper vector of selecting module 32 to choose according to described proper vector, and the verification vectors collection is mapped as eigenmatrix;
Training module 34 is used for that described eigenmatrix is sent into the specific classification device and trains, and obtains disaggregated model.
Fig. 6 is the structural representation of verification vectors optimal module among the present invention, and as shown in Figure 6, described verification vectors optimal module 4 comprises:
Proper vector acquisition module 41 is used for obtaining the proper vector of newly-generated verification vectors according to the newly-generated verification vectors of described verification vectors generation module and the proper vector of described extraction verification vectors, sends into described disaggregated model;
Coverage rate prediction module 42 is used for predicting according to described disaggregated model the coverage rate of newly-generated verification vectors, judges whether to cover the function point that never covered;
High coverage rate verification vectors acquisition module 43, be used for sending into the coverage rate information that obtains behind the described coverage rate acquisition module 2 according to the described newly-generated verification vectors that can cover the function point that never covered, the tabulation of renewal coverage rate, and then obtain the high coverage rate verification vectors.
Beneficial effect of the present invention is:
1. the optimization method of a kind of verification vectors of the present invention and device are a kind of verification vectors optimization methods based on machine learning;
2. the optimization method of a kind of verification vectors of the present invention and device can reach in proof procedure under the prerequisite that identical coverage rate requires, and reduce the use of verification vectors as far as possible, shorten simulation time, thereby improve verification efficiency, quicken the checking convergence.
In conjunction with the drawings to the description of the specific embodiment of the invention, others of the present invention and feature are conspicuous to those skilled in the art.
More than specific embodiments of the invention are described and illustrate it is exemplary that these embodiment should be considered to it, and be not used in and limit the invention, the present invention should make an explanation according to appended claim.