qinhailiang Posted January 17, 2014 Report Share Posted January 17, 2014 Hi, all There is a piece of code in the function m_add_tw_cbs of the uvm_typed_callbacks#(type T=uvm_object) of the file uvm_callback.sv as follow: if(m_t_inst.m_pool.first(obj)) begin do begin if($cast(me,obj)) begin q = m_t_inst.m_pool.get(obj); if(q==null) begin q=new; m_t_inst.m_pool.add(obj,q); end if(m_cb_find(q,cb) == -1) begin if(ordering == UVM_APPEND) q.push_back(cb); else q.push_front(cb); end end end while(m_t_inst.m_pool.next(obj)); end I want to know whether the red piece is worthless ? Thank you in advanced! BR QIN Quote Link to comment Share on other sites More sharing options...
uwes Posted January 17, 2014 Report Share Posted January 17, 2014 at the first glance this code isnt useless. if obj isnt part of m_t_inst.m_pool (and obj is of a class type) then the pool returns "null" as indication that no object with key "obj" did exist in the pool. if missing its added to the pool. on the second thought the whole code is an iterator over the m_pool key set - so there is an entry for each key. but yet the entry could be "null" through a m_pool.add(key,null) ... i'm not sure if this is scenario is valid ... Quote Link to comment Share on other sites More sharing options...
qinhailiang Posted January 18, 2014 Author Report Share Posted January 18, 2014 when the m_pool.add(obj, q) is called by the function add(T obj, uvm_callback cb, uvm_apprepend ordering=UVM_APPEND) in the class uvm_callbacks #(type T=uvm_object, type CB=uvm_callback), if q (i.e the entry you said) is null, the q will be newed, i.e the q (the entry) is not null. 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.