跳转至

输入查询内容

    本页内容

    具体阻塞 socket:IMP 连接与响应返回

    环境:VCS W-2024.09-SP2-8。1.2 使用 uvm-1.2,2.0 使用 uvm-ieee-2020-2.0

    实验检查观察值是否符合预期;成功复现问题不代表问题已修复。

    结果对比

    观察内容 UVM 1.2 UVM 2.0
    阻塞 socket 返回 UVM_TLM_OK_RESPONSE(1=是) response_ok 1 1
    非法地址返回 UVM_TLM_ADDRESS_ERROR_RESPONSE(1=是) bad_address_rejected 1 1
    阻塞 socket 目标 IMP 的 b_transport 调用次数 target_calls 2 2

    运行命令

    目录与环境准备;从解包根目录执行:

    uv run tools/run_uvm_review.py --case socket_migration_probe --variants 12,20
    

    最小源码

    socket_migration_probe.sv

    socket_migration_probe.sv
    `timescale 1ns/1ps
    `include "uvm_macros.svh"
    import uvm_pkg::*;
    
    class payload_target extends uvm_component;
      uvm_tlm_b_target_socket#(payload_target) socket;
      int calls;
      function new(string name, uvm_component parent);
        super.new(name, parent);
        socket = new("socket", this, this);
      endfunction
      virtual task b_transport(uvm_tlm_generic_payload tx, uvm_tlm_time delay);
        calls++;
        if (tx.get_command() == UVM_TLM_WRITE_COMMAND && tx.get_address() == 'h20)
          tx.set_response_status(UVM_TLM_OK_RESPONSE);
        else tx.set_response_status(UVM_TLM_ADDRESS_ERROR_RESPONSE);
      endtask
    endclass
    
    class socket_test extends uvm_test;
      `uvm_component_utils(socket_test)
      uvm_tlm_b_initiator_socket#() socket;
      payload_target target;
      function new(string name, uvm_component parent); super.new(name, parent); endfunction
      function void build_phase(uvm_phase phase);
        super.build_phase(phase);
        socket = new("socket", this);
        target = new("target", this);
      endfunction
      function void connect_phase(uvm_phase phase);
        socket.connect(target.socket);
      endfunction
      task run_phase(uvm_phase phase);
        uvm_tlm_generic_payload tx = new("tx");
        uvm_tlm_time delay = new("delay");
        phase.raise_objection(this);
        tx.set_command(UVM_TLM_WRITE_COMMAND);
        tx.set_address('h20);
        socket.b_transport(tx, delay);
        $display("REVIEW|response_ok|%0d", tx.get_response_status() == UVM_TLM_OK_RESPONSE);
        tx.set_address('h24);
        socket.b_transport(tx, delay);
        $display("REVIEW|bad_address_rejected|%0d", tx.get_response_status() == UVM_TLM_ADDRESS_ERROR_RESPONSE);
        $display("REVIEW|target_calls|%0d", target.calls);
        $display("REVIEW|done|1");
        phase.drop_objection(this);
      endtask
    endclass
    
    module socket_migration_probe;
      initial run_test("socket_test");
    endmodule
    

    全部用例 · 证据摘要

    版本适用范围