-- C:\MATLAB6P5\WORK\ISNIAMY\XPID_DATA2
-- VHDL Test Bench created by
-- HDL Bencher 6.1i
-- Mon May 23 12:41:09 2005
-- 
-- Notes:
-- 1) This testbench has been automatically generated from
--   your Test Bench Waveform
-- 2) To use this as a user modifiable testbench do the following:
--   - Save it as a file with a .vhd extension (i.e. File->Save As...)
--   - Add it to your project as a testbench source (i.e. Project->Add Source...)
-- 

LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
LIBRARY WORK;
USE WORK.CONV_PKG.ALL;
USE WORK.CLOCK_PKG.ALL;
USE IEEE.STD_LOGIC_TEXTIO.ALL;
USE STD.TEXTIO.ALL;

ENTITY test1_tbw IS
END test1_tbw;

ARCHITECTURE testbench_arch OF test1_tbw IS
-- If you get a compiler error on the following line,
-- from the menu do Options->Configuration select VHDL 87
FILE RESULTS: TEXT OPEN WRITE_MODE IS "results.txt";
	COMPONENT pid_sysgen_clk_wrapper
		PORT (
			ce : In  std_logic;
			clk : In  std_logic;
			gateway_in1 : In  std_logic_vector (15 DOWNTO 0);
			gateway_out : Out  std_logic_vector (23 DOWNTO 0)
		);
	END COMPONENT;

	SIGNAL ce : std_logic;
	SIGNAL clk : std_logic;
	SIGNAL gateway_in1 : std_logic_vector (15 DOWNTO 0);
	SIGNAL gateway_out : std_logic_vector (23 DOWNTO 0);

BEGIN
	UUT : pid_sysgen_clk_wrapper
	PORT MAP (
		ce => ce,
		clk => clk,
		gateway_in1 => gateway_in1,
		gateway_out => gateway_out
	);

	PROCESS -- clock process for clk,
	BEGIN
		CLOCK_LOOP : LOOP
		clk <= transport '0';
		WAIT FOR 1 ms;
		clk <= transport '1';
		WAIT FOR 1 ms;
		WAIT FOR 4 ms;
		clk <= transport '0';
		WAIT FOR 4 ms;
		END LOOP CLOCK_LOOP;
	END PROCESS;

	PROCESS   -- Process for clk
		VARIABLE TX_OUT : LINE;
		VARIABLE TX_ERROR : INTEGER := 0;

		PROCEDURE CHECK_gateway_out(
			next_gateway_out : std_logic_vector (23 DOWNTO 0);
			TX_TIME : INTEGER
		) IS
			VARIABLE TX_STR : String(1 to 4096);
			VARIABLE TX_LOC : LINE;
		BEGIN
			-- If compiler error ("/=" is ambiguous) occurs in the next line of code
			-- change compiler settings to use explicit declarations only
			IF (gateway_out /= next_gateway_out) THEN 
				STD.TEXTIO.write(TX_LOC,string'("Error at time="));
				STD.TEXTIO.write(TX_LOC, TX_TIME);
				STD.TEXTIO.write(TX_LOC,string'("ms gateway_out="));
				IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, gateway_out);
				STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
				IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_gateway_out);
				STD.TEXTIO.write(TX_LOC, string'(" "));
				TX_STR(TX_LOC.all'range) := TX_LOC.all;
				STD.TEXTIO.writeline(results, TX_LOC);
				STD.TEXTIO.Deallocate(TX_LOC);
				ASSERT (FALSE) REPORT TX_STR SEVERITY ERROR;
				TX_ERROR := TX_ERROR + 1;
			END IF;
		END;

		BEGIN
		-- --------------------
		ce <= transport '1';
		gateway_in1 <= transport std_logic_vector'("0000000100000000"); --100
		-- --------------------
		WAIT FOR 2 ms; -- Time=2 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",2); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=10 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000001"); --101
		-- --------------------
		WAIT FOR 2 ms; -- Time=12 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",12); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=20 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000010"); --102
		-- --------------------
		WAIT FOR 2 ms; -- Time=22 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",22); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=30 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000011"); --103
		-- --------------------
		WAIT FOR 2 ms; -- Time=32 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",32); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=40 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000100"); --104
		-- --------------------
		WAIT FOR 2 ms; -- Time=42 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",42); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=50 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000101"); --105
		-- --------------------
		WAIT FOR 2 ms; -- Time=52 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",52); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=60 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000110"); --106
		-- --------------------
		WAIT FOR 2 ms; -- Time=62 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",62); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=70 ms
		gateway_in1 <= transport std_logic_vector'("0000000100000111"); --107
		-- --------------------
		WAIT FOR 2 ms; -- Time=72 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",72); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=80 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001000"); --108
		-- --------------------
		WAIT FOR 2 ms; -- Time=82 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",82); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=90 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001001"); --109
		-- --------------------
		WAIT FOR 2 ms; -- Time=92 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",92); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=100 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001010"); --10A
		-- --------------------
		WAIT FOR 2 ms; -- Time=102 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",102); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=110 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001011"); --10B
		-- --------------------
		WAIT FOR 2 ms; -- Time=112 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",112); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=120 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001100"); --10C
		-- --------------------
		WAIT FOR 2 ms; -- Time=122 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",122); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=130 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001101"); --10D
		-- --------------------
		WAIT FOR 2 ms; -- Time=132 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",132); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=140 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001110"); --10E
		-- --------------------
		WAIT FOR 2 ms; -- Time=142 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",142); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=150 ms
		gateway_in1 <= transport std_logic_vector'("0000000100001111"); --10F
		-- --------------------
		WAIT FOR 2 ms; -- Time=152 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",152); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=160 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010000"); --110
		-- --------------------
		WAIT FOR 2 ms; -- Time=162 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",162); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=170 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010001"); --111
		-- --------------------
		WAIT FOR 2 ms; -- Time=172 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",172); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=180 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010010"); --112
		-- --------------------
		WAIT FOR 2 ms; -- Time=182 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",182); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=190 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010011"); --113
		-- --------------------
		WAIT FOR 2 ms; -- Time=192 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",192); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=200 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010100"); --114
		-- --------------------
		WAIT FOR 2 ms; -- Time=202 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",202); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=210 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010101"); --115
		-- --------------------
		WAIT FOR 2 ms; -- Time=212 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",212); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=220 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010110"); --116
		-- --------------------
		WAIT FOR 2 ms; -- Time=222 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",222); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=230 ms
		gateway_in1 <= transport std_logic_vector'("0000000100010111"); --117
		-- --------------------
		WAIT FOR 2 ms; -- Time=232 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",232); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=240 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011000"); --118
		-- --------------------
		WAIT FOR 2 ms; -- Time=242 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",242); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=250 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011001"); --119
		-- --------------------
		WAIT FOR 2 ms; -- Time=252 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",252); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=260 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011010"); --11A
		-- --------------------
		WAIT FOR 2 ms; -- Time=262 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",262); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=270 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011011"); --11B
		-- --------------------
		WAIT FOR 2 ms; -- Time=272 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",272); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=280 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011100"); --11C
		-- --------------------
		WAIT FOR 2 ms; -- Time=282 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",282); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=290 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011101"); --11D
		-- --------------------
		WAIT FOR 2 ms; -- Time=292 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",292); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=300 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011110"); --11E
		-- --------------------
		WAIT FOR 2 ms; -- Time=302 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",302); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=310 ms
		gateway_in1 <= transport std_logic_vector'("0000000100011111"); --11F
		-- --------------------
		WAIT FOR 2 ms; -- Time=312 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",312); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=320 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100000"); --120
		-- --------------------
		WAIT FOR 2 ms; -- Time=322 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",322); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=330 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100001"); --121
		-- --------------------
		WAIT FOR 2 ms; -- Time=332 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",332); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=340 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100010"); --122
		-- --------------------
		WAIT FOR 2 ms; -- Time=342 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",342); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=350 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100011"); --123
		-- --------------------
		WAIT FOR 2 ms; -- Time=352 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",352); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=360 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100100"); --124
		-- --------------------
		WAIT FOR 2 ms; -- Time=362 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",362); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=370 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100101"); --125
		-- --------------------
		WAIT FOR 2 ms; -- Time=372 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",372); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=380 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100110"); --126
		-- --------------------
		WAIT FOR 2 ms; -- Time=382 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",382); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=390 ms
		gateway_in1 <= transport std_logic_vector'("0000000100100111"); --127
		-- --------------------
		WAIT FOR 2 ms; -- Time=392 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",392); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=400 ms
		gateway_in1 <= transport std_logic_vector'("0000000100101000"); --128
		-- --------------------
		WAIT FOR 2 ms; -- Time=402 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",402); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=410 ms
		gateway_in1 <= transport std_logic_vector'("0000000100101001"); --129
		-- --------------------
		WAIT FOR 2 ms; -- Time=412 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",412); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=420 ms
		gateway_in1 <= transport std_logic_vector'("0000000100101010"); --12A
		-- --------------------
		WAIT FOR 2 ms; -- Time=422 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",422); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=430 ms
		ce <= transport '1';
		gateway_in1 <= transport std_logic_vector'("0000000100101011"); --12B
		-- --------------------
		WAIT FOR 2 ms; -- Time=432 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",432); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=440 ms
		gateway_in1 <= transport std_logic_vector'("0000000100101100"); --12C
		-- --------------------
		WAIT FOR 2 ms; -- Time=442 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",442); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=450 ms
		gateway_in1 <= transport std_logic_vector'("0000000100101101"); --12D
		-- --------------------
		WAIT FOR 2 ms; -- Time=452 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",452); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=460 ms
		gateway_in1 <= transport std_logic_vector'("0000000100101110"); --12E
		-- --------------------
		WAIT FOR 2 ms; -- Time=462 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",462); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=470 ms
		ce <= transport '1';
		gateway_in1 <= transport std_logic_vector'("0000000100101111"); --12F
		-- --------------------
		WAIT FOR 2 ms; -- Time=472 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",472); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=480 ms
		ce <= transport '1';
		gateway_in1 <= transport std_logic_vector'("0000000100110000"); --130
		-- --------------------
		WAIT FOR 2 ms; -- Time=482 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",482); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=490 ms
		gateway_in1 <= transport std_logic_vector'("0000000100110001"); --131
		-- --------------------
		WAIT FOR 2 ms; -- Time=492 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",492); --U
		-- --------------------
		WAIT FOR 8 ms; -- Time=500 ms
		ce <= transport '0';
		-- --------------------
		WAIT FOR 2 ms; -- Time=502 ms
		CHECK_gateway_out("UUUUUUUUUUUUUUUUUUUUUUUU",502); --U
		-- --------------------
		WAIT FOR 9 ms; -- Time=511 ms
		-- --------------------

		IF (TX_ERROR = 0) THEN 
			STD.TEXTIO.write(TX_OUT,string'("No errors or warnings"));
			STD.TEXTIO.writeline(results, TX_OUT);
			ASSERT (FALSE) REPORT
				"Simulation successful (not a failure).  No problems detected. "
				SEVERITY FAILURE;
		ELSE
			STD.TEXTIO.write(TX_OUT, TX_ERROR);
			STD.TEXTIO.write(TX_OUT, string'(
				" errors found in simulation"));
			STD.TEXTIO.writeline(results, TX_OUT);
			ASSERT (FALSE) REPORT
				"Errors found during simulation"
				SEVERITY FAILURE;
		END IF;
	END PROCESS;
END testbench_arch;

CONFIGURATION pid_sysgen_clk_wrapper_cfg OF test1_tbw IS
	FOR testbench_arch
	END FOR;
END pid_sysgen_clk_wrapper_cfg;
