Commit d0186104 authored by jjhugues's avatar jjhugues
Browse files

Merge branch 'master' of https://github.com/OpenAADL/ocarina

parents a69c22ea d5a0f6a5
ignore:
- "tools/mknodes"
- "src/transfo"
- "doc"
......@@ -31,8 +31,9 @@ property set AADL_Project is
Supported_Connection_QoS: type enumeration (GuaranteedDelivery, OrderedDelivery, SecureDelivery);
Supported_Scheduling_Protocols: type enumeration -- Updated for Cheddar
Supported_Scheduling_Protocols: type enumeration
(SporadicServer, RMS, FixedTimeline,
-- for Cheddar
PARAMETRIC_PROTOCOL,
EDF,
EARLIEST_DEADLINE_FIRST_PROTOCOL,
......@@ -50,7 +51,10 @@ property set AADL_Project is
HIERARCHICAL_CYCLIC_PROTOCOL,
HIERARCHICAL_ROUND_ROBIN_PROTOCOL,
HIERARCHICAL_FIXED_PRIORITY_PROTOCOL,
HIERARCHICAL_PARAMETRIC_PROTOCOL);
HIERARCHICAL_PARAMETRIC_PROTOCOL,
-- for AADL Inspector
RM, DM, HPF, ARINC653, static, cyclic
);
Supported_Source_Languages: type enumeration -- Updated for TASTE/Ocarina
(Ada95,
......
property set Code_Generation_Properties is
Convention: enumeration (AADL, Legacy) => Legacy applies to (subprogram);
Parameter_Usage: enumeration (By_Value, By_Reference)
applies to (data access, parameter);
Return_Parameter: aadlboolean => false applies to (parameter);
-- if true, out parameter is actually a return parameter
end Code_Generation_Properties;
......@@ -290,48 +290,54 @@ package body Ocarina.Backends.C_Common.BA is
Statements : List_Id);
function Evaluate_BA_Value_Expression
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Relation
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Operator (Node : Node_Id) return Operator_Type;
function Evaluate_BA_Simple_Expression
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
function Evaluate_BA_Simple_Expression
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Term
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Factor
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Value
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Integer_Value
(Node : Node_Id;
......@@ -350,6 +356,10 @@ package body Ocarina.Backends.C_Common.BA is
(Node : Node_Id;
Parent_Component : Node_Id) return Node_Id;
function Get_Subcomponent_Data_Instance
(Node : Node_Id;
Parent_Component : Node_Id) return Node_Id;
function Evaluate_BA_Value_Variable
(Node : Node_Id;
S : Node_Id;
......@@ -357,11 +367,12 @@ package body Ocarina.Backends.C_Common.BA is
Statements : List_Id) return Node_Id;
function Evaluate_BA_Property_Constant
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Make_Call_Parameter_For_Get_Count_and_Next_Value
(Node : Node_Id;
......@@ -390,11 +401,12 @@ package body Ocarina.Backends.C_Common.BA is
Statements : List_Id) return Node_Id;
function Evaluate_BA_Identifier
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id;
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id;
function Evaluate_BA_Boolean_Literal (Node : Node_Id) return Node_Id;
......@@ -4232,7 +4244,8 @@ package body Ocarina.Backends.C_Common.BA is
Is_Out_Parameter => BATN.Is_Out (N),
Subprogram_Root => S,
Declarations => Declarations,
Statements => Statements);
Statements => Statements,
Is_Put_Value_On_Port => True);
Append_Node_To_List
(K,
......@@ -4473,7 +4486,8 @@ package body Ocarina.Backends.C_Common.BA is
(Subprogram_Parameter_List (Node))),
Subprogram_Root => S,
Declarations => Declarations,
Statements => Statements)),
Statements => Statements,
Is_Put_Value_On_Port => True)),
Statements);
end Make_Put_Value_On_port;
......@@ -4676,6 +4690,24 @@ package body Ocarina.Backends.C_Common.BA is
(Make_Request_Variable_Name_From_Port_Name
(BATN.Display_Name (N))));
elsif AAN.Kind (Corresponding_Entity) = AAN.K_Subcomponent
and then
AINU.Is_Data (AIN.Corresponding_Instance
(Get_Subcomponent_Data_Instance
(Corresponding_Entity, S)))
and then Get_Data_Representation
(AIN.Corresponding_Instance
(Get_Subcomponent_Data_Instance
(Corresponding_Entity, S))) = Data_Struct
then
Var_identifier := Evaluate_BA_Identifier
(Node => N,
Is_Out_Parameter => Is_Out_Parameter,
Subprogram_Root => S,
Declarations => Declarations,
Statements => Statements);
Is_Pointer := True;
end if;
else
......@@ -4900,11 +4932,12 @@ package body Ocarina.Backends.C_Common.BA is
----------------------------------
function Evaluate_BA_Value_Expression
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Value_Expression);
pragma Assert (not BANu.Is_Empty (BATN.Relations (Node)));
......@@ -4920,7 +4953,7 @@ package body Ocarina.Backends.C_Common.BA is
Left_Expr := Evaluate_BA_Relation
(N, Is_Out_Parameter, Subprogram_Root,
Declarations, Statements);
Declarations, Statements, Is_Put_Value_On_Port);
N := BATN.Next_Node (N);
......@@ -4966,11 +4999,12 @@ package body Ocarina.Backends.C_Common.BA is
--------------------------
function Evaluate_BA_Relation
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Relation);
......@@ -4987,7 +5021,7 @@ package body Ocarina.Backends.C_Common.BA is
Left_Expr := Evaluate_BA_Simple_Expression
(N, Is_Out_Parameter, Subprogram_Root,
Declarations, Statements);
Declarations, Statements, Is_Put_Value_On_Port);
N := BATN.Next_Node (N);
......@@ -5094,11 +5128,12 @@ package body Ocarina.Backends.C_Common.BA is
-----------------------------------
function Evaluate_BA_Simple_Expression
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Simple_Expression);
pragma Assert (not BANu.Is_Empty (BATN.Term_And_Operator (Node)));
......@@ -5114,7 +5149,7 @@ package body Ocarina.Backends.C_Common.BA is
Left_Expr := Evaluate_BA_Term
(N, Is_Out_Parameter, Subprogram_Root,
Declarations, Statements);
Declarations, Statements, Is_Put_Value_On_Port);
N := BATN.Next_Node (N);
......@@ -5158,11 +5193,12 @@ package body Ocarina.Backends.C_Common.BA is
----------------------
function Evaluate_BA_Term
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Term);
pragma Assert (not BANu.Is_Empty (BATN.Factors (Node)));
......@@ -5178,7 +5214,8 @@ package body Ocarina.Backends.C_Common.BA is
Left_Expr := Evaluate_BA_Factor (N, Is_Out_Parameter,
Subprogram_Root,
Declarations, Statements);
Declarations, Statements,
Is_Put_Value_On_Port);
N := BATN.Next_Node (N);
......@@ -5223,11 +5260,12 @@ package body Ocarina.Backends.C_Common.BA is
------------------------
function Evaluate_BA_Factor
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Factor);
begin
......@@ -5250,7 +5288,7 @@ package body Ocarina.Backends.C_Common.BA is
else
return Evaluate_BA_Value
(BATN.Lower_Value (Node), Is_Out_Parameter,
Subprogram_Root, Declarations, Statements);
Subprogram_Root, Declarations, Statements, Is_Put_Value_On_Port);
end if;
-- if Present (BATN.Upper_Value (Node)) then
......@@ -5264,11 +5302,12 @@ package body Ocarina.Backends.C_Common.BA is
-----------------------
function Evaluate_BA_Value
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Value_Variable
or else Kind (Node) = BATN.K_Value_Expression
......@@ -5298,7 +5337,7 @@ package body Ocarina.Backends.C_Common.BA is
when BATN.K_Property_Constant =>
result := Evaluate_BA_Property_Constant
(Node, Is_Out_Parameter, Subprogram_Root,
Declarations, Statements);
Declarations, Statements, Is_Put_Value_On_Port);
-- when BATN.K_Property_Reference =>
-- Evaluate_BA_Property_Reference (Node);
......@@ -5622,17 +5661,18 @@ package body Ocarina.Backends.C_Common.BA is
----------------------------
function Evaluate_BA_Identifier
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id := No_Node;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
use AAN;
pragma Assert (BATN.Kind (Node) = BATN.K_Identifier);
Pointer : Boolean := False;
Variable_Address : Boolean := False;
N : Node_Id;
N, N1 : Node_Id;
result : Node_Id;
begin
......@@ -5692,10 +5732,22 @@ package body Ocarina.Backends.C_Common.BA is
end if;
if Present (N) then
if AAN.kind (N) = AAN.K_Subcomponent and then
Component_Category'Val (Category (N)) = CC_Data
then
Pointer := True;
if AAN.kind (N) = AAN.K_Subcomponent then
N1 := AIN.Corresponding_Instance
(Get_Subcomponent_Data_Instance
(N, Subprogram_Root));
if AINU.Is_Data (N1) then
if Get_Data_Representation (N1) = Data_Struct then
if not Is_Put_Value_On_Port then
return CTU.Make_Defining_Identifier
(Name => BATN.Display_Name (Node));
else
Pointer := True;
end if;
else
Pointer := True;
end if;
end if;
end if;
end if;
end if;
......@@ -5790,6 +5842,31 @@ package body Ocarina.Backends.C_Common.BA is
end Make_Intermediate_Variable_Declaration;
------------------------------------
-- Get_Subcomponent_Data_Instance --
------------------------------------
function Get_Subcomponent_Data_Instance
(Node : Node_Id;
Parent_Component : Node_Id) return Node_Id
is
Fs : constant Ocarina.ME_AADL.AADL_Instances.Nutils.Node_Array
:= Subcomponents_Of (Parent_Component);
result : Node_Id;
begin
for F of Fs loop
if Present (AIN.Identifier (F))
and then Standard.Utils.To_Upper
(AIN.Display_Name (AIN.Identifier (F)))
= Standard.Utils.To_Upper
(AAN.Display_Name (AAN.Identifier (Node)))
then
result := F;
end if;
end loop;
return result;
end Get_Subcomponent_Data_Instance;
----------------------------
-- Get_Port_Spec_Instance --
----------------------------
......@@ -5935,11 +6012,12 @@ package body Ocarina.Backends.C_Common.BA is
-----------------------------------
function Evaluate_BA_Property_Constant
(Node : Node_Id;
Is_Out_Parameter : Boolean := False;
Subprogram_Root : Node_Id;
Declarations : List_Id;
Statements : List_Id) return Node_Id
(Node : Node_Id;
Is_Out_parameter : Boolean := False;
Subprogram_Root : Node_Id;
Declarations : List_Id;
Statements : List_Id;
Is_Put_Value_On_Port : Boolean := False) return Node_Id
is
pragma Assert (BATN.Kind (Node) = BATN.K_Property_Constant);
......@@ -5952,7 +6030,7 @@ package body Ocarina.Backends.C_Common.BA is
return Evaluate_BA_Identifier
(BATN.Identifier (Node), Is_Out_Parameter,
Subprogram_Root, Declarations, Statements);
Subprogram_Root, Declarations, Statements, Is_Put_Value_On_Port);
end Evaluate_BA_Property_Constant;
......
......@@ -893,6 +893,7 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
The_System : constant Node_Id :=
Parent_Component (Parent_Subcomponent (E));
Device_Implementation : Node_Id;
Node_Name : Name_Id;
begin
pragma Assert (AAU.Is_System (Root_Sys));
......@@ -928,6 +929,22 @@ package body Ocarina.Backends.PO_HI_C.Deployment is
(Map_C_Enumerator_Name (Parent_Subcomponent (E))));
Append_Node_To_List (N, CTN.Declarations (Current_File));
Node_Name :=
Map_C_Enumerator_Name (Parent_Subcomponent (E));
Set_Str_To_Name_Buffer ("");
Get_Name_String (Token_Image (Tok_Quote));
Get_Name_String_And_Append (Node_Name);
Get_Name_String_And_Append (Token_Image (Tok_Quote));
Node_Name := Name_Find;
N :=
Make_Define_Statement
(Defining_Identifier => RE (RE_My_Node_Name),
Value =>
Make_Defining_Identifier (Node_Name));
Append_Node_To_List (N, CTN.Declarations (Current_File));
-- Visit all devices attached to the parent system that
-- share the same processor as process E.
......
......@@ -174,6 +174,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Nb_Buses, -- __PO_HI_NB_BUSES
RE_Nb_Protocols, -- __PO_HI_NB_PROTOCOLS
RE_My_Node, -- __PO_HI_MY_NODE
RE_My_Node_Name, -- __PO_HI_MY_NODE_NAME
RE_Port_Type_Content, -- __PO_HI_PORT_TYPE_CONTENT
RE_Gqueue_Fifo_Indata, -- __PO_HI_GQUEUE_FIFO_DATA
RE_Gqueue_Fifo_Out, -- __PO_HI_GQUEUE_FIFO_OUT
......@@ -428,6 +429,7 @@ package Ocarina.Backends.PO_HI_C.Runtime is
RE_Nb_Protocols => RH_Deployment,
RE_Port_Type_Content => RH_Deployment,
RE_My_Node => RH_Deployment,
RE_My_Node_Name => RH_Deployment,
RE_Nb_Ports => RH_Deployment,
RE_Nb_Servers => RH_Deployment,
RE_Nb_Protected => RH_Deployment,
......
......@@ -81,6 +81,8 @@ package body Ocarina.Property_Sets is
Standard_Property_Set_Mask : constant Byte := 2**2;
Ocarina_Property_Set_Mask : constant Byte := 2**3;
Use_Taste_Properties : Boolean := False;
function Internal_Name (N : Name_Id) return Name_Id;
function Internal_Name (S : String) return Name_Id;
......@@ -230,7 +232,12 @@ package body Ocarina.Property_Sets is
function Ocarina_Property_Sets return Ocarina_Property_Set_Array_Type is
begin
return Ocarina_Property_Sets_Table (AADL_Version).all;
if Use_Taste_Properties then
return Ocarina_Property_Sets_Table (AADL_Version).all
& O_Taste_Properties;
else
return Ocarina_Property_Sets_Table (AADL_Version).all;
end if;
end Ocarina_Property_Sets;
-------------------------
......@@ -246,4 +253,13 @@ package body Ocarina.Property_Sets is
Set_Name_Table_Byte (N, B or User_Defined_Mask);
end Set_As_User_Defined;
-------------------------------
-- Activate_Taste_Properties --
-------------------------------
procedure Activate_Taste_Properties is
begin
Use_Taste_Properties := True;
end Activate_Taste_Properties;
end Ocarina.Property_Sets;
......@@ -96,4 +96,8 @@ package Ocarina.Property_Sets is
function Ocarina_Property_Sets return Ocarina_Property_Set_Array_Type;
procedure Activate_Taste_Properties;
-- Special case to activate TASTE property sets as additional
-- Ocarina property set
end Ocarina.Property_Sets;
......@@ -151,22 +151,22 @@ Evaluating theorem set_declaration_is_passing_through
* Iterate for variable: rma.erc32_node_a_task_1
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :4014 end to end flow spec
anonymous end to end flow :4020 end to end flow spec
=> Result: TRUE
* Iterate for variable: rma.erc32_node_a_task_2
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :4014 end to end flow spec
anonymous end to end flow :4020 end to end flow spec
=> Result: TRUE
* Iterate for variable: rma.erc32_node_a_task_12
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :4015 end to end flow spec
anonymous end to end flow :4021 end to end flow spec
=> Result: TRUE
* Iterate for variable: rma.erc32_node_a_task_22
Content of set accessor_flows (test_real_exec_02.aadl:251:21) is
anonymous end to end flow :4015 end to end flow spec
anonymous end to end flow :4021 end to end flow spec
=> Result: TRUE
theorem set_declaration_is_passing_through is: TRUE
......
This diff is collapsed.