2 -- created by hand&mouse in Xilinx ISE
6 use ieee.std_logic_1164.all;
7 use ieee.std_logic_arith.all;
8 use ieee.std_logic_unsigned.all;
9 use ieee.numeric_std.all;
10 USE IEEE.STD_LOGIC_TEXTIO.ALL;
16 ARCHITECTURE testbench_arch OF qctest IS
17 FILE RESULTS: TEXT OPEN WRITE_MODE IS "results.txt";
25 qcount : Out std_logic_vector (31 DownTo 0);
26 a_rise : Out std_logic;
27 a_fall : Out std_logic;
28 b_rise : Out std_logic;
29 b_fall : Out std_logic;
30 ab_event : Out std_logic;
31 ab_error : Out std_logic
35 SIGNAL clock : std_logic := '0';
36 SIGNAL reset : std_logic := '0';
37 SIGNAL a : std_logic := '0';
38 SIGNAL b : std_logic := '0';
39 SIGNAL qcount : std_logic_vector (31 DownTo 0) := "00000000000000000000000000000000";
40 SIGNAL a_rise : std_logic := '0';
41 SIGNAL a_fall : std_logic := '0';
42 SIGNAL b_rise : std_logic := '0';
43 SIGNAL b_fall : std_logic := '0';
44 SIGNAL ab_event : std_logic := '0';
45 SIGNAL ab_error : std_logic := '0';
47 constant PERIOD : time := 200 ns;
48 constant DUTY_CYCLE : real := 0.5;
49 constant OFFSET : time := 100 ns;
67 PROCESS -- clock process for clock
72 WAIT FOR (PERIOD - (PERIOD * DUTY_CYCLE));
74 WAIT FOR (PERIOD * DUTY_CYCLE);
80 -- ------------- Current Time: 185ns
83 -- -------------------------------------
84 -- ------------- Current Time: 385ns
87 -- -------------------------------------
88 -- ------------- Current Time: 585ns
91 -- -------------------------------------
92 -- ------------- Current Time: 785ns
95 -- -------------------------------------
96 -- ------------- Current Time: 985ns
99 -- -------------------------------------
100 -- ------------- Current Time: 1185ns
103 -- -------------------------------------
104 -- ------------- Current Time: 1385ns
107 -- -------------------------------------
108 -- ------------- Current Time: 1585ns
111 -- -------------------------------------
112 -- ------------- Current Time: 1785ns
115 -- -------------------------------------
116 -- ------------- Current Time: 1985ns
120 -- -------------------------------------
121 -- ------------- Current Time: 2385ns
125 -- -------------------------------------
126 -- ------------- Current Time: 2585ns
129 -- -------------------------------------
130 -- ------------- Current Time: 2785ns
133 -- -------------------------------------
134 -- ------------- Current Time: 2985ns
137 -- -------------------------------------
138 -- ------------- Current Time: 3185ns
141 -- -------------------------------------
142 -- ------------- Current Time: 3385ns
145 -- -------------------------------------
146 -- ------------- Current Time: 3585ns
149 -- -------------------------------------
150 -- ------------- Current Time: 3785ns
153 -- -------------------------------------
154 -- ------------- Current Time: 3985ns
157 -- -------------------------------------
158 -- ------------- Current Time: 4185ns
161 -- -------------------------------------
162 -- ------------- Current Time: 4385ns
165 -- -------------------------------------
166 -- ------------- Current Time: 4785ns
169 -- -------------------------------------
170 -- ------------- Current Time: 4985ns
173 -- -------------------------------------
174 -- ------------- Current Time: 5585ns
177 -- -------------------------------------
178 -- ------------- Current Time: 5985ns
181 -- -------------------------------------
182 -- ------------- Current Time: 6385ns
185 -- -------------------------------------
186 -- ------------- Current Time: 6585ns
189 -- -------------------------------------
190 -- ------------- Current Time: 6985ns
193 -- -------------------------------------