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 133

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

powered by: WebSVN 2.1.0

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