Ref: Example in 19.5, pdf page 529 of draft 2.
Compilation of the example in 19.5 shows errors not mentioned in the
example.
I commented out those errors mentioned in the code.
Attached are 2 files,
- cvg_weight_err.sv : LRM code with pointed lrm errors commented out
-cvgt_weight.sv : Modified code.
19.5 Defining coverage points
covergroup cg ( ref int x , ref int y, input int c);
coverpoint x; // creates coverpoint "x" covering the formal "x"
x: coverpoint x; // INVALID: coverpoint label "x" already exists
b: coverpoint y; // creates coverpoint "b" covering the formal "y"
c: coverpoint x; // creates coverpoint "c" covering the formal "x"
*option.weight = c; // set weight of "cg" to value of formal "c"*
d: coverpoint x {
option.weight = 2; // set the weight of coverpoint "d"
}
d.option.weight = 2; // INVALID use of "d", also syntax error
cross x, y { // Creates implicit coverpoint "y" covering
// the formal "y". Then creates a cross of
// coverpoints "x", "y"
*option.weight = c; // set weight of cross to value of formal "c"*
}
b: cross y, x; // INVALID: coverpoint label "b" already exists
endgroup
-- Compiled code (errors mentioned commented out) covergroup cg ( ref int x , ref int y, input int c); coverpoint x; // creates coverpoint "x" covering the formal "x" //x: coverpoint x; // INVALID: coverpoint label "x" already exists b: coverpoint y; // creates coverpoint "b" covering the formal "y" c: coverpoint x; // creates coverpoint "c" covering the formal "x" option.weight = c; // Line 18: set weight of "cg" to value of formal "c" d: coverpoint x { option.weight = 2; // set the weight of coverpoint "d" } //d.option.weight = 2; // INVALID use of "d", also syntax error cross x, y { // Creates implicit coverpoint "y" covering // the formal "y". Then creates a cross of // coverpoints "x", "y" option.weight = c; // LINE 26: set weight of cross to value of formal "c" } // b: cross y, x; // INVALID: coverpoint label "b" already exists endgroup Error pointed by compiler: Error: cvg_weight_err.sv(18): Cannot assign an unpacked type to a packed type Error: cvg_weight_err.sv(26): Cannot assign an unpacked type to a packed type --- Fixing line 18 and 21 makes the code simulate OK. The fix covergroup cg ( ref int x , ref int y, input int c); coverpoint x; // creates coverpoint "x" covering the formal "x" //x: coverpoint x; // INVALID: coverpoint label "x" already exists b_cvpt: coverpoint y; // creates coverpoint "b" covering the formal "y" * c_cvpt:* coverpoint x; // creates coverpoint "c" covering the formal "x" option.weight = c; // set weight of "cg" to value of formal "c" d_cvpt: coverpoint x { option.weight = 2; // set the weight of coverpoint "d" } //d.option.weight = 2; // INVALID use of "d", also syntax error cross x, y { // Creates implicit coverpoint "y" covering // the formal "y". Then creates a cross of // coverpoints "x", "y" option.weight = c; // set weight of cross to value of formal "c" } // b: cross y, x; // INVALID: coverpoint label "b" already exists endgroup cg cg_inst=new(addr, data, cache); Ben Cohen SystemVerilog.us -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.
This archive was generated by hypermail 2.1.8 : Sun Sep 11 2011 - 13:45:40 PDT