1.

How To Check Weather A Handles Is Holding Object Or Not ?

Answer»

It is BASICALLY checking if the object is INITIALIZED or not. In SystemVerilog all uninitialized object handles have a special value of null, and therefore whether it is holding an object or not can be found out by comparing the object handle to null. So the code will LOOK like:-

01.usb_packet My_usb_packet;
02....
03.if(My_usb_packet == null) begin
04.// This loop will GET exited if the handle is not holding any object
05.....
06.end else begin
07.// Hurray ... the handle is holding an object
08....
09.end

It is basically checking if the object is initialized or not. In SystemVerilog all uninitialized object handles have a special value of null, and therefore whether it is holding an object or not can be found out by comparing the object handle to null. So the code will look like:-

01.usb_packet My_usb_packet;
02....
03.if(My_usb_packet == null) begin
04.// This loop will get exited if the handle is not holding any object
05.....
06.end else begin
07.// Hurray ... the handle is holding an object
08....
09.end



Discussion

No Comment Found