Connecting OVM Monitor with OVM Scoreboard! Wish would be helpfull for people!

Hi all,

There weren’t info’s relating connecting ovm_monitor with ovm_scoreboard. Things I learned about TLM Connections for connecting ovm_monitor to ovm_scoreboard are given below.

Type1:
- Using ovm_put_port in ovm_monitor.
- Using ovm_get_port in ovm_scoreboard.
- Using tlm_fifo inside ovm_env to connect the ovm_monitor
****and ovm_scoreboard.

// Declaration In monitor1
ovm_put_port #(xactn_item) mon1_port;
// Code to put the transaction into fifo in monitor1
mon1_port.put(xactn_item);
// Declaration In monitor2
ovm_put_port #(xactn_item) mon2_port;
// Code to put the transaction into fifo in monitor2
mon2_port.put(xactn_item);
//Declarations in Scoreboard to get the transactions
ovm_get_port #(xactn_item) score1_export;
ovm_get_port #(xactn_item) score2_export;
//Connection inside environment
//Declare two fifo’s to connect two different ovm_monitor to
//ovm_scoreboard

tlm_fifo #(xactn_item) fifo1 = new(“fifo1”,null);
tlm_fifo #(xactn_item) fifo2 = new(“fifo2”,null);
//Connect the ovm_monitor with ovm_scoreboard inside connect function
function void connect();
ctl_mon_itd0.mon1_port.connect(fifo1.put_export);
ctl_scoreboard0.score1_export.connect(fifo1.get_export);
ctl_mon_ofd0.mon2_port.connect(fifo2.put_export);
ctl_scoreboard0.score2_export.connect(fifo2.get_export);
endfunction: connect

Type2:
- Using ovm_analysis_port in ovm_monitor.
- Using ovm_analysis_imp inside ovm_scoreboard
.
- Write functions inside the ovm_scoreboard to get the
****transactions from two different ovm_monitor.

//Declaration inside monitor1
ovm_analysis_port #(xactn_item) mon1_port;
//Code to put the transaction into fifo in monitor1
mon1_port.write(xactn_item);
//Declaration inside monitor2
ovm_analysis_port #(xactn_item) mon2_port;
//Code to put the transaction into fifo in monitor2
mon2_port.write(xactn_item);
**//Declaring macros outside ovm_scoreboard class to define N
//**number of write function as per requirement
ovm_analysis_imp_decl(_mon1) ovm_analysis_imp_decl(_mon2)
//Declaring two ports to get transactions from two different monitors
ovm_analysis_imp_mon1 #(xactn_item, ctl_scoreboard) mon1_export;
ovm_analysis_imp_mon2 #(xactn_item, ctl_scoreboard) mon2_export;
//Define two separate write functions to get the transactions from
//two different monitors

protected function void write_memory(input xactn_item mon1_item);
endfunction: write_memory
protected function void read_memory(input xactn_item mon2_item);
endfunction: read_memory
//Connections inside ovm_environment in connect() function
function void connect();
ctl_mon_1.mon1_port.connect(ctl_scoreboard0.mon1_export);
ctl_mon_2.mon2_port.connect(ctl_scoreboard0.mon2_export);
endfunction: connect
NOTE:

  • Since we are using ovm_analysis_imp, we got to define write functions
    inside ovm_scoreboard to get the transactions from the ovm_moniter
  • As we use write functions inside scoreboard, we cant use any delay
    information’s inside it and we cant do any syncing with the ovm_monitor
  • To solve this we go for Type 3 Connection as given below.

Type3:
- Using ovm_analysis_port in ovm_monitor to put transaction.
- Using ovm_analysis_export inside ovm_scoreboard to get
transaction.
- Define tlm_analysis_fifo inside ovm_scoreboard, connect it
****to ovm_analysis_export to get the transactions.

//Declaration inside monitor1
ovm_analysis_port #(xactn_item) mon1_port;
//Code to put the transaction into fifo in monitor1
mon1_port.write(xactn_item);
//Declaration inside monitor2
ovm_analysis_port #(xactn_item) mon2_port;
//Code to put the transaction into fifo in monitor2
mon2_port.write(xactn_item);
//Declarations inside ovm_scoreboard
//Declare two ovm_analysis_export to receive transactions from

//two different monitors
ovm_analysis_export #(xactn_item) mon1_export;
ovm_analysis_export #(xactn_item) mon2_export;
**//Declare two tlm_analysis_fifo to connect to ovm_analysis_export
//**to get the transactions tlm_analysis_fifo #(xactn_item) mon1_fifo;
tlm_analysis_fifo #(xactn_item) mon2_fifo;
//Connect ovm_analysis_export and tlm_analysis_fifo using
//connect function inside ovm_scoreboard
function void connect;
mon1_export.connect(mon1_fifo.analysis_export);
mon2_export.connect(mon2_fifo.analysis_export);
endfunction: connect
//Define the task run to get the transaction using get method
task run;
begin
@(ctl_if0.mon_cb);
chk_data();
end
endtask: run
task chk_data();
xactn_item mon1, mon2;
forever begin
mon1_fifo.get(mon1);
if(mon1.opr == OPRA)
begin end
else if(mon1.opr == OPRB)
begin
mon2_fifo.get(mon2);
end
endtask: chk_data
// Connections inside the environment
// Now connecting the two differenct ovm_monitor with the
// ovm_scoreboard using the connect function

function void connect();
ctl_mon_1.mon1_port.connect(ctl_scoreboard0.mon1_export);
ctl_mon_2.mon2_port.connect(ctl_scoreboard0.mon2_export);
endfunction: connect
Note: In Type 2 connections we used ovm_analysis_imp, so we got to use write function inside the ovm_scoreboard to get the transactions and doesn’t help in syncing with the ovm_monitor as we cant use any delay inside function. But here in this Type 3 we connected tlm_analysis_fifo to ovm_analysis_export to get the transactions from the two different monitor and by doing so we can use “task” inside the ovm_scoreboard to get the transactions and hence you can use any delays information’s inside the task, and helps in syncing with the ovm_monitor.

**The above given information’s are things which I learned from user guide and other threads, If i had made any mistake on it kindly forgive and please post the necessary suggestions.
**
Thanks,
Desperado → In help with things i know ;)

Good one, thanks!!

hi
Can we connect two analysis port to one subscriber?
if yes send me the syntax?
how we can control two write method implementation in that case?

You can connect a subscriber to as many analysis_ports as you want. Each connection adds a subscriber to list of subscribers for an analysis port.

mont1.mon1_port.connect(fifo.analysis_export);
mont2.mon2_port.connect(fifo.analysis_export);

A subscriber provides a single implementation of the write method.
You would have to put someting in the transaction to indicate which analysis port it came from.

Dave Rich

You can connect a subscriber to as many analysis_ports as you want. Each connection adds a subscriber to list of subscribers for an analysis port.
mont1.mon1_port.connect(fifo.analysis_export);
mont2.mon2_port.connect(fifo.analysis_export);
A subscriber provides a single implementation of the write method.
You would have to put someting in the transaction to indicate which analysis port it came from.
Dave Rich

Good to see your response. Thanks a lot.
onemore query is what if both monitors are calling write method of subscriber at same time? is there ant internal arbiter for that?
Waiting for you reply…

The write method is a function; it must return in zero-time Typically, the subscriber is actually an ovm_analysis_fifo, so whatever transaction is written is buffered in the fifo.

Dave Rich

So it menas we have to define analysis fifo in case if we have multiple producers and one subscriber am i correct?
is there a method to control depth of analysis fifo?
i have posted few other blogs but i was not able to see in general threats so what should i do to post in general forum where any one can see it and share their views on that?(as we are doing currently)

It depends. The write method is a function call that cannot block - it must return in zero-time. If you connect that to an analysis fifo, you must guarantee that it is never full.

Whatever you end up implementing with your write method, it is_use it, queue it, or lose it._

Dave Rich

in case where two producers are sending the data to one subscriber, what will be the syntax of analysis port connections without use of fifo?

This thread has been dormant for over a year, but this is exactly my question! So, dave_59 or anyone – is it possible to have two producers feeding analysis info to a common subscriber? If so, what might the syntax look like?

-der

The syntax for the connection is the same as I posted above. The fifo is the common subscriber in that case. Substituteyour_subscriber that implements the write method instead of the analysis_fifo.

Dave

Ah, duh. I actually did read that part of the thread but got myself hopelessly confused about “subscriber” vs. “publisher”. Thanks!

this question was anwsered clearly in #6 by Dave.

but anyway, if you could not get the whole picture by reading the only 2 lines of code. the following implementation that based on the same idea could possibly help you.

http://www.ovmworld.org/contributions-details.php?id=62&keywords=PW_OVM_Scoreboard_Release_1_6

It is actually a ggod socreboard implementation I used in my previous 3 tasks. if I were you, I would use this one directly instead inviting a new one.

this question was anwsered clearly in #6 by Dave.

but anyway, if you could not get the whole picture by reading the only 2 lines of code. the following implementation that based on the same idea could possibly help you.

http://www.ovmworld.org/contribution…rd_Release_1_6

It is actually a ggod socreboard implementation I used in my previous 3 tasks. if I were you, I would use this one directly instead inviting a new one.

this question was anwsered clearly in #6 by Dave.

but anyway, if you could not get the whole picture by reading the only 2 lines of code. the following implementation that based on the same idea could possibly help you.

http://www.ovmworld.org/contribution…rd_Release_1_6

It is actually a ggod socreboard implementation I used in my previous 3 tasks. if I were you, I would use this one directly instead inviting a new one.

Hi Der,

This thread has been dormant for over a year, but this is exactly my question! So, dave_59 or anyone – is it possible to have two producers feeding analysis info to a common subscriber? If so, what might the syntax look like?

If I have understood your above mentioned query correct, then I hope that this thread: http://ovmworld.org/forums/showthread.php?p=2474#poststop can further help you. This thread shows you an example of two monitors being connected to same scoreboard for transferring their transactions.

Hello,

In UVM if one tried to get data using write method from analysis_fifo so it is giving error.
Is this expected ?

-Yajur