-- Z:\CAMURATI\TESI -- VHDL Test Bench created by -- HDL Bencher 6.1i -- Fri Mar 23 12:10:51 2007 -- -- 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; USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_TEXTIO.ALL; USE STD.TEXTIO.ALL; ENTITY tester_gen IS END tester_gen; ARCHITECTURE testbench_arch OF tester_gen 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 display_enable_gen PORT ( clk : In std_logic; clr : In std_logic; unofisso : In std_logic; clkmezzi : Out std_logic; d0 : Out std_logic; d1 : Out std_logic; d2 : Out std_logic; d3 : Out std_logic ); END COMPONENT; SIGNAL clk : std_logic; SIGNAL clr : std_logic; SIGNAL unofisso : std_logic; SIGNAL clkmezzi : std_logic; SIGNAL d0 : std_logic; SIGNAL d1 : std_logic; SIGNAL d2 : std_logic; SIGNAL d3 : std_logic; BEGIN UUT : display_enable_gen PORT MAP ( clk => clk, clr => clr, unofisso => unofisso, clkmezzi => clkmezzi, d0 => d0, d1 => d1, d2 => d2, d3 => d3 ); PROCESS -- clock process for clk, BEGIN CLOCK_LOOP : LOOP clk <= transport '0'; WAIT FOR 10 us; clk <= transport '1'; WAIT FOR 10 us; WAIT FOR 40 us; clk <= transport '0'; WAIT FOR 40 us; END LOOP CLOCK_LOOP; END PROCESS; PROCESS -- Process for clk VARIABLE TX_OUT : LINE; VARIABLE TX_ERROR : INTEGER := 0; PROCEDURE CHECK_d0( next_d0 : std_logic; 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 (d0 /= next_d0) THEN STD.TEXTIO.write(TX_LOC,string'("Error at time=")); STD.TEXTIO.write(TX_LOC, TX_TIME); STD.TEXTIO.write(TX_LOC,string'("us d0=")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, d0); STD.TEXTIO.write(TX_LOC, string'(", Expected = ")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_d0); 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; PROCEDURE CHECK_d1( next_d1 : std_logic; 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 (d1 /= next_d1) THEN STD.TEXTIO.write(TX_LOC,string'("Error at time=")); STD.TEXTIO.write(TX_LOC, TX_TIME); STD.TEXTIO.write(TX_LOC,string'("us d1=")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, d1); STD.TEXTIO.write(TX_LOC, string'(", Expected = ")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_d1); 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; PROCEDURE CHECK_d2( next_d2 : std_logic; 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 (d2 /= next_d2) THEN STD.TEXTIO.write(TX_LOC,string'("Error at time=")); STD.TEXTIO.write(TX_LOC, TX_TIME); STD.TEXTIO.write(TX_LOC,string'("us d2=")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, d2); STD.TEXTIO.write(TX_LOC, string'(", Expected = ")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_d2); 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; PROCEDURE CHECK_d3( next_d3 : std_logic; 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 (d3 /= next_d3) THEN STD.TEXTIO.write(TX_LOC,string'("Error at time=")); STD.TEXTIO.write(TX_LOC, TX_TIME); STD.TEXTIO.write(TX_LOC,string'("us d3=")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, d3); STD.TEXTIO.write(TX_LOC, string'(", Expected = ")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_d3); 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; PROCEDURE CHECK_clkmezzi( next_clkmezzi : std_logic; 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 (clkmezzi /= next_clkmezzi) THEN STD.TEXTIO.write(TX_LOC,string'("Error at time=")); STD.TEXTIO.write(TX_LOC, TX_TIME); STD.TEXTIO.write(TX_LOC,string'("us clkmezzi=")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, clkmezzi); STD.TEXTIO.write(TX_LOC, string'(", Expected = ")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_clkmezzi); 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 -- -------------------- clr <= transport '1'; unofisso <= transport '0'; -- -------------------- WAIT FOR 20 us; -- Time=20 us CHECK_d0('0',20); CHECK_d1('0',20); CHECK_d2('0',20); CHECK_d3('0',20); -- -------------------- WAIT FOR 80 us; -- Time=100 us clr <= transport '0'; unofisso <= transport '1'; -- -------------------- WAIT FOR 100 us; -- Time=200 us clr <= transport '0'; unofisso <= transport '1'; -- -------------------- WAIT FOR 100 us; -- Time=300 us unofisso <= transport '1'; -- -------------------- WAIT FOR 110 us; -- Time=410 us -- -------------------- 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 display_enable_gen_cfg OF tester_gen IS FOR testbench_arch END FOR; END display_enable_gen_cfg;