Functional Coverage : FSM odd states

60 views
Skip to first unread message

mah...@gmail.com

unread,
Sep 11, 2023, 12:21:08 PM9/11/23
to EDA Playground
Hi All,

consider an FSM for FC. 

///////////////////////////////////////////
enum {s0, s1, s2, s3, s4, s5} states;

covergroup CG @(posedge clk);
A : coverpoint states{
 bins odd_states [] = {s1,s3,s5};
}
endgroup
///////////////////////////

Basically, I wanted to write bins to cover odd states or odd numbers. If it it is simpler/lesser states, we can write as above. 

But if it is complex or range is maximum, how can we write in a generic way?
like %2 !=0?

Can anyone suggest?

Thank you,
Thiru



EDA Playground

unread,
Sep 12, 2023, 3:28:15 AM9/12/23
to EDA Playground
Give someone a fish, you feed them for a day:

Here is an example from an Advanced Coverage webinar I did:

covergroup CG;

  coverpoint c {

    bins IS_ZERO      = {0};

    bins DIV_BY_5     = {[1:25]} with (item%5==0);

    bins NOT_DIV_BY_5 = {[1:25]} with (item%5!=0);

  }

endgroup;


Teach someone to fish, you feed them for a lifetime:

To let you into a secret, I wrote that webinar mainly from just reading the SystemVerilog standard. It is very readable and you can download it for free from the IEEE. (Make sure you select the latest version - older versions must be paid for.)

Mahesh K

unread,
Sep 12, 2023, 9:44:55 AM9/12/23
to EDA Playground, EDA Playground
Thank you, it was helpful

--
You received this message because you are subscribed to the Google Groups "EDA Playground" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eda-playgroun...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eda-playground/686aa295-6c0e-49b0-b295-915d971da8bdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages