有没有办法为 SystemVerilog 原语添加断言或仅在包装原语的模块(单元)中添加断言?简单地添加断言无法编译
primitive mux (q, d0, d1, s);
output q;
input s, d0, d1;
table
// d0 d1 s : q
0 ? 0 : 0 ;
1 ? 0 : 1 ;
? 0 1 : 0 ;
? 1 1 : 1 ;
0 0 x : 0 ;
1 1 x : 1 ;
endtable
//assert(s != x) else $error("s has value x"); - add this assertion
endprimitive
最佳答案
用户定义原语 (UDP) 中允许的唯一构造是表。您需要将 UDP 包装在模块中才能添加其他内容。
关于system-verilog - 原语的 SystemVerilog 断言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56096689/