Functional coverage

can we connect agent tlm port to subscriber inbuilt export to get the function coverage
I tried but I am getting zero percent coverage in the coverage report

help me to solve this problem



//here I am writing a small piece of code what I did

//agent
class wr_agent extends uvm_agent;
`uvm_component_utils(wr_agent)
uvm_analysis_port#(wr_txn)port;

function new(string name = "wr_agent",uvm_component parent);
super.new(name,parent);
port = new("port",name);
endfunction

//build_phase
//connect_phase
endclass

// subsciber class

class subscriber extends uvm_subscriber#(wr_txn);
`uvm_component_utils(subsciber)
wr_txn cov;
/*cover group
//cover points
endgroup
*/
function new(string name = "subscriber",uvm_component parent);
super.new(name,parent);
endfunction
function void write(wr_txn t);
this.cov = t;
group1.sample();
endfunction
endclass

//environment
wr_agent agt;
subscriber sub;

//build_phase 
function void build_phase(uvm_phase phase);
super.build_phase(phase);
agt = wr_agent::type_id::create("wr_agent",this);
sub = subcriber::type_id::create("sub",this);
endfunction
//connect_phase


function void connect_phase(uvm_phase phase);
wr_agent.port.connect(sub.analysis_export);
endfunction



In reply to mada saimanasa:

You can do this, but in your code there is no coverage implemented.

I wrote cover groups and cover points inside the subscriber

class subscriber extends uvm_subscriber#(wr_txn);
`uvm_component_utils(subscriber)

wr_txn cov;

covergroup g1;

A1:coverpoint cov.addr{ bins B1 = { [10010:10000]};
bins B2 = {11111:10010]};}
endgroup
function new(string name = “subscriber”,uvm_component parent);
super.new(name,parent);
g1= new();
endfunctuion

function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction

function void write(wr_txn t);
this.cov = t;
g1.sample();
endfunction
endclass

In reply to mada saimanasa:

I wrote cover groups and cover points inside the subscriber
class subscriber extends uvm_subscriber#(wr_txn);
`uvm_component_utils(subscriber)
wr_txn cov;
covergroup g1;
A1:coverpoint cov.addr{ bins B1 = { [10010:10000]};
bins B2 = {11111:10010]};}
endgroup
function new(string name = “subscriber”,uvm_component parent);
super.new(name,parent);
g1= new();
endfunctuion
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void write(wr_txn t);
this.cov = t;
g1.sample();
endfunction
endclass

You have to create component for functional coverage in your enviornment.

In reply to mada saimanasa:

I wrote cover groups and cover points inside the subscriber
class subscriber extends uvm_subscriber#(wr_txn);
`uvm_component_utils(subscriber)
wr_txn cov;
covergroup g1;
A1:coverpoint cov.addr{ bins B1 = { [10010:10000]};
bins B2 = {11111:10010]};}
endgroup
function new(string name = “subscriber”,uvm_component parent);
super.new(name,parent);
g1= new();
endfunctuion
function void build_phase(uvm_phase phase);
super.build_phase(phase);
endfunction
function void write(wr_txn t);
this.cov = t;
g1.sample();
endfunction
endclass

I’d try to see if you get transaction. Simply add a `uvm_info inside the write method that prints thr content of eacj transaction.

In reply to Rohi_417:

I create the subscriber component inside the env

@(chr_sue)

First I implemented with subscriber and monitor that time coverage report was generated. After I tried with agent and subscriber but my coverage report is zero.

And I given `uvm_info inside the write method but is not printing.

In reply to mada saimanasa:
If you do not see the uvm_info, then you do not receive a transaction or your verbosity is too high. Bcause you do not measure any coverage I believe you dont receive a transaction. Did you connect the monitor’s a_port with a_port of your agent?

In reply to mada saimanasa:

In reply to Rohi_417:
I create the subscriber component inside the env

Then you need make connection between subscriber and monitor

inside env @ connect_phase

ex //Monitor_Port.connect(sb_h.analysis_export

from monitor, I am getting coverage

I want to do with the agent.

I have connected monitor port with agent port and again agent port with the subscriber inbuilt export. now I am getting the coverage and even info message also.

thank you