suleesh Posted November 26, 2010 Report Share Posted November 26, 2010 (edited) Hi, I has a testbench based on OVM2.0 . i am connverting it to UVM now. I am having a problem with create_object() function. My OVM code is like the following class MBfm_seq_item extends ovm_sequence_item; `ovm_object_utils (MBfm_seq_item) MasterTransaction dataTransObj; function new (string name = "MBfm_seq_item"); super.new(name); $cast(dataTransObj, ovm_factory::create_object("MasterTransaction","dataTransObj")); endfunction: new endclass: MBfm_seq_item Here, MasterTransaction is extended from ovm_transcatiom I converted it to UVM code as follows class MBfm_seq_item extends uvm_sequence_item; `uvm_object_utils (MBfm_seq_item) MasterTransaction dataTransObj; function new (string name = "MBfm_seq_item"); super.new(name); $cast(dataTransObj, uvm_factory::create_object("MasterTransaction","dataTransObj")); endfunction: new endclass: MBfm_seq_item Then its giving the error "Failed to find name 'create_object' in specified scope" for the line $cast(dataTransObj, uvm_factory::create_object("MasterTransaction","dataTransObj")); I tried with the following too $cast(dataTransObj,create_object("MasterTransaction","dataTransObj")); Then its giving an error "Dotted name ('create_object') not found in current scope. Note that hierarchical references are not allowed from within a package or $unit.' Can somebody help me to solve this problem? Thanks Suleesh Edited August 1, 2011 by suleesh Quote Link to comment Share on other sites More sharing options...
cgales Posted November 26, 2010 Report Share Posted November 26, 2010 The ovm_factory::create_object() method was deprecated in OVM 2.0.1, and removed in the UVM release. I would recommend transitioning first to OVM 2.1.1 to ensure that you are using the latest OVM methodologies, and then use the OVM-UVM conversion script to migrate to UVM. While it may not work perfectly, it might help in identifying the deprecated features. Quote Link to comment Share on other sites More sharing options...
nndad Posted November 29, 2010 Report Share Posted November 29, 2010 Just use the factory function class_type::type_id::create("object_name") Quote Link to comment Share on other sites More sharing options...
uwes Posted November 30, 2010 Report Share Posted November 30, 2010 its much better to use the type based factory api instead of the string based one (you get compile time checking for instance) sometype somefield; somefield = sometype::type_id::create("somelogicalname"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.