首页 > 其他分享 >TLM通信示例4:TLM Port export imp port连接

TLM通信示例4:TLM Port export imp port连接

时间:2022-09-05 15:45:52浏览次数:86  
标签:示例 comp component uvm phase trans port TLM

TLM Port export imp port连接

在前面的示例中,我们已经看到将端口连接到 imp 端口。此示例显示连接 TLM port -> export -> Imp_port。

TLM TesetBench 组件:

————————————————————— 
Name                Type 
————————————————————— 
uvm_test_top         basic_test 
env                        environment 
comp_a                 component_a 
trans_out               uvm_blocking_put_port 
comp_b                 component_b
sub_comp_b_a      sub_component_b_a 
trans_in                 uvm_blocking_put_imp 
trans_in               uvm_blocking_put_export 
—————————————————————

在 comp_a 中实现 TLM port,

在 comp_a 中实现 TLM port涉及以下步骤:

1. 声明 uvm_blocking_put_port

2. 创建端口

3. 随机化事务类

4. 通过 put() 方法将事务发送到 comp_b

class component_a extends uvm_component;
  //Step-1. Declaring blocking port
  uvm_blocking_put_port #(transaction) trans_out;
  
  ùvm_component_utils(component_a)
  
  //---------------------------------------
  // Constructor
  //---------------------------------------
  function new(string name, uvm_component parent);
    super.new(name, parent);
      trans_out = new("trans_out", this);  //Step-2. Creating the port
  endfunction : new
  //---------------------------------------
    // run_phase
  //---------------------------------------
  virtual task run_phase(uvm_phase phase);
    phase.raise_objection(this);
    
    trans = transaction::type_id::create("trans", this);
    void'(trans.randomize());  //Step-3. randomizing the transction
    `uvm_info(get_type_name(),$sformatf(" tranaction randomized"),UVM_LOW)
    `uvm_info(get_type_name(),$sformatf(" Printing trans, \n %s",trans.sprint()),UVM_LOW)
    `uvm_info(get_type_name(),$sformatf(" Before calling port put method"),UVM_LOW)
     trans_out.put(trans);  //Step-4. Sending trans through port put method
    `uvm_info(get_type_name(),$sformatf(" After  calling port put method"),UVM_LOW)
    
    phase.drop_objection(this);
  endtask : run_phase
endclass : component_a

在 sub_comp_b_a 中实现 TLM port

在 sub_comp_b_a 中实现 TLM 端口涉及以下步骤,

1. 声明 uvm_blocking_put_imp

2. 创建 imp 端口

3. 实现 put() 方法来接收事物

class sub_component_b_a extends uvm_component;
  
  transaction trans;
  //Step-1. Declaring blocking imp port 
  uvm_blocking_put_imp#(transaction,sub_component_b_a) trans_in; 
  ùvm_component_utils(sub_component_b_a)
  
  //---------------------------------------
  // Constructor
  //---------------------------------------
  function new(string name, uvm_component parent);
    super.new(name, parent);
    trans_in = new("trans_in", this);  //Step-2. Creating imp port
  endfunction : new
  
  //---------------------------------------
  // Imp port put method
  //---------------------------------------
  //Step-3. Implementing imp port
  virtual task put(transaction trans);
    `uvm_info(get_type_name(),$sformatf(" Recived trans On IMP Port"),UVM_LOW)
    `uvm_info(get_type_name(),$sformatf(" Printing trans,\n %s",trans.sprint()),UVM_LOW)
  endtask
endclass : sub_component_b_a

在 comp_b 中实现 TLM export

在 comp_b 中实现 TLM export包括以下步骤: 

1. 声明 uvm_blocking_put_export

2. 创建export

3. 将export连接到 imp port

class component_b extends uvm_component;
  
  sub_component_b_a sub_comp_b_a;
  //Step-1. Declaring blocking export
  uvm_blocking_put_export#(transaction) trans_in; 
  `uvm_component_utils(component_b)
  
  //---------------------------------------
  // Constructor
  //---------------------------------------
  function new(string name, uvm_component parent);
    super.new(name, parent);
    trans_in = new("trans_in", this);  //Step-2. Creating export
  endfunction : new
  
  //---------------------------------------
  // build_phase - Create the components
  //---------------------------------------
  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    sub_comp_b_a = sub_component_b_a::type_id::create("sub_comp_b_a", this);
  endfunction : build_phase
  
  //---------------------------------------
  // Connect_phase
  //---------------------------------------
  function void connect_phase(uvm_phase phase);
     trans_in.connect(sub_comp_b_a.trans_in);  //Step-3. Connecting export to the imp port
  endfunction : connect_phase
endclass : component_b

在 env 中 将comp_a port与 comp_b export连接。

function void connect_phase(uvm_phase phase);
    comp_a.trans_out.connect(comp_b.trans_in);  //Connecting port with export
endfunction : connect_phase

仿真结果:

UVM_INFO @ 0: reporter [RNTST] Running test basic_test...
--------------------------------------------------------
Name                Type                     Size  Value
--------------------------------------------------------
uvm_test_top        basic_test               -     @1817
  env               environment              -     @1884
    comp_a          component_a              -     @1916
      trans_out     uvm_blocking_put_port    -     @1967
    comp_b          component_b              -     @2000
      sub_comp_b_a  sub_component_b_a        -     @2084
        trans_in    uvm_blocking_put_imp     -     @2134
      trans_in      uvm_blocking_put_export  -     @2050
--------------------------------------------------------
UVM_INFO component_a.sv(29) @ 0: uvm_test_top.env.comp_a [component_a]  tranaction randomized
UVM_INFO component_a.sv(30) @ 0: uvm_test_top.env.comp_a [component_a]  Printing trans, 
 ---------------------------------
Name     Type         Size  Value
---------------------------------
trans    transaction  -     @2187
  addr   integral     4     'h3  
  wr_rd  integral     1     'h0  
  wdata  integral     8     'h33 
---------------------------------

UVM_INFO component_a.sv(32) @ 0: uvm_test_top.env.comp_a [component_a]  Before calling port put method
UVM_INFO sub_component_b_a.sv(24) @ 0: uvm_test_top.env.comp_b.sub_comp_b_a [sub_component_b_a]  Recived trans On IMP Port
UVM_INFO sub_component_b_a.sv(26) @ 0: uvm_test_top.env.comp_b.sub_comp_b_a [sub_component_b_a]  Printing trans, 
 ---------------------------------
Name     Type         Size  Value
---------------------------------
trans    transaction  -     @2187
  addr   integral     4     'h3  
  wr_rd  integral     1     'h0  
  wdata  integral     8     'h33 
---------------------------------
UVM_INFO component_a.sv(34) @ 0: uvm_test_top.env.comp_a [component_a]  After  calling port put method
UVM_INFO /xcelium20.09/tools//methodology/UVM/CDNS-1.2/sv/src/base/uvm_objection.svh(1271) @ 0: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase
UVM_INFO /xcelium20.09/tools//methodology/UVM/CDNS-1.2/sv/src/base/uvm_report_server.svh(847) @ 0: reporter [UVM/REPORT/SERVER] 

 

标签:示例,comp,component,uvm,phase,trans,port,TLM
From: https://www.cnblogs.com/fuqiangblog/p/16658385.html

相关文章

  • 通用mapper集成示例
    目录插件介绍项目结构导入pom依赖配置文件通用Mapper:分页插件:注意事项(默认是不用加的):测试脚手架项目配置easyCodeIDEA插件自动生成xml文件,开发效率简直无敌插件介绍......
  • 样式优先级的规则:!important`>行内样式>嵌入样式>外链样式>id选择器>类选择器>标签选
    CSS样式的优先级应该分成四大类第一类`!important`,无论引入方式是什么,选择器是什么,它的优先级都是最高的。第二类引入方式,行内样式的优先级要高于嵌入和外链,嵌入和外链如......
  • RDLC报表设计1: 添加ReportViewer Control
    https://docs.microsoft.com/en-us/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql......
  • TLM通信示例1:Connecting TLM Port and Imp Port
    让我们考虑一个由两个组件component_a和component_b以及一个事务类组成的示例。component_a和component_b对象在env中创建,分别命名为comp_a和comp_b事务类在co......
  • 【The connection to the server localhost:8080 was refused - did you specify the
    问题k8s报错$kubectlgetnodeTheconnectiontotheserverlocalhost:8080wasrefused-didyouspecifytherighthostorport?解决方法将master节点中的/......
  • XMReport与IReport后端性能对比
    之前XMReport由于没有对重复的图片以及内存使用进行优化,导致性能相对于IReport有较大幅度落后,经优化后,已经在内存使用以及性能方面领先于IReport。本次测试主要从并发数方......
  • import declarations are not supported by current JavaScript version
    Idea的js文件报错:ImportdeclarationsarenotsupportedbycurrentJavaScriptversion报这个错原因是,vue用的es6的语法,解决的话也很简单,只需要把idea的javaScript的版......
  • 您应该查看的 10 个优秀的关于页面示例
    您应该查看的10个优秀的关于页面示例NEOM研究表明,关于页面是新用户希望看到的第一个页面之一,因为关于页面显示了新用户希望看到的网站背后公司的更多详细信息。我们......
  • TLM通信总结1
    事务级建模(TLM)用于模块之间的通信。TLM是实现基于事务的方法的概念,这些方法可用于模块之间的通信。UVMTLMUVM为TLM库提供事务级接口,ports,exports,impports,and......
  • Rust常用并发示例代码
    记录几个常用的并发用法:1、如何让线程只创建1次先看一段熟悉的java代码:voidmethod1(){newThread(()->{while(true){System.out.pri......