Declare a coverpoint for consecutive signals

Hi,

In case I want to represent a consecutive signal in coverage in Systmverilog let’s say read after read (READ => READ) in a memory.
How is possible to do it in coverage? How can I declare a new coverpoint(consecutive) using another coverpoint (cp_read => cp_read) or this is not acceptable in SV?

cp_read : coverpoint cov_item.read{
bins value0 = {0};
bins value1 = {1};
}
cp_write : coverpoint cov_item.write{
bins value0 = {0};
bins value1 = {1};
}
cp_readafterread : coverpoint .....?
{
  //
}

In reply to Emans:

Look into the SystemVerilog section 19.5.2 which describes the definition of transition bins within a coverpoint.

The “read_after_read” transition bin below would increment if two samples of “1” were seen on the “read” variable back-to-back.

cp_read : coverpoint cov_item.read {
  bins value0 = {0};
  bins value1 = {1};
  bins read_after_read = 1 [* 2];
}

Apologies if the syntax isn’t exactly correct (did not test this) but hopefully enough to get you started.

In reply to jcraft:

Thanks, I took a look into the LRM and what you suggested is a suitable solution to how I should define the back-to-back transaction.

cp_read : coverpoint cov_item.read {
  bins value0 = {0};
  bins value1 = {1};
  bins read_after_read = (1 [* 2]);
}

In reply to jcraft:
but what about the “read after write”?

In reply to liuxiaole:

You can encode read/write into a single coverpoint

cp_op : coverpoint {cov_item.read, cov_item.write} {
   bins read  = {2'b10};
   bins write = {2'b01};
   bins read_after_read = (2'b10 [* 2]);
   bins read_after_write = (2'b10 => 2'b01);
}

In reply to dave_59:

Hi,

Can I use consecutive repetition as you showed, but with a limitless range?
something like:
bins many_read_after_read = (2’b10 [* 3:$]);

it seems like I can’t use the ‘$’ there.