How do I use unsigned literals in assignments?
Take a look at this example:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
entity myTest is
Port ( clk : in STD_LOGIC );
end myTest;
architecture Behavioral of myTest is
signal testSignal : unsigned (31 downto 0);
begin
process (clk) is
begin
if (rising_edge (clk)) then
-- this compiles fine:
testSignal <= testSignal + 1;
-- this causes an error. Why?
testSignal <= 1;
end if;
end process;
end Behavioral;
The line:
testSignal <= 1;
results in the following error message on Xilinx ISE:
Line 22. Type of testSignal is incompatible with type of 1.
Can anyone explain why and how to fix this?