2019-09-08 23:26:50 +02:00
|
|
|
LIBRARY ieee;
|
|
|
|
|
USE ieee.std_logic_1164.ALL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ENTITY IEEE754AdderTest IS
|
|
|
|
|
END IEEE754AdderTest;
|
|
|
|
|
|
|
|
|
|
ARCHITECTURE behavior OF IEEE754AdderTest IS
|
|
|
|
|
|
|
|
|
|
-- Component Declaration for the Unit Under Test (UUT)
|
|
|
|
|
|
|
|
|
|
COMPONENT IEEE754Adder
|
|
|
|
|
PORT(
|
|
|
|
|
X : IN std_logic_vector(31 downto 0);
|
|
|
|
|
Y : IN std_logic_vector(31 downto 0);
|
|
|
|
|
RESET : IN std_logic;
|
|
|
|
|
CLK : IN std_logic;
|
|
|
|
|
RESULT : OUT std_logic_vector(31 downto 0)
|
|
|
|
|
);
|
|
|
|
|
END COMPONENT;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--Inputs
|
|
|
|
|
signal X : std_logic_vector(31 downto 0) := (others => '0');
|
|
|
|
|
signal Y : std_logic_vector(31 downto 0) := (others => '0');
|
|
|
|
|
signal RESET : std_logic := '0';
|
|
|
|
|
signal CLK : std_logic := '0';
|
|
|
|
|
|
|
|
|
|
--Outputs
|
|
|
|
|
signal RESULT : std_logic_vector(31 downto 0);
|
|
|
|
|
|
|
|
|
|
-- Clock period definitions
|
2019-09-10 20:54:06 +02:00
|
|
|
constant CLK_period : time := 50 ns; -- MESSA A CASO. VALUTARE IL PERIODO GIUSTO
|
2019-09-08 23:26:50 +02:00
|
|
|
|
|
|
|
|
BEGIN
|
|
|
|
|
|
|
|
|
|
-- Instantiate the Unit Under Test (UUT)
|
|
|
|
|
uut: IEEE754Adder PORT MAP (
|
|
|
|
|
X => X,
|
|
|
|
|
Y => Y,
|
|
|
|
|
RESET => RESET,
|
|
|
|
|
CLK => CLK,
|
|
|
|
|
RESULT => RESULT
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- Clock process definitions
|
|
|
|
|
CLK_process :process
|
|
|
|
|
begin
|
|
|
|
|
CLK <= '0';
|
|
|
|
|
wait for CLK_period/2;
|
|
|
|
|
CLK <= '1';
|
|
|
|
|
wait for CLK_period/2;
|
|
|
|
|
end process;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Stimulus process
|
|
|
|
|
stim_proc: process
|
|
|
|
|
begin
|
|
|
|
|
RESET <= '1';
|
2019-09-10 20:54:06 +02:00
|
|
|
wait for 2*CLK_period;
|
2019-09-08 23:26:50 +02:00
|
|
|
RESET <= '0';
|
|
|
|
|
|
|
|
|
|
-- TODO: FINIRE TEST
|
|
|
|
|
wait for CLK_period;
|
|
|
|
|
X <= "00000000000000000000000000000000";
|
|
|
|
|
Y <= "00000000000000000000000000000000";
|
|
|
|
|
wait for CLK_period;
|
|
|
|
|
X <= "00001000000000000000111000000000";
|
|
|
|
|
Y <= "00000010000001111000000000000000";
|
|
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01000000010110011001100110011010";
|
|
|
|
|
Y <= "01100110010001110000110110000001";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01111111100000000000000000000000";
|
|
|
|
|
Y <= "11111111100000000000000000000000";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01000000100000000000000000000000";
|
|
|
|
|
Y <= "01111111100000000000000000000000";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "00000000100100000000000000000000";
|
|
|
|
|
Y <= "10000000011111111111111111111111";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "11001100000111100111101111110100";
|
|
|
|
|
Y <= "11001111111110111111011100110110";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01111111011111111111111111111111";
|
|
|
|
|
Y <= "01111110011111111111111111111111";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "11111111111111111111111111111111";
|
|
|
|
|
Y <= "00111111100000000000000000000000";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "00110110100111000010111100011010";
|
|
|
|
|
Y <= "11111111111111111111000001111111";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
|
|
|
|
X <= "00000000000000000000000000000000";
|
2019-09-10 20:54:06 +02:00
|
|
|
Y <= "10000000000000000000000000000000";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01001100111010110111100110100011";
|
|
|
|
|
Y <= "11001100111010110111100110100011";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01000010001010000000000000000000";
|
|
|
|
|
Y <= "01000001101110000000000000000000";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait for CLK_period;
|
2019-09-10 20:54:06 +02:00
|
|
|
X <= "01101000111011011000111011010101";
|
|
|
|
|
Y <= "00011001001011011001100001111101";
|
2019-09-08 23:26:50 +02:00
|
|
|
wait;
|
|
|
|
|
end process;
|
|
|
|
|
|
|
|
|
|
END;
|