ankit1
01-23-2008, 01:21 AM
Hi All,
can anybody tell me in below program why it is required to create object of ovm_object?
why it is assigned with packet object ? and what is use of $cast in below program?
location of this function given below:
ovm/ovm-1.0/examples/factory/gen_pkg.sv
--------------------------------------------------------------------------------------------------
virtual function packet get_packet();
packet p;
ovm_object obj;
//use the factory to generate a package
obj = create_object("packet", "p");
//make sure it is a packet
$cast(p, obj);
//randomize it
void'(p.randomize());
return p;
endfunction
--------------------------------------------------------------------------------------------------
regards,
Ankit
can anybody tell me in below program why it is required to create object of ovm_object?
why it is assigned with packet object ? and what is use of $cast in below program?
location of this function given below:
ovm/ovm-1.0/examples/factory/gen_pkg.sv
--------------------------------------------------------------------------------------------------
virtual function packet get_packet();
packet p;
ovm_object obj;
//use the factory to generate a package
obj = create_object("packet", "p");
//make sure it is a packet
$cast(p, obj);
//randomize it
void'(p.randomize());
return p;
endfunction
--------------------------------------------------------------------------------------------------
regards,
Ankit