taste-deployment_view.ads 4.81 KB
Newer Older
1
2
3
4
5
6
--  *************************** taste aadl parser ***********************  --
--  (c) 2017 European Space Agency - maxime.perrotin@esa.int
--  LGPL license, see LICENSE file

--  Deployment View parser

7
with Ada.Containers.Indefinite_Ordered_Maps,
8
9
     Ada.Containers.Indefinite_Vectors,
     Ada.Strings.Unbounded,
10
11
12
     Text_IO,
     Ocarina,
     Ocarina.Types,
13
     Ocarina.Backends.Properties,
14
     Option_Type,
15
     TASTE.Parser_Utils;
16

17
18
19
20
use Ada.Containers,
    Ada.Strings.Unbounded,
    Text_IO,
    Ocarina,
21
    Ocarina.Types,
22
    Ocarina.Backends.Properties,
23
    TASTE.Parser_Utils;
24

25
package TASTE.Deployment_View is
26
27
28

   use Option_UString;
   use Option_ULL;
Maxime Perrotin's avatar
Maxime Perrotin committed
29
   use String_Vectors;
30
31
32

   --  Exceptions specific to the deployment view
   Deployment_View_Error       : exception;
33
   Device_Driver_Error         : exception;
34
35
   Empty_Deployment_View_Error : exception;

Maxime Perrotin's avatar
Maxime Perrotin committed
36
37
   --  List of Ocarina AADL models needed to parse the deployment view
   AADL_Lib : String_Vectors.Vector := Empty_Vector &
Maxime Perrotin's avatar
Maxime Perrotin committed
38
39
                "TASTE_DV_Properties.aadl" &
                "TASTE_IV_Properties.aadl" &
Maxime Perrotin's avatar
Maxime Perrotin committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
                "aadl_project.aadl" &
                "taste_properties.aadl" &
                "Cheddar_Properties.aadl" &
                "communication_properties.aadl" &
                "deployment_properties.aadl" &
                "thread_properties.aadl" &
                "timing_properties.aadl" &
                "programming_properties.aadl" &
                "memory_properties.aadl" &
                "modeling_properties.aadl" &
                "arinc653.aadl" &
                "base_types.aadl" &
                "data_model.aadl" &
                "deployment.aadl";

55
56
57
58
59
60
   --  Initialize Ocarina and instantiate the deployment view, return root.
   function Initialize (Root : Node_Id) return Node_Id
   with Pre => Root /= No_Node;

   type Taste_Bus is
      record
Maxime Perrotin's avatar
Maxime Perrotin committed
61
62
63
64
         Name         : Unbounded_String;
         AADL_Package : Unbounded_String;
         Classifier   : Unbounded_String;
         Properties   : Property_Maps.Map;
65
66
67
68
      end record;

   package Taste_Busses is new Indefinite_Vectors (Natural, Taste_Bus);

69
70
71
72
73
74
75
76
77
78
79
   type Bus_Connection is
      record
         Source_Node : Unbounded_String;
         Source_Port : Unbounded_String;
         Bus_Name    : Unbounded_String;
         Dest_Node   : Unbounded_String;
         Dest_Port   : Unbounded_String;
      end record;

   package Bus_Connections is new Indefinite_Vectors (Natural, Bus_Connection);

80
81
82
   type Taste_Device_Driver is
      record
         Name                      : Unbounded_String;
83
         Package_Name              : Unbounded_String;
84
85
86
87
88
89
90
91
92
93
94
95
96
         Device_Classifier         : Unbounded_String;
         Associated_Processor_Name : Unbounded_String;
         Device_Configuration      : Unbounded_String;
         Accessed_Bus_Name         : Unbounded_String;
         Accessed_Port_Name        : Unbounded_String;
         ASN1_Filename             : Unbounded_String;
         ASN1_Typename             : Unbounded_String;
         ASN1_Module               : Unbounded_String;
      end record;

   package Taste_Drivers is
     new Indefinite_Vectors (Natural, Taste_Device_Driver);

97
98
99
   type Taste_Partition is
      record
         Name            : Unbounded_String;
100
         Coverage        : Boolean := False;
101
102
103
104
105
106
107
         Package_Name    : Unbounded_String;
         CPU_Name        : Unbounded_String;
         CPU_Platform    : Supported_Execution_Platform;
         CPU_Classifier  : Unbounded_String;
         Bound_Functions : String_Vectors.Vector;
      end record;

108
109
   package Option_Partition is new Option_Type (Taste_Partition);

110
111
112
   package Taste_Partitions is
      new Indefinite_Ordered_Maps (String, Taste_Partition);

113
114
   type Taste_Node is
      record
115
116
117
         Name       : Unbounded_String;
         Drivers    : Taste_Drivers.Vector;
         Partitions : Taste_Partitions.Map;
118
119
120
121
      end record;

   package Node_Maps is new Indefinite_Ordered_Maps (String, Taste_Node);

122
123
   type Complete_Deployment_View is tagged
      record
124
125
126
         Nodes       : Node_Maps.Map;
         Connections : Bus_Connections.Vector;
         Busses      : Taste_Busses.Vector;
127
128
129
      end record;

   --  Function to build up the Ada AST by transforming the one from Ocarina
Maxime Perrotin's avatar
Maxime Perrotin committed
130
131
132
   function Parse_Deployment_View (System : Node_Id)
                                   return Complete_Deployment_View
   with Pre => System /= No_Node;
133
134
135
136
137
138
139
140
   procedure Dump_Nodes       (DV     : Complete_Deployment_View;
                               Output : File_Type);
   procedure Dump_Connections (DV     : Complete_Deployment_View;
                               Output : File_Type);
   procedure Dump_Busses      (DV     : Complete_Deployment_View;
                               Output : File_Type);
   procedure Debug_Dump       (DV     : Complete_Deployment_View;
                               Output : File_Type);
141

142
end TASTE.Deployment_View;