Error when calling a put(pkt) from a task

Hi

This is the first time I am using TLM ports. And I appreciate any pointers to help me fix the issue I am facing.

I am trying to create TLM put port in my test bench which I want to connect to my scoreboard export. I am facing the following error → Error: task enable calls an object that is not a task.

Here is what I am doing:

I have a base_test with a task create_tx_frame_buffer which is creating a packet. As soon as I create a pkt, I want to add this packet to the TLM port and use it in my scoreboard for checking the data integrity after I receive at the other end.

task geth_base_test::create_tx_frame;
	txpkt	= geth_tx_frame::type_id::create("txpkt", this);
	txpkt.randomize();
	m_env.m_txn_port.put_port(txpkt);
endtask

This is my m_txn_port code:

class geth_txn_port extends uvm_component;
	`uvm_component_utils (geth_txn_port)
   uvm_blocking_put_port #(geth_tx_frame) put_port;
   geth_tx_frame  pkt;

  function new (string name = "geth_txn_port", uvm_component parent);
     super.new (name, parent);
  endfunction

   virtual function void build_phase (uvm_phase phase);
      super.build_phase (phase);
      put_port = new ("put_port", this);
   endfunction

endclass: geth_txn_port

This is my scoreboard which is under development

class geth_scoreboard extends uvm_scoreboard;
   `uvm_component_utils (geth_scoreboard)

   uvm_blocking_put_imp #(geth_tx_frame, geth_scoreboard) put_export;

   function new (string name = "geth_scoreboard", uvm_component parent);
      super.new (name, parent);
   endfunction
 
   virtual function void build_phase (uvm_phase phase);
      super.build_phase (phase);
      put_export = new ("put_export", this);
   endfunction
 
   task put (geth_tx_frame pkt);
      `uvm_info (get_full_name(), "Packet received from Put port", UVM_LOW)
      pkt.printInfo ();
   endtask
endclass

In reply to yasaswi93:

Just figured I wasn’t actually calling the put :(

m_env.m_txn_port.put_port.put(txpkt); //fixed it

In reply to yasaswi93:

As you have defined it, put_port is a class variable that holds a handle to a uvm_blocking_put_port object (assuming you’ve connected it properly in code you did not show).

You need to call the put() method, so your code should be

	m_env.m_txn_port.put_port.put(txpkt);