Thursday, December 22, 2016

What is the difference between uvm_config_db and uvm_resource_db ?

uvm_config_db is a convenience layer built on top of uvm_resource_db, but that convenience is very important. In particular, uvm_resource_db uses a "last write wins" approach. The uvm_config_db, on the other hand, looks at where things are in the hierarchy up through end_of_elaboration, so "parent wins." Once you start start_of_simulation, the config_db becomes "last write wins."

If a test and an env both set a config_db value during build-time, the test's value will be used because it is higher in the component hierarchy. This is what you would expect.
However, using the uvm_resource_db, since build_phase() is called top-down, the env's build_phase is called after the test's, so the env value would overwrite the test value.
Once start_of_simulation_phase is reached, a write using either the config_db or the resource_db will overwrite whatever is currently in the database for that specific parameter. This is what we mean by "last write wins."

No comments:

Post a Comment