Jump to content

Why is the ~item~ member of uvm_simple_sequence qualified rand?


Recommended Posts

hi,

In uvm_sequence_builtin.svh we find that uvm_simple_sequence has

protected rand uvm_sequence_item item;
The fact that item is rand causes VCS to issue a warning when a simple_sequence is randomized, because at that time (in method uvm_sequence_base::do_sequence_kind) the item is null. Incidentally, this same issue was reported on the OVM forum a while back in this thread by someone using OVM with VCS, but the root cause was not identified in that discussion.

I suspect the rand qualifier is superfluous. uvm_simple_sequence::body() will randomize the item by an explicit call to item.randomize. Generally, when a sequence has members that are items or subsequences it's correct for them not to be rand, and to allow the randomization to be handled by uvm_do calls in the body method.

Is there some special reason why the simple_sequence's item member is rand? If not, can we log this as a (minor) bug and get it changed?

Thanks

Edited by JonathanBromley
Link to comment
Share on other sites

Hi Jonathan,

We fixed this problem by adding

item = new;
to the uvm_simple_sequence constructor in the UVM library that we use. My personal opinion is that it can be a good idea to create sequence items in sequence constructors rather than by calling `uvm_do in the sequence body (which would use the other sequence macros to re-randomize and send the sequence item). However, in this case, I think that your proposal is a better fix.

Best Regards,

Dave

Link to comment
Share on other sites

Hi Jonathan,

We fixed this problem by adding

item = new;
to the uvm_simple_sequence constructor in the UVM library that we use. My personal opinion is that it can be a good idea to create sequence items in sequence constructors rather than by calling `uvm_do in the sequence body (which would use the other sequence macros to re-randomize and send the sequence item). However, in this case, I think that your proposal is a better fix.

Best Regards,

Dave

But why is <item> a member of uvm_simple_sequence in the first place (and not a local variable in the body method)? Declaring <item> as a protected member seems to indicate that it exists for use by a derived class, but is this indeed the intention and what advantage does this bring?

Regards,

Erling

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