Hello friends,
I have declared a varible in my environment like this:
bit checks =0; & registered in ovm factory ovm_component_utils_begin(class name) ovm_field_int(checks, OVM_ALL_ON);
`ovm_component_utils_end
Now i trying to configure “checks =1” in my config file using
set_config_int(env,“checks”,1);
But here my problem is that “checks” is not taking the updated value i.e 1, eventhough i am changing the value from config file.
kindly let me know the reason for this problem.
Thanks in Advance
Thank you Sir,
Now its working fine.
Doubt: if in my verification environment i have 50 to 100 configuring parameters & i need to configure these parameters values from their default values according to my write or read operations, what is the easiest way to do this?
Proceeding with your reply, I’m little bit ambiguous with the usage of get_config_int and set_config_int.
I’ve read the reference manual but still couldn’t able to get the proper and timely usage of get_config_* though many of my other environments have worked successfully without the usage of get_config_*.
It would be helpful for me if you can give me clear picture of these functions.
The manual states that “set_config_* methods work in conjunction with the get_config_* methods”. Thus, you have to use both for the configuration mechanism to work properly.
Generally, you can call get_config_* anytime after set_config_* has been used. So for example, if you use set_config_* in the build phase of the environment class, you can call get_config_* in any of the env’s children in the build phase (since build is top down) or in any subsequent phase.
then your checks member will get configured automatically at the end of the build phase for the class. You DO NOT need to call get_config_* provided you have called set_config_* before the build phase for the class (build is called top down). Calling set_config_* from the initial block of the top level module should always work.
Hi Dave
I think its not working what you have adviced.
I tried reversing the order of set_config_* and “super.build()” in both ways & found that in either ways we have to go for get_config_*.
Another Issue:
As per Bosman we are using get_config_* like this:
assert(get_config_int("checks ",checks ));
Here “assert” verifies whether the function is successful or not.
In this when i am overriding default value of “checks” in the config file, obviously this “assert” statement fails which in turn gives error during simulation time(Ofcourse this error is true for overriding). Now I want these errors to be suppressed i.e., not to display during simulation. Can anyone suggest me how to do this?
I tried using OVM_URM_SEVERITY to all combinations which was obsolete!
Please help me in this regards,
Thanks in advance,
Raghavendra
The assert statement produces a simulation error if fails (not an OVM error) by default. You have two options if you are not interested in the return of the get_config_*:
1-
void'(get_config_int("checks ",checks ));
2-
assert (get_config_int("checks ",checks ))
else ovm_report_warning ("NO_CONFIG", "No config settings for field check");
In the second solution, if the assert fails, it will report an OVM warning, which can be suppressed using
You will not pick up the configured value if you are using the deprecated do_test task to run your simulation. If you use an ovm_test class to instantiate the environment and use run_test to start the simulation then the OVM phases will work correctly. e.g. here is a complete example using OVM 1.1:
`include "ovm_macros.svh"
package my_pkg;
`ifdef INCA
`include "ovm.svh"
`else
import ovm_pkg::*;
`endif
class env extends ovm_env;
bit check = 0;
function new(string name="", ovm_component parent=null);
super.new(name,parent);
endfunction : new
function void build();
super.build();
endfunction: build
function void end_of_elaboration();
ovm_report_info("ENV",$psprintf("check=%0d",check));
endfunction: end_of_elaboration
task run();
ovm_top.stop_request();
endtask:run
`ovm_component_utils_begin(env)
`ovm_field_int(check,OVM_ALL_ON)
`ovm_component_utils_end
endclass : env
class my_test extends ovm_test;
function new(string name="", ovm_component parent=null);
super.new(name,parent);
endfunction : new
env e;
function void build();
super.build();
$cast(e,create_component("env","e"));
endfunction: build
`ovm_component_utils(my_test)
endclass: my_test
endpackage
module top();
`ifndef INCA
import ovm_pkg::*;
`endif
import my_pkg::*;
initial
begin
set_config_int("*","check",1);
run_test("my_test");
end
endmodule: top