📄 ch_tw.vhw
字号:
-- E:\VHDL\WAITPAST\DIG_CLK
-- VHDL Test Bench created by
-- HDL Bencher 6.1i
-- Wed Apr 18 11:01:14 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.STD_LOGIC_ARITH.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;USE IEEE.STD_LOGIC_TEXTIO.ALL;
USE STD.TEXTIO.ALL;
ENTITY ch_tw IS
END ch_tw;
ARCHITECTURE testbench_arch OF ch_tw 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 ch_bcd_integer
PORT (
h1 : In std_logic_vector (3 DOWNTO 0);
h2 : In std_logic_vector (3 DOWNTO 0);
f1 : In std_logic_vector (3 DOWNTO 0);
f2 : In std_logic_vector (3 DOWNTO 0);
m1 : In std_logic_vector (3 DOWNTO 0);
m2 : In std_logic_vector (3 DOWNTO 0);
d1 : Out INTEGER RANGE 0 TO 9;
d2 : Out INTEGER RANGE 0 TO 9;
d3 : Out INTEGER RANGE 0 TO 9;
d4 : Out INTEGER RANGE 0 TO 9;
d5 : Out INTEGER RANGE 0 TO 9;
d6 : Out INTEGER RANGE 0 TO 9
);
END COMPONENT;
SIGNAL h1 : std_logic_vector (3 DOWNTO 0);
SIGNAL h2 : std_logic_vector (3 DOWNTO 0);
SIGNAL f1 : std_logic_vector (3 DOWNTO 0);
SIGNAL f2 : std_logic_vector (3 DOWNTO 0);
SIGNAL m1 : std_logic_vector (3 DOWNTO 0);
SIGNAL m2 : std_logic_vector (3 DOWNTO 0);
SIGNAL d1 : INTEGER RANGE 0 TO 9;
SIGNAL d2 : INTEGER RANGE 0 TO 9;
SIGNAL d3 : INTEGER RANGE 0 TO 9;
SIGNAL d4 : INTEGER RANGE 0 TO 9;
SIGNAL d5 : INTEGER RANGE 0 TO 9;
SIGNAL d6 : INTEGER RANGE 0 TO 9;
BEGIN
UUT : ch_bcd_integer
PORT MAP (
h1 => h1,
h2 => h2,
f1 => f1,
f2 => f2,
m1 => m1,
m2 => m2,
d1 => d1,
d2 => d2,
d3 => d3,
d4 => d4,
d5 => d5,
d6 => d6
);
PROCESS
VARIABLE TX_OUT : LINE;
VARIABLE TX_ERROR : INTEGER := 0;
PROCEDURE CHECK_d1(
next_d1 : INTEGER;
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'("ns d1="));
STD.TEXTIO.write(TX_LOC, d1);
STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
STD.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 : INTEGER;
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'("ns d2="));
STD.TEXTIO.write(TX_LOC, d2);
STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
STD.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 : INTEGER;
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'("ns d3="));
STD.TEXTIO.write(TX_LOC, d3);
STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
STD.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_d4(
next_d4 : INTEGER;
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 (d4 /= next_d4) THEN
STD.TEXTIO.write(TX_LOC,string'("Error at time="));
STD.TEXTIO.write(TX_LOC, TX_TIME);
STD.TEXTIO.write(TX_LOC,string'("ns d4="));
STD.TEXTIO.write(TX_LOC, d4);
STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
STD.TEXTIO.write(TX_LOC, next_d4);
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_d5(
next_d5 : INTEGER;
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 (d5 /= next_d5) THEN
STD.TEXTIO.write(TX_LOC,string'("Error at time="));
STD.TEXTIO.write(TX_LOC, TX_TIME);
STD.TEXTIO.write(TX_LOC,string'("ns d5="));
STD.TEXTIO.write(TX_LOC, d5);
STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
STD.TEXTIO.write(TX_LOC, next_d5);
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_d6(
next_d6 : INTEGER;
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 (d6 /= next_d6) THEN
STD.TEXTIO.write(TX_LOC,string'("Error at time="));
STD.TEXTIO.write(TX_LOC, TX_TIME);
STD.TEXTIO.write(TX_LOC,string'("ns d6="));
STD.TEXTIO.write(TX_LOC, d6);
STD.TEXTIO.write(TX_LOC, string'(", Expected = "));
STD.TEXTIO.write(TX_LOC, next_d6);
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
-- --------------------
h1 <= transport std_logic_vector'("0000"); --0
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0000"); --0
f2 <= transport std_logic_vector'("0100"); --4
m1 <= transport std_logic_vector'("0101"); --5
m2 <= transport std_logic_vector'("0000"); --0
-- --------------------
WAIT FOR 100 ns; -- Time=100 ns
h1 <= transport std_logic_vector'("0001"); --1
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0011"); --3
f2 <= transport std_logic_vector'("0100"); --4
m1 <= transport std_logic_vector'("0101"); --5
m2 <= transport std_logic_vector'("0110"); --6
-- --------------------
WAIT FOR 100 ns; -- Time=200 ns
h1 <= transport std_logic_vector'("0001"); --1
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0011"); --3
f2 <= transport std_logic_vector'("0100"); --4
m1 <= transport std_logic_vector'("0101"); --5
m2 <= transport std_logic_vector'("0110"); --6
-- --------------------
WAIT FOR 100 ns; -- Time=300 ns
h1 <= transport std_logic_vector'("0001"); --1
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0011"); --3
f2 <= transport std_logic_vector'("0100"); --4
m1 <= transport std_logic_vector'("0101"); --5
m2 <= transport std_logic_vector'("0110"); --6
-- --------------------
WAIT FOR 100 ns; -- Time=400 ns
h1 <= transport std_logic_vector'("0001"); --1
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0011"); --3
f2 <= transport std_logic_vector'("0100"); --4
m1 <= transport std_logic_vector'("0101"); --5
m2 <= transport std_logic_vector'("0110"); --6
-- --------------------
WAIT FOR 100 ns; -- Time=500 ns
h1 <= transport std_logic_vector'("0001"); --1
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0011"); --3
f2 <= transport std_logic_vector'("0100"); --4
m1 <= transport std_logic_vector'("0101"); --5
m2 <= transport std_logic_vector'("0110"); --6
-- --------------------
WAIT FOR 100 ns; -- Time=600 ns
h1 <= transport std_logic_vector'("0001"); --1
h2 <= transport std_logic_vector'("0010"); --2
f1 <= transport std_logic_vector'("0011"); --3
f2 <= transport std_logic_vector'("0100"); --4
m2 <= transport std_logic_vector'("0110"); --6
-- --------------------
WAIT FOR 150 ns; -- Time=750 ns
-- --------------------
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 ch_bcd_integer_cfg OF ch_tw IS
FOR testbench_arch
END FOR;
END ch_bcd_integer_cfg;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -