How do you get config info into interface?

I have several clocks with randomly generated period lengths in the config class. I would like to pass these clock period values into the interface so I can generate clocks using ‘forever’ in the interface. How do I pass information between config class and interface?

Thank you

In reply to nagesh_s:

You can simply use the config_dg get/set. But consider the static constructs are created earlier than the dynamic components. You have to send an indication from your configuration object to the interface when it can be used.

In reply to nagesh_s:

First, Your wording suggests you have a single interface generating multiple clocks. Depending on what you’re doing, this might not be reusable. You should have an interface that generates either a single clock, or a single clock along with some synchronous divided and/or gated versions. This should then be reused as many times as needed.

The purest solution is probably to create a clock agent that has a clock sequence item that describes how you want the clock(s) to behave. Start that item on the clock sequencer from a sequence in your test.

Or, because that’s a lot of overhead for something this simple, you might add functions to the interface which control what it is doing. Then from a virtual sequence you could directly call these interface functions to change the clock generators behavior.

Agent pros

  • It’s consistent and uniform with other UVM agents.
  • This can be abstracted and hidden in a higher level test bench using a layered sequence.

Agent cons:

  • It’s more code than simply interacting with the interface directly from a virtual sequence.

Direct Interface Access from Virtual Sequence pros:

  • Super simple and less code.

Direct Interface Access from Virtual Sequence cons:

  • Basically the agent’s pro list.