Search This Blog

Tuesday, 6 August 2013

VHDL Code for 1x4 DeMultiplexer

Function of DeMultiplexer is opposite of Multiplexer. It has one input and several output based on control signal. Find out Test Bench here.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
library ieee;
use ieee.std_logic_1164.all;

entity dmux1x4_seq is
  
  port (
    i : in  std_logic;                      -- input lines
    s : in  std_logic_vector(1 downto 0);   -- select lines
    op : out std_logic_vector(3 downto 0));

end dmux1x4_seq;

architecture beh of dmux1x4_seq is
  
begin  -- beh

u1 : process (i,s)
 variable temp : std_logic_vector(0 to 3);
  begin  -- process u1
    case s is
      when "00" => temp := "000"&i;
      when "01" => temp := "00"&i&'0';
      when "10" => temp := '0'&i&"00";
      when "11" => temp := i&"000";
      when others => null;
    end case;
    op <= temp;
  end process u1;
end beh;

No comments:

Post a Comment