【发布时间】:2017-05-03 06:14:50
【问题描述】:
我正在使用 Altera Max V 和 Quartus 学习 VHDL 来做一些示例,但在使用“With Select when”语句时遇到了麻烦。我有一个简单的 2-4 解码器,如下所示:
library ieee;
use ieee.std_logic_1164.all;
entity lesson9 is
port(
x: in std_logic_vector(1 downto 0);
en: in std_logic;
y: out std_logic_vector(3 downto 0)
);
end lesson9;
architecture rtl of lesson9 is
signal outputBuff: std_logic_vector(3 downto 0);
begin
decoder2to4: process(x)
begin
with x select
outputBuff <= "0001" when "00",
"0010" when "01",
"0100" when "10",
"1000" when "11";
end process decoder2to4;
y <= outputBuff;
end rtl;
我收到了错误消息:
靠近文本“with”;期望“end”,或“(”,或标识符(“with”是保留关键字),pr是顺序语句
我试图检查我的代码但找不到问题?
【问题讨论】:
-
您使用的是哪个版本的 Quartus? With-select it VHDL-2008 结构,旧工具版本不支持。此外,如果使用更新的 Quartus 版本,请确保为文件启用 VHDL-2008。
-
with ... select不是 VHDL-2008 构造,但在顺序代码(例如进程)中允许with ... select是新的。如果您的工具支持这些功能,您需要删除使with ... select并发的进程或启用使用 2008 功能进行编译。