library ieee; use ieee.std_logic_1164.all; use work.vhdl_verification.all; entity tb_datacompare is generic (INVALID_DATA : datagen_invalid_data := unknown; STIMULI_FILE : string := "../test/datagen_test.txt"); end tb_datacompare; architecture behavior of tb_datacompare is -- Make DATA_WIDTH a testbench-level constant so we can use it in signal declarations constant DATA_WIDTH : integer := 1; --Inputs signal clk : std_logic := '0'; signal data : std_logic_vector(DATA_WIDTH-1 downto 0); signal valid : std_logic; signal endsim : std_logic; -- Clock period definitions constant clk_period : time := 10 ns; begin -- Instantiate the Unit Under Test (UUT) uut : datacompare generic map ( SIMULATION_LABEL => "datacompare", VERBOSE => false, GOLD_OUTPUT_FILE => STIMULI_FILE, GOLD_OUTPUT_NIBBLES => 2, DATA_WIDTH => DATA_WIDTH ) port map ( clk => clk, data => data, valid => valid, endsim => endsim ); datagen_inst : datagen generic map ( VERBOSE => false, STIMULI_FILE => STIMULI_FILE, STIMULI_NIBBLES => 2, DATA_WIDTH => DATA_WIDTH, THROUGHPUT => 2, INVALID_DATA => INVALID_DATA, CYCLES_AFTER_LAST_VECTOR => 7 ) port map ( clk => clk, can_write => '1', data => data, valid => valid, endsim => endsim ); -- To stop the simulation without a failure message, -- stop the clock when endsim = '1', clk_process : process begin if(endsim /= '1') then clk <= '0'; wait for clk_period/2; clk <= '1'; wait for clk_period/2; else wait; end if; end process; -- Stimulus process stim_proc : process begin -- hold reset state for 100 ns. wait for 100 ns; wait for clk_period*10; -- insert stimulus here wait; end process; end;