-1

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)?

toolic
  • 57,801
  • 17
  • 75
  • 117
shicky
  • 1,193
  • 14
  • 21

2 Answers2

0

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.

dave_59
  • 39,096
  • 3
  • 24
  • 63
0

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.