-- Z:\CAMURATI\ESERCITAZIONE_2 -- VHDL Test Bench created by -- HDL Bencher 6.1i -- Fri Mar 16 10:09:34 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_riconoscitore IS END tester_riconoscitore; ARCHITECTURE testbench_arch OF tester_riconoscitore 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 riconoscitore_1011 PORT ( Clear : In std_logic; Clock : In std_logic; Enable : In std_logic; Reset : In std_logic; X : In std_logic; Y : Out std_logic ); END COMPONENT; SIGNAL Clear : std_logic; SIGNAL Clock : std_logic; SIGNAL Enable : std_logic; SIGNAL Reset : std_logic; SIGNAL X : std_logic; SIGNAL Y : std_logic; BEGIN UUT : riconoscitore_1011 PORT MAP ( Clear => Clear, Clock => Clock, Enable => Enable, Reset => Reset, X => X, Y => Y ); PROCESS -- clock process for Clock, BEGIN CLOCK_LOOP : LOOP Clock <= transport '0'; WAIT FOR 10 us; Clock <= transport '1'; WAIT FOR 10 us; WAIT FOR 40 us; Clock <= transport '0'; WAIT FOR 40 us; END LOOP CLOCK_LOOP; END PROCESS; PROCESS -- Process for Clock VARIABLE TX_OUT : LINE; VARIABLE TX_ERROR : INTEGER := 0; PROCEDURE CHECK_Y( next_Y : 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 (Y /= next_Y) THEN STD.TEXTIO.write(TX_LOC,string'("Error at time=")); STD.TEXTIO.write(TX_LOC, TX_TIME); STD.TEXTIO.write(TX_LOC,string'("us Y=")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, Y); STD.TEXTIO.write(TX_LOC, string'(", Expected = ")); IEEE.STD_LOGIC_TEXTIO.write(TX_LOC, next_Y); 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 -- -------------------- Clear <= transport '0'; Enable <= transport '1'; Reset <= transport '0'; X <= transport '1'; -- -------------------- WAIT FOR 20 us; -- Time=20 us CHECK_Y('0',20); -- -------------------- WAIT FOR 80 us; -- Time=100 us X <= transport '0'; -- -------------------- WAIT FOR 20 us; -- Time=120 us CHECK_Y('0',120); -- -------------------- WAIT FOR 80 us; -- Time=200 us X <= transport '1'; -- -------------------- WAIT FOR 20 us; -- Time=220 us CHECK_Y('0',220); -- -------------------- WAIT FOR 100 us; -- Time=320 us CHECK_Y('0',320); -- -------------------- WAIT FOR 80 us; -- Time=400 us X <= transport '0'; -- -------------------- WAIT FOR 20 us; -- Time=420 us CHECK_Y('0',420); -- -------------------- WAIT FOR 80 us; -- Time=500 us X <= transport '1'; -- -------------------- WAIT FOR 20 us; -- Time=520 us CHECK_Y('0',520); -- -------------------- WAIT FOR 100 us; -- Time=620 us CHECK_Y('0',620); -- -------------------- WAIT FOR 100 us; -- Time=720 us CHECK_Y('0',720); -- -------------------- WAIT FOR 80 us; -- Time=800 us X <= transport '0'; -- -------------------- WAIT FOR 20 us; -- Time=820 us CHECK_Y('0',820); -- -------------------- WAIT FOR 80 us; -- Time=900 us X <= transport '1'; -- -------------------- WAIT FOR 20 us; -- Time=920 us CHECK_Y('0',920); -- -------------------- WAIT FOR 80 us; -- Time=1000 us X <= transport '0'; -- -------------------- WAIT FOR 20 us; -- Time=1020 us CHECK_Y('0',1020); -- -------------------- WAIT FOR 80 us; -- Time=1100 us X <= transport '1'; -- -------------------- WAIT FOR 20 us; -- Time=1120 us CHECK_Y('0',1120); -- -------------------- WAIT FOR 100 us; -- Time=1220 us CHECK_Y('0',1220); -- -------------------- WAIT FOR 80 us; -- Time=1300 us Enable <= transport '0'; -- -------------------- WAIT FOR 20 us; -- Time=1320 us CHECK_Y('0',1320); -- -------------------- WAIT FOR 90 us; -- Time=1410 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 riconoscitore_1011_cfg OF tester_riconoscitore IS FOR testbench_arch END FOR; END riconoscitore_1011_cfg;