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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [ctrl/] [tbench/] [channel_selector_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: channel_selector_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
 
34
-- Additional libraries used by Model Under Test.
35
-- ...
36
 
37
 
38
 
39
----------------------------------------------------------------------------------------------------
40
entity stimulus is
41
  port (
42
 
43
    channels_I:   inout  std_logic_vector(15 downto 0);
44
    clk_I:        inout  std_logic;
45
    enable_I:     inout  std_logic;
46
    reset_I:      inout  std_logic
47
 
48
  );
49
 
50
end stimulus;
51
 
52
architecture STIMULATOR of stimulus is
53
 
54
  -- Control Signal Declarations
55
  signal tb_status : TStatus;
56
  signal tb_ParameterInitFlag : boolean := false;
57
 
58
  -- Parm Declarations
59
  signal clk_MinHL :  time := 0 ns;
60
  signal clk_MaxHL :  time := 0 ns;
61
  signal clk_MinLH :  time := 0 ns;
62
  signal clk_MaxLH :  time := 0 ns;
63
  signal clk_JFall :  time := 0 ns;
64
  signal clk_JRise :  time := 0 ns;
65
  signal clk_Duty :   real := 0.0;
66
  signal clk_Period : time := 0 ns;
67
  signal clk_Offset : time := 0 ns;
68
 
69
 
70
 
71
begin
72
  --------------------------------------------------------------------------------------------------
73
  -- Status Control block.
74
  process
75
    -- variable good : boolean;
76
  begin
77
    wait until tb_ParameterInitFlag;
78
    tb_status <= TB_ONCE;
79
    wait for 3000 ns;
80
    tb_status <= TB_DONE;  -- End of simulation
81
    wait;
82
  end process;
83
 
84
  --------------------------------------------------------------------------------------------------
85
  -- Parm Assignment Block
86
  AssignParms : process
87
    variable clk_MinHL_real :   real;
88
    variable clk_MaxHL_real :   real;
89
    variable clk_MinLH_real :   real;
90
    variable clk_MaxLH_real :   real;
91
    variable clk_JFall_real :   real;
92
    variable clk_JRise_real :   real;
93
    variable clk_Duty_real :    real;
94
    variable clk_Period_real :  real;
95
    variable clk_Offset_real :  real;
96
  begin
97
    -- Basic parameters
98
    clk_Period_real := 20.0; --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
99
    clk_Period <= clk_Period_real * 1 ns;
100
    clk_Duty_real := 50.0;
101
    clk_Duty <= clk_Duty_real;
102
 
103
    -- Aditionale parameters
104
    clk_MinHL_real := 0.0;
105
    clk_MinHL <= clk_MinHL_real * 1 ns;
106
    clk_MaxHL_real := 0.0;
107
    clk_MaxHL <= clk_MaxHL_real * 1 ns;
108
    clk_MinLH_real := 0.0;
109
    clk_MinLH <= clk_MinLH_real * 1 ns;
110
    clk_MaxLH_real := 0.0;
111
    clk_MaxLH <= clk_MaxLH_real * 1 ns;
112
    clk_JFall_real := 0.0;
113
    clk_JFall <= clk_JFall_real * 1 ns;
114
    clk_JRise_real := 0.0;
115
    clk_JRise <= clk_JRise_real * 1 ns;
116
    clk_Offset_real := 0.0;
117
    clk_Offset <= clk_Offset_real * 1 ns;
118
    tb_ParameterInitFlag <= true;
119
 
120
    wait;
121
  end process;
122
 
123
 
124
  --------------------------------------------------------------------------------------------------
125
  -- Clocks
126
  -- Clock Instantiation
127
  tb_clk : entity syncad_vhdl_lib.tb_clock_minmax
128
    generic map (name => "tb_clk",
129
                initialize => true,
130
                state1 => '1',
131
                state2 => '0')
132
    port map (tb_status,
133
              clk_I, --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
134
              clk_MinLH,
135
              clk_MaxLH,
136
              clk_MinHL,
137
              clk_MaxHL,
138
              clk_Offset,
139
              clk_Period,
140
              clk_Duty,
141
              clk_JRise,
142
              clk_JFall);
143
 
144
  -- Clocked Sequences
145
  -- ...
146
 
147
 
148
  --------------------------------------------------------------------------------------------------
149
  -- Sequence: Unclocked
150
  Unclocked : process
151
  begin
152
    -- Initial values
153
    channels_I <= "1100011011000110";
154
    enable_I <= '1';
155
 
156
    -- Expected output
157
    -- 1
158
    -- 2
159
    -- 6
160
    -- 7
161
    -- 9
162
    -- 10
163
    -- 14
164
    -- 15
165
    -- 1
166
    -- 2
167
    -- 6
168
    -- ...
169
 
170
 
171
 
172
    -- Initial reset
173
    wait for 0 ns;
174
    reset_I <= '1';
175
    wait for 35 ns;
176
    reset_I <= '0';
177
 
178
    wait for 260 ns;  enable_I <= '0';
179
    wait for 40 ns;   enable_I <= '1';
180
 
181
 
182
    wait for 80 ns;   enable_I <= '0';
183
    wait for 80 ns;   enable_I <= '1';
184
 
185
 
186
    wait for 100 ns;  reset_I  <= '1';
187
    wait for 40 ns;   reset_I  <= '0';
188
 
189
 
190
    wait for 100 ns; channels_I <= "0000000000000001";
191
    wait for 200 ns; channels_I <= "0000000000001001";
192
    wait for 200 ns; channels_I <= "1000000000000010";
193
 
194
    wait for 100 ns;  reset_I  <= '1';
195
    wait for 40 ns;   reset_I  <= '0';
196
 
197
    wait for 200 ns; channels_I <= "0000000000000000";
198
 
199
 
200
 
201
 
202
 
203
 
204
 
205
    --wait for 3000 ns;
206
    wait;
207
 
208
  end process;
209
end STIMULATOR;
210
----------------------------------------------------------------------------------------------------
211
 
212
 
213
 
214
 
215
-- Test Bench wrapper for stimulus and Model Under Test
216
 library ieee, std;
217
 use ieee.std_logic_1164.all;
218
 library syncad_vhdl_lib;
219
 use syncad_vhdl_lib.TBDefinitions.all;
220
 
221
-- Additional libraries used by Model Under Test.
222
-- ...
223
 
224
 
225
 
226
----------------------------------------------------------------------------------------------------
227
entity testbench is
228
end testbench;
229
 
230
architecture tbGeneratedCode of testbench is
231
    signal channels_I:         std_logic_vector(15 downto 0);
232
    signal channel_number_O:   std_logic_vector(3 downto 0);
233
    signal clk_I:              std_logic;
234
    signal enable_I:           std_logic;
235
    signal reset_I:            std_logic;
236 38 budinero
    signal first_channel_O:    std_logic;
237 36 budinero
 
238
begin
239
  --------------------------------------------------------------------------------------------------
240
  -- Instantiation of Stimulus.
241
  stimulus_0 : entity work.stimulus
242
    port map (
243
      channels_I        => channels_I,
244
      clk_I             => clk_I,
245
      enable_I          => enable_I,
246
      reset_I           => reset_I
247
    );
248
 
249
  --------------------------------------------------------------------------------------------------
250
  -- Instantiation of Model Under Test.
251 38 budinero
  chsel_0 : entity work.channel_selector
252 36 budinero
  port map (
253
    channels_I        => channels_I,
254
    channel_number_O  => channel_number_O,
255
    clk_I             => clk_I,
256
    enable_I          => enable_I,
257 38 budinero
    reset_I           => reset_I,
258
    first_channel_O   => first_channel_O
259 36 budinero
   );
260
end tbGeneratedCode;
261
----------------------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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