|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
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.
请问,有没有人知道,这个到底是怎么回事的呀? |
|