Debugging signal selection method based on genetic algorithm
By applying a debug signal selection method based on genetic algorithm in circuit design, the circuit gate-level netlist is analyzed and encoded, and a debug signal combination with high recovery rate is generated, which solves the problem of low recovery degree and slow operation speed in the prior art, and achieves fast and accurate debug signal selection.
Patent Information
- Application Number
- CN202411812271.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-18
AI Technical Summary
In the existing debug signal selection methods, the structure-based algorithm runs fast but the selected debug signal combination can be restored at a low level, while the debug signal combination selected based on the simulation algorithm can be restored at a high level but the running speed is slow, making it difficult to quickly and accurately select debug signal combinations with high recovery rates in large-scale circuits.
A method based on genetic algorithm is used to analyze the gate-level netlist of the target circuit, and a gene bank is formed by binary encoding of all registers, and the population is randomly initialized, and a new population is generated through the selection, crossover and mutation process until the stop condition is met. The gene combination of the individual with the highest recovery rate is selected as the debugging signal.
It realizes the rapid and accurate selection of debug signal combinations with high recovery rates in large-scale circuits, which not only improves the recovery degree of debug signal combinations, but also accelerates the calculation process and shortens the debugging time.
Smart Images

Figure CN119849392A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of integrated circuits, and in particular relates to a debugging signal selection method based on a genetic algorithm. Background Art
[0002] In the process of testing and verifying the circuit design, debuggers often use the high parallelism of large-scale FPGA hardware platforms to accelerate the test verification, so as to detect possible errors in the design as soon as possible. However, as the scale of circuit design becomes larger and larger, manually selecting signals may be a long and laborious process, requiring debuggers to have professional design knowledge, and in many cases, this knowledge may not be easy to obtain. For example, for IP blocks designed by third parties, or even for IPs designed by different internal teams, it is unlikely that only one expert can determine how to best build a global debugging solution. Therefore, if a valuable combination of debug signals can be selected before debugging, errors can be located more accurately and quickly, thereby reducing the number of iterations and shortening the iteration time.
[0003] Among the existing debugging signal selection methods, the algorithm based on structure runs fast, but the selected debugging signal combination has a low degree of recoverability, while the debugging signal combination selected based on simulation algorithm has a high degree of recoverability but runs slowly. For a circuit containing thousands of signals, debugging signal selection means selecting the debugging signal combination that can restore the entire circuit to as many states as possible under the constraint of a certain memory depth. Summary of the invention
[0004] In order to overcome the deficiencies in the prior art, the inventors have conducted intensive research and provided a debugging signal selection method based on a genetic algorithm. The method applies a genetic algorithm to a target circuit gate-level netlist to find a debugging signal combination with a high recovery rate, and uses the inherent parallelism of the genetic algorithm to accelerate the calculation process, thereby completing the selection of valuable debugging signals, improving debugging efficiency, and solving the problems of low recoverability and slow running speed of the selected debugging signal group in the existing debugging signal selection method.
[0005] The technical solution provided by the present invention is as follows:
[0006] In a first aspect, a debugging signal selection method based on a genetic algorithm comprises:
[0007] Parse the gate-level netlist of the target circuit, and encode all the registers in the netlist in binary order. The binary code of a register is used as a gene to form a gene library.
[0008] According to the number of debugging signals to be selected, the gene pool and the population size, the population is randomly initialized, and the recovery rate of each individual in the initialized population is determined;
[0009] Perform selection, crossover, and mutation processes on individuals in the initialized population to generate a new population;
[0010] Determine the recovery rate of each individual in the new population and determine whether the stopping condition is met;
[0011] If the stopping condition is met, the genome cooperation of the individual with the highest recovery rate is selected as the debugging signal to be selected. If the stopping condition is not met, the population is initialized and the individual selection, crossover, and mutation process in the population is repeated until the stopping condition is met.
[0012] In a second aspect, a debugging signal selection device based on a genetic algorithm comprises:
[0013] one or more processors;
[0014] a storage device for storing one or more programs,
[0015] When the one or more programs are executed by the one or more processors, the one or more processors implement the debugging signal selection method based on genetic algorithm described in the first aspect.
[0016] In a third aspect, a readable storage medium stores a computer program, which, when executed by a processor, implements the debugging signal selection method based on a genetic algorithm as described in the first aspect.
[0017] In a fourth aspect, a computer program product is provided, the computer program product comprising: a computer program (also referred to as code, or instruction), which, when executed, executes the debugging signal selection method based on genetic algorithm described in the first aspect.
[0018] A debugging signal selection method based on a genetic algorithm provided by the present invention has the following beneficial effects:
[0019] The present invention provides a debugging signal selection method based on a genetic algorithm. The method applies a genetic algorithm to a target circuit gate-level netlist to find a debugging signal combination with a high recovery rate, and uses the inherent parallelism of the genetic algorithm to accelerate the calculation process. Compared with the traditional debugging signal selection method, the method of the present invention has a short running time and a higher recovery rate of the debugging signal combination, thereby helping debuggers select valuable debugging signals and improving debugging efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flow chart of a debugging signal selection method based on genetic algorithm in the present invention;
[0021] Figure 2 It is the combinational logic recovery rule in the recovery rate calculation;
[0022] Figure 3 is the temporal logic recovery rule in the recovery rate calculation;
[0023] Figure 4 It is a schematic circuit for calculating the recovery rate. DETAILED DESCRIPTION
[0024] The following detailed description of the present invention will make the features and advantages of the present invention more clear and explicit.
[0025] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0026] The present invention provides a debugging signal selection method based on genetic algorithm, such as Figure 1 As shown, the following steps are included:
[0027] S1, parse the gate-level netlist of the target circuit, and binary encode all registers in the netlist in sequence, starting from 0 and increasing by 1 until all registers have been encoded. The binary code of a register is regarded as a gene, several genes constitute an individual, several individuals constitute a population, and all genes form a gene pool.
[0028] S2, randomly initialize the population according to the number of debugging signals to be selected, the gene pool and the population size, and determine the recovery rate of each individual in the initialized population.
[0029] The number of signals to be selected for debugging refers to the number of signals that the debugger wants to debug in this debugging; the population size refers to the number of individuals in the generated population.
[0030] The method for randomly initializing a population includes: randomly obtaining genes of the number of debugging signals to be selected in a gene library to form an individual, and generating individuals of the population size to form an initialization population.
[0031] After randomly selecting genes with the number of debugging signals to be selected from the gene library to form an individual, the method further includes: determining whether the same gene exists in each individual, and if the same gene exists, regenerating the individual.
[0032] The recovery rate is a quantitative indicator used to evaluate the quality of the selected debugging signal combination. The recovery rate calculation formula is as follows:
[0033]
[0034] The number of debug signals refers to the sum of the cycles of all debug signals observed, and the number of other signals recovered refers to the sum of the cycles of other signals that can be recovered by applying forward recovery and backward recovery processes to the debug signals.
[0035] There are two types of resources in the gate-level netlist, one is combinational logic resources, and the other is sequential logic resources. The recovery rate is calculated for these two types of resources through two processes: forward recovery and backward recovery. Figure 2 (a) shows the forward recovery process of the AND gate and the OR gate. For the AND gate, as long as one of the inputs is 0, the output can be inferred to be 0, and both inputs can be inferred to be 1. The same is true for the OR gate. As long as one of the inputs is 1, the output can be inferred to be 1, and both inputs can be inferred to be 0. The backward recovery process of the AND gate and the OR gate is shown in Figure 2 (b) shows that for an AND gate, when the output is 1, it can be inferred that both inputs are 1, and when the output is 0, when one input is 1, it can be inferred that the other input is 0. The backward recovery process of the OR gate is similar. Similarly, the forward and backward recovery processes are applicable to all combinational logic gate circuits (such as OR gates, NAND gates, XOR gates, etc.), and for sequential gate unit registers, the recovery process is also similar to combinational logic, such as Figure 3 As shown, in forward recovery, the restored output value is the value of the next cycle, while in backward recovery, the restored input value is the value of the previous cycle. For example, if the register input value is 0 in the second cycle, it can be inferred that the output value of the third cycle is 0. Similarly, if the register output value is 1 in the second cycle, it can be inferred that the input value of the first cycle is 1.
[0036] like Figure 4 A simple circuit is shown in Figure 1 to illustrate how the recovery rate is calculated. Assuming that only signal C is selected as the debugging signal, according to the circuit structure, if the value of C is 1, then the values of signal A and signal B in the previous cycle can be inferred. The value of signal D is the inverse of signal C, and the value of signal E needs to be determined by signal B and signal C. In Table 1, it is assumed that the values of signal C from 0 to 3 cycles are observed, and the inferred values of other signals are recorded in the table, and X indicates that their values cannot be inferred. It can be seen that the total number of other signals recovered is 10, and the number of debugging signals used is 4, so the recovery rate is (10+4) / 4=3.5.
[0037] Table 1 Signal recovery
[0038]
[0039] S3, select, crossover and mutate the individuals in the initialized population to generate a new population.
[0040] The selection process of individuals in the initialization population uses a roulette selection strategy, randomly selecting n times in the initialization population to form a selection population, where n is the population size of the initialization population, that is, the selection population is consistent with the population size of the initialization population.
[0041] The principle of the selection process is to determine the selection probability of each individual based on the ratio of its recovery rate to the total recovery rate of the population. The calculation formula is as follows:
[0042]
[0043] Among them, P(i) represents the selection probability of the i-th individual, f i represents the fitness value of the ith individual, and n is the population size. After obtaining the selection probability of each individual, the selection process is completed by repeating the selection n times in the population.
[0044] The crossover process of individuals in the initialization population includes: randomly selecting two individuals in the selection population as parent individuals; judging whether the parent individuals meet the crossover conditions, if so, the parent individuals randomly exchange a set number of genes to generate two new individuals, and replace the parent individuals with the two new individuals, if not, no exchange; repeating the above two steps n times to form a crossover population, where n is the population size of the initialization population.
[0045] The method for determining whether the parent individuals meet the crossover condition includes: randomly selecting two individuals as parent individuals in the selection population, randomly generating a random number between 0 and 1, and if the random number is less than the crossover probability, it is considered that the crossover condition is met; if the random number is greater than or equal to the crossover probability, it is considered that the crossover condition is not met. Among them, the crossover probability refers to the probability of gene crossover in an individual, which is a preset value.
[0046] After the parent individuals randomly exchange a set number of genes to generate two new individuals, the process also includes: determining whether there are identical genes in each new individual. If there are identical genes, the crossover is abandoned and the parent individuals are reselected to cross over and generate new individuals.
[0047] The mutation process of individuals in the initialization population includes: randomly selecting an individual in the crossover population; judging whether the individual meets the mutation conditions, if so, randomly selecting a gene in the individual, and then randomly selecting a bit in the gene to perform zero-one flipping to form a new individual, and replacing the individual before mutation with the new individual, if not satisfied, not mutating; finally, repeating the above two steps n times to form a new population, where n is the population size of the initialization population.
[0048] The method for determining whether the individual meets the mutation condition includes: randomly selecting an individual in the crossover population, randomly generating a random number between 0 and 1, and if the random number is less than the mutation probability, it is considered that the mutation condition is met; if the random number is greater than or equal to the mutation probability, it is considered that the mutation condition is not met. The mutation probability refers to the probability of a binary value change of a gene, which is a preset value.
[0049] After randomly selecting a bit in the gene to perform zero-one flipping to form a new individual, the process also includes: judging whether the new individual has the same gene. If the same gene exists, the mutation is abandoned and the individual mutation is reselected to generate a new individual.
[0050] After randomly selecting one bit in the gene to perform zero-one flipping to form a new individual, the method also includes: judging whether the new gene formed by the zero-one flipping belongs to the range of the gene library. If it exceeds the range of the gene library, the mutation is abandoned and the individual mutation is reselected to generate a new individual.
[0051] S4, determine the recovery rate of each individual in the new population and judge whether the stopping condition is met; if the stopping condition is met, select the genome cooperation of the individual with the highest recovery rate as the proposed selection debugging signal; if the stopping condition is not met, repeat the initialization population and the individual selection, crossover, and mutation process in the population until the stopping condition is met.
[0052] The recovery rate calculation method is the same as the recovery rate calculation method when initializing the population in step S2.
[0053] The stopping condition refers to the condition for stopping the iteration of the genetic algorithm. There are two stopping conditions to choose from. The first is to specify the number of iterations. When the algorithm reaches the specified number of iterations, the iteration stops. The second is to set the fitness threshold. When the fitness of an individual in the population reaches this threshold, the iteration stops.
[0054] The method of the present invention is compared with the simulation-based method and the fusion algorithm (which combines the structure-based algorithm and the simulation-based algorithm): the CPU is Intel i9-10900K (3.7Ghz) and the memory is 128GB; the three circuits s5378, s15850 and s38417 in the ISCAS'89 test set are used to verify the effectiveness of the signal recommendation algorithm based on the genetic algorithm. The number of debugging signals to be selected is 8, 16 and 32 respectively, and the storage depth is set to 4096 when calculating the recovery rate; for circuits s5378 and s15850, the population size is set to 100, the crossover probability is 0.6, the mutation probability is 0.001, and the stop condition is selected to specify the number of iterations. The number of iterations is 100. For circuit s38417, the population size is set to 200, the number of iterations is increased to 150, and other parameters remain unchanged.
[0055] The recovery rate values of the three signal recommendation algorithms are shown in Table 2, where bold indicates the algorithm with the highest recovery rate among all algorithms, and N / A indicates that the algorithm failed to run within 24 hours. It can be seen that for small circuits (s5378), the method of the present invention is slightly better than the other two algorithms; for medium and large circuits (s15850, s38417), the method of the present invention is much better than the other two algorithms.
[0056] The running time of the three signal recommendation algorithms is shown in Table 3, where the bold indicates the algorithm with the shortest running time among all algorithms, and the data format is "hours: minutes: seconds". It can be seen that for all circuits, the running time of the method of the present invention is significantly shorter than that of the simulation-based method; for small and medium-sized circuits (s15850, s5378), the running time of the method of the present invention is close to or shorter than that of the fusion algorithm; for large circuits (s38417), the running time of the method of the present invention is longer than that of the fusion algorithm. The reason is that the solution space of large circuits is much larger than that of small and medium-sized circuits. In order to ensure that the genetic algorithm does not converge to the local optimal solution prematurely, the method of the present invention increases the population size and the number of iterations, which also increases the running time of the algorithm.
[0057] Through the analysis of the recovery rate and running time of the three signal recommendation algorithms, it can be concluded that the debugging signal combination recommended by the genetic algorithm can provide the maximum signal observability within an acceptable running time range.
[0058] Table 2 Comparison of recovery rates of different algorithms
[0059]
[0060]
[0061] Table 3 Comparison of running time of different algorithms
[0062]
[0063] The present invention also provides a debugging signal selection device based on a genetic algorithm, comprising:
[0064] one or more processors;
[0065] a storage device for storing one or more programs,
[0066] When the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned debugging signal selection method based on genetic algorithm.
[0067] The present invention also provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned debugging signal selection method based on the genetic algorithm is implemented.
[0068] The readable storage medium includes, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0069] The present invention also provides a computer program product, which includes: a computer program (also referred to as code or instruction), and when the computer program is run, the above-mentioned debugging signal selection method based on genetic algorithm is executed.
[0070] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, microwave, etc.) mode to another website site, computer, server or data center.
[0071] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0072] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and products can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0073] The present invention has been described in detail above in conjunction with specific implementations and exemplary examples, but these descriptions cannot be understood as limiting the present invention. Those skilled in the art understand that, without departing from the spirit and scope of the present invention, a variety of equivalent substitutions, modifications or improvements may be made to the technical solution of the present invention and its implementation methods, all of which fall within the scope of the present invention. The scope of protection of the present invention shall be subject to the attached claims.
[0074] The contents not described in detail in the specification of the present invention belong to the common knowledge of those skilled in the art.
Claims
1. A debugging signal selection method based on genetic algorithm, characterized in that: include: Parse the gate-level netlist of the target circuit, and encode all the registers in the netlist in binary order. The binary code of a register is used as a gene to form a gene library. According to the number of debugging signals to be selected, the gene pool and the population size, the population is randomly initialized, and the recovery rate of each individual in the initialized population is determined; Perform selection, crossover, and mutation processes on individuals in the initialized population to generate a new population; Determine the recovery rate of each individual in the new population and determine whether the stopping condition is met; If the stopping condition is met, the genome cooperation of the individual with the highest recovery rate is selected as the debugging signal to be selected. If the stopping condition is not met, the population is initialized and the individual selection, crossover, and mutation process in the population is repeated until the stopping condition is met.
2. The debugging signal selection method based on genetic algorithm according to claim 1, characterized in that: The step of randomly initializing the population includes: randomly obtaining genes of the number of debugging signals to be selected in the gene library to form an individual, and generating individuals of the population size to form the initialization population.
3. The debugging signal selection method based on genetic algorithm according to claim 1, characterized in that: The step of performing selection, crossover and mutation on individuals in the initialization population to generate a new population, wherein the selection process uses a roulette wheel selection strategy to randomly select n times in the initialization population to form a selection population, where n is the population size of the initialization population.
4. The debugging signal selection method based on genetic algorithm according to claim 3 is characterized in that: The step of performing selection, crossover and mutation on individuals in the initialization population to generate a new population, wherein the crossover process includes: randomly selecting two individuals in the selection population as parent individuals; judging whether the parent individuals meet the crossover condition, if so, the parent individuals randomly exchange a set number of genes to generate two new individuals, and replace the parent individuals with the two new individuals, if not, no exchange; repeating the above two steps n times to form a crossover population, where n is the population size of the initialization population.
5. The debugging signal selection method based on genetic algorithm according to claim 4 is characterized in that: The method for determining whether the parent individuals meet the crossover condition includes: after randomly selecting two individuals as parent individuals in the selection population, randomly generating a random number between 0 and 1; if the random number is less than the crossover probability, it is considered that the crossover condition is met; if the random number is greater than or equal to the crossover probability, it is considered that the crossover condition is not met; the crossover probability refers to the probability of genetic crossover occurring in an individual, which is a preset value.
6. The debugging signal selection method based on genetic algorithm according to claim 4 is characterized in that: After the parent individuals randomly exchange a set number of genes to generate two new individuals, the method further includes: determining whether there are identical genes in each new individual; if there are identical genes, abandoning the crossover and reselecting the parent individuals to crossover and generate new individuals.
7. The debugging signal selection method based on genetic algorithm according to claim 4, characterized in that: The step of performing selection, crossover and mutation on individuals in the initialization population to generate a new population, wherein the mutation process includes: randomly selecting an individual in the crossover population; determining whether the individual meets the mutation condition, if so, randomly selecting a gene in the individual, and then randomly selecting a bit in the gene for zero-one flipping to form a new individual, and replacing the individual before the mutation with the new individual, and if not, not mutating; and finally repeating the above two steps n times to form a new population, where n is the population size of the initialization population.
8. The debugging signal selection method based on genetic algorithm according to claim 7, characterized in that: The method for determining whether the individual meets the mutation condition includes: randomly selecting an individual in the crossover population, randomly generating a random number between 0 and 1, if the random number is less than the mutation probability, it is considered that the mutation condition is met; if the random number is greater than or equal to the mutation probability, it is considered that the mutation condition is not met; the mutation probability refers to the probability of a binary value change of a gene, which is a preset value.
9. The debugging signal selection method based on genetic algorithm according to claim 7, characterized in that: After randomly selecting a bit in the gene to perform zero-one flipping to form a new individual, the process also includes: judging whether the new individual has the same gene. If the same gene exists, the mutation is abandoned and the individual mutation is reselected to generate a new individual.
10. The debugging signal selection method based on genetic algorithm according to claim 7, characterized in that: After randomly selecting one bit in the gene to perform zero-one flipping to form a new individual, the method also includes: judging whether the new gene formed by the zero-one flipping belongs to the range of the gene library. If it exceeds the range of the gene library, the mutation is abandoned and the individual mutation is reselected to generate a new individual.
11. The debugging signal selection method based on genetic algorithm according to claim 1, characterized in that: There are two types of stopping conditions. The first is to specify the number of iterations. When the number of iterations of initializing the population and the individual selection, crossover, and mutation processes in the population reaches the specified number of iterations, the iteration is stopped. The second is to set a recovery rate threshold. When the recovery rate of an individual in the new population reaches the recovery rate threshold, the iteration is stopped.
12. A computer program product, characterized in that The computer program product comprises: a computer program, which, when being executed, executes the debugging signal selection method based on genetic algorithm according to any one of claims 1 to 11.