Project

General

Profile

Download (3.66 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
-- Copyright (C) 2001 Bill Billowitch.
3

    
4
-- Some of the work to develop this test suite was done with Air Force
5
-- support.  The Air Force and Bill Billowitch assume no
6
-- responsibilities for this software.
7

    
8
-- This file is part of VESTs (Vhdl tESTs).
9

    
10
-- VESTs is free software; you can redistribute it and/or modify it
11
-- under the terms of the GNU General Public License as published by the
12
-- Free Software Foundation; either version 2 of the License, or (at
13
-- your option) any later version. 
14

    
15
-- VESTs is distributed in the hope that it will be useful, but WITHOUT
16
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17
-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18
-- for more details. 
19

    
20
-- You should have received a copy of the GNU General Public License
21
-- along with VESTs; if not, write to the Free Software Foundation,
22
-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
23

    
24
-- ---------------------------------------------------------------------
25
--
26
-- $Id: tc141.vhd,v 1.2 2001-10-26 16:29:41 paw Exp $
27
-- $Revision: 1.2 $
28
--
29
-- ---------------------------------------------------------------------
30

    
31
ENTITY c04s03b02x02p09n01i00141ent IS
32
  FUNCTION addup (i1,i2,i3:INTEGER:=5) RETURN INTEGER IS
33
  BEGIN
34
    RETURN (i1+i2+i3);
35
  END;
36
END c04s03b02x02p09n01i00141ent;
37

    
38
ARCHITECTURE c04s03b02x02p09n01i00141arch OF c04s03b02x02p09n01i00141ent IS
39
  SIGNAL a1 : INTEGER := 57;
40
  SIGNAL a2 : INTEGER := 68;
41
  SIGNAL a3 : INTEGER := 77;
42
  SIGNAL i1 : INTEGER := 0;
43
  SIGNAL i2 : INTEGER := 0;
44
  SIGNAL i3 : INTEGER := 0;
45
  SIGNAL i4 : INTEGER := 0;
46
  SIGNAL i5 : INTEGER := 0;
47
BEGIN
48
  TESTING: PROCESS
49
  BEGIN
50
    WAIT FOR 1 ns;
51
    i1 <= addup(i2=>a1,i1=>a1);
52
    WAIT FOR 1 ns;
53
    IF (i1 = 119) THEN
54
      ASSERT false REPORT "PASS: Function call uses same actual twice plus default" SEVERITY note;
55
    ELSE
56
      ASSERT false REPORT "FAIL: Function call fails" SEVERITY error;
57
    END IF;
58
    
59
    WAIT FOR 1 ns;
60
    i2 <= addup(i3=>a2,i1=>a2,i2=>a1);
61
    WAIT FOR 1 ns;
62
    IF (i2 = 193) THEN
63
      ASSERT false REPORT "PASS: Function call uses same actual twice" SEVERITY note;
64
    ELSE
65
      ASSERT false REPORT "FAIL: Function call fails" SEVERITY error;
66
    END IF;
67
    
68
    WAIT FOR 1 ns;
69
    i3 <= addup(i3=>a3,i2=>a3,i1=>a3);
70
    WAIT FOR 1 ns;
71
    IF (i3 = 231) THEN
72
      ASSERT false REPORT "PASS: Function call uses same actual thrice" SEVERITY note;
73
    ELSE
74
      ASSERT false REPORT "FAIL: Function call fails" SEVERITY error;
75
    END IF;
76
    
77
    WAIT FOR 1 ns;
78
    i4 <= addup;
79
    WAIT FOR 1 ns;
80
    IF (i4 = 15) THEN
81
      ASSERT false REPORT "PASS: All parameters defaulted to same value" SEVERITY note;
82
    ELSE
83
      ASSERT false REPORT "FAIL: Function call fails" SEVERITY error;
84
    END IF;
85
    
86
    WAIT FOR 1 ns;
87
    i5 <= addup(addup(addup,addup,addup),addup(addup,addup,addup),addup(addup,addup,addup));
88
    WAIT FOR 1 ns;
89
    IF (i5 = 135) THEN
90
      ASSERT false REPORT "PASS: All parameters defaulted to same value recursively" SEVERITY note;
91
    ELSE
92
      ASSERT false REPORT "FAIL: Function call fails" SEVERITY error;
93
    END IF;
94
    wait for 5 ns;
95
    assert NOT(   i1 = 119   and
96
                  i2 = 193   and
97
                  i3 = 231   and
98
                  i4 = 15      and
99
                  i5 = 135   ) 
100
      report "***PASSED TEST: c04s03b02x02p09n01i00141"
101
      severity NOTE;
102
    assert (   i1 = 119   and
103
               i2 = 193   and
104
               i3 = 231   and
105
               i4 = 15      and
106
               i5 = 135   ) 
107
      report "***FAILED TEST: c04s03b02x02p09n01i00141 - Named association on function call test failed." 
108
      severity ERROR;
109
    wait;
110
  END PROCESS TESTING;
111

    
112
END c04s03b02x02p09n01i00141arch;
(181-181/2088)