差异参考
按模块查阅
RAL(寄存器模型)
M07-025
本页内容
私有 reg-bank 覆盖率改为构造时声明
编译断点 其他行为变化
影响范围
使用 snps_uvm_reg_bank_group 等私有 reg-bank 类型,尤其构造后调用 add_coverage() 或依赖私有 predictor /访问签名。
具体差异
两版 VCS 都包含 snps_uvm_reg_bank.svh,Accellera 两版均无。1.2 add_coverage(uvm_reg_cvr_t models) 对 local m_has_cover 作或运算,2.0 删除;两版构造参数 has_coverage 都设置该能力集,set_coverage 只在能力集内启用。私有 predictor 的 get_type_name 在目标改用函数内 static 字符串缓存,并非新增静态 type_name() API;访问 path 随主库改为 uvm_door_e,保留别名范围见 M07-001 。
修改方案
对初始化时可确定的能力,把原构造能力与各次 add_coverage 参数合并为位掩码,通过 new(name, parent, has_coverage) 第三参传入;再用 set_coverage 选择当前启用项。不能用 set_coverage 冒充扩充能力。若运行中才增加能力,需调整模型生命周期或维护自己的模型实现;没有给存量对象追加能力的已验证通用替代。只使用其他保留接口时无需因此整体替换 reg-bank。
下例限构造完成前即可确定支持能力的 group;null 保留 parent 参数的位置。
// UVM 1.2
snps_uvm_reg_bank_group bank = new ( "bank" , null , UVM_CVR_REG_BITS );
bank . add_coverage ( UVM_CVR_FIELD_VALS );
void '( bank . set_coverage ( UVM_CVR_FIELD_VALS ));
// Both VCS libraries
uvm_reg_cvr_t supported = UVM_CVR_REG_BITS | UVM_CVR_FIELD_VALS ;
snps_uvm_reg_bank_group bank = new ( "bank" , null , supported );
void '( bank . set_coverage ( UVM_CVR_FIELD_VALS ));
通过 factory 构造派生 group 时,把已确定的能力传给派生类中的 super.new,不能把额外参数直接塞进不支持该签名的 type_id::create。运行中调整启用项可继续用 set_coverage,但只限已声明能力。
兼容措施与范围 :兼容措施不恢复 group.add_coverage。构造时声明能力适用于能力可预先确定的对象;path 旧别名在主库保留,按 M07-001 核对具体调用。
迁移后验证
编译原调用与改写;检查 has_coverage、启用/关闭后的 get_coverage,并在实际 bank 模型确认覆盖采样。若更改对象构造时机,还需检查已有引用、mode 切换及 predictor 连接;本条实验不覆盖实际 bank 切换或 RAL 总线访问。
记录本条结果 :M07-025 · 状态与证据 。
已有实测与复现
vendor_compile_probe 的 add_coverage 调用在 1.2 编译通过、2.0 报 Error-[MFNF]。vendor_migration_probe 两库构造后 has_coverage 返回 1;仅开启 FIELD_VALS 后,该项 get_coverage 为 1,REG_BITS 为 0。未验证 covergroup 实际采样、bank mode 切换、私有 predictor 或总线访问。
补充查阅
扫描定位与记录结果
有扫描规则,覆盖部分可识别写法 。脚本检查名称、参数和部分 FLAG 表达式,并对少数直接声明关联使用点;未做完整类型解析或预处理,行为结果仍需验证。
D6 · 文本匹配 :snps_uvm_reg_bank(Synopsys 私有 reg-bank 扩展,API 有变)。
uv run tools/uvm_migration_scan.py <SoC代码目录> --rules D6
核对命中对象及生效分支后,在条目清单记录修改与验证证据;扫描规则记录用于整理命中位置。
扫描器下载、输入范围与报告说明
源码与标准依据
核查方式:源码与实测核对 。实测仅覆盖本条所列场景。
补充定位
VCS 内置 UVM-1.2 :snps_uvm_reg_bank.svh:50–106 、uvm_reg_model.svh:450
VCS 内置 uvm-ieee-2020-2.0 :snps_uvm_reg_bank.svh:50–101 、snps_uvm_reg_bank.svh:584–596 、uvm_reg_model.svh:464
标准依据 :Synopsys 私有扩展,不属于 IEEE 1800.2 的通用 reg-bank API。
标为“源码标注”或未注明原文核对的条款仅作定位;具体库行为以源码和实测为准。
引用代码(高亮为引用行);上方行号链接可直接定位。
src/vcs-uvm-1.2/reg/snps_uvm_reg_bank.svh // first declared bankMode.
//
//-----------------------------------------------------------------
class snps_uvm_reg_bank_group extends uvm_object ;
`uvm_object_utils ( snps_uvm_reg_bank_group )
string modes [$];
string m_currentmode ;
int m_mode ;
local int m_has_cover ;
local int m_cover_on ;
function new ( string name = "" , uvm_object parent = null , int has_coverage = UVM_NO_COVERAGE );
super . new ( name );
m_has_cover = has_coverage ;
endfunction
protected virtual function void sample ();
endfunction
function uvm_reg_cvr_t build_coverage ( uvm_reg_cvr_t models );
typedef uvm_resource #( uvm_reg_cvr_t ) rsrc_t ;
rsrc_t rsrc = uvm_reg_cvr_rsrc_db :: get_by_name ({ "uvm_reg::" , get_full_name ()},
"include_coverage" , 0 );
if ( rsrc == null ) begin
return UVM_NO_COVERAGE ;
end
return rsrc . read ( this ) & models ;
endfunction : build_coverage
// add_coverage
function void add_coverage ( uvm_reg_cvr_t models );
this . m_has_cover |= models ;
endfunction : add_coverage
// has_coverage
function bit has_coverage ( uvm_reg_cvr_t models );
return (( m_has_cover & models ) == models );
endfunction : has_coverage
// set_coverage
function uvm_reg_cvr_t set_coverage ( uvm_reg_cvr_t is_on );
if ( is_on == uvm_reg_cvr_t '( UVM_NO_COVERAGE )) begin
m_cover_on = is_on ;
return m_cover_on ;
end
m_cover_on = m_has_cover & is_on ;
return m_cover_on ;
endfunction : set_coverage
// get_coverage
function bit get_coverage ( uvm_reg_cvr_t is_on );
if ( has_coverage ( is_on ) == 0 )
return 0 ;
return (( m_cover_on & is_on ) == is_on );
endfunction : get_coverage
完整源码 · SHA256:9b61ca476e055cc73692a7f72c81459c40adb0b2361da63d808db3b64118b10a
src/vcs-uvm-1.2/reg/uvm_reg_model.svh `include "reg/sequences/uvm_reg_mem_built_in_seq.svh"
`include "reg/sequences/uvm_reg_mem_hdl_paths_seq.svh"
`include "reg/snps_uvm_reg_bank.svh"
`endif // UVM_REG_MODEL__SV
完整源码 · SHA256:f29457c271b91936df38d49968f1b68383159bc266e9858e32a4fe3af4fded8d
src/vcs-uvm-ieee-2020-2.0/reg/snps_uvm_reg_bank.svh // first declared bankMode.
//
//-----------------------------------------------------------------
class snps_uvm_reg_bank_group extends uvm_object ;
`uvm_object_utils ( snps_uvm_reg_bank_group )
string modes [$];
string m_currentmode ;
int m_mode ;
local int m_has_cover ;
local int m_cover_on ;
function new ( string name = "" , uvm_object parent = null , int has_coverage = UVM_NO_COVERAGE );
super . new ( name );
m_has_cover = has_coverage ;
endfunction
protected virtual function void sample ();
endfunction
function uvm_reg_cvr_t build_coverage ( uvm_reg_cvr_t models );
typedef uvm_resource #( uvm_reg_cvr_t ) rsrc_t ;
rsrc_t rsrc = uvm_reg_cvr_rsrc_db :: get_by_name ({ "uvm_reg::" , get_full_name ()},
"include_coverage" , 0 );
if ( rsrc == null ) begin
return UVM_NO_COVERAGE ;
end
return rsrc . read ( this ) & models ;
endfunction : build_coverage
// has_coverage
function bit has_coverage ( uvm_reg_cvr_t models );
return (( m_has_cover & models ) == models );
endfunction : has_coverage
// set_coverage
function uvm_reg_cvr_t set_coverage ( uvm_reg_cvr_t is_on );
if ( is_on == uvm_reg_cvr_t '( UVM_NO_COVERAGE )) begin
m_cover_on = is_on ;
return m_cover_on ;
end
m_cover_on = m_has_cover & is_on ;
return m_cover_on ;
endfunction : set_coverage
// get_coverage
function bit get_coverage ( uvm_reg_cvr_t is_on );
if ( has_coverage ( is_on ) == 0 )
return 0 ;
return (( m_cover_on & is_on ) == is_on );
endfunction : get_coverage
src/vcs-uvm-ieee-2020-2.0/reg/snps_uvm_reg_bank.svh super . new ( name , parent );
endfunction
// This method is documented in uvm_object
//static string type_name = "";
virtual function string get_type_name ();
static string m_type_name ;
if ( m_type_name == "" ) begin
BUSTYPE t ;
t = BUSTYPE :: type_id :: create ( "t" );
m_type_name = { "snps_uvm_reg_predictor #(" , t . get_type_name (), ")" };
end
return m_type_name ;
endfunction
// Function- write
//
// not a user-level method. Do not call directly. See documentation
完整源码 · SHA256:a95acc66ab44164d548b3782786b407fceb261f9f7c99e45eae7328177a2363f
src/vcs-uvm-ieee-2020-2.0/reg/uvm_reg_model.svh `include "reg/sequences/uvm_reg_mem_built_in_seq.svh"
`include "reg/sequences/uvm_reg_mem_hdl_paths_seq.svh"
`include "reg/snps_uvm_reg_bank.svh"
`endif // UVM_REG_MODEL__SV
完整源码 · SHA256:14112c26926a565dcc1015ad016048c30900829ae7de1621707e404f72c57901
术语解释 · 兼容配置
寄存器 path 类型更名(M07-001)
返回RAL(寄存器模型) · 迁移清单
版本适用范围