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

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

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

I am not able to check if an Unsigned(8 downto 0) data type is "XXXXXXXX" or even "UUUUUUUU"

Inside a process as a variable or even checking an input im not able to get it to work.

Any solution to it?

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

This is because the numeric_std package overloads the "=" function so that any "UUUU" or "XXXX" values will cause the result to always be false. Rememeber that numeric_std is arithmetic, so non numeric values should cause this behaviour.

To get a valid comparison, convert the unsigned first to std_logic_vector:

if std_logic_vector(some_unsiged) = "XXXXXXXXX" then