在进程中使用if / then语句时出现VHDL语法错误

时间:2017-01-23 23:52:48

标签: vhdl

我收到第16行的消息:附近"'":语法错误。我不确定我的错误是什么。任何帮助将不胜感激!

library IEEE;
use IEEE.std_logic_1164.all;

entity SystemI is
    port (ABCD : in std_logic_vector(3 downto 0);
          F    : out std_logic);
end entity;

architecture SystemI_arch of SystemI is

begin

    process (ABCD)
        begin

            if (ABCD='0001') then
                F <= '1';
            elsif (ABCD='0011') then
                F <= '1';
            elsif (ABCD='1001') then
                F <= '1';
            elsif (ABCD='1011') then
                F <= '1';
            else
                F <= '0';
            end if;

    end process;

end architecture;

1 个答案:

答案 0 :(得分:0)

您在比较中使用单引号('),它们用于单个位/字符文字。对于向量,您需要使用"

将所有if / elsif语句的所有比较更改为(ABCD="0001")

编辑:

此外,您可以使用等效的选定信号分配替换整个过程:

with ABCD select 
    F <= '1' when "0001" | "0011" | "1001" | "1011", '0' when others;