Design of GRAY to Binary Code Converter using CASE Statements (Behavior Modeling Style)-
Output Waveform : Gray to Binary Code Converter |
VHDL Code -
-------------------------------------------------------------------------------
--
-- Title : Gray_to_Binary
-- 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 Gray_to_Binary is
port(
din : in STD_LOGIC_VECTOR(3 downto 0);
dout : out STD_LOGIC_VECTOR(3 downto 0)
);
end Gray_to_Binary;
architecture Gray_to_Binary_arc of Gray_to_Binary 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 <= "0111";
when "0101" => dout <= "0110";
when "0110" => dout <= "0100";
when "0111" => dout <= "0101";
when "1000" => dout <= "1111";
when "1001" => dout <= "1110";
when "1010" => dout <= "1100";
when "1011" => dout <= "1101";
when "1100" => dout <= "1000";
when "1101" => dout <= "1001";
when "1110" => dout <= "1011";
when others => dout <= "1010";
end case;
end process btog;
end Gray_to_Binary_arc;
No comments:
Post a Comment