[sv-ec] FW: [sv-bc] sv-bc 19.5 Defining coverage points // Error in eample

From: Maidment, Matthew R <matthew.r.maidment@intel.com>
Date: Sun Sep 11 2011 - 22:42:52 PDT

--
Matt Maidment
mmaidmen@ichips.intel.com
From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of ben cohen
Sent: Sunday, September 11, 2011 1:45 PM
To: sv-bc@eda.org; sv-ac@eda-stds.org
Subject: [sv-bc] sv-bc 19.5 Defining coverage points // Error in eample
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<http://cvg_weight_err.sv> : LRM code with pointed lrm errors commented out
   -cvgt_weight.sv<http://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<http://cvg_weight_err.sv>(18): Cannot assign an unpacked type to a packed type
Error: cvg_weight_err.sv<http://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<http://www.mailscanner.info/>, and is
believed to be clean.
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


Received on Sun Sep 11 22:43:36 2011

This archive was generated by hypermail 2.1.8 : Sun Sep 11 2011 - 22:43:40 PDT