Search form

Main menu

My Account Menu

Tlm_analysis_fifo Usage

ktran99
ktran99
Full Access
18 posts

I am looking to use some fields of the driver in my monitor to facilitate the data collection in the monitor. I instantiated a "tlm_analysis_fifo" in my monitor and hooked it up as shown but it doesn't seem to be working. Any help is appreciated.

class my_driver extends ovm_driver#(my_pkt);
ovm_analysis_port #(my_pkt) driver_ap;

function void build(); driver_ap = new("driver_ap", this); endfunction

virtual task run();
driver_ap.write(my_pkt);
...
endtask
endclass

class my_monitor extends ovm_monitor;
ovm_analysis_port #(my_pkt) monitor_ap;
local tlm_analysis_fifo #(my_pkt) monitor_af;

function void new();
super.new();
monitor_ap = new("monitor_ap", this);
monitor_af = new("monitor_af", this);
endfunction

function void connect();
super.connect();
monitor_ap.connect(monitor_af.get_ap);
endfunction

task run();
monitor_af.get(my_pkt);
...
endtask
endclass

class my_agent extends ovm_agent;
my_driver driver;
my_monitor monitor;

function void connect();
super.connect();
driver.driver_ap.connect(monitor.monitor_ap);
endfunction
...
endclass

Am I using the tlm_analysis_fifo correctly? I tried printing one of "my_pkt" fields and the field is wrong.

Answers

ktran99
ktran99
Full Access
18 posts

I got it. From the monitor side I was supposed to use ovm_analysis_export instead of ovm_analysis_port.

manishp.p18
manishp.p18
Forum Access
17 posts

Quote:

function void connect();
super.connect();
monitor_ap.connect(monitor_af.get_ap);
endfunction

Shouldn't the above connection be to put_ap rather than get_ap?

Comments on this answer

I have the use of Mentor's Certe so when I saw the "put_ap" on the tlm_analysis_fifo in the environment diagram I tried that too but that didn't work either. I looked at the Cookbook again and realized that the monitor in this case is a subscriber so its connection has to be an ovm_analysis_export. Here is my updated monitor:

class my_monitor extends ovm_monitor;
ovm_analysis_export #(my_pkt) monitor_xport;
tlm_analysis_fifo #(my_pkt) afifo_from_driver;

// New not shown

function void connect() monitor_xport.connect(afifo_from_driver.analysis_export); endfunction
endclass

This works for me now.