Vhdl 如何将信号分配给多路复用器的端口?

Vhdl 如何将信号分配给多路复用器的端口?,vhdl,Vhdl,我试图将多路复用器的输出值分配给信号,但我找不到方法 这是库的代码work entity mux4a1 is port(enable: in std_logic; x: in std_logic_vector(3 downto 0); sel: in std_logic_vector(1 downto 0); y: out std_logic); end mux4a1; architectur

我试图将多路复用器的输出值分配给信号,但我找不到方法

这是库的代码
work

entity mux4a1 is
    port(enable: in  std_logic;
         x:      in  std_logic_vector(3 downto 0);
         sel:    in  std_logic_vector(1 downto 0);
         y:      out std_logic);
    end mux4a1;

architecture funcional of mux4a1 is
begin
    process(enable, x, sel)
    begin
        if enable = '0' then
            y <= '0';
        else
            case sel is
                when "00"   => y <= x(0);
                when "01"   => y <= x(1);
                when "10"   => y <= x(2);
                when others => y <= x(3);
            end case;
        end if;        
    end process;
end funcional;
实体mux4a1是
端口(启用:在std_逻辑中;
x:标准逻辑向量(3到0);
sel:标准逻辑向量(1到0);
y:输出标准(U逻辑);
末端mux4a1;
mux4a1的架构功能是
开始
进程(启用、x、sel)
开始
如果enable='0',则

首先,mux4a1的实例化不在正确的位置。这一部分应该独立存在。然后,在其
端口映射中,您当前只有(e,i,sel)。所以您还没有映射输出,
y
。我想您想要的是将
端口映射更改为(e,I,sel,z(1))。然后z(1)将被分配
mux
的输出
z(1)i,sel=>sel,y=>z(1))
@user1155120我已经设法修复了它,非常感谢!首先,mux4a1的实例化位置不正确。这一部分应该独立存在。然后,在其
端口映射中,您当前只有(e,i,sel)。所以您还没有映射输出,
y
。我想您想要的是将
端口映射更改为(e,I,sel,z(1))。然后z(1)将被分配
mux
的输出
z(1)i,sel=>sel,y=>z(1))
@user1155120我已经设法修复了它,非常感谢!
entity practica1 is  
port (x: in    std_logic_vector(3 downto 0);        
      z: out    std_logic_vector(3 downto 0)); 
end practica1;

architecture apartadoE of practica1 is
  signal e: std_logic:= '1';
  signal i: std_logic_vector (3 downto 0);
  signal sel: std_logic_vector (1 downto 0);
begin
  z(0) <= '0';
  z(2) <= '0';
  z(3) <= '0';
  i(0) <= x(3) and x(1);
  i(1) <= (not x(1)) and (not x(3));
  i(2) <= x(1);
  i(3) <= not x(1);
  -- here is the problem, i don´t how to assign it.
  z(1) <= mux: entity work.mux4a1 port map (e, i, sel);
end apartadoE;