Binary To Gray Code Converter using Logical Gates (Data Flow Modelling Style)-
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;
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;
TEST BENCH Code ?
ReplyDeleteSAD maybe
ReplyDelete