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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_0_3_beta/] [bench/] [vhdl/] [if_timing.vhd] - Blame information for rev 292

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 81 arniml
-------------------------------------------------------------------------------
2
--
3
-- Interface Timing Checker.
4
--
5 82 arniml
-- $Id: if_timing.vhd,v 1.2 2004-04-25 20:40:58 arniml Exp $
6 81 arniml
--
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 82 arniml
    case rd_n_i is
102
      -- RD active
103
      when '0' =>
104
        -- tLAFC1: ALE to Control RD
105
        assert (now - last_ale_fall_s) > (t_CY / 5 - 75 ns)
106
          report "Timing violation of tLAFC1 on RD!"
107
          severity error;
108 81 arniml
 
109 82 arniml
        -- tAFC1: Addr Float to RD
110
        assert (now - last_bus_change_s) > (t_CY * 2/15 - 40 ns)
111
          report "Timing violation of tAFC1 on RD!"
112
          severity error;
113 81 arniml
 
114
        -- RD inactive
115 82 arniml
      when '1' =>
116
        -- tCC1: Control Pulse Width RD
117
        assert (now - last_rd_n_fall_s) > (t_CY / 2 - 200 ns)
118
          report "Timing violation of tCC1 on RD!"
119
          severity error;
120 81 arniml
 
121 82 arniml
      when others =>
122
        null;
123
    end case;
124 81 arniml
 
125
  end process rd_check;
126
  --
127
  -----------------------------------------------------------------------------
128
 
129
 
130
  -----------------------------------------------------------------------------
131
  -- Check WR
132
  --
133
  wr_check: process (wr_n_i)
134
  begin
135 82 arniml
    case wr_n_i is
136
      -- WR active
137
      when '0' =>
138
        -- tLAFC1: ALE to Control WR
139
        assert (now - last_ale_fall_s) > (t_CY / 5 - 75 ns)
140
          report "Timing violation of tLAFC1 on WR!"
141
          severity error;
142 81 arniml
 
143 82 arniml
        -- tAW: Addr Setup to WR
144
        assert (now - bus_change_ale_s) > (t_CY / 3 - 150 ns)
145
          report "Timing violation of tAW on WR!"
146
          severity error;
147 81 arniml
 
148 82 arniml
        -- tAW sanity check
149
        assert (now - bus_change_ale_s) < t_CY
150
          report "Timing relation between BUS and WR inconsistent!"
151
          severity error;
152 81 arniml
 
153
        -- WR inactive
154 82 arniml
      when '1' =>
155
        -- tCC1: Control Pulse Width WR
156
        assert (now - last_wr_n_fall_s) > (t_CY / 2 - 200 ns)
157
          report "Timing violation of tCC1 on WR!"
158
          severity error;
159 81 arniml
 
160 82 arniml
        -- tDW: Data Setup before WR
161
        assert (now - last_bus_change_s) > (t_CY * 13/30 - 200 ns)
162
          report "Timing violation of tDW on WR!"
163
          severity error;
164 81 arniml
 
165 82 arniml
      when others =>
166
        null;
167
    end case;
168 81 arniml
 
169
  end process wr_check;
170
  --
171
  -----------------------------------------------------------------------------
172
 
173
 
174
  -----------------------------------------------------------------------------
175
  -- Check BUS
176
  --
177
  bus_check: process (db_bus_i)
178
  begin
179 82 arniml
    -- RD access
180
    -- tAD1 and tRD1 are not checked as they are constraints for the
181
    -- external memory, not the t48!
182 81 arniml
 
183 82 arniml
    -- WR access
184
    if wr_n_i = '0' then
185
      -- tDW: Data Hold after WR
186
      assert (now - last_wr_n_rise_s) > (t_CY / 15 - 50 ns)
187
        report "Timing violation of tDW on BUS vs. WR!"
188
        severity error;
189 81 arniml
 
190 82 arniml
    end if;
191 81 arniml
 
192 82 arniml
    -- Address strobe
193
    if ale_i = '0' then
194
      -- tLA: Addr Hold from ALE
195
      assert (now - last_ale_fall_s) > (t_CY / 15 - 40 ns)
196
        report "Timing violation of tLA on BUS vs. ALE!"
197
        severity error;
198 81 arniml
    end if;
199
 
200
  end process bus_check;
201
  --
202
  -----------------------------------------------------------------------------
203
 
204
 
205
  -----------------------------------------------------------------------------
206 82 arniml
  -- Check ALE
207
  --
208
  ale_check: process (ale_i)
209
    variable t_CA1 : time;
210
    variable t_AL  : time;
211
  begin
212
    case ale_i is
213
      when '0' =>
214
        t_AL := t_CY * 2/15 - 110 ns;
215
 
216
        -- tAL: Addr Setup to ALE
217
        assert (now - last_bus_change_s) > t_AL
218
          report "Timing violation of tAL on BUS vs. ALE!"
219
          severity error;
220
        assert (now - last_p2_change_s) > t_AL
221
          report "Timing violation of tAL on P2 vs. ALE!"
222
          severity error;
223
 
224
      when '1' =>
225
        -- tCA1: Control to ALE (RD, WR, PROG)
226
        t_CA1 := t_CY / 15 - 40 ns;
227
 
228
        assert (now - last_rd_n_rise_s) > t_CA1
229
          report "Timing violation of tCA1 on RD vs. ALE!"
230
          severity error;
231
        assert (now - last_wr_n_rise_s) > t_CA1
232
          report "Timing violation of tCA1 on WR vs. ALE!"
233
          severity error;
234
        assert (now - last_prog_n_rise_s) > t_CA1
235
          report "Timing violation of tCA1 on PROG vs. ALE!"
236
          severity error;
237
 
238
        -- tCA2: Control to ALE (PSEN)
239
        assert (now - last_psen_n_rise_s) > (t_CY * 4/15 - 40 ns)
240
          report "Timing violation of tCA2 on PSEN vs. ALE!"
241
          severity error;
242
 
243
        -- tPL: Port 2 I/O Setup to ALE
244
        assert (now - last_p2_change_s) > (t_CY * 4/15 - 200 ns)
245
          report "Timing violation of tPL on P2 vs. ALE!"
246
          severity error;
247
 
248
      when others =>
249
        null;
250
 
251
    end case;
252
 
253
  end process ale_check;
254
  --
255
  -----------------------------------------------------------------------------
256
 
257
 
258
  -----------------------------------------------------------------------------
259
  -- Check P2
260
  --
261
  p2_check: process (p2_i)
262
  begin
263
    case ale_i is
264
      when '0' =>
265
        -- tLA: Addr Hold from ALE
266
        assert ((now - last_ale_fall_s) > (t_CY / 15 - 40 ns)) or
267
               now = 0 ns
268
          report "Timing violation of tLA on P2 vs. ALE!"
269
          severity error;
270
 
271
        if last_ale_fall_s < last_ale_rise_s then
272
          -- tPV: Port Output from ALE
273
          assert (now - last_ale_fall_s) < (t_CY * 3/10 + 100 ns)
274
            report "Timing violation of tPV on P2 vs. ALE!"
275
            severity error;
276
        end if;
277
 
278
        if prog_n_i = '1' then
279
          -- tPD: Output Data Hold
280
          assert ((now - last_prog_n_rise_s) > (t_CY / 10 - 50 ns)) or
281
                 now = 0 ns
282
            report "Timing violation of tPD on P2 vs. PROG!"
283
            severity error;
284
 
285
        end if;
286
 
287
      when '1' =>
288
        -- tLP: Port 2 I/O to ALE
289
        assert (now - last_ale_rise_s) > (t_CY / 30 - 30 ns)
290
          report "Timing violation of tLP on P2 vs. ALE!"
291
          severity error;
292
 
293
      when others =>
294
        null;
295
 
296
    end case;
297
 
298
  end process p2_check;
299
  --
300
  -----------------------------------------------------------------------------
301
 
302
 
303
  -----------------------------------------------------------------------------
304
  -- Check PROG
305
  --
306
  prog_check: process (prog_n_i)
307
  begin
308
    case prog_n_i is
309
      when '1' =>
310
        -- tPP: PROG Pulse Width
311
        assert (now - last_prog_n_fall_s) > (t_CY * 7/10 - 250 ns)
312
          report "Timing violation of tPP!"
313
          severity error;
314
 
315
        -- tDP: Output Data Setup
316
        assert (now - last_p2_change_s) > (t_CY * 2/5 - 150 ns)
317
          report "Timing violation of tDP on P2 vs. PROG!"
318
          severity error;
319
 
320
      when others =>
321
        null;
322
    end case;
323
 
324
  end process prog_check;
325
  --
326
  -----------------------------------------------------------------------------
327
 
328
 
329
  -----------------------------------------------------------------------------
330 81 arniml
  -- Monitor XTAL
331
  --
332
  xtal_mon: process
333
  begin
334
    last_xtal_rise_s     <= 0 ns;
335
    period_s             <= 90 ns;
336
 
337
    while true loop
338
      wait on xtal_i;
339
 
340
      if xtal_i = '1' then
341
        period_s         <= now - last_xtal_rise_s;
342
        last_xtal_rise_s <= now;
343
      end if;
344
 
345
    end loop;
346
 
347
  end process xtal_mon;
348
  --
349
  -----------------------------------------------------------------------------
350
 
351
 
352
  -----------------------------------------------------------------------------
353
  -- Monitor ALE
354
  --
355
  ale_mon: process
356
  begin
357
    last_ale_rise_s       <= 0 ns;
358
    last_ale_fall_s       <= 0 ns;
359
 
360
    while true loop
361
      wait on ale_i;
362
 
363
      case ale_i is
364
        when '0' =>
365
          last_ale_fall_s <= now;
366
        when '1' =>
367
          last_ale_rise_s <= now;
368
        when others =>
369
          null;
370
      end case;
371
 
372
    end loop;
373
 
374
  end process ale_mon;
375
  --
376
  -----------------------------------------------------------------------------
377
 
378
 
379
  -----------------------------------------------------------------------------
380
  -- Monitor PSEN
381
  --
382
  psen_mon: process
383
  begin
384
    last_psen_n_rise_s       <= 0 ns;
385
    last_psen_n_fall_s       <= 0 ns;
386
 
387
    while true loop
388
      wait on psen_n_i;
389
 
390
      case psen_n_i is
391
        when '0' =>
392
          last_psen_n_fall_s <= now;
393
        when '1' =>
394
          last_psen_n_rise_s <= now;
395
        when others =>
396
          null;
397
      end case;
398
 
399
    end loop;
400
 
401
  end process psen_mon;
402
  --
403
  -----------------------------------------------------------------------------
404
 
405
 
406
  -----------------------------------------------------------------------------
407
  -- Monitor RD
408
  --
409
  rd_mon: process
410
  begin
411
    last_rd_n_rise_s       <= 0 ns;
412
    last_rd_n_fall_s       <= 0 ns;
413
 
414
    while true loop
415
      wait on rd_n_i;
416
 
417
      case rd_n_i is
418
        when '0' =>
419
          last_rd_n_fall_s <= now;
420
        when '1' =>
421
          last_rd_n_rise_s <= now;
422
        when others =>
423
          null;
424
      end case;
425
 
426
    end loop;
427
 
428
  end process rd_mon;
429
  --
430
  -----------------------------------------------------------------------------
431
 
432
 
433
  -----------------------------------------------------------------------------
434
  -- Monitor WR
435
  --
436
  wr_mon: process
437
  begin
438
    last_wr_n_rise_s       <= 0 ns;
439
    last_wr_n_fall_s       <= 0 ns;
440
 
441
    while true loop
442
      wait on wr_n_i;
443
 
444
      case wr_n_i is
445
        when '0' =>
446
          last_wr_n_fall_s <= now;
447
        when '1' =>
448
          last_wr_n_rise_s <= now;
449
        when others =>
450
          null;
451
      end case;
452
 
453
    end loop;
454
 
455
  end process wr_mon;
456
  --
457
  -----------------------------------------------------------------------------
458
 
459
 
460
  -----------------------------------------------------------------------------
461
  -- Monitor PROG
462
  --
463
  prog_mon: process
464
  begin
465
    last_prog_n_rise_s       <= 0 ns;
466
    last_prog_n_fall_s       <= 0 ns;
467
 
468
    while true loop
469
      wait on prog_n_i;
470
 
471
      case prog_n_i is
472
        when '0' =>
473
          last_prog_n_fall_s <= now;
474
        when '1' =>
475
          last_prog_n_rise_s <= now;
476
        when others =>
477
          null;
478
      end case;
479
 
480
    end loop;
481
 
482
  end process prog_mon;
483
  --
484
  -----------------------------------------------------------------------------
485
 
486
 
487
  -----------------------------------------------------------------------------
488
  -- Monitor BUS
489
  --
490
  bus_mon: process
491
  begin
492
    last_bus_change_s    <= 0 ns;
493
    bus_change_ale_s     <= 0 ns;
494
 
495
    while true loop
496
      wait on db_bus_i;
497
 
498
      last_bus_change_s  <= now;
499
 
500
      if ale_i = '1' then
501
        bus_change_ale_s <= now;
502
      end if;
503
    end loop;
504
 
505
  end process bus_mon;
506
  --
507
  -----------------------------------------------------------------------------
508
 
509
 
510
  -----------------------------------------------------------------------------
511
  -- Monitor P2
512
  --
513
  p2_mon: process
514
  begin
515
    last_p2_change_s   <= 0 ns;
516
 
517
    while true loop
518
      wait on p2_i;
519
 
520
      last_p2_change_s <= now;
521
    end loop;
522
 
523
  end process p2_mon;
524
  --
525
  -----------------------------------------------------------------------------
526
 
527
end behav;
528
 
529
 
530
-------------------------------------------------------------------------------
531
-- File History:
532
--
533
-- $Log: not supported by cvs2svn $
534 82 arniml
-- Revision 1.1  2004/04/25 16:24:10  arniml
535
-- initial check-in
536
--
537 81 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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