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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_6_1_beta/] [bench/] [vhdl/] [if_timing.vhd] - Blame information for rev 81

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

Line No. Rev Author Line
1 81 arniml
-------------------------------------------------------------------------------
2
--
3
-- Interface Timing Checker.
4
--
5
-- $Id: if_timing.vhd,v 1.1 2004-04-25 16:24:10 arniml Exp $
6
--
7
-- Copyright (c) 2004, Arnim Laeuger (arniml@opencores.org)
8
--
9
-- All rights reserved
10
--
11
-- Redistribution and use in source and synthezised forms, with or without
12
-- modification, are permitted provided that the following conditions are met:
13
--
14
-- Redistributions of source code must retain the above copyright notice,
15
-- this list of conditions and the following disclaimer.
16
--
17
-- Redistributions in synthesized form must reproduce the above copyright
18
-- notice, this list of conditions and the following disclaimer in the
19
-- documentation and/or other materials provided with the distribution.
20
--
21
-- Neither the name of the author nor the names of other contributors may
22
-- be used to endorse or promote products derived from this software without
23
-- specific prior written permission.
24
--
25
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26
-- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
27
-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28
-- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
29
-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30
-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35
-- POSSIBILITY OF SUCH DAMAGE.
36
--
37
-- Please report bugs to the author, but before you do so, please
38
-- make sure that this is not a derivative work and that
39
-- you have the latest version of this file.
40
--
41
-- The latest version of this file can be found at:
42
--      http://www.opencores.org/cvsweb.shtml/t48/
43
--
44
-------------------------------------------------------------------------------
45
 
46
library ieee;
47
use ieee.std_logic_1164.all;
48
 
49
entity if_timing is
50
 
51
  port (
52
    xtal_i   : in std_logic;
53
    ale_i    : in std_logic;
54
    psen_n_i : in std_logic;
55
    rd_n_i   : in std_logic;
56
    wr_n_i   : in std_logic;
57
    prog_n_i : in std_logic;
58
    db_bus_i : in std_logic_vector(7 downto 0);
59
    p2_i     : in std_logic_vector(7 downto 0)
60
  );
61
 
62
end if_timing;
63
 
64
 
65
 
66
architecture behav of if_timing is
67
 
68
  signal last_xtal_rise_s    : time;
69
  signal period_s            : time;
70
 
71
  signal last_ale_rise_s,
72
         last_ale_fall_s     : time;
73
 
74
  signal last_psen_n_rise_s,
75
         last_psen_n_fall_s  : time;
76
 
77
  signal last_rd_n_rise_s,
78
         last_rd_n_fall_s    : time;
79
 
80
  signal last_wr_n_rise_s,
81
         last_wr_n_fall_s    : time;
82
 
83
  signal last_prog_n_rise_s,
84
         last_prog_n_fall_s  : time;
85
 
86
  signal last_bus_change_s,
87
         bus_change_ale_s    : time;
88
  signal last_p2_change_s    : time;
89
 
90
  signal t_CY                : time;
91
 
92
begin
93
 
94
  t_CY <= 15 * period_s;
95
 
96
  -----------------------------------------------------------------------------
97
  -- Check RD
98
  --
99
  rd_check: process (rd_n_i)
100
  begin
101
    if rd_n_i'event then
102
 
103
      case rd_n_i is
104
        -- RD active
105
        when '0' =>
106
          -- tLAFC1: ALE to Control RD
107
          assert (now - last_ale_fall_s) > (t_CY / 5 - 75 ns)
108
            report "Timing violation of tLAFC1 on RD!"
109
            severity error;
110
 
111
          -- tAFC1: Addr Float to RD
112
          assert (now - last_bus_change_s) > (t_CY * 2/15 - 40 ns)
113
            report "Timing violation of tAFC1 on RD!"
114
            severity error;
115
 
116
        -- RD inactive
117
        when '1' =>
118
          -- tCC1: Control Pulse Width RD
119
          assert (now - last_rd_n_fall_s) > (t_CY / 2 - 200 ns)
120
            report "Timing violation of tCC1 on RD!"
121
            severity error;
122
 
123
        when others =>
124
          null;
125
      end case;
126
 
127
    end if;
128
 
129
  end process rd_check;
130
  --
131
  -----------------------------------------------------------------------------
132
 
133
 
134
  -----------------------------------------------------------------------------
135
  -- Check WR
136
  --
137
  wr_check: process (wr_n_i)
138
  begin
139
    if wr_n_i'event then
140
 
141
      case wr_n_i is
142
        -- WR active
143
        when '0' =>
144
          -- tLAFC1: ALE to Control WR
145
          assert (now - last_ale_fall_s) > (t_CY / 5 - 75 ns)
146
            report "Timing violation of tLAFC1 on WR!"
147
            severity error;
148
 
149
          -- tAW: Addr Setup to WR
150
          assert (now - bus_change_ale_s) > (t_CY / 3 - 150 ns)
151
            report "Timing violation of tAW on WR!"
152
            severity error;
153
 
154
          -- tAW sanity check
155
          assert (now - bus_change_ale_s) < t_CY
156
            report "Timing relation between BUS and WR inconsistent!"
157
            severity error;
158
 
159
        -- WR inactive
160
        when '1' =>
161
          -- tCC1: Control Pulse Width WR
162
          assert (now - last_wr_n_fall_s) > (t_CY / 2 - 200 ns)
163
            report "Timing violation of tCC1 on WR!"
164
            severity error;
165
 
166
          -- tDW: Data Setup before WR
167
          assert (now - last_bus_change_s) > (t_CY * 13/30 - 200 ns)
168
            report "Timing violation of tDW on WR!"
169
            severity error;
170
 
171
        when others =>
172
          null;
173
      end case;
174
 
175
    end if;
176
 
177
  end process wr_check;
178
  --
179
  -----------------------------------------------------------------------------
180
 
181
 
182
  -----------------------------------------------------------------------------
183
  -- Check BUS
184
  --
185
  bus_check: process (db_bus_i)
186
  begin
187
    if db_bus_i'event then
188
 
189
      -- RD access
190
      -- tAD1 and tRD1 are not checked as they are constraints for the
191
      -- external memory, not the t48!
192
 
193
      -- WR access
194
      if wr_n_i = '0' then
195
        -- tDW: Data Hold after WR
196
        assert (now - last_wr_n_rise_s) > (t_CY / 15 - 50 ns)
197
          report "Timing violation of tDW on BUS vs. WR!"
198
          severity error;
199
 
200
      end if;
201
 
202
    end if;
203
 
204
  end process bus_check;
205
  --
206
  -----------------------------------------------------------------------------
207
 
208
 
209
  -----------------------------------------------------------------------------
210
  -- Monitor XTAL
211
  --
212
  xtal_mon: process
213
  begin
214
    last_xtal_rise_s     <= 0 ns;
215
    period_s             <= 90 ns;
216
 
217
    while true loop
218
      wait on xtal_i;
219
 
220
      if xtal_i = '1' then
221
        period_s         <= now - last_xtal_rise_s;
222
        last_xtal_rise_s <= now;
223
      end if;
224
 
225
    end loop;
226
 
227
  end process xtal_mon;
228
  --
229
  -----------------------------------------------------------------------------
230
 
231
 
232
  -----------------------------------------------------------------------------
233
  -- Monitor ALE
234
  --
235
  ale_mon: process
236
  begin
237
    last_ale_rise_s       <= 0 ns;
238
    last_ale_fall_s       <= 0 ns;
239
 
240
    while true loop
241
      wait on ale_i;
242
 
243
      case ale_i is
244
        when '0' =>
245
          last_ale_fall_s <= now;
246
        when '1' =>
247
          last_ale_rise_s <= now;
248
        when others =>
249
          null;
250
      end case;
251
 
252
    end loop;
253
 
254
  end process ale_mon;
255
  --
256
  -----------------------------------------------------------------------------
257
 
258
 
259
  -----------------------------------------------------------------------------
260
  -- Monitor PSEN
261
  --
262
  psen_mon: process
263
  begin
264
    last_psen_n_rise_s       <= 0 ns;
265
    last_psen_n_fall_s       <= 0 ns;
266
 
267
    while true loop
268
      wait on psen_n_i;
269
 
270
      case psen_n_i is
271
        when '0' =>
272
          last_psen_n_fall_s <= now;
273
        when '1' =>
274
          last_psen_n_rise_s <= now;
275
        when others =>
276
          null;
277
      end case;
278
 
279
    end loop;
280
 
281
  end process psen_mon;
282
  --
283
  -----------------------------------------------------------------------------
284
 
285
 
286
  -----------------------------------------------------------------------------
287
  -- Monitor RD
288
  --
289
  rd_mon: process
290
  begin
291
    last_rd_n_rise_s       <= 0 ns;
292
    last_rd_n_fall_s       <= 0 ns;
293
 
294
    while true loop
295
      wait on rd_n_i;
296
 
297
      case rd_n_i is
298
        when '0' =>
299
          last_rd_n_fall_s <= now;
300
        when '1' =>
301
          last_rd_n_rise_s <= now;
302
        when others =>
303
          null;
304
      end case;
305
 
306
    end loop;
307
 
308
  end process rd_mon;
309
  --
310
  -----------------------------------------------------------------------------
311
 
312
 
313
  -----------------------------------------------------------------------------
314
  -- Monitor WR
315
  --
316
  wr_mon: process
317
  begin
318
    last_wr_n_rise_s       <= 0 ns;
319
    last_wr_n_fall_s       <= 0 ns;
320
 
321
    while true loop
322
      wait on wr_n_i;
323
 
324
      case wr_n_i is
325
        when '0' =>
326
          last_wr_n_fall_s <= now;
327
        when '1' =>
328
          last_wr_n_rise_s <= now;
329
        when others =>
330
          null;
331
      end case;
332
 
333
    end loop;
334
 
335
  end process wr_mon;
336
  --
337
  -----------------------------------------------------------------------------
338
 
339
 
340
  -----------------------------------------------------------------------------
341
  -- Monitor PROG
342
  --
343
  prog_mon: process
344
  begin
345
    last_prog_n_rise_s       <= 0 ns;
346
    last_prog_n_fall_s       <= 0 ns;
347
 
348
    while true loop
349
      wait on prog_n_i;
350
 
351
      case prog_n_i is
352
        when '0' =>
353
          last_prog_n_fall_s <= now;
354
        when '1' =>
355
          last_prog_n_rise_s <= now;
356
        when others =>
357
          null;
358
      end case;
359
 
360
    end loop;
361
 
362
  end process prog_mon;
363
  --
364
  -----------------------------------------------------------------------------
365
 
366
 
367
  -----------------------------------------------------------------------------
368
  -- Monitor BUS
369
  --
370
  bus_mon: process
371
  begin
372
    last_bus_change_s    <= 0 ns;
373
    bus_change_ale_s     <= 0 ns;
374
 
375
    while true loop
376
      wait on db_bus_i;
377
 
378
      last_bus_change_s  <= now;
379
 
380
      if ale_i = '1' then
381
        bus_change_ale_s <= now;
382
      end if;
383
    end loop;
384
 
385
  end process bus_mon;
386
  --
387
  -----------------------------------------------------------------------------
388
 
389
 
390
  -----------------------------------------------------------------------------
391
  -- Monitor P2
392
  --
393
  p2_mon: process
394
  begin
395
    last_p2_change_s   <= 0 ns;
396
 
397
    while true loop
398
      wait on p2_i;
399
 
400
      last_p2_change_s <= now;
401
    end loop;
402
 
403
  end process p2_mon;
404
  --
405
  -----------------------------------------------------------------------------
406
 
407
end behav;
408
 
409
 
410
-------------------------------------------------------------------------------
411
-- File History:
412
--
413
-- $Log: not supported by cvs2svn $
414
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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