OVM/UVM高手请进,讨论一个小问题
my_test_case extend ovm_test;
tb_env my_tb;
.......
在build函数中:
set_config_int("my_tb.my_rx_env.my_rx_agent.rx_sqr", "pre_num",6);
现在遇到一个问题:我希望set完这个变量之后,就在这一句后面打印出来这个变量pre_num的值!
可是层级调用不行,请高人指点一下!谢谢!
在rx_sequencer代码里面可以打印,我想在case里面配置完后就打印。
如何在case里拿到agent以及sequencer里面的变量呢?
you should get your settings from your lower component, but not from the upper or itself.
for example, your should print the pre_num in sequencer and agent after your configure this
variable in testcase.
I know how to print in sequencer, But Is there some methods to print in testcase?
no way except get this in the following methods likeconnect() , end_of_elaboration() .....in testcase.
because build() is done in a top-down way, so you cannot get the settings of lower component in the uppercomponent in build() method.
in the connect() phase in testcase , for example, you can get it because of having finished configuration for the all components.
The component "my_rx_env" has not yet been created after the following configuration statement. Then you may ask why the configuration statement can work, that is because it is just an registeration. The configuration is active when the "build" task is excuted in rx_sqr.
set_config_int("my_tb.my_rx_env.my_rx_agent.rx_sqr", "pre_num",6);
楼上说得对,变量还没实体化无法打印
那就别在build phase打印呗,
不好弄啊
试一下:
uvm_config_db(T)::get()