tb_top是整個UVM驗證平台的最頂層;tb_top中例化dut,提供時鍾和復位信號,定義接口以及設置driver和monitor的virual interface,在intial中調用run_test() UVM入口函數。在基於uvm_test擴展出base_test,根據測試用例再基於base_test擴展出各種各樣的test.在擴展后的test中call sequence.
在base_test中實例化env, env_config, 打印驗證平台的拓撲結構uvm_top.print_topology,打印輸出注冊在factory中類factory.print()。在環境env的build_phase()階段,實例化agent,reference model,scoreboard,checker,function coverage。在connetion_phase()將各個組件component通過TLM1.0 中的FIFO或analysis port連接起來。在agent中,實例化driver,monitor,sequencer,根據uvm_agent的is_active變量決定是否實例化driver和sequencer。在monitor和driver與DUT的信號層打交道,所以需要例化virtual interface. 除此之外,根據情況例化config,用congfig_db 配置相應的參數。從uvm_item_sequence派生成相應的transactions。
整個UVM TB的如何函數是run_test()。UVM是基於事物級的驗證方法學各個組件之間通過port, export, transport, analysis_port, analysis_export,imp(implement) 等來進行通信。搭建完驗證平台后,大部分工作需要編寫sequence(seq lib).
uvm中有兩種基本類:uvm_transaction,uvm_component(uvm_component其實也是從uvm_objection擴展而來)。uvm驗證平台是基於uvm_component構建的樹形結構;uvm_compent包括各種phase: build_phase, connect_phase, end_of_elaboration, start_of_simulation_phase, run_phase, pre_reset_phase, reset_phase, post_reset_phase , pre_congfigure_phase, configure_phase, post_configure_phase, pre_main_phase, main_phase, post_main_phase, pre_shutdown, shutdown_phase, post_shutdown_phase, extract_phase, chect_phase, report_phase, final_pahse等。uvm采用objection機制決定phase執行的時間raising_objection和drop_objection. 將uvm_sequence_item中比較復雜的約束可以放在per_randomize()和post_randomize()中。sequence包含pre_body(), body(), post_body()三個過程。
驗證平台需要自動化完成工作,用perl腳本搭建基本UVM驗證平台框架,編寫Makefile完成仿真工具和工作設置,以及在Makefile中調用參數化設置;還可使用$test$plusargs和$value$plusargs傳入相應的參數。
參考文獻:
擴展閱讀
[1] 關於$test$plusargs和$value$plusargs的小結. http://www.cnblogs.com/nanoty/p/4355245.html
