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 ;)