题解 | #四选一多路器#

https://www.nowcoder.com/practice/cba4617e1ef64e9ea52cbb400a0725a3


VHDL选手报道。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity MUX4_1 is
  Port (d1 : in std_logic_vector(1 downto 0);
        d2 : in std_logic_vector(1 downto 0);
        d3 : in std_logic_vector(1 downto 0);
        d0 : in std_logic_vector(1 downto 0);
        sel : in std_logic_vector(1 downto 0);
        mux_out : out std_logic_vector(1 downto 0));
end MUX4_1;

architecture Behavioral of MUX4_1 is

begin
process(sel)
begin
     case sel is
            when "00" => mux_out <= d3;
            when "01" => mux_out <= d2;
            when "10" => mux_out <= d1;
            when "11" => mux_out <= d0;
            when others => mux_out <= d3;
         end case;
end process;

end Behavioral;

全部评论

相关推荐

点赞 评论 收藏
分享
海螺很能干:每次看到这种简历都没工作我就觉得离谱
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务