How do we access class objects and properties

An class object properities are accessed with the handle and dot operator(.)
e.g

     module top();
      
            class animal;
                 int      age;
                 string name;
            endclass

            animal   a_h ;       // create handle to animal object

            initial begin
                  a_h             = new();
                  a_h.name        = "Tiger";
                  a_h.age         = 10;
           end

endmodule

Comments

Popular posts from this blog

What is Class based Randomization and how do we define ?

How Disable Constraints in SystemVerilog

How do we define Weighted Distribution Constraint in SystemVerilog