UVM field macros for an associative array of queues with string

Hi all,

I have been trying to see how can we use a `uvm_field macro to create for a string associative array of queues. I need this so I can use the uvm_tree_printer to generate a JSON file for the same.

In reply to rohandbz:

The field macros have some significant limitations and shouldn’t be used.

It is recommended to implement the required transaction methods directly to give the desired results.

In reply to cgales:

Hi cgales,

First, thank you for all the help and answers to many question here!

Second, what about using “Field macros” in uvm_component?
Could we use it?
If yes, what are the benefits of using in uvm_component?
Or if you could kindly provide an example for a use-case?


In reply to Michael54:

The field macros are used to generate the transaction methods in the above referenced cookbook article. Using the field macros removes the requirement for the user to code their own methods. However due to the code inefficiency and inability to handle all data types, we recommend users not use the field macros and code their own methods.

The field macros can also be used for uvm_components, but since components aren’t cloned/copied/compared/recorded/etc. like transactions are, there should be no reason to use any field macros.

In reply to cgales:

Yes, I know that UVM components should not be cloned/copied/compared/recorded/etc.
However, the uvm_component has a Configuration Interface, which has the function: apply_config_settings :

Trying to figure out what is its purpose?
In the description of the function there are some mentions of: `uvm_*_field macros
This what I was trying to point out.
What use cases could require usage of field macros for uvm_component?
I guess we cannot deny its usage for components as we do advise not to use it for uvm objects. Since we are not constructing/deconstructing uvm components many times during run-time.
So there is not much performance penalty…

In reply to Michael54:

The apply_config_settings is an old approach to getting configuration values from the config_db. If you set a variable in the config_db, part of the field macro implementation would be to retrieve that value from the config_db and assign it to the specified variable.

This method isn’t recommended as there are some significant limitations:

  • Only certain datatypes are supported
  • Names had to match
  • The implemention code is inefficient
  • Each variable requires a config_db entry, potentially limiting performance

The recommendation is to use an agent configuration object which encapsulates all the required configuration variables, including the virtual interface handle. You now have one object to pass in the config_db to the component instead of multiple entries.

In reply to cgales:

Thanks for the answer and clarification :)