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

VHDL syntax error when using if/then statement in a process

我收到第 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;

您在比较中使用了单引号 ('),它用于单个 bit/character 文字。对于向量,您需要使用 ".

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

编辑:

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

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