跳转至

输入查询内容

    本页内容

    多个 sequence 同时 lock 时授权顺序改变

    影响范围

    多个 sequence 同时申请 lock,或依赖同 seed 下的旧授权顺序。

    具体差异

    1.2 只处理队首连续 lock,先统一判阻塞再批量授予;2.0 在整个仲裁队列找第一个未阻塞 lock,每轮授予一个。因此不仅批量变单发,排在普通请求后面的 lock 也可能提前获授。不要将其简单解释为更严格的同一算法;锁竞争与普通请求混排必须比对调度。

    修改方案

    保留 lock/unlock 的配对流程;回归不再假定一次调度同时授权所有排队 lock。对并发 sequence 按实际授权与完成顺序判定;若业务必须固定先后,用显式握手表达依赖,并验证每个请求最终获准、锁最终释放。

    兼容措施与范围:lock/unlock 接口可保留,兼容措施不恢复旧批量授权;依赖顺序须由明确握手表达。

    迁移后验证

    并发申请后记录授予顺序和每个请求完成,验证无饥饿和锁残留;允许差异需由仲裁契约解释。

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

    已有实测与复现

    补充查阅

    扫描定位与记录结果

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

    • S34 · 启发式:sequence lock/kill 与等待请求流程。 排除已识别的 process/component 接收者;未知类型仍保留启发式提示。扫描不能证明并发竞争与 kill 时序。
    uv run tools/uvm_migration_scan.py <SoC代码目录> --rules S34
    

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

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

    源码与标准依据

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

    VCS 内置 UVM-1.2uvm_sequencer_base.svh:660(对队首连续的 lock 请求,把所有未阻塞者一次性移入 lock_list)

    VCS 内置 uvm-ieee-2020-2.0uvm_sequencer_base.svh:565(只授予第一个未阻塞的 lock 请求)

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

    src/vcs-uvm-1.2/seq/uvm_sequencer_base.svh
    // 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});
          foreach(q[idx]) begin
            `uvm_error("SEQLCKZMB", $sformatf("The task responsible for requesting a lock on sequencer '%s' for sequence '%s' has been killed, to avoid a deadlock the sequence will be removed from the arbitration queues", this.get_full_name(), q[idx].sequence_ptr.get_full_name()))
    
            remove_sequence_from_queues(q[idx].sequence_ptr);
          end   
      end
    
      // now move all is_blocked() into lock_list
      begin
        uvm_sequence_request leading_lock_reqs[$],blocked_seqs[$],not_blocked_seqs[$];  
        int q1[$];
    

    完整源码 · SHA256:66b7addbfd531ae8a5579d82e77865fab23259c17a87a43ee4d1dbf7d67133fd

    src/vcs-uvm-ieee-2020-2.0/seq/uvm_sequencer_base.svh
    // 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});
           foreach(zombies[idx]) begin
              `uvm_error("SEQLCKZMB", $sformatf("The task responsible for requesting a lock on sequencer '%s' for sequence '%s' has been killed, to avoid a deadlock the sequence will be removed from the arbitration queues", this.get_full_name(), zombies[idx].sequence_ptr.get_full_name()))
              remove_sequence_from_queues(zombies[idx].sequence_ptr);
           end
        end
    
        // grant the first lock request that is not blocked, if any
        begin
           int lock_req_indices[$];
           lock_req_indices = arb_sequence_q.find_first_index(item) with (item.request==SEQ_TYPE_LOCK && is_blocked(item.sequence_ptr) == 0);
           if(lock_req_indices.size()) begin
    

    完整源码 · SHA256:6d2477484529dad661a38b31619edf9898bfa3375f217f06a27b3a69af32ccf7

    术语解释 · 兼容配置

    返回Sequence / Sequencer · 迁移清单

    版本适用范围