網站首頁 編程語言 正文
在圖3-4所示的UVM樹中,driver的路徑為uvm_test_top.env.i_agt.drv。在uvm_test_top,env或者i_agt中,對driver中的某些變量
通過config_db機制進行設置,稱為直線的設置。但是若在其他component,如scoreboard中,對driver的某些變量使用config_db機制
進行設置,則稱為非直線的設置。
在my_driver中使用config_db::get獲得其他任意component設置給my_driver的參數,稱為直線的獲取。假如要在其他的component,如在reference model中獲取其他component設置給my_driver的參數的值,稱為非直線的獲取。
要進行非直線的設置,需要仔細設置set函數的第一個和第二個參數。以在scoreboard中設置driver中的pre_num為例:
文件:src/ch3/section3.5/3.5.6/set/my_scoreboard.sv
18 function void my_scoreboard::build_phase(uvm_phase phase);
…
22 uvm_config_db#(int)::set(this.m_parent, "i_agt.drv", "pre_num", 200);
26 `uvm_info("my_scoreboard", "in my_scoreboard, uvm_test_top.env.i_agt.drv.pre_num is set to 200", UVM_LOW)
27 endfunction
或者:
function void my_scoreboard::build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_config_db#(int)::set(uvm_root::get(), "uvm_test_top.env.i_agt.drv", "pre_num", 200);
endfunction
無論哪種方式,都帶來了一個新的問題。在UVM樹中,build_phase是自上而下執行的,但是對于圖3-4所示的UVM樹來說,scb與i_agt處于同一級別中,UVM并沒有明文指出同一級別的build_phase的執行順序。所以當my_driver在獲取參數值時,my_scoreboard的build_phase可能已經執行了,也可能沒有執行。所以,這種非直線的設置,會有一定的風險,應該避免這種情況的出現。
非直線的獲取也只需要設置其第一和第二個參數。假如要在reference model中獲取driver的pre_num的值:
文件:src/ch3/section3.5/3.5.6/get/my_model.sv
21 function void my_model::build_phase(uvm_phase phase);
22 super.build_phase(phase);
23 port = new("port", this);
24 ap = new("ap", this);
25 `uvm_info("my_model", $sformatf("before get, the pre_num is %0d", drv_pre_num), UVM_LOW)
26 void'(uvm_config_db#(int)::get(this.m_parent, "i_agt.drv", "pre_num", drv_pre_num));
27 `uvm_info("my_model", $sformatf("after get, the pre_num is %0d", drv_pre_num), UVM_LOW)
28 endfunction
或者:
void'(uvm_config_db#(int)::get(uvm_root::get(), "uvm_test_top.env.i_agt.drv",
"pre_num", drv_pre_num));
這兩種方式都可以正確地得到設置的pre_num的值。
非直線的獲取可以在某些情況下避免config_db::set的冗余。上面的例子在reference model中獲取driver的pre_num的值,如果
不這樣做,而采用直線獲取的方式,那么需要在測試用例中通過cofig_db::set分別給reference model和driver設置pre_num的值。
同樣的參數值設置出現在不同的兩條語句中,這大大增加了出錯的可能性。因此,非直線的獲取可以在驗證平臺中多個組件
(UVM樹結點)需要使用同一個參數時,減少config_db::set的冗余。
原文鏈接:https://blog.csdn.net/Michael177/article/details/125473251
相關推薦
- 2022-12-26 C++內存分區模型超詳細講解_C 語言
- 2023-07-27 react中使用echarts
- 2022-07-21 CUICatalog: Invalid asset name supplied: ‘‘
- 2022-02-27 記錄npm 在windows下cmd中報錯以及idea下terminal安裝依賴時同樣報錯
- 2024-03-10 【Redis】Redis的持久化(備份)
- 2022-04-06 React中使用react-player?播放視頻或直播的方法_React
- 2022-08-30 大表delete刪數據導致數據庫異常解決_oracle
- 2022-11-05 docker中nginx卸載、安裝、配置及掛載詳細教程_docker
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支