Jump to content

the worthless code in the file uvm_callback.sv?

Recommended Posts

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

          if(m_cb_find(q,cb) == -1) begin
            if(ordering == UVM_APPEND)
      end while(m_t_inst.m_pool.next(obj));



   I want to know whether the red piece is worthless ?



   Thank you in advanced!







Link to comment
Share on other sites

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 ...

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...