[sv-ec] illustration of new Mantis 1897 proposal

From: David Scott <david_scott_at_.....>
Date: Mon Aug 20 2007 - 16:00:46 PDT
This is to be taken in context of the second proposal for Mantis 1897.  Note that we did agree to re-name "aggregate_by_union" as "merge_instances", but I thought I'd use the name from the current proposal to avoid confusion:
parameter PER_INSTANCE = 0;
parameter AGGREGATE_BY_UNION = 0;

module m;
    int i;

    covergroup cg;
        option.per_instance = PER_INSTANCE;
        type_option.aggregate_by_union = AGGREGATE_BY_UNION;
        coverpoint i { bins b[] = { [0:2] }; }
    endgroup
    cg cvA = new;
    cg cvB = new;

    initial begin
        i = 0;  cvA.sample();
        i = 1;  cvA.sample();
        i = 2;  cvB.sample();
        $display("coverage: %.2f; A inst_coverage: %.2f; B inst_coverage: %.2f",
                 cg::get_coverage(),
                 cvA.get_inst_coverage(), cvB.get_inst_coverage());
    end
endmodule
There are four cases:

PER_INSTANCE
AGGREGATE_BY_UNION
output
0
0
coverage: 50.00; A inst_coverage: 50.00; B inst_coverage: 50.00
0
1
coverage: 100.00; A inst_coverage: 100.00; B inst_coverage: 100.00
1
0
coverage: 50.00; A inst_coverage: 66.67; B inst_coverage: 33.33
1
1
coverage: 100.00; A inst_coverage: 66.67; B inst_coverage: 33.33

There's an interesting reason to know about option.per_instance -- which in the new proposal is to say whether get_inst_coverage() should be used to report the coverage for a particular instance.  If we know that it is not, then it is possible to optimize the implementation, with memory usage consequences that some users may care about.  Particularly in the case where PER_INSTANCE==0 && AGGREGATE_BY_UNION==1, then one doesn't need any bin data for the instances; bin counts can be maintained as static data within the covergroup type.

-- David Scott
Mentor Graphics


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean. Received on Mon Aug 20 16:01:02 2007

This archive was generated by hypermail 2.1.8 : Mon Aug 20 2007 - 16:01:28 PDT