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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [ctrl/] [tbench/] [data_skipper_tbench_text.vhd] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 36 budinero
-------------------------------------------------------------------------------------------------100
2
--| Modular Oscilloscope
3
--| UNSL - Argentine
4
--|
5
--| File: data_skipper_tbench_text.vhd
6
--| Version: 0.01
7
--| Tested in: Actel A3PE1500
8
--|-------------------------------------------------------------------------------------------------
9
--| Description:
10
--|   Adquisition control module. 
11
--|   This file is only for test purposes. Testing daq. Test bench.
12
--|   It may not work for other than Actel Libero software.
13
--|-------------------------------------------------------------------------------------------------
14
--| File history:
15
--|   0.01  | apr-2009 | First release
16
----------------------------------------------------------------------------------------------------
17
--| Copyright © 2009, Facundo Aguilera.
18
--|
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
-- NOTE:  It may not work for other than Actel Libero software.
25
--        You can download Libero for free from Actel website (it is not a free software).
26
 
27
 
28
 
29
library ieee, std;
30
use ieee.std_logic_1164.all;
31
library syncad_vhdl_lib;
32
use syncad_vhdl_lib.TBDefinitions.all;
33
use IEEE.NUMERIC_STD.ALL;
34
 
35
 
36
 
37
-- Additional libraries used by Model Under Test.
38
use work.ctrl_pkg.all;
39
use ieee.math_real.all;
40
 
41
 
42
 
43
----------------------------------------------------------------------------------------------------
44
entity stimulus is
45
  generic(
46
    SELECTOR_WIDTH: integer :=  5  -- max looses = 2**(2**SELECTOR_WIDTH)
47
  );
48
  port(
49
    -- sinal from wishbone interface
50
    ack_I, stb_I:     inout  std_logic;
51
    -- selector from register
52
    selector_I:       inout   std_logic_vector(SELECTOR_WIDTH-1 downto 0);
53
    -- enable from register 
54
    enable_skipper_I: inout   std_logic;
55
    -- common signals
56 38 budinero
    reset_I, clk_I:   inout   std_logic;
57
    first_channel_I:  inout   std_logic
58 36 budinero
  );
59
 
60
end stimulus;
61
 
62
architecture STIMULATOR of stimulus is
63
  -- Period
64
  constant T: real := 10.0;
65
 
66
  -- Control Signal Declarations
67
  signal tb_status : TStatus;
68
  signal tb_ParameterInitFlag : boolean := false;
69
 
70
  -- Parm Declarations
71
  signal clk_MinHL :  time := 0 ns;
72
  signal clk_MaxHL :  time := 0 ns;
73
  signal clk_MinLH :  time := 0 ns;
74
  signal clk_MaxLH :  time := 0 ns;
75
  signal clk_JFall :  time := 0 ns;
76
  signal clk_JRise :  time := 0 ns;
77
  signal clk_Duty :   real := 0.0;
78
  signal clk_Period : time := 0 ns;
79
  signal clk_Offset : time := 0 ns;
80
 
81
 
82
 
83
begin
84
 
85
  --------------------------------------------------------------------------------------------------
86
  -- Parm Assignment Block
87
  AssignParms : process
88
    variable clk_MinHL_real :   real;
89
    variable clk_MaxHL_real :   real;
90
    variable clk_MinLH_real :   real;
91
    variable clk_MaxLH_real :   real;
92
    variable clk_JFall_real :   real;
93
    variable clk_JRise_real :   real;
94
    variable clk_Duty_real :    real;
95
    variable clk_Period_real :  real;
96
    variable clk_Offset_real :  real;
97
  begin
98
    -- Basic parameters
99
    clk_Period_real := T; --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
100
    clk_Period <= clk_Period_real * 1 ns;
101
    clk_Duty_real := 50.0;
102
    clk_Duty <= clk_Duty_real;
103
 
104
    -- Aditionale parameters
105
    clk_MinHL_real := 0.0;
106
    clk_MinHL <= clk_MinHL_real * 1 ns;
107
    clk_MaxHL_real := 0.0;
108
    clk_MaxHL <= clk_MaxHL_real * 1 ns;
109
    clk_MinLH_real := 0.0;
110
    clk_MinLH <= clk_MinLH_real * 1 ns;
111
    clk_MaxLH_real := 0.0;
112
    clk_MaxLH <= clk_MaxLH_real * 1 ns;
113
    clk_JFall_real := 0.0;
114
    clk_JFall <= clk_JFall_real * 1 ns;
115
    clk_JRise_real := 0.0;
116
    clk_JRise <= clk_JRise_real * 1 ns;
117
    clk_Offset_real := 0.0;
118
    clk_Offset <= clk_Offset_real * 1 ns;
119
    tb_ParameterInitFlag <= true;
120
 
121
    wait;
122
  end process;
123
 
124
 
125
  --------------------------------------------------------------------------------------------------
126
  -- Clocks
127
  -- Clock Instantiation
128
  tb_clk : entity syncad_vhdl_lib.tb_clock_minmax
129
    generic map (name => "tb_clk",
130
                initialize => true,
131
                state1 => '1',
132
                state2 => '0')
133
    port map (tb_status,
134
              clk_I, --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
135
              clk_MinLH,
136
              clk_MaxLH,
137
              clk_MinHL,
138
              clk_MaxHL,
139
              clk_Offset,
140
              clk_Period,
141
              clk_Duty,
142
              clk_JRise,
143
              clk_JFall);
144
 
145
  --<=============================================================================================
146
  -- Clocked Sequences
147
  -- ...
148
  --===============================================================================================>
149
 
150
 
151
  --<===============================================================================================
152
  -- Sequence: Unclocked
153 38 budinero
  P_FirstCh: process
154
  begin
155
    wait until tb_ParameterInitFlag;
156
    first_channel_I <= '0';
157
      wait for T*1.5 ns;
158
    while tb_status = TB_ONCE loop
159
      first_channel_I <= '1';
160
        wait for T * 1 ns; --<delay>
161
      first_channel_I <= '0';
162
        wait for 4.0 * T * 1 ns;
163
    end loop;
164
 
165
    wait;
166
  end process;
167
 
168
  P_Unclocked : process
169 36 budinero
    variable i: natural range 0 to 500;
170
  begin
171 38 budinero
       wait until tb_ParameterInitFlag;
172
    tb_status <= TB_ONCE;
173
 
174
 
175 36 budinero
    -- Initial
176
    reset_I <= '1' ;
177
    ack_I <= '0'; stb_I <= '0';
178 38 budinero
    enable_skipper_I <= '1';
179 36 budinero
    selector_I <= (others => '0');
180 38 budinero
      wait for T*1.5 ns; --<delay>
181 36 budinero
 
182
    -- w/o en_skip
183
    reset_I <= '0';
184
      wait for T * 1 ns; --<delay>
185
 
186
    ack_I <= '1';
187
      wait for T * 1 ns; --<delay>
188
 
189
    ack_I <= '0'; stb_I <= '1';
190
      wait for T * 1 ns; --<delay>
191
 
192
    ack_I <= '1'; stb_I <= '1';
193
      wait for (3.0*T) * 1 ns; --<delay>
194
 
195
    -- w/ en_skip
196
    enable_skipper_I <= '1';
197
      wait for 10.0*T * 1 ns; --<delay>
198
 
199
    ack_I <= '1'; stb_I <= '0';
200
      wait for 4.0 * T * 1 ns; --<delay>
201
 
202
    ack_I <= '0'; stb_I <= '1';
203 38 budinero
      wait for 4.0*T *4.0* 1 ns; --<delay>
204 36 budinero
 
205
    -- selector_I /= 0
206
    ack_I <= '1'; stb_I <= '1'; selector_I <= std_logic_vector(unsigned(selector_I) + 1);
207 38 budinero
      wait for 20.0*T*4.0 * 1 ns; --<delay>
208 36 budinero
 
209
    selector_I <= std_logic_vector(to_unsigned( integer(2**real(selector_I'length )/10.0), selector_I'length ));
210 38 budinero
      wait for 4000.0*T*4.0 * 1 ns;
211 36 budinero
 
212
    selector_I <= std_logic_vector(to_unsigned( integer(2**real(selector_I'length )/4.0), selector_I'length ));
213 38 budinero
      wait for 4000.0*T*4.0 * 1 ns; --<delay>
214 36 budinero
 
215
    selector_I <= std_logic_vector(to_unsigned( integer(2**real(selector_I'length )-1.0), selector_I'length ));
216 38 budinero
      wait for 100000.0*T *4.0* 1 ns; --<delay>
217 36 budinero
 
218
 
219
 
220
 
221
 
222
 
223 38 budinero
    tb_status <= TB_DONE;  -- End of simulation
224 36 budinero
    wait;
225
 
226
  end process;
227
  --===============================================================================================>
228
 
229
 
230
end STIMULATOR;
231
----------------------------------------------------------------------------------------------------
232
 
233
 
234
 
235
 
236
-- Test Bench wrapper for stimulus and Model Under Test
237
 library ieee, std;
238
 use ieee.std_logic_1164.all;
239
 library syncad_vhdl_lib;
240
 use syncad_vhdl_lib.TBDefinitions.all;
241
 
242
-- Additional libraries used by Model Under Test.
243
-- ...
244
 
245
 
246
 
247
----------------------------------------------------------------------------------------------------
248
entity testbench is
249
end testbench;
250
 
251
architecture tbGeneratedCode of testbench is
252
    constant SELECTOR_WIDTH: integer :=  5;
253
      -- enable output signal
254
    signal ack_O:              std_logic;
255
    -- sinal from wishbone interface
256
    signal ack_I, stb_I:       std_logic;
257
    -- selector from register
258
    signal selector_I:          std_logic_vector(SELECTOR_WIDTH-1 downto 0);
259
    -- enable from register 
260
    signal enable_skipper_I:    std_logic;
261
    -- common signals
262
    signal reset_I, clk_I:      std_logic;
263 38 budinero
    signal first_channel_I:     std_logic;
264 36 budinero
 
265
begin
266
  --------------------------------------------------------------------------------------------------
267
  -- Instantiation of Stimulus.
268
  U_stimulus_0 : entity work.stimulus --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
269
  generic map(
270
    SELECTOR_WIDTH => SELECTOR_WIDTH
271
  )
272
  port map (
273
    ack_I => ack_I,
274
    stb_I => stb_I,
275
    selector_I => selector_I,
276
    enable_skipper_I => enable_skipper_I,
277
    reset_I => reset_I,
278 38 budinero
    clk_I => clk_I,
279
    first_channel_I => first_channel_I
280 36 budinero
  );
281
 
282
  --------------------------------------------------------------------------------------------------
283
  -- Instantiation of Model Under Test.
284
  U_skip_0 : entity work.data_skipper --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
285
  generic map(
286
    SELECTOR_WIDTH => 5
287
  )
288
  port map (
289
    ack_O => ack_O,
290
    ack_I => ack_I,
291
    stb_I => stb_I,
292
    selector_I => selector_I,
293
    enable_skipper_I => enable_skipper_I,
294
    reset_I => reset_I,
295 38 budinero
    first_channel_I => first_channel_I,
296 36 budinero
    clk_I => clk_I
297
  );
298
end tbGeneratedCode;
299
----------------------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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