Signal x is a one hot signal of bits 'n' I would like to cover only one hot values of the signal and not interested in other values.
Ex: if a signal x is of 3 bits then I would like does x is reaching below values are not.
x == 3'b001
x == 3'b010
x == 3'b100
I tried below to achieve goal.
struct ABC {
x :uint(bits:n);
event pqrs;
cover pqrs is {
item x using ranges={
range([1]);
range([2]);
range([4]);
};
};
But above code is not elegant since 'n' `define value which can be varied based on environment. Please help me how to write coverage for above case.
Thanking all in advance for your help. Regards, Srikanth
you can write yourself a define-as-computed macro that creates the covergroup. Note that the macro must expand to the full syntactic element, you cannot just create a macro that creates the range expressions. (I have such a macro but cannot disclose it).
Thorsten.