是否有可能实现具有多个控制信号的多路复用器?例如,我想这样做:
with (sig1 & sig2) select
output <= A when "00",
B when "01",
C when "10",
D when "11",
'0' when others; 我知道我可以将它们分配给一个新的信号并使用它,但如果可能的话,这是我想要避免的事情。
发布于 2011-04-11 20:16:57
您需要在编译器上启用VHDL2008模式才能使其工作。
另一种选择(也是2008年):
muxing: process (sig1, sig2) is
begin -- process muxing
case sig1 & sig2 is
when "00" => output <= '1';
when "01" => output <= '0';
when "10" => output <= '0';
when "11" => output <= '1';
when others => output <= '0';
end case;
end process muxing;如果您的编译器上没有VHDL-2008模式,它将失败并抱怨
Array type case expression must be of a locally static subtype.或者类似的。
如果您的编译器不能与VHDL2008兼容,那么您必须创建一个可以用来包围sig1 & sig2的类型来显式地告诉编译器发生了什么,从而解决这个问题:
subtype twobits is bit_vector(0 to 1);然后:
with twobits'(sig1 & sig2) select
output <= '1' when "00",
-- etc.或者:
case twobits'(sig1 & sig2) is
when "00" => -- etc.发布于 2011-04-10 12:59:50
看看这个,也许它能帮到你
entity MUX is
port ( a, i0, i1 : in bit;
o : out bit );
end MUX;
architecture behave of MUX is
begin
process ( a, i0, i1 ) begin
if a = '1' then
o <= i1;
else
o <= i0;
end if;
end process;
end behave;https://stackoverflow.com/questions/5609728
复制相似问题