Hardware Reference
In-Depth Information
Example 9.14. The checker mycheck will not compile, even though this checker is
instantiated in module m :
checker mycheck( event clk = $inferred_clock);
a1: assert property (@clk a);
endchecker : mycheck
module m( input logic clk, ...);
logic a = ...;
mycheck check( posedge clk);
...
endmodule :m
This is because a referredtoinassertion a1 is resolved in the scope of the checker
definition where no a is declared, and not in the scope of the checker instantiation
where a is visible.
If the hierarchical name of a specific instance of module m is top.unit1.block2
then the checker mycheck could be rewritten as follows to reference a by its
hierarchical name:
checker mycheck( event clk = $inferred_clock);
a1: assert property (@clk top.unit1.block2.a);
endchecker : mycheck
Of course, a cleaner solution would be to pass a as an argument to the checker.
This should be done for small checkers like mycheck . Referencing design signals in
a checker by their hierarchical names is useful in big checkers verifying behavior of
large pieces of a design, however, it limits their reusability in other designs.
t
9.2.3.1
Checkers in Packages
Checkers are natural candidates for units of standard or project-wide verification
libraries. The question is how to package several checkers in a reusable unit. Another
problem is a possible name collision: the name of a library checker may be the same
as a name of another checker or module.
SystemVerilog package construct is well suited for both tasks: it can contain
several checkers (also properties, sequences, let, constants, etc., see Sect. 2.6 ), and
it also introduces its own name space.
Example 9.15. We can place checker request_granted from Example 9.7 in a
package named check_lib as follows:
package check_lib;
checker request_granted( sequence req, property gnt,
untyped n=1,
event clk = $inferred_clock, untyped rst = $inferred_disable);
a1: assert property (@clk disable iff (rst)
req |-> nexttime [n] gnt);
endchecker : request_granted
// Other checkers ...
endpackage : check_lib
Search WWH ::




Custom Search