Member reference resolution error related to uvm_analysis_imp_decl

Hi
I am seeing Member reference resolution error(line num 52) related to uvm_analysis_imp_decl.(please check the line uvm_analysis_imp_dec)
I connected monitor analysis port to another component analysis export .

Can anyone plesae help on this?

class  transaction #(parameter  LENGTH=10) extends uvm_sequence_item;
  rand bit a;
  
  `uvm_object_param_utils_begin(transaction#(LENGTH))
  `uvm_field_int(a,UVM_ALL_ON)
  `uvm_object_utils_end
  
  
  function new(string name="transaction");
    super.new(name);
    
  endfunction
  
  
endclass
  
  
  
  
  
  
  

class    monitor#(parameter LENGTH=5) extends  uvm_monitor#(transaction#(LENGTH));

`uvm_component_param_utils(monitor#(LENGTH))
transaction#(LENGTH)  tr;
uvm_analysis_port#(transaction#(LENGTH))  analysis_port;

  function new(string name="monitor",uvm_component parent);
    super.new(name,parent);
    
  endfunction
  
  
  task run_phase(uvm_phase  phase);
    tr=new("mahen");
    $display("mahen");
analysis_port.write(tr);
endtask


endclass

linenum 52:`uvm_analysis_imp_decl(_mon)
  class  model#(parameter LENGTH=5)  extends  uvm_component#(transaction#(LENGTH));
`uvm_component_param_utils(model#(LENGTH))

 uvm_analysis_imp_mon#(transaction#(LENGTH)) mon_export;
    
    

transaction#(LENGTH)  tr;
    
    function new(string name,uvm_component parent);
      super.new(name,parent);
      mon_export=new("mon_export",this);
    endfunction
      
     

function write_mon(transaction#(LENGTH)  trans);
  $display("in_monitor");
endfunction
endclass
  
  
  
   class  env#(parameter LENGTH=5)  extends  uvm_component#(transaction#(LENGTH));
     `uvm_component_param_utils(env#(LENGTH))
     
     
     model#(LENGTH)  md;
     monitor#(LENGTH)  mon;
     
       function new(string name,uvm_component parent);
      super.new(name,parent);
       endfunction
      
         function  build_phase(uvm_phase  phase);
           
           super.build_phase(phase);
           md=model#(LENGTH)::type_id::create("model",this);
           mon=monitor#(LENGTH)::type_id::create("mon",this);
           
         endfunction
           
           function  connect_phase(uvm_phase  phase);
             
             mon.analysis_port.connect(md.mon_export);
             
           endfunction
           
      
       endclass
     
     
   class  test#(parameter LENGTH=5)  extends  uvm_component#(transaction#(LENGTH));
     //`uvm_component_param_utils(test#(LENGTH))
     typedef uvm_component_registry#(test#(LENGTH),"test") type_id ;
     
     env#(LENGTH)  en;
     
       function new(string name,uvm_component parent);
      super.new(name,parent);
       endfunction
      
         function  build_phase(uvm_phase  phase);
           
           super.build_phase(phase);
           en=env#(LENGTH)::type_id::create("env",this);
          
           
         endfunction
           
          task  run_phase(uvm_phase  phase);
             
             #10;
             
          endtask
           
      
       endclass
            
            
            
            module  top;
              parameter  LENGTH=10;
              typedef test#(LENGTH) delay_test;
              
              initial
                
                
                run_test();
              
            endmodule
              

TimeScale is 1 ns / 1 ns

Error-[MRRE] Member reference resolution error
testbench.sv, 52
Member operator “.” cannot be used on object of type int.
Expression: m_imp
Source info: m_imp.write_mon

Thanks,
praneeth

The main problem is with the declaration of mon_export. It needs to include the type of the class it is declared in.

uvm_analysis_imp_mon#(transaction#(LENGTH),model#(LENGTH))  analysis_port;

Other problems are

  • classes extended from uvm_component/uvm_monitor must not specify a parameter in their extension
  • function declaration in this example need to be declared as function void to match their virtual method prototypes. Without the ‘void’ the default return type is 1-bit logic.

In reply to dave_59:

Thanks Dava its worked.