ocarina-backends-lnt-svl_generator.adb 7.69 KB
Newer Older
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
------------------------------------------------------------------------------
--                                                                          --
--                           OCARINA COMPONENTS                             --
--                                                                          --
--   O C A R I N A . B A C K E N D S . L N T . S V L _ G E N E R A T O R    --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--                     Copyright (C) 2016 ESA & ISAE.                       --
--                                                                          --
-- Ocarina  is free software; you can redistribute it and/or modify under   --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion. Ocarina 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.                     --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
--                 Ocarina is maintained by the TASTE project               --
--                      (taste-users@lists.tuxfamily.org)                   --
--                                                                          --
------------------------------------------------------------------------------

with Outfiles;        use Outfiles;
with Ocarina.Namet;   use Ocarina.Namet;
with GNAT.OS_Lib;     use GNAT.OS_Lib;
with Ocarina.Output;  use Ocarina.Output;
with Ocarina.Options; use Ocarina.Options;

package body Ocarina.Backends.LNT.Svl_Generator is

   procedure Make_Demo_Svl;

   -------------------
   -- Make_SVL_File --
   -------------------

   procedure Make_SVL_File is
      Fd              : File_Descriptor;
   begin
      if Output_Filename /= No_Name and then
         Get_Name_String (Output_Filename) = "-"
      then
         Set_Standard_Output;
         Set_Space_Increment (3);
         Make_Demo_Svl;
      else
         Fd := Set_Output (Get_String_Name ("demo.svl"));
         Set_Space_Increment (3);
         Make_Demo_Svl;
         Close (Fd);
      end if;
   end Make_SVL_File;

   -------------------
   -- Make_Demo_Svl --
   -------------------

   procedure Make_Demo_Svl is
   begin
69
70
71
      Write_Str ("% DEFAULT_MCL_LIBRARIES=");
      Write_Quoted_Str ("standard.mcl");
      Write_Line ("");
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
      --  LTS generation
      Write_Quoted_Str ("Main.bcg");
      Write_Str ("=  divbranching reduction of ");
      Write_Quoted_Str (Get_Name_String (System_Name) & "_Main.lnt");
      Write_Line (";");
      --  adding deadlock property
      Write_Line ("property PROPERTY_Deadlock is");
      Increment_Indentation;
      Write_Indentation;
      Write_Str ("deadlock of ");
      Write_Quoted_Str ("Main.bcg");
      Write_Line (";");
      Write_Indentation;
      Write_Line ("expected FALSE;");
      Decrement_Indentation;
      Write_Indentation;
      Write_Line ("end property;");
89
90
91

      --  adding Scheduling_Test property
      Write_Line ("property Scheduling_Test (ID)");
92
93
      Increment_Indentation;
      Write_Indentation;
94
95
      Write_Quoted_Str ("Scheduling Test ");
      Write_Line ("is");
96
      Write_Quoted_Str ("Main.bcg");
97
      Write_Line ("|= with evaluator3");
98
      Write_Indentation;
99
      Write_Str ("NEVER (");
100
      Write_Quoted_Str ("ACTIVATION_$ID !T_Error");
101
      Write_Line (");");
102
103
104
105
106
107
      Write_Indentation;
      Write_Line ("expected TRUE;");
      Decrement_Indentation;
      Write_Indentation;
      Write_Line ("end property;");

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
      for I in 1 .. Thread_Number loop
         Write_Line ("check Scheduling_Test (" & Integer'Image (I) & ");");
      end loop;

      --  adding Connection property
      Write_Line ("property Connection (ID)");
      Increment_Indentation;
      Write_Indentation;
      Write_Quoted_Str ("Connection Test ");
      Write_Line ("is");
      Write_Quoted_Str ("Main.bcg");
      Write_Line ("|= with evaluator3");
      Write_Indentation;
      Write_Str ("AFTER_1_INEVITABLE_2 ");
      Write_Str ("('SEND_$ID !*' , 'RECEIVE_$ID !*')");
      Write_Line (";");
      Write_Indentation;
      Write_Line ("expected TRUE;");
      Decrement_Indentation;
      Write_Indentation;
      Write_Line ("end property;");
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
198
199
200
      --  adding Is_Preempted property
      Write_Line ("property Is_Preempted (ID)");
      Increment_Indentation;
      Write_Indentation;
      Write_Quoted_Str ("Is_Preempted Test ");
      Write_Line ("is");
      Write_Quoted_Str ("Main.bcg");
      Write_Line ("|= with evaluator3");
      Write_Indentation;
      Write_Str ("SOME (");
      Write_Str ("true* .");
      Write_Quoted_Str ("ACTIVATION_$ID !T_DISPATCH_PREEMPTION");
      Write_Str (". true* . (");
      Write_Quoted_Str ("ACTIVATION_$ID !T_PREEMPTION");
      Write_Str (")* . true* . ");
      Write_Quoted_Str ("ACTIVATION_$ID !T_PREEMPTION_COMPLETION");
      Write_Line (");");
      Write_Indentation;
      Write_Line ("expected TRUE;");
      Decrement_Indentation;
      Write_Indentation;
      Write_Line ("end property;");

      for I in 1 .. Thread_Number loop
         Write_Line ("check Is_Preempted (" & Integer'Image (I) & ");");
      end loop;

      --  adding Data_Loss property
      Write_Line ("property Data_Loss (ID)");
      Increment_Indentation;
      Write_Indentation;
      Write_Quoted_Str ("Between two consecutive SEND_$ID actions," &
         " there is a RECEIVE_$ID");
      Write_Line (" is");
      Write_Quoted_Str ("Main.bcg");
      Write_Line ("|= with evaluator3");
      Write_Indentation;
      Write_Str ("NEVER (");
      Write_Str ("true* .");
      Write_Quoted_Str ("SEND_$ID !AADLDATA");
      Write_Str (". (not");
      Write_Quoted_Str ("RECEIVE_$ID !AADLDATA");
      Write_Str (")* .");
      Write_Quoted_Str ("SEND_$ID !AADLDATA");
      Write_Line (");");
      Write_Indentation;
      Write_Line ("expected TRUE;");
      Decrement_Indentation;
      Write_Indentation;
      Write_Line ("end property;");

      --  adding Transition property
      Write_Line ("property Transition (TH_NAME, Si, Sj)");
      Increment_Indentation;
      Write_Indentation;
      Write_Quoted_Str ("Thread $TH_NAME, being in state $Si," &
         " the corresponding $Sj state is eventually reachable");
      Write_Line (" is");
      Write_Quoted_Str ("Main.bcg");
      Write_Line ("|= with evaluator3");
      Write_Indentation;
      Write_Str ("AFTER_1_INEVITABLE_2 (");
      Write_Quoted_Str ("DISPLAY_STATE !$TH_NAME !$Si");
      Write_Str (",");
      Write_Quoted_Str ("DISPLAY_STATE !$TH_NAME !$Sj");
      Write_Line (");");
      Write_Indentation;
      Write_Line ("expected TRUE;");
      Decrement_Indentation;
      Write_Indentation;
      Write_Line ("end property;");
201
202
203
   end Make_Demo_Svl;

end Ocarina.Backends.LNT.Svl_Generator;