Hi,
I’m having more than 5 agent instances in my UVM env and Monitors inside each agent should be connected to a scoreboard in the env. I want to know how to connect all these monitors to the scoreboard. If I use uvm_analysis_imp_decl macro to create multiple input streams. How to connect these input streams in the scoreboard to these monitors? Sample code: uvm_analysis_imp_decl(_SAMPLE1)
`uvm_analysis_imp_decl(_SAMPLE2)
class my_scb extends uvm_scoreboard;
uvm_analysis_imp_SAMPLE1#(tr,my_scb) sample1;
uvm_analysis_imp_SAMPLE2#(tr,my_scb) sample2;
…
…
virtual function void write_SAMPLE1(tr);
…
endfunction
virtual function void write_SAMPLE2(tr);
…
endfunction
endclass
My goal is to send the transactions from agent1.mon to write_SAMPLE1 and similarly agent2.mon to write_SAMPLE2. I have few questions too, which I’ve listed below.
In the monitor the analysis port’s name should match with the suffix used in the `uvm_analysis_imp_decl macro?
By connecting in the following way
agent1.mon.analysis_port(scb.sample1) in the env’s connect phase will send the transactions from agent1.mon to write_SAMPLE1 in the scoreboard?
Please provide clarifications regarding this.
Naming the analysis imp variable the same name as the class suffix is a good practice for making debugging easier. But it is not required.
The code you wrote for connecting the monitor’s analysis port to the scoreboard imp looks OK, assuming you have all the correct pathnames.
Another option is having a scoreboard with only one analysis imp. Then each monitor connects to the same write() function. The you could have each monitor set a field in your transaction to a unique value if necessary.
In reply to Raj Guru:
Naming the analysis imp variable the same name as the class suffix is a good practice for making debugging easier. But it is not required.
The code you wrote for connecting the monitor’s analysis port to the scoreboard imp looks OK, assuming you have all the correct pathnames.
Another option is having a scoreboard with only one analysis imp. Then each monitor connects to the same write() function. The you could have each monitor set a field in your transaction to a unique value if necessary.
Dear Dave,
May I ask to you the example code for understanding the 2 answer Please?
I think it will be a great for us to understand it.
I don’t have the time to write examples to answer every question, but here are the steps I would take to create such an example:
Determine a unique identifier for each monitor. This could be a unique numeric id stored in each agent’s configuration object. You could also use the full pathname string to the monitor in the testbench hierarchy, but that is not very efficient for doing comparisons. You could also use a handle to the monitor as its id.
Add that identifier as a field in the transaction (or extend the transaction using the factory) that the monitor write to.
Set the identifier in each monitor just before doing the write()
In the scoreboard write() function, use that identifier value to dispatch whatever needs to be done differently for each monitor.