Design of Binary to GRAY Code Converter using CASE Statements (Behavior Modeling Style).
Output Waveform : Binary To GRAY Code Converter |
VHDL Code -
-------------------------------------------------------------------------------
--
-- Title : Binary_to_Gray
-- Design : vhdl_upload 1
-- Author : Naresh Singh Dobal
-- Company : nsd
-- VHDL Tutorials & exercise by Naresh Singh Dobal
-------------------------------------------------------------------------------
--
-- File : Binary to Gray using case statements.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity Binary_to_Gray is
port(
din : in STD_LOGIC_VECTOR(3 downto 0);
dout : out STD_LOGIC_VECTOR(3 downto 0)
);
end Binary_to_Gray;
architecture Binary_to_Gray_arc of Binary_to_Gray is
begin
btog : process (din) is
begin
case din is
when "0000" => dout <= "0000";
when "0001" => dout <= "0001";
when "0010" => dout <= "0011";
when "0011" => dout <= "0010";
when "0100" => dout <= "0110";
when "0101" => dout <= "0111";
when "0110" => dout <= "0101";
when "0111" => dout <= "0100";
when "1000" => dout <= "1100";
when "1001" => dout <= "1101";
when "1010" => dout <= "1111";
when "1011" => dout <= "1110";
when "1100" => dout <= "1010";
when "1101" => dout <= "1011";
when "1110" => dout <= "1001";
when others => dout <= "1000";
end case;
end process btog;
end Binary_to_Gray_arc;
Thank you so much for dis vhdl code
ReplyDelete
ReplyDelete👍👍👍
code was supper....!
ReplyDeleteis there any method to write the code in short and beautiful..