0
`define A 'd1
`define B 'd2
`define C 'd3
`define D 'd4
`define E 'd5
`define F 'd6
`define I 'd7
`define J 'd8

module testModule(input clk,
                        input CReset,
                        input[4;0] Opcode_P0I1,
                        input[4;0] Opcode_P0I2,
                        input[4;0] Opcode_P0I3,
                        input[4;0] Opcode_P0I4,
                        input[4;0] Opcode_P1I1,
                        input[4;0] Opcode_P1I2,
                        input[4;0] Opcode_P1I3,
                        input[4;0] Opcode_P1I4,
                        input P0V,
                        input P1V,
                        input P0IsFe,
                        input P1IsFe,
                        input P0I1PAllow,
                        input P0I2PAllow,
                        input P0I3PAllow,
                        input P0I4PAllow,
                        input P1I1PAllow,
                        input P1I2PAllow,
                        input P1I3PAllow,
                        input P1I4PAllow,
                        input I1VT0,
                        input I1VT1,
                        input I1VT2,
                        input I1VT4,
                        input I2VT0,
                        input I2VT1,
                        input I2VT2,
                        input I2VT3,
                        input I3VT0,
                        input I3VT1,
                        input I3VT2,
                        input I3VT3,
                        input I4VT0,
                        input I4VT1,
                        input I4VT2,
                        input I4VT3,
                        input[3:0] P0TId,
                        input[3:0] P1TId);
covergroup cg_Abc @(posedge clk);
    option.per_instance = 1;
    cp_P0I1_IsSquare: coverpoint Opcode_P0I1 iff (P0V == 1 && P0IsFe == 1 && P0I1PAllow == 1 && (I1VT0 && P0TId == 2**0  || I1VT1 && P0TdId == 2**1 || I1VT2 && P0TId == 2**2 || I1VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P0I2_IsSquare: coverpoint Opcode_P0I2 iff (P0V == 1 && P0IsFe == 1 && P0I2PAllow == 1 && (I2VT0 && P0TId == 2**0  || I2VT1 && P0TdId == 2**1 || I2VT2 && P0TId == 2**2 || I2VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P0I3_IsSquare: coverpoint Opcode_P0I3 iff (P0V == 1 && P0IsFe == 1 && P0I3PAllow == 1 && (I3VT0 && P0TId == 2**0  || I3VT1 && P0TdId == 2**1 || I3VT2 && P0TId == 2**2 || I3VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P0I4_IsSquare: coverpoint Opcode_P0I4 iff (P0V == 1 && P0IsFe == 1 && P0I4PAllow == 1 && (I4VT0 && P0TId == 2**0  || I4VT1 && P0TdId == 2**1 || I4VT2 && P0TId == 2**2 || I4VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P1I1_IsSquare: coverpoint Opcode_P1I1 iff (P1V == 1 && P1IsFe == 1 && P1I1PAllow == 1 && (I1VT0 && P1TId == 2**0  || I1VT1 && P1TdId == 2**1 || I1VT2 && P1TId == 2**2 || I1VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P1I2_IsSquare: coverpoint Opcode_P1I2 iff (P1V == 1 && P1IsFe == 1 && P1I2PAllow == 1 && (I2VT0 && P1TId == 2**0  || I2VT1 && P1TdId == 2**1 || I2VT2 && P1TId == 2**2 || I2VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P1I3_IsSquare: coverpoint Opcode_P1I3 iff (P1V == 1 && P1IsFe == 1 && P1I3PAllow == 1 && (I3VT0 && P1TId == 2**0  || I3VT1 && P1TdId == 2**1 || I3VT2 && P1TId == 2**2 || I3VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}
    cp_P1I4_IsSquare: coverpoint Opcode_P1I4 iff (P1V == 1 && P1IsFe == 1 && P1I4PAllow == 1 && (I4VT0 && P1TId == 2**0  || I4VT1 && P1TdId == 2**1 || I4VT2 && P1TId == 2**2 || I4VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins derp = {`A,`B,`C};}

    cp_P0I1_IsCircle: coverpoint Opcode_P0I1 iff (P0V == 1 && P0I1PAllow == 0 && (I1VT0 && P0TId == 2**0  || I1VT1 && P0TdId == 2**1 || I1VT2_DE2 && P0TId == 2**2 || I1VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P0I2_IsCircle: coverpoint Opcode_P0I2 iff (P0V == 1 && P0I2PAllow == 0 && (I2VT0 && P0TId == 2**0  || I2VT1 && P0TdId == 2**1 || I2VT2_DE2 && P0TId == 2**2 || I2VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P0I3_IsCircle: coverpoint Opcode_P0I3 iff (P0V == 1 && P0I3PAllow == 0 && (I3VT0 && P0TId == 2**0  || I3VT1 && P0TdId == 2**1 || I3VT2_DE2 && P0TId == 2**2 || I3VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P0I4_IsCircle: coverpoint Opcode_P0I4 iff (P0V == 1 && P0I4PAllow == 0 && (I4VT0 && P0TId == 2**0  || I4VT1 && P0TdId == 2**1 || I4VT2_DE2 && P0TId == 2**2 || I4VT3 &&  P0TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P1I1_IsCircle: coverpoint Opcode_P1I1 iff (P1V == 1 && P1I1PAllow == 0 && (I1VT0 && P1TId == 2**0  || I1VT1 && P1TdId == 2**1 || I1VT2 && P1TId == 2**2 || I1VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P1I2_IsCircle: coverpoint Opcode_P1I2 iff (P1V == 1 && P1I2PAllow == 0 && (I2VT0 && P1TId == 2**0  || I2VT1 && P1TdId == 2**1 || I2VT2 && P1TId == 2**2 || I2VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P1I3_IsCircle: coverpoint Opcode_P1I3 iff (P1V == 1 && P1I3PAllow == 0 && (I3VT0 && P1TId == 2**0  || I3VT1 && P1TdId == 2**1 || I3VT2 && P1TId == 2**2 || I3VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}
    cp_P1I4_IsCircle: coverpoint Opcode_P1I4 iff (P1V == 1 && P1I4PAllow == 0 && (I4VT0 && P1TId == 2**0  || I4VT1 && P1TdId == 2**1 || I4VT2 && P1TId == 2**2 || I4VT3 &&  P1TId == 2**3)) {option.weight = 0;type_option.weight = 0; bins bxx = {`D,`E,`F,`G,`H,`I,`J};}

    cr_P0I1I2_IsSqauarexIsCircle : cross cp_P0I1_IsSquare,cp_P0I2_IsCircle{option.weight = 0;type_option.weight = 0;}
    cr_P0I2I3_IsSqauarexIsCircle : cross cp_P0I2_IsSquare,cp_P0I3_IsCircle{option.weight = 0;type_option.weight = 0;}
    cr_P0I3I4_IsSqauarexIsCircle : cross cp_P0I3_IsSquare,cp_P0I4_IsCircle{option.weight = 0;type_option.weight = 0;}
    AggregateCov1 : ?

    cr_P1I1I2_IsSqauarexIsCircle : cross cp_P1I1_IsSquare,cp_P1I2_IsCircle{option.weight = 0;type_option.weight = 0;}
    cr_P1I2I3_IsSqauarexIsCircle : cross cp_P1I2_IsSquare,cp_P1I3_IsCircle{option.weight = 0;type_option.weight = 0;}
    cr_P1I3I4_IsSqauarexIsCircle : cross cp_P1I3_IsSquare,cp_P1I14_IsCircle{option.weight = 0;type_option.weight = 0;}
    AggregateCov2 : ?
  endgroup
  cg_Abc cg_Abc_inst = new();
endmodule

I am looking for AggregateCov1 which tells if any of cr_P0I1I2_IsSqauarexIsCircle,cr_P0I2I3_IsSqauarexIsCircle,cr_P0I3I4_IsSqauarexIsCircle is a hit. Essentially meaning I have at least one square and a circle adjacent to each other in the group [Opcode_P0I1,Opcode_P0I2,Opcode_P0I3,Opcode_P0I4].

Also looking for AggregateCov2 which tells if I have at least one square and a circle adjacent to each other in the group [Opcode_P0I1,Opcode_P0I2,Opcode_P0I3,Opcode_P0I4] or [Opcode_P1I1,Opcode_P1I2,Opcode_P1I3,Opcode_P1I4]

Sparsh Gupta
  • 41
  • 11

2 Answers2

0

There is no need to do this as you need to hit the AND of all coverpoints a,b,c to get 100% coverage of this covergroup.

But if you insist, you can use a coverpoint expression

AggregateCoverpoint: coverpoint v_a | v_b | v_c;
dave_59
  • 30,490
  • 3
  • 22
  • 48
  • Hi Dave, I don't want to use the expression v_a and so forth because they are actually sampled @ iff condition which essentially is different for all of them. I have made edits to better represent my problem. I would ideally like to use 'a','b','c' to create a seperate coverpoint and I want to avoid combining those conditions. – Sparsh Gupta Mar 08 '19 at 19:46
  • I'll ask again why you need to do this. It will not collect anymore coverage unless the `iff` conditions are different. You'll need to explain with some sample values. – dave_59 Mar 08 '19 at 20:40
  • Essentially the requirement is to verify that along an array adjacent items are of 2 different types. For instance, at posedge clk array[i] is of type 1 detected by 'a' and array[j] if of type 2. Now, I need to do this over the whole array say of length 4. So 3 items which check the same. But overall I want to qualify that along the array, I have type1 followed by type2. If this happens even once I want to report 100%. – Sparsh Gupta Mar 08 '19 at 20:54
  • That is a lot of additional information that was not in the original question, and still probably not enough. Think of creating an mcve that generates the data you want to check without thinking about the covergroup syntax. https://stackoverflow.com/help/mcve – dave_59 Mar 09 '19 at 04:33
  • I have changed the original description and added a code barebone, Does that help? – Sparsh Gupta Mar 12 '19 at 16:06
  • You just replicated the existing code. Give us example bins and conditions we can work with. Please read https://stackoverflow.com/help/mcve – dave_59 Mar 12 '19 at 16:41
  • Changed code.Added condition and bins. Like I had mentioned just 1 bin. – Sparsh Gupta Mar 12 '19 at 17:54
0

Using assign statements to create new wires, makes this problem go away.

Sparsh Gupta
  • 41
  • 11