| |
EndOfTest
UVM test结束指南 - 了解可用的test结束机制和phase objections。
“End of Test”章节内容:
EndOfTest (this page)
Objections
Topic Overview
End of Test in the UVM
如果使用标准phasing,UVM测试平台有许多零耗时的phase来构建和连接测试平台,然后是一些耗时的phase,最后是一些零耗时的清理phase。
所有耗时phase结束时,test结束。当该phase不再有任何待决objections时,每个phase结束。因此,通过管理phase objections来控制UVM中的test结束。从Phasing Introduction Page链接到的文章中描述了使用阶段异议的最佳方法
一个简单的测试可能如下所示:
task reset_phase( uvm_phase phase);
phase.raise_objection( this );
reset_seq.start( m_sequencer );
phase.drop_objection( this );
endtask
task configure_phase( uvm_phase phase);
phase.raise_objection( this );
program_control_registers_seq.start( m_sequencer );
phase.drop_objection( this );
endtask
task main_phase( uvm_phase phase);
phase.raise_objection( this );
data_transfer_seq.start( m_sequencer );
phase.drop_objection( this );
endtask
task shutdown_phase( uvm_phase phase);
phase.raise_objection( this );
read_status_registers_seq.start( m_sequencer );
phase.drop_objection( this );
endtask
上述test中的四个phase中的每个phase都会提起objection和撤销objection。由于上述特定phase按顺序发生,因此一个phase在前一phase完成之前无法启动。在每个phase开始时提起objection会阻止phase立即终止,而撤销objection意味着该组件不再对phase结束有异议。如果其他组件或objects没有提出其他待决异议,则该phase将终止。当对特定phase没有待决异议时,仿真将在下一类phase进行。当没有耗时的phase要执行时,仿真继续进行cleanup phase并且test结束。
phase_ready_to_end
对于sequences, tests和许多完整的测试平台,如上所述,在phase的正常寿命期间phase objections的提起和撤销是足够的。
但是,有时某个组件不希望在phase的正常生命周期内主动提起和撤销objections,但确实希望延迟从一个phase到下一类phase的过渡。在事务生产者中经常出现这种情况,出于性能原因,不能针对每笔事务提出objection,并且通常情况下是端到端的记分板。
为了在所有其他组件同意该phase应该结束之后延迟phase结束,该组件应该在phase_ready_to_end方法中提出objections。然后它负责在组件的主体中或在phase_ready_end_method的任务fork / join none中撤销这些objections。
使用fork / join_none的示例如下所示:
function void my_component::phase_ready_to_end( uvm_phase phase );
if( !is_ok_to_end() ) begin
phase.raise_objection( this , "not yet ready to end phase" );
fork begin
wait_for_ok_end();
phase.drop_objection( this , "ok to end phase" );
end
join_none
end
endfunction : phase_ready_to_end
没有fork / join_none的Ready_to_end_phase用于通常用于事务生产者和记分板等组件的Object-to-All和Object-to-One的phasing策略。