forked from hemanth-VP/SystemVerilog_Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_md.sv
60 lines (37 loc) · 927 Bytes
/
new_md.sv
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
//--------------------------------------------------------------------------------------------
//new_method:
//
//Used to create mailbox. If any argument it will be taken as size of the mailbox.
//
//--------------------------------------------------------------------------------------------
//Transmitter
class A;
int a;
int i;
mailbox m;
function new(mailbox m1);
this.m = m1;
endfunction
task check();
if(m == null)begin:BEGIN_1
$display("Mailbox is not created");
end:BEGIN_1
else
$display("Mailbox is created");
for(i=0;i<3;i++)begin:BEGIN_2
a++;
m.put(a);
$display("Value of a = %0d",a);
end:BEGIN_2
endtask
endclass:A
module tb();
A a1;
mailbox main = new(3);
initial begin:BEGIN_MAIN
a1= new(main);
$display("");
$display("");
a1.check();
end:BEGIN_MAIN
endmodule:tb