Unit test method and device
By automatically generating and managing test cases, the problem that manual writing of unit test cases in the existing technology cannot meet the automation requirements is solved, and efficient and accurate unit tests for integrated circuit design rule checks are realized, adapting to the needs of design rule changes, and improving the Reliability and stability of the test.
Patent Information
- Application Number
- CN202411124790.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-11-26
AI Technical Summary
In the prior art, manual writing of unit test cases cannot meet the automation requirements of integrated circuit design rules checking, resulting in a huge number of test cases, difficult maintenance, and difficult to adapt to changes in design rules.
By obtaining the target rule part of the design rule file, generating test graphics and defining its graphic properties, batch generating text files, converting them into EDA input files and picture files, constructing test cases, and using gtest test case functions for testing, realizing automated generation and manage test cases.
Significantly improve testing efficiency and accuracy, reduce developer workload, ensure full coverage of all design rules types and boundary conditions, quickly adjust test cases, maintain test effectiveness and consistency, and improve the integrated circuit design software Reliability and stability.
Smart Images

Figure CN119026548A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of very large scale integrated circuits, and in particular to a unit testing method and device. Background Art
[0002] As the complexity of software systems increases, traditional manual testing methods can no longer meet the needs of modern software development. In an agile development and continuous integration environment, rapid iteration and frequent releases require more efficient testing methods. Unit testing can detect and fix defects as early as possible by independently testing the smallest sample of design rules, ensuring the correctness of each design rule check function, thereby improving test efficiency and coverage.
[0003] The existing unit testing methods have their own advantages, but there are also some obvious problems and shortcomings. In particular, it is difficult for manually designed unit test cases to fully cover all situations of all design rules, and it is difficult to adapt to the changes brought about by changes in design rules. Specifically, due to the wide variety of design rules, rapid iterations, and different parameters on different wiring layers, the test cases need to cover every situation, which leads to a large number of test cases and difficulty in maintenance. The existing unit testing methods require developers to write unit test cases for all design rule checks. For complex design rules, these technologies alone cannot meet the requirements of integrated circuit design rule check unit test automation.
[0004] Based on this, a new technical solution is needed. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a unit test method and apparatus for integrated circuit design rule checking, so as to at least solve the problem in the prior art that manually written unit test cases cannot meet automation requirements.
[0006] The embodiment of the present invention provides the following technical solutions:
[0007] A first aspect of an embodiment of the present invention provides a unit testing method, which is applied to integrated circuit design rule checking, and the method comprises:
[0008] Obtaining a target rule part in a design rule file, wherein the target rule part includes a constant parameter and a variable value parameter;
[0009] Batch generate test patterns based on the constant parameters and the variable value parameters;
[0010] Defining and describing the graphic attributes of the test graphics generated in batches according to preset rules, and matching the graphic attributes with the constant parameters and the variable value parameters;
[0011] Batch generate text files based on the definition description and the expected number of violations;
[0012] Convert the batch-generated text files into EDA input files and image files, and batch-construct test cases based on the text files and the EDA input files, wherein the image files are graphics generated according to the text files;
[0013] Use the test case function to test the test case.
[0014] Furthermore, the test pattern is configured as a combination of a rectangle or at least two rectangles.
[0015] Furthermore, the text file includes a description type and attributes of the rectangle, wherein the attributes include one or more of the size of the rectangle, the position of the rectangle, the coordinates of the rectangle, the layer of the test pattern, the network to which it belongs, the via name, the pin name, and the color of the description type of the rectangle.
[0016] Furthermore, according to the description type of the rectangle in each of the text files, corresponding attributes are added in each of the text files.
[0017] Furthermore, the EDA input file includes one or more of a DEF file, a LEF file, and a Verilog file.
[0018] Further, converting the text file into an EDA input file includes:
[0019] Based on the description type of the test pattern and the parameters corresponding to the description type, a DEF file, a LEF file or a Verilog file is generated according to a predetermined syntax format.
[0020] Further, when the attributes in the text file include pin names or macro_obs, a LEF file is generated based on the text file.
[0021] Furthermore, the test case function is a test case function based on gtest.
[0022] Further, the using the test case function to test the test case includes:
[0023] The test case function reads the expected number of violations in the test case and detects the actual number of violations of the target rule part of the test case;
[0024] Based on the comparison between the expected violation quantity and the actual violation quantity, the correctness of the design rule checking function is judged.
[0025] A second aspect of an embodiment of the present invention further provides a unit test device for integrated circuit design rule checking, comprising:
[0026] A first script unit, the first script unit is used to obtain a target rule part in a design rule file, wherein the target rule part includes a constant parameter and a variable value parameter, generate a test pattern based on the constant parameter and the variable value parameter, and define and describe a graphic attribute of the test pattern according to a preset rule so that the test graphic attribute matches the constant parameter and the variable value parameter, and form a text file based on the definition description and the expected number of violations;
[0027] A second script unit, the second script unit is used to convert the text file into an EDA input file, and construct a test case based on the text file and the EDA input file;
[0028] A test unit, wherein the test unit is used to test the test case using a test case function.
[0029] Compared with the prior art, the at least one technical solution adopted in the embodiment of the present invention can achieve the following beneficial effects:
[0030] A unit testing method of the present invention obtains a target rule part in a design rule file, wherein the target rule part includes a constant parameter and a variable value parameter; generates a test graphic based on the constant parameter and the variable value parameter; defines and describes the graphic attributes of the test graphic according to a preset rule, so that the test graphic attributes match the constant parameter and the variable value parameter; generates text files in batches based on the definition description and the expected number of violations; converts the batch-generated text files into EDA input files and image files, and constructs test cases in batches based on the batch-generated text files and the EDA input files; and tests the test cases using a test case function. The present invention can use scripts to automatically obtain batch text files and test cases, thereby testing batch test cases through test functions, thereby solving the problem in the prior art that manually written unit test cases cannot meet automation requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0032] Figure 1 A flow chart of a unit testing method according to an embodiment of the present invention;
[0033] Figure 2 The test case content in the text file of the first embodiment of the embodiment of the present invention;
[0034] Figure 3 Based on Figure 2 The DEF file content generated by the text file;
[0035] Figure 4 Based on Figure 2 The Verilog file content generated by the text file;
[0036] Figure 5 Based on Figure 2 Graphics of test cases generated from text files;
[0037] Figure 6 The test case content in the text file of the second embodiment of the embodiment of the present invention;
[0038] Figure 7 Based on Figure 6 The LEF file generated by the text file shown;
[0039] Figure 8 Based on Figure 6 The DEF file generated by the text file shown;
[0040] Fig. 9 Based on Figure 6 Graphics of test cases generated from the text file shown;
[0041] Fig.10 For the test case function, Figure 6 The log generated when the generated EDA input file test passes;
[0042] Fig.11 For the test case function, Figure 6 Logs generated when the generated EDA input file test fails. DETAILED DESCRIPTION
[0043] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0044] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that, in the absence of conflict, the following embodiments and the features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work belong to the scope of protection of the present application.
[0045] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present application, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number and aspect described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0046] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. The drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0047] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the examples can be practiced without these specific details.
[0048] In the physical design process of very large scale integrated circuits (VLSI), the goal of wiring is to complete the connection of all wire nets without violating the design rules, which requires multiple rounds of design rule checking and violation repair operations. Unit testing aims to verify the software's ability to detect design rules and quickly identify potential errors after code changes such as optimization or repair of program vulnerabilities. However, there are many types of design rules and the number is huge. Unit testing needs to cover all design rule types and boundary conditions. Manually designing unit test cases is time-consuming and the cases are not easy to maintain.
[0049] Based on this, this specification embodiment proposes a processing solution: Figure 1 As shown, a unit testing method of the present invention has certain similarities in the test graphics composition of unit test cases for the same design rules, and only differs in the changed parameters. Therefore, the script can generate test graphics in batches according to constant parameters and variable value parameters, so as to define and describe the test graphics to batch generate text files, and generate corresponding EDA input files from the batch-generated text files, and finally, the batch-generated text files and the corresponding batch EDA input files are batch-composed into unit test cases to test the design rule check, thereby solving the problem of manually writing unit test cases for design rule checking in the prior art.
[0050] The technical solutions provided by various embodiments of the present application are described below in conjunction with the accompanying drawings.
[0051] like Figure 1 As shown, the present invention provides a unit testing method, which is applied to integrated circuit design rule checking, and the method comprises:
[0052] Step S102: Obtain a target rule part in the design rule file, wherein the target rule part includes constant parameters and variable value parameters.
[0053] Among them, the target rule part in the design rule file can be read through the Python script file.
[0054] Among them, constant parameters are rules that must be strictly followed and unchanged during the design process, such as line width, line length, parallel run length, layer name, etc.
[0055] The variable value parameters are parameters that allow the designer to adjust according to specific needs, such as the area and spacing of the metal graphics.
[0056] Step S104: batch generate test patterns based on the constant parameters and the variable value parameters.
[0057] The test pattern is a specific pattern intentionally created in the integrated circuit design and is used to trigger the design rule checking function.
[0058] The test pattern is configured as a rectangle or a combination of at least two rectangles.
[0059] Specifically, the basic figure of the test figure is a rectangle, and the combined figure can be synthesized by overlapping multiple rectangles or can be composed of multiple rectangles.
[0060] The rectangle is composed of length and width, and its position is related to the parameters of the target rule part. The rectangle can be combined into a graphic corresponding to the design rule according to its size, position and expected number of violations.
[0061] Among them, Python scripts can be used to batch generate test graphics based on constant parameters and variable value parameters.
[0062] Step S106: defining and describing the graphic attributes of the test graphics generated in batches according to preset rules, so that the graphic attributes match the constant parameters and the variable value parameters.
[0063] Step S108, batch-generating text files based on the definition description and the expected number of violations;
[0064] Among them, a Python script can be used to define and describe the graphic properties of the test graphic according to preset rules. The definition description includes the graphic type, position and other necessary properties. After defining and describing the graphic properties, the definition description is written into a text file (txt file) to complete the design of the unit test case text.
[0065] The text file includes the description type and attributes of the rectangle, wherein the attributes include one or more of the coordinates of the rectangle, the layer of the test pattern, the line network to which it belongs, the via name, the pin name, and the color of the rectangle description type.
[0066] The attribute is a rectangle description attribute, which is used to describe the attribute of the rectangle in the integrated circuit.
[0067] The content of the text file is some graphic attribute definitions, which can represent types such as wires, pins, obstacles, etc., to help users intuitively understand the composition of the current unit test.
[0068] like Figure 2 As shown in the figure, the first line of the text file describes the expected number of violations, and the next three lines describe the graphics that trigger the design rule check. The first keyword is used to describe the type of rectangle. The text file can include two types: wire and fills. The subsequent four numbers are used to describe the diagonal coordinates of the rectangle, such as the coordinates of the lower left corner and the upper right corner in the XY coordinate system, to specify the size and position of the rectangle. The subsequent fifth parameter is the layer, and the remaining required attributes such as the net and color of the wire, the color of the fills, etc. are also described. Figure 5 A graph representing the unit test is used to help users intuitively understand the test graph composition of the test case.
[0069] Furthermore, according to different description types of rectangles, the attributes in different text files are different.
[0070] Specifically, according to the description type of the rectangle in each text file, a corresponding attribute is added in each text file.
[0071] like Figure 6 As shown, Figure 6 is another text file, which is Figure 2 The text file shown is similar, with the first line describing the expected number of violations, the next six lines defining the test pattern, the first keyword in the subsequent six lines describing the type of rectangle, the five numbers in each line describing the coordinates of the lower left and upper right corners of the rectangle, and the last number describing the layer where the rectangle is located. Depending on the description type of the rectangle, it can determine whether to add some more attributes to the rectangle, such as the network it belongs to, via name, color, pin name, etc., and finally convert it into the corresponding DEF file, LEF file, and Verilog file through the script.
[0072] Among them, the Python script generates multiple test graphics in batches according to different variable value parameters, defines and describes the multiple test graphics, and then generates text files in batches according to the definition description of the graphic attributes of the multiple test graphics and the corresponding expected number of violations.
[0073] Step S110, batch converting the batch-generated text files into EDA input files and image files, and constructing test cases based on the text files and the EDA input files, wherein the image files are graphics generated according to the text files.
[0074] Among them, after the text files are prepared, Python scripts can be used to convert all text files into corresponding EDA (integrated circuit design automation tool) input files, and different graphic types have fixed syntax formats in DEF, LEF, and Verilog files.
[0075] The EDA input files include one or more of a DEF file, a LEF file, and a Verilog file.
[0076] Among them, DEF file (Design Exchange Format) is an ASCII format file used to describe the layout of integrated circuits. It records the design unit, macro block, standard unit and wiring information. It is mainly used to describe the chip layout, including the location, shape and direction of the unit, and records the wiring information, such as the direction and level of the wire, and contains detailed information about the metal layer, power grid, etc.
[0077] Among them, LEF file (Library Exchange Format) is a standard library exchange format file used to describe the abstract information of the standard cell library. It contains a simplified description of geometry, hierarchy, rules, and cell properties. It is used to provide a macro view of the standard cell without involving specific internal details, describing the cell's boundaries, port locations, pins, metal layers, and design rule constraints, and is used in physical design tools for layout and routing.
[0078] Among them, Verilog file is a hardware description language (HDL) file used to describe the behavior and structure of digital systems. It can be used to simulate, synthesize and verify circuit design, to describe logic functions and timing behaviors, RTL level design and simulation, and support synthesis tools to convert it into a gate-level netlist for physical implementation.
[0079] Among them, Python also obtains a picture file based on the text file, and the picture file is a graphic generated based on the text file.
[0080] Specifically, a DEF file, a LEF file or a Verilog file may be generated according to a predetermined syntax format based on the description type of the picture type and the parameters corresponding to the description type.
[0081] like Figures 2 to 4 As shown, Figures 3-4 is based on Figure 2 The DEF file and Verilog generated by the text file shown in the figure, the two wires defined in the text file belong to net1 and net2 respectively, the Verilog file reflects all the nets, and the DEF file describes the specific location and size of the wires; the fills in the text file are also defined in the DEF file. Figure 5 The graphics generated from the text file are displayed, showing the size, position and relationship of the graphics. The color indicates the type of graphics. For example, a green rectangle (color not shown in the figure) can represent wires, and a purple rectangle (color not shown in the figure) can represent fills. After executing this step, the complete test case is constructed.
[0082] More specifically, when the attributes in the text file include pin names or macro_obs, a LEF file is generated based on the text file.
[0083] like Figure 7 As shown, Figure 7 It is the content of the LEF file after the script conversion. It needs to be converted into a LEF file only when pins or macro_obs are defined in the text file.
[0084] like Figures 8-9 As shown, Figure 8 Based on Figure 6 The DEF file generated by the text file shown in the figure is Fig. 9 Based on Figure 6 The image file generated by the text file shown is used to visually demonstrate the graphic composition and size of this use case.
[0085] Step S112: Use the test case function to perform verification test on the test case.
[0086] The test case function is based on gtest, which is an open source testing framework based on C++ for writing and running unit tests. It provides a series of macros, functions, and classes to help developers write and organize test cases more conveniently.
[0087] Specifically, using the test case function to test the test case includes:
[0088] Step S112a, the test case function reads the expected number of violations in the test case, and detects the actual number of violations of the target rule part of the test case;
[0089] Step S112b: comparing the expected number of violations with the actual number of violations to determine the correctness of the design rule checking function.
[0090] Among them, the test case function of the present invention can call the DRC function in the software, compare the actual number of violations with the expected number of violations, so as to verify whether the behavior of the software meets expectations.
[0091] Among them, the gtest test case function can read the EDA input file and text file of the test case to obtain the expected number of violations, and call the software function to detect the actual number of violations of the current test case, so as to compare the expected number of violations with the actual number of violations. If there is inconsistency, it means that a bug has occurred in the software after modification, thereby judging the correctness of the design rule checking function.
[0092] Specifically, when the gtest test case function detects that the expected number of violations is equal to the actual number of violations, it means that the design rule checking function can be used normally, and the following will appear: Fig.10 The log shown in the figure is as follows; if the expected number of violations is not equal to the actual number of violations, it means that there is a bug in the design rule checking function, and the following will appear: Fig.11 The log shown.
[0093] In a specific embodiment of the present invention, Figure 6 A text file generated for a specific embodiment of the present invention, Figure 7 Based on Figure 6 The LEF file generated by the text file, Figure 8 Based on Figure 6 The DEF file generated by the text file, Fig. 9 Based on Figure 6 The image file generated by the text file; Fig.10 This is the effect diagram of gtest passing. This log appears when the expected number of violations is equal to the actual number of violations. Fig.11 This is the effect diagram of the gtest test failure. When the expected number of violations is not equal to the actual number of violations, the following will appear: Fig.11 The log shown here indicates that a bug has occurred in the software after modification.
[0094] The unit testing method of the present invention covers the format definition of unit test cases, the script for converting unit test cases into DEF, LEF, and Verilog files, the script for batch generating unit test cases according to design rules, and the batch verification of unit tests using Google Test (gtest). The present invention realizes comprehensive automation from the construction of test cases to the operation of unit tests. This method significantly improves the test efficiency and accuracy and reduces the workload of developers. By automatically generating and managing test cases, the present invention can ensure that all design rule types and boundary conditions are fully covered, and the test cases can be quickly adjusted even when the rules are changed to maintain the effectiveness and consistency of the test. This automation method not only solves the problems of insufficient coverage and high maintenance cost of existing unit tests, but also helps to improve the reliability and stability of integrated circuit design software in the step of design rule checking.
[0095] The present invention integrates the entire test process of batch designing text test cases, converting text test cases into DEF, LEF, and Verilog files, and batch verifying all test cases. Through this method, there is no need to manually design test cases, and users can intuitively understand the design rule description and graphic combination of test cases without paying attention to the specific content of DEF, LEF, and Verilog files, thereby being able to effectively verify whether the running results of the program before and after the change meet expectations.
[0096] The method described in the present invention is particularly suitable for integrated circuit design unit testing with a large number of design rules of various types, which can significantly save human resources and improve test efficiency and accuracy. By automatically generating and managing test cases, the present invention ensures that all design rule types and boundary conditions are fully covered, and test cases can be quickly adjusted even when the rules are changed to maintain the effectiveness and consistency of the test, greatly improving the reliability and stability of integrated circuit design software in the design rule checking step.
[0097] The embodiment of the present invention also provides a unit test device for integrated circuit design rule checking, including a first script unit, a second script unit and a test unit. The first script unit is used to obtain a target rule part in a design rule file, wherein the target rule part includes a constant parameter and a variable value parameter, a test pattern is generated based on the constant parameter and the variable value parameter, and the graphic attributes of the test pattern are defined and described according to a preset rule so that the test graphic attributes match the constant parameter and the variable value parameter, and a text file is formed based on the definition description and the expected number of violations; the second script unit is used to convert the text file into an EDA input file, and construct a test case based on the text file and the EDA input file; the test unit is used to test the test case using a test case function.
[0098] Furthermore, the second script unit is further used to generate a DEF file, a LEF file or a Verilog file according to a predetermined syntax format based on the description type of the test pattern and parameters corresponding to the description type.
[0099] Furthermore, the test unit is also used to read the expected number of violations in the test case and detect the actual number of violations in the test case; based on the comparison between the expected number of violations and the actual number of violations, it is determined whether the purpose of the unit test is achieved.
[0100] In this specification, the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the product embodiment described later, since it corresponds to the method, the description is relatively simple, and the relevant parts can be referred to the partial description of the system embodiment.
[0101] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A unit testing method, characterized in that: Applied to integrated circuit design rule checking, the method comprises: Obtaining a target rule part in a design rule file, wherein the target rule part includes a constant parameter and a variable value parameter; Batch generate test patterns based on the constant parameters and the variable value parameters; Defining and describing the graphic attributes of the test graphics generated in batches according to preset rules, and matching the graphic attributes with the constant parameters and the variable value parameters; Batch generate text files based on the definition description and the expected number of violations; Convert the batch-generated text files into EDA input files and image files, and batch-construct test cases based on the text files and the EDA input files, wherein the image files are graphics generated according to the text files; Use the test case function to test the test case.
2. The unit testing method according to claim 1, characterized in that: The test pattern is configured as a combination of a rectangle or at least two rectangles.
3. The unit testing method according to claim 2, characterized in that: The text file includes the description type and attributes of the rectangle, wherein the attributes include one or more of the coordinates of the rectangle, the layer of the test pattern, the network to which it belongs, the via name, the pin name, and the color of the description type of the rectangle.
4. The unit testing method according to claim 3, characterized in that: According to the description type of the rectangle in each of the text files, corresponding attributes are added in each of the text files.
5. The unit testing method according to claim 4, characterized in that: The EDA input file includes one or more of a DEF file, a LEF file, and a Verilog file.
6. The unit testing method according to claim 5, characterized in that: Converting the text file to an EDA input file includes: Based on the description type of the test pattern and the parameters corresponding to the description type, a DEF file, a LEF file or a Verilog file is generated according to a predetermined syntax format.
7. The unit testing method according to claim 6, characterized in that: When the attributes in the text file include pin names or macro_obs, a LEF file is generated based on the text file.
8. The unit testing method according to claim 1, characterized in that: The test case function is a test case function based on gtest.
9. The unit testing method according to claim 8, characterized in that: The testing of the test case using the test case function comprises: The test case function reads the expected number of violations in the test case and detects the actual number of violations of the target rule part of the test case; Based on the comparison between the expected violation quantity and the actual violation quantity, the correctness of the design rule checking function is judged.
10. A unit test device for integrated circuit design rule checking, characterized in that: include: A first script unit, the first script unit is used to obtain a target rule part in a design rule file, wherein the target rule part includes a constant parameter and a variable value parameter, generate a test pattern based on the constant parameter and the variable value parameter, and define and describe a graphic attribute of the test pattern according to a preset rule so that the test graphic attribute matches the constant parameter and the variable value parameter, and form a text file based on the definition description and the expected number of violations; A second script unit, the second script unit is used to convert the text file into an EDA input file, and construct a test case based on the text file and the EDA input file; A test unit, wherein the test unit is used to test the test case using a test case function.
