Multiple UVC's/agents

Hi All,

I have set up one UVC with 1 agent. i would want multiple agents which either can have the same sequences or individual ones. Can I get more information on what all information I should consider.
Would it be just instantiating the agent as
my_agent agent
and then have multiple instances of the same agent or how should I do it.

Thanks,
Leela

Each sequence instance gets started on the sequencer of a particular agent. So, once you decide how many agents you want, it’s up to your test to decide which sequence(s) to start on each sequencer. Having an array of agents or separately instantiating different agents makes no difference to the test’s ability to start sequences on the resulting sequencers in the agents (assuming the parameterization is correct).
Does that help?
-Tom

In reply to tfitz:

Hi Tom,

Thanks for your reply!!! I was able to generate multiple instances of the agents.
Now I have another question:

I have multiple agents now and I would want to drive the requests to the DUT.
What I would want to know is should I create one interface and instantiate a virtual interface in the top module or do I also have to generate an array of virtual interface instances??
may be for example like this:
for(genvar i=0;i;i++) begin : for_loop
initial begin : config
string if_name;
$sformat(if_name, “IF[%0d]”, i);
uvm_config_db#(virtual my_if_type)::set(uvm_root::get(), “*”, if_name, my_if[i]);
end : config
end : for_loop
Could you please suggest me on how should I proceed with it…??

Thanks ,
Leela

In reply to leela:

Don’t make things more complicated than they have to be. Each interface instance is connected to a specific set of pins on your DUT. If there’s only one physical connection, then you need only one interface instance. The question to ask yourself is why you think you need multiple agents. If you have multiple agents, then that implies each will be connected to a different virtual interface instance and your DUT will have to arbitrate between them. On the other hand, if you’re trying to interleave multiple sequences to generate stimuli to a single set of pins, you’d be better off having just one agent and starting multiple sequences in parallel on the agent’s sequencer. Then the sequencer will handle the arbitration and the driver will drive the transaction to the DUT.
Does that help?

In reply to tfitz:

What I want is to generate stimuli from 8 different agents and send to the DUT parallely.
What would be the best way to do it??
Having multiple agents or Having multiple sequences??

Thanks ,
Leela

In reply to leela:

If the DUT has 8 separate interfaces, then using an array of interfaces and an array of agents is the right way to organize things. You would only need the generate loop to connect each interface instance to the corresponding interface on the DUT. In the testbench, a regular for-loop can be employed to use the config_db to pass each virtual interface instance down to the corresponding agent.

In reply to tfitz:

Let me assume for now the DUT has only one interface.

In this case if I want to generate multiple requests then I can use sequences right??
While using sequences, I assume there are several arbitration methods to send the rquests to the driver.

Now my question is if want to send the requests parallelly then using for and join would be the best idea ?? Or is there any other way it can be done?? what do you suggest?

In reply to leela:

If you have only one interface, then you should have only one driver connected to it and you will have only one agent (and therefore one sequencer connected to the driver). The sequencer supports many possible arbitration schemes (see the Cookbook). The key is that you’ll want all your sequences running in parallel on the sequencer. So, from your test, you’d do something like:

class my_test extends uvm_test;
  `uvm_component_utils(my_test)
  task run_phase(uvm_phase phase);
    env.agent.sequencer.set_arbitration(arb_type);
    phase.raise_objection("starting",this);
    fork
      seq1.start(env.agent.sequencer);
      seq2.start(env.agent.sequencer);
      seq3.start(env.agent.sequencer);
      ...
    join
    phase.drop_objection("completed",this);
    endtask
endclass

This allows each sequence to attempt to send transactions in parallel. In reality, since there’s only one interface to the DUT, it can only handle one transaction at a time, so this setup allows the driver to request one transaction at a time from the sequencer which will select from the multiple parallel sequences (according to the arbitration scheme you select) which transaction to send to the driver.
So, if you have one sequence generating A,B,C,D… and another sequence generating 1,2,3,4…, running them in parallel on the same sequencer with default arbitration would yield a transaction stream to the driver of A,1,B,2,C,3,D,4…
Your resulting transaction stream is interleaved, but as far as the driver is concerned, it’s just getting a series of transactions from the sequencer. This is part of the beauty of UVM.
Hope this helps,
-Tom

In reply to tfitz:

Hi Tom,

Thanks for the detailed explanation. It really helped me!!

Regards,

Leela

In reply to tfitz:

In reply to leela:
If the DUT has 8 separate interfaces, then using an array of interfaces and an array of agents is the right way to organize things. You would only need the generate loop to connect each interface instance to the corresponding interface on the DUT. In the testbench, a regular for-loop can be employed to use the config_db to pass each virtual interface instance down to the corresponding agent.

Hi Tom
I have a similar issue. I have 9 interfaces and 9 agents.
I have used a generate loop
genvar i;
generate
for(i=0;i<= `NUM_INST i++) begin: req_inst
arb_req_if req_if();
initial begin
uvm_config_db#(virtual arb_req_if)::set(uvm_root::get(),*,$sformatf(req_if_%0d,i),req_if);
end
end
endgenerate

In the env I have created the agents as arb_req_agent_0. My question is how to pass the virtual interface instance to each agent using the for loop. Can you please give me an example with a snippet of code.
In my top module instaed of the * can I have uvm_test_top.env.arb_req_agent_%0d. If so what is the syntax?
Thanks

In reply to roopa_wsemi:

In the toplevel module you have the generate loop and passing the virtual interfaces to the config_db. Does this work or what is your issue.
BTW the generate is commonly used if you want to be flexible with the number of interfaces/agents. In the other case you could simply use a for loop.

In reply to roopa_wsemi:

You should not be passing interfaces directly to an agent from the top level due to the problems you are discovering.

An agent will use get_config() with a specific string to get its configuration object containing the interface handle. If there are 9 instances of an agent, you will need to target a specific hierarchy for each configuration object.

To accomplish this, your test should create a configuration object for each agent, call get_config() for each interface handle specific to the agent, then set_config() the configuration object for each agent.