覆盖约束

Overriding constraints

我在覆盖测试台中的约束时遇到了一些问题。 在我的序列中,我正在执行以下操作:

    `uvm_do_with(req, {trans_kind == WRITE ;
                       address == 40'hc0_0000_0000;
                       mask_mismatch_error == 1;
                       bus_error_type == SCB_BUS_ERR_NONE;
                       }) //this line sends the transaction

在我的序列项中:

    constraint c_mask_mismatch_error_disable_map8 { (cfg_h.is_map8 == 1) -> (mask_mismatch_error == 0); }

日志文件发出此警告:

ncsim: *W,SVRNDF (source location/line): The randomize method call failed. The unique id of the failed randomize call is 86.

Observed simulation time : 79492842 PS + 14

ncsim: *W,RNDOCS: These constraints contribute to the set of conflicting constraints: }) //this line sends the transaction ( (mask_mismatch_error == 0); } (source location/line)

ncsim: *W,RNDOCS: These variables contribute to the set of conflicting constraints:

state variables: cfg_h.is_map8 (1) [source location/line]

rand variables: mask_mismatch_error [source location/line]

我不明白为什么不能进行这种覆盖。我该怎么做才能覆盖序列中的约束?

调用randomizewith子句仅用于添加约束;它不能覆盖它们。覆盖约束的正确 OOP 方法是扩展事务 class 并在扩展的 class 中声明具有相同名称的约束。

您的另一个选择是使用

关闭约束
req.c_mask_mismatch_error_disable_map8.constraint_mode(0);

如果这样做,您将无法再使用 `umm_do_with 宏,许多人无论如何都建议不要使用它。