Friday, 1 September 2017

4 Bit Comparator VHDL Code

Library IEEE;
USE IEEE.std_logic_1164.all;
USE IEEE.std_logic_arith.all;
Entity Comparator is
port(a,b : in std_logic_vector(3 downto 0);
         eq,lr,gr : Out std_logic);
End Comparator;
Architecture Behavioral of comparator is
begin
process (a,b)
begin
eq<= '0' ; gr<= '0' ; lr<= '0';
if (a=b) then eq<= '1' ;
end if;
if (a>b) then gr<= '1' ;
end if;
if (a<b) then lr<= '1' ;
end if;
end process;
end behavioral;

The Respective Block diagram TTL Schematic and RTL Schematic are given below
VHDL Code
Block Diagram
TTL Schematic
RTL schematic

No comments:

Post a Comment