Best way to randomize from virtual sequence

In reply to Phill_Ferg:

Nothing wrong with discussing the advantages and disadvantages of coding styles as there are many different ways of accomplishing the same thing. Our recommendations come from our experiences with customers around the world involving all different complexities of verification environments, so we try to provide something that works well with all users.

With respect to creating a new sequence item with every call, the amount of memory used shouldn’t change, although this would be simulator dependent with how and when garbage collection is performed. The main benefit with creating only one sequence item and reusing it comes from the performance overhead required for each item. If you are doing single transactions, then there is no difference. However, we see customers doing loops of thousands of transactions. In this case, there can be a measurable performance impact.

As you mentioned, a completely self-contained randomizable environment is ideal, but new customers who don’t understand this concept will utilize UVM in a directed-type methodology. This results in sequences with many specific constraints which are better applied without the overhead of a randomize() call.

Overall, it is up to the user to determine which approach they desire to use. It is easier to start out with the explicit generation and make minor changes than it is to start with the macros and then realize that you will need to re-factor at a later date to make a small change.