library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity Vmodecpe is port ( M: in STD_LOGIC_VECTOR (1 downto 0); -- mode A, B: in STD_LOGIC_VECTOR (31 downto 0); -- unsigned integers EQ, GT: out STD_LOGIC ); -- comparison results end Vmodecpe; architecture Vmodecpe_arch of Vmodecpe is begin process (M, A, B) variable EQ30, GT30: STD_LOGIC; -- 30-bit comparison results begin if A(31 downto 2) = B(31 downto 2) then EQ30 := '1'; else EQ30 := '0'; end if; if A(31 downto 2) > B(31 downto 2) then GT30 := '1'; else GT30 := '0'; end if; case M is when "00" => if EQ30='1' and A(1 downto 0) = B(1 downto 0) then EQ <= '1'; else EQ <= '0'; end if; if GT30='1' or (EQ30='1' and A(1 downto 0) > B(1 downto 0)) then GT <= '1'; else GT <= '0'; end if; when "01" => if EQ30='1' and A(1) = B(1) then EQ <= '1'; else EQ <= '0'; end if; if GT30='1' or (EQ30='1' and A(1) > B(1)) then GT <= '1'; else GT <= '0'; end if; when "10" => EQ <= EQ30; GT <= GT30; when others => EQ <= '0'; GT <= '0'; end case; end process; end Vmodecpe_arch;