1

I am not able to find the exact reason for the error here. Can anyone help me?

`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

I am trying to change the verbosity of the my_environment to UVM_DEBUG.

toolic
62.9k21 gold badges81 silver badges130 bronze badges
asked Oct 15, 2024 at 4:58
0

1 Answer 1

0

It is illegal to use the initial keyword inside a class. When I try to compile your code with the Cadence simulator, I get a much more helpful error message:

xmvlog: *E,DECINM : Declaration is only valid within a module, interface, or a program block.

When you don't understand an error message, you can try to compile your code on other simulators on EDA Playground.

You could add the code from your initial block into the new function.

answered Oct 15, 2024 at 10:24
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.