summaryrefslogtreecommitdiff
path: root/Example/mux-demux/demux.vhdl
diff options
context:
space:
mode:
authorrahul2019-10-22 11:27:47 +0530
committerrahul2019-10-22 11:27:47 +0530
commit76241122c16990ee003df89391c85ee478ea0dca (patch)
tree8055abb97cb298fa4dde4e11a3759ff2ea7358f0 /Example/mux-demux/demux.vhdl
parent0b2a123b6ea6c3d09fae9fb054849432373794cf (diff)
downloadnghdl-76241122c16990ee003df89391c85ee478ea0dca.tar.gz
nghdl-76241122c16990ee003df89391c85ee478ea0dca.tar.bz2
nghdl-76241122c16990ee003df89391c85ee478ea0dca.zip
Examples
Diffstat (limited to 'Example/mux-demux/demux.vhdl')
-rw-r--r--Example/mux-demux/demux.vhdl32
1 files changed, 32 insertions, 0 deletions
diff --git a/Example/mux-demux/demux.vhdl b/Example/mux-demux/demux.vhdl
new file mode 100644
index 0000000..e73c196
--- /dev/null
+++ b/Example/mux-demux/demux.vhdl
@@ -0,0 +1,32 @@
+library IEEE;
+use IEEE.STD_LOGIC_1164.all;
+
+entity demux is
+ port(
+
+ F : in STD_LOGIC_vector(0 downto 0);
+ S0: in STD_LOGIC_vector(0 downto 0);
+ S1: in STD_LOGIC_vector(0 downto 0);
+ A: out STD_LOGIC_vector(0 downto 0);
+ B: out STD_LOGIC_vector(0 downto 0);
+ C: out STD_LOGIC_vector(0 downto 0);
+ D: out STD_LOGIC_vector(0 downto 0)
+ );
+end demux;
+
+architecture bhv of demux is
+begin
+process (F,S0,S1) is
+begin
+ if (S0 ="0" and S1 = "0") then
+ A <= F;
+ elsif (S0 ="1" and S1 = "0") then
+ B <= F;
+ elsif (S0 ="0" and S1 = "1") then
+ C <= F;
+ else
+ D <= F;
+ end if;
+
+end process;
+end bhv;