Multi master

hi all,
i am implementing multi master and multi slave configuration.

in the test bench , i am calling driver’s assign function of two master agents.and both agents are of same type.

env0.a_master1.driver.assign_vif(if_port1, if_top, if_master1);
env0.a_master.driver.assign_vif(if_port, if_top, if_master);

my query is how ovm will decides which driver’s assign function should be called.
or
we can say that … how drivers are linked with their master agent?
and both master agents are of same type that is :

a_ovm_master_agent a_master , a_master1 ;

regards
saurabh jain

Saurabh,
The hierarchical path of the driver instance (i.e., env0.a_master1.driver and env0.a_master.driver) uniquely specifies which assign_vif function is called.

hi ,
my query is ,if i am having two drivers that is :

class driver1 extends ovm_driver#(ovm_master_trans);

virtual function void assign_vif(
virtual interface nvs_axi_ovm_port_if vif_port ,
virtual interface nvs_axi_ovm_top_if vif_top ,
virtual interface nvs_axi_ovm_master_if vif_master
);

endfunction : assign_vif
endclass

and second driver is :

class driver2 extends ovm_driver#(ovm_master_trans);

virtual function void assign_vif(
virtual interface nvs_axi_ovm_port_if vif_port ,
virtual interface nvs_axi_ovm_top_if vif_top ,
virtual interface nvs_axi_ovm_master_if vif_master
);

endfunction : assign_vif
endclass

and if i calls assign function of these two driver by the statement below:

env0.a_master1.driver.assign_vif(if_port1, if_top, if_master1);
env0.a_master.driver.assign_vif(if_port, if_top, if_master);

then how will ovm decide which driver’s assign function should be called.

Do i need to write something in the drivers , that is driver1 and driver2 which will ensure that “driver1” is for “a_master1” agent and “driver2” is for “a_master” agent.because both master agents are of same type that is :

class axi_env extends ovm_env;
a_ovm_master_agent a_master , a_master1 ;

virtual function void build();
a_master =a_ovm_master_agent::type_id::create(“a_master”,this);
a_master1=a_ovm_master_agent::type_id::create(“a_master1”,this);
endfunction

endclass

regards
saurabh jain

Saurabh,
I’m still not clear about your question. What does the agent code look like? Which driver do you declare in the agent code? Also, what is the reason that you want to have 2 different types of driver but only 1 type of agent? If I understand a little bit more about what you are trying to do, perhaps, I can suggest a solution :)

hi,

this is my environment :

class axi_env extends ovm_env;
axi_ovm_master_agent a_master,a_master1 ; //master agents
axi_ovm_slave_agent a_slave,a_slave1 ; // slave agents

// create two master and slave agents
virtual function void build();
super.build();
a_master = axi_ovm_master_agent::type_id::create(“a_master”, this);
a_master1 = axi_ovm_master_agent::type_id::create(“a_master1”, this);
a_slave = axi_ovm_slave_agent::type_id::create(“a_slave”, this);
a_slave1 = axi_ovm_slave_agent::type_id::create(“a_slave1”, this);
endfunction : build
endclass

MASTER AGENT
class axi_ovm_master_agent extends ovm_agent;

axi_ovm_master_sequencer             sequencer;
axi_ovm_master_driver                driver   ;
axi_ovm_master_monitor               monitor  ;

virtual function void build();
super.build();
driver=axi_ovm_master_driver::type_id::create(“driver”,this);
sequencer=axi_ovm_master_sequencer::type_id::create(“sequencer”,this);
monitor=axi_ovm_master_monitor::type_id::create(“monitor”,this);
endfunction : build
endclass

driver , sequencer and monitor will be created for both master agents by the above code.
FIRST SEQUENCER
class axi_ovm_master_sequencer extends ovm_sequencer #(axi_ovm_master_trans);

`ovm_sequencer_utils(axi_ovm_master_sequencer)

function new(string name, ovm_component parent);
super.new(name,parent);
`ovm_update_sequence_lib_and_item(axi_ovm_master_trans)
endfunction : new
endclass : nvs_axi_ovm_master_sequencer
SECOND SEQUENCER
class axi_ovm_master_sequencer1 extends ovm_sequencer #(axi_ovm_master_trans);

`ovm_sequencer_utils(nvs_axi_ovm_master_sequencer1)

function new(string name, ovm_component parent);
super.new(name,parent);
`ovm_update_sequence_lib_and_item(axi_ovm_master_trans)
endfunction : new
endclass : nvs_axi_ovm_master_sequencer1

and the drivers are :

class axi_ovm_master_driver extends ovm_driver #(axi_ovm_master_trans);
axi_ovm_master_trans item;

task run;
seq_item_port.get_next_item(item);
send_to_dut(item);
seq_item_port.item_done();
endtask
endclass

class axi_ovm_master_driver1 extends ovm_driver #(axi_ovm_master_trans);
axi_ovm_master_trans item;

task run;
seq_item_port.get_next_item(item);
send_to_dut(item);
seq_item_port.item_done();
endtask
endclass

**so my query is

  1. where should i connect “axi_ovm_master_sequencer” with “axi_ovm_master_driver”
    and “axi_ovm_master_sequencer1” with “axi_ovm_master_driver1”.

  2. how can i associate “a_master” agent with “axi_ovm_master_driver” and “axi_ovm_master_sequencer”.
    and
    “a_master1” agent with “axi_ovm_master_driver1” and “axi_ovm_master_sequencer1”.**

please give syntax

regards
saurabh jain

HI,

With the code provided by you, u are creating by default the both a_master & a_master1 of type axi_ovm_master_agent. The class axi_ovm_master_agent has instantiations of axi_ovm_master_sequencer and axi_ovm_master_driver. So by default for driver will be of type axi_ovm_master_driver & sequencer will be of type axi_ovm_master_sequencer. So both a_master & a_master1 instances will have driver of type axi_ovm_master_driver & sequencer of type axi_ovm_master_sequencer.

If u want to have master which consists of driver1 & Sequencer1, then create another agent and instantiate driver1 & sequencer1. Use this agent to to create master1.

Otherwise Use OVM Factory concept.

hi ,
will you please tell me… how OVM factory concept will be implemented here.

regards

saurabh jain

Saurabh,

In your case, it makes more sense to create another master type (as vishnuprasanth explained in his message). To use the factory, you will need to have your axi_ovm_master_driver1 extend from axi_ovm_master_driver (not ovm_driver), and your axi_ovm_master_sequencer1 extend from axi_ovm_master_sequencer. The factory is most useful for situation where you want to modify the behavior of an existing verification environment, which have been fully tested, and you don’t want to touch the existing code of that environment.

For more info on the factory concept, you can look at the OVM User guide. There is also a simple factory example in the examples directory of the OVM package.

hi,

i want there should be two master agents in my env. and each master agent should have its own sequencer and own driver .

and both sequencer should generate sequences for its driver simultaneously.
two master agent should work simultaneously.

how can i implement this?
please do reply…

regards
saurabh jain

hi ,
I have sorted out the problem to some extent .
the code i have provided is somewhat wrong so i am giving the new code

this is my environment :

class axi_env extends ovm_env;
axi_ovm_master_agent a_master,a_master1 ; //master agents
axi_ovm_slave_agent a_slave,a_slave1 ; // slave agents

// create two master and slave agents
virtual function void build();
super.build();
a_master = axi_ovm_master_agent::type_id::create(“a_master”, this);
a_master1 = axi_ovm_master_agent::type_id::create(“a_master1”, this);
a_slave = axi_ovm_slave_agent::type_id::create(“a_slave”, this);
a_slave1 = axi_ovm_slave_agent::type_id::create(“a_slave1”, this);
endfunction : build
endclass

MASTER AGENT
class axi_ovm_master_agent extends ovm_agent;

 axi_ovm_master_sequencer             sequencer;
 axi_ovm_master_driver                driver   ;
 axi_ovm_master_monitor               monitor  ;

virtual function void build();
super.build();
driver=axi_ovm_master_driver::type_id::create(“driver”,this);
sequencer=axi_ovm_master_sequencer::type_id::creat e(“sequencer”,this);
monitor=axi_ovm_master_monitor::type_id::create(“monitor”,this);
endfunction : build
endclass

driver , sequencer and monitor will be created for both master agents by the above code.
FIRST SEQUENCER
class axi_ovm_master_sequencer extends ovm_sequencer #(axi_ovm_master_trans);

`ovm_sequencer_utils(axi_ovm_master_sequencer)

function new(string name, ovm_component parent);
super.new(name,parent);
`ovm_update_sequence_lib_and_item(axi_ovm_master_t rans)
endfunction : new
endclass : nvs_axi_ovm_master_sequencer
SECOND SEQUENCER
class axi_ovm_master_sequencer extends ovm_sequencer #(axi_ovm_master_trans);

`ovm_sequencer_utils(axi_ovm_master_sequencer)

function new(string name, ovm_component parent);
super.new(name,parent);
`ovm_update_sequence_lib_and_item(axi_ovm_master_trans)
endfunction : new
endclass : nvs_axi_ovm_master_sequencer

and the drivers are :
FIRST DRIVER
class axi_ovm_master_driver extends ovm_driver #(axi_ovm_master_trans);
axi_ovm_master_trans item;

task run;
seq_item_port.get_next_item(item);
send_to_dut(item);
seq_item_port.item_done();
endtask
endclass

SECOND DRIVER
class axi_ovm_master_driver extends ovm_driver #(axi_ovm_master_trans);
axi_ovm_master_trans item;

task run;
seq_item_port.get_next_item(item);
send_to_dut(item);
seq_item_port.item_done();
endtask
endclass

as by the above code , i think class name of both drivers and both sequencer should be same .
becase drivers and sequencers are of same type for “a_master” and “a_master1” agent

my query is:
how can first sequencer and first driver be linked with "a_master’ agent and second sequencer and second driver with “a_master1” agent ?

such that both master agents should work simultaneously.means to say that
FIRST SEQUENCER should generate the sequence and give it to FIRST DRIVER AND SECOND SEQUENCER should generate the sequence and give it to SECOND DRIVER simultaneously.

regards
saurabh jain