【发布时间】:2015-11-08 17:58:17
【问题描述】:
entity hex_kp is
Port ( row : out STD_LOGIC_VECTOR (3 downto 0);
coloumn : in STD_LOGIC_VECTOR (3 downto 0);
sevenseg : out STD_LOGIC_VECTOR (7 downto 0);
ca : out STD_LOGIC_VECTOR (3 downto 0));
end hex_kp;
architecture Behavioral of hex_kp is
begin
ca <="0111";
if(row = "0111") then
if(coloumn = "0111") then sevenseg <= "00000110" ;
elsif (coloumn = "1011") then sevenseg <= "01011011" ;
elsif (coloumn = "1101") then sevenseg <= "01001111" ;
elsif (coloumn = "1110") then sevenseg <= "01110001" ;
end if;
end if;
这是我用于 Basys2 的 4x4 键盘扫描仪的 vhdl 代码的一部分。它给 "if(row = "0111") then" 语句一个错误。我找不到请帮忙的原因。
【问题讨论】:
-
读取“OUT”端口无效,除非您指定 VHDL-2008。
-
并且您不(应该)被允许根据 -2008 中的输出值对其他信号的值做出决定。这是一项旨在支持验证构造的功能。
-
信号
row的值在哪里赋值? -
您是否将 Digilent 键盘用作 Pmod 设备?有浮动输入的可能性……您应该在 FPGA 的 IOB 中启用上拉。
-
我找到了 4×4 键盘的原始 Digilent 示例代码。您必须开车
column并阅读row!这可以防止您使用浮动输入。