第五章 UVM驗證平臺的運行

5.1 phase機制

UVM中的phase

(1)UVM中的phase,按照其是否消耗仿真時間($time打印出的時間)的特性,可以分成function phase 和 task phase。 圖中灰色背景所示的是task phase,其他為function phase。

(2)對于function phase來說,在同一時間只有一個phase在執(zhí)行;但是在task phase中,run_phase和pre_reset_phase等12個小的phase并行運行。后者稱為動態(tài)運行(run-time)的phase。

(3)UVM在build_phase中做uvm_component及其派生類變量的實例化工作。uvm_object可以在任何phase完成。

(4)除了build_phase之外,所有function phase都是自下而上執(zhí)行的。

(5)對于同一層次的、具有兄弟關(guān)系的component,執(zhí)行順序是按照字典序的,與實例化的順序無關(guān)。

(6)UVM采用深度優(yōu)先地原則,如i_agt實例化時名字為"i_agt",scb為"scb",則i_agt的build_phase先執(zhí)行,執(zhí)行完畢后,再執(zhí)行driver,monitor,sequence的build phase,全部執(zhí)行完畢后再執(zhí)行scoreboard的build phase。

(7)super.build_phase:自動獲取通過config_db::set設(shè)置的參數(shù)。如果要關(guān)掉這個功能,可以在自己的build_phase中不調(diào)用super.build_phase。

(8)對于直接擴展自uvm_component的類,出build_phase外,完全可以不必加上super.xxxx_phase語句。

(9)jump函數(shù)的參數(shù),uvm_pre_reset_phase::get()后的所有phase都可以。

(10)<sim command> +UVM_PHASE_TRACE:對phase進行調(diào)制。

(11)uvm_top.set_timeout(500ns, 0):設(shè)置超時時間,第二個參數(shù)表示此設(shè)置是否可以被其后的其他set_timeout語句覆蓋。

? ? ? ? ? ? 默認的超時退出時間:

? ? ? ? ? ? ? ? ? ? `define UVM_DEFAULT_TIMEOUT 9200s

? ? ? ? ? ? ? ? ? ? <sim command> +UVM_TIMEOUT="300ns, YES"


5.2 objection機制

(1)對于run-time的phase,如果想執(zhí)行一些耗費時間的代碼,那么要在此phase下任意一個component中至少提起一次objection。

(2)如果UVM發(fā)現(xiàn)某phase沒有提起任何objection,那么將會直接跳轉(zhuǎn)到下一個phase中。

(3)如果12個動態(tài)運行的phase有objection被提起,那么run_phase根本不需要raise_objection就可以自動執(zhí)行。

(4)在一個實際的驗證平臺中,通常會在以下兩種objection的控制策略中選擇一種:

? ? ? ? ? ? ? ? 1. 在scoreboard中進行控制。

? ? ? ? ? ? ? ? 2. 在sequence中提起sequencer的objection,當sequence完成后,再撤銷此objection。一般情況下只在sequence中控制objection。

(5)一個phase對應一個drain_time,沒有設(shè)置的情況下,drain_time的默認值為0。

? ? ? ? ? ? "base_test.sv"

? ? ? ? ? ? task base_test::main_phase(uvm_phase phase);

? ? ? ? ? ? ?? phase.phase_done.set_drain_time(this, 200);

? ? ? ? ? ? endtask

(6) objection的調(diào)試

? ? ? ? ? ? <sim command> +UVM_OBJECTION_TRACE


5.3 domain的應用

(1)domain只能隔離run-time的phase,其他phase還是同步的,即run_phase和function_phase是同步的。

(2)class B extends uvm_component;

? ? ? ? ? ? ? ? ?? uvm_domain ? ? new_domain;

? ? ? ? ? ? ? ? ?? `uvm_component_utils(B)

? ? ? ? ? ? ? ? ?? function new(string name, uvm_component parent);

? ? ? ? ? ? ? ? ? ? ? ? ? ? super.new(name, parent);

? ? ? ? ? ? ? ? ? ? ? ? ? ? new_domain = new("new_domain");

? ? ? ? ? ? ? ? ?? endfunction

? ? ? ? ? ? ? ? ?? virtual function void connect_phase(uvm_phase phase);

? ? ? ? ? ? ? ? ? ? ? ? ? ? set_domain(new_domain);

? ? ? ? ? ? ? ? ?? endfunction

? ? ? ? ? ? set_domain將B加入到此domain中。

(3)phase的跳轉(zhuǎn)只局限于某一個domain中。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容