Write function not getting executed in monitor

Hi All,

I am seeing that the write function in the monitor is not working the simulation is hanging. Any reasons as to why the write is not working and simulation hangs?

Regards,
Abhinandan

You should post a complete example which demonstrates your issue.

It’s impossible to determine what is wrong without seeing all variables, methods, classes declared.

//Monitor run phase code:
task adc_monitor::run_phase(uvm_phase phase);
idx1 = 0;
idx2 = 0;
super.run_phase(phase) ;
`uvm_info(get_type_name(),“Entered run phase of adc offset monitor”,UVM_LOW)

forever begin
@(posedge adc_vif.clock);
adc_seq_item_h.adc_en = adc_vif.adc_en;
fork
begin
@(posedge adc_vif.tick_i)begin
//Logic to monitor the signals

                  idx1 = idx1 + 1;
              end //@(posedge adc_vif.tick_i)
          end //begin

      begin
          @(posedge adc_vif.tick_q)begin
                   //Logic to monitor the signals
            
                  idx2 = idx2 + 1;
              end //@(posedge obs_adc_offset_vif.tick_i)
          end //begin

join

      monitor_analysis_port_h.write(obs_adc_offset_seq_item_h);
      `uvm_info(get_type_name(),"Write to analysis port is done",UVM_LOW)
  end //forever

endtask : run_phase

//ADC Scoreboard write function code

`uvm_analysis_imp_decl(_adc_offset_trans)

class adc_scoreboard extends uvm_scoreboard;

uvm_analysis_imp_adc_offset_trans #(adc_sequence_item, adc_scoreboard) adc_offset_trans ;

function new (string name = “adc_scoreboard”, uvm_component parent=null);
super.new(name, parent);
adc_offset_trans = new(“adc_offset_trans”,this);
endfunction

function void write_adc_offset_trans(adc_sequence_item adc_trans_h);
string IQ[2];
IQ[0] = “I”;
IQ[1] = “Q”;
`uvm_info(get_type_name(),“Inside the write function in scoreboard”,UVM_LOW)

//Logic to collect the transaction items
endfunction : write_adc_offset_trans

endclass

//Connect phase code of env

function void adc_env::connect_phase(uvm_phase phase);
super.connect_phase(phase);
if (!uvm_config_db#(obs_config_env)::get(null, “*”,“obs_config_env”, obs_config_env_h))
`uvm_fatal(“FATAL”,“Could not get obs_config_env from uvm_config_db”)

adc_agent_h.adc_moniter_h.monitor_analysis_port_h.connect(adc_scoreboard_h.adc_offset_trans);

endfunction : connect_phase

Regards,
Abhinandan

Please format you code with markdown tags.

You could read about it in the post below:

[quote=“ajoshi, post:3, topic:51353”]
//Monitor run phase code:

task adc_monitor::run_phase(uvm_phase phase);
idx1 = 0;
idx2 = 0;
super.run_phase(phase) ;
`uvm_info(get_type_name(),“Entered run phase of adc offset monitor”,UVM_LOW)

forever begin
@(posedge adc_vif.clock);
adc_seq_item_h.adc_en = adc_vif.adc_en;
fork
begin
@(posedge adc_vif.tick_i)begin
//Logic to monitor the signals

                  idx1 = idx1 + 1;
              end //@(posedge adc_vif.tick_i)
          end //begin

      begin
          @(posedge adc_vif.tick_q)begin
                   //Logic to monitor the signals
            
                  idx2 = idx2 + 1;
              end //@(posedge obs_adc_offset_vif.tick_i)
          end //begin

join

      monitor_analysis_port_h.write(obs_adc_offset_seq_item_h);
      `uvm_info(get_type_name(),"Write to analysis port is done",UVM_LOW)
  end //forever

endtask : run_phase


//ADC Scoreboard write function code

`uvm_analysis_imp_decl(_adc_offset_trans)

class adc_scoreboard extends uvm_scoreboard;

uvm_analysis_imp_adc_offset_trans #(adc_sequence_item, adc_scoreboard) adc_offset_trans ;

function new (string name = “adc_scoreboard”, uvm_component parent=null);
super.new(name, parent);
adc_offset_trans = new(“adc_offset_trans”,this);
endfunction

function void write_adc_offset_trans(adc_sequence_item adc_trans_h);
string IQ[2];
IQ[0] = “I”;
IQ[1] = “Q”;
`uvm_info(get_type_name(),“Inside the write function in scoreboard”,UVM_LOW)

//Logic to collect the transaction items
endfunction : write_adc_offset_trans

endclass

//Connect phase code of env

function void adc_env::connect_phase(uvm_phase phase);
super.connect_phase(phase);
if (!uvm_config_db#(obs_config_env)::get(null, “*”,“obs_config_env”, obs_config_env_h))
`uvm_fatal(“FATAL”,“Could not get obs_config_env from uvm_config_db”)

adc_agent_h.adc_moniter_h.monitor_analysis_port_h.connect(adc_scoreboard_h.adc_offset_trans);

endfunction : connect_phase

Regards,
Abhinandan

Thanks for the editing the code to be more readable.

Few questions/suggestions:

  1. In the monitor code, where is defined obs_adc_offset_seq_item_h?
  2. A small note: usually the uvm_config_db#(obs_config_env)::get
    Is done in build_phase.
  3. Do you see in your test log the UVM macro print:
    “Inside the write function in scoreboard”?