uaveiro-leci/1ano/2semestre/lsd/pratica05/CmpN_Demo/CmpN.vhd

24 lines
681 B
VHDL
Raw Normal View History

2023-03-21 22:41:33 +00:00
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.NUMERIC_STD.all;
entity CmpN is
generic (N : positive := 4);
port
(
input0 : in std_logic_vector((N-1) downto 0);
input1 : in std_logic_vector((N-1) downto 0);
equal : out std_logic;
notEqual : out std_logic;
ltSigned : out std_logic;
ltUnsigned : out std_logic
);
end CmpN;
architecture Behavioral of CmpN is
begin
equal <= '1' when (input0 = input1) else '0';
notEqual <= '1' when (input0 /= input1) else '0';
ltSigned <= '1' when (signed(input0) < signed(input1)) else '0';
ltUnsigned <= '1' when (unsigned(input0) < unsigned(input1)) else '0';
end Behavioral;