1 |
53 |
budinero |
-------------------------------------------------------------------------------------------------100
|
2 |
|
|
--| Modular Oscilloscope
|
3 |
|
|
--| UNSL - Argentine
|
4 |
|
|
--|
|
5 |
|
|
--| File: modullar_oscilloscope_tbench_text.vhd
|
6 |
|
|
--| Version: 0.1
|
7 |
|
|
--| Tested in: Actel A3PE1500
|
8 |
|
|
--| Board: RVI Prototype Board + LP Data Conversion Daughter Board
|
9 |
|
|
--|-------------------------------------------------------------------------------------------------
|
10 |
|
|
--| Description:
|
11 |
|
|
--| This file is only for test purposes.
|
12 |
|
|
--|
|
13 |
|
|
--|-------------------------------------------------------------------------------------------------
|
14 |
|
|
--| File history:
|
15 |
|
|
--| 0.1 | aug-2009 | First release
|
16 |
|
|
----------------------------------------------------------------------------------------------------
|
17 |
54 |
budinero |
--| Copyright © 2009, Facundo Aguilera (budinero at gmail.com.
|
18 |
53 |
budinero |
--|
|
19 |
|
|
--| This VHDL design file is an open design; you can redistribute it and/or
|
20 |
|
|
--| modify it and/or implement it after contacting the author.
|
21 |
|
|
----------------------------------------------------------------------------------------------------
|
22 |
|
|
|
23 |
|
|
--==================================================================================================
|
24 |
|
|
-- TO DO
|
25 |
|
|
-- · Full full test
|
26 |
|
|
--==================================================================================================
|
27 |
|
|
|
28 |
54 |
budinero |
-- NOTES
|
29 |
|
|
-- · Board clock freq = 25 MHz
|
30 |
|
|
-- · PLL clocks: clk_epp freq = 10 MHz, clk_epp freq = 40 MHz
|
31 |
53 |
budinero |
|
32 |
|
|
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
33 |
54 |
budinero |
-->> Virtual clock
|
34 |
53 |
budinero |
library ieee;
|
35 |
|
|
use ieee.std_logic_1164.all;
|
36 |
|
|
use ieee.math_real.all;
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
54 |
budinero |
entity tb_simple_clock is
|
41 |
53 |
budinero |
port (
|
42 |
|
|
CLK_PERIOD: in time;-- := 20 ns;
|
43 |
|
|
CLK_DUTY: in real; -- := 0.5;
|
44 |
|
|
active: in boolean;
|
45 |
|
|
clk_o: out std_logic
|
46 |
|
|
);
|
47 |
54 |
budinero |
end entity tb_simple_clock ;
|
48 |
53 |
budinero |
|
49 |
54 |
budinero |
architecture beh of tb_simple_clock is
|
50 |
53 |
budinero |
begin
|
51 |
|
|
P_main: process
|
52 |
|
|
begin
|
53 |
|
|
wait until active;
|
54 |
|
|
while (active = true) loop
|
55 |
|
|
clk_o <= '0';
|
56 |
|
|
wait for CLK_PERIOD * (100.0 - clk_Duty)/100.0;
|
57 |
|
|
clk_o <= '1';
|
58 |
|
|
wait for CLK_PERIOD * clk_Duty/100.0;
|
59 |
|
|
end loop;
|
60 |
|
|
clk_o <= '0';
|
61 |
|
|
wait;
|
62 |
|
|
end process;
|
63 |
|
|
end architecture beh;
|
64 |
|
|
|
65 |
54 |
budinero |
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
66 |
|
|
-->> Virtual ADC
|
67 |
|
|
library ieee;
|
68 |
|
|
use ieee.std_logic_1164.all;
|
69 |
|
|
use ieee.std_logic_unsigned.all;
|
70 |
53 |
budinero |
|
71 |
54 |
budinero |
entity virtual_adc is
|
72 |
|
|
port (
|
73 |
|
|
clk_I: in std_logic;
|
74 |
|
|
sel_I: in std_logic;
|
75 |
|
|
chip_sel_I: in std_logic;
|
76 |
|
|
sleep_I: in std_logic;
|
77 |
|
|
data_O: out std_logic_vector(9 downto 0)
|
78 |
|
|
);
|
79 |
|
|
end entity virtual_adc ;
|
80 |
|
|
|
81 |
|
|
architecture beh of virtual_adc is
|
82 |
|
|
signal data1: std_logic_vector(9 downto 0) := "0000000001"; -- odd
|
83 |
|
|
signal data2: std_logic_vector(9 downto 0) := (others => '0'); -- pair
|
84 |
|
|
begin
|
85 |
53 |
budinero |
|
86 |
54 |
budinero |
P_virtual_adc: process (clk_I, sel_I, chip_sel_I, sleep_I)
|
87 |
|
|
|
88 |
|
|
begin
|
89 |
|
|
if clk_I'event and clk_I = '1' then
|
90 |
|
|
data1 <= data1 + 2;
|
91 |
|
|
data2 <= data2 + 2;
|
92 |
|
|
end if;
|
93 |
|
|
|
94 |
|
|
if sleep_I = '1' or chip_sel_I = '0' then
|
95 |
|
|
data_O <= (others => '0');
|
96 |
|
|
else
|
97 |
|
|
case sel_I is
|
98 |
|
|
when '0' =>
|
99 |
|
|
data_O <= data1;
|
100 |
|
|
when others =>
|
101 |
|
|
data_O <= data2;
|
102 |
|
|
end case;
|
103 |
|
|
end if;
|
104 |
|
|
|
105 |
|
|
end process;
|
106 |
|
|
|
107 |
|
|
end architecture beh;
|
108 |
|
|
|
109 |
53 |
budinero |
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
110 |
54 |
budinero |
-->> Stimulus
|
111 |
53 |
budinero |
library ieee, std;
|
112 |
|
|
use ieee.std_logic_1164.all;
|
113 |
|
|
use ieee.std_logic_unsigned.all;
|
114 |
54 |
budinero |
--use IEEE.NUMERIC_STD.ALL;
|
115 |
53 |
budinero |
use ieee.math_real.all;
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
-- Additional libraries used by Model Under Test.
|
119 |
|
|
use work.ctrl_pkg.all;
|
120 |
|
|
use work.daq_pkg.all;
|
121 |
|
|
use work.memory_pkg.all;
|
122 |
|
|
use work.eppwbn_pkg.all;
|
123 |
|
|
|
124 |
|
|
entity stimulus is
|
125 |
|
|
port(
|
126 |
|
|
-- ADC
|
127 |
54 |
budinero |
adc_data_I: inout std_logic_vector (9 downto 0) := (others => '0');
|
128 |
53 |
budinero |
adc_sel_O: in std_logic;
|
129 |
|
|
adc_clk_O: in std_logic;
|
130 |
|
|
adc_sleep_O: in std_logic;
|
131 |
|
|
adc_chip_sel_O: in std_logic;
|
132 |
|
|
|
133 |
|
|
-- EPP
|
134 |
|
|
nStrobe_I: inout std_logic; -- HostClk/nWrite
|
135 |
|
|
Data_IO: inout std_logic_vector (7 downto 0);-- AD8..1 (Data1..Data8)
|
136 |
|
|
nAck_O: in std_logic; -- PtrClk/PeriphClk/Intr
|
137 |
54 |
budinero |
Busy_O: in std_logic; -- PtrBusy/PeriphAck/nWait
|
138 |
53 |
budinero |
PError_O: in std_logic; -- AckData/nAckReverse
|
139 |
|
|
Sel_O: in std_logic; -- XFlag (Select)
|
140 |
|
|
nAutoFd_I: inout std_logic; -- HostBusy/HostAck/nDStrb
|
141 |
|
|
PeriphLogicH_O: in std_logic; -- (Periph Logic High)
|
142 |
|
|
nInit_I: inout std_logic; -- nReverseRequest
|
143 |
|
|
nFault_O: in std_logic; -- nDataAvail/nPeriphRequest
|
144 |
|
|
nSelectIn_I: inout std_logic; -- 1284 Active/nAStrb
|
145 |
|
|
|
146 |
|
|
-- Peripherals
|
147 |
|
|
reset_I: inout std_logic;
|
148 |
54 |
budinero |
pll_clk_I: inout std_logic; -- clock signal go to pll, and is divided in two clocks
|
149 |
|
|
|
150 |
|
|
test_number: out integer range 0 to 20
|
151 |
53 |
budinero |
);
|
152 |
|
|
|
153 |
|
|
end stimulus;
|
154 |
|
|
|
155 |
|
|
architecture STIMULATOR of stimulus is
|
156 |
54 |
budinero |
-- PLL clocks
|
157 |
|
|
constant CLK_DAQ_PERIOD: time := 25 ns;
|
158 |
|
|
constant CLK_EPP_PERIOD: time := 100 ns;
|
159 |
|
|
|
160 |
53 |
budinero |
-- Control Signal Declarations
|
161 |
|
|
signal tb_InitFlag : boolean := false;
|
162 |
|
|
signal tb_ParameterInitFlag : boolean := false;
|
163 |
|
|
signal i: std_logic;
|
164 |
54 |
budinero |
signal runflag: std_logic;
|
165 |
53 |
budinero |
|
166 |
|
|
-- Parm Declarations
|
167 |
|
|
signal clk_Duty : real := 0.0;
|
168 |
|
|
signal clk_Period : time := 0 ns;
|
169 |
|
|
|
170 |
|
|
begin
|
171 |
|
|
--------------------------------------------------------------------------------------------------
|
172 |
|
|
-- Parm Assignment Block
|
173 |
|
|
P_AssignParms : process
|
174 |
|
|
variable clk_Duty_real : real;
|
175 |
|
|
variable clk_Period_real : real;
|
176 |
|
|
begin
|
177 |
|
|
-- Basic parameters
|
178 |
54 |
budinero |
clk_Period_real := 40.0; --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
|
179 |
53 |
budinero |
clk_Period <= clk_Period_real * 1 ns;
|
180 |
|
|
clk_Duty_real := 50.0;
|
181 |
|
|
clk_Duty <= clk_Duty_real;
|
182 |
|
|
|
183 |
|
|
tb_ParameterInitFlag <= true;
|
184 |
|
|
|
185 |
|
|
wait;
|
186 |
|
|
end process;
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
--------------------------------------------------------------------------------------------------
|
190 |
54 |
budinero |
-- Instantiation
|
191 |
53 |
budinero |
-- Clock Instantiation
|
192 |
54 |
budinero |
U_TB_CLK: entity work.tb_simple_clock
|
193 |
53 |
budinero |
port map (
|
194 |
|
|
clk_Period => clk_Period,
|
195 |
|
|
clk_Duty => clk_Duty,
|
196 |
|
|
active => tb_InitFlag,
|
197 |
|
|
clk_o => pll_clk_I
|
198 |
|
|
);
|
199 |
|
|
|
200 |
54 |
budinero |
-- ADC Instantiation
|
201 |
|
|
U_TB_ADC: entity work.virtual_adc
|
202 |
|
|
port map(
|
203 |
|
|
clk_I => adc_clk_O,
|
204 |
|
|
sel_I => adc_sel_O,
|
205 |
|
|
chip_sel_I => adc_chip_sel_O,
|
206 |
|
|
sleep_I => adc_sleep_O,
|
207 |
|
|
data_O => adc_data_I
|
208 |
|
|
);
|
209 |
|
|
|
210 |
53 |
budinero |
|
211 |
|
|
--------------------------------------------------------------------------------------------------
|
212 |
54 |
budinero |
-- Main process
|
213 |
|
|
P_Unclocked : process
|
214 |
|
|
------------------------------------------------------------------------------------------------
|
215 |
|
|
-- Procedure for write in epp port
|
216 |
|
|
procedure WriteData(
|
217 |
|
|
constant in_address: in std_logic_vector(7 downto 0);
|
218 |
|
|
constant in_data: in std_logic_vector(15 downto 0);
|
219 |
|
|
signal Data_IO: out std_logic_vector(7 downto 0);
|
220 |
|
|
signal nStrobe_I: out std_logic;
|
221 |
|
|
signal nSelectIn_I: out std_logic;
|
222 |
|
|
signal nAutoFd_I: out std_logic;
|
223 |
|
|
signal Busy_O: in std_logic
|
224 |
|
|
) is
|
225 |
|
|
begin
|
226 |
|
|
nStrobe_I <= '0'; -- '0' -> is write
|
227 |
53 |
budinero |
|
228 |
54 |
budinero |
Data_IO <= in_address; -- Address
|
229 |
|
|
nSelectIn_I <= '0'; -- addStb
|
230 |
|
|
wait until Busy_O = '1';
|
231 |
|
|
--wait for 30 ns;
|
232 |
|
|
nSelectIn_I <= '1';
|
233 |
|
|
wait until Busy_O = '0';
|
234 |
|
|
|
235 |
|
|
Data_IO <= in_data(7 downto 0); -- Data1
|
236 |
|
|
nAutoFd_I <= '0'; -- datStb
|
237 |
|
|
wait until Busy_O = '1';
|
238 |
|
|
nAutoFd_I <= '1';
|
239 |
|
|
wait until Busy_O = '0';
|
240 |
|
|
|
241 |
|
|
Data_IO <= in_data(15 downto 8); -- Data0
|
242 |
|
|
nAutoFd_I <= '0'; -- datStb
|
243 |
|
|
wait until Busy_O = '1';
|
244 |
|
|
nAutoFd_I <= '1';
|
245 |
|
|
wait until Busy_O = '0';
|
246 |
|
|
|
247 |
|
|
end procedure WriteData;
|
248 |
|
|
------------------------------------------------------------------------------------------------
|
249 |
|
|
-- Procedure for read from epp port
|
250 |
|
|
procedure ReadData(
|
251 |
|
|
signal out_runflag: out std_logic;
|
252 |
|
|
constant in_address: in std_logic_vector(7 downto 0);
|
253 |
|
|
signal Data_IO: inout std_logic_vector(7 downto 0);
|
254 |
|
|
signal nStrobe_I: out std_logic;
|
255 |
|
|
signal nSelectIn_I: out std_logic;
|
256 |
|
|
signal nAutoFd_I: out std_logic;
|
257 |
|
|
signal Busy_O: in std_logic
|
258 |
|
|
) is
|
259 |
|
|
begin
|
260 |
|
|
|
261 |
|
|
nStrobe_I <= '0'; -- '0' -> is write
|
262 |
|
|
Data_IO <= in_address; -- Address
|
263 |
|
|
nSelectIn_I <= '0'; -- addStb
|
264 |
|
|
wait until Busy_O = '1';
|
265 |
|
|
--wait for 30 ns;
|
266 |
|
|
nSelectIn_I <= '1';
|
267 |
|
|
wait until Busy_O = '0';
|
268 |
|
|
|
269 |
|
|
nStrobe_I <= '1'; -- '1' -> is read
|
270 |
|
|
Data_IO <= (others => 'Z'); -- Data1
|
271 |
|
|
nAutoFd_I <= '0'; -- datStb
|
272 |
|
|
wait until (Busy_O = '1');
|
273 |
|
|
wait for 30 ns;
|
274 |
|
|
nAutoFd_I <= '1';
|
275 |
|
|
wait until (Busy_O = '0');
|
276 |
|
|
|
277 |
|
|
Data_IO <= (others => 'Z'); -- Data0
|
278 |
|
|
nAutoFd_I <= '0'; -- datStb
|
279 |
|
|
wait until (Busy_O = '1');
|
280 |
|
|
wait for 30 ns;
|
281 |
|
|
out_runflag <= Data_IO(6);
|
282 |
|
|
nAutoFd_I <= '1';
|
283 |
|
|
wait until (Busy_O = '0');
|
284 |
|
|
|
285 |
|
|
end procedure ReadData;
|
286 |
53 |
budinero |
|
287 |
|
|
begin
|
288 |
54 |
budinero |
------------------------------------------------------------------------------------------------
|
289 |
|
|
-- Init
|
290 |
|
|
test_number <= 0;
|
291 |
53 |
budinero |
wait until tb_ParameterInitFlag;
|
292 |
|
|
tb_InitFlag <= true;
|
293 |
|
|
|
294 |
54 |
budinero |
nSelectIn_I <= '0';
|
295 |
|
|
nStrobe_I <= '0';
|
296 |
|
|
Data_IO <= (others => '0');
|
297 |
|
|
nAutoFd_I <= '1';
|
298 |
|
|
nInit_I <= '1';
|
299 |
|
|
reset_I <= '1';
|
300 |
|
|
wait for 700 ns; -- PLL delay
|
301 |
53 |
budinero |
|
302 |
54 |
budinero |
reset_I <= '0';
|
303 |
53 |
budinero |
|
304 |
54 |
budinero |
-- EPP Mode Negotiation
|
305 |
|
|
-- Standar timing and handshake
|
306 |
|
|
nStrobe_I <= '1';
|
307 |
|
|
wait for 500 ns;
|
308 |
53 |
budinero |
|
309 |
54 |
budinero |
Data_IO <= X"40";
|
310 |
|
|
wait for 500 ns;
|
311 |
53 |
budinero |
|
312 |
54 |
budinero |
nSelectIn_I <= '1';
|
313 |
|
|
nAutoFd_I <= '0';
|
314 |
|
|
wait until (PError_O = '1' and nAck_O = '0' and nFault_O = '1' and Sel_O = '1');
|
315 |
53 |
budinero |
|
316 |
54 |
budinero |
nStrobe_I <= '0';
|
317 |
|
|
wait for 500 ns;
|
318 |
53 |
budinero |
|
319 |
54 |
budinero |
nAutoFd_I <= '1';
|
320 |
|
|
nStrobe_I <= '1';
|
321 |
|
|
wait until (nAck_O = '1' and Sel_O = '1');
|
322 |
53 |
budinero |
|
323 |
54 |
budinero |
------------------------------------------------------------------------------------------------
|
324 |
|
|
-- Test 1
|
325 |
|
|
-- Writing in all control register
|
326 |
53 |
budinero |
|
327 |
54 |
budinero |
-- 00 RunConf_R RW [ | | | | |TScal04|TScal03|TScal02|
|
328 |
|
|
-- TScal01|TScal00|TScalEn| TrCh| TrEdg| TrOn| Cont| Start]
|
329 |
|
|
--
|
330 |
|
|
-- 01 Channels_R RW [ | | | | | | | |
|
331 |
|
|
-- | | | | | | RCh01| RCh00]
|
332 |
|
|
--
|
333 |
|
|
-- 02 BuffSize_R RW [ | |BuffS13|BuffS12|BuffS11|BuffS10|BuffS09|BuffS08|
|
334 |
|
|
-- BuffS07|BuffS06|BuffS05|BuffS04|BuffS03|BuffS02|BuffS01|BuffS00]
|
335 |
|
|
--
|
336 |
|
|
-- 03 TrigLvl_R RW [ | | | | | |TrLvl09|TrLvl08|
|
337 |
|
|
-- TrLvl07|TrLvl06|TrLvl05|TrLvl04|TrLvl03|TrLvl02|TrLvl01|TrLvl00]
|
338 |
|
|
--
|
339 |
|
|
-- 04 TrigOff_R RW [ |TrOff14|TrOff13|TrOff12|TrOff11|TrOff10|TrOff09|TrOff08|
|
340 |
|
|
-- TrOff07|TrOff06|TrOff00|TrOff00|TrOff00|TrOff00|TrOff00|TrOff00]
|
341 |
|
|
--
|
342 |
|
|
-- 05 ADCConf RW [ | | | | ADCS|ADSleep| ADPSEn| ADPS08|
|
343 |
|
|
-- ADPS07| ADPS06| ADPS05| ADPS04| ADPS03| ADPS02| ADPS01| ADPS00]
|
344 |
|
|
--
|
345 |
|
|
-- 08 Data_O R [ErrFlag|RunFlag| | | | DCh00| Dat09| Dat08|
|
346 |
|
|
-- Dat07| Dat06| Dat05| Dat04| Dat03| Dat02| Dat01| Dat00]
|
347 |
|
|
--
|
348 |
|
|
-- 09 Error_O R [ | | | | | | | |
|
349 |
|
|
-- | | | | | ErrN02| ErrN01| ErrN00]
|
350 |
|
|
test_number <= 1;
|
351 |
53 |
budinero |
|
352 |
54 |
budinero |
WriteData(X"00", X"FFFE", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
353 |
|
|
WriteData(X"01", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
354 |
|
|
WriteData(X"02", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
355 |
|
|
WriteData(X"03", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
356 |
|
|
WriteData(X"04", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
357 |
53 |
budinero |
|
358 |
54 |
budinero |
ReadData(runflag, X"00", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
359 |
|
|
ReadData(runflag,X"01", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
360 |
|
|
ReadData(runflag, X"02", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
361 |
|
|
ReadData(runflag, X"03", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
362 |
|
|
ReadData(runflag, X"04", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
363 |
53 |
budinero |
|
364 |
54 |
budinero |
wait for 50 ns;
|
365 |
|
|
------------------------------------------------------------------------------------------------
|
366 |
|
|
-- Test 2 - DAQ Config
|
367 |
|
|
-- Writing in daq config register
|
368 |
|
|
test_number <= 2;
|
369 |
53 |
budinero |
|
370 |
54 |
budinero |
WriteData(X"05", X"07FF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
371 |
|
|
ReadData(runflag, X"05", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
372 |
53 |
budinero |
|
373 |
54 |
budinero |
WriteData(X"05", X"0A00", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
374 |
|
|
ReadData(runflag, X"05", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
375 |
|
|
|
376 |
|
|
wait for 50 ns;
|
377 |
|
|
------------------------------------------------------------------------------------------------
|
378 |
|
|
-- Test 3 - Test basic
|
379 |
|
|
-- daq freq = ctrl freq/2 (default), w/o trigger, w/o skipper, channels 1 and 2,
|
380 |
|
|
-- buffer size = 50h, continuous
|
381 |
|
|
test_number <= 3;
|
382 |
|
|
|
383 |
|
|
WriteData(X"01", X"0003", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
|
384 |
|
|
WriteData(X"02", X"0050", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
|
385 |
|
|
WriteData(X"03", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
|
386 |
|
|
WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R
|
387 |
|
|
WriteData(X"00", X"0001", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
|
388 |
|
|
|
389 |
|
|
|
390 |
|
|
ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
391 |
|
|
while (runflag = '1') loop
|
392 |
|
|
ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
|
393 |
|
|
end loop;
|
394 |
|
|
|
395 |
|
|
wait for 50 ns;
|
396 |
|
|
------------------------------------------------------------------------------------------------
|
397 |
|
|
-- Test 4 - Skipper
|
398 |
|
|
-- daq freq = ctrl freq/2 (default), w/o trigger, skipper = 3, channels 1 and 2,
|
399 |
|
|
-- buffer size = 80, no continuous
|
400 |
|
|
|
401 |
|
|
|
402 |
|
|
------------------------------------------------------------------------------------------------
|
403 |
|
|
-- Test 5 - Trigger - one shot
|
404 |
|
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, not continuous, skipper = 5,
|
405 |
|
|
-- channels 1 and 2, buffer size = 100
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
------------------------------------------------------------------------------------------------
|
409 |
|
|
-- Test 6 - Trigger
|
410 |
|
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, continuous, skipper = 5,
|
411 |
|
|
-- channels 1, buffer size = 50
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
------------------------------------------------------------------------------------------------
|
415 |
|
|
-- Test 7 - One channel
|
416 |
|
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, continuous, skipper = 5,
|
417 |
|
|
-- channels 1, buffer size = 50
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
------------------------------------------------------------------------------------------------
|
422 |
|
|
-- Test 8 - Test write while working
|
423 |
|
|
-- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, continuous, skipper = 5,
|
424 |
|
|
-- channels 1, buffer size = 50
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
wait for 100 ns;
|
430 |
|
|
|
431 |
|
|
tb_InitFlag <= false;
|
432 |
|
|
wait;
|
433 |
|
|
|
434 |
|
|
|
435 |
53 |
budinero |
end process;
|
436 |
|
|
|
437 |
|
|
|
438 |
|
|
|
439 |
|
|
end architecture STIMULATOR;
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
|
443 |
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
|
|
|
449 |
|
|
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
450 |
|
|
library ieee, std;
|
451 |
|
|
use ieee.std_logic_1164.all;
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
-- Additional libraries used by Model Under Test.
|
455 |
|
|
-- ...
|
456 |
|
|
entity testbench is
|
457 |
|
|
end testbench;
|
458 |
|
|
|
459 |
|
|
architecture tbGeneratedCode of testbench is
|
460 |
|
|
-- ADC
|
461 |
|
|
signal adc_data_I: std_logic_vector (9 downto 0);
|
462 |
|
|
signal adc_sel_O: std_logic;
|
463 |
|
|
signal adc_clk_O: std_logic;
|
464 |
|
|
signal adc_sleep_O: std_logic;
|
465 |
|
|
signal adc_chip_sel_O: std_logic;
|
466 |
|
|
-- EPP
|
467 |
|
|
signal nStrobe_I: std_logic;
|
468 |
|
|
signal Data_IO: std_logic_vector (7 downto 0);
|
469 |
|
|
signal nAck_O: std_logic;
|
470 |
|
|
signal busy_O: std_logic;
|
471 |
|
|
signal PError_O: std_logic;
|
472 |
|
|
signal Sel_O: std_logic;
|
473 |
|
|
signal nAutoFd_I: std_logic;
|
474 |
|
|
signal PeriphLogicH_O: std_logic;
|
475 |
|
|
signal nInit_I: std_logic;
|
476 |
|
|
signal nFault_O: std_logic;
|
477 |
|
|
signal nSelectIn_I: std_logic;
|
478 |
|
|
-- Peripherals
|
479 |
|
|
signal reset_I: std_logic;
|
480 |
|
|
signal pll_clk_I: std_logic;
|
481 |
54 |
budinero |
|
482 |
|
|
|
483 |
|
|
signal test_number: integer range 0 to 20;
|
484 |
53 |
budinero |
begin
|
485 |
|
|
--------------------------------------------------------------------------------------------------
|
486 |
|
|
-- Instantiation of Stimulus.
|
487 |
|
|
U_stimulus_0 : entity work.stimulus
|
488 |
|
|
port map (
|
489 |
|
|
-- ADC
|
490 |
|
|
adc_data_I => adc_data_I,
|
491 |
|
|
adc_sel_O => adc_sel_O,
|
492 |
|
|
adc_clk_O => adc_clk_O,
|
493 |
|
|
adc_sleep_O => adc_sleep_O,
|
494 |
|
|
adc_chip_sel_O => adc_chip_sel_O,
|
495 |
|
|
-- EPP
|
496 |
|
|
nStrobe_I => nStrobe_I,
|
497 |
|
|
Data_IO => Data_IO,
|
498 |
|
|
nAck_O => nAck_O,
|
499 |
|
|
busy_O => busy_O,
|
500 |
|
|
PError_O => PError_O,
|
501 |
|
|
Sel_O => Sel_O,
|
502 |
|
|
nAutoFd_I => nAutoFd_I,
|
503 |
|
|
PeriphLogicH_O =>PeriphLogicH_O ,
|
504 |
|
|
nInit_I => nInit_I,
|
505 |
|
|
nFault_O => nFault_O,
|
506 |
|
|
nSelectIn_I => nSelectIn_I,
|
507 |
|
|
-- Peripherals
|
508 |
|
|
reset_I => reset_I,
|
509 |
54 |
budinero |
pll_clk_I => pll_clk_I,
|
510 |
|
|
|
511 |
|
|
test_number => test_number
|
512 |
53 |
budinero |
);
|
513 |
|
|
|
514 |
|
|
--------------------------------------------------------------------------------------------------
|
515 |
|
|
-- Instantiation of Model Under Test.
|
516 |
54 |
budinero |
U_OSC0 : entity work.modular_oscilloscope --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
|
517 |
53 |
budinero |
port map (
|
518 |
|
|
-- ADC
|
519 |
|
|
adc_data_I => adc_data_I,
|
520 |
|
|
adc_sel_O => adc_sel_O,
|
521 |
|
|
adc_clk_O => adc_clk_O,
|
522 |
|
|
adc_sleep_O => adc_sleep_O,
|
523 |
|
|
adc_chip_sel_O => adc_chip_sel_O,
|
524 |
|
|
-- EPP
|
525 |
|
|
nStrobe_I => nStrobe_I,
|
526 |
|
|
Data_IO => Data_IO,
|
527 |
|
|
nAck_O => nAck_O,
|
528 |
|
|
busy_O => busy_O,
|
529 |
|
|
PError_O => PError_O,
|
530 |
|
|
Sel_O => Sel_O,
|
531 |
|
|
nAutoFd_I => nAutoFd_I,
|
532 |
|
|
PeriphLogicH_O =>PeriphLogicH_O ,
|
533 |
|
|
nInit_I => nInit_I,
|
534 |
|
|
nFault_O => nFault_O,
|
535 |
|
|
nSelectIn_I => nSelectIn_I,
|
536 |
|
|
-- Peripherals
|
537 |
|
|
reset_I => reset_I,
|
538 |
|
|
pll_clk_I => pll_clk_I
|
539 |
|
|
);
|
540 |
|
|
|
541 |
|
|
end tbGeneratedCode;
|
542 |
|
|
----------------------------------------------------------------------------------------------------
|