UVM: Does setting values to sequence_item before I call start_item(seq_item) cause any issue?

395 views Asked by At

I am setting values to sequence_item before I call start_item(seq_item) any different from setting values after calling start_item(seq_item)?

2

There are 2 answers

0
dave_59 On

Yes, you can do this, but realize that start_item() is a blocking task, so the state of your design and testbench may be different before versus after.

0
Allan Carter On

The main reason for randomizing a seq_item after start_item returns is to enable the transaction to be randomized based on the current state of the machine. If you don't have a dependency on the testbench state, then there is no functional difference.

I think the bigger issue is to use the established pattern of deferred randomization so that all of your code looks the same and so that anyone copying your code as a template (including you) follows the pattern just in case the order does matter.

Consistency in your code will help prevent bugs.