summaryrefslogtreecommitdiff
path: root/Example/bin_to_gray
diff options
context:
space:
mode:
authorfossee2019-09-03 11:07:32 +0530
committerfossee2019-09-03 11:07:32 +0530
commitf8d3dbc8c0f1c59a0546998cb9365e5c291dca07 (patch)
tree28f0d2fe7f00f1ee854e411b82689eae861a9c52 /Example/bin_to_gray
parent491e95ad13764229c3e27dfb625c5dbef9ddec59 (diff)
downloadnghdl-f8d3dbc8c0f1c59a0546998cb9365e5c291dca07.tar.gz
nghdl-f8d3dbc8c0f1c59a0546998cb9365e5c291dca07.tar.bz2
nghdl-f8d3dbc8c0f1c59a0546998cb9365e5c291dca07.zip
added examples and modified server
Diffstat (limited to 'Example/bin_to_gray')
-rw-r--r--Example/bin_to_gray/bin_to_gray.vhdl21
1 files changed, 21 insertions, 0 deletions
diff --git a/Example/bin_to_gray/bin_to_gray.vhdl b/Example/bin_to_gray/bin_to_gray.vhdl
new file mode 100644
index 0000000..542f7ec
--- /dev/null
+++ b/Example/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); -- binary input
+ G : out std_logic_vector(3 downto 0) -- gray code output
+ );
+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