-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenv.sv
More file actions
85 lines (61 loc) · 1.62 KB
/
env.sv
File metadata and controls
85 lines (61 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
class env;
virtual fifo_interface vif;
mailbox gen_drv;
mailbox gen_scb;
mailbox mon_scb;
// mailbox drv_scb;
generator gen;
driver drv;
monitor mon;
scoreboard scb;
coverage #(32,32) c ;
event gen_ended;
event scb_ended;
int repeat_count;
int mon_transmitted;
function new(int repeat_count, virtual fifo_interface vif);
gen_drv = new();
gen_scb = new();
mon_scb = new();
// drv_scb=new();
c=new(vif);
this.vif = vif;
this.repeat_count = repeat_count;
gen = new(gen_drv, gen_scb, repeat_count, gen_ended);
drv = new(gen_drv, vif);
mon = new(mon_scb, vif, mon_transmitted);
scb = new(mon_scb, gen_scb, scb_ended, repeat_count, mon_transmitted);
endfunction
task sample_coverage();
forever begin
@(posedge vif.clk);
#1ns;
c.cg.sample();
$display("[%0t] Sampling coverage: data_in = %h", $time, vif.data_in);
end
endtask
task pre_test();
vif.reset();
@(posedge vif.clk);
endtask
task test();
fork
gen.run();
drv.run();
mon.run();
scb.run();
sample_coverage();
join_any
endtask
task post_test();
wait(gen_ended.triggered);
//@(gen_ended);
wait(drv.txns_received == repeat_count && scb.txns_received == repeat_count);
endtask
task run();
pre_test();
test();
post_test();
$finish;
endtask
endclass