Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / vhdl_json / vhdl_files / 2-exportOK / ghdl / ghdl / testsuite / vests / vhdl-93 / billowitch / compliant / tc1910.vhd @ 3fd18385

History | View | Annotate | Download (8.01 KB)

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: tc1910.vhd,v 1.2 2001-10-26 16:29:43 paw Exp $
27
-- $Revision: 1.2 $
28
--
29
-- ---------------------------------------------------------------------
30

    
31
ENTITY c07s02b00x00p09n01i01910ent IS
32
END c07s02b00x00p09n01i01910ent;
33

    
34
ARCHITECTURE c07s02b00x00p09n01i01910arch OF c07s02b00x00p09n01i01910ent IS
35

    
36
BEGIN
37
  TESTING: PROCESS
38
    -- Local declarations.
39
    variable ValueB1 : BOOLEAN;
40
    variable ValueB2 : BOOLEAN;
41
    variable ValueB3 : BOOLEAN;
42
    variable ValueB4 : BOOLEAN;
43
    variable ValueI1, SameValueI1, DifferentValueI1 : INTEGER;
44
    variable ValueI2, SameValueI2, DifferentValueI2 : INTEGER;
45
    variable ValueI3, SameValueI3, DifferentValueI3 : INTEGER;
46
    variable ValueI4, SameValueI4, DifferentValueI4 : INTEGER;
47
    variable ValueI5, SameValueI5, DifferentValueI5 : INTEGER;
48
    variable ValueI6, SameValueI6, DifferentValueI6 : INTEGER;
49
    variable ValueI7, SameValueI7, DifferentValueI7 : INTEGER;
50
  BEGIN
51
    -- "+" (addition) operator, and the "-" operator.
52
    --     - NOTE:  The following expression would not be able to parse
53
    --              if the precedence used was such that the "=" operator
54
    --              had a higher precedence than the "+" operator.  Thus,
55
    --              if this parses you are guaranteed that the precedence
56
    --              relative to these two levels is correctly defined.Same
57
    --              goes for the "-" operator.
58
    ValueB1         := 1 + 3 = 3 + 1;
59
    assert (ValueB1)
60
      report "The expression has not been processed correctly.(5)";
61
    ValueB2         := 3 - 1 = 5 - 3;
62
    assert (ValueB2)
63
      report "The expression has not been processed correctly.(6)";
64
    
65
    -- "+" (sign) operator, and the "-" (sign) operator.
66
    --     - NOTE:  The following expression would not be able to parse
67
    --              if the precedence used was such that the "=" operator
68
    --              had a higher precedence than the "+" operator.  Thus,
69
    --              if this parses you are guaranteed that the precedence
70
    --              relative to these two levels is correctly defined.Same
71
    --              goes for the "-" operator.
72
    ValueB3         := + 1 = + 1;
73
    assert (ValueB3)
74
      report "The expression has not been processed correctly.(7)";
75
    ValueB4         := - 3 = - 3;
76
    assert (ValueB4)
77
      report "The expression has not been processed correctly.(8)";
78

    
79
    ValueI1         := -3 + 4;
80
    SameValueI1     := (-3) + 4;
81
    DifferentValueI1:= -(3 + 4);
82
    assert (ValueI1 = SameValueI1)
83
      report "Values of lower precedence associated before those of higher precedence.(9)";
84
    assert (ValueI1 /= DifferentValueI1)
85
      report "Values of lower precedence associated before those of higher precedence.(10)";
86
    
87
    -- "*" operator.
88
    ValueI2         := 3 + 4 * 5;
89
    SameValueI2     := 3 + (4 * 5);
90
    DifferentValueI2:= (3 + 4) * 5;
91
    assert (ValueI2 = SameValueI2)
92
      report "Values of lower precedence associated before those of higher precedence.(13)";
93
    assert (ValueI2 /= DifferentValueI2)
94
      report "Values of lower precedence associated before those of higher precedence.(14)";
95
    
96
    -- "/" operator.
97
    ValueI3         := 5 + 10 / 5;
98
    SameValueI3     := 5 + (10 / 5);
99
    DifferentValueI3:= (5 + 10) / 5;
100
    assert (ValueI3 = SameValueI3)
101
      report "Values of lower precedence associated before those of higher precedence.(15)";
102
    assert (ValueI3 /= DifferentValueI3)
103
      report "Values of lower precedence associated before those of higher precedence.(16)";
104
    
105
    -- "mod" operator.
106
    ValueI4         := 4 + 11 mod 3;
107
    SameValueI4     := 4 + (11 mod 3);
108
    DifferentValueI4:= (4 + 11) mod 3;
109
    assert (ValueI4 = SameValueI4)
110
      report "Values of lower precedence associated before those of higher precedence.(17)";
111
    assert (ValueI4 /= DifferentValueI4)
112
      report "Values of lower precedence associated before those of higher precedence.(18)";
113
    
114
    -- "rem" operator.
115
    ValueI5         := 4 + 11 rem 3;
116
    SameValueI5     := 4 + (11 rem 3);
117
    DifferentValueI5:= (4 + 11) rem 3;
118
    assert (ValueI5 = SameValueI5)
119
      report "Values of lower precedence associated before those of higher precedence.(19)";
120
    assert (ValueI5 /= DifferentValueI5)
121
      report "Values of lower precedence associated before those of higher precedence.(20)";
122

    
123
    -- "**" operator.
124
    ValueI6         := 3 * 4 ** 2;
125
    SameValueI6     := 3 * (4 ** 2);
126
    DifferentValueI6:= (3 * 4) ** 2;
127
    assert (ValueI6 = SameValueI6)
128
      report "Values of lower precedence associated before those of higher precedence.(21)";
129
    assert (ValueI6 /= DifferentValueI6)
130
      report "Values of lower precedence associated before those of higher precedence.(22)";
131
    
132
    -- "abs" operator.
133
    ValueI7         := abs (-5) * (-7);
134
    SameValueI7     := (abs (-5)) * (-7);
135
    DifferentValueI7:= abs((-5) * (-7));
136
    assert (ValueI7 = SameValueI7)
137
      report "Values of lower precedence associated before those of higher precedence.(23)";
138
    assert (ValueI7 /= DifferentValueI7)
139
      report "Values of lower precedence associated before those of higher precedence.(24)";
140

    
141
    wait for 5 ns;
142

    
143
    assert NOT(   (ValueB1)   and
144
                  (ValueB2)   and 
145
                  (ValueB3)   and 
146
                  (ValueB4)   and 
147
                  (ValueI1 = SameValueI1)      and
148
                  (ValueI1 /= DifferentValueI1)   and
149
                  (ValueI2 = SameValueI2)      and
150
                  (ValueI2 /= DifferentValueI2)   and
151
                  (ValueI3 = SameValueI3)      and
152
                  (ValueI3 /= DifferentValueI3)   and
153
                  (ValueI4 = SameValueI4)      and
154
                  (ValueI4 /= DifferentValueI4)   and
155
                  (ValueI5 = SameValueI5)      and
156
                  (ValueI5 /= DifferentValueI5)   and
157
                  (ValueI6 = SameValueI6)      and
158
                  (ValueI6 /= DifferentValueI6)   and
159
                  (ValueI7 = SameValueI7)      and
160
                  (ValueI7 /= DifferentValueI7)   )
161
      report "***PASSED TEST: c07s02b00x00p09n01i01910"
162
      severity NOTE;
163
    assert (   (ValueB1)   and
164
               (ValueB2)   and 
165
               (ValueB3)   and 
166
               (ValueB4)   and 
167
               (ValueI1 = SameValueI1)      and
168
               (ValueI1 /= DifferentValueI1)   and
169
               (ValueI2 = SameValueI2)      and
170
               (ValueI2 /= DifferentValueI2)   and
171
               (ValueI3 = SameValueI3)      and
172
               (ValueI3 /= DifferentValueI3)   and
173
               (ValueI4 = SameValueI4)      and
174
               (ValueI4 /= DifferentValueI4)   and
175
               (ValueI5 = SameValueI5)      and
176
               (ValueI5 /= DifferentValueI5)   and
177
               (ValueI6 = SameValueI6)      and
178
               (ValueI6 /= DifferentValueI6)   and
179
               (ValueI7 = SameValueI7)      and
180
               (ValueI7 /= DifferentValueI7)   )
181
      report "***FAILED TEST: c07s02b00x00p09n01i01910 - Operators of higher precedence are associated with their operands before operators of lower precedence."
182
      severity ERROR;
183
    wait;
184
  END PROCESS TESTING;
185

    
186
END c07s02b00x00p09n01i01910arch;