How do I access methods from sequencer in sequence


//Sequence
class fifo_write_sequence extends uvm_sequence#(fifo_seq_item);
  `uvm_object_utils(fifo_write_sequence)
  `uvm_declare_p_sequencer(fifo_write_sequence)
  
  function new(string name="fifo_write_sequence");
    super.new(name);
  endfunction
  
  virtual task body();
    fifo_seq_item seq;
    while(p_sequencer.fun()!=1)begin
      seq=new();
      start_item(seq);
      assert(seq.randomize()with{seq.wr==1;});
      finish_item(seq);
    end
  endtask
  
endclass

//Sequencer
class fifo_sequencer extends uvm_sequencer#(fifo_seq_item);
  
  `uvm_component_utils(fifo_sequencer)
  
  uvm_analysis_imp#(fifo_seq_item, fifo_sequencer) mon_imp;
  fifo_seq_item trans;
  bit full;
  
  function void write(fifo_seq_item trans);
  full=trans.wr_full;
  endfunction 
  
   function new(string name, uvm_component parent);
    super.new(name,parent);
  endfunction
  
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
  endfunction
  
  function bit fun;
    return full;
  endfunction
endclass


When I try accessing function from sequencer into sequence using p_sequencer then I get error that member not found. Please help me solve this error.

In reply to mikasa:

You did not construct the trans. There is no object of this type.
BTW I try to understand what you are doing with the analysis_imp in the sequencer. The typical application is the interface between sequencer and driver.

Also you need to pass sequencer “fifo_sequencer” type to the macro `uvm_declare_p_sequencer not the sequence.

In reply to ShreemantVats :

Thank you, it worked.

In reply to chr_sue:

I am trying to take response from monitor, that is fifo full flag signal, and then depending on that I want to keep running my sequence until the fifo gets full. Please suggest if there a better way to do it.

In reply to mikasa:

You can extract your response in the driver and put it back to the sequencer without adding an additional port/export. This is the typical way to deal with this scenario.
See the bidirectional interface between driver and sequencer in the Verification Academy code examples.

In reply to chr_sue:

Okay, thank you.