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

Subversion Repositories t48

[/] [t48/] [tags/] [rel_1_2/] [bench/] [vhdl/] [if_timing.vhd] - Blame information for rev 140

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 140 arniml
-- $Id: if_timing.vhd,v 1.4 2004-10-25 19:33:13 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
        -- WR inactive
149 82 arniml
      when '1' =>
150
        -- tCC1: Control Pulse Width WR
151
        assert (now - last_wr_n_fall_s) > (t_CY / 2 - 200 ns)
152
          report "Timing violation of tCC1 on WR!"
153
          severity error;
154 81 arniml
 
155 82 arniml
        -- tDW: Data Setup before WR
156
        assert (now - last_bus_change_s) > (t_CY * 13/30 - 200 ns)
157
          report "Timing violation of tDW on WR!"
158
          severity error;
159 81 arniml
 
160 82 arniml
      when others =>
161
        null;
162
    end case;
163 81 arniml
 
164
  end process wr_check;
165
  --
166
  -----------------------------------------------------------------------------
167
 
168
 
169
  -----------------------------------------------------------------------------
170
  -- Check BUS
171
  --
172
  bus_check: process (db_bus_i)
173
  begin
174 82 arniml
    -- RD access
175
    -- tAD1 and tRD1 are not checked as they are constraints for the
176
    -- external memory, not the t48!
177 81 arniml
 
178 82 arniml
    -- WR access
179
    if wr_n_i = '0' then
180
      -- tDW: Data Hold after WR
181
      assert (now - last_wr_n_rise_s) > (t_CY / 15 - 50 ns)
182
        report "Timing violation of tDW on BUS vs. WR!"
183
        severity error;
184 81 arniml
 
185 82 arniml
    end if;
186 81 arniml
 
187 82 arniml
    -- Address strobe
188
    if ale_i = '0' then
189
      -- tLA: Addr Hold from ALE
190
      assert (now - last_ale_fall_s) > (t_CY / 15 - 40 ns)
191
        report "Timing violation of tLA on BUS vs. ALE!"
192
        severity error;
193 81 arniml
    end if;
194
 
195 133 arniml
    -- PSEN
196
    if psen_n_i = '0' then
197
      -- tRD2: PSEN to Data In
198
      assert (now - last_psen_n_fall_s) < (t_CY * 4/15 - 170 ns)
199
        report "Timing violation of tRD2 on BUS vs. PSEN!"
200
        severity error;
201
    end if;
202
 
203 81 arniml
  end process bus_check;
204
  --
205
  -----------------------------------------------------------------------------
206
 
207
 
208
  -----------------------------------------------------------------------------
209 82 arniml
  -- Check ALE
210
  --
211
  ale_check: process (ale_i)
212
    variable t_CA1 : time;
213
    variable t_AL  : time;
214
  begin
215
    case ale_i is
216
      when '0' =>
217
        t_AL := t_CY * 2/15 - 110 ns;
218
 
219
        -- tAL: Addr Setup to ALE
220
        assert (now - last_bus_change_s) > t_AL
221
          report "Timing violation of tAL on BUS vs. ALE!"
222
          severity error;
223
        assert (now - last_p2_change_s) > t_AL
224
          report "Timing violation of tAL on P2 vs. ALE!"
225
          severity error;
226
 
227
      when '1' =>
228
        -- tCA1: Control to ALE (RD, WR, PROG)
229
        t_CA1 := t_CY / 15 - 40 ns;
230
 
231
        assert (now - last_rd_n_rise_s) > t_CA1
232
          report "Timing violation of tCA1 on RD vs. ALE!"
233
          severity error;
234
        assert (now - last_wr_n_rise_s) > t_CA1
235
          report "Timing violation of tCA1 on WR vs. ALE!"
236
          severity error;
237
        assert (now - last_prog_n_rise_s) > t_CA1
238
          report "Timing violation of tCA1 on PROG vs. ALE!"
239
          severity error;
240
 
241
        -- tCA2: Control to ALE (PSEN)
242
        assert (now - last_psen_n_rise_s) > (t_CY * 4/15 - 40 ns)
243
          report "Timing violation of tCA2 on PSEN vs. ALE!"
244
          severity error;
245
 
246
        -- tPL: Port 2 I/O Setup to ALE
247
        assert (now - last_p2_change_s) > (t_CY * 4/15 - 200 ns)
248
          report "Timing violation of tPL on P2 vs. ALE!"
249
          severity error;
250
 
251
      when others =>
252
        null;
253
 
254
    end case;
255
 
256
  end process ale_check;
257
  --
258
  -----------------------------------------------------------------------------
259
 
260
 
261
  -----------------------------------------------------------------------------
262
  -- Check P2
263
  --
264
  p2_check: process (p2_i)
265
  begin
266
    case ale_i is
267
      when '0' =>
268
        -- tLA: Addr Hold from ALE
269
        assert ((now - last_ale_fall_s) > (t_CY / 15 - 40 ns)) or
270
               now = 0 ns
271
          report "Timing violation of tLA on P2 vs. ALE!"
272
          severity error;
273
 
274
        if last_ale_fall_s < last_ale_rise_s then
275
          -- tPV: Port Output from ALE
276
          assert (now - last_ale_fall_s) < (t_CY * 3/10 + 100 ns)
277
            report "Timing violation of tPV on P2 vs. ALE!"
278
            severity error;
279
        end if;
280
 
281
        if prog_n_i = '1' then
282
          -- tPD: Output Data Hold
283
          assert ((now - last_prog_n_rise_s) > (t_CY / 10 - 50 ns)) or
284
                 now = 0 ns
285
            report "Timing violation of tPD on P2 vs. PROG!"
286
            severity error;
287
 
288
        end if;
289
 
290
      when '1' =>
291
        -- tLP: Port 2 I/O to ALE
292
        assert (now - last_ale_rise_s) > (t_CY / 30 - 30 ns)
293
          report "Timing violation of tLP on P2 vs. ALE!"
294
          severity error;
295
 
296
      when others =>
297
        null;
298
 
299
    end case;
300
 
301
  end process p2_check;
302
  --
303
  -----------------------------------------------------------------------------
304
 
305
 
306
  -----------------------------------------------------------------------------
307
  -- Check PROG
308
  --
309
  prog_check: process (prog_n_i)
310
  begin
311
    case prog_n_i is
312
      when '1' =>
313
        -- tPP: PROG Pulse Width
314
        assert (now - last_prog_n_fall_s) > (t_CY * 7/10 - 250 ns)
315
          report "Timing violation of tPP!"
316
          severity error;
317
 
318
        -- tDP: Output Data Setup
319
        assert (now - last_p2_change_s) > (t_CY * 2/5 - 150 ns)
320
          report "Timing violation of tDP on P2 vs. PROG!"
321
          severity error;
322
 
323
      when others =>
324
        null;
325
    end case;
326
 
327
  end process prog_check;
328
  --
329
  -----------------------------------------------------------------------------
330
 
331
 
332
  -----------------------------------------------------------------------------
333 133 arniml
  -- Check PSEN
334
  --
335
  psen_check: process (psen_n_i)
336
  begin
337
    case psen_n_i is
338
      when '1' =>
339
        -- tCC2: Control Pulse Width PSEN
340
        assert (now - last_psen_n_fall_s) > (t_CY * 2/5 - 200 ns)
341
          report "Timing violation of tCC2 on PSEN!"
342
          severity error;
343
 
344
      when '0' =>
345
        -- tLAFC2: ALE to Control PSEN
346
        assert (now - last_ale_fall_s) > (t_CY / 10 - 75 ns)
347
          report "Timing violation of tLAFC2 on PSEN vs. ALE!"
348
          severity error;
349
 
350
      when others =>
351
        null;
352
 
353
    end case;
354
 
355
  end process psen_check;
356
  --
357
  -----------------------------------------------------------------------------
358
 
359
 
360
  -----------------------------------------------------------------------------
361
  -- Check cycle overlap
362
  --
363
  cycle_overlap_check: process (psen_n_i,
364
                                rd_n_i,
365
                                wr_n_i)
366
    variable tmp_v : std_logic_vector(2 downto 0);
367
  begin
368
    tmp_v := psen_n_i & rd_n_i & wr_n_i;
369
    case tmp_v is
370
      when "001" |
371
           "010" |
372
           "100" |
373
           "000" =>
374
        assert false
375
          report "Cycle overlap deteced on PSEN, RD and WR!"
376
          severity error;
377
 
378
    end case;
379
 
380
  end process cycle_overlap_check;
381
  --
382
  -----------------------------------------------------------------------------
383
 
384
 
385
  -----------------------------------------------------------------------------
386 81 arniml
  -- Monitor XTAL
387
  --
388
  xtal_mon: process
389
  begin
390
    last_xtal_rise_s     <= 0 ns;
391
    period_s             <= 90 ns;
392
 
393
    while true loop
394
      wait on xtal_i;
395
 
396
      if xtal_i = '1' then
397
        period_s         <= now - last_xtal_rise_s;
398
        last_xtal_rise_s <= now;
399
      end if;
400
 
401
    end loop;
402
 
403
  end process xtal_mon;
404
  --
405
  -----------------------------------------------------------------------------
406
 
407
 
408
  -----------------------------------------------------------------------------
409
  -- Monitor ALE
410
  --
411
  ale_mon: process
412
  begin
413
    last_ale_rise_s       <= 0 ns;
414
    last_ale_fall_s       <= 0 ns;
415
 
416
    while true loop
417
      wait on ale_i;
418
 
419
      case ale_i is
420
        when '0' =>
421
          last_ale_fall_s <= now;
422
        when '1' =>
423
          last_ale_rise_s <= now;
424
        when others =>
425
          null;
426
      end case;
427
 
428
    end loop;
429
 
430
  end process ale_mon;
431
  --
432
  -----------------------------------------------------------------------------
433
 
434
 
435
  -----------------------------------------------------------------------------
436
  -- Monitor PSEN
437
  --
438
  psen_mon: process
439
  begin
440
    last_psen_n_rise_s       <= 0 ns;
441
    last_psen_n_fall_s       <= 0 ns;
442
 
443
    while true loop
444
      wait on psen_n_i;
445
 
446
      case psen_n_i is
447
        when '0' =>
448
          last_psen_n_fall_s <= now;
449
        when '1' =>
450
          last_psen_n_rise_s <= now;
451
        when others =>
452
          null;
453
      end case;
454
 
455
    end loop;
456
 
457
  end process psen_mon;
458
  --
459
  -----------------------------------------------------------------------------
460
 
461
 
462
  -----------------------------------------------------------------------------
463
  -- Monitor RD
464
  --
465
  rd_mon: process
466
  begin
467
    last_rd_n_rise_s       <= 0 ns;
468
    last_rd_n_fall_s       <= 0 ns;
469
 
470
    while true loop
471
      wait on rd_n_i;
472
 
473
      case rd_n_i is
474
        when '0' =>
475
          last_rd_n_fall_s <= now;
476
        when '1' =>
477
          last_rd_n_rise_s <= now;
478
        when others =>
479
          null;
480
      end case;
481
 
482
    end loop;
483
 
484
  end process rd_mon;
485
  --
486
  -----------------------------------------------------------------------------
487
 
488
 
489
  -----------------------------------------------------------------------------
490
  -- Monitor WR
491
  --
492
  wr_mon: process
493
  begin
494
    last_wr_n_rise_s       <= 0 ns;
495
    last_wr_n_fall_s       <= 0 ns;
496
 
497
    while true loop
498
      wait on wr_n_i;
499
 
500
      case wr_n_i is
501
        when '0' =>
502
          last_wr_n_fall_s <= now;
503
        when '1' =>
504
          last_wr_n_rise_s <= now;
505
        when others =>
506
          null;
507
      end case;
508
 
509
    end loop;
510
 
511
  end process wr_mon;
512
  --
513
  -----------------------------------------------------------------------------
514
 
515
 
516
  -----------------------------------------------------------------------------
517
  -- Monitor PROG
518
  --
519
  prog_mon: process
520
  begin
521
    last_prog_n_rise_s       <= 0 ns;
522
    last_prog_n_fall_s       <= 0 ns;
523
 
524
    while true loop
525
      wait on prog_n_i;
526
 
527
      case prog_n_i is
528
        when '0' =>
529
          last_prog_n_fall_s <= now;
530
        when '1' =>
531
          last_prog_n_rise_s <= now;
532
        when others =>
533
          null;
534
      end case;
535
 
536
    end loop;
537
 
538
  end process prog_mon;
539
  --
540
  -----------------------------------------------------------------------------
541
 
542
 
543
  -----------------------------------------------------------------------------
544
  -- Monitor BUS
545
  --
546
  bus_mon: process
547
  begin
548
    last_bus_change_s    <= 0 ns;
549
    bus_change_ale_s     <= 0 ns;
550
 
551
    while true loop
552
      wait on db_bus_i;
553
 
554
      last_bus_change_s  <= now;
555
 
556
      if ale_i = '1' then
557
        bus_change_ale_s <= now;
558
      end if;
559
    end loop;
560
 
561
  end process bus_mon;
562
  --
563
  -----------------------------------------------------------------------------
564
 
565
 
566
  -----------------------------------------------------------------------------
567
  -- Monitor P2
568
  --
569
  p2_mon: process
570
  begin
571
    last_p2_change_s   <= 0 ns;
572
 
573
    while true loop
574
      wait on p2_i;
575
 
576
      last_p2_change_s <= now;
577
    end loop;
578
 
579
  end process p2_mon;
580
  --
581
  -----------------------------------------------------------------------------
582
 
583
end behav;
584
 
585
 
586
-------------------------------------------------------------------------------
587
-- File History:
588
--
589
-- $Log: not supported by cvs2svn $
590 140 arniml
-- Revision 1.3  2004/09/12 00:31:50  arniml
591
-- add checks for PSEN
592
--
593 133 arniml
-- Revision 1.2  2004/04/25 20:40:58  arniml
594
-- check expander timings
595
--
596 82 arniml
-- Revision 1.1  2004/04/25 16:24:10  arniml
597
-- initial check-in
598
--
599 81 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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