Possibility of writing 2 monitors in a single TB

Is it possible to write two monitors and remaining test bench components are normal in a testbench?

In reply to Manirama:

The UVM has no compliance checking. You are free to do what you want. The question is: what is useful? You should always code ‘as easy as possible’.

In reply to Manirama:

You can since there are no restrictions imposed by UVM. On similar lines you can have a single monitor and multiple analysis ports too. But I am not sure why would one need such a setup.

Actually I wanted to implement two monitors and single scoreboard in my TB.
So, My question is since we have only one scoreboard
monitor_1 have write() method and it collects some variables data
and monitor_2 also have write() method and it collects some other variables data. now, I am implementing the write method in scoreboard. then I am displaying the data in scoreboard, the data in scoreboard is not same as data from two monitors i.e. data displayed in monitors alone is not same as the received data in scoreboard.

In reply to Manirama:

Check the connection of the analysis ports. Example code:


//monitor1
uvm_analysis_port #(my_transaction) ana_mon1_port;
/*
... other code
*/
ana_mon1_port.write(tx);

//monitor2
uvm_analysis_port #(my_transaction) ana_mon2_port;
/*
... other code
*/
ana_mon2_port.write(tx);

//scoreboard 
`uvm_analysis_imp_decl(_ana_mon1)
`uvm_analysis_imp_decl(_ana_mon2)

class myscoreboard extends uvm_component;
  uvm_analysis_imp_ana_mon1#(my_transaction, myscoreboard) ana_mon1;
  uvm_analysis_imp_ana_mon2#(my_transaction, myscoreboard) ana_mon2;
  
  function new(string name, uvm_component parent);
    super.new(name,parent);
    ana_mon1= new("ana_mon1", this);
    ana_mon2= new("ana_mon2", this);
  endfunction

  function void write_ana_mon1(my_transaction t);
    /*
     .... other code 
    */
  endfunction

  function void write_ana_mon2(my_transaction t);
    /*
     .... other code 
    */
  endfunction

endclass

//connection in environment
    agt.mon1.ana_mon1_port.connect(sb.ana_mon1);
    agt.mon2.ana_mon2_port.connect(sb.ana_mon2);