0
如何在赋值中使用无符号文字?VHDL中的无符号文字
看看这个例子:
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;
行:
testSignal <= 1;
导致在赛灵思ISE以下错误信息:
Line 22. Type of testSignal is incompatible with type of 1.
谁能解释为什么以及如何解决这个问题?
谢谢。现在有道理。 – 2014-09-04 19:12:13
除了fru1tbat的回答之外,还可以使用像这样的二进制或十六进制值的直接向量分配,例如'testSignal <= x“00023AD5”;或者将每个位设置为零,如'testSignal <= (others =>'0');你应该添加一个初始化值到你的计数器的信号声明:) – Paebbels 2014-09-05 08:15:14