• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Functional Verification
  3. Functional coverage

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 65
  • Views 19905
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Functional coverage

jxker
jxker over 13 years ago

Hi, all. I am trying to do functional coverage, but it seems something wrong with my command line, that I cannot get a functional coverage result, but only the code coverage result. Can anyone tell me where I make a mistake?

my systemverilog code is:

class rand_cov;
   rand bit[4:0] data_a;
endclass

module cov;
   int i;
   int succ;
   bit[4:0] data;
  
   rand_cov cov_t;
   
   covergroup cg;
      cov_a: coverpoint data;
   endgroup
   cg cg_inst;

   initial begin
      cg_inst =new();
      cov_t = new();
     
      for(i=0; i<20; i++) begin
          succ = cov_t.randomize();
          data = cov_t.data_a;
          cg_inst.sample();
          $display("data=%0d, now coverage is: %0d",data, cg_inst.get_coverage());
      end      
   end
endmodule

And my command is :

ncvlog -message -sv cov.v
ncelab -message -access +rcw -covdut cov -coverage all work.cov:module
ncsim -message -covoverwrite -covtest cov -covscope cov work.cov:module

  • Cancel
Parents
  • archive
    archive over 13 years ago

     

     Change your code as below adding:

    option.per_instance=1;

    and

        cg_inst.set_inst_name($psprintf({"%m","_cg_inst"}));

    Otherwise you'll end up with a covergroup machine generated name like: cg_inst@1_1

    class rand_cov;
       rand bit[4:0] data_a;
    endclass

    module cov;
       int i;
       int succ;
       bit[4:0] data;
      
       rand_cov cov_t;
      
       covergroup cg;
      option.per_instance = 1;
          cov_a: coverpoint data;
       endgroup
       cg cg_inst;

       initial begin
          cg_inst =new();
          cov_t = new();
          cg_inst.set_inst_name($psprintf({"%m","_cg_inst"}));
         
          for(i=0; i<20; i++) begin
              succ = cov_t.randomize();
              data = cov_t.data_a;
              cg_inst.sample();
              $display("data=%0d, now coverage is: %0d",data, cg_inst.get_coverage());
          end     
       end
    endmodule

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • archive
    archive over 13 years ago

     

     Change your code as below adding:

    option.per_instance=1;

    and

        cg_inst.set_inst_name($psprintf({"%m","_cg_inst"}));

    Otherwise you'll end up with a covergroup machine generated name like: cg_inst@1_1

    class rand_cov;
       rand bit[4:0] data_a;
    endclass

    module cov;
       int i;
       int succ;
       bit[4:0] data;
      
       rand_cov cov_t;
      
       covergroup cg;
      option.per_instance = 1;
          cov_a: coverpoint data;
       endgroup
       cg cg_inst;

       initial begin
          cg_inst =new();
          cov_t = new();
          cg_inst.set_inst_name($psprintf({"%m","_cg_inst"}));
         
          for(i=0; i<20; i++) begin
              succ = cov_t.randomize();
              data = cov_t.data_a;
              cg_inst.sample();
              $display("data=%0d, now coverage is: %0d",data, cg_inst.get_coverage());
          end     
       end
    endmodule

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information