Warm tip: This article is reproduced from serverfault.com, please click

其他-在VHDL中如何检查UNSIGNED(8 downto 0)是未初始化的还是未定义的?

(其他 - in VHDL how to check if UNSIGNED(8 downto 0) is UNINITIALIZED or UNDEFINED?)

发布于 2020-11-29 21:36:41

我无法检查Unsigned(8 downto 0)数据类型是“ XXXXXXXX”还是“ UUUUUUUU”

在进程内部,将其作为变量甚至检查输入均无法使其正常工作。

有什么解决办法吗?

Questioner
Xero
Viewed
0
Tricky 2020-11-30 06:19:55

这是因为numeric_std程序包使"="函数过载,因此任何“ UUUU”或“ XXXX”值都将导致结果始终为假。请记住,numeric_std是算术运算,因此非数字值应导致此行为。

为了获得有效的比较,请先将无符号的转换为std_logic_vector:

if std_logic_vector(some_unsiged) = "XXXXXXXXX" then