原始的SystemVerilog断言

时间:2019-05-12 06:22:04

标签: system-verilog system-verilog-assertions

有没有一种方法可以为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

1 个答案:

答案 0 :(得分:5)

用户定义原语(UDP)内唯一允许的结构是表。您需要将UDP包装在模块中以添加其他内容。

相关问题