Files
IEEE754Adder/ComparatorTest.vhd

78 lines
1.7 KiB
VHDL
Raw Normal View History

2019-08-27 11:50:27 +02:00
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY ComparatorTest IS
END ComparatorTest;
ARCHITECTURE behavior OF ComparatorTest IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Comparator
PORT(
2019-08-30 19:24:54 +02:00
X_MANT : IN std_logic_vector(7 downto 0);
Y_MANT : IN std_logic_vector(7 downto 0);
NEED_SWAP : OUT std_logic
2019-08-27 11:50:27 +02:00
);
END COMPONENT;
--Inputs
2019-08-30 19:24:54 +02:00
signal X_MANT : std_logic_vector(7 downto 0) := (others => '0');
signal Y_MANT : std_logic_vector(7 downto 0) := (others => '0');
2019-08-27 11:50:27 +02:00
--Outputs
2019-08-30 19:24:54 +02:00
signal NEED_SWAP : std_logic;
2019-08-27 11:50:27 +02:00
signal clock: std_logic;
constant clock_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Comparator PORT MAP (
2019-08-30 19:24:54 +02:00
X_MANT => X_MANT,
Y_MANT => Y_MANT,
NEED_SWAP => NEED_SWAP
2019-08-27 11:50:27 +02:00
);
-- Clock process definitions
clock_process :process
begin
clock <= '0';
wait for clock_period/2;
clock <= '1';
wait for clock_period/2;
end process;
2019-08-30 19:24:54 +02:00
test_proc: process
begin
X_MANT <= "00000000";
Y_MANT <= "00000000";
wait for clock_period;
X_MANT <= "01011010";
Y_MANT <= "01100000";
wait for clock_period;
X_MANT <= "00111100";
Y_MANT <= "10000100";
wait for clock_period;
X_MANT <= "10000000";
Y_MANT <= "01111111";
wait for clock_period;
X_MANT <= "01110100";
Y_MANT <= "01101000";
wait for clock_period;
X_MANT <= "01111111";
Y_MANT <= "10000000";
wait for clock_period;
X_MANT <= "10101010";
Y_MANT <= "01010101";
wait for clock_period;
X_MANT <= "01010101";
Y_MANT <= "10101010";
wait for clock_period;
end process;
2019-08-27 11:50:27 +02:00
END;