SV and UVM

  1. what is function new()
  2. difference between with arguments and without arguments inside the function new()
  3. what is virtual sequence ?
  4. function and task in verilog and system verilog both are same ?
  1. what is function new() ?
    new() is a constructor which is used to allocate the memory to a class object. and it is also used to intialize the class members with user defined vluues. when you just instantiate a class then it will be just a handle/varable, after that you have to call the new() constructor then memory will be allocated to that particular handle and it will be an object now.
    like: class A;
    int i;
    endclass

    module mohan;
    initial begin
    A a1; //its just a handle or variable you can’t access the class properties by this
    a1=new() //new() is default constructor and now a1 is an object.
    a1.i=10;
    end
    endmodule

  2. difference between with arguments and without arguments inside the function new() ?

if you call new() function without arguement means the class properties will be initialized with their default values.
like in the previous example i just called the new() function without arguement then at that time the class property i will be initialized by their default value 0 for int.

but if you want that when you allocate memory then all the class properties should be initialized by the user defined values then you will give the arguement at the time of new() call, and also write the body of the new() function inside the class.