我无法在这里找到确切的错误,有人可以帮助我吗?
`include "uvm_macros.svh"
import uvm_pkg::*;
class my_driver extends uvm_driver;
`uvm_component_utils(my_driver)
function new(string path, uvm_component parent);
super.new(path,parent);
endfunction
task run1();
`uvm_info("DVR","INFO LEVEL",UVM_DEBUG);
`uvm_warning("DVR", "WARNING LEVEL");
`uvm_error("DVR","ERROR LEVEL");
#10;
`uvm_fatal("DVR","FATAL LEVEL");
endtask
task run2();
`uvm_error("DVR1","Count of erros = 1");
`uvm_error("DVR1","Count of erros = 2");
`uvm_info("DVR1","simulation quit after 3 errors",UVM_DEBUG);
`uvm_error("DVR1","Count of erros = 3");
endtask
endclass
class my_environment extends uvm_env;
`uvm_component_utils(my_environment)
function new(string path, uvm_component parent);
super.new(path,parent);
endfunction
initial
begin
my_driver my_dvr_obj;
my_dvr_obj = new("DVR",null);
my_dvr_obj.run1();
my_driver my_dvr_obj_new;
my_dvr_obj_new = new("DVR1",null);
my_dvr_obj_new.set_report_max_quit_count(3);
my_dvr_obj_new.run2();
end
task my_task();
`uvm_info("MY_ENV","Verbosity level is UVM_DEBUG in Environment",UVM_DEBUG);
endtask
endclass
module tb;
initial begin
my_environment new_env_obj;
new_env_obj = new("MY_ENV",null);`your text`
new_env_obj.set_report_verbosity_level_hier(UVM_DEBUG);
new_env_obj.my_task();
end
endmodule
我正在尝试将 my_environment 的详细程度更改为 UVM_DEBUG。
在
initial
内使用 class
关键字是非法的。 当我尝试使用 Cadence 模拟器编译您的代码时,我收到一条更有帮助的错误消息:
xmvlog: *E,DECINM : Declaration is only valid within a module, interface, or a program block.
当您不明白错误消息时,您可以尝试在 EDA Playground 上的其他模拟器上编译您的代码。
您可以将
initial
块中的代码添加到 new
函数中。