1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
-- PSL - Simple subset
-- Copyright (C) 2002-2016 Tristan Gingold
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <gnu.org/licenses>.
with PSL.Types; use PSL.Types;
with PSL.Errors; use PSL.Errors;
package body PSL.Subsets is
procedure Check_Simple (N : Node)
is
begin
case Get_Kind (N) is
when N_Not_Bool =>
if Get_Psl_Type (Get_Boolean (N)) /= Type_Boolean then
Error_Msg_Sem
("operand of a negation operator must be a boolean", N);
end if;
when N_Never =>
case Get_Psl_Type (Get_Property (N)) is
when Type_Sequence | Type_Boolean =>
null;
when others =>
Error_Msg_Sem ("operand of a 'never' operator must be "
& "a boolean or a sequence", N);
end case;
when N_Eventually =>
case Get_Psl_Type (Get_Property (N)) is
when Type_Sequence | Type_Boolean =>
null;
when others =>
Error_Msg_Sem ("operand of an 'eventually!' operator must be"
& " a boolean or a sequence", N);
end case;
when N_And_Bool =>
if Get_Psl_Type (Get_Left (N)) /= Type_Boolean then
Error_Msg_Sem ("left-hand side operand of logical 'and' must be"
& " a boolean", N);
end if;
when N_Or_Bool =>
if Get_Psl_Type (Get_Left (N)) /= Type_Boolean then
Error_Msg_Sem ("left-hand side operand of logical 'or' must be"
& " a boolean", N);
end if;
when N_Log_Imp_Prop =>
if Get_Psl_Type (Get_Left (N)) /= Type_Boolean then
Error_Msg_Sem ("left-hand side operand of logical '->' must be"
& " a boolean", N);
end if;
-- FIXME: <->
when N_Until =>
if not Get_Inclusive_Flag (N) then
if Get_Psl_Type (Get_Right (N)) /= Type_Boolean then
Error_Msg_Sem ("right-hand side of a non-overlapping "
& "'until*' operator must be a boolean", N);
end if;
else
if Get_Psl_Type (Get_Right (N)) /= Type_Boolean
or else Get_Psl_Type (Get_Left (N)) /= Type_Boolean
then
Error_Msg_Sem ("both operands of an overlapping 'until*'"
& " operator are boolean", N);
end if;
end if;
when N_Before =>
if Get_Psl_Type (Get_Right (N)) /= Type_Boolean
or else Get_Psl_Type (Get_Left (N)) /= Type_Boolean
then
Error_Msg_Sem ("both operands of a 'before*'"
& " operator are boolean", N);
end if;
when others =>
null;
end case;
-- Recursion.
case Get_Kind (N) is
when N_Error =>
null;
when N_Hdl_Mod_Name =>
null;
when N_Vunit
| N_Vmode
| N_Vprop =>
declare
Item : Node;
begin
Item := Get_Item_Chain (N);
while Item /= Null_Node loop
Check_Simple (Item);
Item := Get_Chain (Item);
end loop;
end;
when N_Name_Decl =>
null;
when N_Assert_Directive
| N_Property_Declaration =>
Check_Simple (Get_Property (N));
when N_Endpoint_Declaration
| N_Sequence_Declaration =>
Check_Simple (Get_Sequence (N));
when N_Clock_Event =>
Check_Simple (Get_Property (N));
Check_Simple (Get_Boolean (N));
when N_Always
| N_Never
| N_Eventually
| N_Strong =>
Check_Simple (Get_Property (N));
when N_Braced_SERE
| N_Clocked_SERE =>
Check_Simple (Get_SERE (N));
when N_Concat_SERE
| N_Fusion_SERE
| N_Within_SERE =>
Check_Simple (Get_Left (N));
Check_Simple (Get_Right (N));
when N_Name =>
null;
when N_Star_Repeat_Seq
| N_Goto_Repeat_Seq
| N_Equal_Repeat_Seq
| N_Plus_Repeat_Seq =>
declare
N2 : constant Node := Get_Sequence (N);
begin
if N2 /= Null_Node then
Check_Simple (N2);
end if;
end;
when N_Match_And_Seq
| N_And_Seq
| N_Or_Seq =>
Check_Simple (Get_Left (N));
Check_Simple (Get_Right (N));
when N_Imp_Seq
| N_Overlap_Imp_Seq =>
Check_Simple (Get_Sequence (N));
Check_Simple (Get_Property (N));
when N_Log_Imp_Prop
| N_Log_Equiv_Prop
| N_Until
| N_Before
| N_Or_Prop
| N_And_Prop
| N_And_Bool
| N_Or_Bool
| N_Imp_Bool
| N_Equiv_Bool =>
Check_Simple (Get_Left (N));
Check_Simple (Get_Right (N));
when N_Next
| N_Next_A
| N_Next_E
| N_Paren_Prop =>
Check_Simple (Get_Property (N));
when N_Next_Event
| N_Next_Event_A
| N_Next_Event_E
| N_Abort =>
Check_Simple (Get_Boolean (N));
Check_Simple (Get_Property (N));
when N_Not_Bool
| N_Paren_Bool =>
Check_Simple (Get_Boolean (N));
when N_Const_Parameter
| N_Sequence_Parameter
| N_Boolean_Parameter
| N_Property_Parameter =>
null;
when N_Actual =>
null;
when N_Sequence_Instance
| N_Endpoint_Instance
| N_Property_Instance =>
null;
when N_True
| N_False
| N_Number
| N_EOS
| N_HDL_Expr
| N_HDL_Bool =>
null;
end case;
end Check_Simple;
end PSL.Subsets;
|