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
| interface my_if();
logic [7:0] some_data;
endinterface
module dut(my_if mif);
initial begin
$monitor($time, " mif.some_data=%2x ",
mif.some_data);
end
endmodule
class class_stimulus;
virtual my_if port_vif;
function new(virtual my_if ports);
this.port_vif = ports;
endfunction
task run_t();
repeat (3) begin
port_vif.some_data = $urandom;
#2;
end
endtask
endclass
program test(my_if this_if);
initial begin
class_stimulus class_stimulus_u = new(this_if);
fork
class_stimulus_u.run_t();
join_none
#122;
$finish;
end
endprogram
module mem_tb();
my_if my_connection();
dut my_dut(.mif(my_connection));
test my_test(.this_if(my_connection));
endmodule
|