Method and computer-readable medium for implementing coverage collection code reuse
By creating a cover warehouse base class and a derived cover warehouse class, overloading the functions of the cover warehouse base class, and using static array variables to obtain the coverage collection characteristics that need to be ignored, the problem of code duplication and maintenance difficulties in chip verification is solved, and the implementation of the problem of "repeat and maintenance of code" is achieved. Reuse of coverage collection code and simplification of verification platform.
Patent Information
- Application Number
- CN202210085225.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-01-25
AI Technical Summary
During the chip verification process, when facing the same type of chip with different performance, multiple sets of almost the same coverage collection codes need to be maintained, resulting in difficulty in code duplication and maintenance.
By creating a coverage warehouse base class and derived coverage warehouse class, overloading functions of the coverage warehouse base class, and using static array variables to obtain coverage collection characteristics that need to be ignored, realizing the reuse of coverage collection code.
It reduces the system complexity of the chip verification platform, simplifies the chip verification method, and the reloading process is more intuitive and easy to understand and maintain.
Smart Images

Figure CN114443028B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of chip verification technology, and in particular to a method for implementing coverage collection code reuse and a computer-readable medium. Background Art
[0002] like Figure 1 The figure shows an example diagram after abstracting the functional logic of a chip.
[0003] The signals of each port are as follows:
[0004] op: operation instructions, including addition ADD, subtraction SUB, multiplication MUL, and division DIV operations;
[0005] A: Operand operation, use register group to operate and store operands; B: Operand operation, use register group to operate and store operands; rslt: Operation result, use register group to operate and store the result.
[0006] Usually, in order to meet different market needs, different product strategies are formulated and corresponding product planning is carried out to plan a variety of chips of the same type with different performance. The performance parameters supported by the chip can be abstracted as follows:
[0007] support_mode: supported working modes, including HIGH_MODE, MEDIUM_MODE, and LOW_MODE. The higher the performance, the more modes it supports;
[0008] support_op: supported operation instructions, including ADD, SUB, MUL, DIV. The higher the performance, the more types of operation instructions it supports, which depends on the supported working mode support_mode;
[0009] support_reg: Supported register group, including registers R0~R7. The higher the performance, the more registers are used for the operands and results of the operation instructions, and the faster the operation speed is. This also depends on the supported working mode support_mode.
[0010] Then simply abstract its operation instructions and represent them with enumeration variables in the verification platform. Specifically:
[0011] mode: working mode;
[0012] op: operation instruction;
[0013] A_reg: register group used by operand A;
[0014] B_reg: register group used by operand B;
[0015] rslt_reg: The register group used by the operation result rslt.
[0016] Usually, it is necessary to write a coverage component coverage to collect coverage statistics for some important coverage points of the chip. This component obtains transaction data monitored by the monitor. It can be implemented through the subscriber mode or through the TLM communication port connection.
[0017] The coverage components generally include at least:
[0018] mode: collects coverage to the supported working modes;
[0019] op: collects and covers the supported operation instructions;
[0020] A_reg: collects the register group used by the covered operation operand A;
[0021] B_reg: collects the register group used by the covered operation operand B;
[0022] rslt_reg: collects the register group used by the covered operation result rslt.
[0023] Some cross-coverage points, such as the register group used by the operation instructions and the operation operand A, and other corner coverage points.
[0024] As mentioned above, in order to meet different market needs, different product strategies will be formulated and corresponding product planning will be carried out to plan out a variety of chips of the same type with different performance. Therefore, in order to verify a variety of chips of the same type with different performance, it may be necessary to maintain multiple sets of coverage collection code. For example, the same type of chip planned for the mid-to-low-end market no longer supports the HIGH_MODE working mode. At this time, the chip no longer supports the multiplication MUL and division DIV operation instructions. At the same time, the chip's operation speed will also be reduced. That is, at this time, its operation operands and operation results can no longer use all register groups R0~R7, but can only use register groups R0~R3. Then it is necessary to rewrite the above coverage collection code coverage and add some ignore_bins to ignore the coverage collection of some performance characteristics that are no longer supported.
[0025] Although only some ignore_bins need to be added, the previous coverage collection code needs to be completely copied. Similarly, if there are other chips of the same performance, there will be a lot of duplicate code. In this case, multiple sets of almost identical coverage collection codes need to be maintained at the same time. In addition, if modifications are needed later, multiple places may need to be modified simultaneously, which is troublesome and prone to omissions and errors. Summary of the invention
[0026] According to an embodiment of the present invention, a method for implementing coverage collection code reuse is provided, comprising the following steps:
[0027] Create a base class for overlay warehouse;
[0028] As needed, derive the overriding warehouse subclass from the overriding warehouse base class and overload the functions of the overriding warehouse base class;
[0029] Create a coverage collection object. The coverage collection object contains static array variables declared static. The static array variables are used to obtain coverage collections that need to be ignored.
[0030] Declare and instantiate coverage collection objects for creating test cases;
[0031] In the test case, override the actually required class object in the coverage bin base class used by default in the test case to reuse the coverage collection code.
[0032] Preferably, in the initial state, there is no coverage collection that needs to be ignored in the coverage bin base class.
[0033] Preferably, functions in the coverage warehouse base class and coverage warehouse subclasses are abstracted by the keyword virtual for code overloading.
[0034] Preferably, the static array variable obtains the coverage collection characteristics to be ignored by calling a function method of the coverage bin base class.
[0035] Preferably, when declaring and instantiating the coverage warehouse base class, a this parameter derived from the UVM object is passed to generate the scope domain of the coverage warehouse base class.
[0036] According to yet another embodiment of the present invention, a computer-readable medium having a non-volatile program code executable by a processor is provided, wherein the program code enables the processor to execute any one of the above methods for implementing coverage collection code reuse.
[0037] According to the method and computer-readable medium for implementing coverage collection code reuse in an embodiment of the present invention, the system complexity of the chip verification platform is reduced, and the overall chip verification method is more concise. At the same time, the coverage collection component objects required by the project are directly reloaded to ignore the coverage collection of some performance characteristics that are no longer supported. The reloading process is more intuitive and easy to understand, which facilitates the subsequent maintenance of the verification environment code.
[0038] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is an example diagram of the abstraction of chip function logic in the prior art;
[0040] Figure 2 A flowchart of a method for implementing coverage collection code reuse according to an embodiment of the present invention;
[0041] Figure 3 Based on Figure 2 Schematic diagram of the method principle. DETAILED DESCRIPTION
[0042] The preferred embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings to further illustrate the present invention.
[0043] First, combine Figure 2~3 A method for implementing coverage collection code reuse according to an embodiment of the present invention is described, which is used for chip verification with different performances and different modes and has a wide range of application scenarios.
[0044] like Figure 2~3 As shown, the method for implementing coverage collection code reuse in an embodiment of the present invention comprises the following steps:
[0045] Specifically, Figure 2~3 As shown, in step S1, a base class cg_ignore_bins_default is created for derivation in subsequent steps. In this embodiment, the function of the base class is added with the keyword virtual to achieve abstraction, so that its subclasses can overload its function methods.
[0046] Furthermore, in the initial state, there is no ignore_bins in the coverage bin base class cg_ignore_bins_default, that is, there is no coverage collection that needs to be ignored in the coverage bin base class cg_ignore_bins_default.
[0047] Specifically, Figure 2~3As shown, in step S2, as needed, the overriding warehouse base class derives the overriding warehouse subclass, and overloads the overriding warehouse base class cg_ignore_bins_default function; in this embodiment, the functions in the overriding warehouse base class and the overriding warehouse subclass are abstracted by the keyword virtual for code overloading.
[0048] Specifically, Figure 2~3 As shown, in step S3, a coverage collection object coverage is created, and the coverage collection object coverage contains a static array variable declared static, which is used to obtain the coverage collection characteristics of some performance characteristics that need to be ignored. In this embodiment, the static array variable obtains the coverage collection characteristics that need to be ignored by calling the function method of the coverage bin base class cg_ignore_bins_default.
[0049] Specifically, Figure 2~3 As shown, in step S4, the coverage collection object is declared and instantiated to create a test case. In this embodiment, the this parameter is passed during declaration and instantiation. Although the this parameter is derived from the UVM object uvm_object, it must be instantiated using the UVM component method, mainly to generate a range domain belonging to the coverage bin base class cg_ignore_bins_default, so as to facilitate the subsequent use of set_inst_override to overload and replace the coverage collection code of the factory.
[0050] For the purpose of coverage collection code reuse, you can also pass in the coverage collection that is no longer supported and need to be ignored through parameterized classes to achieve coverage code reuse; at the same time, through static calls, it is guaranteed that the class will not be instantiated, and only the coverage bin ignore_bins that the target needs to ignore will be obtained. However, in order to use the overloading function of the factory mechanism, it is necessary to add an additional level of coverage_base base class, and then overload the base class each time, instead of overloading the corresponding subclass_cg_ignore_bins_default according to project needs to selectively ignore the coverage collection characteristics of some performance characteristics that are no longer supported. This will cause two defects:
[0051] (1) An additional level, coverage_base, is added, which increases the complexity of the verification platform and makes the overall code less concise.
[0052] (2) Each time the coverage_base class is overloaded, it is overloaded instead of directly overloading the corresponding subclass_cg_ignore_bins_default to selectively ignore the coverage collection features of some performance features that are no longer supported. This makes the overloading process less intuitive and difficult to understand.
[0053] The method for implementing coverage collection code reuse in an embodiment of the present invention considers instantiating the default cg_ignore_bins_default class in the new constructor of the coverage collection component coverage and calling the method therein to obtain the coverage bin ignore_bins to be ignored, then assigning it to the declared static static array variable, and finally using the overloading function of the factory mechanism to replace the class object cg_ignore_bins_default class corresponding to the default coverage collection point to be ignored with the class required to be used in the actual project, which greatly reduces the system complexity of the chip verification platform and makes the overall chip verification method more concise. At the same time, the coverage collection component object required by the project is directly overloaded to ignore the coverage collection characteristics of some performance characteristics that are no longer supported. The overloading process is more intuitive and easy to understand, which facilitates the later maintenance of the verification environment code.
[0054] The above combined with Figure 2~3 The method for implementing coverage collection code reuse according to an embodiment of the present invention is described. Further, the present invention can also be applied to a computer-readable medium having a non-volatile program code executable by a processor.
[0055] The computer-readable medium of the embodiment of the present invention has a non-volatile program code executable by a processor, and the program code enables the processor to execute the method for implementing coverage collection code reuse of the above embodiment.
[0056] Above, refer to Figure 2~3 A method and computer-readable medium for implementing coverage collection code reuse according to an embodiment of the present invention are described, which reduces the system complexity of the chip verification platform and makes the overall chip verification method more concise. At the same time, the coverage collection component objects required by the project are directly overloaded to ignore the coverage collection of some performance characteristics that are no longer supported. The overloading process is more intuitive and easy to understand, which facilitates the subsequent maintenance of the verification environment code.
[0057] It should be noted that, in this specification, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprises..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0058] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims.
Claims
1. A method for implementing coverage collection code reuse, characterized in that: The following steps are included: Create a base class for overlay warehouse; As required, the overlay warehouse base class derives the overlay warehouse subclass and overloads the functions of the overlay warehouse base class; Create a coverage collection object, wherein the coverage collection object includes a static array variable declared static, and the static array variable is used to obtain coverage collection that needs to be ignored; Declare and instantiate the coverage collection object for creating test cases; In the test case, overloading the actually required class object in the coverage bin base class used by default in the test case to reuse the coverage collection code; The static array variable obtains the coverage collection characteristics to be ignored by calling the function method of the coverage bin base class; When declaring and instantiating the overlay bin base class, a this parameter derived from the UVM object is passed to generate the scope domain of the overlay bin base class.
2. The method for implementing coverage collection code reuse as claimed in claim 1, characterized in that: In the initial state, there is no coverage collection that needs to be ignored in the coverage bin base class.
3. The method for implementing coverage collection code reuse as claimed in claim 1, characterized in that: Functions in the overlay warehouse base class and the overlay warehouse subclass are abstracted by the keyword virtual for code overloading.
4. A computer-readable medium having a non-volatile program code executable by a processor, characterized in that: The program code enables the processor to execute the method for implementing coverage collection code reuse as described in any one of claims 1 to 3.