提高验证生产力的关键之一就是在合适的抽象层次思考问题和完成验证工作,为此uvm提供了 事务级别(transaction level) 的通信接口 (transaction-level modeling,tlm) 。
在uvm中,transactions建模了两个组件之间通信所需的信息(变量、约束等等)。下面是一个简单的总线协议事务示例:
class simple_trans extends uvm_transaction; rand data_t data; rand addr_t addr; rand enum {write,read} kind; constraint c1 { addr < 16’h2000; } ...endclass有了transactions之后,还需要定义操作transactions的接口。
tlm **port **发起transactions操作,tlm export提供这些操作transactions方法的具体实现
basic tlm communication(put操作)
最基本的事务级别操作是一个 组件(component) 将事务put给另一个组件(component)。
producer上的方框表示port,consumer上的圆圈表示export。
producer组件代码如下
class producer extends uvm_component; uvm_blocking_put_port #(simple_trans) put_port; // 1 parameter function new( string name, uvm_component parent); put_port = new(“put_port”, this); ... endfunction virtual task run(); simple_trans t; for(int i = 0; i < n; i++) begin // generate t. put_port.put(t); end endtaskendclassproducer组件首先定义了 uvm_blocking_put_port ,指定参数化事务为simple_trans。然后在run()函数内发起put操作。
consumer组件代码如下
class consumer extends uvm_component; uvm_blocking_put_imp #(simple_trans, consumer) put_export; // 2 parameters ... task put(simple_trans t); case(t.kind) read: // do read. write: // do write. endcase endtaskendclassconsumer组件首先定义了uvm_blocking_put_imp,指定参数化事务为simple_trans,同时指定put函数的具体实现组件。put()函数的具体实现是在consumer内完成的。
basic tlm communication(get操作)
get事务级操作和put类似,
get_consumer上的方框表示port,get_producer上的圆圈表示export。
由get_consumer这个port处定义uvm_blocking_get_port,指定事务类型,发起get操作。
class get_consumer extends uvm_component; uvm_blocking_get_port #(simple_trans) get_port; function new( string name, uvm_component parent); get_port = new(“get_port”, this); ... endfunction virtual task run(); simple_trans t; for(int i = 0; i < n; i++) begin // generate t. get_port.get(t); end endtaskendclass然后在export处完成get操作的具体实现
class get_producer extends uvm_component; uvm_blocking_get_imp #(simple_trans, get_producer) get_export; ... task get(output simple_trans t); simple_trans tmp = new(); // assign values to tmp. t = tmp; endtaskendclass
盘点那些采用了黑科技的高端平板
战略合作 | IAR全面支持云途车规级MCU
无线通信标准大PK
基于ONNX结构分析
计划总投资3亿元!瑞声科技马来西亚智能制造基地投产
数字IC验证之基本的TLM通信
光纤温度传感器分类_光纤温度传感器发展前景
9个优秀的开源工单系统,你知道几个
ADI宣布推出LT8491降压-升压电池充电控制器
无人机拍照的7个技巧
苹果Homekit来了,您准备好了吗?
iphone8什么时候上市?iphone8概念图流出:后双摄光学变焦+卡尔察司,颜值升级堪称新一代怪兽
XREAL与宝马集团展示智能AR辅助的未来驾驶体验
如何构建一个低成本的Arduino MiniCNC绘图仪
动态补偿装置的元件构成与注意事项有哪些?
C语言函数的回调函数
PLC逻辑梯形图编程的特点
中国联通面向交通重磅发布了5G+车联网与智慧交通系列产品
Vishay推出耐高温的新款超薄、大电流电感器
表面声波触摸屏优缺点_表面声波触摸屏应用