Jump to content

Recommended Posts

Totally disagree with the above answer. The best is to use the macros.

 

Religion aside for a second, it all depends on the situation:

 

If you want to create a sequence on a sequencer, randomize it, and send it, then `uvm_do does all that for you. 

 

If you want to create a sequence, set some values inside of it, and then send it, then the combination of `uvm_create and `uvm_send is best.

 

If you need constraints, use the _with macros. If it's on another sequencer, use the _on macros. Mix and match as appropriate.

 

As for whether to use macros or not, I agree that it's best to know what they all do under the hood. However, macros always have two benefits:

 

1. They reduce the amount of code that you have to type, which reduces the number of mistakes you need to debug.

2. If the underlying code of the macros is later improved, you don't need to change any code anywhere at any time. You get the improvements for free.

Link to comment
Share on other sites

On the other hand, in order to use the macros correctly, you must learn what each of the macros does. Depending on whether you are using these for sequence_item's (transactions) or sub-sequences, there are only three or four basic steps in either one. Since the experts disagree, we suggest you learn both ways and only once you fully appreciate the differences make a selection. If you don't learn both ways, you may find yourself confused when you stumble over code written by somebody else.

Link to comment
Share on other sites

By "best", I believe you mean the "best method for someone who is new to UVM".

 

As someone who has been using UVM for a few years, but is still pretty green with it, here are my thoughts.

 

Avoid the `uvm_do macros until you can comfortably work without them.  (And in my case, I still don't use them.  In my early UVM days, they just led to a lot of confusion for me, as I looked at examples of the different ways to do things.)

 

I found that sticking with the following got me going when I was floundering in the assorted examples online showing different ways to send sequences.

  `uvm_create(item)

   start_item(item);                             

   // randomize item and/or assign to it here.

   finish_item(item);

 

 

I strongly agree with the following.

"The [‘uvm_do] macros also obscure a very simple interface for

executing sequences and sequence items. Although 18 in

number, they are inflexible and provide a small subset of the

possible ways of executing. If none of the [‘uvm_do] macro

flavors provide the functionality you need, you will need to

learn how to execute sequences without the macros. And once

you’ve learned that, you might as well code smartly and avoid

them all together. "


 

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