Forum Discussion
Altera_Forum
Honored Contributor
14 years agoUnsigned number math
Greetings, Apparently when using unsigned numbers if you are performing a math operation using a statement like if shortwait = (others => '0') then next line of code.... is ...
Altera_Forum
Honored Contributor
14 years agoBecause the tool doesn't know how large an unsigned (others => '0') should be. You could do something like this, if you were inclined.
constant ZERO : unsigned(shortwait'range) := (others => '0');
if shortwait = ZERO then
The second equals in question is defined in numeric_std as specifically operating on two operands, one an unsigned and the other an integer, and starts off by defining an unsigned variable of the same length as the operand, mapping the integer into it using TO_UNSIGNED, and then performing the equality comparison.