Jump to content

queue field of uvm_queue is protected


Recommended Posts

Field "queue" of uvm_queue is declared as protected, and it turns out to be limiting the use and reusability of this object. All it does is providing a container for a SV queue, and adds the "protected" restriction.

Could it be changed to public in future releases ?

Thanks.

Link to comment
Share on other sites

Field "queue" of uvm_queue is declared as protected, and it turns out to be limiting the use and reusability of this object. All it does is providing a container for a SV queue, and adds the "protected" restriction.

Could it be changed to public in future releases ?

Thanks.

hi,

for own code you could do something like the code below. i think it would be better to have the set/get variants instead of the direct access.

/uwe

:

program test50;
import uvm_pkg::*;

class my_queue#(type T=int) extends uvm_queue#(T);

typedef T this_type[$];

function new(string name="");
       super.new(name);
endfunction

function this_type get_view();
return queue;
endfunction

function void set_view(ref this_type r);
this.queue = r;
endfunction

endclass

initial begin
       int a[$];
       static my_queue#(int) mq = new();
       a.push_back(4);
       mq.set_view(a);
       a.push_back(5);
       assert (mq.size() == 1);

       mq.push_back(5);
       assert (mq.size() == 2); 

end
endprogram

Edited by uwes
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.

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