6. ANÁLISIS Y RESULTADOS
6.2 Análisis las condiciones operacionales del tránsito de bici-usuarios por la
6.2.2 Modelación del Estado Actual de la Avenida de las Américas entre
Configuration is a mechanism in OVM that higher level components in a hierarchy can configure the lower level components variables. Using set_config_* methods, user can configure integer, string and objects of lower level components. Without this mechanism, user should access the lower level component using hierarchy paths, which restricts reusability. This mechanism can be used only with components. Sequences and transactions cannot be configured using this mechanism. When set_config_* method is called, the data is stored w.r.t strings in a table. There is also a global configuration table.
Higher level component can set the configuration data in level component table. It is the responsibility of the lower level component to get the data from the component table and update the appropriate table.
Set_config_* Methods:
Following are the method to configure integer , string and object of ovm_object based class respectively.
function void set_config_int (string inst_name, string field_name,
ovm_bitstream_t value)
function void set_config_string (string inst_name, string field_name,
string value)
function void set_config_object (string inst_name, string field_name,
ovm_object value, bit clone = 1)
(S)Arguments description:
string inst_name: Hierarchical string path.
string field_name: Name of the field in the table.
bitstream_t value: In set_config_int, a integral value that can be anything from 1 bit to 4096 bits. bit clone : If this bit is set then object is cloned.
inst_name and field_name are strings of hierarchal path. They can include wile card "*" and "?" characters. These methods must be called in build phase of the component.
"*" matches zero or more characters "?" matches exactly one character
(S)Some examples:
"*" -All the lower level components.
"*abc" -All the lower level components which ends with "abc". Example: "xabc","xyabc","xyzabc" ....
"abc*" -All the lower level components which starts with "abc". Example: "abcx","abcxy","abcxyz" ....
"ab?" -All the lower level components which start with "ab" , then followed by one more character. Example: "abc","abb","abx" ....
"?bc" -All the lower level components which start with any one character ,then followed by "c". Example: "abc","xbc","bbc" ....
"a?c" -All the lower level components which start with "a" , then followed by one more character and then followed by "c".
Example: "abc","aac","axc" â~@¦..
There are two ways to get the configuration data: 1)Automatic : Using Field macros
2)Manual : using gte_config_* methods.
Automatic Configuration:
To use the atomic configuration, all the configurable fields should be defined using ovm component field macros and ovm component utilities macros.
(S)Ovm component utility macros: For non parameterized classes `ovm_component_utils_begin(TYPE) `ovm_field_* macro invocations here `ovm_component_utils_end
For parameterized classes.
`ovm_component_param_utils_begin(TYPE) `ovm_field_* macro invocations here `ovm_component_utils_end
For OVM Field macros, Refer to link OVM_TRANSACTION
Example:
Following example is from link OVM_TESTBENCH
2 Configurable fields, a integer and a string are defined in env, agent, monitor and driver classes. Topology of the environment using these classes is
(S)Driver class Source Code:
Similar to driver class, all other components env, agent and monitor are define.
class driver extends ovm_driver; integer int_cfg;
string str_cfg;
`ovm_component_utils_begin(driver) `ovm_field_int(int_cfg, OVM_DEFAULT) `ovm_field_string(str_cfg, OVM_DEFAULT) `ovm_component_utils_end
function new(string name, ovm_component parent); super.new(name, parent);
function void build(); super.build();
endfunction endclass (S)Testcase:
Using set_config_int() and set_config_string() configure variables at various hierarchal locations.
//t_env.ag1.drv.int_cfg //t_env.ag1.mon.int_cfg
set_config_int("*.ag1.*","int_cfg",32); //t_env.ag2.drv
set_config_int("t_env.ag2.drv","int_cfg",32); //t_env.ag2.mon
set_config_int("t_env.ag2.mon","int_cfg",32); //t_env.ag1.mon.str_cfg
//t_env.ag2.mon.str_cfg //t_env.ag1.drv.str_cfg //t_env.ag2.drv.str_cfg
set_config_string("*.ag?.*","str_cfg","pars"); //t_env.str_cfg
set_config_string("t_env","str_cfg","abcd"); (S)Download the source code
ovm_configuration_1.tar
Browse the code in ovm_configuration_1.tar
(S)Command to run the simulation
your_tool_simulation_command +path_to_ovm_pkg -f filelist +OVM_TESTNAME=test1
From the above log report of th example, we can see the variables int_cfg and str_cfg of all the components and they are as per the configuration setting from the testcase.
Manual Configurations:
Using get_config_* methods, user can get the required data if the data is available in the table.
Following are the method to get configure data of type integer , string and object of ovm_object based class respectively.
function bit get_config_int (string field_name, inout ovm_bitstream_t value)
function bit get_config_string (string field_name, inout string value)
function bit get_config_object (string field_name, inout ovm_object value,
input bit clone = 1)
If a entry is found in the table with "field_name" then data will be updated to "value" argument . If entry is not found, then the function returns "0". So when these methods are called, check the return value.
Example:
(S)Driver class code:
class driver extends ovm_driver; integer int_cfg;
string str_cfg;
`ovm_component_utils(driver)
function new(string name, ovm_component parent); super.new(name, parent);
endfunction
function void build(); super.build();
void'(get_config_int("int_cfg",int_cfg)); void'(get_config_string("str_cfg",str_cfg)); ovm_report_info(get_full_name(),
$psprintf("int_cfg %0d : str_cfg %0s ",int_cfg,str_cfg),OVM_LOW); endfunction
endclass
Configuration Setting Members:
function void print_config_settings ( string field = "",
ovm_component comp = null, bit recurse = 0 )
This method prints all configuration information for this component.
If "field" is specified and non-empty, then only configuration settings matching that field, if any, are printed. The field may not contain wildcards. If "recurse" is set, then information for all children components are printed recursively.
(S)print_config_matches
static bit print_config_matches = 0
Setting this static variable causes get_config_* to print info about matching configuration settings as they are being applied. These two members will be helpful to know while debugging.
(Q i49) Is it possible to use ‘get_config_obj’ inside a sequence class?
(Q i50)Whato eisi theodifference qbetweenre create iandoq jnewre method i? (Q i51)Whato eisi virtualosequencer q?re Explain ibyoq jwritingre example. (Q i52)Howo eai sequenceois qstartedre ?
(Q i53)Explaino eendi ofotest qmechanism.re
(Q i54)When/howo ethei stop()omethod qisre called i?www.testbench.in
(Q i55)Whato eisi port/import/exporto?
(Q i56)Whicho ephasei isotop qdown,re and iwhichoq jphasere is ibottom oup?
(Q i57)Ino ewhichi phaseomethod, qsuperre method iisoq jrequiredre to icall. oqWhat ifz theu ysupere oiszx not called ?
(Q i58)Explaino ethei differentophases qandre what iisoq jtheirre purpose...w...w...w...t...e...s...t...b...e.... .n...c...h...i...n
(Q i59)Howo etoi useofactory qoverridere a isequenceoq j?re www.testbench.in
(Q i60)Explaino ehowi scoreboardois qimplemented.re (Q i61)Whato eisi theouse qofre subscriber i?
(Q i62)Explaino eabouti run_test().
(Q i63)Howo einterfacei isopassed qtore component.
(Q i64)Whato eisi theodifferent qb/wre active iagentoq jandre passive iagent o?www.testbench.in
(Q i65)Explaino ehowi aointerrupt qsequencere is iimplemented. (Q i66)Explaino ehowi layeredosequencers qarere implemented.
(Q i67)Howo etoi changeothe qverbosityre level iofoq jlogre messages ifromocommandqline ? ...w...w...w...t...e...s...t...b...e...n...c...h...i...n
(Q i68)Howo etoi setoverbosity qlevelre to ioneoq jparticularre component i? (Q i69)Howo etoi fillothe qgapre b/w idifferentoq jobjections?www.testbench.in
(Q i70)Whato eisi theouse qofre uvm_event i?
(Q i71)Howo etoi connectomultiple qsequencersre to ioneoq jdriverre ? (Q i72)Whato eisi returnedoby qget_type_name()?
(Q i73)Howo etoi useoset_config_* qforre setting ivariablesoq jofre sequence i?
(Q i74)Foro edebuggingi purpose,ohow qtore print imessagesoq jthatre indicates itheocomponentsqphase ?www.testbench.in
(Q i75)Whato eisi theodisadvantage qifre sequence iisoq jregisterdre to isequencerousingqutility
macrosz ?u ye oIfzx sequence is not registered with sequencer, then how to invoke the sequence execution ? (Q i76)Whato eisi theouse qofre uvm_create_random_seed i?
(Q i77)Whato eisi theodifference qb/wre starting iaoq jsequencere usingidefault_sequence oandqsequence.start( ) method.z...w...w...w...t...e...s...t...b...e...n...c...h...i...n
(Q i78)Io edon~Rti wantoto qregisterre a isequenceoq jtore sequencer. iWhat oisqthe alternatez macrou ytoe ouvm_sequence_utils()zx macro ?
(Q i79)Explaino ehowi UVMocallbacks qworkre ?www.testbench.in