Method, computer readable medium for implementing coverage collection code reuse
Technical Field
The present invention relates to the field of chip verification technologies, and in particular, to a method and a computer-readable medium for realizing reuse of coverage collection codes.
Background
Fig. 1 is an example diagram obtained by abstracting functional logic of a chip.
The port signals are as follows:
op: operation instructions, including addition ADD, subtraction SUB, multiplication MUL, division DIV operations;
a: an operation operand operated and registered using the register group; b: an operation operand operated and registered using the register group; rslt: and an operation result, which is operated and registered by using the register group.
Generally, in order to face different market needs, different product strategies are formulated, corresponding product plans are performed, a plurality of chips of the same type with different performances are formulated, and then performance parameters supported by the chips can be abstracted as follows:
support _ mode: the supported working MODEs comprise HIGH _ MODE, MEDIUM _ MODE and LOW _ MODE, and the higher the performance is, the more MODEs are supported;
support _ op: the higher the performance of the supported operation instructions, including ADD, SUB, MUL and DIV, the more types of the supported operation instructions are, and the operation instructions are dependent on the supported work mode support _ mode;
support _ reg: the higher the performance of the supported register group comprising the registers R0-R7 is, the more registers are used by the operand and the result after the operation when the operation instruction is operated, the faster the operation speed is, and the same depends on the supported working mode support _ mode.
Its operation instructions are simply abstracted and represented in the verification platform with enumerated variables. The method specifically comprises the following steps:
mode: a working mode;
op: an operation instruction;
a _ reg: a register set used for operating the operand A;
b _ reg: a register set used for operating the operand B;
rst _ reg: register sets used for the operation result rlt.
Generally, a coverage component coverage needs to be written to perform coverage collection statistics on some important coverage points of the chip, and the component acquires transaction data monitored by a monitor, and the acquisition can be realized through a subscriber mode or through TLM communication port connection.
The coverage component generally includes coverage points including at least:
mode: collecting coverage to supported modes of operation;
op: collecting the operation instructions covered to the support;
a _ reg: collecting a register group used by the covered operation operand A;
b _ reg: collecting a register group used by the covered operation operand B;
rst _ reg: and collecting a register group used by the covered operation result rlt.
Some crossing coverage points, such as other kernel coverage points like register sets used by the operation instructions and the operation operands A.
In the foregoing, in order to face different market needs, different product strategies are made, corresponding product planning is performed, and a plurality of chips of the same type with different properties are planned, so that a plurality of coverage rate collection codes may need to be maintained in order to verify the plurality of chips of the same type with different properties. For example, the same type of chip designed for the middle and low end markets no longer supports the HIGH _ MODE operation MODE, at this time, the chip no longer supports the operation instructions of multiplication MUL and division DIV, and the operation speed of the chip is also reduced, that is, at this time, the operation operands and operation results of the chip can no longer use all the register sets R0 to R7, but only the register sets R0 to R3, so that the coverage collection code coverage needs to be rewritten and some ignores the coverage collection of some performance characteristics that are no longer supported at present.
In this regard, although only some align _ bins need to be added, the previous coverage collection code needs to be completely copied, and if there are other performance chips of the same type, there will be a large number of duplicate codes, and it will be necessary to maintain multiple sets of almost identical coverage collection codes at the same time. In addition, if modification is needed later, multiple places may need to be modified synchronously, which is troublesome and easy to miss errors.
Disclosure of Invention
According to the embodiment of the invention, the method for realizing the reuse of the coverage rate collecting codes is provided, which comprises the following steps:
creating a covering warehouse class;
according to the requirement, the covering bin base class is used for deriving the covering bin subclass, and the function of the covering bin base class is reloaded;
creating a coverage rate collection object, wherein the coverage rate collection object comprises a static array variable of a statement static, and the static array variable is used for acquiring coverage rate collection needing to be ignored;
declaring and instantiating a coverage collection object for creating test cases;
in the test case, the actually needed class objects in the coverage bin base class used by default in the test case are reloaded for reusing the coverage collection code.
Preferably, in the initial state, there is no coverage collection in the coverage bin base class that needs to be ignored.
Preferably, the functions in the overlay bin base class and the overlay bin subclass are abstracted by a keyword virtual for code reloading.
Preferably, the static array variable acquires the coverage collection characteristic needing to be ignored by calling a function method covering the bin base class.
Preferably, when the overlay bin base class is declared and instantiated, the this parameter derived from the UVM object is passed for generating a scope domain that covers the bin base class.
According to yet another embodiment of the present invention, there is provided a computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to execute any of the above methods for implementing coverage collection code reuse.
According to the method and the computer readable medium for realizing reuse of the coverage rate collection codes, the system complexity of a chip verification platform is reduced, the whole chip verification method is simpler, meanwhile, coverage rate collection component objects required by heavy-load projects are directly overloaded to omit coverage rate collection of some performance characteristics which are not supported any more, the heavy-load process is more visual and convenient to understand, and maintenance of verification environment codes in the later period is facilitated.
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 claimed technology.
Drawings
FIG. 1 is a diagram illustrating an example of a prior art chip with abstracted functional logic;
FIG. 2 is a flow diagram of a method for implementing reuse of coverage collection codes according to an embodiment of the present invention;
fig. 3 is a schematic view of the method according to fig. 2.
Detailed Description
The present invention will be further explained by describing preferred embodiments of the present invention in detail with reference to the accompanying drawings.
First, a method for realizing reuse of coverage rate collection codes according to an embodiment of the present invention will be described with reference to fig. 2 to 3, which is used for chip verification with different performances and different modes, and has a wide application range.
As shown in fig. 2 to 3, the method for implementing reuse of coverage rate collection codes according to the embodiment of the present invention includes the following steps:
specifically, as shown in fig. 2 to 3, in step S1, a cg _ align _ bins _ default covering the bin base class is created for derivation in the subsequent steps.
Further, in the initial state, there is no align _ bins in the coverage bin base class cg _ align _ bins _ default, i.e. there is no coverage collection in the coverage bin base class cg _ align _ bins _ default that needs to be ignored.
Specifically, as shown in fig. 2 to 3, in step S2, the overlay bin base class derives the overlay bin subclass according to the requirement, and the function of the overlay bin base class cg _ align _ bins _ default is reloaded; in this embodiment, the functions in the overlay bin base class and the overlay bin subclass are abstracted by the keyword virtual for code reloading.
Specifically, as shown in fig. 2 to 3, in step S3, a coverage collection object coverage is created, where the coverage collection object coverage includes a static array variable of a statement static for obtaining a coverage collection characteristic of some performance characteristics that need to be ignored. In this embodiment, the static array variable obtains the coverage collection characteristic that needs to be ignored by calling a function method that covers the cg _ align _ bins _ default of the bin base class.
Specifically, as shown in fig. 2 to 3, in step S4, a coverage collection object is declared and instantiated to create a test case, in this embodiment, a this parameter is passed when declaring and instantiating, and although the this parameter is derived from the UVM object UVM _ object, the this parameter is instantiated by using the UVM component, mainly to generate a range domain belonging to the coverage bin base class cg _ overlap _ default, so as to facilitate the subsequent replacement of reloading of the factory coverage collection code by using the set _ inst _ override.
Based on the purpose of reusing the code collected by the coverage rate, the code reuse of the coverage rate can be realized by transferring parameterized classes into the collection of the coverage rate which needs to be ignored and is not supported any more; meanwhile, through static calling, the class is guaranteed not to be instantiated, only the coverage bin align _ bins which need to be ignored by a target are obtained, however, in order to use the overloading function of the factor mechanism, a hierarchical coverage _ base class needs to be additionally added, then the base class is overloaded each time, instead of selectively ignoring the coverage rate collection characteristics of some performance characteristics which are not supported any more by overloading the corresponding foreground _ cg _ align _ bins _ default according to the project requirement, two defects are generated:
(1) a level coverage _ base is additionally added, so that the complexity of the verification platform is increased, and the whole code is not concise.
(2) The base class coverage _ base is reloaded during each reloading, and the corresponding coverage _ cg _ align _ bins _ default is not directly reloaded to selectively ignore the coverage rate collection characteristics of some performance characteristics which are not supported any more, so that the reloading process is not intuitive and is not convenient to understand.
In the method for realizing reuse of the coverage rate collection code according to the embodiment of the present invention, the default cg _ ignore _ bins _ default class is instantiated in the new constructor of the coverage rate collection component coverage and the method therein is called to obtain the coverage bins ignore _ bins to be ignored, then assigning the static array variable to the statement, finally using the overloading function of the factor mechanism to replace the class object cg _ align _ bins _ default class corresponding to the default coverage collection point needing to be ignored into the class needing to be used in the actual project, greatly reducing the system complexity of the chip verification platform, leading the whole chip verification method to be more concise, meanwhile, the coverage rate collection component object required by the project is directly reloaded to ignore the coverage rate collection characteristics of some performance characteristics which are not supported any more, the reloading process is more visual and convenient to understand, and the maintenance of the verification environment code at the later stage is facilitated.
The method for realizing reuse of the coverage rate collection codes according to the embodiment of the invention is described above with reference to the attached figures 2-3. Further, the present invention can also be applied to a computer-readable medium having non-volatile program codes executable by a processor.
The computer readable medium having the non-volatile program code executable by the processor of the embodiment of the present invention, the program code causes the processor to execute the method for realizing reuse of the coverage collection code of the above-mentioned embodiment.
The method for realizing reuse of the coverage rate collection codes and the computer readable medium according to the embodiments of the invention are described above with reference to fig. 2 to 3, the system complexity of the chip verification platform is reduced, the whole chip verification method is simpler, meanwhile, the coverage rate collection of some performance characteristics which are not supported any more is omitted by directly overloading the coverage rate collection component objects required by the project, the overloading process is more intuitive and convenient to understand, and the maintenance of the verification environment codes at the later stage is facilitated.
It should be noted that, in the present specification, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
While the present invention has been described in detail with reference to the preferred embodiments, it should be understood that the above description should not be taken as limiting the invention. Various modifications and alterations to this invention will become apparent to those skilled in the art upon reading the foregoing description. Accordingly, the scope of the invention should be determined from the following claims.