Jump to content

[ubus example] is there a redundant uvm_config_db::get in ubus_env? (num_masters)

Recommended Posts

In the UVM1.1/a Release's ubus example, "uvm_config_db::get num_slaves and num_masters." are used to factory the multiple masters and slaves agents as high layer scenarios required.

In ubus_env.sv

void'(uvm_config_db#(int)::get(this, "", "num_masters", num_masters));

masters = new[num_masters];

for(int i = 0; i < num_masters; i++) begin

$sformat(inst_name, "masters[%0d]", i);

masters = ubus_master_agent::type_id::create(inst_name, this);


"master_id", i));


"master_id", i));


void'(uvm_config_db#(int)::get(this, "", "num_slaves", num_slaves));

slaves = new[num_slaves];

for(int i = 0; i < num_slaves; i++) begin

$sformat(inst_name, "slaves[%0d]", i);

slaves = ubus_slave_agent::type_id::create(inst_name, this);


in the test_lib.sv

// 2 Master, 4 Slave test

class test_2m_4s extends ubus_example_base_test;


function new(string name = "test_2m_4s", uvm_component parent=null);


endfunction : new

virtual function void build_phase(uvm_phase phase);

loop_read_modify_write_seq lrmw_seq;


// Overides to the ubus_example_tb build_phase()

// Set the topology to 2 masters, 4 slaves


"num_masters", 2);


"num_slaves", 4);

// Control the number of RMW loops

uvm_config_db#(int)::set(this,"ubus_example_tb0.ubus0.masters[0].sequencer.loop_read_modify_write_seq", "itr", 6);

uvm_config_db#(int)::set(this,"ubus_example_tb0.ubus0.masters[1].sequencer.loop_read_modify_write_seq", "itr", 8);

// Define the sequences to run in the run phase




lrmw_seq = loop_read_modify_write_seq::type_id::create();





for(int i = 0; i < 4; i++) begin

string slname;

$swrite(slname,"ubus_example_tb0.ubus0.slaves[%0d].sequencer", i);

uvm_config_db#(uvm_object_wrapper)::set(this, {slname,".run_phase"},




// Create the tb



endfunction : build_phase

Link to comment
Share on other sites

Yes. I think this *get* just wants to give user an example for uvm_config_db*set/get explicit usage in ubus example, but uvm factory already did as implicit way.

For new user , they need understand both ways in this example.

This is why it didn't judge whether the uvm_config_db::get is successful or not, like "if(!uvm_config_db)". It just used "void'*" here.

void'(uvm_config_db#(int)::get(this, "", "num_masters", num_masters));

Link to comment
Share on other sites

yes you are right and this "get" feature is also illustrated by getting the vif between lines nearby in the same file (ubus_env.sv). what I want to address is some member writes many redundant code in his project just because he misleaded by this example and is not aware that factory did this already.

Link to comment
Share on other sites

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.

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