提问人:P2000 提问时间:11/13/2023 最后编辑:P2000 更新时间:11/14/2023 访问量:47
(System)Verilog 中不应发生的 case 语句默认值中的适当断言 [已关闭]
Suitable assertion in (System)Verilog default of case statement that should never occur [closed]
问:
什么样的断言适合处理 SystemVerilog case 语句的默认情况?
以下是我想到的一些方法:
default:
$display("this should never occur")
// because all anticipated cases are supposed to be caught above
// and the default catch hints at an illegal or omitted case
output = safe_value;
endcase
或者,代替 $display()
$info("this should never occur")
或者,在 SystemVerilog 中
assert (false) $warning("this should never occur")
类似的情况发生在优先级编码的嵌套中,如果...else,预计不会发生最终的 else,但在模拟期间发出警告是明智的。
我希望使用语言语句,而不是任务或“定义”,它们不应该造成 linting 或合成问题。
断言技术最好仍应允许安全的默认情况,即使预计不会发生默认情况。
答:
2赞
dave_59
11/13/2023
#1
SystemVerilog 具有 a 和 a,如果没有选择并且没有选择其他案例项,则会为您创建断言。priority case
unique case
default
请注意,这适用于顺序逻辑或组合逻辑,没有可能触发错误错误的故障。
否则,综合工具会忽略断言。
评论
0赞
P2000
11/14/2023
关于故障的好点,我确实不得不求助于“断言最终”。如果使用唯一而不是默认,我更关心不确定的电路输出(硅或LUT)。您如何建议将“唯一”与安全电路默认输出一起使用,这也会导致仿真警告。(我也不认为“优先级”可以解决这个问题?
0赞
dave_59
11/15/2023
可能需要另一个问题,因为我不知道您的设计要求是什么
评论