Hi, I want to write for 12 bit signal, using wildcard.
Here is sample code.
module fcov_rate
(
// Clock and Resets
input [12:0] i_rx_config
);
covergroup client_rate;
option.per_instance = 1;
RX_CLIENT_RATE : coverpoint i_rx_config
{
wildcard bins RATE_0 = {12'b????_????_??10};
wildcard bins RATE_1 = {12'b????_????_??01};
wildcard bins RATE_2 = {12'b????_????_01??};
wildcard bins RATE_3 = {12'b????_??01_????};
wildcard bins RATE_4 = {12'b????_01??_????};
wildcard bins RATE_5 = {12'b???1_????_????};
wildcard bins RATE_6 = {12'b??1?_????_????};
wildcard bins RATE_7 = {12'b?1??_????_????};
}
endgroup
client_rate cov_config_inst;
//////////////////////////////////////////////////
initial begin
cov_config_inst = new();
end
endmodule
With this wildcard method, I am able to achieve desired coverage, but let's say if I have 32 bit register and want to write coverage on that, then wildcard will be messy,
I can not use 32'b????....???? (?/X for 32 bits). So, I tried with following code,
module fcov_rate
(
// Clock and Resets
input [31:0] i_tx_config
);
covergroup client_rate;
option.per_instance = 1;
TX_CLIENT_RATE : coverpoint i_tx_config
{
wildcard bins RATE_0 = {i_tx_config[1:0] == 2'b10};
wildcard bins RATE_1 = {i_tx_config[1:0] == 2'b01};
wildcard bins RATE_2 = {i_tx_config[3:2] == 2'b01};
wildcard bins RATE_3 = {i_tx_config[5:4] == 2'b01};
wildcard bins RATE_4 = {i_tx_config[7:6] == 2'b01};
}
endgroup
client_rate cov_config_inst;
//////////////////////////////////////////////////
initial begin
cov_config_inst = new();
end
endmodule
Above code is compile clean, but not able to hit bins.
Is there any other way to just part-select of coverpoint reference.
I know that I can achieve this using multiple coverpoint, but I don't want to write new coverpoint for each case like,
FCOV_TX_CLIENT_RATE : coverpoint i_tx_config[1:0]
{
wildcard bins RATE_0 = {2};
wildcard bins RATE_1 = {1};
}
FCOV_TX_CLIENT_RATE : coverpoint i_tx_config[3:2]
{
wildcard bins RATE_2 = {1};
}
FCOV_TX_CLIENT_RATE : coverpoint i_tx_config[5:4]
{
wildcard bins RATE_3 = {1};
}
Is there any better solution ?