我们如何正确地从覆盖组中排除 {'1} 值?
How do we correctly exclude an {'1} value from a cover group?
我实现了以下封面组:
covergroup my_covergroup_cg (input string name);
enable_reg_cp : coverpoint enabled_reg[PARAM1-1:0] {
illegal_bins no_enable = {0};
}
feature_active_reg_cp : coverpoint feature_active_reg_mask[PARAM2-1:0] { // Interested in covering a PARAM2-width chunk of a 32-bit feature_active_reg
illegal_bins all_features_active = {'1}; // We must not activate all features (1 bit = 1 feature active)
}
my_covergroup_cross : cross enable_reg_cp , feature_active_reg_cp {
illegal_bins il0 = (binsof (enable_reg_cp) intersect {0});
illegal_bins il1 = (binsof (feature_active_reg_cp) intersect {'1});
}
endgroup : my_covergroup_cg
执行后,我的十字的 "il1" 非法 bin 被命中,值为“0x1”
feature_active_reg_mask[PARAM2-1:0] - 这是完全合法的并且与 {'1} 不匹配(相当于 ..111111:全部)。
在 "binsof" 范围内如何处理这些 {'1} 是否存在特定问题?
这很可能是工具问题。根据 1800-20167 LRM 中的第 19.5.7 节值解析,所有 bin 表达式都在 coverpoint 类型的上下文中进行评估。您可以使用 [$:$]
作为代表最大可能值的替代项。
但是... cross
中的 illegal_bins
是不必要的,因为只有包含的覆盖点的箱子才会被交叉。 AND...你定义了一组明确的箱子,没有隐式定义的箱子,所以你应该写成
covergroup my_covergroup_cg (input string name);
enable_reg_cp : coverpoint enabled_reg[PARAM1-1:0] {
bins enable[] = {[1:$]}; // will be split into N bins according to auto_bins_max
}
feature_active_reg_cp : coverpoint feature_active_reg_mask[PARAM2-1:0] { // Interested in covering a PARAM2-width chunk of a 32-bit feature_active_reg
bins some_features_active = {[0:$]};
ignore_bins all_features_active = {[$:$]}; // We must not activate all features (1 bit = 1 feature active)
}
my_covergroup_cross : cross enable_reg_cp , feature_active_reg_cp;
endgroup : my_covergroup_cg
在 2nd 覆盖点中,$ 值与两个 bin 规范重叠,但 ignore_bins
覆盖了它。
只是为了分享我的知识共享解决方法:
我决定继续使用 localparam
语义。看起来问题与解释 {'1}
的工具有关。
我做了以下事情:
localparam all_ones = {PARAM2{1'b1}};
covergroup my_covergroup_cg (input string name);
enable_reg_c .... // rest of code
然后我将别名传递到我的 illegal_bins
illegal_bins il1 = (binsof (feature_active_reg_cp) intersect {all_ones});
干杯,
我实现了以下封面组:
covergroup my_covergroup_cg (input string name);
enable_reg_cp : coverpoint enabled_reg[PARAM1-1:0] {
illegal_bins no_enable = {0};
}
feature_active_reg_cp : coverpoint feature_active_reg_mask[PARAM2-1:0] { // Interested in covering a PARAM2-width chunk of a 32-bit feature_active_reg
illegal_bins all_features_active = {'1}; // We must not activate all features (1 bit = 1 feature active)
}
my_covergroup_cross : cross enable_reg_cp , feature_active_reg_cp {
illegal_bins il0 = (binsof (enable_reg_cp) intersect {0});
illegal_bins il1 = (binsof (feature_active_reg_cp) intersect {'1});
}
endgroup : my_covergroup_cg
执行后,我的十字的 "il1" 非法 bin 被命中,值为“0x1” feature_active_reg_mask[PARAM2-1:0] - 这是完全合法的并且与 {'1} 不匹配(相当于 ..111111:全部)。
在 "binsof" 范围内如何处理这些 {'1} 是否存在特定问题?
这很可能是工具问题。根据 1800-20167 LRM 中的第 19.5.7 节值解析,所有 bin 表达式都在 coverpoint 类型的上下文中进行评估。您可以使用 [$:$]
作为代表最大可能值的替代项。
但是... cross
中的 illegal_bins
是不必要的,因为只有包含的覆盖点的箱子才会被交叉。 AND...你定义了一组明确的箱子,没有隐式定义的箱子,所以你应该写成
covergroup my_covergroup_cg (input string name);
enable_reg_cp : coverpoint enabled_reg[PARAM1-1:0] {
bins enable[] = {[1:$]}; // will be split into N bins according to auto_bins_max
}
feature_active_reg_cp : coverpoint feature_active_reg_mask[PARAM2-1:0] { // Interested in covering a PARAM2-width chunk of a 32-bit feature_active_reg
bins some_features_active = {[0:$]};
ignore_bins all_features_active = {[$:$]}; // We must not activate all features (1 bit = 1 feature active)
}
my_covergroup_cross : cross enable_reg_cp , feature_active_reg_cp;
endgroup : my_covergroup_cg
在 2nd 覆盖点中,$ 值与两个 bin 规范重叠,但 ignore_bins
覆盖了它。
只是为了分享我的知识共享解决方法:
我决定继续使用 localparam
语义。看起来问题与解释 {'1}
的工具有关。
我做了以下事情:
localparam all_ones = {PARAM2{1'b1}};
covergroup my_covergroup_cg (input string name);
enable_reg_c .... // rest of code
然后我将别名传递到我的 illegal_bins
illegal_bins il1 = (binsof (feature_active_reg_cp) intersect {all_ones});
干杯,