hi all; i want to detect if the lsb is odd or even for integer data . how can i do it in vhdl code
You can use the "mod" operator. http://www.csee.umbc.edu/portal/help/VHDL/operator.html
1 | if (myinteger mod 2 = 1) then |
2 | -- odd
|
3 | else
|
4 | -- even
|
5 | end if; |
Alternatively you can first convert to unsigned type and then check the lowest bit.
1 | myunsigned <= to_unsigned(myinteger, length); |
2 | if (myunsigned(0) = '1') then |
3 | -- odd
|
4 | else
|
5 | -- even
|
6 | end if; |
:
Edited by User