Coverpoint bins with clause

Hi i have created a covergroup as shown below,

mem_seq_item mem_item;
  
  ahb_m_seq_item ahb_item;
  
  apb_transfer apb_item;
  
  covergroup cg1;
    ahb_size: coverpoint ahb_item.hsize{bins word = {WORD} with (ahb_item.haddr[1 : 0] == 'b00);
                                        bins def = default;
    }
    ahb_addr : coverpoint ahb_item.haddr{bins incr4_trans = {(in_addr => in_addr + 4 => in_addr + 8 => in_addr +12 )} with (ahb_item.hburst == INCR4);
                                         bins def = default;
      
    }
    ahb_htrans : coverpoint ahb_item.htrans[0] {bins trans = {(NONSEQ => SEQ => SEQ => SEQ)} with ((ahb_item.hburst == INCR4)||(ahb_item.hburst == WRAP4));
                                                bins def = default;
    }
    apb_addr : coverpoint apb_item.paddr{bins start_reg = {0};
                                         bins end_reg = {4};
                                         bins ctrl_reg = {8};
                                         bins def = default;
    }
    apb_data : coverpoint apb_item.pwdata{bins ctrl[4] = {[0 : 3]} with (apb_item.paddr == 'h8);
                                          bins start_addr = {apb_item.pwdata} with (apb_item.paddr == 'h0);
                                          bins end_addr   = {apb_item.pwdata} with (apb_item.paddr == 'h4);
    }
    filt_on : coverpoint l_ctrl_reg[0];
    filter : coverpoint ((mem_item.addr >= l_start_reg) && (mem_item.addr <= l_end_reg));
    ex_on : coverpoint l_ctrl_reg[1];
    filt_cross : cross filt_on,ex_on,filter,mem_item.addr;
  endgroup : cg1

have used with clause for bins filtering but simulator is throwing error and warnings,
i am confused can anyone help,

Error: ** while parsing file included at testbench.sv(74)
** at coverage.sv(31): the specification of 'with' expr in bin 'incr4_trans' is not allowed.
** Error: ** while parsing file included at testbench.sv(74)
** at coverage.sv(35): the specification of 'with' expr in bin 'trans' is not allowed.
** Warning: ** while parsing file included at testbench.sv(74)
** at coverage.sv(43): (vlog-13185) Unexpected constant with_expr in bin 'ctrl' of Coverpoint apb_data.
** Warning: ** while parsing file included at testbench.sv(74)
** at coverage.sv(44): (vlog-13185) Unexpected constant with_expr in bin 'start_addr' of Coverpoint apb_data.
** Warning: ** while parsing file included at testbench.sv(74)
** at coverage.sv(45): (vlog-13185) Unexpected constant with_expr in bin 'end_addr' of Coverpoint apb_data.
** Warning: ** while parsing file included at testbench.sv(74)
** at coverage.sv(28): (vlog-13185) Unexpected constant with_expr in bin 'word' of Coverpoint ahb_size.
End time: 14:28:29 on Feb 06,2024, Elapsed time: 0:00:00
Errors: 2, Warnings: 4

might be because of older sv compilation in simulator

Another way would be to check the error message.

Here’s a hint " Is with clause legal for transitional bins ? "

1 Like

Yeah got it,
thanks,
With clause is illegal for transition bins.