summaryrefslogtreecommitdiff
path: root/Example/combinational_logic/bin_to_gray
diff options
context:
space:
mode:
authorsaurabhb172019-12-18 15:13:23 +0530
committersaurabhb172019-12-18 15:13:23 +0530
commiteb95026ab9007631eb8e2a1c54dcd38fabcb60ad (patch)
tree8695e410cfe16a3b2e37600cd64b3f0b9a5673e2 /Example/combinational_logic/bin_to_gray
parent04d9c666b4bb19936dfa469f536fb38107e631eb (diff)
downloadnghdl-eb95026ab9007631eb8e2a1c54dcd38fabcb60ad.tar.gz
nghdl-eb95026ab9007631eb8e2a1c54dcd38fabcb60ad.tar.bz2
nghdl-eb95026ab9007631eb8e2a1c54dcd38fabcb60ad.zip
Examples Restructered
Diffstat (limited to 'Example/combinational_logic/bin_to_gray')
-rw-r--r--Example/combinational_logic/bin_to_gray/bin_to_gray.vhdl21
1 files changed, 21 insertions, 0 deletions
diff --git a/Example/combinational_logic/bin_to_gray/bin_to_gray.vhdl b/Example/combinational_logic/bin_to_gray/bin_to_gray.vhdl
new file mode 100644
index 0000000..d6045e8
--- /dev/null
+++ b/Example/combinational_logic/bin_to_gray/bin_to_gray.vhdl
@@ -0,0 +1,21 @@
+LIBRARY ieee;
+USE ieee.std_logic_1164.ALL;
+
+entity bin_to_gray is
+port(
+ bin : in std_logic_vector(3 downto 0);
+ G : out std_logic_vector(3 downto 0)
+ );
+end bin_to_gray;
+
+
+architecture gate_level of bin_to_gray is
+
+begin
+
+G(3) <= bin(3);
+G(2) <= bin(3) xor bin(2);
+G(1) <= bin(2) xor bin(1);
+G(0) <= bin(1) xor bin(0);
+
+end gate_level; \ No newline at end of file