Issue in using with clause for bins of a coverpoint

I am using with clause in a bin like this:

typedef bit[1:0]{UPSTREAM_PORT, DOWNSTREAM_PORT} port_name;
coverpoint lcw = lcw.link_command{
                bin lgood = `lgood;
                bin lup = `lup with(cfg.port_name == UPSTREAM_PORT);
                }

Q. Expectation is that bin lup should be only covered for upstream port. I am fetching the expectation but it is giving warning during compile time. WARNING is:- Suspicious constant type for with_expression in bin lup. Why this warning is coming and how o resolve it?

  • I am using questa10.5 which is latest version.

In reply to tech_savvy:
It would help to show correct syntax, and ALL declarations used by that syntax.

I assume port_name was meant to be an enum, and cfg.port_name was meant to be a variable of that type. You need to show us the type for link_command, and the two text macros.

Also, the ‘with’ construct was meant to iterate over all values of the bin type using ‘item’, and that is missing from your declaration.

In reply to dave_59:

Okay @dave_59, I am requoting all.
lgood and lup are macros
→ lcw is handle of a class.
→ link_command is rand bit taken in lcw class.

  • Also, when I am using with (item == UPSTREAM_PORT) then, it is not throwing any warning but it is neither creating bin for LUP in upstream instance nor in downstream instance. That’s why I used cfg.port_name but throwing above mentioned warning though it creates bin as wanted.