Quantcast
Channel: UVM Forums RSS Feed
Viewing all articles
Browse latest Browse all 756

CodingStyle: handle name vs create's string name. To match or not?

$
0
0
CodingStyle: handle name vs create's string name.  To match or not to match?
 
What pros, cons, or team rules can you share about whether the string name passed into create should match the handle?
 
i.e. 
 
//1) object declared, with handle name m_xyz_agent
xyz_agent  m_xyz_agent;
 
//2) object created.  what-string-name will you pass in to ::create?   m_xyz_agent or smthg else?
m_xyz_agent = xyz_agent::type_id::create("what-string-name",this);
 
 
When I first started with uvm, I was tripped up a bunch in situations where I confused the handle and the string.  A prime example is in the place of what-string-name below.
uvm_config_db#(uvm_object_wrapper)::set(this,"*.what-string-name.asdf.main_phase", "default_sequence",xyz_seq::type_id::get());
 
 
When different developers use different styles, it can be a headache.
 
So, besides suggesting 'just be consistent', which I fully agree with, what are your preferences, and why?
 
 
thanks,
 
 
Most examples I find have the string name passed to create and the handle match.
(Having them differ does help a newbie understand what is going on a bit better, I believe.)
 

Viewing all articles
Browse latest Browse all 756

Trending Articles