# Error message : can not find the member in the class

**URL:** <https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896>\
**Category:** UVM\
**Tags:** UVM\
**Created:** [August 21, 2018, 4:09pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896 "2018-08-21T16:09:29Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 21, 2018, 4:09pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/1 "2018-08-21T16:09:29Z")

</div>

Hi all  
i am a beginner in uvm. please correct me if the testbench is wrong or there is better solution  
the error message is (Error-[MFNF] Member not found  
driver.sv,  
“this.req.”  
Could not find member ‘addr’ in class ‘uvm\_sequence\_item’ ) while running vcs

i am confused with the error, because addr is defined in the class mem\_seq\_item.

here is my code.

```verilog
class mem_seq_item extends uvm_sequence_item;
  //data and control fields
  rand bit [3:0] addr;
  rand bit wr_en;
  rand bit rd_en;
  rand bit [7:0] wdata;
       bit [7:0] rdata;
   
  //Utility and Field macros,
  `uvm_object_utils_begin(mem_seq_item)
    `uvm_field_int(addr,UVM_ALL_ON)
    `uvm_field_int(wr_en,UVM_ALL_ON)
    `uvm_field_int(rd_en,UVM_ALL_ON)
    `uvm_field_int(wdata,UVM_ALL_ON)
  `uvm_object_utils_end
   
  //Constructor
  function new(string name = "mem_seq_item");
    super.new(name);
  endfunction
   
  //constaint, to generate any one among write and read
  constraint wr_rd_c { wr_en != rd_en; };
   
endclass

class mem_sequencer extends uvm_sequencer#(mem_seq_item);
 
  `uvm_component_utils(mem_sequencer)
 
  //constructor
  function new(string name, uvm_component parent);
    super.new(name,parent);
  endfunction
   
endclass

Calling of build phase

class mem_sequence extends uvm_sequence#(mem_seq_item);
   
  `uvm_object_utils(mem_sequence )
  //`uvm_sequence_utils(mem_sequence,mem_sequencer)
   
  //Constructor
  function new(string name = "mem_sequence");
    super.new(name);
  endfunction
   
// virtual function void build_phase(uvm_phase phase)
//   
// req = mem_seq_item::type_id::create("req");
//   
// endfunction
   
   
  virtual task body();
 
   req = mem_seq_item::type_id::create("req");
   // wait_for_grant();
    req.randomize();
    send_request(req);
  // wait_for_item_done();
 
  endtask
   
endclass

`define DRIV_IF pointer_to_interface.DRIVER.driver_cb
class mem_driver extends uvm_driver;
   `uvm_component_utils(mem_driver);

 virtual mem_if pointer_to_interface;
   
 function new (string name, uvm_component parent);
      super.new(name,parent);

 endfunction : new

 virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    
	if(!uvm_config_db #(virtual mem_if)::get(null, "*","pointer_to_interface", pointer_to_interface))
        $fatal("Failed to get BFM");
		
 endfunction : build_phase
   
   
   
   
 task run_phase(uvm_phase phase);

      phase.raise_objection(this);
    forever begin
        seq_item_port.get_next_item(req);
      drive();
        seq_item_port.item_done();
    end

      phase.drop_objection(this);
 endtask : run_phase

   
  virtual task drive();
    `DRIV_IF.wr_en <= 0;
    `DRIV_IF.rd_en <= 0;
    @(posedge pointer_to_interface.DRIVER.clk);
        `DRIV_IF.addr <= req.addr;
   
     if(req.wr_en) begin
        `DRIV_IF.wr_en <= req.wr_en;
        `DRIV_IF.wdata <= req.wdata;
        @(posedge vif.DRIVER.clk);
      end
    if(req.rd_en) begin
        `DRIV_IF.rd_en <= req.rd_en;
        @(posedge vif.DRIVER.clk);
        `DRIV_IF.rd_en <= 0;
        @(posedge vif.DRIVER.clk);
        req.rdata = `DRIV_IF.rdata;
      end
    
  endtask : drive
  
endclass
   

class mem_agent extends uvm_agent;
  //declaring agent components
  mem_driver driver;
  mem_sequencer sequencer;
  //mem_monitor monitor;
 
  // UVM automation macros for general components
  `uvm_component_utils(mem_agent)
 
  // constructor
  function new (string name, uvm_component parent);
    super.new(name, parent);
  endfunction : new
 
  // build_phase
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
 
      driver = mem_driver::type_id::create("driver", this);
      sequencer = mem_sequencer::type_id::create("sequencer", this);

 
  endfunction : build_phase
 
  // connect_phase
  function void connect_phase(uvm_phase phase);
      super.connect_phase(phase);
      driver.seq_item_port.connect(sequencer.seq_item_export);

  endfunction : connect_phase
 
endclass : mem_agent

class mem_model_test extends uvm_test;
 
  `uvm_component_utils(mem_model_test)
 
  mem_agent agent;
  mem_sequence seq;
 
  function new(string name = "mem_model_test",uvm_component parent=null);
    super.new(name,parent);
  endfunction : new
 
  virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);
 
    agent = mem_agent::type_id::create("agent", this);
    seq = mem_sequence::type_id::create("seq",this);
  endfunction : build_phase
 
  task run_phase(uvm_phase phase);
  phase.raise_objection(this);
 // seq.start(env.mem_agnt.sequencer);
    phase.drop_objection(this);
  endtask : run_phase
 
endclass : mem_model_test

```

```verilog
interface mem_if(input logic clk,reset);
  
  //---------------------------------------
  //declaring the signals
  //---------------------------------------
  logic [1:0] addr;
  logic wr_en;
  logic rd_en;
  logic [7:0] wdata;
  logic [7:0] rdata;
  
  //---------------------------------------
  //driver clocking block
  //---------------------------------------
  clocking driver_cb @(posedge clk);
    default input #1 output #1;
    output addr;
    output wr_en;
    output rd_en;
    output wdata;
    input rdata;  
  endclocking
  
  //---------------------------------------
  //monitor clocking block
  //---------------------------------------
  clocking monitor_cb @(posedge clk);
    default input #1 output #1;
    input addr;
    input wr_en;
    input rd_en;
    input wdata;
    input rdata;  
  endclocking
  
  //---------------------------------------
  //driver modport
  //---------------------------------------
  modport DRIVER (clocking driver_cb,input clk,reset);
  
  //---------------------------------------
  //monitor modport  
  //---------------------------------------
  modport MONITOR (clocking monitor_cb,input clk,reset);
  
endinterface

module memory
  #( parameter ADDR_WIDTH = 2,
     parameter DATA_WIDTH = 8 ) (
    input clk,
    input reset,
    
    //control signals
    input [ADDR_WIDTH-1:0] addr,
    input wr_en,
    input rd_en,
    
    //data signals
    input [DATA_WIDTH-1:0] wdata,
    output [DATA_WIDTH-1:0] rdata
  ); 
  
  reg [DATA_WIDTH-1:0] rdata;
  
  //Memory
  reg [DATA_WIDTH-1:0] mem [2**ADDR_WIDTH];

  //Reset 
  always @(posedge reset) 
    for(int i=0;i<2**ADDR_WIDTH;i++) mem[i]=8'hFF;
   
  // Write data to Memory
  always @(posedge clk) 
    if (wr_en) mem[addr] <= wdata;

  // Read data from memory
  always @(posedge clk)
    if (rd_en) rdata <= mem[addr];

endmodule

module tbench_top;

  //---------------------------------------
  //clock and reset signal declaration
  //---------------------------------------
  bit clk;
  bit reset;
  
  //---------------------------------------
  //clock generation
  //---------------------------------------
  always #5 clk = ~clk;
  
  //---------------------------------------
  //reset Generation
  //---------------------------------------
  initial begin
    reset = 1;
    #5 reset =0;
  end
  
  //---------------------------------------
  //interface instance
  //---------------------------------------
  mem_if intf(clk,reset);
  
  //---------------------------------------
  //DUT instance
  //---------------------------------------
  memory DUT (
    .clk(intf.clk),
    .reset(intf.reset),
    .addr(intf.addr),
    .wr_en(intf.wr_en),
    .rd_en(intf.rd_en),
    .wdata(intf.wdata),
    .rdata(intf.rdata)
   );
  
  //---------------------------------------
  //passing the interface handle to lower heirarchy using set method 
  //and enabling the wave dump
  //---------------------------------------
  initial begin 
    uvm_config_db#(virtual mem_if)::set(uvm_root::get(),"*","pointer_to_interface",intf);
    //enable wave dump
    //$dumpfile("dump.vcd"); 
   // $dumpvars;
  end
  
  //---------------------------------------
  //calling test
  //---------------------------------------
  initial begin 
    run_test();
  end
  
endmodule

```

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [August 21, 2018, 4:19pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/2 "2018-08-21T16:19:23Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896):_

Your problem is you extended **uvm\_driver** without specifying a parameter (mem\_seq\_item) for **REQ**.

---

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 21, 2018, 11:26pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/3 "2018-08-21T23:26:43Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/2):_

> _In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/2):_  
> Your problem is you extended **uvm\_driver** without specifying a parameter (mem\_seq\_item) for **REQ**.

Thanks Dave, i fixed the code. it worked! But , addr ,wr\_en, rd\_en, wdata ,rdata are unknown,  
i used req.randomize() in body task. why the addr,wr\_en, rd\_en, wdata ,rdata can not be randomized?  
Here is new driver code

```verilog

 `define DRIV_IF pointer_to_interface.DRIVER.driver_cb
class mem_driver extends uvm_driver #(mem_seq_item);
   `uvm_component_utils(mem_driver);

 virtual mem_if pointer_to_interface;
   
 function new (string name, uvm_component parent);
      super.new(name,parent);

 endfunction : new

 virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    
	if(!uvm_config_db #(virtual mem_if)::get(null, "*","pointer_to_interface", pointer_to_interface))
        $fatal("Failed to get BFM");
		
 endfunction : build_phase
   

 task run_phase(uvm_phase phase);

      phase.raise_objection(this);
    forever begin
        seq_item_port.get_next_item(req);
      drive();
        seq_item_port.item_done();
    end

      phase.drop_objection(this);
 endtask : run_phase

   
  virtual task drive();
    `DRIV_IF.wr_en <= 0;
    `DRIV_IF.rd_en <= 0;
    @(posedge pointer_to_interface.DRIVER.clk);
        `DRIV_IF.addr <= req.addr;
      if(req.wr_en) begin
        `DRIV_IF.wr_en <= req.wr_en;
        `DRIV_IF.wdata <= req.wdata;

    @(posedge pointer_to_interface.DRIVER.clk);
      //end
    if(req.rd_en) begin
        `DRIV_IF.rd_en <= req.rd_en;
    @(posedge pointer_to_interface.DRIVER.clk);
       `DRIV_IF.rd_en <= 0;
    @(posedge pointer_to_interface.DRIVER.clk);
        req.rdata = `DRIV_IF.rdata;
      end   
  endtask : drive  
endclass

```

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [August 22, 2018, 6:13am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/4 "2018-08-22T06:13:01Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/3):_

Are you sure

```verilog
seq_item_port.get_next_item(req);

```

is completing, i.e. get a req?

Could you please show your sequence code?  
BTW the connection to the virtual interface should be made in the connect\_phase.

---

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 22, 2018, 7:08am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/5 "2018-08-22T07:08:32Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/4):_

> _In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/4):_  
> Are you sure

```verilog
seq_item_port.get_next_item(req);

```

is completing, i.e. get a req?  
Could you please show your sequence code?  
BTW the connection to the virtual interface should be made in the connect\_phase.

Hi chr\_sue. why virtual interface should be made in the connect\_phase? thanks!  
here is sequence code

```verilog
 
class mem_sequence extends uvm_sequence#(mem_seq_item);
 
  `uvm_object_utils(mem_sequence )
  //`uvm_sequence_utils(mem_sequence,mem_sequencer)
 
  //Constructor
  function new(string name = "mem_sequence");
    super.new(name);
  endfunction
 

 
  virtual task body();
 
   req = mem_seq_item::type_id::create("req");
   // wait_for_grant();
    req.randomize();
    send_request(req);
  // wait_for_item_done();
 
  endtask
 
endclass

```

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [August 22, 2018, 7:46am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/6 "2018-08-22T07:46:24Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/5):_

Your body task is incomplete. It should look like this:

```verilog
 virtual task body();
   req = mem_seq_item::type_id::create("req");
   start_item(req);
   void'(req.randomize());
   finish_item(req); 
  endtask

```

---

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 22, 2018, 12:38pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/7 "2018-08-22T12:38:01Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/6):_

Hi ,  
i find that task body() is not executed, so req is always null . But, why my task body is not executed?

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [August 22, 2018, 1:20pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/8 "2018-08-22T13:20:50Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/7):_  
It looks like you did not implement the interface between your driver and the sequencer correctly. Did you modify the body task as I was proposing?

---

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 22, 2018, 2:20pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/9 "2018-08-22T14:20:43Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/8):_

> _In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/8):_  
> It looks like you did not implement the interface between your driver and the sequencer correctly. Did you modify the body task as I was proposing?

Yes , i modified the body task which you suggest. But , it did not work  
the addr ,wr\_en,rd\_en etc still are unknown.  
I dont know why The task body is not executed  
here is task body code

```verilog
 
 virtual task body();
   mem_seq_item req;
   req = mem_seq_item::type_id::create("req");
   start_item(req);
   req.randomize();
   finish_item(req); 
  endtask

```

Thanks

---

<div class="post-metadata">

**Author:** ![letheverifguy](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/c68b51/32.png) [@letheverifguy](https://verificationacademy.com/forums/u/letheverifguy)\
**Post date:** [August 22, 2018, 6:53pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/10 "2018-08-22T18:53:06Z")

</div>

@peter:

when you say "the addr ,wr\_en,rd\_en etc still are unknown. ", is it for every clock? only when driver drives it? always? did you print the req in the “drive” task?

also , please always make sure you use the same clocking block clk , which you are using to drive the signals.  
try updating the “drive” task to this.

```verilog
  virtual task drive();
    `DRIV_IF.wr_en <= 0;
    `DRIV_IF.rd_en <= 0;
    @(`DRIV_IF);
        `DRIV_IF.addr <= req.addr;
      if(req.wr_en) begin
        `DRIV_IF.wr_en <= req.wr_en;
        `DRIV_IF.wdata <= req.wdata;
      end
    @(`DRIV_IF);
      //end
    if(req.rd_en) begin
        `DRIV_IF.rd_en <= req.rd_en;
    @(`DRIV_IF);
       `DRIV_IF.rd_en <= 0;
    @(`DRIV_IF);
        req.rdata = `DRIV_IF.rdata;
      end   
  endtask : drive  

```

---

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [August 22, 2018, 7:15pm UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/11 "2018-08-22T19:15:59Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/10):_

1. Did you start your sequence in your test with specific sequencer?
2. In driver, raise/drop objection for a forever loop is terrible. I wonder how your simulation finish?

---

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 23, 2018, 12:14am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/12 "2018-08-23T00:14:23Z")

</div>

_In reply to [chris\_le](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/11):_

i set break point in task body(). i found that task body() never be executed. i think the problem is not related to driver. i am confused that why the body() is not executed  
can anyone give some suggestions?  
Thanks!!

---

<div class="post-metadata">

**Author:** ![cuonghle](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/cuonghle/32/3231_2.png) [@cuonghle](https://verificationacademy.com/forums/u/cuonghle)\
**Post date:** [August 23, 2018, 1:41am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/13 "2018-08-23T01:41:14Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/12):_

Did you check #1 that I suggested? Did you start your sequence in your test?  
Check again the line:

```verilog

seq.start(env.mem_agnt.sequencer);

```

Please make sure you have the line above in your test, the body method is executed once you start the sequence correctly.

One more thing, as I mentioned in #2, dont use raise/drop objection in run\_phase of driver where you have forever loop. I dont think your test will finish with your implementation.  
The objection should be raised/dropped in your test only where you start the sequence.

---

<div class="post-metadata">

**Author:** ![chr\_sue](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/chr_sue/32/1199_2.png) [@chr\_sue](https://verificationacademy.com/forums/u/chr_sue)\
**Post date:** [August 23, 2018, 6:15am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/14 "2018-08-23T06:15:55Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/13):_

> _In reply to [chris\_le](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/13):_  
> i set break point in task body(). i found that task body() never be executed. i think the problem is not related to driver. i am confused that why the body() is not executed  
> can anyone give some suggestions?  
> Thanks!!

I’d recommend to clean-up your driver code. The task drive is never working. You are using very different names for your virtual interface.  
There is the problem with your code. And also in your design you have weaknesses.  
Your simulator should point you these places.

---

<div class="post-metadata">

**Author:** ![peter1](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/peter1/32/1304_2.png) [@peter1](https://verificationacademy.com/forums/u/peter1)\
**Post date:** [August 24, 2018, 3:38am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/15 "2018-08-24T03:38:10Z")

</div>

_In reply to [chr\_sue](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/14):_

Yes, i use seq.start() in run\_phase in uvm\_test.Now, the task body() works.  
But , the driver seems has some problems.  
here is my modified driver and interface 's code. there is compiler error related to @(posedge `DRIV\_IF);  
I am still finding the reason

```verilog
interface mem_if(input logic clk,reset);
 

  logic [1:0] addr;
  logic wr_en;
  logic rd_en;
  logic [7:0] wdata;
  logic [7:0] rdata;
 
  //---------------------------------------
  //driver clocking block
  //---------------------------------------
  clocking driver_cb @(posedge clk);
    default input #1 output #1;
    output addr;
    output wr_en;
    output rd_en;
    output wdata;
    input rdata;  
  endclocking
 

  //---------------------------------------
  //driver modport
  //---------------------------------------
  //modport DRIVER (clocking driver_cb,input clk,reset);

endinterface

 `define DRIV_IF pointer_to_interface.driver_cb
class mem_driver extends uvm_driver #(mem_seq_item);
   `uvm_component_utils(mem_driver);
 
 virtual mem_if pointer_to_interface;
 
 function new (string name, uvm_component parent);
      super.new(name,parent);
 
 endfunction : new
 
 virtual function void build_phase(uvm_phase phase);
    super.build_phase(phase);
 
	if(!uvm_config_db #(virtual mem_if)::get(null, "*","pointer_to_interface", pointer_to_interface))
        $fatal("Failed to get BFM");
 
 endfunction : build_phase
 
 
 task run_phase(uvm_phase phase);
 
      phase.raise_objection(this);
    forever begin
        seq_item_port.get_next_item(req);
      drive();
        seq_item_port.item_done();
    end
 
      phase.drop_objection(this);
 endtask : run_phase

  virtual task drive();
    `DRIV_IF.wr_en <= 0;
    `DRIV_IF.rd_en <= 0;
    @(posedge `DRIV_IF);
        `DRIV_IF.addr <= req.addr;
      if(req.wr_en) begin
        `DRIV_IF.wr_en <= req.wr_en;
        `DRIV_IF.wdata <= req.wdata;
      end
    @(posedge `DRIV_IF);  
      if(req.rd_en) begin
        `DRIV_IF.rd_en <= req.rd_en;
    @(posedge `DRIV_IF);
       `DRIV_IF.rd_en <= 0;
    @(posedge `DRIV_IF);
        req.rdata = `DRIV_IF.rdata;
     end  
  endtask : drive 
 endclass

```

---

<div class="post-metadata">

**Author:** ![letheverifguy](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/l/c68b51/32.png) [@letheverifguy](https://verificationacademy.com/forums/u/letheverifguy)\
**Post date:** [August 24, 2018, 4:11am UTC](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/16 "2018-08-24T04:11:35Z")

</div>

_In reply to [peter](https://verificationacademy.com/forums/t/error-message-can-not-find-the-member-in-the-class/34896/15):_

the clocking block already has the cloking event as posedge clk , so you don’t need to state  
@(posedge `DRIV_IF), @(`DRIV\_IF) ← is the right way to ask for the posedge event.

its that simple.
