Writing Efficient Testbenches £ⅫL|NX ariable gog real: gooo-numoex, errordeti: boolean variable vector time: time; file vector file: text is in values. txt' n ndfile(vector file)loop readline(vector file, l)i read(l, r, good = good number)i next when not good number vector time if(now wait for vector time now end if read(l, space) go assert good val rePort bad tenthsoutvalue ait for 10 n f (tmptenthsout / tenthsout) then assert errordet report vector mismatch"i nd loop process check results library xilinxCorelib CONFIGURATION stopwatch cfg of testbench Is for testbench arch FOR ALL stopwatch use configuration work. cfg tenths END FOR END FOR th cfe The following vector file is used with the testbench above. It contains expected simulation Vector file containing expected results 01111111110 3401111111110 4001111111101 4601111111011 5201111110111 5801111101111 7001110111111 760110111111 8201011111111 8800111111111 94011111111 10001111111110 10601111111101 11201111111011 11801111110111 13001111011111 13601110111111 14201101111111 14801011111111 XAPP199(v10)June11,2001 www.xilinx.com 1-800-255-7778Writing Efficient Testbenches XAPP199 (v1.0) June 11, 2001 www.xilinx.com 13 1-800-255-7778 R variable good_val, good_number, errordet: boolean; variable r : real; variable vector_time: time; variable space: character; file vector_file: text is in "values.txt"; begin while not endfile(vector_file) loop readline(vector_file, l); read(l, r, good => good_number); next when not good_number; vector_time := r * 1 ns; if (now < vector_time) then wait for vector_time - now; end if; read(l, space); read(l, tmptenthsout, good_val); assert good_val REPORT "bad tenthsoutvalue"; wait for 10 ns; if (tmptenthsout /= tenthsout) then assert errordet REPORT "vector mismatch"; end if; end loop; wait; end process check_results; end testbench_arch; library XilinxCoreLib; CONFIGURATION stopwatch_cfg OF testbench IS FOR testbench_arch FOR ALL : stopwatch use configuration work.cfg_tenths; END FOR; END FOR; END stopwatch_cfg; The following vector file is used with the testbench above. It contains expected simulation values. -- Vector file containing expected results 0 1111111110 340 1111111110 400 1111111101 460 1111111011 520 1111110111 580 1111101111 640 1111011111 700 1110111111 760 1101111111 820 1011111111 880 0111111111 940 1111111110 1000 1111111110 1060 1111111101 1120 1111111011 1180 1111110111 1240 1111101111 1300 1111011111 1360 1110111111 1420 1101111111 1480 1011111111