4 bit Magnitude Comparator

Requirements:

  • WARP
  • Active HDL
  • Cool Runner and Fitter CPLD Kit

 

Program for Magnitude Comparator
library IEEE;
use IEEE.std_logic_1164.all;
entity mag_comp is
port (
a: in STD_LOGIC_VECTOR (3 downto 0);
b: in STD_LOGIC_VECTOR (3 downto 0);
eq: out STD_LOGIC;
agr: out STD_LOGIC;
bgr: out STD_LOGIC
);
end mag_comp;
architecture mag_comp of mag_comp is
begin
process(a,b)
begin
eq <= '0';
agr <= '0';
bgr <= '0';
if (a=b) then
eq <= '1';
elsif(a>b) then
agr <= '1';
elsif(b>a) then
bgr <= '1';
end if;
end process;
end mag_comp;

Symbol

image

Waveform

image

Comments

Popular Posts