【发布时间】:2014-09-15 08:46:57
【问题描述】:
(在我的验证环境中,我们使用vr_ad 包。)。我尝试实现下一个:
当数据写入其中一个寄存器 (timer_load) 时,另一个寄存器 (timer_bgload) 应该使用相同的数据进行更新。
我在 UVM 用户指南中找到了下一个 示例:
// Attaching the target register file to the broadcasted register
extend ex_c_bus_env {
post_generate() is also {
xcore_regs.vr_ad_rx_data.attach(xbus_regs);
};
};
// Implement the broadcast:
// When writing to register VR_AD_RX_DATA in XCORE vr_ad_reg_file,
// propagate the value to the VR_AD_XBUS_DATA register in ACTIVE_XBUS.
extend ACTIVE_XBUS vr_ad_reg_file {
indirect_access( direction : vr_ad_rw_t, ad_item : vr_ad_base) is {
if ad_item is a VR_AD_RX_DATA vr_ad_reg (d) {
vr_ad_xbus_data.write_reg_val(d.get_cur_value());
};
};
};
我的注册:
reg_def TIMER_LOAD_0 TIMER 20'h00010 {
reg_fld timer_load : uint (bits : 32) : RW : 0xffff;
};
reg_def TIMER_BGLOAD_0 TIMER 20'h00014 {
reg_fld timer_bgload : uint (bits : 32) : RW : 0xffff;
};
reg_def TIMER_BGLOAD_1 TIMER 20'h00028 {
reg_fld timer_bgload : uint (bits : 32) : RW : 0xffff;
//another reg with the same instance name
};
我的代码,用于在将数据写入tiemr_load 后更新timer_bgload 寄存器:
extend TIMER vr_ad_reg_file {
indirect_access( direction : vr_ad_rw_t, ad_item : vr_ad_base) is {
if ad_item is a TIMER_LOAD_0 vr_ad_reg (d) {
timer_bgload.write_reg_val(d.get_cur_value());
};
};
};
unit timer_env_u like any_env {
post_generate() is also {
timer_regs.timer_load_0.attach(timer_regs.timer_bgload_0.timer_bgload);
};
};
我得到一个编译错误:
*** Error: No such variable 'timer_bgload'
at line 17 in @timer_reg_db
timer_bgload.write_reg_val(d.get_cur_value());
非常感谢任何帮助。
【问题讨论】:
-
timer_bgload仅存在于TIMER_BGLOAD_0和TIMER_BGLOAD_1(它们不是同一个字段!)您无法从TIMER vr_ad_reg_file访问它们