UVM入门和进阶实验0

一. 概述

UVM学习流程仍然按照SV时候的核心流程,即:

  • 如何搭建验证框架
  • 验证组件之间的连接和通信
  • 如何编写测试用例,继而完成复用和覆盖率的收敛

我们UVM入门和进阶实验0还是同之前SV验证实验0思想一样,让大家通过简单的实验要求,从而掌握下面的基本概念和仿真操作:

  • 懂得如何编译UVM代码。
  • 理解SV和UVM之间的关系。
  • 了解UVM验证顶层盒子与SV验证顶层盒子之间的联系。
  • 掌握启动UVM验证的必要步骤。

二. 编译UVM代码

(1)导入uvm_dass_inst.sv,sv_class_inst.sv,uvm_test_inst.sv,uvm_compile.sv并且compile select
在这里插入图片描述
(2)编译文件uvm_compile.sv,选项为:simulate without optimization,待正常编译结束。

module uvm_compile;
  // NOTE:: it is necessary to import uvm package and macros
  import uvm_pkg::*; //预编译的uvm的库
  `include "uvm_macros.svh"//预编译的uvm的库

  initial begin
    `uvm_info("UVM", "Hello, welcome to RKV UVM training!", UVM_LOW)
    #1us;
    `uvm_info("UVM", "Bye, and more gifts waiting for you!", UVM_LOW)
  end
endmodule

在这里插入图片描述
uvm_pkg可以在mtiUvm中找到。
在这里插入图片描述
(3)在命令窗口中敲入"run-all",可以观察到仿真输出语句:
在这里插入图片描述

三. SV和UVM之间的关系

(1)编译sv_class_inst

module sv_class_inst;
  import uvm_pkg::*;
  `include "uvm_macros.svh"

  class top;
    function new();
      `uvm_info("SV_TOP", "SV TOP creating", UVM_LOW)
    endfunction
  endclass

  initial begin
    top t; 
    `uvm_info("SV_TOP", "test started", UVM_LOW)
    t = new();
    `uvm_info("SV_TOP", "test finished", UVM_LOW)
  end
endmodule

编译结果:
在这里插入图片描述

反映在sim中的结构图:
在这里插入图片描述
其实在0时刻的时候创建了t,并且结束了仿真,但是在instance中没有显示。获得显示的过程为:
首先transcipt中输入restart
然后点击sv_class_inst,将断点设置在17行,
再者transcipt中输入run -all,
点击view-local,
选中initial过程块,local中会显示t变量。
在这里插入图片描述
run -all的仿真结果:
在这里插入图片描述
(2)编译uvm_class_inst

module uvm_compile;
  // NOTE:: it is necessary to import uvm package and macros
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  
  class top extends uvm_component;
    `uvm_component_utils(top)
    function new(string name = "top", uvm_component parent = null);
      super.new(name, parent);
      `uvm_info("UVM_TOP", "SV TOP creating", UVM_LOW)
    endfunction
  endclass

  initial begin
    `uvm_info("UVM", "Hello, welcome to RKV UVM training!", UVM_LOW)
    #1us;
    `uvm_info("UVM", "Bye, and more gifts waiting for you!", UVM_LOW)
  end
endmodule

编译结果:
在这里插入图片描述
run -all仿真结果:
在这里插入图片描述

四. UVM验证顶层盒子与SV验证顶层盒子之间的联系。

编译并仿真uvm_test_inst.sv

package test_pkg;
  import uvm_pkg::*;
  `include "uvm_macros.svh"

  class top extends uvm_test;
    `uvm_component_utils(top)
    function new(string name = "top", uvm_component parent = null);
      super.new(name, parent);
      `uvm_info("UVM_TOP", "SV TOP creating", UVM_LOW)
    endfunction
    task run_phase(uvm_phase phase);
      phase.raise_objection(this);
      `uvm_info("UVM_TOP", "test is running", UVM_LOW)
      phase.drop_objection(this);
    endtask
  endclass
endpackage

module uvm_test_inst;
  import uvm_pkg::*;
  `include "uvm_macros.svh"
  import test_pkg::*;

  initial begin
    `uvm_info("UVM_TOP", "test started", UVM_LOW)
    run_test("top");
    `uvm_info("UVM_TOP", "test finished", UVM_LOW)
  end

endmodule

仿真结果:
在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

马志高

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值