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 292

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 81 arniml
-------------------------------------------------------------------------------
2
--
3
-- Interface Timing Checker.
4
--
5 200 arniml
-- $Id: if_timing.vhd,v 1.6 2005-11-01 21:20:36 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 200 arniml
      when '0' =>
313
        -- tCP: Port Control Setup to PROG'
314
        assert (now - last_p2_change_s) > (t_CY * 2/15 - 80 ns)
315
          report "Timing violation of tCP on P2 vs PROG'!"
316
          severity error;
317
 
318 82 arniml
      when '1' =>
319
        -- tPP: PROG Pulse Width
320
        assert (now - last_prog_n_fall_s) > (t_CY * 7/10 - 250 ns)
321
          report "Timing violation of tPP!"
322
          severity error;
323
 
324
        -- tDP: Output Data Setup
325
        assert (now - last_p2_change_s) > (t_CY * 2/5 - 150 ns)
326
          report "Timing violation of tDP on P2 vs. PROG!"
327
          severity error;
328
 
329
      when others =>
330
        null;
331
    end case;
332
 
333
  end process prog_check;
334
  --
335
  -----------------------------------------------------------------------------
336
 
337
 
338
  -----------------------------------------------------------------------------
339 133 arniml
  -- Check PSEN
340
  --
341
  psen_check: process (psen_n_i)
342
  begin
343
    case psen_n_i is
344
      when '1' =>
345
        -- tCC2: Control Pulse Width PSEN
346
        assert (now - last_psen_n_fall_s) > (t_CY * 2/5 - 200 ns)
347
          report "Timing violation of tCC2 on PSEN!"
348
          severity error;
349
 
350
      when '0' =>
351
        -- tLAFC2: ALE to Control PSEN
352
        assert (now - last_ale_fall_s) > (t_CY / 10 - 75 ns)
353
          report "Timing violation of tLAFC2 on PSEN vs. ALE!"
354
          severity error;
355
 
356
      when others =>
357
        null;
358
 
359
    end case;
360
 
361
  end process psen_check;
362
  --
363
  -----------------------------------------------------------------------------
364
 
365
 
366
  -----------------------------------------------------------------------------
367
  -- Check cycle overlap
368
  --
369
  cycle_overlap_check: process (psen_n_i,
370
                                rd_n_i,
371
                                wr_n_i)
372
    variable tmp_v : std_logic_vector(2 downto 0);
373
  begin
374
    tmp_v := psen_n_i & rd_n_i & wr_n_i;
375
    case tmp_v is
376
      when "001" |
377
           "010" |
378
           "100" |
379
           "000" =>
380
        assert false
381
          report "Cycle overlap deteced on PSEN, RD and WR!"
382
          severity error;
383 160 arniml
      when others =>
384
        null;
385 133 arniml
 
386
    end case;
387
 
388
  end process cycle_overlap_check;
389
  --
390
  -----------------------------------------------------------------------------
391
 
392
 
393
  -----------------------------------------------------------------------------
394 81 arniml
  -- Monitor XTAL
395
  --
396
  xtal_mon: process
397
  begin
398
    last_xtal_rise_s     <= 0 ns;
399
    period_s             <= 90 ns;
400
 
401
    while true loop
402
      wait on xtal_i;
403
 
404
      if xtal_i = '1' then
405
        period_s         <= now - last_xtal_rise_s;
406
        last_xtal_rise_s <= now;
407
      end if;
408
 
409
    end loop;
410
 
411
  end process xtal_mon;
412
  --
413
  -----------------------------------------------------------------------------
414
 
415
 
416
  -----------------------------------------------------------------------------
417
  -- Monitor ALE
418
  --
419
  ale_mon: process
420
  begin
421
    last_ale_rise_s       <= 0 ns;
422
    last_ale_fall_s       <= 0 ns;
423
 
424
    while true loop
425
      wait on ale_i;
426
 
427
      case ale_i is
428
        when '0' =>
429
          last_ale_fall_s <= now;
430
        when '1' =>
431
          last_ale_rise_s <= now;
432
        when others =>
433
          null;
434
      end case;
435
 
436
    end loop;
437
 
438
  end process ale_mon;
439
  --
440
  -----------------------------------------------------------------------------
441
 
442
 
443
  -----------------------------------------------------------------------------
444
  -- Monitor PSEN
445
  --
446
  psen_mon: process
447
  begin
448
    last_psen_n_rise_s       <= 0 ns;
449
    last_psen_n_fall_s       <= 0 ns;
450
 
451
    while true loop
452
      wait on psen_n_i;
453
 
454
      case psen_n_i is
455
        when '0' =>
456
          last_psen_n_fall_s <= now;
457
        when '1' =>
458
          last_psen_n_rise_s <= now;
459
        when others =>
460
          null;
461
      end case;
462
 
463
    end loop;
464
 
465
  end process psen_mon;
466
  --
467
  -----------------------------------------------------------------------------
468
 
469
 
470
  -----------------------------------------------------------------------------
471
  -- Monitor RD
472
  --
473
  rd_mon: process
474
  begin
475
    last_rd_n_rise_s       <= 0 ns;
476
    last_rd_n_fall_s       <= 0 ns;
477
 
478
    while true loop
479
      wait on rd_n_i;
480
 
481
      case rd_n_i is
482
        when '0' =>
483
          last_rd_n_fall_s <= now;
484
        when '1' =>
485
          last_rd_n_rise_s <= now;
486
        when others =>
487
          null;
488
      end case;
489
 
490
    end loop;
491
 
492
  end process rd_mon;
493
  --
494
  -----------------------------------------------------------------------------
495
 
496
 
497
  -----------------------------------------------------------------------------
498
  -- Monitor WR
499
  --
500
  wr_mon: process
501
  begin
502
    last_wr_n_rise_s       <= 0 ns;
503
    last_wr_n_fall_s       <= 0 ns;
504
 
505
    while true loop
506
      wait on wr_n_i;
507
 
508
      case wr_n_i is
509
        when '0' =>
510
          last_wr_n_fall_s <= now;
511
        when '1' =>
512
          last_wr_n_rise_s <= now;
513
        when others =>
514
          null;
515
      end case;
516
 
517
    end loop;
518
 
519
  end process wr_mon;
520
  --
521
  -----------------------------------------------------------------------------
522
 
523
 
524
  -----------------------------------------------------------------------------
525
  -- Monitor PROG
526
  --
527
  prog_mon: process
528
  begin
529
    last_prog_n_rise_s       <= 0 ns;
530
    last_prog_n_fall_s       <= 0 ns;
531
 
532
    while true loop
533
      wait on prog_n_i;
534
 
535
      case prog_n_i is
536
        when '0' =>
537
          last_prog_n_fall_s <= now;
538
        when '1' =>
539
          last_prog_n_rise_s <= now;
540
        when others =>
541
          null;
542
      end case;
543
 
544
    end loop;
545
 
546
  end process prog_mon;
547
  --
548
  -----------------------------------------------------------------------------
549
 
550
 
551
  -----------------------------------------------------------------------------
552
  -- Monitor BUS
553
  --
554
  bus_mon: process
555
  begin
556
    last_bus_change_s    <= 0 ns;
557
    bus_change_ale_s     <= 0 ns;
558
 
559
    while true loop
560
      wait on db_bus_i;
561
 
562
      last_bus_change_s  <= now;
563
 
564
      if ale_i = '1' then
565
        bus_change_ale_s <= now;
566
      end if;
567
    end loop;
568
 
569
  end process bus_mon;
570
  --
571
  -----------------------------------------------------------------------------
572
 
573
 
574
  -----------------------------------------------------------------------------
575
  -- Monitor P2
576
  --
577
  p2_mon: process
578
  begin
579
    last_p2_change_s   <= 0 ns;
580
 
581
    while true loop
582
      wait on p2_i;
583
 
584
      last_p2_change_s <= now;
585
    end loop;
586
 
587
  end process p2_mon;
588
  --
589
  -----------------------------------------------------------------------------
590
 
591
end behav;
592
 
593
 
594
-------------------------------------------------------------------------------
595
-- File History:
596
--
597
-- $Log: not supported by cvs2svn $
598 200 arniml
-- Revision 1.5  2004/12/03 19:58:55  arniml
599
-- add others to case statement
600
--
601 160 arniml
-- Revision 1.4  2004/10/25 19:33:13  arniml
602
-- remove tAW sanity check
603
-- conflicts with OUTL A, BUS
604
--
605 140 arniml
-- Revision 1.3  2004/09/12 00:31:50  arniml
606
-- add checks for PSEN
607
--
608 133 arniml
-- Revision 1.2  2004/04/25 20:40:58  arniml
609
-- check expander timings
610
--
611 82 arniml
-- Revision 1.1  2004/04/25 16:24:10  arniml
612
-- initial check-in
613
--
614 81 arniml
-------------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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