版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
constraint con{
delay dist {0:/10};
}
上述写法可能导致constraint很难解,不要用上述写法。
2. 对与求和的约束的写法(防止和溢出)
bd_len_q.sum with(int'(item)) == 20
3. 数组元素不重复
class A;
rand bit [31:0] arr[];
constraint arr_size { arr.size() inside {[10:15]}; }
constraint arr_uniq { unique {arr}; }
endclass