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

标题: 关于用irun跑uvm [打印本页]

作者: oscillator_cn1    时间: 2012-5-4 17:36
标题: 关于用irun跑uvm
本帖最后由 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.

请问,有没有人知道,这个到底是怎么回事的呀?
作者: decade    时间: 2012-5-6 09:42
确认一下你是否加载了UVM的lib
作者: oscillator_cn1    时间: 2012-5-7 09:16
那个,怎么确认?
作者: heritor    时间: 2012-5-15 17:50
回复 3# oscillator_cn1


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

木有
作者: lifz27    时间: 2013-8-22 09:02
改变一下include "uvm_pkg.sv"的位置试试
作者: hbhbts    时间: 2013-8-22 10:44
现编译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
作者: oscillator_cn1    时间: 2013-8-22 13:26
回复 9# hbhbts

Thanks!
作者: tbb2009    时间: 2013-8-22 22:02


   
回复  hbhbts

Thanks!
oscillator_cn1 发表于 2013-8-22 13:26




    这个明显是questa/modelsim啊。。。
作者: oscillator_cn1    时间: 2013-8-23 09:08
本帖最后由 oscillator_cn1 于 2013-8-23 09:10 编辑

回复 11# tbb2009

差不多吧,改为ncvlog和ncsim就可以啦。
另外,我想他的意思是说,把uvm源代码所在的文件夹加入到incdir中,然后再编译。
作者: uvmer    时间: 2013-12-25 13:26
最后问题解决了吗?
作者: oscillator_cn1    时间: 2013-12-25 15:49
回复 13# uvmer

解决了,把库所在加入incdir中就可以了
作者: uvmer    时间: 2013-12-25 17:30
回复 14# oscillator_cn1


    OK,我也在搞这个。谢谢。
作者: suyuan    时间: 2014-7-22 09:59
每一个文件都要   
`include "uvm_macros.svh"
      import uvm_pkg::*;
作者: 杀猪的日子    时间: 2015-7-9 16:56
thanks for your reply
作者: silencefpga    时间: 2015-7-11 23:19
thank you for sharing
作者: lijing94    时间: 2015-10-27 19:07
楼主怎么做到的啊?能把命令给我看看吗……纠结一天了,thank you~
作者: xiaoyangyu    时间: 2018-11-5 20:43
应该把具体的解决方法写一下
作者: edwardk    时间: 2018-11-19 17:20
学习中。。。。。
作者: 翻滚的咸鱼    时间: 2022-2-22 13:52


   
oscillator_cn1 发表于 2013-8-22 13:26
回复 9# hbhbts

Thanks!


按9楼的方法解决了吗?





欢迎光临 EETOP 创芯网论坛 (原名:电子顶级开发网) (https://bbs.eetop.cn/) Powered by Discuz! X3.5