跳转至

输入查询内容

    本页内容

    starting_phase 的直接赋值与锁定限制

    影响范围

    直接写 starting_phase,或在其锁定后再次设置。

    具体差异

    直接赋值本身不会执行检查,读取时才同步/检查字段与 DAP。1.2 锁定后的冲突也有 UVM/SEQ/LOCK_DEPR 或 DAP error,并非只告警或静默接受。2.0 改为 UVM/SEQ/SP/GET / SET;冲突值不替换锁定的 DAP 值。两库 get 后 set 的实测均保持旧 phase 并报错,故迁移重点是访问器与诊断 ID。

    修改方案

    把 seq.starting_phase = phase 改为 seq.set_starting_phase(phase),读取改为 seq.get_starting_phase()。在 sequence 启动及相关 DAP 锁定前完成设置;锁定后的诊断应修正设置时机,不只修改消息过滤。

    兼容措施与范围:主库保留 starting_phase 兼容字段;setter 与锁定检查可能改变赋值效果,应在 sequence 启动前设置,并核对被锁定时的诊断。

    迁移后验证

    在 start 前设置并读回 phase;受控测试锁定后的冲突设置,检查返回状态/报错和保留值。

    记录本条结果M06-014 · 状态与证据

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

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

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

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

    源码与标准依据

    核查方式:源码与实测核对。实测仅覆盖本条所列场景。

    VCS 内置 UVM-1.2uvm_sequence_base.svh:530–536starting_phase 直接赋值触发 UVM_DEPRECATED 警告,uvm_sequence_base.svh:552/uvm_sequence_base.svh:590 存取器内含兼容检查)

    VCS 内置 uvm-ieee-2020-2.0uvm_sequence_base.svh:554@uvm-compat 普通字段)、uvm_sequence_base.svh:587get_starting_phase 锁定后值不一致报 UVM/SEQ/SP/GET error)、uvm_sequence_base.svh:609set_starting_phase 锁定后报 UVM/SEQ/SP/SET error)

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

    src/vcs-uvm-1.2/seq/uvm_sequence_base.svh
    `endif
    
    `ifdef UVM_DEPRECATED_STARTING_PHASE
      // DEPRECATED!! Use get/set_starting_phase accessors instead!
      uvm_phase starting_phase;
      // Value set via set_starting_phase
      uvm_phase m_set_starting_phase;
      // Ensures we only warn once per sequence
      bit m_warn_deprecated_set;
    `endif 
    
      // Function: get_starting_phase
      // Returns the 'starting phase'.
      //
      // If non-~null~, the starting phase specifies the phase in which this
      // sequence was started.  The starting phase is set automatically when
      // this sequence is started as the default sequence on a sequencer.
      // See <uvm_sequencer_base::start_phase_sequence> for more information.
      //
    

    src/vcs-uvm-1.2/seq/uvm_sequence_base.svh
      // its execution (either via natural termination, or being killed),
      // then the starting phase value can be modified again.
      //
      function uvm_phase get_starting_phase();
    `ifdef UVM_DEPRECATED_STARTING_PHASE
         begin
            bit throw_error;
    
            if (starting_phase != m_set_starting_phase) begin
               if (!m_warn_deprecated_set) begin
                  `uvm_warning("UVM_DEPRECATED", "'starting_phase' is deprecated and not part of the UVM standard.  See documentation for uvm_sequence_base::set_starting_phase")
                  m_warn_deprecated_set = 1;
               end
    
               if (m_starting_phase_dap.try_set(starting_phase))
                 m_set_starting_phase = starting_phase;
               else begin
                  uvm_phase dap_phase = m_starting_phase_dap.get();
                  `uvm_error("UVM/SEQ/LOCK_DEPR",
    

    src/vcs-uvm-1.2/seq/uvm_sequence_base.svh
      // its execution (either via natural termination, or being killed),
      // then the starting phase value can be modified again.
      //
      function void set_starting_phase(uvm_phase phase);
    `ifdef UVM_DEPRECATED_STARTING_PHASE
         begin
            if (starting_phase != m_set_starting_phase) begin
               if (!m_warn_deprecated_set) begin
                  `uvm_warning("UVM_DEPRECATED", 
                               {"The deprecated 'starting_phase' variable has been set to '",
                                starting_phase.get_full_name(),
                                "' manually.  See documentation for uvm_sequence_base::set_starting_phase."})
                  m_warn_deprecated_set = 1;
               end
    
               starting_phase = phase;
               m_set_starting_phase = phase;
            end
         end
    

    完整源码 · SHA256:1594d38afd79cb400a689fdbe6c8e33ff60714bb7527cd8d79739d9357b31682

    src/vcs-uvm-ieee-2020-2.0/seq/uvm_sequence_base.svh
      local uvm_get_to_lock_dap#(uvm_phase) m_starting_phase_dap;
    
      // @uvm-compat For compatibility with UVM 1.1d
      uvm_phase starting_phase;
    
      // Function- m_init_phase_daps
      // Either creates or renames DAPS
      function void m_init_phase_daps(bit create);
         string apo_name = $sformatf("%s.automatic_phase_objection", get_full_name());
         string sp_name = $sformatf("%s.starting_phase", get_full_name());
    
         if (create) begin
            m_automatic_phase_objection_dap = uvm_get_to_lock_dap#(bit)::type_id::create(apo_name, get_sequencer());
            m_starting_phase_dap = uvm_get_to_lock_dap#(uvm_phase)::type_id::create(sp_name, get_sequencer());
         end
         else begin
            m_automatic_phase_objection_dap.set_name(apo_name);
            m_starting_phase_dap.set_name(sp_name);
         end
    

    src/vcs-uvm-ieee-2020-2.0/seq/uvm_sequence_base.svh
      // then the starting phase value can be modified again.
      //
      // @uvm-ieee 1800.2-2020 auto 14.2.4.1
      function uvm_phase get_starting_phase();
        uvm_phase sp;
    
        // If we're not locked, use the starting_phase variable
        if (!m_starting_phase_dap.is_locked() && starting_phase != null)
          m_starting_phase_dap.set(starting_phase);
    
        // Get the DAP value (and lock it)
        sp = m_starting_phase_dap.get();
    
        // Throw an error if starting_phase != dap.get()
        if (sp!=starting_phase) begin
          `uvm_error("UVM/SEQ/SP/GET",
                     $sformatf("The starting_phase variable was set to '%s' after a call to get_starting_phase locked the value '%s'.  The new value is ignored.",
                               (starting_phase == null) ? "<null>" : starting_phase.get_name(),
                               (sp == null) ? "<null>" : sp.get_name()))
    

    src/vcs-uvm-ieee-2020-2.0/seq/uvm_sequence_base.svh
      // @uvm-ieee 1800.2-2020 auto 14.2.4.2
      function void set_starting_phase(uvm_phase phase);
        if (!m_starting_phase_dap.try_set(phase)) begin
          // Too late to update starting phase
          uvm_phase sp;
          sp = m_starting_phase_dap.get();
          `uvm_error("UVM/SEQ/SP/SET",
                     $sformatf("The starting_phase variable was set to '%s' after a call to get_starting_phase locked the value at '%s'.  The new value is ignored.",
                               (phase == null) ? "<null>" : phase.get_name(),
                               (sp == null) ? "<null>" : sp.get_name()))
        end
        else begin
          // Update the starting_phase variable
          starting_phase = phase;
        end
      endfunction : set_starting_phase
    

    完整源码 · SHA256:aedbad6d9991d5712dd8e5e676a9fb5487ab33af52219ae4786e6adaa7001375

    术语解释 · 兼容配置

    返回Sequence / Sequencer · 迁移清单

    版本适用范围