跳转至

输入查询内容

    本页内容

    自定义 sequence 仲裁函数改用 int 签名

    影响范围

    重写 user_priority_arbitration 或直接传递候选队列。

    具体差异

    integerint 都是 32 位有符号四态整数,不能将此变化解释为二态化。但 VCS W-2024.09-SP2-8 对旧 integer 返回值及 integer avail_sequences[$] override 在 2.0 报 SV-IRT / SV-ATDNMD,直接传入 integer 队列还报 ICTTFC。因此本机表现为编译断点。

    修改方案

    2.0 派生 sequencer 的返回类型和形参改为 int / int avail_sequences[$];直接调用时也同步队列元素类型。若同一源码必须支持两版,以库版本宏选择签名。

    在原派生 sequencer 内保留仲裁算法,只调整返回类型和候选队列类型。例如,原来选择最后一个候选项:

    1
    2
    3
    4
    // UVM 1.2
    virtual function integer user_priority_arbitration(integer avail_sequences[$]);
      return avail_sequences[$];
    endfunction
    
    1
    2
    3
    4
    // UVM 2.0
    virtual function int user_priority_arbitration(int avail_sequences[$]);
      return avail_sequences[$];
    endfunction
    

    示例来自 C14 编译探针,假定库传入非空候选集合;它不表示业务应统一选择末项。返回候选集合中的值,不能把自己计算的队列位置误当成该值。自行调用此方法时,实参队列也改为 int candidates[$]integerint 都是 32 位四态,此处是在匹配目标 VCS 的方法签名。

    兼容措施与范围:兼容开关不恢复旧仲裁签名;override 和直接调用的队列类型均须匹配目标。

    迁移后验证

    两库各编译对应签名;构造两个不同优先级请求,检查实际授权对象以及返回索引确实属于候选集合。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • C14 · 文本匹配:自定义 user_priority_arbitration 旧 integer 签名在 VCS 2.0 不匹配。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules C14
    

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_sequencer_base.svh:100、实现 uvm_sequencer_base.svh:649function integer user_priority_arbitration(integer avail_sequences[$])

    VCS 内置 uvm-ieee-2020-2.0uvm_sequencer_base.svh:121、实现 uvm_sequencer_base.svh:554function int ...(int avail_sequences[$])

    标准依据:IEEE 1800.2-2020 §15.3.2.3(virtual function int user_priority_arbitration(int avail_sequences[$])

    标为“源码标注”或未注明原文核对的条款仅作定位;具体库行为以源码和实测为准。

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

    src/vcs-uvm-1.2/seq/uvm_sequencer_base.svh
      // The default implementation behaves like UVM_SEQ_ARB_FIFO, which returns the
      // entry at avail_sequences[0]. 
      //
      extern virtual function integer user_priority_arbitration(integer avail_sequences[$]);
    
    
      // Task: execute_item
      //
      // Executes the given transaction ~item~ directly on this sequencer. A temporary
      // parent sequence is automatically created for the ~item~.  There is no capability to
      // retrieve responses. If the driver returns responses, they will accumulate in the
      // sequencer, eventually causing response overflow unless
      // <uvm_sequence_base::set_response_queue_error_report_disabled> is called.
    
      extern virtual task execute_item(uvm_sequence_item item);
    
      // Hidden array, keeps track of running default sequences
      protected uvm_sequence_process_wrapper m_default_sequences[uvm_phase];
    

    src/vcs-uvm-1.2/seq/uvm_sequencer_base.svh
    // user_priority_arbitration
    // -------------------------
    
    function integer uvm_sequencer_base::user_priority_arbitration(integer avail_sequences[$]);
      return avail_sequences[0];
    endfunction
    
    
    // grant_queued_locks
    // ------------------
    // Any lock or grab requests that are at the front of the queue will be
    // granted at the earliest possible time.  This function grants any queues
    // at the front that are not locked out
    
    function void uvm_sequencer_base::grant_queued_locks();
      // first remove sequences with dead lock control process
      begin
          uvm_sequence_request q[$];
          q = arb_sequence_q.find(item) with (item.request==SEQ_TYPE_LOCK && item.process_id.status inside {process::KILLED,process::FINISHED});
    

    完整源码 · SHA256:66b7addbfd531ae8a5579d82e77865fab23259c17a87a43ee4d1dbf7d67133fd

    src/vcs-uvm-ieee-2020-2.0/seq/uvm_sequencer_base.svh
      // @uvm-ieee 1800.2-2020 auto 15.3.2.3
      extern virtual function int user_priority_arbitration(int avail_sequences[$]);
    
    
      // Task -- NODOCS -- execute_item
      //
      // Executes the given transaction ~item~ directly on this sequencer. A temporary
      // parent sequence is automatically created for the ~item~.  There is no capability to
      // retrieve responses. If the driver returns responses, they will accumulate in the
      // sequencer, eventually causing response overflow unless
      // <uvm_sequence_base::set_response_queue_error_report_enabled> is called.
    
      // @uvm-ieee 1800.2-2020 auto 15.3.2.5
      extern virtual task execute_item(uvm_sequence_item item);
    
      // Hidden array, keeps track of running default sequences
      protected uvm_sequence_process_wrapper m_default_sequences[uvm_phase];
    

    src/vcs-uvm-ieee-2020-2.0/seq/uvm_sequencer_base.svh
    // user_priority_arbitration
    // -------------------------
    
    function int uvm_sequencer_base::user_priority_arbitration(int avail_sequences[$]);
      return avail_sequences[0];
    endfunction
    
    
    // grant_queued_locks
    // ------------------
    // Any lock or grab requests that are at the front of the queue will be
    // granted at the earliest possible time.  This function grants any queues
    // at the front that are not locked out
    
    function void uvm_sequencer_base::grant_queued_locks();
        // remove and report any zombies
        begin
           uvm_sequence_request zombies[$];
           zombies = arb_sequence_q.find(item) with (item.request==SEQ_TYPE_LOCK && item.process_id.status inside {process::KILLED,process::FINISHED});
    

    完整源码 · SHA256:6d2477484529dad661a38b31619edf9898bfa3375f217f06a27b3a69af32ccf7

    术语解释 · 兼容配置

    返回Sequence / Sequencer · 迁移清单

    版本适用范围