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

Subversion Repositories modular_oscilloscope

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 budinero
-------------------------------------------------------------------------------------------------100
2
--| Modular Oscilloscope
3
--| UNSL - Argentine
4
--|
5
--| File: ctrl_output_manager_tbench_text.vhd
6
--| Version: 0.01
7
--| Tested in: Actel A3PE1500
8
--|-------------------------------------------------------------------------------------------------
9
--| Description:
10
--|   This file is only for test purposes. 
11
--|-------------------------------------------------------------------------------------------------
12
--| File history:
13
--|   0.01  | jul-2009 | First release
14
----------------------------------------------------------------------------------------------------
15
--| Copyright © 2009, Facundo Aguilera.
16
--|
17
--| This VHDL design file is an open design; you can redistribute it and/or
18
--| modify it and/or implement it after contacting the author.
19
----------------------------------------------------------------------------------------------------
20
 
21
 
22
 
23
 
24
 
25
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 
26
library ieee;
27
use ieee.std_logic_1164.all;
28
use ieee.math_real.all;
29
 
30
entity ctrl_tb_simple_clock is
31
  port (
32
    CLK_PERIOD: in time;-- := 20 ns;
33
    CLK_DUTY:  in  real; -- := 0.5;
34
    active:  in     boolean;
35
    clk_o:   out    std_logic
36
  );
37
end entity ctrl_tb_simple_clock ;
38
 
39
architecture beh of ctrl_tb_simple_clock is
40
begin
41
  P_main: process
42
  begin
43
    wait until active;
44
    while (active = true) loop
45
      clk_o <= '0';
46
      wait for CLK_PERIOD * (100.0 - clk_Duty)/100.0;
47
      clk_o <= '1';
48
      wait for CLK_PERIOD * clk_Duty/100.0;
49
    end loop;
50
    clk_o <= '0';
51
    wait;
52
  end process;
53
end architecture beh;
54
 
55
 
56
 
57
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
58
library ieee, std;
59
use ieee.std_logic_1164.all;
60
use ieee.std_logic_unsigned.all;
61
use IEEE.NUMERIC_STD.ALL;
62
 
63
 
64
-- Additional libraries used by Model Under Test.
65
use ieee.math_real.all;
66
 
67
entity stimulus is
68
   generic(
69
    MEM_ADD_WIDTH: integer :=  14
70
  );
71
  port(
72
    ACK_I_mem: inout std_logic ;
73
    DAT_I_mem: inout std_logic_vector (15 downto 0);
74
 
75
    CYC_I_port: inout std_logic;
76
    STB_I_port: inout std_logic;
77
    WE_I_port:  inout std_logic;
78
    RST_I:      inout std_logic;
79
    CLK_I:      inout std_logic;
80
 
81
    load_I:             inout std_logic;
82
    enable_I:           inout std_logic;
83
    initial_address_I:  inout std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
84
    biggest_address_I:  inout std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
85
    pause_address_I:    inout std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
86
 
87
    finish_O:  in std_logic;
88
    CYC_O_mem:  in std_logic;
89
    STB_O_mem:  in std_logic;
90
    ADR_O_mem: in std_logic_vector (MEM_ADD_WIDTH - 1 downto 0)
91
  );
92
 
93
end stimulus;
94
 
95
architecture STIMULATOR of stimulus is
96
 
97
  -- Control Signal Declarations
98
  signal tb_InitFlag : boolean := false;
99
  signal tb_ParameterInitFlag : boolean := false;
100
  signal i: std_logic;
101
 
102
 
103
  -- Parm Declarations
104
  signal clk_Duty :   real := 0.0;
105
  signal clk_Period : time := 0 ns;
106
 
107
 
108
begin
109
  --------------------------------------------------------------------------------------------------
110
  -- Parm Assignment Block
111
  AssignParms : process
112
    variable clk_Duty_real :    real;
113
    variable clk_Period_real :  real;
114
  begin
115
    -- Basic parameters
116
    clk_Period_real := 20.0; --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
117
    clk_Period <= clk_Period_real * 1 ns;
118
    clk_Duty_real := 50.0;
119
    clk_Duty <= clk_Duty_real;
120
 
121
    tb_ParameterInitFlag <= true;
122
 
123
    wait;
124
  end process;
125
 
126
 
127
  --------------------------------------------------------------------------------------------------
128
  -- Clocks
129
  -- Clock Instantiation
130
  tb_clk: entity work.tb_simple_clock
131
  port map (
132
    clk_Period => clk_Period,
133
    clk_Duty => clk_Duty,
134
    active => tb_InitFlag,
135
    clk_o => CLK_I
136
  );
137
 
138
 
139
  --------------------------------------------------------------------------------------------------
140
  -- Clocked Sequences
141
 
142
 
143
 
144
  --------------------------------------------------------------------------------------------------
145
  -- Sequence: Unclocked
146
  Unclocked : process
147
 
148
  begin
149
    wait until tb_ParameterInitFlag;
150
    tb_InitFlag <= true;
151
 
152
    load_I <= '0';
153
    RST_I <= '1';
154
    STB_I_port <= '1';
155
    CYC_I_port <= '1';
156
    WE_I_port <= '0';
157
    initial_address_I <= B"01_0000_0000_0000";
158
    biggest_address_I <= B"11_1100_0000_0000";
159
    pause_address_I   <= B"00_0000_1000_0000";
160
    enable_I <= '1';
161
      wait for 1.5 * clk_Period;
162
 
163
    RST_I <= '0';
164
      wait for 1.0 * clk_Period;
165
 
166
    load_I <= '1';
167
      wait for 1.0 * clk_Period;
168
 
169
 
170
 
171
 
172
    load_I <= '0';
173
    wait until ADR_O_mem = B"00_0000_1000_0000";
174
      wait for 8.0 * clk_Period;
175
 
176
    pause_address_I   <= B"01_0000_0000_0000";
177
      wait for 20.0 * clk_Period;
178
 
179
    enable_I <= '0';
180
      wait for 8.0 * clk_Period;
181
 
182
    enable_I <= '1';
183
 
184
 
185
    wait until finish_O = '1';
186
      wait for 2.0 * clk_Period;
187
 
188
    tb_InitFlag <= false;
189
    wait;
190
 
191
 
192
  end process;
193
 
194
 
195
 
196
  --------------------------------------------------------------------------------------------------
197
  -- Conditional signals
198
 
199
  P_mem: process(STB_O_mem, DAT_I_mem, CYC_O_mem, CLK_I, RST_I,i)
200
 
201
  begin
202
    if STB_O_mem = '1' and CYC_O_mem = '1' and i = '1' then
203
      ACK_I_mem <= '1';
204
    else
205
      ACK_I_mem <= '0';
206
    end if;
207
 
208
    if CLK_I'event and CLK_I = '1' then
209
      if RST_I = '1' then
210
        DAT_I_mem <= (others => '0');
211
      elsif STB_O_mem = '1' and CYC_O_mem = '1' and i = '1' then
212
        DAT_I_mem <= DAT_I_mem + 1;
213
      end if;
214
    end if;
215
 
216
    if CLK_I'event and CLK_I = '1' then
217
      if RST_I = '1' then
218
        i <= '0';
219
      elsif STB_O_mem = '1' and CYC_O_mem = '1' then
220
        i <= not(i);
221
      end if;
222
    end if;
223
 
224
  end process;
225
 
226
 
227
 
228
end architecture STIMULATOR;
229
 
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
 
238
-->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
239
 library ieee, std;
240
 use ieee.std_logic_1164.all;
241
 
242
 
243
 
244
-- Additional libraries used by Model Under Test.
245
-- ...
246
 
247
entity testbench is
248
  generic (
249
    MEM_ADD_WIDTH:  integer := 14
250
  );
251
end testbench;
252
 
253
architecture tbGeneratedCode of testbench is
254
    signal DAT_I_mem:  std_logic_vector (15 downto 0);
255
    signal ADR_O_mem:  std_logic_vector (MEM_ADD_WIDTH - 1  downto 0);
256
    signal CYC_O_mem: std_logic;
257
    signal STB_O_mem: std_logic;
258
    signal ACK_I_mem: std_logic ;
259
    signal WE_O_mem:  std_logic;
260
    signal DAT_O_port: std_logic_vector (15 downto 0);
261
    signal CYC_I_port: std_logic;
262
    signal STB_I_port: std_logic;
263
    signal ACK_O_port: std_logic ;
264
    signal WE_I_port:  std_logic;
265
    signal RST_I: std_logic;
266
    signal CLK_I:             std_logic;
267
    signal load_I:             std_logic;
268
    signal enable_I:           std_logic;
269
    signal initial_address_I:  std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
270
    signal biggest_address_I:  std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
271
    signal pause_address_I:    std_logic_vector (MEM_ADD_WIDTH - 1 downto 0);
272
    signal finish_O:           std_logic;
273
 
274
begin
275
  --------------------------------------------------------------------------------------------------
276
  -- Instantiation of Stimulus.
277
  U_stimulus_0 : entity work.stimulus
278
    generic map (
279
    MEM_ADD_WIDTH=> MEM_ADD_WIDTH
280
    )
281
    port map (
282
      ACK_I_mem => ACK_I_mem,
283
      DAT_I_mem => DAT_I_mem,
284
      CYC_I_port => CYC_I_port,
285
      STB_I_port => STB_I_port,
286
      WE_I_port => WE_I_port,
287
      RST_I => RST_I,
288
      CLK_I => CLK_I,
289
      load_I => load_I,
290
      enable_I => enable_I,
291
      initial_address_I => initial_address_I,
292
      biggest_address_I => biggest_address_I,
293
      pause_address_I => pause_address_I,
294
 
295
 
296
      finish_O => finish_O,
297
      CYC_O_mem => CYC_O_mem,
298
      STB_O_mem => STB_O_mem,
299
      ADR_O_mem => ADR_O_mem
300
    );
301
 
302
  --------------------------------------------------------------------------------------------------
303
  -- Instantiation of Model Under Test.
304
  U_outman_0 : entity work.output_manager --<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--
305
    generic map (
306
 
307
    MEM_ADD_WIDTH=> MEM_ADD_WIDTH
308
    )
309
    port map (
310
      DAT_I_mem => DAT_I_mem,
311
      ADR_O_mem => ADR_O_mem,
312
      CYC_O_mem => CYC_O_mem,
313
      STB_O_mem => STB_O_mem,
314
      ACK_I_mem => ACK_I_mem,
315
      WE_O_mem => WE_O_mem,
316
      DAT_O_port => DAT_O_port,
317
      CYC_I_port => CYC_I_port,
318
      STB_I_port => STB_I_port,
319
      ACK_O_port => ACK_O_port,
320
      WE_I_port => WE_I_port,
321
      RST_I => RST_I,
322
      CLK_I => CLK_I,
323
      load_I => load_I,
324
      enable_I => enable_I,
325
      initial_address_I => initial_address_I,
326
      biggest_address_I => biggest_address_I,
327
      pause_address_I => pause_address_I,
328
      finish_O => finish_O
329
    );
330
 
331
--   U_mem0: entity work.dual_port_memory_wb
332
--   port map(
333
--     -- Port A (Higer prioriry)
334
--     RST_I_a => '0',
335
--     CLK_I_a => '0',
336
--     DAT_I_a => (others => '0'),
337
--     DAT_O_a => open,
338
--     ADR_I_a => '0',
339
--     CYC_I_a => '0',
340
--     STB_I_a => '0',
341
--     ACK_O_a => open,
342
--     WE_I_a => '0',
343
--     
344
--     -- Port B (Lower prioriry)
345
--     RST_I_b => RST_I,
346
--     CLK_I_b => CLK_I,
347
--     DAT_I_b => (others => '0'),
348
--     DAT_O_b => DAT_I_mem,
349
--     ADR_I_b => ADR_O_mem,
350
--     CYC_I_b => CYC_O_mem,
351
--     STB_I_b => STB_O_mem,
352
--     ACK_O_b => ACK_I_mem,
353
--     WE_I_b => WE_O_mem
354
--     );
355
 
356
end tbGeneratedCode;
357
----------------------------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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