- library ieee;
- use ieee.std_logic_1164.all;
- use ieee.numeric_std.all;
- entity key_expansion_tb is
- end key_expansion_tb;
- architecture tb of key_expansion_tb is
- component key_expansion
- port (CLK : in std_logic;
- key_load : in std_logic;
- key : in std_logic_vector (127 downto 0);
- xkey0 : out std_logic_vector (31 downto 0);
- xkey1 : out std_logic_vector (31 downto 0);
- xkey2 : out std_logic_vector (31 downto 0);
- xkey3 : out std_logic_vector (31 downto 0));
- end component;
- -- Input
- signal CLK : std_logic;
- signal key_load : std_logic;
- signal key : std_logic_vector (127 downto 0) := x"10_11_12_13_14_15_16_17_18_19_1a_1b_1c_1d_1e_1f";
- -- Output
- signal xkey0 : std_logic_vector (31 downto 0);
- signal xkey1 : std_logic_vector (31 downto 0);
- signal xkey2 : std_logic_vector (31 downto 0);
- signal xkey3 : std_logic_vector (31 downto 0);
- constant TbPeriod : time := 10 ns; -- EDIT put right period here
- signal TbClock : std_logic := '0';
- begin
- dut : key_expansion
- port map (CLK => CLK,
- key_load => key_load,
- key => key,
- xkey0 => xkey0,
- xkey1 => xkey1,
- xkey2 => xkey2,
- xkey3 => xkey3);
- TbClock <= not TbClock after TbPeriod/2;
- -- EDIT: Check that CLK is really your main clock signal
- CLK <= TbClock;
- stimuli : process
- begin
- key_load <= '0';
- wait for 20 ns;
- key_load <= '1';
- wait for 10 ns;
- key_load <= '0';
- wait for 500 ns;
- --wait;
- report "End of Simulation" severity failure;
- --finish(2);
- end process;
- end tb;
key_expansion_tb.vhd