文章目录 原始代码及log UVM测试平台层次结构与Phase执行顺序解析 UVM测试平台层次结构与Phase执行顺序深度解析 🧩 仿真结果图示 🔍 UVM Phase执行顺序核心原理 🧪 UVM组件层次结构分析 📊 Phase执行时间线分析 1. build_phase (0ns) 2. end_of_elaboration_phase (0ns) 3. start_of_simulation_phase (0ns) 4. run_phase (关键阶段) ✅ UVM Phase执行顺序核心原则 1. 构建阶段(build_phase):自底向上 2. 运行阶段(run_phase):自顶向下 3. 结束阶段(extract/check/report_phase):自底向上 🔥 本例的关键发现 💡 为什么其他组件的run_phase在500ns前结束? ✅ UVM最佳实践总结 ✅ 正确使用UVM Phase ✅ 测试结束协调 ✅ 组件层次设计 💬 与UVM官方文档一致 ✅ 重要结论 追更 build_phase执行顺序与打印顺序 ✅ UVM官方文档确认 ✅ 仿真结果验证 仿真日志的打印顺序示例 UVM测试平台设计规范 💬 为什么UVM设计为build_phase自底向上? 原始代码及log module top; import uvm_pkg:: * ; //Create a topology // top // | | // u1(A) u2(A) // | | | | // b1(B) d1(D) b1(B) d1(D) //No run phase class D extends uvm_component; functionnew ( string name, uvm_component parent) ; super. new ( name, parent) ; endfunction functionvoid build_phase ( uvm_phase phase) ; $display ( "%0t: %0s: build" , $time, get_full_name ( ) ) ; endfunction functionvoid end_of_elaboration_phase ( uvm_phase phase) ; $display ( "%0t: %0s: end_of_elaboration" , $time, get_full_name ( ) ) ; endfunction functionvoid start_of_simulation_phase ( uvm_phase phase) ; $display ( "%0t: %0s: start_of_simulation" , $time, get_full_name ( ) ) ; endfunction functionvoid extract_phase ( uvm_phase phase) ; $display ( "%0t: %0s: extract" , $time, get_full_name ( ) ) ; endfunction functionvoid check_phase ( uvm_phase phase) ; $display ( "%0t: %0s: check" , $time, get_full_name ( ) ) ; endfunction functionvoid report_phase ( uvm_phase phase) ; $display ( "%0t: %0s: report" , $time, get_full_name ( ) ) ; endfunction endclass//Has run phase class B extends uvm_component; rand logic[ 7 : 0 ] delay; functionnew ( string name, uvm_component parent) ; super. new ( name, parent) ; endfunction functionvoid build_phase ( uvm_phase phase) ; $display ( "%0t: %0s: build" , $time, get_full_name ( ) ) ; endfunction functionvoid end_of_elaboration_phase ( uvm_phase phase) ; $display ( "%0t: %0s: end_of_elaboration" , $time, get_full_name ( ) ) ; endfunction functionvoid start_of_simulation_phase ( uvm_phase phase) ; $display ( "%0t: %0s: start_of_simulation" , $time, get_full_name ( ) ) ; endfunction functionvoid extract_phase ( uvm_phase phase) ; $display ( "%0t: %0s: extract" , $time, get_full_name ( ) ) ; endfunction functionvoid check_phase ( uvm_phase phase) ; $display ( "%0t: %0s: check" , $time, get_full_name ( ) ) ; endfunction functionvoid report_phase ( uvm_phase phase) ; $display ( "%0t: %0s: report" , $time, get_full_name ( ) ) ; endfunction taskrun_phase ( uvm_phase phase) ; $display ( "%0t: %0s: start run phase" , $time, get_full_name ( ) ) ; # delay ; $display ( "%0t: %0s: end run phase" , $time, get_full_name (