Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
70a35bfe
Commit
70a35bfe
authored
Mar 09, 2017
by
yoogx
Browse files
Merge branch 'spacestudio'
parents
295501ba
3ba0c40c
Changes
25
Expand all
Hide whitespace changes
Inline
Side-by-side
src/backends/ocarina-backends-aadl_spacestudio-main.adb
0 → 100644
View file @
70a35bfe
This diff is collapsed.
Click to expand it.
src/backends/ocarina-backends-aadl_spacestudio-main.ads
0 → 100644
View file @
70a35bfe
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.AADL_SPACESTUDIO.MAIN --
-- --
-- S p e c --
-- --
-- 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) --
-- --
------------------------------------------------------------------------------
package
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Main
is
procedure
Visit
(
E
:
Node_Id
;
Concat_Name
:
Name_Id
;
Proc_Binding
:
Name_Id
);
end
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Main
;
src/backends/ocarina-backends-aadl_spacestudio-mapping.adb
0 → 100644
View file @
70a35bfe
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.AADL_SPACESTUDIO.MAPPING --
-- --
-- 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
Ocarina
.
Namet
;
use
Ocarina
.
Namet
;
with
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
with
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nutils
;
with
Ocarina
.
Backends
.
python
.
Nodes
;
with
Ocarina
.
Backends
.
python
.
Nutils
;
package
body
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Mapping
is
use
Ocarina
.
ME_AADL
;
use
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
use
Ocarina
.
Backends
.
python
.
Nodes
;
use
Ocarina
.
Backends
.
python
.
Nutils
;
package
AIN
renames
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nodes
;
package
AINU
renames
Ocarina
.
ME_AADL
.
AADL_Instances
.
Nutils
;
package
PN
renames
Ocarina
.
Backends
.
python
.
Nodes
;
-----------------
-- Map_HI_Node --
-----------------
function
Map_HI_Node
(
E
:
Node_Id
)
return
Node_Id
is
pragma
Assert
(
AINU
.
Is_Process
(
E
)
or
else
AINU
.
Is_System
(
E
)
or
else
AINU
.
Is_Processor
(
E
));
N
:
constant
Node_Id
:=
New_Node
(
PN
.
K_HI_Node
);
begin
if
AINU
.
Is_System
(
E
)
then
Set_Str_To_Name_Buffer
(
"general"
);
else
Get_Name_String
(
To_python_Name
(
AIN
.
Name
(
Identifier
(
Parent_Subcomponent
(
E
)))));
Add_Str_To_Name_Buffer
(
"_cheddar"
);
-- XXX ????
end
if
;
PN
.
Set_Name
(
N
,
Name_Find
);
Set_Units
(
N
,
New_List
(
K_List_Id
));
-- Append the partition N to the node list
Append_Node_To_List
(
N
,
HI_Nodes
(
Current_Entity
));
Set_Distributed_Application
(
N
,
Current_Entity
);
return
N
;
end
Map_HI_Node
;
-----------------
-- Map_HI_Unit --
-----------------
function
Map_HI_Unit
(
E
:
Node_Id
)
return
Node_Id
is
pragma
Assert
(
AINU
.
Is_System
(
E
)
or
else
AINU
.
Is_Process
(
E
)
or
else
AINU
.
Is_Processor
(
E
));
U
:
Node_Id
;
N
:
Node_Id
;
P
:
Node_Id
;
Root
:
Node_Id
;
begin
U
:=
New_Node
(
PN
.
K_HI_Unit
,
Identifier
(
E
));
-- Packages that are common to all nodes
if
AINU
.
Is_System
(
E
)
then
Get_Name_String
(
To_python_Name
(
Display_Name
(
Identifier
(
E
))));
else
Get_Name_String
(
To_python_Name
(
Display_Name
(
Identifier
(
Parent_Subcomponent
(
E
)))));
end
if
;
Add_Str_To_Name_Buffer
(
"_aadl_Python"
);
N
:=
Make_Defining_Identifier
(
Name_Find
);
P
:=
Make_python_File
(
N
);
Set_Distributed_Application_Unit
(
P
,
U
);
PN
.
Set_python_File
(
U
,
P
);
Root
:=
Make_python_Node
(
""
,
No_Name
,
K_Nameid
);
PN
.
Set_Root_Node
(
P
,
Root
);
Append_Node_To_List
(
U
,
Units
(
Current_Entity
));
PN
.
Set_Entity
(
U
,
Current_Entity
);
return
U
;
end
Map_HI_Unit
;
end
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Mapping
;
src/backends/ocarina-backends-aadl_spacestudio-mapping.ads
0 → 100644
View file @
70a35bfe
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- OCARINA.BACKENDS.AADL_SPACESTUDIO.MAPPING --
-- --
-- S p e c --
-- --
-- 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) --
-- --
------------------------------------------------------------------------------
package
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Mapping
is
function
Map_HI_Node
(
E
:
Node_Id
)
return
Node_Id
;
function
Map_HI_Unit
(
E
:
Node_Id
)
return
Node_Id
;
end
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Mapping
;
src/backends/ocarina-backends-aadl_spacestudio.adb
0 → 100644
View file @
70a35bfe
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . A A D L _ S P A C E S T U D I O --
-- --
-- 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
Ocarina
.
Instances
;
with
Ocarina
.
Backends
.
Expander
;
with
Ocarina
.
Backends
.
Messages
;
with
Ocarina
.
Backends
.
AADL_SpaceStudio
.
Main
;
with
Ocarina
.
Backends
.
Utils
;
with
Ocarina
.
Backends
.
python
.
Nodes
;
with
Ocarina
.
Backends
.
python
.
Nutils
;
with
Ocarina
.
Backends
.
python
.
Generator
;
with
GNAT
.
Command_Line
;
use
GNAT
.
Command_Line
;
with
Ocarina
.
Namet
;
use
Ocarina
.
Namet
;
package
body
Ocarina
.
Backends
.
AADL_SpaceStudio
is
use
Ocarina
.
Instances
;
use
Ocarina
.
Backends
.
Messages
;
use
Ocarina
.
Backends
.
Utils
;
use
Ocarina
.
Backends
.
Expander
;
package
PTN
renames
Ocarina
.
Backends
.
python
.
Nodes
;
package
PTU
renames
Ocarina
.
Backends
.
python
.
Nutils
;
Generated_Sources_Directory
:
Name_Id
:=
No_Name
;
procedure
Visit_Architecture_Instance
(
E
:
Node_Id
);
-- Most top level visitor routine. E is the root of the AADL
-- instance tree. The procedure does a traversal for each
-- compilation unit to be generated.
--------------
-- Generate --
--------------
procedure
Generate
(
AADL_Root
:
Node_Id
)
is
Instance_Root
:
Node_Id
;
begin
Instance_Root
:=
Instantiate_Model
(
AADL_Root
);
if
No
(
Instance_Root
)
then
Display_Error
(
"Cannot instantiate the AADL model"
,
Fatal
=>
True
);
end
if
;
-- Expand the AADL instance
Expand
(
Instance_Root
);
Visit_Architecture_Instance
(
Instance_Root
);
-- Abort if the construction of the python tree failed
if
No
(
Python_Root
)
then
Display_Error
(
"python generation failed"
,
Fatal
=>
True
);
end
if
;
Enter_Directory
(
Generated_Sources_Directory
);
-- Create the Python file
python
.
Generator
.
Generate
(
Python_Root
);
Leave_Directory
;
end
Generate
;
----------
-- Init --
----------
procedure
Init
is
begin
Generated_Sources_Directory
:=
Get_String_Name
(
"."
);
Initialize_Option_Scan
;
loop
case
Getopt
(
"* o:"
)
is
when
ASCII
.
NUL
=>
exit
;
when
'o'
=>
declare
D
:
constant
String
:=
Parameter
;
begin
if
D
'
Length
/=
0
then
Generated_Sources_Directory
:=
Get_String_Name
(
D
);
end
if
;
end
;
when
others
=>
null
;
end
case
;
end
loop
;
Register_Backend
(
"spacestudio"
,
Generate
'
Access
,
SpaceStudio
);
end
Init
;
-----------
-- Reset --
-----------
procedure
Reset
is
begin
null
;
end
Reset
;
---------------------------------
-- Visit_Architecture_Instance --
---------------------------------
procedure
Visit_Architecture_Instance
(
E
:
Node_Id
)
is
begin
Python_Root
:=
PTU
.
New_Node
(
PTN
.
K_HI_Distributed_Application
);
PTN
.
Set_Name
(
Python_Root
,
No_Name
);
PTN
.
Set_Units
(
Python_Root
,
PTU
.
New_List
(
PTN
.
K_List_Id
));
PTN
.
Set_HI_Nodes
(
Python_Root
,
PTU
.
New_List
(
PTN
.
K_List_Id
));
PTU
.
Push_Entity
(
Python_Root
);
AADL_SpaceStudio
.
Main
.
Visit
(
E
,
Get_String_Name
(
"willdesepear"
),
Get_String_Name
(
"Hardware"
));
PTU
.
Pop_Entity
;
end
Visit_Architecture_Instance
;
end
Ocarina
.
Backends
.
AADL_SpaceStudio
;
src/backends/ocarina-backends-aadl_spacestudio.ads
0 → 100644
View file @
70a35bfe
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . A A D L _ S P A C E S T U D I O --
-- --
-- S p e c --
-- --
-- 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) --
-- --
------------------------------------------------------------------------------
package
Ocarina
.
Backends
.
AADL_SpaceStudio
is
procedure
Generate
(
AADL_Root
:
Node_Id
);
procedure
Init
;
procedure
Reset
;
private
Python_Root
:
Node_Id
;
Current_Python_Node
:
Node_Id
;
Distributed_Application
:
Node_Id
;
HI_Node
:
Node_Id
;
HI_Unit
:
Node_Id
;
end
Ocarina
.
Backends
.
AADL_SpaceStudio
;
src/backends/ocarina-backends-python-debug.adb
0 → 100644
View file @
70a35bfe
------------------------------------------------------------------------------
-- --
-- OCARINA COMPONENTS --
-- --
-- O C A R I N A . B A C K E N D S . P Y T H O N . D E B U G --
-- --
-- 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) --
-- --
------------------------------------------------------------------------------
pragma
Warnings
(
Off
);
with
Charset
;
use
Charset
;
with
Locations
;
use
Locations
;
with
Ocarina
.
Namet
;
use
Ocarina
.
Namet
;
with
Utils
;
use
Utils
;
with
Ocarina
.
Backends
.
python_Values
;
use
Ocarina
.
Backends
.
python_Values
;
package
body
Ocarina
.
Backends
.
python
.
Debug
is
-----------
-- Image --
-----------
function
Image
(
N
:
Node_Kind
)
return
String
is
S
:
String
:=
Node_Kind
'
Image
(
N
);
begin
To_Lower
(
S
);
for
I
in
S
'
Range
loop
if
S
(
I
)
=
'_'
then
S
(
I
)
:=
' '
;
end
if
;
end
loop
;
return
S
(
3
..
S
'
Last
);
end
Image
;
function
Image
(
N
:
Name_Id
)
return
String
is
begin
if
N
=
No_Name
then
return
No_Str
;
else
return
Get_Name_String
(
N
);
end
if
;
end
Image
;
function
Image
(
N
:
Value_Id
)
return
String
is
begin
return
python_Values
.
Image
(
N
);
end
Image
;
function
Image
(
N
:
Node_Id
)
return
String
is
begin
return
Image
(
Int
(
N
));
end
Image
;
function
Image
(
N
:
List_Id
)
return
String
is
begin
return
Image
(
Int
(
N
));
end
Image
;
function
Image
(
N
:
Mode_Id
)
return
String
is
begin
case
N
is
when
Mode_In
=>
return
Quoted
(
"in"
);
when
Mode_Inout
=>
return
Quoted
(
"in out"
);
when
Mode_Out
=>
return
Quoted
(
"out"
);
end
case
;
end
Image
;
function
Image
(
N
:
Boolean
)
return
String
is
begin
return
Boolean
'
Image
(
N
);
end
Image
;
function
Image
(
N
:
Byte
)
return
String
is
begin
return
Image
(
Int
(
N
));
end
Image
;
function
Image
(
N
:
Int
)
return
String
is
S
:
constant
String
:=
Int
'
Image
(
N
);
begin
return
S
(
S
'
First
+
1
..
S
'
Last
);
end
Image
;
------------
-- W_Byte --
------------
procedure
W_Byte
(
N
:
Byte
)
is
begin
Write_Int
(
Int
(
N
));
end
W_Byte
;
---------------
-- W_Indents --
---------------
procedure
W_Indents
is
begin
for
I
in
1
..
N_Indents
loop
Write_Str
(
" "
);
end
loop
;
end
W_Indents
;
---------------
-- W_List_Id --
---------------
procedure
W_List_Id
(
L
:
List_Id
)
is
N
:
Node_Id
;
begin
if
L
=
No_List
then
return
;
end
if
;
N
:=
First_Node
(
L
);
while
Present
(
N
)
loop
W_Node_Id
(
N
);
N
:=
Next_Node
(
N
);
end
loop
;
end
W_List_Id
;
----------------------
-- W_Node_Attribute --
----------------------
procedure
W_Node_Attribute
(
A
:
String
;
K
:
String
;
V
:
String
;
N
:
Int
:=
0
)
is
C
:
Node_Id
;
begin
if
A
=
"Next_Node"
or
else
A
=
"Package_Declaration"
then
return
;
end
if
;
N_Indents
:=
N_Indents
+
1
;
W_Indents
;
Write_Str
(
A
);
Write_Char
(
' '
);
Write_Str
(
K
);
Write_Char
(
' '
);
C
:=
Node_Id
(
N
);
if
K
=
"Name_Id"
then
Write_Line
(
Quoted
(
V
));
elsif
K
=
"Node_Id"
and
then
Present
(
C
)
then
case
Kind
(
C
)
is
when
K_Numeric
=>
Write_Line
(
'('
&
Image
(
Kind
(
Node_Id
(
N
)))
&
')'
);
when
others
=>
Write_Line
(
V
);
end
case
;
else
Write_Line
(
V
);
end
if
;
if
A
/=
"Frontend_Node"