How do we identity NULL Handles?

During the building up of  SystemVerilog Environment sometimes we end in facing NULL Pointer error.

Question is how do we identify the issue ?

Let us look at one small example and analyze.

e.g

                 module test;
                        class       animal;
                               int   age;
                        endclass
                         animal      a_h;      //  class handle pointer
                         initial   begin
                                    a_h.age  =  52;
                                    a_h         = new();
                          end
                      endmodule

****      Here we forgot to call the new() for class animal handle (a_h) 
            before accessing its objects. 
****      Since the Class handle was not created it created NULL Handle issue.
*****    By reversing the handle creation and assignment, we can get ride of 
           NULL pointer issue.
                           

Comments

Popular posts from this blog

How Disable Constraints in SystemVerilog

What is Class based Randomization and how do we define ?

How to define a Cyclic Randomization in SystemVerilog