Chip testing method and electronic equipment
The particle swarm optimization algorithm is used to iteratively update the test vector in chip testing, which solves the problem of slow convergence of functional coverage in complex chip functional tests, and achieves more efficient testing and better functional coverage.
Patent Information
- Application Number
- CN202510373150.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-06-13
AI Technical Summary
When faced with complex chip functions, the functional coverage convergence rate is slow or unable to converge, resulting in a long test time and it is difficult to achieve higher coverage.
Using particle swarm optimization algorithm, multiple test vectors are randomly generated, each test vector represents one particle in the particle swarm, and the particle position is updated by iteratively until the functional coverage reaches or exceeds the target coverage.
Improve the efficiency of chip function testing, ensure the meeting of the functional and performance requirements of chip design, and avoid the need for manual writing of targeted test cases.
Smart Images

Figure CN120145955A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and in particular, to a chip testing method and an electronic device. Background Art
[0002] In the process of verifying the functions of a chip, a target coverage rate is first defined, and then an automated tool is used to generate test cases. When the test cases are executed, a coverage rate tool will record the coverage rate indicators of each test case in real time, and analyze the breadth and depth of the test through the coverage rate indicators. By continuously monitoring the coverage rate results, chip functions that have not been fully tested can be identified, so that the test cases can be adjusted accordingly to ensure that the chip design meets the predetermined function and performance requirements. Summary of the Invention
[0003] In view of this, the present disclosure provides a chip testing method and an electronic device.
[0004] One aspect of the present disclosure provides a chip testing method, including: randomly generating a plurality of test vectors, each test vector representing a particle in a particle swarm, and the coordinate values of each test vector being used to represent the position of each particle in the particle swarm; and using each particle in the particle swarm to test a chip to be tested to obtain a test result; wherein, using each particle in the particle swarm to test the chip to be tested to obtain a test result includes repeatedly performing the following operations until the function coverage rate of the particle swarm is greater than or equal to a target function coverage rate: inputting the coordinate values of each particle into the chip to be tested to obtain a test result; determining the function coverage rate of the particle swarm according to the test result; in the case where the function coverage rate of the particle swarm is less than the target function coverage rate, determining the updated position of each particle in the particle swarm according to the fitness of each particle in the particle swarm, and using the updated position as the coordinate value of each particle, and the fitness represents the weight of the function points covered by each particle relative to all the function points of the chip.
[0005] According to an embodiment of the present disclosure, determining the function coverage rate of the particle swarm according to the test result includes: determining the function points covered by each particle according to the test result of each particle in the particle swarm; and determining the ratio of the number of function points covered by all the particles in the particle swarm to the number of all the function points of the chip to be tested as the function coverage rate of the particle swarm.
[0006] According to an embodiment of the present disclosure, determining the updated position of each particle in the particle swarm according to the fitness of each particle in the particle swarm includes: determining the individual historical optimal point of each particle and the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm; and determining the updated position of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor.
[0007] According to an embodiment of the present disclosure, determining the individual historical optimal point of each particle and the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm includes: for each particle in the particle swarm, screening out the position corresponding to the maximum fitness from the set of historical positions of the particle as the individual historical optimal point of the particle, where the set of historical positions is a set composed of the coordinate values corresponding to the positions of the particle in each iteration process; screening out the position corresponding to the maximum fitness from the set of historical positions of all particles in the particle swarm as the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm.
[0008] According to an embodiment of the present disclosure, determining the updated position of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor includes: calculating the moving distance of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor; determining the updated position of each particle in the particle swarm according to the moving distance of each particle in the particle swarm and the current position of each particle.
[0009] According to an embodiment of the present disclosure, calculating the moving distance of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor includes: calculating the moving distance of each particle in the particle swarm based on the following formula:
[0010]
[0011] where, is the moving distance of the i-th particle moving from the position at time t - 1 to the position at time t, is the moving distance of the i-th particle moving from the position at time t to the position at time t + 1, represents the inertia weight, and are the acceleration factors, and are random numbers, is the individual historical optimal point of the i-th particle at time t, is the global historical optimal point of the particle swarm at time t, is the position of the i-th particle at time t.
[0012] According to an embodiment of the present disclosure, determining the updated position of each particle in the particle swarm according to the moving distance of each particle in the particle swarm and the current position of each particle includes:
[0013] Determining the updated position of each particle in the particle swarm based on the following formula:
[0014]
[0015] in, is the position of the ith particle at time t+1.
[0016] According to an embodiment of the present disclosure, the method further includes: determining the fitness of each particle based on the following formula:
[0017]
[0018] Among them, the chip has a total of N functional points to be tested. Indicates whether the test result of the kth particle covers the nth function point. If the test result of the kth particle covers the nth function point, , when the test result of the kth particle does not cover the nth function point, , Indicates the weight of the nth function point relative to all the function points to be tested on the chip, is the fitness of the kth particle.
[0019] According to an embodiment of the present disclosure, the method further includes: for each particle in the particle group, the inertia weight of the particle is determined based on the following formula:
[0020]
[0021] in, is the inertia weight of the ith particle, and are the preset lower and upper limits of the inertia weight. is the fitness of the ith particle, is the maximum fitness of all particles in the particle swarm, is the average fitness of all particles in the particle swarm.
[0022] According to an embodiment of the present disclosure, the method also includes: when the concentration of all particles in the particle swarm is greater than a preset threshold, for each particle in the particle swarm, determining the mutation probability of the particle according to the crowding distance of the particle, the crowding distance being the distance between two other particles closest to the particle in the particle swarm, and the concentration being determined based on the distance between the particle and other particles in the particle swarm; according to the mutation probability of each particle in the particle swarm, selecting a particle that needs to mutate, and randomly generating an update position of the particle that needs to mutate.
[0023] Another aspect of the present disclosure also provides an electronic device, comprising:
[0024] one or more processors;
[0025] a storage device for storing one or more programs,
[0026] Wherein, when one or more programs are executed by one or more processors, the one or more processors are caused to execute the method according to the above embodiments.
[0027] The third aspect of the present disclosure further provides a computer-readable storage medium, on which executable instructions are stored, and when the instructions are executed by a processor, the processor is caused to execute the method according to the above embodiments.
[0028] The fourth aspect of the present disclosure further provides a computer program product, including a computer program, the computer program being stored on at least one of a readable storage medium and an electronic device, and when the computer program is executed by a processor, the method according to the above embodiments is implemented.
[0029] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. Description of the Drawings
[0030] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above and other objects, features, and advantages of the present disclosure will become clearer. In the drawings:
[0031] Figure 1 Schematically shows an application scenario diagram of a chip testing method according to an embodiment of the present disclosure;
[0032] Figure 2 Schematically shows a flowchart of a chip testing method according to an embodiment of the present disclosure;
[0033] Figure 3 Schematically shows an iterative update flowchart of a chip testing method according to an embodiment of the present disclosure;
[0034] Figure 4 Schematically shows a schematic diagram of a chip testing method according to an embodiment of the present disclosure;
[0035] Figure 5 Schematically shows a flowchart of a particle mutation method of a chip testing method according to an embodiment of the present disclosure;
[0036] Figure 6 Schematically shows a block diagram of an electronic device suitable for implementing a chip testing method according to an embodiment of the present disclosure. Detailed Embodiments
[0037] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted in the following description for clarity and conciseness.
[0038] In the technical solution of the present disclosure, the processing of the data involved (such as including but not limited to user personal information) in aspects of collection, storage, use, processing, transmission, provision, disclosure, and application complies with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and it does not violate public order and good customs.
[0039] As the scale of chip design continues to expand, chip verification tasks become increasingly complex and difficult. To ensure the correctness and reliability of chip design, coverage has become an important indicator to measure the quality of verification. During the process of verifying chip functions, first define the target coverage, and then use automated tools to generate test cases. When executing the test cases, the coverage tool will record various coverage indicators of the test cases in real time, and analyze the breadth and depth of the test through the coverage indicators. By continuously monitoring the coverage results, chip functions that have not been fully tested can be identified, so that the test cases can be adjusted accordingly to ensure that the chip design meets the predetermined function and performance requirements. Coverage includes code coverage, functional coverage, assertion coverage, etc. Among them, it is relatively common to use functional coverage as the test basis. By analyzing the functional coverage, it can be understood which parts of the design have been tested and which parts need further attention.
[0040] In the related art, a coverage-driven verification method emerged. This method starts with formulating a detailed verification plan, and clarifies the target coverage based on the chip design specification. Subsequently, automated tools are used to generate test vectors, the test vectors are input into the chip for testing the chip functions, and the coverage is monitored in real time during the testing process. The functional coverage can be obtained by analyzing the test results. If the functional coverage does not reach the target coverage, the test cases and test vectors are adjusted and supplemented according to the obtained functional coverage, and then the adjusted test cases and test vectors are used for chip testing, and the iteration continues until the functional coverage in the test results is greater than or equal to the target coverage, ensuring that all important functions and application scenarios of the chip are fully verified.
[0041] However, the above verification method has the following problems:
[0042] (1) As the complexity of chip functions gradually increases, relying solely on randomly generated test vectors to test the chip, the convergence rate of the chip's functional coverage is very slow or the functional coverage cannot converge, resulting in a relatively long time consumption for the entire process of chip testing and chip simulation.
[0043] (2) At the end of each test, if the functional coverage does not reach the target coverage, a large number of directed test cases need to be written according to the gap between the functional coverage and the target coverage. Manually writing test cases is time-consuming and has a poor test effect, and it also makes the upper limit of the functional coverage only reach the target coverage and unable to approach a higher coverage.
[0044] Figure 1 Schematically shows an application scenario diagram of a chip testing method according to an embodiment of the present disclosure.
[0045] As Figure 1 shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0046] Users can use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication systems and client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as, for example, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0047] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0048] The server 105 may be a server providing various services, such as a background management server (only for example) that supports the websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process data such as user requests received, and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0049] It should be noted that the chip testing method provided by the embodiments of the present disclosure can generally be executed by the server 105. Correspondingly, the chip testing device provided by the embodiments of the present disclosure can generally be disposed in the server 105. The chip testing method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Correspondingly, the chip testing device provided by the embodiments of the present disclosure can also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.
[0050] It should be understood that Figure 1 the numbers of the terminal devices, networks, and servers in
[0051] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 1 Based on the Figures 2 to 6 scenario described below, a chip testing method of the disclosed embodiments will be described in detail through
[0052] Figure 2 FIG. schematically shows a flowchart of a chip testing method according to an embodiment of the present disclosure. As Figure 2 shown, a chip testing method of an embodiment of the present disclosure includes operation S21 to operation S22.
[0053] Operation S21: Randomly generate a plurality of test vectors.
[0054] Among them, each test vector represents a particle in the particle swarm, and the coordinate values of each test vector are used to represent the position of each particle in the particle swarm. In the particle swarm optimization algorithm, the particle swarm is a set of candidate solutions, and each particle represents a possible solution in the problem space. Each particle, as an element in the particle swarm, has a position and a velocity. The position of each particle corresponds to a solution in the problem space, and the velocity of each particle determines the movement of the particle in the search space. The coordinate values of each particle are used to describe the position of the particle in the search space, that is, the space where the particle swarm is located.
[0055] When applying the particle swarm optimization algorithm to the chip testing method, a particle swarm is initialized, that is, multiple test vectors are randomly generated. The coordinate values of each test vector are a set of randomly generated input signals, which are used to be input into the chip under test during the testing process to obtain the chip response. The multiple test vectors are regarded as a particle swarm, each test vector represents a particle in the particle swarm, and the coordinate values of each test vector are used to represent the position of each particle in the particle swarm. The position of each particle is represented by a set of randomly generated coordinate values. These coordinate values can be binary numbers, decimal numbers or other formats, depending on the input requirements of the chip under test, that is, each particle corresponds to a set of input signals of the chip.
[0056] The problem space of the particle swarm is the test vector space. The coordinate values of each test vector are the coordinate values of each particle in the test vector space. The velocity of each particle corresponds to the change amount of the coordinate values of each test vector in each iteration process.
[0057] Operation S22: Use each particle in the particle swarm to test the chip under test to obtain the test result.
[0058] Input the coordinate values of each particle in the particle swarm into the chip under test for testing. Specifically, refer to Figure 3 . Figure 3 Schematically shows an iterative update flowchart of a chip testing method according to an embodiment of the present disclosure. As Figure 3 shown, operation S22 includes repeatedly performing the following operations until the functional coverage rate of the particle swarm is greater than or equal to the target functional coverage rate:
[0059] Operation S221: Input the coordinate values of each particle into the chip under test to obtain the test result.
[0060] Input the coordinate values of each particle as input signals into the chip under test in sequence, and test each function of the chip under test according to the test cases. According to the response of the chip under test, the test result can be obtained. The test result includes the functional coverage rate of each particle. Optionally, the coordinate values of each particle in the particle swarm can also be input into multiple chips under test in parallel to obtain the functional coverage rates of each particle respectively. The functional coverage rate of each particle is used to measure the coverage degree of each test vector for the functional points of the chip under test.
[0061] Operation S222: Determine the functional coverage rate of the particle swarm according to the test result.
[0062] According to the test results of each particle in the particle swarm, the functional coverage rate of each particle or the functional points covered by each particle can be obtained. According to the functional coverage rate of each particle or the functional points covered by each particle, the overall corresponding functional coverage rate of the particle swarm can be determined.
[0063] Exemplarily, reference may be made to Figure 4 . Figure 4 FIG. schematically shows a schematic diagram of a chip testing method according to an embodiment of the present disclosure. As Figure 4 shown, the data frames at the receiving end of the Ethernet MAC module are encoded. Each data frame includes: a destination MAC address of 6 bytes, a source MAC address of 6 bytes, a tag protocol identifier of 2 bytes, a tag control information of 2 bytes, a type or length of 2 bytes, and an exception flag bit. Each data frame is a total of 19 dimensions, and each dimension is 8 bits. Each data frame is used as a particle in the particle swarm. The data of each dimension of a data frame is used as the position coordinate information of each particle. As Figure 4 shown, data frame 1 corresponds to particle 1, data frame 2 is used as particle 2, and so on, and data frame n is used as particle n. Each data frame is sequentially input into the Ethernet MAC module to be tested for testing, and a function coverage file corresponding to each data frame can be obtained. As Figure 4 shown, data frame 1 is input into the Ethernet MAC module to be tested for testing, and coverage file 1 is obtained. Data frame 2 is input into the Ethernet MAC module to be tested for testing, and coverage file 2 is obtained, and so on. Data frame n is input into the Ethernet MAC module to be tested for testing, and coverage file n is obtained. By analyzing each coverage file, the function coverage corresponding to the entire particle swarm can be obtained.
[0064] Operation S223: In the case where the function coverage of the particle swarm is less than the target function coverage, determine the updated position of each particle in the particle swarm according to the fitness of each particle in the particle swarm, and use the updated position as the coordinate value of each particle.
[0065] Among them, the target function coverage may be a preset function coverage that needs to be achieved in the test result. When the function coverage of the particle swarm reaches or exceeds the target function coverage, it means that the function test of the chip to be tested is sufficiently sufficient, and the function points to be tested of the chip to be tested have been tested. The fitness is used to characterize the weight of the function points covered by each particle relative to all the function points of the chip to be tested, that is, the importance of the function points covered by each particle. The fitness is used to evaluate the quality of each particle.
[0066] For each particle in the particle swarm, use its coordinate value as a test input and apply it to the chip to be tested, and record the output response of the chip.
[0067] When the functional coverage rate of the particle swarm is less than the target functional coverage rate, determine the updated position of each particle in the particle swarm according to the fitness of each particle in the particle swarm, and use the updated position as the coordinate value of each particle and continue to input it into the chip under test. Repeat the operations from S221 to S223 until the functional coverage rate of the particle swarm is greater than or equal to the target functional coverage rate.
[0068] According to the chip testing method provided in the above embodiment, multiple test vectors are randomly generated, and the chip is tested based on the particle swarm algorithm. Through the above iterative process, the position of each particle in the particle swarm will be gradually optimized, and the position of each particle will automatically approach the position that can cover more functional points and more important functional points. After each iteration, there is no need to manually write directed test cases, and there is no need to repeat randomly generating new test vectors, which can effectively improve the chip verification efficiency and ensure the correctness and reliability of the chip functional design.
[0069] In Figure 2 Based on the embodiment shown, in some embodiments, determining the functional coverage rate of the particle swarm according to the test results includes: determining the functional points covered by each particle according to the test results of each particle in the particle swarm; determining the ratio of the number of functional points covered by all particles in the particle swarm to the number of all functional points of the chip as the functional coverage rate of the particle swarm.
[0070] Take the output response of the chip under test as the test result. A coverage analysis tool can be used to evaluate the test result and count the functional points covered by each test vector. To determine whether a functional point is triggered by a test vector, it is necessary to compare the test results of each particle with all the functional points to be tested of the chip under test to check whether the expected response result is generated. Determine the ratio of the number of functional points covered by all particles in the particle swarm to the number of all functional points to be tested of the chip under test as the functional coverage rate of the particle swarm.
[0071] For example: A counter can be initialized to record the total number of functional points covered by the particle swarm. Specifically, each particle in the particle swarm can be traversed, its test results can be analyzed, and the number of covered functional points can be added to the counter. Obtain the number of all functional points to be tested of the chip under test, and calculate the ratio of the number of functional points covered by all particles in the particle swarm to the number of all functional points to be tested of the chip under test.
[0072] According to the method provided in the above embodiment, it is possible to clarify which functional points are not covered according to the functional coverage rate of the particle swarm, so that the position of each particle in the particle swarm in the next iteration approaches the position where the test results cover the uncovered functional points.
[0073] In Figure 2Based on the illustrated embodiments, in some embodiments, determining the updated position of each particle in the particle swarm according to the fitness of each particle in the particle swarm includes: determining the individual historical optimal point of each particle and the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm; determining the updated position of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor.
[0074] Among them, the fitness is used as an index to evaluate the quality of particles, and is used to characterize the quantity and quality of function points covered by each particle, that is, the contribution degree of the function coverage rate of each particle to the function coverage rate of the entire particle swarm. The higher the fitness, the more function points the test vector represented by the particle can cover and the more effective the covered function points are. The individual historical optimal point is used to characterize the best position encountered by each particle during the search process, and this position corresponds to the highest fitness achieved by the particle in the historical iteration times. The global historical optimal point is used to characterize the best position of the particles encountered by the entire particle swarm during the search process, and this position corresponds to the highest fitness achieved by all particles in the historical iteration times.
[0075] The inertia weight is used to characterize the tendency of each particle to maintain the current moving speed, that is, the parameter that affects the subsequent moving speed of the current moving speed of the particle, and helps to balance the global search and the local search. The acceleration factor is used to adjust the moving speed of the particle moving towards the individual historical optimal point and the global historical optimal point. According to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor, the updated position of each particle in the particle swarm can be determined, and the updated position of each particle is used for the next iteration.
[0076] Based on the above embodiments, in some embodiments, determining the individual historical optimal point of each particle and the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm includes: for each particle in the particle swarm, screening out the position corresponding to the maximum fitness from the historical position set of the particle as the individual historical optimal point of the particle, and the historical position set is a set composed of the coordinate values corresponding to the positions of the particle in each iteration process; screening out the position corresponding to the maximum fitness from the historical position sets of all particles in the particle swarm as the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm.
[0077] Among them, the historical position set is used to record the position coordinate values of each particle in each iteration process, and is used to track the moving path of the particle. A historical position set is maintained for each particle, and this set is updated after each iteration.
[0078] For example: From the set of historical positions of the particles, the position corresponding to the maximum fitness is selected as the individual historical optimal point of the particle. From the set of historical positions of all particles in the particle swarm, the position corresponding to the maximum fitness is selected as the global historical optimal point of the particle swarm. After each iteration ends, the current position coordinate values of each particle are added to the set of historical positions. The current fitness of each particle can be evaluated. If the current fitness of a particle is higher than the fitness corresponding to its individual historical optimal point, then the individual historical optimal point of the particle is updated to the current position. After each iteration ends, among the individual historical optimal points of all particles in the particle swarm, the point with the highest fitness is found and used as the global historical optimal point.
[0079] According to the method provided in the above embodiments, the particle swarm optimization algorithm can record and utilize the search history of the particles, thereby guiding the particles to move towards a better solution. The individual historical optimal point helps each particle remember the best position in its search process, while the global historical optimal point provides the search direction for the entire particle swarm. This mechanism ensures that the particle swarm algorithm can effectively explore the search space and gradually converge to the optimal or near-optimal solution. Considering both the inertia of the particles (inertia weight) and the ability to follow the optimal solution (acceleration factor) helps to achieve more efficient test vector generation.
[0080] Based on the above embodiments, in some embodiments, according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor, the updated position of each particle in the particle swarm is determined, including: calculating the moving distance of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor; determining the updated position of each particle in the particle swarm according to the moving distance of each particle in the particle swarm and the current position of each particle.
[0081] Among them, calculating the moving distance of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight, and the acceleration factor, the moving distance of each particle in the particle swarm can be calculated based on the following formula:
[0082]
[0083] Among them, is the moving distance of the i-th particle from the position at time t - 1 to the position at time t, is the moving distance of the i-th particle from the position at time t to the position at time t + 1, represents the inertia weight, and are the acceleration factors, and are random numbers, is the individual historical optimal point of the ith particle at time t, is the global historical optimal point of the particle swarm at time t, is the position of the ith particle at time t, where time corresponds to a specific number of iterations, for example, time t is the tth iteration.
[0084] According to the moving distance of each particle in the particle swarm and the current position of each particle, the updated position of each particle in the particle swarm is determined. The updated position of each particle in the particle swarm can be determined based on the following formula:
[0085]
[0086] in, is the position of the ith particle at time t+1.
[0087] In some embodiments, the method may further include: determining the fitness of each particle based on the following formula:
[0088]
[0089] Among them, the chip has N functional points to be tested. Indicates whether the test result of the kth particle covers the nth function point. If the test result of the kth particle covers the nth function point, , when the test result of the kth particle does not cover the nth function point, , Indicates the weight of the nth function point relative to all the function points to be tested on the chip, is the fitness of the kth particle.
[0090] By calculating fitness according to the method provided in the above embodiment, the position of each particle can be inclined to move the position of the functional point with a high coverage weight.
[0091] In the actual chip testing process, if the test method provided by the embodiment is used directly, the particle swarm will fall into a local solution, the diversity of particles will be missing, and other problems will occur, resulting in poor chip verification effect, slow convergence of functional coverage or failure to converge to the target functional coverage. As the number of iterations increases, the individual historical optimal point or the global historical optimal point of the particle swarm will change. In the subsequent process, the optimal solution of the searched particle swarm may not be near the initial individual historical optimal point or the global historical optimal point. If the test vector generated by initialization covers a considerable number of coverage points, the fitness of the test vector generated by initialization will be very large, resulting in the phenomenon of "false optimal solution".
[0092] To this end, in some embodiments, it may further include: for each particle in the particle swarm, the inertia weight of the particle is determined based on the following formula:
[0093]
[0094] Wherein, is the inertia weight of the i-th particle, and are the lower limit value and the upper limit value of the preset inertia weight, is the fitness of the i-th particle, is the maximum value of the fitness of all particles in the particle swarm, is the average value of the fitness of all particles in the particle swarm.
[0095] Calculating the inertia weight of each particle according to the above formula can make the particles with fitness below the average fitness of the particle swarm have a higher inertia weight and stronger exploration ability, that is, the particles that contribute little to the functional coverage rate of the particle swarm can move to a wider area to improve the functional coverage rate. The inertia weight of the particles with fitness above the average fitness of the particle swarm is determined according to the fitness difference from the particle with the highest fitness, that is, the particles that contribute greatly to the functional coverage rate of the particle swarm continue to move in the current moving direction.
[0096] In some embodiments, it may further include: when the concentration of all particles in the particle swarm is greater than a preset threshold, for each particle in the particle swarm, the mutation probability of the particle is determined according to the crowding distance of the particle; according to the mutation probability of each particle in the particle swarm, the particles that need to mutate are selected, and the updated positions of the particles that need to mutate are randomly generated.
[0097] Among them, the concentration is used to describe the degree of closeness of the particle distribution in the particle swarm. The higher the concentration, the closer the particles in the particle swarm are to each other. If the concentration exceeds the preset threshold, that is, the particles all hover around a certain solution, and the phenomenon of local optimal solution appears, the diversity of the particles is missing, resulting in the inability to explore a wide solution space. At this time, it is necessary to change the positions of the particles in the particle swarm. The concentration is determined based on the distance between the particle and other particles in the particle swarm. For example, the average distance between each particle in the particle swarm and all other particles is calculated, and this average distance is determined as the concentration.
[0098] The crowding distance is the distance between the two other particles closest to the particle in the particle swarm. The crowding distance is used to evaluate the local density of the position where the particle is located. The crowding distance can be calculated based on the following formula:
[0099]
[0100] Wherein, is the coordinate value of the i-th particle, is the crowding distance of the i-th particle. and are the coordinate values of the two particles closest to the i-th particle. is the distance between the j-th particle and the k-th particle.
[0101] The mutation probability is the probability that a particle mutates, that is, randomly changes its position. Mutation helps to increase the diversity of the particle swarm and prevent the particle swarm algorithm from falling into a local optimum. The mutation probability of a particle is determined according to its crowding distance. The smaller the crowding distance, the higher the mutation probability.
[0102] For example: for each particle, find the two particles closest to it and calculate the distance between these two particles, which is the crowding distance. Use a random number generator to generate a random number. If the generated random number is less than the mutation probability of the particle, then select this particle for mutation. For the selected particle, randomly generate a new position near its current position. This new position can be randomly selected within the entire search space or restricted to a specific neighborhood.
[0103] Exemplarily, reference can be made to Figure 5 . Figure 5 is a particle mutation method for a chip testing method provided by an embodiment of the present disclosure. As Figure 5 shown, the particle mutation method includes the following operations:
[0104] Operation S501: Input the coordinate values of each particle in the particle swarm into the chip to be tested to obtain the functional coverage rate of the particle swarm.
[0105] Operation S502: Determine whether the functional coverage rate of the particle swarm is less than the target coverage rate. If so, execute Operation S503; if not, end the process.
[0106] Operation S503: After the end of the last M iterations, determine whether the global historical optimal point is updated. If so, execute Operation S504; if not, execute Operations S506 to S507.
[0107] Operation S504: Determine whether the concentration degree of all particles in the particle swarm is greater than a preset threshold. If so, execute Operation S507; if not, execute Operation S505.
[0108] Operation S505: Determine the updated position of each particle according to the fitness of each particle. After executing Operation S505, continue to execute Operation S501.
[0109] Operation S506: Forget the global historical optimal point.
[0110] Operation S507: Select the particles that need to mutate according to the mutation probability of each particle, and randomly generate the updated positions of the particles that need to mutate.
[0111] For example: Determine whether the globally optimal historical point has not been updated in the previous M iterations before the current iteration. If not, forget this globally optimal historical point and mutate the particles. At the next iteration, re-determine the globally optimal historical point. Among them, M can be set as a random number first, and during the subsequent iterations, it can be set according to the specific test results. After each iteration ends, calculate the concentration degree of the particle swarm. If the concentration degree exceeds the preset threshold, then for each particle, calculate its crowding distance. Determine the mutation probability of each particle according to the crowding distance. For each particle in the particle swarm, generate a random number and compare it with the mutation probability of this particle to decide whether to mutate. For the particles that need to mutate, randomly generate a new position and update the position of this particle. Continue to execute the iterative process of the particle swarm optimization algorithm.
[0112] According to the method provided in the above embodiments, when the globally optimal historical point has not been updated after more than n iterations, forget this globally optimal historical point, which can effectively solve the false optimal solutions that occur due to the rapid increase in functional coverage rate in the initial and middle stages of testing, and encourage the particles to find the optimal solutions for the uncovered points in the remaining space. When the particle swarm converges to the local optimal solution, the mutation operation can increase the diversity of the particle swarm, thereby avoiding premature convergence to the local optimal solution and improving the global search ability of the algorithm.
[0113] Figure 6 A schematic block diagram of an electronic device that can be used to implement the method of the embodiments of the present disclosure is schematically shown.
[0114] As Figure 6 shown, the electronic device 600 according to the embodiments of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 into the random access memory (RAM) 603. The processor 601 can include, for example, a general microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application specific integrated circuit (ASIC)), etc. The processor 601 can also include on-board memory for caching purposes. The processor 601 can include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiments of the present disclosure.
[0115] In the RAM 603, various programs and data required for the operation of the electronic device 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flow according to the embodiments of the present disclosure by executing the programs in the ROM 602 and / or the RAM 603. It should be noted that the programs may also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 may also implement the method provided by the embodiments of the present disclosure by executing the programs stored in the one or more memories.
[0116] According to an embodiment of the present disclosure, the electronic device 600 may further include an input / output (I / O) interface 605, and the input / output (I / O) interface 605 is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read from it can be installed into the storage portion 608 as needed.
[0117] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the method according to the embodiments of the present disclosure is implemented.
[0118] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 602 and / or RAM 603 described above and / or one or more memories other than the ROM 602 and RAM 603.
[0119] An embodiment of the present disclosure also includes a computer program product, which includes a computer program that contains program code for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program code is used to enable the computer system to implement the method provided by the embodiment of the present disclosure.
[0120] When the computer program is executed by the processor 601, it executes the above functions defined in the system / apparatus of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0121] In one embodiment, the computer program can rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program can also be transmitted and distributed in the form of a signal on a network medium, and is downloaded and installed through the communication part 609, and / or installed from the removable medium 611. The program code contained in the computer program can be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0122] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, it executes the above functions defined in the system of the embodiment of the present disclosure. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0123] It should be noted that in the technical solutions of the present disclosure, the processing of the user's personal information, such as collection, storage, use, processing, transmission, provision, disclosure, and application, complies with the provisions of relevant laws and regulations, takes necessary confidentiality measures, and does not violate public order and good customs. In the technical solutions of the present disclosure, the authorization or consent of the user is obtained before obtaining or collecting the user's personal information.
[0124] According to an embodiment of the present disclosure, program code for executing the computer programs provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedures and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, such as Java, C++, Python, the "C" language, or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user's computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, by using an Internet service provider to connect through the Internet).
[0125] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0126] Those skilled in the art can understand that the features described in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0127] The embodiments of the present disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments have been described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present disclosure.
Claims
1. A chip testing method, comprising: Randomly generate a plurality of test vectors, each of which represents a particle in a particle swarm, and the coordinate value of each of which is used to represent the position of each of the particles in the particle swarm; and Using each particle in the particle group to test the chip to be tested to obtain a test result; Wherein, using each particle in the particle group to test the chip to be tested, and obtaining the test result includes repeatedly performing the following operations until the functional coverage of the particle group is greater than or equal to the target functional coverage: Inputting the coordinate value of each particle into the chip to be tested to obtain a test result; Determining the functional coverage of the particle swarm according to the test results; When the functional coverage of the particle swarm is less than the target functional coverage, the update position of each particle in the particle swarm is determined according to the fitness of each particle in the particle swarm, and the updated position is used as the coordinate value of each particle, and the fitness represents the weight of the functional points covered by each particle relative to all the functional points of the chip to be tested.
2. The method according to claim 1, wherein determining the functional coverage of the particle swarm according to the test results comprises: Determining the function points covered by each particle according to the test result of each particle in the particle group; The ratio of the number of functional points covered by all particles in the particle group to the number of all functional points of the chip to be tested is determined as the functional coverage rate of the particle group.
3. The method according to claim 1, wherein determining the update position of each particle in the particle swarm according to the fitness of each particle in the particle swarm comprises: According to the fitness of each particle in the particle swarm, determining the individual historical optimal point of each particle and the global historical optimal point of the particle swarm; The update position of each particle in the particle swarm is determined according to the individual historical optimal point, the global historical optimal point, the inertia weight and the acceleration factor.
4. The method according to claim 3, wherein determining the individual historical optimal point of each particle and the global historical optimal point of the particle swarm according to the fitness of each particle in the particle swarm comprises: For each particle in the particle swarm, according to the fitness of the particle, a position corresponding to the maximum fitness is selected from the historical position set of the particle as the individual historical optimal point of the particle, wherein the historical position set is a set of coordinate values corresponding to the position of the particle in each iteration process; According to the fitness of each particle in the particle swarm, a position corresponding to the maximum fitness is selected from the historical position set of all particles in the particle swarm as the global historical optimal point of the particle swarm.
5. The method according to claim 3, wherein determining the update position of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight and the acceleration factor comprises: Calculate the moving distance of each particle in the particle swarm according to the individual historical optimal point, the global historical optimal point, the inertia weight and the acceleration factor; An updated position of each particle in the particle group is determined according to the moving distance of each particle in the particle group and the current position of each particle.
6. The method according to claim 5, wherein the moving distance of each particle in the particle swarm is calculated according to the individual historical optimal point, the global historical optimal point, the inertia weight and the acceleration factor, comprising: The moving distance of each particle in the particle group is calculated based on the following formula: in, is the distance that the i-th particle moves from its position at time t-1 to its position at time t, is the distance the ith particle moves from its position at time t to its position at time t+1, represents the inertia weight, and is the acceleration factor, and is a random number, is the individual historical optimal point of the ith particle at time t, is the global historical optimal point of the particle swarm at time t, is the position of the ith particle at time t.
7. The method according to claim 5, determining the updated position of each particle in the particle swarm according to the moving distance of each particle in the particle swarm and the current position of each particle, comprising: The updated position of each particle in the particle swarm is determined based on the following formula: in, is the position of the ith particle at time t+1.
8. The method according to claim 1, further comprising: The fitness of each particle is determined based on the following formula: The chip to be tested has N function points to be tested. Indicates whether the test result of the kth particle covers the nth function point. If the test result of the kth particle covers the nth function point, , when the test result of the kth particle does not cover the nth function point, , represents the weight of the nth function point relative to all the function points to be tested of the chip to be tested, is the fitness of the kth particle.
9. The method according to claim 1, further comprising: For each particle in the particle group, the inertia weight of the particle is determined based on the following formula: in, is the inertia weight of the ith particle, and are the preset lower and upper limits of the inertia weight. is the fitness of the ith particle, is the maximum value of the fitness of all particles in the particle swarm, is the average value of the fitness of all particles in the particle swarm.
10. The method according to claim 1, further comprising: In the case where the concentration of all particles in the particle group is greater than a preset threshold, for each particle in the particle group, determining the mutation probability of the particle according to the crowding distance of the particle, the crowding distance being the distance between two other particles closest to the particle in the particle group, and the concentration being determined based on the distance between the particle and other particles in the particle group; According to the mutation probability of each particle in the particle group, a particle that needs to be mutated is selected, and an update position of the particle that needs to be mutated is randomly generated.
11. An electronic device, comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method according to any one of claims 1 to 10.
12. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to perform the method according to any one of claims 1 to 10.
13. A computer program product, comprising a computer program, wherein the computer program is stored on at least one of a readable storage medium and an electronic device, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.