Cross coverage of two covergroups

Hi Everyone,

I am using the UVM env, in that I have two agents lets say agent1 and agen2, I want to get the cross coverage of input stimulus generated by both agents.

What I did till now , I have a shared seq_item.svh for both agents , so I did placed the


class seq_item extends uvm_sequence_item;

covergroup cg_for_agent1:
coverpoint a;
coverpoint b;
agent1: cross a,b;
end covergroup

covergroup cg_for_agent2:
coverpoint a;
coverpoint b;
agent2: cross a,b;
end covergroup

function post_randomise();
if (this.get_name == pkt_for_agent1)
cg_for_agent1.sample();
if (this.get_name == pkt_for_agent2)
cg_for_agent2.sample();
endfunction


Now what I need is CROSS: cg_for_agent1, cg_for_agent2;

Please let me know how can I achieve it,since the SV has depreciated Hierarchical Covergroups :(

Thanks

Adding the ability to create a cross between two separate covergroups is a highly requested enhancement for SystemVerilog. However your particular example demonstrates a major problem with doing so. You are either going to sample cg_for_agent1 OR cg_for_agent2, but not both simultaneously. A cross bin is hit when all the coverpoint bins in is set are hit. So if you are sampling cg_for_agent1, which bins from cg_for_agent2 are part of the cross?

In reply to dave_59:

Great Many Thanks Dave for your reply!!!

If that could be the issue let me elaborate the example further:


static cnt = 0;

class seq_item extends uvm_sequence_item;

typedef {x,y,z} lmn_t;
typedef {m,n,o} pqr_t;

rand lmn_t lmn;
rand pqr_t pqr;

covergroup cg_for_agent1:
coverpoint a: lmn;
coverpoint b: pqr;
end covergroup

covergroup cg_for_agent2:
coverpoint a: lmn;
coverpoint b: pqr;
end covergroup

covergroup cg_for_cross_ab;
CROSS_cov: cg_for_agent1.a;cg_for_agent1.b;cg_for_agent2.a;cg_for_agent2.b
end covergroup

function post_randomise();
if (this.get_name == pkt_for_agent1)begin
cg_for_agent1.sample();
cnt++;
end
if (this.get_name == pkt_for_agent2)begin
cg_for_agent2.sample();
cnt++;
end
if (cnt %2 == 0)begin
cg_for_cross_ab.sample();
end
endfunction

Now what I achieved cg_for_agent1 & cg_for_agent2 has bins covered but cg_for_cross_ab received zero bin covered.

Strange how static covergroups lost their value.

Apart from this, the seq_item object is created in both the agents at same time and randomized at the same time.

Please help me where I lost.

Thanks.

P.S: I am also wondering for functional coverage best technique, as per Mentor’s guidelines i am doing this to achieve input test stimulus coverage , that i have sent all the vectors, please help me with any example to get it done in some other good way

Thanks again :)

In reply to Meeta:

You say the two seq_item objects are randomized at the same time, but that is not the same as simultaneously. randomize() and sample() are procedural statements executing discretely. To achieve the cross you want, you need to get all the data you want in the cross into a single sample(). That may mean creating a separate coverage collection component, using analysis ports to do a write() from the two agents to your collector. Then you will need to merge the data so a single covergroup can sample it.

In reply to dave_59:

Thanks Dave !!

But my problem is something more:

I want to calculate the input coverage in which I want to be sure that my desired test vectors were thrown.

Now the seq_item(n number of bytes) randomized in the sequence and sequence processes it and throws seq_item_1(single byte) to driver so does the monitor sees it in byte information.

So keeping the coverage_model on the transaction based on data gives by the byte information(monitor/driver) gives me the data bins not the packet information based on enumeration ,I want to generate the coverage in terms enumerated data typedef {x,y,z} lmn_t; typedef {m,n,o} pqr_t;

lets say:
agent1 covers x,y
agent2 covers y,z

So I expect the cross coverage gives me the bins uncovered {agent1.z, agent2.x} … etc,

Thus only I would be able to generate other scenarios.

May be I am wondering somewhere else, please put light on this.

Great Many Thanks Dave for your prompt replies.

In reply to Meeta:

Update to the above reply,

As per Dave’s guidelines , creating a separate coverage collector , I need to pass the handle of the packet to process through analysis port, so the options are creating the analysis port are as:

Monitor/Driver - Not possible as both as working on byte but need full packet(n bytes including enumerated data).
Sequence - So I have to write create and throw the packet through every sequence analysis port - Not liking.
Seq_item - It does not allow to create the analysis port.

Well, trying for different experiments and will be uploading as soon as got some result.

Thanks

In reply to Meeta:

Put the analysis port in the sequencer. (it might already have one, I don’t remember). Your sequence has access to the sequencer it is running on.

In reply to dave_59:

Thanks a lot Dave !!

Sorry ,as the sequencer is bind to seq_item2 , the seq_item to be covered is just visible in the sequences to process according to the random data of it and update the value of seq_item2 and send to driver via sequencer.

Seq_item1: is of n bytes with enumerated data(which is further constraining other data variable) data need to be covered,

Seq_item2: is byte type, passed to driver via sequencer contains only data , which can’t regenerate enumerated seq_item1 data.

May , I am not able to clear my intentions, my apologies for the same .

I have created a small ppt , but unable to upload the pictures on this board :(

In reply to Meeta:

This is going to be difficult to help you on the forum. I suggest you try to get someone locally to help you out.

In reply to dave_59:

Well , Thanks for the help Dave !!,

If you need some piece of code to look into please share you mail : karandeep963(at the rate)gmail.com , as I am wondering at lot and find hard the solution, any clues may help me to experiment further.

Sorry, to push you , but please if you have some bandwidth please depart some time on this, as I am unable to find any work on input stimulus coverage , I tried hard.

May something I am missing :(

Hope you got my mail !!!

Thanks.