OpenCores
URL https://opencores.org/ocsvn/modular_oscilloscope/modular_oscilloscope/trunk

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [tbench/] [modullar_oscilloscope_tbench_text.vhd] - Blame information for rev 56

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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 56 budinero
 
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 56 budinero
    variable i: integer range 0 to 1200;
215
 
216 54 budinero
    ------------------------------------------------------------------------------------------------
217
    -- Procedure for write in epp port
218
    procedure WriteData(
219
      constant in_address: in  std_logic_vector(7 downto 0);
220
      constant in_data:    in  std_logic_vector(15 downto 0);
221
      signal Data_IO:      out std_logic_vector(7 downto 0);
222
      signal nStrobe_I:    out std_logic;
223
      signal nSelectIn_I:  out std_logic;
224
      signal nAutoFd_I:    out std_logic;
225
      signal Busy_O:       in  std_logic
226
    ) is
227
    begin
228
      nStrobe_I <= '0'; -- '0' -> is write
229 53 budinero
 
230 54 budinero
      Data_IO <= in_address;          -- Address
231
      nSelectIn_I <= '0';             -- addStb      
232
      wait until Busy_O = '1';
233
      --wait for 30 ns;
234
      nSelectIn_I <= '1';
235
      wait until Busy_O = '0';
236
 
237
      Data_IO <= in_data(7 downto 0); -- Data1
238
      nAutoFd_I <= '0';                -- datStb
239
      wait until Busy_O = '1';
240
      nAutoFd_I <= '1';
241
      wait until Busy_O = '0';
242
 
243
      Data_IO <= in_data(15 downto 8); -- Data0  
244
      nAutoFd_I <= '0';               -- datStb
245
      wait until Busy_O = '1';
246
      nAutoFd_I <= '1';
247
      wait until Busy_O = '0';
248
 
249
    end procedure WriteData;
250
    ------------------------------------------------------------------------------------------------
251
    -- Procedure for read from epp port
252
    procedure ReadData(
253
      signal out_runflag:  out std_logic;
254
      constant in_address: in  std_logic_vector(7 downto 0);
255
      signal Data_IO:      inout std_logic_vector(7 downto 0);
256
      signal nStrobe_I:    out std_logic;
257
      signal nSelectIn_I:  out std_logic;
258
      signal nAutoFd_I:    out std_logic;
259
      signal Busy_O:       in  std_logic
260
    ) is
261
    begin
262
 
263
      nStrobe_I <= '0'; -- '0' -> is write
264
      Data_IO <= in_address;          -- Address
265
      nSelectIn_I <= '0';             -- addStb
266
      wait until Busy_O = '1';
267
      --wait for 30 ns;
268
      nSelectIn_I <= '1';
269
      wait until Busy_O = '0';
270
 
271
      nStrobe_I <= '1'; -- '1' -> is read
272
      Data_IO <= (others => 'Z');     -- Data1
273
      nAutoFd_I <= '0';               -- datStb
274
      wait until (Busy_O = '1');
275
      wait for 30 ns;
276
      nAutoFd_I <= '1';
277
      wait until (Busy_O = '0');
278
 
279
      Data_IO <= (others => 'Z');     -- Data0
280
      nAutoFd_I <= '0';               -- datStb
281
      wait until (Busy_O = '1');
282
      wait for 30 ns;
283
      out_runflag <= Data_IO(6);
284
      nAutoFd_I <= '1';
285
      wait until (Busy_O = '0');
286
 
287
    end procedure ReadData;
288 53 budinero
 
289
  begin
290 54 budinero
    ------------------------------------------------------------------------------------------------
291
    -- Init
292
    test_number <= 0;
293 53 budinero
    wait until tb_ParameterInitFlag;
294
    tb_InitFlag <= true;
295
 
296 54 budinero
    nSelectIn_I <= '0';
297
    nStrobe_I   <= '0';
298
    Data_IO     <= (others => '0');
299
    nAutoFd_I   <= '1';
300
    nInit_I     <= '1';
301
    reset_I     <= '1';
302
    wait for 700 ns; -- PLL delay
303 53 budinero
 
304 54 budinero
    reset_I     <= '0';
305 53 budinero
 
306 54 budinero
    -- EPP Mode Negotiation
307
    -- Standar timing and handshake
308
    nStrobe_I <= '1';
309
    wait for 500 ns;
310 53 budinero
 
311 54 budinero
    Data_IO <= X"40";
312
    wait for 500 ns;
313 53 budinero
 
314 54 budinero
    nSelectIn_I <= '1';
315
    nAutoFd_I <= '0';
316
    wait until (PError_O = '1' and nAck_O = '0' and nFault_O = '1' and Sel_O = '1');
317 53 budinero
 
318 54 budinero
    nStrobe_I <= '0';
319
    wait for 500 ns;
320 53 budinero
 
321 54 budinero
    nAutoFd_I <= '1';
322
    nStrobe_I <= '1';
323 55 budinero
    wait until (nAck_O = '1' and Sel_O = '1');
324 53 budinero
 
325 54 budinero
    ------------------------------------------------------------------------------------------------
326
    -- Test 1
327
    -- Writing in all control register
328 53 budinero
 
329 54 budinero
    -- 00   RunConf_R   RW     [       |       |       |       |       |TScal04|TScal03|TScal02|
330
    --                          TScal01|TScal00|TScalEn|   TrCh|  TrEdg|   TrOn|   Cont|  Start]    
331
    --      
332
    -- 01   Channels_R  RW     [       |       |       |       |       |       |       |       |
333
    --                                 |       |       |       |       |       |  RCh01|  RCh00] 
334
    --      
335
    -- 02   BuffSize_R  RW     [       |       |BuffS13|BuffS12|BuffS11|BuffS10|BuffS09|BuffS08|
336
    --                          BuffS07|BuffS06|BuffS05|BuffS04|BuffS03|BuffS02|BuffS01|BuffS00]
337
    --      
338
    -- 03   TrigLvl_R   RW     [       |       |       |       |       |       |TrLvl09|TrLvl08|
339
    --                          TrLvl07|TrLvl06|TrLvl05|TrLvl04|TrLvl03|TrLvl02|TrLvl01|TrLvl00]
340
    --           
341
    -- 04   TrigOff_R   RW     [       |TrOff14|TrOff13|TrOff12|TrOff11|TrOff10|TrOff09|TrOff08|
342
    --                          TrOff07|TrOff06|TrOff00|TrOff00|TrOff00|TrOff00|TrOff00|TrOff00]  
343
    --
344
    -- 05   ADCConf     RW     [       |       |       |       |   ADCS|ADSleep| ADPSEn| ADPS08|
345
    --                           ADPS07| ADPS06| ADPS05| ADPS04| ADPS03| ADPS02| ADPS01| ADPS00]  
346
    --
347
    -- 08   Data_O      R      [ErrFlag|RunFlag|       |       |       |  DCh00|  Dat09|  Dat08|
348
    --                            Dat07|  Dat06|  Dat05|  Dat04|  Dat03|  Dat02|  Dat01|  Dat00] 
349
    -- 
350
    -- 09   Error_O     R      [       |       |       |       |       |       |       |       |
351
    --                                 |       |       |       |       | ErrN02| ErrN01| ErrN00] 
352 55 budinero
--     test_number <= 1;
353
--     
354
--     WriteData(X"00", X"FFFE", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
355
--     WriteData(X"01", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
356
--     WriteData(X"02", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
357
--     WriteData(X"03", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
358
--     WriteData(X"04", X"FFFF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
359
--     
360
--     ReadData(runflag, X"00", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
361
--     ReadData(runflag, X"01", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
362
--     ReadData(runflag, X"02", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
363
--     ReadData(runflag, X"03", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
364
--     ReadData(runflag, X"04", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
365
--     
366
--     wait for 50 ns;
367
--     ------------------------------------------------------------------------------------------------
368
--     -- Test 2 - DAQ Config
369
--     -- Writing in daq config register
370
--     test_number <= 2;
371
--     
372
--     WriteData(X"05", X"07FF", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
373
--     ReadData(runflag, X"05", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
374
--     
375
--     WriteData(X"05", X"0A00", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
376
--     ReadData(runflag, X"05", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
377
--     
378
--     wait for 50 ns;
379
--     ------------------------------------------------------------------------------------------------
380
--     -- Test 3 - Test basic
381
--     -- daq freq = ctrl freq/2 (default), w/o trigger, w/o skipper, channels 1 and 2, 
382
--     -- buffer size = 50h, continuous
383
--     test_number <= 3;
384
--     
385
--     WriteData(X"01", X"0003", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
386
--     WriteData(X"02", X"0050", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
387
--     WriteData(X"03", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
388
--     WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R
389
--     WriteData(X"00", X"0001", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
390
--     
391
--     
392
--     ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
393
--     while (runflag = '1') loop
394
--       ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);    
395
--     end loop;
396
--     
397
--     wait for 50 ns;
398
--     ------------------------------------------------------------------------------------------------
399
--     -- Test 4 - Skipper
400
--     -- daq freq = ctrl freq/2 (default), w/o trigger, skipper = 3, channels 1 and 2, 
401
--     -- buffer size = 80h, no continuous
402
--     test_number <= 4;
403
--     
404
--     WriteData(X"01", X"0003", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
405
--     WriteData(X"02", X"0080", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
406
--     WriteData(X"03", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
407
--     WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R
408
--     WriteData(X"00", B"00000_00011_1_0_0_0_0_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
409
--                        
410
--     
411
--     
412
--     ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
413
--     while (runflag = '1') loop
414
--       ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);    
415
--     end loop;
416
--     
417
--     -- Some samples
418
--     --     011011001  0  217
419
--     --     011110110  1  246
420
--     --     011111001  0  249  32
421
--     --     100010110  1  278  32
422
--     --     100011001  0  281  32
423
--     --     100110110  1  310  32
424
--     --     100111001  0  313  32
425
--     --     101010110  1  342  32
426
--     
427
--     
428 56 budinero
--     
429
--     wait for 50 ns;
430
--     
431
--     ------------------------------------------------------------------------------------------------
432
--     -- Test 5 - Trigger - one shot
433
--     -- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, not continuous, skipper = 5, 
434
--     -- channels 1 and 2, buffer size = 100h, rissing edge, trigg offset = 0
435
--     test_number <= 5;
436
--     
437
--     WriteData(X"01", X"0003", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
438
--     WriteData(X"02", X"0100", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
439
--     WriteData(X"03", X"0133", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
440
--     WriteData(X"04", X"0000", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R
441
--     WriteData(X"00", B"00000_00101_1_1_0_1_0_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
442
--     
443
--     
444
--     ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
445
--     while (runflag = '1') loop
446
--       ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);    
447
--     end loop;
448 53 budinero
 
449
 
450 54 budinero
    ------------------------------------------------------------------------------------------------
451 56 budinero
    -- Test 6 - Trigger 
452
    -- daq freq = ctrl freq/2 (default), trigger channel 1, level 70 %, continuous, skipper = 3, 
453
    -- channels 1, buffer size = 150h, falling edge, full negative trigger offset
454
    test_number <= 6;
455 54 budinero
 
456 56 budinero
    WriteData(X"01", X"0002", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
457
    WriteData(X"02", X"0150", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
458
    WriteData(X"03", X"02CD", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
459
    WriteData(X"04", X"FF6A", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
460
    WriteData(X"00", B"00000_00011_1_1_1_1_1_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
461 54 budinero
 
462
 
463
    ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
464 56 budinero
    i := 0;
465
    while (i <= 200) loop
466 54 budinero
      ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
467 56 budinero
      i := i + 1;
468 54 budinero
    end loop;
469
 
470
    ------------------------------------------------------------------------------------------------
471
    -- Test 7 - One channel
472 56 budinero
    -- daq freq = ctrl freq/2 (default), trigger channel 0, level 30 %, continuous, skipper = 5, 
473
    -- channels 1, buffer size = 30, trigger offset 29, skipper = 10
474
    --11101101010
475
--     test_number <= 7;
476
--     
477
--     WriteData(X"01", X"0001", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- Channels_R
478
--     WriteData(X"02", X"0030", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- BuffSize_R
479
--     WriteData(X"03", X"0010", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigLvl_R
480
--     WriteData(X"04", X"0029", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- TrigOff_R -150
481
--     WriteData(X"00", B"00000_01010_1_0_1_1_1_1", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O); -- RunConf_R
482
--     
483
--     
484
--     ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);
485
--     while (i <= 1200) loop
486
--       ReadData(runflag, X"08", Data_IO, nStrobe_I, nSelectIn_I, nAutoFd_I, Busy_O);    
487
--       i = i + 1;
488
--     end loop;
489 54 budinero
 
490
 
491
    ------------------------------------------------------------------------------------------------
492
    -- Test 8  - Test write while working
493
    -- daq freq = ctrl freq/2 (default), trigger channel 1, level 30 %, continuous, skipper = 5, 
494
    -- channels 1, buffer size = 50
495
 
496
 
497
 
498
 
499
      wait for 100 ns;
500
 
501
    tb_InitFlag <= false;
502
    wait;
503
 
504
 
505 53 budinero
  end process;
506
 
507
 
508
 
509
end architecture STIMULATOR;
510
 
511
 
512
 
513
 
514
 
515
 
516
 
517
 
518
 
519
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
520
 library ieee, std;
521
 use ieee.std_logic_1164.all;
522
 
523
 
524
-- Additional libraries used by Model Under Test.
525
-- ...
526
entity testbench is
527
end testbench;
528
 
529
architecture tbGeneratedCode of testbench is
530
    -- ADC
531
    signal adc_data_I:      std_logic_vector (9 downto 0);
532
    signal adc_sel_O:       std_logic;
533
    signal adc_clk_O:       std_logic;
534
    signal adc_sleep_O:     std_logic;
535
    signal adc_chip_sel_O:  std_logic;
536
    -- EPP
537
    signal nStrobe_I:       std_logic;
538
    signal Data_IO:         std_logic_vector (7 downto 0);
539
    signal nAck_O:          std_logic;
540
    signal busy_O:          std_logic;
541
    signal PError_O:        std_logic;
542
    signal Sel_O:           std_logic;
543
    signal nAutoFd_I:       std_logic;
544
    signal PeriphLogicH_O:  std_logic;
545
    signal nInit_I:         std_logic;
546
    signal nFault_O:        std_logic;
547
    signal nSelectIn_I:     std_logic;
548
    -- Peripherals
549
    signal reset_I:     std_logic;
550
    signal pll_clk_I:   std_logic;
551 54 budinero
 
552
 
553
    signal test_number: integer range 0 to 20;
554 53 budinero
begin
555
  --------------------------------------------------------------------------------------------------
556
  -- Instantiation of Stimulus.
557
  U_stimulus_0 : entity work.stimulus
558
    port map (
559
      -- ADC
560
      adc_data_I => adc_data_I,
561
      adc_sel_O => adc_sel_O,
562
      adc_clk_O => adc_clk_O,
563
      adc_sleep_O => adc_sleep_O,
564
      adc_chip_sel_O => adc_chip_sel_O,
565
      -- EPP
566
      nStrobe_I => nStrobe_I,
567
      Data_IO => Data_IO,
568
      nAck_O => nAck_O,
569
      busy_O => busy_O,
570
      PError_O => PError_O,
571
      Sel_O => Sel_O,
572
      nAutoFd_I => nAutoFd_I,
573
      PeriphLogicH_O =>PeriphLogicH_O ,
574
      nInit_I => nInit_I,
575
      nFault_O => nFault_O,
576
      nSelectIn_I => nSelectIn_I,
577
      -- Peripherals
578
      reset_I => reset_I,
579 54 budinero
      pll_clk_I => pll_clk_I,
580
 
581
      test_number => test_number
582 53 budinero
    );
583
 
584
  --------------------------------------------------------------------------------------------------
585
  -- Instantiation of Model Under Test.
586 54 budinero
  U_OSC0 : entity work.modular_oscilloscope --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
587 53 budinero
    port map (
588
      -- ADC
589
      adc_data_I => adc_data_I,
590
      adc_sel_O => adc_sel_O,
591
      adc_clk_O => adc_clk_O,
592
      adc_sleep_O => adc_sleep_O,
593
      adc_chip_sel_O => adc_chip_sel_O,
594
      -- EPP
595
      nStrobe_I => nStrobe_I,
596
      Data_IO => Data_IO,
597
      nAck_O => nAck_O,
598
      busy_O => busy_O,
599
      PError_O => PError_O,
600
      Sel_O => Sel_O,
601
      nAutoFd_I => nAutoFd_I,
602
      PeriphLogicH_O =>PeriphLogicH_O ,
603
      nInit_I => nInit_I,
604
      nFault_O => nFault_O,
605
      nSelectIn_I => nSelectIn_I,
606
      -- Peripherals
607
      reset_I => reset_I,
608
      pll_clk_I => pll_clk_I
609
    );
610
 
611
end tbGeneratedCode;
612
----------------------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.