跳转至

输入查询内容

    本页内容

    phase.jump(null) 与跳转状态查询

    影响范围

    使用 jump/set_jump_phase,尤其向其传入 null。

    具体差异

    新增三个查询函数。清除状态的分支仅适用于 未激活 phase 的 set_jump_phase(null);激活态仍进入前驱/后继查找,不能把 jump(null) 当作通用取消操作,且可能进入 null 解引用路径。

    修改方案

    原本用 jump(null) 取消或结束运行的代码需改写:正常结束按 M03-003 释放实际 phase 的 objection,需要跳转时传入明确且合法的前驱/后继 phase。仅未激活节点的 set_jump_phase(null) 路径用于清除挂起状态;不要将其推广至激活节点。查询方向使用 is_jumping_forward()/is_jumping_backward(),提前结束状态使用 is_ending_prematurely()。

    兼容措施与范围:现有入口无需兼容开关;这不表示两版行为相同,仍按本条条件和验证方法核对。

    迁移后验证

    分别核对激活和未激活节点的状态;只在允许的未激活路径清除挂起状态,正常收尾使用明确目标和 objection,禁止把 jump(null) 当通用取消。

    记录本条结果M03-009 · 状态与证据

    补充查阅

    扫描定位与记录结果

    有扫描规则,覆盖部分可识别写法。脚本检查名称、参数和部分 FLAG 表达式,并对少数直接声明关联使用点;未做完整类型解析或预处理,行为结果仍需验证。

    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules S28
    

    核对命中对象及生效分支后,在条目清单记录修改与验证证据;扫描规则记录用于整理命中位置。

    扫描器下载、输入范围与报告说明

    源码与标准依据

    核查方式:源码核对。未单独进行 VCS 行为实测。

    VCS 内置 UVM-1.2uvm_phase.svh:2008set_jump_phase,phase 未激活时对 null 也报 JMPPHIDL error)

    VCS 内置 uvm-ieee-2020-2.0uvm_phase.svh:1699–1716(未激活且 phase==null 时静默清除挂起的 jump 状态后返回,不报错)、uvm_phase.svh:1762/uvm_phase.svh:1767/uvm_phase.svh:1781is_jumping_forward()/is_jumping_backward()/is_ending_prematurely()

    引用代码(高亮为引用行);上方行号链接可直接定位。

    src/vcs-uvm-1.2/base/uvm_phase.svh
    //
    // Specify a phase to transition to when phase is complete.
    
    function void uvm_phase::set_jump_phase(uvm_phase phase) ;
      uvm_phase d;
    
      if ((m_state <  UVM_PHASE_STARTED) ||
          (m_state >  UVM_PHASE_ENDED) )
      begin
       `uvm_error("JMPPHIDL", { "Attempting to jump from phase \"",
          get_name(), "\" which is not currently active (current state is ",
          m_state.name(), "). The jump will not happen until the phase becomes ",
          "active."})
      end
    
    
    
      // A jump can be either forward or backwards in the phase graph.
      // If the specified phase (name) is found in the set of predecessors
    

    完整源码 · SHA256:35d4b96b111219dd92ea544929952a1d7bbeb3ce29153c705a75c934551f050e

    src/vcs-uvm-ieee-2020-2.0/base/uvm_phase.svh
    //
    // Specify a phase to transition to when phase is complete.
    
    function void uvm_phase::set_jump_phase(uvm_phase phase) ;
      uvm_phase d;
      bit active;
      uvm_phase_state state;
      state = get_state();
      active = (state >= UVM_PHASE_STARTED) && (state <= UVM_PHASE_ENDED);
    
      if (!active) begin
        if (phase == null) begin
          // Clear out jump information
          m_jump_phase = null;
          m_jump_fwd = 0;
          m_jump_bkwd = 0;
          m_premature_end = 0;
          return;
        end
        else begin
          `uvm_error("JMPPHIDL", { "Attempting to jump from phase \"",
    

    src/vcs-uvm-ieee-2020-2.0/base/uvm_phase.svh
    endfunction
    
    // is_jumping_forward
    function bit uvm_phase::is_jumping_forward();
      return m_jump_fwd;
    endfunction : is_jumping_forward
    
    // is_jumping_backward
    function bit uvm_phase::is_jumping_backward();
      return m_jump_bkwd;
    endfunction : is_jumping_backward
    
    // end_prematurely
    // ----
    //
    // Set a flag to cause the phase to end prematurely.  
    
    function void uvm_phase::end_prematurely() ;
       m_premature_end = 1 ;
    endfunction
    
    // is_ending_permaturely
    function bit uvm_phase::is_ending_prematurely();
      return m_premature_end;
    endfunction : is_ending_prematurely
    
    
    // jump
    // ----
    //
    // Note that this function does not directly alter flow of control.
    // That is, the new phase is not initiated in this function.
    // Rather, flags are set which execute_phase() uses to determine
    // that a jump has been requested and performs the jump.
    
    function void uvm_phase::jump(uvm_phase phase);
       set_jump_phase(phase) ;
       end_prematurely() ;
    

    完整源码 · SHA256:a788b22ff02a9ff8e6eab4a18c55794dcae9777ddfa19695bffa88bf14b83181

    术语解释 · 兼容配置

    旧 test_done 不再保持 run 存活(M03-003)

    返回Phase / Objection / Event · 迁移清单

    版本适用范围