Coverage in Environment

Hi all,
I am new to uvm,I want to cover both master item and target item in one functional coverage file(filename is “func_cov.svh”).
I have my coverage file in environment.
monitor coverage connection with environment is
m_agent.m_monitor.m_coverage_port.connect(m_monitor.cov_cl.analysis_port);(i have two agents)

My question is:
1. Is master item and target item come here or not?
2. If items come here,how to differentiate master and target items?

Please give me any one idea to perform to cover both master item and target items.

In reply to arasupotri.natarajan90:

Need a bit more information to answer you.
Are master and target items completely different, or is one an extension of the other?
Exactly what information are you trying to cover? Is it the same for master and target items?

Aside from that, a description of your component hierarchy would help, since I can’t tell what coverage_port and cov_cl actually are.

May you are asking how the coverage class implements the write function for two ports, so this will help you:

// Connections
master_m_agent.m_monitor.m_coverage_port.connect(m_monitor_cov.analysis_port_m);
target_m_agent.m_monitor.m_coverage_port.connect(m_monitor_cov.analysis_port_t);

// In the Coverage class
uvm_analysis_imp_m(master_item)analysis_port_m;
uvm_analysis_imp_t(target_item)analysis_port_m;

function write_m;
sample.cov_m();
endfunction

function write_t;
sample.cov_t();
endfunction

Hope your query answered, if not let me know.

-Cheers
Karandeep

In reply to karandeepsingh:

Karandeep is on the right track to allow you to record both transactions in the same component. Just a couple of comments:

  1. The analysis_imps are technically exports, so calling them “analysis_port_?” might be confusing.
  2. To declare the analysis_imps, you should use the imp_decl macros:
`uvm_analysis_imp_decl(_m)
`uvm_analysis_imp_decl(_t)

Karandeep is assuming that cov_m and cov_t are distinct covergroups. If you want to collect information about each in the same covergroup, you’ll have copy the elements of master and target [the arguments to the two write() methods] to variables that the covergroup is looking for and then sample the covergroup.[/list]

In reply to tfitz:

Thanks Tom.

I was concentrating on the method of implementation only, missing syntax errors. Thanks for correction.

I named the imports as analysis_port_* just copying the supplied names in the problem.

Yes, it was confined for distinct covergroups only :(

-Karandeep

In reply to karandeepsingh:

Hi Karandeep,
I figured that was the case, but I wanted to make sure things were clear.
I hope I didn’t offend you as that certainly wasn’t my intention.
Thanks,
-Tom

In reply to tfitz:

Dear TOM ,

It was nothing to be offended. What made you feel like that ?

I really appreciate your efforts, in fact I feel nice that you provided more refinement, as it may be the next question from the poster when it gives error.

Indeed it is helping.

Admire your help !!!

I think my words may have taken you to other direction but it was nothing like that.

Hope this time I am able to express.

Great Many Thanks,
Karandeep