一、介绍
在验证环境中,验证平台组件通常以同步的方式通信,以有效地实现时间精确检查,System Verilog event是专用的、广泛使用的数据类型,用于实现组件之间所需的同步通信。UVM有一个内置的专门的类围绕sv事件,这拓宽了基于事件通信的应用和使用,本文突出介绍uvm_event的使用和好处
二、System Verilog Events
sv的event是一种没有存储空间的数据类型。它可以使用“->”操作符触发,事件触发发生可以通过使用“@”操作符或内置的.trigger方法捕获
三、uvm_event
uvm_event是使用sv event创建的参数化包装类,其继承关系如下:
class uvm_event #(type T=uvm_object) extends uvm_object
四、uvm_event Methods
Frequently used Methods | Description |
trigger(T data = null) | Trigger an event |
wait_trigger() | Waiting for an event. A system Verilog equivalent of @ operator |
wait_ptrigger() | Waiting for a persistent trigger. A system Verilog equivalent of .triggered. Avoids any race condition |
get_trigger_data() | Gets data if any provided by the last call to trigger |
wait_trigger_data(output T data) | Call and returns get_trigger_data method value followed by wait_trigger |
wait_ptrigger_data(output T data) | Call and returns get_trigger_data method value followed by wait_ptrigger |
五、uvm_event_pool
uvm_event_pool是围绕uvm_events的关联数组构建的一个单例类,该关联数组由字符串 索引,这允许在整个验证环境 Hierarchy中的组件之间共享项。
六、uvm_event_pool Methods
Frequently used Methods | Description |
get_global_pool() | Returns the singleton global pool for the item type, T. |
get_global(key) | Returns the specified item instance from the global item pool. |
get(key) | Returns the item with the given key. |
add(key,item) | Adds the given (key, item) pair to the pool. If an item already exists at the given key it is overwritten with the new item. |
七、uvm event and pool usage
八、案例学习
1、中断案例
中断是dut模块在满足特定条件时触发的事件;CPU必须为这些事件服务,在服务中断时由CPU负责的操作统称为-中断服务例程(ISR)
2、Callbacks
uvm_event_callback类是一个抽象类,用来创建一个回调对象,它附加到uvm_event#(T),如下所示代码 uvm_event_callback类有两个空的虚方法。用户必须创建一个从uvm_event_callback扩展的回调类,并且必须覆盖虚方法来实现所需的功能, 回调支持是任何VIP的主要特性之一.
3、验证平台感知复位(Reset Aware Testbench)
处理动态复位是验证平台设计的挑战之一,UVM方法没有定义必须如何处理动态复位,复位是一个主要的破坏性事件,可以发生在任何时间点,这是非常重要的,以确保芯片存在的复位和恢复正常操作没有任何问题。
常用的4个组件需要感知复位(driver、monitor、sorceboard、sequences)
diver----复位期间不驱动数据。
monitor---事务之间复位,应把事务数据置为无效。
Scoreboard---复位时,应该清空fifo
sequence----复位后,sequence之前需要重新配置
九、结论
uvm_event和事件池提供了验证环境中多线程或并发进程之间的同步, 可以观察到,通过使用uvm_event,我们可以实现更好的同步,而不需要对现有的测试台进行重大更改 uvm_event包装类围绕传统系统Verilog事件添加方法,使uvm_event适用于更广泛和复杂的应用程序,而不仅仅是同步