mux4.vhd

来自「一个用VHDL编写的在CPLD上实现模拟交通灯的程序源代码」· VHDL 代码 · 共 26 行

VHD
26
字号
library  ieee;
use  ieee.std_logic_1164.all;
use  ieee.std_logic_unsigned.all;

entity  mux4  is
port(ina,inb  : in  std_logic_vector(7 downto 0);
     sel      : in  std_logic_vector(2 downto 0);
     dout     : out std_logic_vector(3 downto 0) 
     );
end  mux4;

architecture behave of  mux4 is
begin
    process(ina,inb,sel)
    begin
      case   sel  is
      when   "000"     =>  dout<=ina(7 downto 4);
      when   "001"     =>  dout<=ina(3 downto 0);
      when   "110"     =>  dout<=inb(7 downto 4);
      when   "111"     =>  dout<=inb(3 downto 0);
      when  others     =>  null;
      end  case;
    end  process;
end  behave;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?