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 36

Go to most recent revision | 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
    reset_I, clk_I:   inout   std_logic
57
  );
58
 
59
end stimulus;
60
 
61
architecture STIMULATOR of stimulus is
62
  -- Period
63
  constant T: real := 10.0;
64
 
65
  -- Control Signal Declarations
66
  signal tb_status : TStatus;
67
  signal tb_ParameterInitFlag : boolean := false;
68
 
69
  -- Parm Declarations
70
  signal clk_MinHL :  time := 0 ns;
71
  signal clk_MaxHL :  time := 0 ns;
72
  signal clk_MinLH :  time := 0 ns;
73
  signal clk_MaxLH :  time := 0 ns;
74
  signal clk_JFall :  time := 0 ns;
75
  signal clk_JRise :  time := 0 ns;
76
  signal clk_Duty :   real := 0.0;
77
  signal clk_Period : time := 0 ns;
78
  signal clk_Offset : time := 0 ns;
79
 
80
 
81
 
82
begin
83
  --------------------------------------------------------------------------------------------------
84
  -- Status Control block.
85
  process
86
    -- variable good : boolean;
87
  begin
88
    wait until tb_ParameterInitFlag;
89
    tb_status <= TB_ONCE;
90
    wait for 50000 ns;
91
    tb_status <= TB_DONE;  -- End of simulation
92
    wait;
93
  end process;
94
 
95
  --------------------------------------------------------------------------------------------------
96
  -- Parm Assignment Block
97
  AssignParms : process
98
    variable clk_MinHL_real :   real;
99
    variable clk_MaxHL_real :   real;
100
    variable clk_MinLH_real :   real;
101
    variable clk_MaxLH_real :   real;
102
    variable clk_JFall_real :   real;
103
    variable clk_JRise_real :   real;
104
    variable clk_Duty_real :    real;
105
    variable clk_Period_real :  real;
106
    variable clk_Offset_real :  real;
107
  begin
108
    -- Basic parameters
109
    clk_Period_real := T; --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
110
    clk_Period <= clk_Period_real * 1 ns;
111
    clk_Duty_real := 50.0;
112
    clk_Duty <= clk_Duty_real;
113
 
114
    -- Aditionale parameters
115
    clk_MinHL_real := 0.0;
116
    clk_MinHL <= clk_MinHL_real * 1 ns;
117
    clk_MaxHL_real := 0.0;
118
    clk_MaxHL <= clk_MaxHL_real * 1 ns;
119
    clk_MinLH_real := 0.0;
120
    clk_MinLH <= clk_MinLH_real * 1 ns;
121
    clk_MaxLH_real := 0.0;
122
    clk_MaxLH <= clk_MaxLH_real * 1 ns;
123
    clk_JFall_real := 0.0;
124
    clk_JFall <= clk_JFall_real * 1 ns;
125
    clk_JRise_real := 0.0;
126
    clk_JRise <= clk_JRise_real * 1 ns;
127
    clk_Offset_real := 0.0;
128
    clk_Offset <= clk_Offset_real * 1 ns;
129
    tb_ParameterInitFlag <= true;
130
 
131
    wait;
132
  end process;
133
 
134
 
135
  --------------------------------------------------------------------------------------------------
136
  -- Clocks
137
  -- Clock Instantiation
138
  tb_clk : entity syncad_vhdl_lib.tb_clock_minmax
139
    generic map (name => "tb_clk",
140
                initialize => true,
141
                state1 => '1',
142
                state2 => '0')
143
    port map (tb_status,
144
              clk_I, --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
145
              clk_MinLH,
146
              clk_MaxLH,
147
              clk_MinHL,
148
              clk_MaxHL,
149
              clk_Offset,
150
              clk_Period,
151
              clk_Duty,
152
              clk_JRise,
153
              clk_JFall);
154
 
155
  --<=============================================================================================
156
  -- Clocked Sequences
157
  -- ...
158
  --===============================================================================================>
159
 
160
 
161
  --<===============================================================================================
162
  -- Sequence: Unclocked
163
  Unclocked : process
164
    variable i: natural range 0 to 500;
165
  begin
166
 
167
    -- Initial
168
    reset_I <= '1' ;
169
    enable_skipper_I <= '0';
170
    ack_I <= '0'; stb_I <= '0';
171
    selector_I <= (others => '0');
172
      wait for 15 ns; --<delay>
173
 
174
    -- w/o en_skip
175
    reset_I <= '0';
176
      wait for T * 1 ns; --<delay>
177
 
178
    ack_I <= '1';
179
      wait for T * 1 ns; --<delay>
180
 
181
    ack_I <= '0'; stb_I <= '1';
182
      wait for T * 1 ns; --<delay>
183
 
184
    ack_I <= '1'; stb_I <= '1';
185
      wait for (3.0*T) * 1 ns; --<delay>
186
 
187
    -- w/ en_skip
188
    enable_skipper_I <= '1';
189
      wait for 10.0*T * 1 ns; --<delay>
190
 
191
    ack_I <= '1'; stb_I <= '0';
192
      wait for 4.0 * T * 1 ns; --<delay>
193
 
194
    ack_I <= '0'; stb_I <= '1';
195
      wait for 4.0*T * 1 ns; --<delay>
196
 
197
    -- selector_I /= 0
198
    ack_I <= '1'; stb_I <= '1'; selector_I <= std_logic_vector(unsigned(selector_I) + 1);
199
      wait for 20.0*T * 1 ns; --<delay>
200
 
201
    selector_I <= std_logic_vector(to_unsigned( integer(2**real(selector_I'length )/10.0), selector_I'length ));
202
      wait for 1000.0*T * 1 ns; --<delay>
203
 
204
    selector_I <= std_logic_vector(to_unsigned( integer(2**real(selector_I'length )/4.0), selector_I'length ));
205
      wait for 2000.0*T * 1 ns; --<delay>
206
 
207
    selector_I <= std_logic_vector(to_unsigned( integer(2**real(selector_I'length )-1.0), selector_I'length ));
208
      wait for 100000.0*T * 1 ns; --<delay>
209
 
210
 
211
 
212
 
213
 
214
 
215
 
216
    wait;
217
 
218
 
219
  end process;
220
  --===============================================================================================>
221
 
222
 
223
end STIMULATOR;
224
----------------------------------------------------------------------------------------------------
225
 
226
 
227
 
228
 
229
-- Test Bench wrapper for stimulus and Model Under Test
230
 library ieee, std;
231
 use ieee.std_logic_1164.all;
232
 library syncad_vhdl_lib;
233
 use syncad_vhdl_lib.TBDefinitions.all;
234
 
235
-- Additional libraries used by Model Under Test.
236
-- ...
237
 
238
 
239
 
240
----------------------------------------------------------------------------------------------------
241
entity testbench is
242
end testbench;
243
 
244
architecture tbGeneratedCode of testbench is
245
    constant SELECTOR_WIDTH: integer :=  5;
246
      -- enable output signal
247
    signal ack_O:              std_logic;
248
    -- sinal from wishbone interface
249
    signal ack_I, stb_I:       std_logic;
250
    -- selector from register
251
    signal selector_I:          std_logic_vector(SELECTOR_WIDTH-1 downto 0);
252
    -- enable from register 
253
    signal enable_skipper_I:    std_logic;
254
    -- common signals
255
    signal reset_I, clk_I:      std_logic;
256
 
257
begin
258
  --------------------------------------------------------------------------------------------------
259
  -- Instantiation of Stimulus.
260
  U_stimulus_0 : entity work.stimulus --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
261
  generic map(
262
    SELECTOR_WIDTH => SELECTOR_WIDTH
263
  )
264
  port map (
265
    ack_I => ack_I,
266
    stb_I => stb_I,
267
    selector_I => selector_I,
268
    enable_skipper_I => enable_skipper_I,
269
    reset_I => reset_I,
270
    clk_I => clk_I
271
  );
272
 
273
  --------------------------------------------------------------------------------------------------
274
  -- Instantiation of Model Under Test.
275
  U_skip_0 : entity work.data_skipper --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
276
  generic map(
277
    SELECTOR_WIDTH => 5
278
  )
279
  port map (
280
    ack_O => ack_O,
281
    ack_I => ack_I,
282
    stb_I => stb_I,
283
    selector_I => selector_I,
284
    enable_skipper_I => enable_skipper_I,
285
    reset_I => reset_I,
286
    clk_I => clk_I
287
  );
288
end tbGeneratedCode;
289
----------------------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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