1 Star 0 Fork 0

haorui/my_fcov

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
simple_coverage.sv 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
haorui 提交于 2021-06-29 09:52 . add
//+++++++++++++++++++++++++++++++++++++++++++++++++
// 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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/haoanqi/my_fcov.git
git@gitee.com:haoanqi/my_fcov.git
haoanqi
my_fcov
my_fcov
master

搜索帮助