Jump to content

Configuration visibility from transaction(sequence_item) file


Recommended Posts

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...