Hi,
signal a; → level triggered
queue x[$:3]; → fixed size 3 of queue
I have a level triggered signal, and I want to sample it when it goes from 0->1.
Another thing is, I need to push this signal into the queue whenever it transitions from 0->1.
Previously, I tried pushing it at every clock cycle
@(posedge clk)
if(a==1) x.push_back(1);
Problem here is, if this signal stays high for 10 cycles, I would be pushing 1 into the queue 10 times (which is not what I expect).
Any suggestions on how to push it inside queue when it transitions from 0->1?
Can I use transition coverage here somehow?
Thanks
You can use $rose(a) instead of a==1.
You haven’t really explained how coverage involved in this situation.
I have three signals, one of them is level triggered (a) and two of them are pulse tirggered ( x and y)
I have to cover the scenario where the order of occurence is a=>x=>y, so i am pushing them into the queue, making sure queue size is 3 when I sample and check.
I was not aware about $rose(a) and hence was trying to sample a as separate coverpoint with (0=>1) transition.
Hi Dave, it seems I can’t directly use $rose(a) inside a task.
Wish you would have told me why not.
If you are getting an error message like “Could not determine the clocking event for ‘$rose’.”
Then you need to add an extra argument
$rose(a,@(posedge clk))
Apologies for not explaining the error, however I tried this:
task sample_cov();
forever begin
@(posedge clk)
…
…
…
…
if($rose(a), @(posedge clk), x.psh_back(1);
Error: Use of automatic variables in sampled system functions is not yet implemented.
That is a bummer. Try a different tool or declare a
as static.