带4个2x1多路复用器和1个4x1的多路复用器8x1

时间:2019-06-09 14:49:33

标签: vhdl

代码显示为使用2x1和4x1的多路复用器8x1。我尝试将此代码放置为显示错误,指出组件“ mux8x1”没有默认绑定。 (端口“ I”不在实体上),我不明白我在代码中的错误在哪里,我一遍又一遍地检查,如果有人可以帮助我,我再也没有发现错误,我将不胜感激

-- Code your design here
library IEEE;
use IEEE.std_logic_1164.all;

--declaration for 8x1
entity mux8x1 is   
    port( I : in std_logic_vector(7 downto 0); -- input that need 8x1
           s: in std_logic_vector(2 downto 0); --is the enable
           Y: out std_logic -- output of 8x1 is the output
    );
end mux8x1;

architecture behavioral of mux8x1 is
    signal f0,f1,f2,f3 : std_logic;
begin
    process(I,S)
    begin
        if s(0)='0' then 
            f0<=I(7);
            f1<=I(5);
            f2<=I(3);
            f3<=I(1);
        else 
            f0<=I(6);
            f1<=I(4);
            f2<=I(2);
            f3<=I(0);
        end if;

        if (s(1)='0' and s(0)='0')then
            Y<=f0;
            if (s(1)='0' and s(0)='1')then
                Y<=f1;
                if (s(1)='1' and s(0)='0')then
                    Y<=f2;
                    if (s(1)='1' and s(0)='1')then
                        Y<=f3;
                    end if;
                end if;
            end if;
        end if;
    end process;
end behavioral;

1 个答案:

答案 0 :(得分:0)

ARCHITECTURE behavior OF mux8x1 IS 
   COMPONENT mux8x1 is

测试台必须具有除测试实体/组件之外的其他名称,仅此而已!
将您的测试台重命名为mux8x1_tb
证明您应该在此处放置测试平台代码以帮助我们...