Jump to content

Recommended Posts

Posted

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.

  • 2 weeks later...
Posted

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

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...