可以有两个' uvm_tlm_b_target_socket'和两个相应的' b_transport'在单个对象中实现?

时间:2016-07-03 05:21:43

标签: uvm

我有一个要求,我需要在课堂上有两个uvm_tlm_b_target_socket,因为它将从两个不同的代理接收交易。我需要以不同方式处理从两个套接字接收的数据,因此我无法单独执行b_transport任务。是否有任何等价的目标套接字到分析端口的终结符我们可以使用uvm_analysis_imp_decl宏,它允许我们有write函数的不同实现?在课程参考手册中,我可以找到此宏uvm_blocking_transport_imp_decl,但无法找到如何使用它的示例。总之,我正在尝试这样做

uvm_tlm_b_target_socket A;
umv_tlm_b_target_socket B;

// b_transport task implementation for socket "A"
task b_transport;

// b_transport task implementation for socket "B"
task b_transport;

2 个答案:

答案 0 :(得分:1)

uvm_tlm_b_target_socket在实例化时需要提供两个参数。

1)实现--b_transport所在的基类

2)另一个是数据项本身。

   uvm_tlm_b_target_socket #(receiver, data_item) A;

您的接收器类中只能有1个transport_b函数。 但是您可以使用包装器类将接收器类中的其他函数连接到其他目标套接字。

typedef class receiver; // name of the parent class processing the transport call.

class connect_transport ; // does not need to be a component but if you need it can - extends uvm_component;
receiver m_parent; // parent class 
   function new(string name = "receiver", receiver parent = null);
        m_parent = parent; // connect the parent class 
   endfunction
   task b_transport(data_item data, uvm_tlm_time delay);
        // transport_b for B.
        m_parent.b_transport_b(data,delay); // call the function in the parent class.
   endtask
endclass

在接收器类

class receiver  extends umm_component ; 
`uvm_component_utils(receiver)
    connect_transport    c1;

.....
   uvm_tlm_b_target_socket #(receiver, data_item) A; // connects to the local b_transport function 
   uvm_tlm_b_target_socket #(connect_transport, data_item) B; // connect to the wrapper class

  function new(string name = "receiver", uvm_component parent = null);
      super.new(name, parent);
      A = new("A", this);
      c1 = new ("c1",this); // create the connecting class 
      B = new("B", this,c1); // connect the target socket to the connecting class

  endfunction

  //for socket B
  task b_transport_b(data_item data, uvm_tlm_time delay);
  ......
  end task

  // will be connected to A socket.
  task b_transport(data_item data, uvm_tlm_time delay);
  ......
  end task 
endclass

您可以将其包装到宏中,并具有_imp_decl类型的实现。  您也可以直接在connect_transport中实现检查。

答案 1 :(得分:0)

除了经典的TLM2套接字外,还有*_transport_imps。据我所知,这些与套接字相同。您使用*_decl宏就像使用uvm_analysis_imp_decl

一样
class some_class;
  `uvm_blocking_transport_imp_decl(_a)
  `uvm_blocking_transport_imp_decl(_a)

  uvm_transport_imp_a A;
  umv_transport_imp_b B;

  task b_transport_a(...);
  task b_transport_b(...);
endclass