VHDL with-select error expecting "(", or an identifier or unary operator
VHDL with-select error expecting "(", or an identifier or unary operator
我正在用 VHDL 编写一个 2 位 4 输入多路复用器,完全基于一个事实 table。我正在使用 with-select 语句 Code . However I get the following error messages: Error messages on the last 4 lines。我找不到任何语法错误,并且查看 with-select 的其他示例看起来与我的完全一样。
我在想我可能在分配向量值时犯了一个错误,但我找不到错误。
该软件是 Quartus Prime Lite。
代码:
LIBRARY ieee;
use ieee.std_logic_1164.all;
entity tut43mux IS
PORT(
--sw: in Std_Logic_Vector(9 downto 0);
--LEDR: out Std_Logic_Vector(9 downto 0));
sw: in Std_Logic_Vector(0 to 9);
LEDR: out Std_Logic_Vector(0 to 9));
end tut43mux;
architecture behavior of tut43mux is
--signal s,u,v,w,x,t,y,m: Std_Logic_Vector(1 downto 0);
signal s,u,v,w,x,m: Std_Logic_Vector(0 to 1);
begin
LEDR(0)<=m(0);LEDR(1)<=m(1);
LEDR(2)<=sw(2);LEDR(3)<=sw(3);
LEDR(4)<=sw(4);LEDR(5)<=sw(5);
LEDR(6)<=sw(6);LEDR(7)<=sw(7);
LEDR(8)<=sw(8);LEDR(9)<=sw(9);
s(0)<=sw(0);s(1)<=sw(1);
u(0)<=sw(2);u(1)<=sw(3);
v(0)<=sw(4);v(1)<=sw(5);
w(0)<=sw(6);w(1)<=sw(7);
x(0)<=sw(8);x(1)<=sw(9);
with s select m
<= u when "00",
<= v when "01",
<= w when "10",
<= x when "11",
<= "00" when others;
end architecture behavior;
您只需要 <=
用于 with.. select
语句中的第一个赋值。其余的不需要它。
with s select
m <= u when "00",
v when "01",
w when "10",
x when "11",
"00" when others;
我正在用 VHDL 编写一个 2 位 4 输入多路复用器,完全基于一个事实 table。我正在使用 with-select 语句 Code . However I get the following error messages: Error messages on the last 4 lines。我找不到任何语法错误,并且查看 with-select 的其他示例看起来与我的完全一样。 我在想我可能在分配向量值时犯了一个错误,但我找不到错误。 该软件是 Quartus Prime Lite。
代码:
LIBRARY ieee;
use ieee.std_logic_1164.all;
entity tut43mux IS
PORT(
--sw: in Std_Logic_Vector(9 downto 0);
--LEDR: out Std_Logic_Vector(9 downto 0));
sw: in Std_Logic_Vector(0 to 9);
LEDR: out Std_Logic_Vector(0 to 9));
end tut43mux;
architecture behavior of tut43mux is
--signal s,u,v,w,x,t,y,m: Std_Logic_Vector(1 downto 0);
signal s,u,v,w,x,m: Std_Logic_Vector(0 to 1);
begin
LEDR(0)<=m(0);LEDR(1)<=m(1);
LEDR(2)<=sw(2);LEDR(3)<=sw(3);
LEDR(4)<=sw(4);LEDR(5)<=sw(5);
LEDR(6)<=sw(6);LEDR(7)<=sw(7);
LEDR(8)<=sw(8);LEDR(9)<=sw(9);
s(0)<=sw(0);s(1)<=sw(1);
u(0)<=sw(2);u(1)<=sw(3);
v(0)<=sw(4);v(1)<=sw(5);
w(0)<=sw(6);w(1)<=sw(7);
x(0)<=sw(8);x(1)<=sw(9);
with s select m
<= u when "00",
<= v when "01",
<= w when "10",
<= x when "11",
<= "00" when others;
end architecture behavior;
您只需要 <=
用于 with.. select
语句中的第一个赋值。其余的不需要它。
with s select
m <= u when "00",
v when "01",
w when "10",
x when "11",
"00" when others;