forked from hemanth-VP/SystemVerilog_Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
handle.sv
35 lines (29 loc) · 874 Bytes
/
handle.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
//...............................................
//handle is just name of the class that is point
//to an object of the class.
//this handle is point to the NULL
//..............................................
class home; //define class
//declare class properties
bit light;
int fan ;
string switch;
//define class method(task/function)
task open_electricity();
switch = "ON";
$display("switch is %s so electricity is open",switch);
endtask:open_electricity
endclass:home
module tb;
//create a handle for a class home that can point to an object
//of the class type home
home h1;
initial begin:BEGIN_I
$display("Let's declare handle");
$display("Check wheather the object is created or not");
if (h1==null)
$display("object is empty");
else
$display("object is not empty");
end:BEGIN_I
endmodule:tb