Verification method and device based on genetic algorithm

Through the verification method based on genetic algorithm, the problem of high resource consumption and low accuracy of chip verification is solved, efficient global search is achieved, and the coverage and accuracy of processor verification is improved.

CN119150769APending Publication Date: 2024-12-17SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411154865.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In the prior art, chip verification methods consume a lot of resources and time, and randomly generated test cases are not accurate and inefficient. The particle swarm algorithm is prone to fall into local optimal solutions, which cannot ensure the accuracy of chip verification.

Method used

The verification method based on genetic algorithm is adopted, and the initial key parameters are randomly selected, the fitness is calculated, the cross-and-mutation operations are performed, the population is dynamically adjusted, the global search is achieved, the local optimal solution is avoided, and the verification coverage is improved.

Benefits of technology

Effectively explore the value space of key parameters, improve the efficiency and quality of processor verification, and ensure high coverage and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119150769A_ABST
    Figure CN119150769A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a verification method and device based on a genetic algorithm, and the method comprises the steps: randomly selecting a plurality of groups of initial key parameters from a preset key parameter value range, and calculating the fitness of each group of initial key parameters in a processor verification process, processing the plurality of groups of initial key parameters according to the fitness, a preset selection probability, a preset crossover probability and a preset mutation probability to finally obtain a plurality of groups of target key parameters, taking the plurality of groups of target key parameters as the plurality of groups of initial key parameters, executing the steps again until a preset termination condition is met, and stopping iteration to obtain a plurality of target key parameters; and calculating and outputting a processor verification coverage rate according to the plurality of groups of target key parameters and the key parameter value range. The target key parameters are obtained based on the genetic algorithm, local optimum is avoided, the parameters are continuously optimized in the iteration process, the high processor verification coverage rate can be obtained, and the processor verification efficiency and quality are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of processor verification, and in particular to a verification method and device based on a genetic algorithm. Background Art

[0002] Processor verification can be divided into software simulation, prototype verification, and hardware simulation. Among them, prototype verification can identify potential problems in the design, such as unreasonable resource utilization in certain scenarios, unreasonable constraints without timing violations, etc. Pre-identifying these problems through prototype verification can reduce the risk of problems later. In prototype verification, it is necessary to restore the real usage scenario of the processor as much as possible and try to fully cover all functions of the processor. How to improve the verification coverage in prototype verification is one of the important indicators to ensure the reliability and stability of the processor. As the scale of processor design becomes larger and larger, prototype verification becomes more and more difficult, so how to improve the coverage in prototype verification becomes very important.

[0003] At present, in order to improve the prototype verification coverage of the module, formal verification, symbolic execution and random testing are mainly used. However, traditional chip verification methods usually consume a lot of resources and time, and the verification accuracy of randomly generated test cases is not high and the efficiency is low. In the prior art, the particle swarm algorithm is used to calculate the position of particles to achieve chip verification. However, the particle swarm algorithm is easily trapped by the local optimal solution and cannot obtain the global optimal solution, and cannot fully ensure the accuracy of chip verification. Summary of the invention

[0004] In view of the above problems, the present application proposes a verification method and device based on genetic algorithm.

[0005] In a first aspect of the implementation of the present application, a verification method based on a genetic algorithm is first provided, characterized in that the method comprises:

[0006] Randomly select a number of groups of initial key parameters in a preset key parameter value range, and calculate the fitness of each group of the initial key parameters in the processor verification process;

[0007] Determine a first quantity according to a preset selection probability and a total number of groups of the initial key parameters;

[0008] sorting the groups of initial key parameters in ascending order based on the fitness, and taking the first number of groups of initial key parameters with the smallest fitness as the groups of first key parameters;

[0009] Processing a plurality of groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain a plurality of groups of second key parameters;

[0010] respectively calculating the fitness of each group of the second key parameters in the processor verification process;

[0011] Determine the second number according to a preset selection probability and the total number of groups of the second key parameter;

[0012] sorting the plurality of groups of the second key parameters in ascending order based on the fitness, and taking the plurality of groups of the second key parameters of the second number with the smallest fitness as the plurality of groups of target key parameters;

[0013] Using the plurality of groups of target key parameters as the plurality of groups of initial key parameters, re-execute the step of determining the first number according to the preset selection probability and the total number of groups of the initial key parameters until the number of re-executions reaches a preset number of iterations or the fitness is consistent with a preset termination fitness;

[0014] The processor verification coverage is calculated and outputted according to several groups of the target key parameters and the value ranges of the key parameters.

[0015] Optionally, each group of the initial key parameters includes parameters of several registers, and the several groups of initial key parameters are randomly selected from the preset key parameter value range, including:

[0016] Randomly selecting a parameter corresponding to each register from the value range of the key parameter corresponding to each register;

[0017] Several groups of parameters are selected as initial key parameters, each group of parameters including parameters corresponding to several registers that meet preset constraint conditions.

[0018] Optionally, respectively calculating the fitness of each group of the initial key parameters in the processor verification process includes:

[0019] Calculate the Euclidean distance between each group of the initial key parameters and each of the remaining groups of the initial key parameters based on the first preset formula;

[0020] Among them, the first preset formula is:

[0021]

[0022] Among them, d i represents the Euclidean distance; (A i , B i …Z i ) represents the initial key parameters of the current group; (A j , B j …Z j ) represents the initial key parameters of any group other than the current group;

[0023] For each group of the initial key parameters, calculating the minimum distance among the plurality of Euclidean distances based on a second preset formula;

[0024] Among them, the second preset formula is:

[0025]

[0026] in, Indicates the minimum distance; min(d1,d2,…,d n ) represents the minimum value among the Euclidean distances;

[0027] Obtaining the total number of groups of the initial key parameters;

[0028] Calculate the average distance according to the minimum distance, the total number of groups of the initial key parameters and a third preset formula;

[0029] Among them, the third preset formula is:

[0030]

[0031] in, represents the average distance; n represents the total number of groups of the initial key parameters;

[0032] Calculating the fitness of each group of the initial key parameters according to the average distance, the total number of groups of the initial key parameters and a fourth preset formula;

[0033] Among them, the fourth preset formula is:

[0034]

[0035] in, Represents the fitness of each set of the initial key parameters.

[0036] Optionally, the processing of several groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain several groups of second key parameters includes:

[0037] Processing a plurality of groups of the first key parameters based on a preset crossover probability to obtain a plurality of groups of third key parameters;

[0038] Several groups of the third key parameters are processed based on a preset mutation probability to obtain several groups of second key parameters.

[0039] Optionally, each group of the first key parameters includes parameters of several registers, and the several groups of the first key parameters are processed based on a preset crossover probability to obtain several groups of third key parameters, including:

[0040] randomly selecting a group of the first key parameters from a plurality of groups of the first key parameters as a current group of the first key parameters;

[0041] Obtaining the number of the registers in the first key parameter of the current group according to the number of parameters of the registers;

[0042] Calculate the number of crossovers in the first key parameter of the current group based on the crossover probability and the number of registers;

[0043] Exchange the first key parameter of the current group with the register parameters of the crossover quantity in any other group of the first key parameters except the current group;

[0044] The first key parameters of the current group after exchange, the first key parameters of any other group except the current group, and the remaining several groups of the first key parameters are used as several groups of third key parameters.

[0045] Optionally, the processing of several groups of the third key parameters based on a preset mutation probability to obtain several groups of second key parameters includes:

[0046] Calculating a mutation number based on the mutation probability and the number of registers;

[0047] Replacing the register parameter of the variation number in each group of the third key parameter with another random number in the value range of the key parameter corresponding to the register;

[0048] The replaced groups of the third key parameters are used as the replaced groups of the second key parameters.

[0049] Optionally, the method further comprises:

[0050] Using the target key parameters as parameters of the processor, performing software verification on the processor to obtain a target software verification result;

[0051] Using the target key parameters as parameters of the processor, performing prototype verification on the processor to obtain a target prototype verification result;

[0052] Comparing the target software verification result with the target prototype verification result;

[0053] If the target software verification result is inconsistent with the target prototype verification result, record the target key parameters;

[0054] Obtaining operation log information generated during prototype verification and software verification of the processor;

[0055] The target key parameter is associated with the operation log information and saved as verification test information of the processor.

[0056] In a second aspect of the implementation of the present application, there is also provided a verification device based on a genetic algorithm, characterized in that the device comprises:

[0057] An initial fitness calculation module, used to randomly select a number of groups of initial key parameters in a preset key parameter value range, and respectively calculate the fitness of each group of the initial key parameters in the processor verification process;

[0058] A first quantity determination module, used to determine the first quantity according to a preset selection probability and the total number of groups of the initial key parameters;

[0059] A first key parameter selection module is used to sort the groups of initial key parameters in ascending order based on the fitness, and use the first number of groups of initial key parameters with the smallest fitness as the groups of first key parameters;

[0060] A second key parameter selection module, used for processing a plurality of groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain a plurality of groups of second key parameters;

[0061] A second fitness calculation module, used for respectively calculating the fitness of each group of the second key parameters in the processor verification process;

[0062] A second quantity determination module, used to determine the second quantity according to a preset selection probability and the total number of groups of the second key parameter;

[0063] a target key parameter selection module, used for sorting the plurality of groups of the second key parameters in ascending order based on the fitness, and taking the plurality of groups of the second key parameters of the second number with the smallest fitness as the plurality of groups of target key parameters;

[0064] A loop module, used for taking the several groups of the target key parameters as the several groups of the initial key parameters, and re-executing the step of determining the first number according to the preset selection probability and the total number of groups of the initial key parameters, until the number of re-executions reaches a preset number of iterations or the fitness is consistent with a preset termination fitness;

[0065] The coverage calculation module is used to calculate and output the processor verification coverage according to several groups of the target key parameters and the value ranges of the key parameters.

[0066] In the third aspect of the implementation of the present application, there is also provided an electronic device, characterized in that it includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, it implements the genetic algorithm-based verification method as described above.

[0067] In a fourth aspect of the implementation of the present application, a computer-readable storage medium is further provided, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the verification method based on the genetic algorithm as described above is implemented.

[0068] The embodiments of the present application have the following advantages:

[0069] In an embodiment of the present application, several groups of initial key parameters are randomly selected from a preset range of key parameter values, the fitness of each group of initial key parameters in the processor verification process is calculated respectively, and then the first number is determined according to the preset selection probability and the total number of groups of initial key parameters, the several groups of initial key parameters are sorted in order from small to large based on the fitness, and the several groups of initial key parameters of the first number with the smallest fitness are used as several groups of first key parameters, and the several groups of first key parameters are processed based on the preset crossover probability and the preset mutation probability to obtain several groups of second key parameters, and the fitness of each group of second key parameters in the processor verification process is calculated respectively. fitness, determine the second quantity according to the preset selection probability and the total number of groups of the second key parameters, sort the several groups of second key parameters in ascending order based on the fitness, use the several groups of second key parameters with the smallest fitness as several groups of target key parameters, use the several groups of target key parameters as several groups of initial key parameters, re-execute the step of determining the first quantity according to the preset selection probability and the total number of groups of initial key parameters, until the number of re-executions reaches the preset number of iterations or the fitness is consistent with the preset termination fitness, calculate and output the processor verification coverage according to the several groups of target key parameters and the range of key parameter values. The present application can effectively explore the value space of key parameters through the global search capability of the genetic algorithm to avoid falling into the local optimum, and the fitness evaluation mechanism can dynamically adjust the population so that the algorithm can adaptively evolve towards a better solution, and then the crossover and mutation operations increase the diversity of the population and improve the exploration capability of the algorithm. In addition, the parameters are continuously optimized during the iteration process, and finally a higher processor verification coverage can be obtained, which improves the efficiency and quality of verification. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art.

[0071] Figure 1 It is a flowchart of a genetic algorithm provided by an embodiment of the present application;

[0072] Figure 2 It is a flowchart of a verification method based on a genetic algorithm provided in one embodiment of the present application;

[0073] Figure 3 It is a structural diagram of a verification device based on a genetic algorithm provided in one embodiment of the present application. DETAILED DESCRIPTION

[0074] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, each embodiment of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in each embodiment of the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not constitute any limitation, and the various embodiments can be combined with each other and referenced to each other without contradiction.

[0075] During the prototype verification process, there are certain constraints between the key parameters of the IP module. The key parameters of the module can be randomly selected. The key parameters of the module need to meet the constraints. The key parameter values ​​of the module that meet the constraints are input into the software verification platform and the prototype verification platform, and the output value of the software verification platform is compared with the output value of the prototype verification platform. If the output values ​​of the two are consistent, it proves that the verification results of the software and hardware are consistent, indicating that the prototype verification results are relatively ideal, and running the processor with this set of parameters will not cause many problems. If the output values ​​of the two are inconsistent, it means that the results of the hardware and software implementations are inconsistent, and it is necessary to further confirm whether it is a software implementation problem or a hardware design problem.

[0076] It should be noted that the implementation process of prototype verification can be to deploy the design of the processor on a FPGA (field programmable gate array) or other programmable hardware platform. In this way, it can be tested closer to the actual hardware environment, and more complex scenarios and higher data throughput can be handled. Prototype verification helps to discover and solve problems that are difficult to simulate in software simulation, such as timing problems, power consumption problems, etc. Among them, the prototype verification platform can be a specially designed system or environment for testing, verifying and debugging the prototype during the product development process. This platform can be applied to multiple fields, such as electronics, machinery, software, etc., but is particularly important in the field of semiconductor and integrated circuit design. The prototype verification platform can ensure the functional correctness, performance, reliability of the prototype, and ensure that the processor meets the design specifications. In the embodiment of the present application, key parameters can be selected by genetic algorithm to realize prototype verification.

[0077] The implementation process of software verification can be to simulate the behavior of the processor by software on a computer. Special simulation tools and languages ​​(such as SystemVerilog, VHDL, etc.) can be used to write and run test cases. The advantage of software verification is that a large number of tests can be performed quickly, at a low cost, but the speed is slow and the real-time performance of the hardware cannot be fully simulated. Among them, the software verification platform can be a specially designed system or environment for testing, verifying and debugging software products during the software development process. Its purpose is to ensure the functional correctness, performance, security, stability and user experience of the software. The software verification platform can be a physical device, a virtual environment, or a complex system combining hardware and software. In the embodiment of the present application, the result of the prototype verification can be compared with the result of the software verification to confirm the conclusion of the verification.

[0078] In the field of semiconductor and integrated circuit design, IP modules (Intellectual Property Modules) can be designed, reusable functional modules that can be integrated into larger processor designs. IP modules can be hardware modules or software modules.

[0079] Usually, the key parameters of a module have a wide range of values, and the probability of duplication when randomly selecting the key parameters of the module is very high, making it impossible to cover all the key parameters. If all the key parameters are to be covered, it will take days or even months, which seriously affects the efficiency of prototype verification.

[0080] Therefore, the present application proposes a verification method based on a genetic algorithm. In the process of prototype verification coverage, key parameters that meet the constraint conditions are selected according to the genetic algorithm. The genetic algorithm screens the key parameter values ​​through the fitness value, and the key parameter values ​​are evenly distributed within the value range of the key parameters. The probability of repeated values ​​can be reduced, thereby quickly completing the prototype verification coverage test.

[0081] It should be noted that the Genetic Algorithm (GA) was first proposed by John Holland of the United States in the 1970s. The algorithm was designed and proposed based on the laws of evolution of organisms in nature. It is a computational model of biological evolution that simulates the natural selection and genetics mechanism of Darwin's theory of biological evolution. It is a method of searching for the optimal solution by simulating the natural evolution process. The algorithm uses mathematical methods and computer simulation operations to convert the problem-solving process into processes such as crossover and mutation of chromosome genes in biological evolution. When solving more complex combinatorial optimization problems, it can usually obtain better optimization results faster than some conventional optimization algorithms.

[0082] The background of genetic algorithm is Darwin's theory of evolution. The solution of the algorithm is a process of continuous reproduction, inheritance, elimination, and evolution to find the most suitable solution.

[0083] Reference Figure 1 , shows a schematic diagram of a process of a genetic algorithm provided by an embodiment of the present application, which may specifically include the following contents:

[0084] At the beginning of the process, the initial population is created, the fitness is calculated, and it is determined whether the fitness meets the termination condition. If the termination condition is not met, the initial population is selected, crossover, and mutation are performed, and the fitness of the new population is calculated again. If the termination condition is met, the optimal individual obtained is output, and the process ends.

[0085] It should be noted that creating an initialization population may be to randomly generate a group of individuals, which constitute the initial population of the algorithm. Each individual is usually a code of a solution, which may be a binary string, a real number vector, etc. In an embodiment of the present application, creating an initialization population may be to randomly generate a group of register parameters.

[0086] Calculating the fitness can be calculating the fitness value for each individual in the population, and the fitness value is usually the result of the objective function, reflecting the ability of the individual to solve the problem. In the embodiment of the present application, it is necessary to calculate the fitness of each set of parameters and further process the parameters based on this.

[0087] Determining whether the fitness satisfies the termination condition may be to check whether there are individuals in the current population that meet the problem requirements, or whether a preset number of iterations, fitness threshold, or other termination conditions have been reached. In the embodiment of the present application, the termination condition may be a preset number of iterations, fitness threshold, etc., which may be selected according to actual needs.

[0088] The selection operation can be performed based on the fitness value of the individual, and the purpose of the selection operation is to pass on excellent genes to the next generation. In the embodiment of the present application, parameters with smaller fitness can be preferentially selected.

[0089] The crossover operation can be to randomly pair selected individuals and perform gene crossover (also called hybridization or pairing) to produce new individuals. The crossover operation simulates the mating process in biological inheritance. In an embodiment of the present application, several parameters in one set of register parameters can be exchanged with several parameters in another set of register parameters.

[0090] The mutation operation can be to mutate the genes of the newly generated individuals to introduce new genetic mutations and increase the diversity of the population. The mutation operation simulates the mutation process in biological inheritance. In the embodiment of the present application, several parameters in a set of register parameters can be mutated to other values.

[0091] The process of genetic algorithm is an iterative process. Through continuous selection, crossover and mutation operations, individuals in the population gradually evolve towards a better solution. This process is similar to the evolutionary process in nature. Through the survival of the fittest and genetic mutation, the optimal solution or approximate optimal solution of the problem is finally found.

[0092] Reference Figure 2 , shows a flowchart of a verification method based on a genetic algorithm provided by an embodiment of the present application, and the method may specifically include the following steps:

[0093] Step 101 : randomly selecting a number of groups of initial key parameters in a preset range of key parameter values, and calculating the fitness of each group of the initial key parameters in the processor verification process.

[0094] It should be noted that each set of initial key parameters may include parameter values ​​of several registers.

[0095] The preset key parameter value range may be the value range of the parameter value of the register. And there may be other constraints between the parameter values ​​of different registers, for example, the parameter value of a certain register needs to be smaller than the parameter value of another register.

[0096] Fitness can be used to evaluate the performance of an individual in a problem space. The fitness value is a quantitative representation of an individual's problem-solving ability, usually calculated based on the objective function or evaluation criteria of the problem.

[0097] In the embodiment of the present application, several groups of initial key parameters can be randomly selected within a preset range of key parameter values, and then the fitness of each group of initial key parameters can be calculated respectively.

[0098] In a specific implementation, the population initialization process can be used as a process of randomly selecting several groups of initial key parameters in a preset key parameter value range. The specific implementation method is as follows:

[0099] Randomly generate several solutions in the feasible domain, which are called the initial population. For example, a function of an IP module needs to configure three registers, the registers are register A, register B, register C, and the value range is A1~A n , B1~B m , C1~C o For example, randomly select A1~A n is the value of register A2, B1~B m is the value of register B3, C1~C o is the value of register C4, and satisfies the constraint that the value of register A is less than the value of register B. We call one of the registers a gene, and the combination of registers a chromosome. The chromosome is one of the solutions. In this algorithm, a chromosome is an individual, such as [A2, B3, C4] is one of the solutions. The population size should not be too large or too small. If it is too small, the genetic optimization performance will generally not be very good. If it is too large, it is easy to fall into the local optimal solution. The number of chromosomes for population initialization can be selected according to the actual situation.

[0100] In a specific implementation, respectively calculating the fitness of each group of the initial key parameters in the processor verification process can refer to the following implementation:

[0101] Perform fitness evaluation on each solution in the population to evaluate the degree of adaptability of each individual to the environment. That is, the fitness of each set of initial key parameters is calculated in this application. Similarly, taking the example that a function of an IP module needs to configure three registers, namely register A, register B, and register C, randomly select individual 1 [A2, B3, C4], individual 2 [A3, B4, C5], and individual 3 [A3, B3, C4], and regard the register value as one dimension, then the three registers can be regarded as three dimensions, and the randomly selected individual is a point in the three-dimensional space. The fitness evaluation is to obtain the average value of the distance from each point to the nearest point in the three-dimensional space, and calculate the sum of the variances of the distances between all points and the average value as the fitness.

[0102] Step 102: determining a first quantity according to a preset selection probability and the total number of groups of the initial key parameters.

[0103] It should be noted that the selection probability can be the selection operation of the genetic algorithm. In the genetic algorithm, the fittest survive and the unfit are eliminated. Specifically, the unfit individuals can be eliminated according to the fitness ranking, and the fit ones can be retained. The selection operation selects a part of excellent individuals by evaluating and ranking the fitness of individuals, so that they have a greater chance to participate in the reproduction process. In this way, the genetic information of excellent individuals can be inherited and developed in the offspring, thereby improving the fitness of the entire population. However, too large a selection probability may lead to the occurrence of premature maturity. The selection probability p s The range can be 0.2 <p s <0.5, which can be preset according to actual conditions.

[0104] In the embodiment of the present application, the first number can be determined according to the preset selection probability and the total number of groups of the initial key parameters, wherein the first number can be the number of retained individuals.

[0105] In the specific implementation, the selection probability p can be selected s is 0.4. The number of retained individuals Res = selection probability p s ×Total number of initial key parameter groups.

[0106] Step 103: sort the groups of initial key parameters in ascending order based on the fitness, and use the first number of groups of initial key parameters with the smallest fitness as the groups of first key parameters.

[0107] In an embodiment of the present application, several groups of initial key parameters may be sorted in ascending order based on fitness, and several groups of initial key parameters of the first number with the smallest fitness are selected as several groups of first key parameters.

[0108] In a specific implementation, after calculating the fitness of the individuals, i.e., chromosomes, the individuals, i.e., chromosomes, can be sorted according to the size of the fitness values, and a number of chromosomes with smaller fitness of the individuals, i.e., chromosomes, of the number of retained individuals are retained, and other individuals, i.e., chromosomes, are eliminated. Among them, the individuals or chromosomes can be the initial key parameters in this application.

[0109] Step 104: Processing several groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain several groups of second key parameters.

[0110] In an embodiment of the present application, several groups of first key parameters can be processed based on a preset crossover probability and a preset mutation probability, that is, the crossover operation and mutation operation in the genetic algorithm can be performed on several groups of first key parameters to obtain several groups of second key parameters after processing.

[0111] In specific implementation, the crossover operation can refer to the process of exchanging part of the gene sequence between two individuals. The purpose of this operation is to produce offspring with a better gene combination. The specific implementation steps of the crossover operation are to randomly select genes at a certain position in the two individuals and exchange their values. The crossover probability p c Generally, the crossover probability p is 0.4 to 0.99. c is 0.7, that is, each gene in two individuals has a crossover probability p c The individual or chromosome may be the initial key parameter in this application.

[0112] Mutation operation can be a random change in the genes in the chromosome during the evolution process to produce new individuals. Mutation operation plays an important role in evolutionary algorithms. It can increase the search space and avoid falling into the local optimal solution. Generally speaking, a lower mutation probability can maintain the stability of the population, and a higher mutation probability can increase the exploration space. So the mutation probability p m It should not be too large or too small. The general value is 0.0001 to 0.2. In the embodiment of the present application, the crossover probability p can be selected m is 0.1, that is, each gene in an individual has a mutation probability p m The range of gene mutation must also be within the range of register values, and must meet preset constraints such as register A value is less than register B value.

[0113] Step 105 , respectively calculating the fitness of each group of the second key parameters in the processor verification process.

[0114] In the embodiment of the present application, the fitness of each group of second key parameters in the processor verification process may be calculated separately.

[0115] The present application can calculate the fitness of the second key parameter, and then evaluate the fitness of each solution in the population to assess the degree of adaptation of each individual to the environment.

[0116] Step 106: Determine the second quantity according to a preset selection probability and the total number of groups of the second key parameter.

[0117] In the embodiment of the present application, the second number can be determined according to the preset selection probability and the total number of groups of the second key parameter, wherein the second number can be the number of retained individuals.

[0118] In the specific implementation, the selection probability p can be selected s is 0.4. The number of retained individuals Res = selection probability p s ×The total number of groups of the second key parameter.

[0119] Step 107: sort the plurality of groups of the second key parameters in ascending order based on the fitness, and use the second number of groups of the second key parameters with the smallest fitness as the plurality of groups of target key parameters.

[0120] In the embodiment of the present application, several groups of second key parameters may be sorted in ascending order based on fitness, and several groups of second key parameters of the second number with the smallest fitness may be used as several groups of target key parameters.

[0121] In a specific implementation, after calculating the fitness of the individuals, i.e., chromosomes, the individuals, i.e., chromosomes, can be sorted according to the size of the fitness values, and a number of chromosomes with smaller fitness of the individuals, i.e., chromosomes, of the number of retained individuals are retained, and other individuals, i.e., chromosomes, are eliminated. Among them, the individuals or chromosomes can be the second key parameter in this application.

[0122] Step 108, using several groups of the target key parameters as several groups of the initial key parameters, re-execute the step of determining the first number based on the preset selection probability and the total number of groups of the initial key parameters, until the number of re-executions reaches a preset number of iterations or the fitness is consistent with the preset termination fitness.

[0123] It should be noted that the target key parameters can be used as parameters of a processor, and software verification and / or prototype verification can be performed on the processor with the parameters.

[0124] In an embodiment of the present application, several groups of the target key parameters can be used as several groups of the initial key parameters, and the steps of determining the first number based on the preset selection probability and the total number of groups of the initial key parameters can be re-executed until the number of re-executions reaches a preset number of iterations or the fitness is consistent with the preset termination fitness.

[0125] In a specific implementation, the iterative loop of the genetic algorithm can be stopped when a preset number of cycles or a variance reaches a preset value. For example, it can be determined whether the maximum number of iterations t max Or the variance and the fitness reach the preset value of 0.

[0126] Step 109: Calculate and output the processor verification coverage based on several groups of the target key parameters and the value ranges of the key parameters.

[0127] It should be noted that in software testing, hardware verification and other engineering fields, coverage can be an important metric to measure the adequacy and effectiveness of testing or verification activities. Coverage usually refers to how much of the design or code is covered by test cases or verification conditions during the execution of testing or verification.

[0128] In an embodiment of the present application, the processor verification coverage can be calculated and output based on several groups of target key parameters and key parameter value ranges. Among them, the target key parameters can represent the parameter values ​​of a group of registers, the key parameter value range can represent the value range of the parameter values ​​of the registers, and the ratio of the parameter values ​​of several groups of registers obtained during the entire iteration process to the value range of the parameter values ​​of the registers can be used to represent the coverage of the processor during the verification process. In other words, the coverage rate can refer to the ratio of the register parameters involved in software verification and / or prototype verification to the total register parameters.

[0129] In an embodiment of the present application, several groups of initial key parameters are randomly selected from a preset range of key parameter values, the fitness of each group of initial key parameters in the processor verification process is calculated respectively, and then the first number is determined according to the preset selection probability and the total number of groups of initial key parameters, the several groups of initial key parameters are sorted in order from small to large based on the fitness, and the several groups of initial key parameters of the first number with the smallest fitness are used as several groups of first key parameters, and the several groups of first key parameters are processed based on the preset crossover probability and the preset mutation probability to obtain several groups of second key parameters, and the fitness of each group of second key parameters in the processor verification process is calculated respectively. fitness, determine the second quantity according to the preset selection probability and the total number of groups of the second key parameters, sort the several groups of second key parameters in ascending order based on the fitness, use the several groups of second key parameters with the smallest fitness as several groups of target key parameters, use the several groups of target key parameters as several groups of initial key parameters, re-execute the step of determining the first quantity according to the preset selection probability and the total number of groups of initial key parameters, until the number of re-executions reaches the preset number of iterations or the fitness is consistent with the preset termination fitness, calculate and output the processor verification coverage according to the several groups of target key parameters and the range of key parameter values. The present application can effectively explore the value space of key parameters through the global search capability of the genetic algorithm to avoid falling into the local optimum, and the fitness evaluation mechanism can dynamically adjust the population so that the algorithm can adaptively evolve towards a better solution, and then the crossover and mutation operations increase the diversity of the population and improve the exploration capability of the algorithm. In addition, the parameters are continuously optimized during the iteration process, and finally a higher processor verification coverage can be obtained, which improves the efficiency and quality of verification.

[0130] In an optional embodiment of the present application, each group of the initial key parameters includes parameters of several registers, and step S101 further includes the following sub-steps:

[0131] S11: Randomly select a parameter corresponding to each register from the value range of the key parameter corresponding to each register;

[0132] S12: Selecting several groups of parameters as initial key parameters, each group of parameters including parameters corresponding to several registers that meet preset constraint conditions.

[0133] It should be noted that the preset constraint condition may be the value range of each register, or the constraint relationship between the values ​​of several registers, and it can be selected according to the actual situation.

[0134] In an embodiment of the present application, parameters corresponding to a register can be randomly selected from the key parameter value range corresponding to each register, and then several groups of parameters can be selected as initial key parameters, each group of parameters including several parameters corresponding to the register that meet preset constraints.

[0135] In a specific implementation, the constraint condition may refer to the following example, for example, the constraint condition may be 1<register A<5, 4<register B<7, 10<register C<16. Register A<register B.

[0136] The following example illustrates how to obtain the initial key parameters.

[0137] For example, an IP module has three registers, namely register A, register B, and register C, with value ranges of 1 to 5, 4 to 7, and 10 to 16. First, the population can be initialized, that is, several sets of initial key parameters can be obtained. Assume that the population size m is 3, the number of genes in each chromosome D is 3, and the selection probability p s is 0.4, and the crossover probability p c is 0.7, the mutation probability p m is 0.1, the maximum number of iterations t max is 1000, and the variance and preset value are 0. The three sets of initial key parameters obtained, that is, the three chromosomes are initialized as x1 = [1, 4, 10], x2 = [5, 7, 16], and x3 = [3, 5, 13].

[0138] In an optional embodiment of the present application, step S101 further includes the following sub-steps:

[0139] S21: calculating the Euclidean distance between each group of the initial key parameters and each of the remaining groups of the initial key parameters based on the first preset formula;

[0140] S22: Wherein, the first preset formula is:

[0141]

[0142] S23: where d i represents the Euclidean distance; (A i , B i …Z i) represents the initial key parameters of the current group; (A j , B j …Z j ) represents the initial key parameters of any group other than the current group;

[0143] S24: for each group of the initial key parameters, calculating the minimum distance among the plurality of Euclidean distances based on a second preset formula;

[0144] S25: The second preset formula is:

[0145]

[0146] S26: Among them, Indicates the minimum distance; min(d1,d2,…,d n ) represents the minimum value among the Euclidean distances;

[0147] S27: Obtain the total number of groups of the initial key parameters;

[0148] S28: calculating an average distance according to the minimum distance, the total number of groups of the initial key parameters and a third preset formula;

[0149] S29: Wherein, the third preset formula is:

[0150]

[0151] S30: Among them, represents the average distance; n represents the total number of groups of the initial key parameters;

[0152] S31: calculating the fitness of each group of the initial key parameters according to the average distance, the total number of groups of the initial key parameters and a fourth preset formula;

[0153] S32: The fourth preset formula is:

[0154]

[0155] S33: Among them, Represents the fitness of each set of the initial key parameters.

[0156] It should be noted that Euclidean distance, also known as Euclidean distance, is one of the commonly used distance metrics in geometry and can be used to measure the straight-line distance between two points in a multidimensional space. In two-dimensional or three-dimensional space, the Euclidean distance can be calculated by a simple Pythagorean theorem. For higher-dimensional spaces, the calculation formula for the Euclidean distance is similar. In an embodiment of the present application, the Euclidean distance is used to characterize the similarity or difference between the initial key parameters of different groups.

[0157] In an embodiment of the present application, the Euclidean distance between each group of initial key parameters and each of the remaining groups of initial key parameters can be calculated based on the first preset formula, and the Euclidean distance can characterize the similarity or difference between the initial key parameters of different groups. Then, for each group of initial key parameters, the minimum distance among several Euclidean distances is calculated based on the second preset formula to obtain the closest distance between each group of initial key parameters and other groups of initial key parameters. Then, the average distance is calculated based on the minimum distance, the total number of groups of initial key parameters and the third preset formula. The average value of the closest distances in all groups of initial key parameters is obtained. Then, the fitness of each group of initial key parameters is calculated based on the average distance, the total number of groups of initial key parameters and the fourth preset formula. The fitness can be used to evaluate the performance of each group of initial key parameters in the processor verification process.

[0158] In a specific implementation, the following example may be used to illustrate the method of calculating fitness.

[0159] After calculating the fitness value according to the fitness function, sorting is performed according to the fitness value to select the probability p s After selecting and retaining the excellent individuals (i.e. chromosomes), take the initialization of 3 chromosomes as x1 = [1, 4, 10], x2 = [5, 7, 16], x3 = [3, 5, 13] as an example.

[0160] The distance from chromosome x1 to chromosome x2 can be:

[0161]

[0162] The distance from chromosome x1 to chromosome x3 can be:

[0163]

[0164] The minimum distance among the Euclidean distances of chromosome x1

[0165] The distance from chromosome x2 to chromosome x1 can be:

[0166]

[0167] The distance from chromosome x2 to chromosome x3 can be:

[0168]

[0169] The minimum distance among the Euclidean distances of chromosome x2

[0170] The distance from chromosome x3 to chromosome x1 can be:

[0171]

[0172] The distance from chromosome x3 to chromosome x2 can be:

[0173]

[0174] The minimum distance among the Euclidean distances of chromosome x3

[0175] The average distance can be:

[0176]

[0177] The sum of the squared deviations of the distances between all points and this mean:

[0178]

[0179] It should be noted that the above method of calculating fitness is only an embodiment of the present application, and the fitness can be calculated not only according to such parameter settings, but also by selecting appropriate parameters to calculate the fitness according to actual conditions.

[0180] In the embodiment of the present application, the Euclidean distance between each group of initial key parameters is calculated to characterize the similarity or difference of the parameter groups, and then the minimum distance and average distance of each group of parameters are calculated, and finally the fitness is calculated based on these distances. This method can effectively evaluate the performance of each group of initial key parameters in the processor verification process, improve the processor verification coverage through global search and iterative optimization, and improve the verification efficiency and quality.

[0181] In an optional embodiment of the present application, step S104 further includes the following sub-steps:

[0182] S41: Processing several groups of the first key parameters based on a preset crossover probability to obtain several groups of third key parameters;

[0183] S42: Processing several groups of the third key parameters based on a preset mutation probability to obtain several groups of second key parameters.

[0184] It should be noted that the crossover probability and mutation probability can be set according to actual needs.

[0185] In an embodiment of the present application, several groups of first key parameters can be processed based on a preset crossover probability, that is, the crossover operation in the genetic algorithm is performed on the first key parameters to obtain several groups of third key parameters, and then several groups of third key parameters can be processed based on a preset mutation probability, that is, the mutation operation in the genetic algorithm is performed on the third key parameters to obtain several groups of second key parameters.

[0186] The present application increases the diversity of the population through crossover and mutation operations, which helps the genetic algorithm to explore a wider solution space and avoid falling into local optimality, thereby improving the efficiency and quality of processor verification.

[0187] In an optional embodiment of the present application, each group of the first key parameters includes parameters of several registers, and step S41 further includes the following sub-steps:

[0188] S411: randomly selecting a group of the first key parameters from a plurality of groups of the first key parameters as a current group of the first key parameters;

[0189] S412: Obtain the number of the registers in the first key parameter of the current group according to the number of the parameters of the registers;

[0190] S413: Calculate the number of crossovers in the first key parameter of the current group based on the crossover probability and the number of registers;

[0191] S414: exchanging the first key parameter of the current group with the register parameters of the crossover quantity in any other group of the first key parameters except the current group;

[0192] S415: The first key parameters of the current group after exchange, the first key parameters of any other group except the current group, and the first key parameters of the remaining several groups are used as several groups of third key parameters.

[0193] In an embodiment of the present application, a group of first key parameters can be randomly selected from several groups of first key parameters as the first key parameters of the current group, and then the number of registers in the first key parameters of the current group is obtained according to the number of parameters of the registers, and then the number of crossovers in the first key parameters of the current group is calculated based on the crossover probability and the number of registers, and the first key parameters of the current group are exchanged with the register parameters of the number of crossovers in any other group of first key parameters except the current group, and the exchanged first key parameters of the current group, any other group of first key parameters except the current group, and the remaining several groups of first key parameters are used as several groups of third key parameters.

[0194] In a specific implementation, the following example may be used to illustrate the crossover operation method.

[0195] Two chromosomes are randomly selected for crossover, and each gene in the individual chromosome is c Crossover, due to p c ×D=0.7×3=2.1 is greater than 2, but the crossover must be an integer, so 2 genes are selected for crossover, so two genes from two chromosomes are randomly selected for exchange.

[0196] In an optional embodiment of the present application, step S42 further includes the following sub-steps:

[0197] S421: Calculating the number of mutations based on the mutation probability and the number of registers;

[0198] S422: Replace the register parameter of the variation number in each group of the third key parameter with another random number in the key parameter value range corresponding to the register;

[0199] S423: Using the replaced groups of the third key parameters as the groups of the second key parameters.

[0200] In the embodiment of the present application, the number of mutations can be calculated based on the probability of mutation and the number of registers. Then, the register parameter of the number of mutations in each group of third key parameters is replaced with another random number in the key parameter value range corresponding to the register, and the replaced groups of third key parameters are used as groups of second key parameters.

[0201] In a specific implementation, the following example can be used to illustrate the mutation operation method.

[0202] Each gene in an individual, i.e. a chromosome, has a mutation probability p m To mutate, due to p m ×D=0.1×3=0.3 is less than 1, but the mutated gene must be an integer, so a gene in the individual, that is, the chromosome, is randomly selected for mutation, and after the mutation, the value of register A must satisfy 1 to 5, the value of register B must satisfy 4 to 7, and the value of register C must satisfy 10 to 16.

[0203] In an optional embodiment of the present application, the method further includes:

[0204] S51: using the target key parameter as a parameter of the processor, performing software verification on the processor, and obtaining a target software verification result;

[0205] S52: using the target key parameters as parameters of the processor, performing prototype verification on the processor, and obtaining a target prototype verification result;

[0206] S53: Compare the target software verification result with the target prototype verification result;

[0207] S54: If the target software verification result is inconsistent with the target prototype verification result, record the target key parameters;

[0208] S55: Obtaining operation log information generated during the process of performing prototype verification and software verification on the processor;

[0209] S56: The target key parameter is associated with the operation log information and saved as verification test information of the processor.

[0210] It should be noted that the operation log information may refer to a series of data and messages recorded during the operation of software, hardware or system, which are usually used for tracking, debugging, performance analysis and fault diagnosis. The operation log information is essential for ensuring the stable operation of the system, optimizing performance and solving problems. In an embodiment of the present application, the test information of the processor can be recorded by the operation log information.

[0211] The verification test information may be test information in the operation log information including target key parameters. Through the verification test information, the tester may quickly understand what problems occurred during the processor test under what parameter conditions.

[0212] In an embodiment of the present application, the target key parameters can be used as parameters of the processor to perform software verification on the processor to obtain target software verification results. The target key parameters can then be used as parameters of the processor to perform prototype verification on the processor to obtain target prototype verification results. The target software verification results are then compared with the target prototype verification results. If the target software verification results are inconsistent with the target prototype verification results, the target key parameters are recorded, and the operation log information generated during the prototype verification and software verification of the processor is obtained. The target key parameters are associated with the operation log information and saved as verification test information for the processor.

[0213] In the specific implementation, the key parameters selected by the genetic algorithm can be input into the software verification platform and the prototype verification platform, and the output values ​​of the software verification platform and the prototype verification platform can be compared. If the output values ​​of the two are consistent, it proves that the implementation of the software and hardware are consistent, indicating that there is little problem with the prototype verification. If the output values ​​of the two are inconsistent, it means that the hardware and software implementations are inconsistent, and it is necessary to further confirm whether it is a software implementation problem or a hardware design problem.

[0214] In the specific implementation, the mutation operation method can be explained by referring to the following example. The updated values ​​of the position, i.e., register A, register B, and register C, can be used as the input of the IP module to the IP module of the prototype verification platform and the IP module of the software verification platform, and the output results of the two can be compared. If they are inconsistent, the values ​​of all registers and the operation logs are saved for the tester to locate the problem.

[0215] In the embodiment of the present application, by applying the target key parameters to the software verification and prototype verification of the processor, comparing the consistency of the two verification results, and recording the key parameters and operation log information when the results are inconsistent, it is helpful to deeply analyze and locate the problem and improve the accuracy and reliability of the verification. This method can ensure the consistency of the processor's behavior in different verification environments and provide strong support for the optimization and debugging of the processor.

[0216] In the embodiment of the present application, a multi-objective genetic algorithm can be introduced to achieve simultaneous optimization of coverage and verification time. In this way, in the fitness function of the genetic algorithm, not only coverage but also verification time need to be considered. The genetic algorithm can find a balance point and effectively improve the efficiency and quality of processor verification. This method helps to reduce unnecessary verification time while improving verification coverage, thereby accelerating the product launch cycle and improving resource utilization efficiency.

[0217] In the embodiment of the present application, an adaptive mechanism can also be introduced to dynamically adjust the genetic algorithm parameters. The selection probability, crossover probability and mutation probability of the genetic algorithm can be dynamically adjusted according to the current coverage level. For example, when the coverage is low, the mutation probability can be increased to increase the diversity of the population and promote the exploration of new solutions; when the coverage is high, the mutation probability can be reduced to stabilize the population and avoid excessive exploration. And the fitness threshold can be adjusted: the fitness threshold is dynamically adjusted according to the current coverage to control the termination condition of the algorithm. When the coverage is close to the target, the threshold can be appropriately increased to prompt the algorithm to optimize the parameters more finely. This adaptive strategy helps to more effectively balance exploration and development during the verification process, ensuring that the algorithm can be more finely adjusted when it is close to the optimal solution, thereby improving the overall performance of processor verification.

[0218] In an embodiment of the present application, several groups of initial key parameters are randomly selected from a preset range of key parameter values, the fitness of each group of initial key parameters in the processor verification process is calculated respectively, and then the first number is determined according to the preset selection probability and the total number of groups of initial key parameters, the several groups of initial key parameters are sorted in order from small to large based on the fitness, and the several groups of initial key parameters of the first number with the smallest fitness are used as several groups of first key parameters, and the several groups of first key parameters are processed based on the preset crossover probability and the preset mutation probability to obtain several groups of second key parameters, and the fitness of each group of second key parameters in the processor verification process is calculated respectively. fitness, determine the second quantity according to the preset selection probability and the total number of groups of the second key parameters, sort the several groups of second key parameters in ascending order based on the fitness, use the several groups of second key parameters with the smallest fitness as several groups of target key parameters, use the several groups of target key parameters as several groups of initial key parameters, re-execute the step of determining the first quantity according to the preset selection probability and the total number of groups of initial key parameters, until the number of re-executions reaches the preset number of iterations or the fitness is consistent with the preset termination fitness, calculate and output the processor verification coverage according to the several groups of target key parameters and the range of key parameter values. The present application can effectively explore the value space of key parameters through the global search capability of the genetic algorithm to avoid falling into the local optimum, and the fitness evaluation mechanism can dynamically adjust the population so that the algorithm can adaptively evolve towards a better solution, and then the crossover and mutation operations increase the diversity of the population and improve the exploration capability of the algorithm. In addition, the parameters are continuously optimized during the iteration process, and finally a higher processor verification coverage can be obtained, which improves the efficiency and quality of verification.

[0219] Reference Figure 3 , shows a schematic diagram of the structure of a verification device based on a genetic algorithm provided by an embodiment of the present application. The device comprises:

[0220] An initial fitness calculation module 301 is used to randomly select a number of groups of initial key parameters in a preset key parameter value range, and respectively calculate the fitness of each group of the initial key parameters in the processor verification process;

[0221] A first quantity determination module 302, configured to determine a first quantity according to a preset selection probability and a total number of groups of the initial key parameters;

[0222] A first key parameter selection module 303 is used to sort the groups of initial key parameters in ascending order based on the fitness, and use the first number of groups of initial key parameters with the smallest fitness as the groups of first key parameters;

[0223] A second key parameter selection module 304, configured to process a plurality of groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain a plurality of groups of second key parameters;

[0224] A second fitness calculation module 305, used to respectively calculate the fitness of each group of the second key parameters in the processor verification process;

[0225] A second quantity determination module 306, configured to determine a second quantity according to a preset selection probability and a total number of groups of the second key parameter;

[0226] A target key parameter selection module 307 is used to sort the plurality of groups of the second key parameters in ascending order based on the fitness, and select the second number of groups of the second key parameters with the smallest fitness as the plurality of groups of target key parameters;

[0227] A loop module 308 is used to use the plurality of groups of target key parameters as the plurality of groups of initial key parameters, and re-execute the step of determining the first number according to the preset selection probability and the total number of groups of the initial key parameters, until the number of re-executions reaches a preset number of iterations or the fitness is consistent with a preset termination fitness;

[0228] The coverage calculation module 309 is used to calculate and output the processor verification coverage according to several groups of the target key parameters and the value ranges of the key parameters.

[0229] Optionally, each group of the initial key parameters includes parameters of several registers, and the initial fitness calculation module 301 includes:

[0230] A register parameter random selection module, used for randomly selecting a parameter corresponding to each register from the key parameter value range corresponding to each register;

[0231] The initial key parameter acquisition module is used to select several groups of parameters as initial key parameters, each group of parameters including parameters corresponding to several registers that meet preset constraints.

[0232] Optionally, the initial fitness calculation module 301 further includes:

[0233] A Euclidean distance calculation module, used for respectively calculating the Euclidean distance between each group of the initial key parameters and each of the remaining groups of the initial key parameters based on a first preset formula;

[0234] Among them, the first preset formula is:

[0235]

[0236] Among them, di represents the Euclidean distance; (A i , B i …Z i ) represents the initial key parameters of the current group; (A j , B j …Z j ) represents the initial key parameters of any group other than the current group;

[0237] A minimum distance calculation module, used for calculating the minimum distance among the plurality of Euclidean distances based on a second preset formula for each group of the initial key parameters;

[0238] Among them, the second preset formula is:

[0239]

[0240] in, Indicates the minimum distance; min(d1,d2,…,d n ) represents the minimum value among the Euclidean distances;

[0241] A total number of groups acquisition module, used to acquire the total number of groups of the initial key parameters;

[0242] An average distance calculation module, used to calculate the average distance according to the minimum distance, the total number of groups of the initial key parameters and a third preset formula;

[0243] Among them, the third preset formula is:

[0244]

[0245] in, represents the average distance; n represents the total number of groups of the initial key parameters;

[0246] A fitness calculation module, used for calculating the fitness of each group of the initial key parameters according to the average distance, the total number of groups of the initial key parameters and a fourth preset formula;

[0247] Among them, the fourth preset formula is:

[0248]

[0249] in, Represents the fitness of each set of the initial key parameters.

[0250] Optionally, the second key parameter selection module 304 includes:

[0251] A third key parameter acquisition module, used for processing several groups of the first key parameters based on a preset crossover probability to obtain several groups of third key parameters;

[0252] The second key parameter acquisition submodule is used to process several groups of the third key parameters based on a preset mutation probability to obtain several groups of second key parameters.

[0253] Optionally, each group of the first key parameters includes parameters of several registers, and the third key parameter acquisition module includes:

[0254] A current group parameter selection module, used for randomly selecting a group of the first key parameters from a plurality of groups of the first key parameters as the first key parameters of the current group;

[0255] A register quantity acquisition module, used for acquiring the number of the registers in the first key parameter of the current group according to the number of parameters of the registers;

[0256] a crossover number calculation module, configured to calculate the crossover number in the first key parameter of the current group based on the crossover probability and the number of registers;

[0257] An exchange module, used for exchanging the first key parameter of the current group with the register parameter of the crossover quantity in any other group of the first key parameter except the current group;

[0258] The third key parameter acquisition submodule is used to use the first key parameters of the current group after exchange, the first key parameters of any other group except the current group, and the remaining several groups of the first key parameters as several groups of third key parameters.

[0259] Optionally, the second key parameter acquisition submodule includes:

[0260] A mutation number calculation module, used for calculating the mutation number based on the mutation probability and the number of registers;

[0261] A mutation module, used for replacing the register parameter of the mutation quantity in each group of the third key parameter with another random number in the value range of the key parameter corresponding to the register;

[0262] The second key parameter composition module is used to use the replaced groups of the third key parameters as the groups of the second key parameters.

[0263] Optionally, the device further comprises:

[0264] A software verification module, used to use the target key parameters as parameters of the processor, perform software verification on the processor, and obtain a target software verification result;

[0265] A prototype verification module, used to use the target key parameters as parameters of the processor, perform prototype verification on the processor, and obtain a target prototype verification result;

[0266] A result comparison module, used for comparing the target software verification result with the target prototype verification result;

[0267] A parameter recording module, used for recording the target key parameters if the target software verification result is inconsistent with the target prototype verification result;

[0268] An operation log acquisition module is used to acquire operation log information generated during the process of performing prototype verification and software verification on the processor;

[0269] The test information acquisition module is used to associate the target key parameter with the operation log information and save it as verification test information of the processor.

[0270] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0271] An embodiment of the present application also provides an electronic device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and when the computer program is executed by the processor, the genetic algorithm-based verification method as described above is implemented.

[0272] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the verification method based on the genetic algorithm as described above is implemented.

[0273] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0274] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0275] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0276] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0277] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0278] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0279] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0280] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.

[0281] The verification method and device based on genetic algorithm are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A verification method based on genetic algorithm, characterized in that: The method comprises: Randomly select a number of groups of initial key parameters in a preset key parameter value range, and calculate the fitness of each group of the initial key parameters in the processor verification process; Determine a first quantity according to a preset selection probability and a total number of groups of the initial key parameters; sorting the groups of initial key parameters in ascending order based on the fitness, and taking the first number of groups of initial key parameters with the smallest fitness as the groups of first key parameters; Processing a plurality of groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain a plurality of groups of second key parameters; respectively calculating the fitness of each group of the second key parameters in the processor verification process; Determine the second number according to a preset selection probability and the total number of groups of the second key parameter; sorting the plurality of groups of the second key parameters in ascending order based on the fitness, and taking the plurality of groups of the second key parameters of the second number with the smallest fitness as the plurality of groups of target key parameters; Using the plurality of groups of target key parameters as the plurality of groups of initial key parameters, re-execute the step of determining the first number according to the preset selection probability and the total number of groups of the initial key parameters until the number of re-executions reaches a preset number of iterations or the fitness is consistent with a preset termination fitness; The processor verification coverage is calculated and outputted according to several groups of the target key parameters and the value ranges of the key parameters.

2. The method according to claim 1, characterized in that Each group of the initial key parameters includes parameters of several registers, and several groups of initial key parameters are randomly selected from the preset key parameter value range, including: Randomly selecting a parameter corresponding to each register from the value range of the key parameter corresponding to each register; Several groups of parameters are selected as initial key parameters, each group of parameters including parameters corresponding to several registers that meet preset constraint conditions.

3. The method according to claim 2, characterized in that The respectively calculating the fitness of each group of the initial key parameters in the processor verification process includes: Calculate the Euclidean distance between each group of the initial key parameters and each of the remaining groups of the initial key parameters based on the first preset formula; Among them, the first preset formula is: Among them, d i represents the Euclidean distance; (A i , B i …Z i ) represents the initial key parameters of the current group; (A j , B j …Z j ) represents the initial key parameters of any group other than the current group; For each group of the initial key parameters, calculating the minimum distance among the plurality of Euclidean distances based on a second preset formula; Among them, the second preset formula is: in, Indicates the minimum distance; min(d1,d2,…,d n ) represents the minimum value among the Euclidean distances; Obtaining the total number of groups of the initial key parameters; Calculate the average distance according to the minimum distance, the total number of groups of the initial key parameters and a third preset formula; Among them, the third preset formula is: in, represents the average distance; n represents the total number of groups of the initial key parameters; Calculating the fitness of each group of the initial key parameters according to the average distance, the total number of groups of the initial key parameters and a fourth preset formula; Among them, the fourth preset formula is: in, Represents the fitness of each set of the initial key parameters.

4. The method according to claim 1, characterized in that: The processing of the plurality of groups of the first key parameters based on the preset crossover probability and the preset mutation probability to obtain a plurality of groups of the second key parameters includes: Processing a plurality of groups of the first key parameters based on a preset crossover probability to obtain a plurality of groups of third key parameters; Several groups of the third key parameters are processed based on a preset mutation probability to obtain several groups of second key parameters.

5. The method according to claim 4, characterized in thatEach group of the first key parameters includes parameters of several registers, and the several groups of the first key parameters are processed based on the preset crossover probability to obtain several groups of third key parameters, including: randomly selecting a group of the first key parameters from a plurality of groups of the first key parameters as a current group of the first key parameters; Obtaining the number of the registers in the first key parameter of the current group according to the number of parameters of the registers; Calculate the number of crossovers in the first key parameter of the current group based on the crossover probability and the number of registers; Exchange the first key parameter of the current group with the register parameters of the crossover quantity in any other group of the first key parameters except the current group; The first key parameters of the current group after exchange, the first key parameters of any other group except the current group, and the remaining several groups of the first key parameters are used as several groups of third key parameters.

6. The method according to claim 5, characterized in that The processing of the plurality of groups of the third key parameters based on the preset mutation probability to obtain the plurality of groups of the second key parameters includes: Calculating a mutation number based on the mutation probability and the number of registers; Replacing the register parameter of the variation number in each group of the third key parameter with another random number in the value range of the key parameter corresponding to the register; The replaced groups of the third key parameters are used as the replaced groups of the second key parameters.

7. The method according to claim 1, characterized in that The method further comprises: Using the target key parameters as parameters of the processor, performing software verification on the processor to obtain a target software verification result; Using the target key parameters as parameters of the processor, performing prototype verification on the processor to obtain a target prototype verification result; Comparing the target software verification result with the target prototype verification result; If the target software verification result is inconsistent with the target prototype verification result, record the target key parameters; Obtaining operation log information generated during prototype verification and software verification of the processor; The target key parameter is associated with the operation log information and saved as verification test information of the processor.

8. A verification device based on genetic algorithm, characterized in that: The device comprises: An initial fitness calculation module, used to randomly select a number of groups of initial key parameters in a preset key parameter value range, and respectively calculate the fitness of each group of the initial key parameters in the processor verification process; A first quantity determination module, used to determine the first quantity according to a preset selection probability and the total number of groups of the initial key parameters; A first key parameter selection module is used to sort the groups of initial key parameters in ascending order based on the fitness, and use the first number of groups of initial key parameters with the smallest fitness as the groups of first key parameters; A second key parameter selection module, used for processing a plurality of groups of the first key parameters based on a preset crossover probability and a preset mutation probability to obtain a plurality of groups of second key parameters; A second fitness calculation module, used for respectively calculating the fitness of each group of the second key parameters in the processor verification process; A second quantity determination module, used to determine the second quantity according to a preset selection probability and the total number of groups of the second key parameter; a target key parameter selection module, used for sorting the plurality of groups of the second key parameters in ascending order based on the fitness, and taking the plurality of groups of the second key parameters of the second number with the smallest fitness as the plurality of groups of target key parameters; a loop module, configured to use the plurality of groups of target key parameters as the plurality of groups of initial key parameters, and re-execute the step of determining the first number according to the preset selection probability and the total number of groups of the initial key parameters, until the number of re-executions reaches a preset number of iterations or the fitness is consistent with a preset termination fitness; The coverage calculation module is used to calculate and output the processor verification coverage according to several groups of the target key parameters and the value ranges of the key parameters.

9. An electronic device, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the verification method based on a genetic algorithm as claimed in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the genetic algorithm-based verification method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Chip unknown state root cause determination method, electronic equipment, medium and program product

    CN120068751A

  • Method for Determining Root Cause of Unknown State of Chip, Electronic Device, Medium and Program Product

    CN120068751B

  • Chip parameter optimization method and device, medium and product

    CN120235100A

  • Chip parameter optimization method, device, medium and product

    CN120235100B