Saturday, 20 July 2013

Design of GRAY to BINARY Code Converter using IF-ELSE Statements (VHDL Code).






Design of GRAY to BINARY Code Converter using IF-ELSE 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     : nsdobal@gmail.com   
-- VHDL Tutorials & classes by Naresh Singh Dobal
--
-------------------------------------------------------------------------------
--
-- File        : Gray to Binary using if else 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

     gtob : process (din) is
    begin
        if (din="0000") then
            dout <= "0000";
        elsif (din="0001") then
            dout <= "0001";
        elsif (din="0010") then
            dout <=    "0011";
        elsif (din="0011") then
            dout <=    "0010";
        elsif (din="0100") then
            dout <=    "0111";
        elsif (din="0101") then
            dout <= "0110";
        elsif (din="0110") then
            dout <=    "0100";
        elsif (din="0111") then
            dout <=    "0101";
        elsif (din="1000") then
            dout <=    "1111";
        elsif (din="1001") then
            dout <=    "1110";
        elsif (din="1010") then
            dout <= "1100";
        elsif (din="1011") then
            dout <=    "1101";
        elsif (din="1100") then
            dout <=    "1000";
        elsif (din="1101") then
            dout <=    "1001";
        elsif (din="1110") then
            dout <=    "1011";
        else
            dout <=    "1010";
        end if;
    end process gtob;

end gray_to_binary_arc;

0 comments :

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes