推荐阅读:UVM phase的用法研究【zz】www.cnblogs.com
phase是使验证平台中各个component按照各自的需求可以阶段性执行的一种自动化的机制。phase根据是否消耗时间可以分成不消耗时间的函数phase和消耗时间的任务phase。
1.phase的执行顺序
run_phase和另外的12个小的taskphase并行执行(forkjoin块),12个小的taskphase顺序执行(begin_end块)。其中,reset、configure、main、shutdown四个phase是核心。假设要在运行过程中对DUT进行一次复位(reset)操作,分别在scoreboard、reference model及其他部分(如driver、monitor等)的reset_phase写好相关代码,之后如果想做一次复位操作,那么只要通过phase的跳转,就会自动跳转回reset_phase。
对于UVM树来说(具有父子关系的component),除了build_phase之外,所有不耗费仿真时间的phase(即function phase)都是自下而上执行的。如对于connect_phase即先执行driver和monitor的connect_phase,再执行agent的connect_phase。在build_phase中做实例化的工作时,driver和monitor都是agent的成员变量,所以它们的实例化都要在agent的build_phase中执行。如果在agent的build_phase之前执行driver的build_phase,此时driver还根本没有实例化,所以调用driver.build_phase只会引发错误。因此选择了自上而下的执行顺序。
对于同一层次的、具有兄弟关系的component,如