wuddi Posted September 18, 2012 Report Posted September 18, 2012 Hi UVM experts, I want to use members of configuration object in transaction file and there is an example below, How can transaction access to configuration object? (I have use uvm_config_db::set to put my_cfg into resourse database, but I'm confused about how and when to use uvm_config_db::get to get my_cfg information from database.) class my_cfg extends uvm_object; typedef enum { DATA_WIDTH_8, DATA_WIDTH_16, DATA_WIDTH_32 } data_width_enum; rand data_width_enum data_width = DATA_WIDTH_8; `uvm_object_utils_begin(my_cfg) ...... function new (string name = "my_cfg"); ...... endclass class my_trans extends uvm_object; my_cfg cfg; rand bit [31:0] data; constraint reasonable_data { (cfg.data_width == DATA_WIDTH_8) -> data[31:8] ==0 ; (cfg.data_width == DATA_WIDTH_16) -> data[31:16] ==0; } `uvm_object_utils_begin(my_trans) ...... function new (......); ...... endclass Thanks. Quote
petermonsson Posted September 28, 2012 Report Posted September 28, 2012 Hi, In UVM a configuration is meant to apply to a component, not an object. I believe that you should try to use a sequence with your transaction. In a way, one could say that a sequence is to a transaction what a configuration is to a component: cfg -> driver seq -> transaction I hope this helps Peter Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.