core-v-verif系列之lib<49>
该文件监控CVXIF接口信号收集请求和响应事务管理复位状态将事务发送给序列器和覆盖率模型代码介绍:定义监控类,继承自UVM的基类逻辑分析:作为标准UVM监控组件,负责观察DUT接口活动参数说明:定义三种复位状态状态转换:通过任务监控复位信号变化代码分析:初始化分析端口关键点:确保事务传输通道就绪完整的UVM标准实现支持多种事务类型监控完善的复位状态管理灵活的事务分发机制详细的调试信息输出。
UVM环境介绍
HEAD commitID: 1f968ef
1. core-v-verif/lib/uvm_agents/uvma_cvxif/src/comps/uvma_cvxif_mon.sv
// Copyright 2021 Thales DIS design services SAS
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
// You may obtain a copy of the License at https://solderpad.org/licenses/
//
// Original Author: Zineb EL KACIMI (zineb.el-kacimi@external.thalesgroup.com)
`ifndef __UVMA_CVXIF_MON_SV__
`define __UVMA_CVXIF_MON_SV__
class uvma_cvxif_mon_c extends uvm_monitor;
//objects
uvma_cvxif_cfg_c cfg;
uvma_cvxif_cntxt_c cntxt;
// add to factory
`uvm_component_utils_begin(uvma_cvxif_mon_c)
`uvm_field_object(cfg, UVM_DEFAULT)
`uvm_field_object(cntxt, UVM_DEFAULT)
`uvm_component_utils_end
string info_tag = "CVXIF_MONITOR";
int req_valid;
uvm_analysis_port#(uvma_cvxif_req_item_c) req_ap;
uvm_analysis_port#(uvma_cvxif_resp_item_c) resp_ap;
uvma_cvxif_req_item_c req_tr;
uvma_cvxif_resp_item_c resp_tr;
/**
* Default constructor.
*/
extern function new(string name="uvma_cvxif_mon", uvm_component parent=null);
/**
* 1. Ensures vif handle is not null.
* 2. Builds ap.
*/
extern virtual function void build_phase(uvm_phase phase);
/**
* Monitoring transaction
*/
extern virtual task run_phase(uvm_phase phase);
/**
* Send transaction request to sequencer
*/
extern task send_req_to_sqr(uvma_cvxif_req_item_c req);
/**
* Collect and send request items to sequencer
*/
extern task collect_and_send_req(uvma_cvxif_req_item_c req_tr);
/**
* Collect and send response items to coverage model
*/
extern task collect_and_send_resp(uvma_cvxif_resp_item_c resp_tr);
/**
* Observe reset state
*/
extern task observe_reset();
/**
* Monitor pre-reset phase
*/
extern virtual task mon_cvxif_pre_reset();
/**
* Monitor in-reset phase
*/
extern virtual task mon_cvxif_in_reset();
/**
* Monitor post-reset phase
*/
extern virtual task mon_cvxif_post_reset();
endclass : uvma_cvxif_mon_c
function uvma_cvxif_mon_c::new(string name="uvma_cvxif_mon", uvm_component parent=null);
super.new(name, parent);
endfunction : new
function void uvma_cvxif_mon_c::build_phase(uvm_phase phase);
super.build_phase(phase);
void'(uvm_config_db#(uvma_cvxif_cfg_c)::get(this, "", "cfg", cfg));
if (cfg == null) begin
`uvm_fatal("CFG", "Configuration handle is null")
end
void'(uvm_config_db#(uvma_cvxif_cntxt_c)::get(this, "", "cntxt", cntxt));
if (cntxt == null) begin
`uvm_fatal("CNTXT", "Context handle is null")
end
req_ap = new("req_ap", this);
resp_ap = new("resp_ap", this);
endfunction : build_phase
task uvma_cvxif_mon_c::run_phase(uvm_phase phase);
super.run_phase(phase);
fork
observe_reset();
forever begin
case (cntxt.reset_state)
UVMA_CVXIF_RESET_STATE_PRE_RESET: mon_cvxif_pre_reset();
UVMA_CVXIF_RESET_STATE_IN_RESET: mon_cvxif_in_reset();
UVMA_CVXIF_RESET_STATE_POST_RESET: mon_cvxif_post_reset();
endcase
end
join
endtask: run_phase
task uvma_cvxif_mon_c::mon_cvxif_post_reset();
fork
begin
collect_and_send_resp(resp_tr);
end
begin
collect_and_send_req(req_tr);
end
join_any
endtask
task uvma_cvxif_mon_c::mon_cvxif_in_reset();
@(cntxt.vif.clk);
endtask
task uvma_cvxif_mon_c::mon_cvxif_pre_reset();
@(cntxt.vif.clk);
endtask
task uvma_cvxif_mon_c::send_req_to_sqr(uvma_cvxif_req_item_c req);
req_ap.write(req);
endtask : send_req_to_sqr
task uvma_cvxif_mon_c::collect_and_send_req(uvma_cvxif_req_item_c req_tr);
forever begin
// wait for a transaction
if ((cntxt.vif.issue_valid && cntxt.vif.issue_ready) || (cntxt.vif.compressed_valid && cntxt.vif.compressed_ready)) begin
req_tr = uvma_cvxif_req_item_c::type_id::create("req_tr");
`uvm_info(info_tag, $sformatf("New transaction received"), UVM_HIGH);
//Detect an issue_req transaction
if (cntxt.vif.compressed_valid) begin
req_tr.compressed_valid = cntxt.vif.compressed_valid;
req_tr.compressed_req.instr = cntxt.vif.compressed_req.instr;
req_tr.compressed_req.hartid = cntxt.vif.compressed_req.hartid;
`uvm_info(info_tag, $sformatf("New compressed valid transaction received"), UVM_HIGH);
req_valid = 1;
end
//Detect an issue_req transaction
if (cntxt.vif.issue_valid) begin
req_tr.issue_valid = cntxt.vif.issue_valid;
req_tr.issue_req.instr = cntxt.vif.issue_req.instr;
req_tr.issue_req.hartid = cntxt.vif.issue_req.hartid;
req_tr.issue_req.id = cntxt.vif.issue_req.id;
`uvm_info(info_tag, $sformatf("New issue valid transaction received"), UVM_HIGH);
req_valid = 1;
end
//Detect an issue_req transaction
if (cntxt.vif.register_valid) begin
req_tr.register_valid = cntxt.vif.register_valid;
req_tr.register.hartid = cntxt.vif.register.hartid;
req_tr.register.id = cntxt.vif.register.id;
for (int i = 0; i < X_NUM_RS; i++) begin
if (cntxt.vif.register.rs_valid[i]) begin
req_tr.register.rs_valid[i] = cntxt.vif.register.rs_valid[i];
req_tr.register.rs[i] = cntxt.vif.register.rs[i];
end
end
`uvm_info(info_tag, $sformatf("New register valid transaction received"), UVM_HIGH);
req_valid = 1;
end
//Detect commit transaction
if (cntxt.vif.commit_valid) begin
req_tr.commit_valid = cntxt.vif.commit_valid;
req_tr.commit_req.hartid = cntxt.vif.commit_req.hartid;
req_tr.commit_req.id = cntxt.vif.commit_req.id;
req_tr.commit_req.commit_kill = cntxt.vif.commit_req.commit_kill;
`uvm_info(info_tag, $sformatf("New commit valid transaction received"), UVM_HIGH);
req_valid = 1;
end
if (req_valid) begin
`uvm_info(info_tag, $sformatf("Sending req to sqr %p", req_tr), UVM_HIGH);
send_req_to_sqr(req_tr);
req_valid = 0;
end
end
@(cntxt.vif.slv_cvxif_cb);
end
endtask
task uvma_cvxif_mon_c::collect_and_send_resp(uvma_cvxif_resp_item_c resp_tr);
forever begin
fork
begin
wait (cntxt.vif.compressed_ready && cntxt.vif.compressed_valid);
resp_tr = uvma_cvxif_resp_item_c::type_id::create("resp_tr");
resp_tr.compressed_resp.accept = cntxt.vif.compressed_resp.accept;
resp_tr.compressed_resp.instr = cntxt.vif.compressed_resp.instr;
`uvm_info(info_tag, $sformatf("send compreseed resp"), UVM_HIGH);
end
begin
wait (cntxt.vif.issue_ready && cntxt.vif.issue_valid);
resp_tr = uvma_cvxif_resp_item_c::type_id::create("resp_tr");
resp_tr.issue_resp.accept = cntxt.vif.issue_resp.accept;
resp_tr.issue_resp.writeback = cntxt.vif.issue_resp.writeback;
resp_tr.issue_resp.register_read = cntxt.vif.issue_resp.register_read;
`uvm_info(info_tag, $sformatf("send issue resp"), UVM_HIGH);
end
begin
wait (cntxt.vif.result_valid && cntxt.vif.result_ready);
resp_tr = uvma_cvxif_resp_item_c::type_id::create("resp_tr");
resp_tr.result_valid = cntxt.vif.result_valid;
resp_tr.result.hartid = cntxt.vif.result.hartid;
resp_tr.result.id = cntxt.vif.result.id;
resp_tr.result.data = cntxt.vif.result.data;
resp_tr.result.rd = cntxt.vif.result.rd;
resp_tr.result.we = cntxt.vif.result.we;
`uvm_info(info_tag, $sformatf("send result resp"), UVM_HIGH);
end
join_any
resp_ap.write(resp_tr);
@(cntxt.vif.slv_cvxif_cb);
end
endtask
task uvma_cvxif_mon_c::observe_reset();
forever begin
wait (cntxt.vif.reset_n === 0);
cntxt.reset_state = UVMA_CVXIF_RESET_STATE_IN_RESET;
`uvm_info(get_type_name(), $sformatf("RESET_STATE_IN_RESET"), UVM_NONE)
wait (cntxt.vif.reset_n === 1);
cntxt.reset_state = UVMA_CVXIF_RESET_STATE_POST_RESET;
`uvm_info(get_type_name(), $sformatf("RESET_STATE_POST_RESET"), UVM_NONE)
end
endtask : observe_reset
`endif // __UVMA_CVXIF_MON_SV__
1. 简要介绍
该文件uvma_cvxif_mon.sv
是CVXIF验证环境的监控组件实现,主要功能包括:
- 监控CVXIF接口信号
- 收集请求和响应事务
- 管理复位状态
- 将事务发送给序列器和覆盖率模型
2. 接口介绍
2.1 类定义与继承
class uvma_cvxif_mon_c extends uvm_monitor;
- 代码介绍:定义监控类,继承自UVM的
uvm_monitor
基类 - 逻辑分析:作为标准UVM监控组件,负责观察DUT接口活动
2.2 分析端口
uvm_analysis_port#(uvma_cvxif_req_item_c) req_ap;
uvm_analysis_port#(uvma_cvxif_resp_item_c) resp_ap;
- 代码介绍:定义两个分析端口
- 逻辑分析:
req_ap
:发送请求事务给序列器resp_ap
:发送响应事务给覆盖率模型
3. 参数介绍
3.1 复位状态定义
UVMA_CVXIF_RESET_STATE_PRE_RESET
UVMA_CVXIF_RESET_STATE_IN_RESET
UVMA_CVXIF_RESET_STATE_POST_RESET
- 参数说明:定义三种复位状态
- 状态转换:通过
observe_reset
任务监控复位信号变化
3.2 事务类型
uvma_cvxif_req_item_c req_tr;
uvma_cvxif_resp_item_c resp_tr;
- 参数说明:定义请求和响应事务句柄
- 生命周期:在收集事务时动态创建
4. 模块实现介绍
4.1 build_phase实现
req_ap = new("req_ap", this);
resp_ap = new("resp_ap", this);
- 代码分析:初始化分析端口
- 关键点:确保事务传输通道就绪
4.2 run_phase实现
fork
observe_reset();
forever begin
case (cntxt.reset_state)
UVMA_CVXIF_RESET_STATE_PRE_RESET: mon_cvxif_pre_reset();
UVMA_CVXIF_RESET_STATE_IN_RESET: mon_cvxif_in_reset();
UVMA_CVXIF_RESET_STATE_POST_RESET: mon_cvxif_post_reset();
endcase
end
join
- 代码分析:并行执行复位监控和事务收集
- 并发控制:使用fork-join实现多进程
4.3 事务收集任务
if (cntxt.vif.issue_valid) begin
req_tr.issue_valid = cntxt.vif.issue_valid;
req_tr.issue_req.instr = cntxt.vif.issue_req.instr;
- 代码分析:捕获issue请求事务
- 信号映射:将接口信号赋值给事务对象
5. 总结
该监控组件具有以下特点:
- 完整的UVM标准实现
- 支持多种事务类型监控
- 完善的复位状态管理
- 灵活的事务分发机制
- 详细的调试信息输出
作为CVXIF验证环境的关键组件,它提供了接口活动的全面监控能力,为功能覆盖率和断言检查提供了基础数据。
2. core-v-verif/lib/uvm_agents/uvma_cvxif/src/comps/uvma_cvxif_vsqr.sv
// Copyright 2021 Thales DIS design services SAS
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
// You may obtain a copy of the License at https://solderpad.org/licenses/
//
// Original Author: Zineb EL KACIMI (zineb.el-kacimi@external.thalesgroup.com)
`ifndef __UVMA_CVXIF_VSQR_SV__
`define __UVMA_CVXIF_VSQR_SV__
/**
* Component provides sequence items for uvma_cvxif_drv_c.
*/
class uvma_cvxif_vsqr_c extends uvm_sequencer#(uvma_cvxif_resp_item_c);
// Analysis port to receive retirement events from monitor
uvm_tlm_analysis_fifo #(uvma_cvxif_req_item_c) mm_req_fifo;
// Objects
uvma_cvxif_cfg_c cfg;
`uvm_component_utils_begin (uvma_cvxif_vsqr_c)
`uvm_field_object(cfg , UVM_DEFAULT)
`uvm_object_utils_end
/**
* Default constructor.
*/
extern function new(string name="uvma_cvxif_vsqr", uvm_component parent=null);
extern virtual function void build_phase(uvm_phase phase);
endclass : uvma_cvxif_vsqr_c
function uvma_cvxif_vsqr_c::new(string name="uvma_cvxif_vsqr", uvm_component parent=null);
super.new(name, parent);
endfunction : new
function void uvma_cvxif_vsqr_c::build_phase(uvm_phase phase);
super.build_phase(phase);
void'(uvm_config_db#(uvma_cvxif_cfg_c)::get(this, "", "cfg", cfg));
if (cfg == null) begin
`uvm_fatal("CFG", "Configuration handle is null")
end
mm_req_fifo = new("mm_req_fifo", this);
endfunction : build_phase
`endif // __UVMA_CVXIF_VSQR_SV__
1. 简要介绍
该文件uvma_cvxif_vsqr.sv
是CVXIF验证环境的虚拟序列器实现,主要功能包括:
- 为CVXIF驱动提供序列项
- 管理请求事务队列
- 协调序列执行
2. 接口介绍
2.1 类定义与继承
class uvma_cvxif_vsqr_c extends uvm_sequencer#(uvma_cvxif_resp_item_c);
- 代码介绍:定义虚拟序列器类,继承自参数化的UVM序列器
- 逻辑分析:专用于处理
uvma_cvxif_resp_item_c
类型的响应项
2.2 分析FIFO
uvm_tlm_analysis_fifo #(uvma_cvxif_req_item_c) mm_req_fifo;
- 代码介绍:定义请求事务FIFO
- 逻辑分析:用于接收来自监控器的请求事务
3. 参数介绍
3.1 配置对象
uvma_cvxif_cfg_c cfg;
- 参数说明:存储验证配置参数
- 访问方式:通过UVM配置数据库获取
3.2 UVM组件宏
`uvm_component_utils_begin(uvma_cvxif_vsqr_c)
`uvm_field_object(cfg, UVM_DEFAULT)
`uvm_object_utils_end
- 参数说明:注册组件和字段
- 功能:支持自动化操作
4. 模块实现介绍
4.1 构造函数
function uvma_cvxif_vsqr_c::new(string name="uvma_cvxif_vsqr", uvm_component parent=null);
super.new(name, parent);
endfunction : new
- 代码分析:标准构造函数
- 关键点:调用父类构造函数完成初始化
4.2 build_phase实现
void'(uvm_config_db#(uvma_cvxif_cfg_c)::get(this, "", "cfg", cfg));
mm_req_fifo = new("mm_req_fifo", this);
- 代码分析:
- 从UVM数据库获取配置
- 初始化请求FIFO
- 错误处理:配置为空时报fatal错误
5. 总结
该虚拟序列器具有以下特点:
- 标准的UVM序列器实现
- 内置请求事务缓冲队列
- 完善的配置管理
- 简洁高效的实现
作为CVXIF验证环境的关键组件,它为序列执行提供了基础设施支持,确保验证场景能够正确执行。
3. core-v-verif/lib/uvm_agents/uvma_cvxif/src/obj/uvma_cvxif_cfg.sv
// Copyright 2021 Thales DIS design services SAS
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
// You may obtain a copy of the License at https://solderpad.org/licenses/
//
// Original Author: Zineb EL KACIMI (zineb.el-kacimi@external.thalesgroup.com)
`ifndef __UVMA_CVXIF_CFG_SV__
`define __UVMA_CVXIF_CFG_SV__
/**
* Object encapsulating all parameters for creating, connecting and running all
* Clock & Reset agent (uvma_cvxif_agent_c) components.
*/
class uvma_cvxif_cfg_c extends uvm_object;
rand bit enabled_cvxif;
bit cvxif_plusarg_valid;
rand bit cov_model_enabled;
rand int unsigned hold_issue_ready;
rand int unsigned hold_issue_not_ready;
rand int unsigned hold_compressed_ready;
rand int unsigned hold_compressed_not_ready;
rand bit zero_delay_mode;
rand int unsigned instr_delayed;
rand uvma_cvxif_slv_drv_ordering_mode ordering_mode;
rand uvma_cvxif_issue_ready_mode_enum issue_ready_mode;
rand uvma_cvxif_compressed_ready_mode_enum compressed_ready_mode;
constraint reasonable_values {
soft hold_issue_ready inside {[1:3]};
soft hold_issue_not_ready inside {[1:3]};
soft hold_compressed_ready inside {[1:3]};
soft hold_compressed_not_ready inside {[1:3]};
if (zero_delay_mode) {
instr_delayed == 0;
}
else {
soft instr_delayed inside {[2:4]};
}
}
constraint hold_ready_values {
hold_issue_ready != 0;
hold_compressed_ready != 0;
}
constraint defaults_val {
soft issue_ready_mode == UVMA_CVXIF_ISSUE_READY_RANDOMIZED;
soft compressed_ready_mode == UVMA_CVXIF_COMPRESSED_READY_RANDOMIZED;
soft ordering_mode == UVMA_CVXIF_ORDERING_MODE_IN_ORDER;
soft zero_delay_mode == 1;
soft cov_model_enabled == 1;
soft enabled_cvxif == 0;
}
`uvm_object_utils_begin(uvma_cvxif_cfg_c)
`uvm_field_int ( cov_model_enabled, UVM_DEFAULT)
`uvm_field_int ( enabled_cvxif, UVM_DEFAULT)
`uvm_field_int ( hold_issue_ready, UVM_DEFAULT)
`uvm_field_int ( hold_issue_not_ready, UVM_DEFAULT)
`uvm_field_int ( hold_compressed_ready, UVM_DEFAULT)
`uvm_field_int ( hold_compressed_not_ready, UVM_DEFAULT)
`uvm_field_int ( instr_delayed, UVM_DEFAULT)
`uvm_field_int ( zero_delay_mode, UVM_DEFAULT)
`uvm_field_enum (uvma_cvxif_slv_drv_ordering_mode, ordering_mode, UVM_DEFAULT);
`uvm_field_enum (uvma_cvxif_issue_ready_mode_enum, issue_ready_mode, UVM_DEFAULT);
`uvm_field_enum (uvma_cvxif_compressed_ready_mode_enum, compressed_ready_mode, UVM_DEFAULT);
`uvm_object_utils_end
/**
* Default constructor.
*/
extern function new(string name="uvma_cvxif_cfg");
endclass : uvma_cvxif_cfg_c
function uvma_cvxif_cfg_c::new(string name="uvma_cvxif_cfg");
super.new(name);
// Read plusargs for defaults
if ($test$plusargs("enabled_cvxif")) begin
cvxif_plusarg_valid = 1;
end
endfunction : new
`endif //__UVMA_CVXIF_CFG_SV__
1. 简要介绍
该文件uvma_cvxif_cfg.sv
是CVXIF验证环境的配置类实现,主要功能包括:
- 管理验证环境的配置参数
- 定义随机约束
- 支持命令行参数配置
- 提供默认参数值
2. 接口介绍
2.1 类定义与继承
class uvma_cvxif_cfg_c extends uvm_object;
- 代码介绍:定义配置类,继承自UVM的
uvm_object
基类 - 逻辑分析:作为UVM对象,支持配置参数的灵活管理
2.2 配置参数
rand bit enabled_cvxif;
rand bit cov_model_enabled;
rand int unsigned hold_issue_ready;
- 代码介绍:定义随机化配置参数
- 逻辑分析:参数支持随机化,便于验证场景的多样化
3. 参数介绍
3.1 约束定义
constraint reasonable_values {
soft hold_issue_ready inside {[1:3]};
if (zero_delay_mode) {
instr_delayed == 0;
}
}
- 参数说明:定义合理的参数范围
- 约束类型:使用
soft
约束允许外部覆盖
3.2 默认值约束
constraint defaults_val {
soft issue_ready_mode == UVMA_CVXIF_ISSUE_READY_RANDOMIZED;
soft enabled_cvxif == 0;
}
- 参数说明:设置参数的默认值
- 灵活性:
soft
约束可被外部覆盖
4. 模块实现介绍
4.1 UVM字段宏
`uvm_object_utils_begin(uvma_cvxif_cfg_c)
`uvm_field_int(cov_model_enabled, UVM_DEFAULT)
`uvm_field_enum(uvma_cvxif_issue_ready_mode_enum, issue_ready_mode, UVM_DEFAULT)
`uvm_object_utils_end
- 代码分析:注册字段和枚举类型
- 功能:支持UVM的自动化操作
4.2 构造函数
function uvma_cvxif_cfg_c::new(string name="uvma_cvxif_cfg");
super.new(name);
if ($test$plusargs("enabled_cvxif")) begin
cvxif_plusarg_valid = 1;
end
endfunction
- 代码分析:读取命令行参数
- 关键点:支持运行时配置
5. 总结
该配置类具有以下特点:
- 完整的参数管理功能
- 灵活的随机约束定义
- 支持命令行参数配置
- 完善的UVM集成
- 清晰的默认值设置
作为验证环境的基础组件,它为CVXIF接口验证提供了灵活的配置能力,支持各种验证场景的需求。
4. core-v-verif/lib/uvm_agents/uvma_cvxif/src/obj/uvma_cvxif_cfg.sv
// Copyright 2021 Thales DIS design services SAS
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
// You may obtain a copy of the License at https://solderpad.org/licenses/
//
// Original Author: Zineb EL KACIMI (zineb.el-kacimi@external.thalesgroup.com)
`ifndef __UVMA_CVXIF_CNTXT_SV__
`define __UVMA_CVXIF_CNTXT_SV__
/**
* Object encapsulating all state variables for all CVXIF agent
* (uvma_cvxif_agent_c) components.
*/
class uvma_cvxif_cntxt_c extends uvm_object;
// Handle to agent interface
virtual uvma_cvxif_intf vif;
uvma_cvxif_reset_state_enum reset_state = UVMA_CVXIF_RESET_STATE_PRE_RESET;
// Events
uvm_event sample_cfg_e;
uvm_event sample_cntxt_e;
`uvm_object_utils_begin(uvma_cvxif_cntxt_c)
`uvm_field_event(sample_cfg_e , UVM_DEFAULT)
`uvm_field_event(sample_cntxt_e, UVM_DEFAULT)
`uvm_field_enum(uvma_cvxif_reset_state_enum, reset_state, UVM_DEFAULT)
`uvm_object_utils_end
/**
* Builds events.
*/
extern function new(string name="uvma_cvxif_cntxt");
endclass : uvma_cvxif_cntxt_c
function uvma_cvxif_cntxt_c::new(string name="uvma_cvxif_cntxt");
super.new(name);
sample_cfg_e = new("sample_cfg_e" );
sample_cntxt_e = new("sample_cntxt_e");
endfunction : new
`endif // __UVMA_CVXIF_CNTXT_SV__
1. 简要介绍
该文件uvma_cvxif_cntxt.sv
是CVXIF验证环境的上下文类实现,主要功能包括:
- 管理验证环境的运行时状态
- 存储虚拟接口句柄
- 提供事件通知机制
- 跟踪复位状态
2. 接口介绍
2.1 类定义与继承
class uvma_cvxif_cntxt_c extends uvm_object;
- 代码介绍:定义上下文类,继承自UVM的
uvm_object
基类 - 逻辑分析:作为UVM对象,支持验证环境的运行时状态管理
2.2 成员变量
virtual uvma_cvxif_intf vif;
uvma_cvxif_reset_state_enum reset_state = UVMA_CVXIF_RESET_STATE_PRE_RESET;
- 代码介绍:定义两个关键成员变量
- 逻辑分析:
vif
:存储CVXIF接口的虚拟句柄reset_state
:记录当前复位状态,默认PRE_RESET
3. 参数介绍
3.1 事件定义
uvm_event sample_cfg_e;
uvm_event sample_cntxt_e;
- 参数说明:定义两个UVM事件
- 用途:
sample_cfg_e
:配置采样事件sample_cntxt_e
:上下文采样事件
3.2 UVM字段宏
`uvm_object_utils_begin(uvma_cvxif_cntxt_c)
`uvm_field_event(sample_cfg_e, UVM_DEFAULT)
`uvm_field_enum(uvma_cvxif_reset_state_enum, reset_state, UVM_DEFAULT)
`uvm_object_utils_end
- 参数说明:注册事件和枚举类型
- 功能:支持UVM的自动化操作
4. 模块实现介绍
4.1 构造函数
function uvma_cvxif_cntxt_c::new(string name="uvma_cvxif_cntxt");
super.new(name);
sample_cfg_e = new("sample_cfg_e");
sample_cntxt_e = new("sample_cntxt_e");
endfunction
- 代码分析:
- 调用父类构造函数
- 初始化两个事件对象
- 关键点:确保事件对象在构造时创建
5. 总结
该上下文类具有以下特点:
- 完整的UVM标准实现
- 清晰的接口管理
- 灵活的复位状态跟踪
- 完善的事件通知机制
- 简洁高效的实现
作为CVXIF验证环境的核心组件,它为验证场景提供了必要的运行时状态管理能力,确保验证过程能够正确执行和监控。
5. core-v-verif/lib/uvm_agents/uvma_cvxif/src/seq/uvma_cvxif_resp_item.sv
// Copyright 2021 Thales DIS design services SAS
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
// You may obtain a copy of the License at https://solderpad.org/licenses/
//
// Original Author: Zineb EL KACIMI (zineb.el-kacimi@external.thalesgroup.com)
`ifndef __UVMA_CVXIF_RESP_ITEM_SV__
`define __UVMA_CVXIF_RESP_ITEM_SV__
/**
* Object rebuilt from the CVXIF monitor
*/
class uvma_cvxif_resp_item_c extends uvm_sequence_item;
rand x_compressed_resp_t compressed_resp;
rand x_issue_resp_t issue_resp;
rand x_result_t result;
rand logic issue_ready;
rand logic compressed_ready;
rand logic register_ready;
rand logic result_valid;
rand logic delay_resp;
logic compressed_valid;
logic issue_valid;
`uvm_object_utils(uvma_cvxif_resp_item_c)
/**
* Default constructor.
*/
extern function new(string name="uvma_cvxif_resp_item");
endclass : uvma_cvxif_resp_item_c
function uvma_cvxif_resp_item_c::new(string name="uvma_cvxif_resp_item");
super.new(name);
endfunction : new
`endif //__UVMA_CVXIF_RESP_ITEM_SV__
1. 简要介绍
该文件uvma_cvxif_req_item.sv
是CVXIF验证环境的请求事务类实现,主要功能包括:
- 封装CVXIF接口的请求数据
- 支持随机化生成测试场景
- 作为序列器与驱动器间的数据传输单元
2. 接口介绍
2.1 类定义与继承
class uvma_cvxif_req_item_c extends uvm_sequence_item;
- 代码介绍:定义请求事务类,继承自UVM的
uvm_sequence_item
基类 - 逻辑分析:作为UVM序列项,支持在验证组件间传输数据
2.2 成员变量
rand x_issue_req_t issue_req;
rand x_compressed_req_t compressed_req;
- 代码介绍:定义随机化成员变量
- 逻辑分析:
issue_req
:标准指令请求compressed_req
:压缩指令请求
3. 参数介绍
3.1 请求类型
rand logic issue_valid;
rand logic compressed_valid;
- 参数说明:定义请求有效性标志
- 随机化:支持随机生成有效/无效请求场景
3.2 UVM对象宏
`uvm_object_utils(uvma_cvxif_req_item_c)
- 参数说明:注册UVM对象
- 功能:支持自动化操作如复制、比较等
4. 模块实现介绍
4.1 构造函数
function uvma_cvxif_req_item_c::new(string name="uvma_cvxif_req_item");
super.new(name);
endfunction : new
- 代码分析:简单调用父类构造函数
- 关键点:保持UVM标准初始化流程
5. 总结
该请求事务类具有以下特点:
- 完整的UVM标准实现
- 支持多种请求类型
- 灵活的随机化配置
- 简洁高效的实现
作为CVXIF验证环境的基础数据结构,它为验证场景提供了标准化的请求数据封装,确保验证组件间的数据交互规范一致。
6. core-v-verif/lib/uvm_agents/uvma_cvxif/src/seq/uvma_cvxif_req_item.sv
1. 简要介绍
该文件uvma_cvxif_req_item.sv
是CVXIF验证环境的请求事务类实现,主要功能包括:
- 封装CVXIF接口的请求数据
- 支持随机化生成测试场景
- 作为序列器与驱动器间的数据传输单元
2. 接口介绍
2.1 类定义与继承
class uvma_cvxif_req_item_c extends uvm_sequence_item;
- 代码介绍:定义请求事务类,继承自UVM的
uvm_sequence_item
基类 - 逻辑分析:作为UVM序列项,支持在验证组件间传输数据
2.2 成员变量
rand x_issue_req_t issue_req;
rand x_compressed_req_t compressed_req;
- 代码介绍:定义随机化成员变量
- 逻辑分析:
issue_req
:标准指令请求compressed_req
:压缩指令请求
3. 参数介绍
3.1 请求类型
rand logic issue_valid;
rand logic compressed_valid;
- 参数说明:定义请求有效性标志
- 随机化:支持随机生成有效/无效请求场景
3.2 UVM对象宏
`uvm_object_utils(uvma_cvxif_req_item_c)
- 参数说明:注册UVM对象
- 功能:支持自动化操作如复制、比较等
4. 模块实现介绍
4.1 构造函数
function uvma_cvxif_req_item_c::new(string name="uvma_cvxif_req_item");
super.new(name);
endfunction : new
- 代码分析:简单调用父类构造函数
- 关键点:保持UVM标准初始化流程
5. 总结
该请求事务类具有以下特点:
- 完整的UVM标准实现
- 支持多种请求类型
- 灵活的随机化配置
- 简洁高效的实现
作为CVXIF验证环境的基础数据结构,它为验证场景提供了标准化的请求数据封装,确保验证组件间的数据交互规范一致。

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。
更多推荐
所有评论(0)