在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 19810|回复: 21

[求助] 关于用irun跑uvm

[复制链接]
发表于 2012-5-4 17:36:34 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 oscillator_cn1 于 2012-5-4 17:40 编辑

各位:
     我正在学习UVM,看的是《A Practical Guide to Adopting the Universal Verification Methodology(UVM)》。书中第四章的例子4-4与4-2是关于UVM object automation的,我把这两个例子放一起用书中前面提供的命令irun -uvmhome $UVM_HOME automation_example.sv apb_transfer.sv 来试着编译一下,结果出了很多错误,其中一条大概是说uvm_object数据类型并不在当前范围可见。不知道这是为什么呢?是代码没全还是我的命令有问题,还是我使用UVM的方法错了?
     附上两段代码。example 4-2
typedef enum bit {APB_READ,APB_WRITE} apb_direction_enum;
class apb_transfer extends uvm_object;
    rand bit [31:0] addr;
    rand bit [31:0] data;
    rand apb_direction_enum direction;
    // Control field - does not translate into signal data
    rand int unsigned transmit_delay; //delay between transfers
    //UVM automation macros for data items
    `uvm_object_utils_begin (apb_transfer)
        `uvm_field_int(addr, UVM_DEFAULT)
        `uvm_field_int(data, UVM_DEFAULT)
        `uvm_field_enum(apb_direction_enum, direction, UVM_DEFAULT)
        `uvm_field_int(transmit_delay, UVM_DEFAULT|UVM_NOCOMPARE)
    `uvm_object_utils_end
    // Constructor - required UVM syntax
    function new (string name="apb_transfer");
        super.new(name);
    endfunction : new
endclass : apb_transfer
    example 4-4
`include "uvm_pkg.sv"
module automation_exampble;
    //Import the UVM library and liclude the UVM macros
    import uvm_pkg::*;
    `include "uvm_macros.svh"
    //Include the APB transfer class
    `include "apb_transfer.sv"
    apb_transfer my_xfer,tx1,tx2,tx3;
    initial begin
        my_xfer = apb_transfer::type_id::create("my_xfer");
        if(!my_xfer.randomize())
            `uvm_fatal("RENDFAIL","can not randomize my_xfer")
        tx1 = my_xfer;   //tx1 and my_xfer share the same memory
        //Create a new apb_transfer
        tx2=apb_transfer::type_id::create("tx2");
        tx2.copy(tx1);   //Copies fields from tx1 to tx2
        $cast(tx3,tx1.clone()); //Creates a new apb_transfer and copy all
                                //  specified fields from tx1 to tx3
        if(!tx3.compare(tx2))
            `uvm_error("CompareFailed","The comparion failed")
        my_xfer.print();    //Prints my_xfer in a table format
        my_xfer.print(uvm_default_tree_printer);// Prints in "tree" format
    end
endmodule:automation_exampble
然后irun.log中的错误提示为
class apb_transfer extends uvm_object;
                                             |
ncvlog: *E,SVNOTY (apb_transfer.sv,2|36): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.

请问,有没有人知道,这个到底是怎么回事的呀?
发表于 2012-5-6 09:42:13 | 显示全部楼层
确认一下你是否加载了UVM的lib
 楼主| 发表于 2012-5-7 09:16:34 | 显示全部楼层
那个,怎么确认?
发表于 2012-5-15 17:50:35 | 显示全部楼层
回复 3# oscillator_cn1


    直接用 -uvm 吧,或者加 +incdir+$UVM_HOME/src
 楼主| 发表于 2012-5-16 09:21:54 | 显示全部楼层
非常感谢!
我用了-uvm
后来也试过了-uvm_home $UVM_HOME,都不行啊。+incdir的还没试过,试试看。
发表于 2013-8-10 13:07:01 | 显示全部楼层
楼主,找到解决办法了没??
 楼主| 发表于 2013-8-13 09:47:47 | 显示全部楼层
回复 6# 熊石

木有
发表于 2013-8-22 09:02:27 | 显示全部楼层
改变一下include "uvm_pkg.sv"的位置试试
发表于 2013-8-22 10:44:14 | 显示全部楼层
现编译uvm_pkg.sv
vlog -incr +incdir+$(UVM_HOME)/src      $(UVM_HOME)/src/uvm_pkg.sv
vlog -incr +incdir+$(UVM_HOME)/src      your_file.sv
vsim -sv_lib $(UVM_HOME)/lib/uvm_dpi     your_test
 楼主| 发表于 2013-8-22 13:26:20 | 显示全部楼层
回复 9# hbhbts

Thanks!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-28 04:20 , Processed in 0.034246 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表