代码拉取完成,页面将自动刷新
//+++++++++++++++++++++++++++++++++++++++++++++++++
// DUT With Coverage
//+++++++++++++++++++++++++++++++++++++++++++++++++
module simple_coverage();
logic [7:0] addr;
logic [7:0] data;
logic par;
logic rw;
logic en;
//=================================================
// Coverage Group
//=================================================
covergroup memory @ (posedge en);
address : coverpoint addr {
bins low = {0,50};
bins med = {51,150};
bins high = {151,255};
}
parity : coverpoint par {
bins even = {0};
bins odd = {1};
}
read_write : coverpoint rw {
bins read = {0};
bins write = {1};
}
endgroup
//=================================================
// Instance of covergroup memory
//=================================================
memory mem = new();
//=================================================
// Task to drive values
//=================================================
task drive (input [7:0] a, input [7:0] d, input r);
#5 en <= 1;
addr <= a;
rw <= r;
data <= d;
par <= ^d;
$display ("@%2tns Address :%d data %x, rw %x, parity %x",
$time,a,d,r, ^d);
#5 en <= 0;
rw <= 0;
data <= 0;
par <= 0;
addr <= 0;
rw <= 0;
endtask
//=================================================
// Testvector generation
//=================================================
initial begin
en = 0;
repeat (10) begin
drive ($random,$random,$random);
end
#10 $finish;
end
endmodule
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。