Search This Blog

Sunday, July 14, 2013

Binary To Gray Code Converter using Logical Expressions (VHDL Code).

Binary To Gray Code Converter using Logical Gates (Data Flow Modelling Style)-


Output Waveform : Binary To Gray Code Converter


Program-


-------------------------------------------------------------------------------
--
-- Title       : binary_to_gray
-- Design      : vhdl_test
-- Author      : Naresh Singh Dobal
-- Company     : nsd
--
-------------------------------------------------------------------------------


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

    dout(3) <= din(3);
    dout(2) <= din(3) xor din(2);
    dout(1) <= din(2) xor din(1);
    dout(0) <= din(1) xor din(0);

end binary_to_gray_arc;

2 comments: