Commit 9350c78e authored by hana's avatar hana

Start of AADL Behavior Annex mapping.

parent 23c99ceb
......@@ -573,6 +573,16 @@ package body Ocarina.Backends.LNT.Printer is
L_Write ("and");
when K_Or =>
L_Write ("or");
when K_Head =>
L_Write ("head");
when K_Tail =>
L_Write ("tail");
when K_Append =>
L_Write ("append");
when K_Length =>
L_Write ("length");
when K_Reverse =>
L_Write ("reverse");
when others =>
null;
end case;
......
......@@ -275,7 +275,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Main is
if not AINU.Is_Empty (Connections (E)) then
S := AIN.First_Node (Connections (E));
while Present (S) loop
Put_Line (Image (AIN.Display_Name (AIN.Identifier (S))));
-- Put_Line (Image (AIN.Display_Name (AIN.Identifier (S))));
S := AIN.Next_Node (S);
end loop;
end if;
......@@ -346,7 +346,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Main is
Aux_N_Port_3 := BLNu.Make_Node_Container (N_Port);
BLNu.Append_Node_To_List (Make_Gate_Declaration
(Make_Identifier ("LNT_Channel_Data"),
(Make_Identifier ("LNT_Channel_Port"),
N_Port), L_Gates_Declaration);
BLNu.Append_Node_To_List (Aux_N_Port_1, Device_Gates_List);
......@@ -456,6 +456,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Main is
N_Event : Node_Id;
Aux_N_Event : Node_Id;
Aux_N_Event_1 : Node_Id;
N_Port : Node_Id;
Aux_N_Port_1 : Node_Id;
Aux_N_Port_2 : Node_Id;
......@@ -513,7 +514,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Main is
Aux_N_Port_4 := BLNu.Make_Node_Container (N_Port);
BLNu.Append_Node_To_List (Make_Gate_Declaration
(Make_Identifier ("LNT_Channel_Data"),
(Make_Identifier ("LNT_Channel_Port"),
N_Port), L_Gates_Declaration);
BLNu.Append_Node_To_List (Aux_N_Port_1, Thread_Gates_List);
......@@ -558,7 +559,9 @@ package body Ocarina.Backends.LNT.Tree_Generator_Main is
elsif AIN.Is_Event (S) then
-- event port
if Is_Not_Periodic then
Aux_N_Event := BLNu.Make_Node_Container (N_Event);
Aux_N_Event_1 := BLNu.Make_Node_Container (N_Event);
Port_Gates_List := New_List (
Make_Identifier (N_SEND), -- SEND_
Aux_N_Port_3, -- RECEIVE_
......@@ -569,7 +572,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Main is
New_List (Make_Identifier (Integer'Image
(Queue_Size))));
BLNu.Append_Node_To_List (N_Event,
BLNu.Append_Node_To_List (Aux_N_Event_1,
Interface_Connection_Gates_List);
else
Port_Gates_List := New_List (
......
......@@ -91,10 +91,10 @@ package body Ocarina.Backends.LNT.Tree_Generator_Port is
No_List,
New_List (
Make_Gate_Declaration
(Make_Identifier ("LNT_Channel_Data"),
(Make_Identifier ("LNT_Channel_Port"),
Make_Identifier ("Input")),
Make_Gate_Declaration
(Make_Identifier ("LNT_Channel_Data"),
(Make_Identifier ("LNT_Channel_Port"),
Make_Identifier ("Output"))),
No_List,
No_List,
......
......@@ -1454,7 +1454,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Processor is
New_List (
Make_Communication_Statement
(Make_Identifier ("ACTIVATION"),
New_List (Make_Identifier ("T_All")),
New_List (Make_Identifier ("T_Dispatch_Completion")),
false, No_Node),
Make_Assignment_Statement (
Make_Identifier ("Threads"),
......@@ -1485,7 +1485,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Processor is
New_List (
Make_Communication_Statement
(Make_Identifier ("ACTIVATION"),
New_List (Make_Identifier ("T_End")),
New_List (Make_Identifier ("T_Preemption_Completion")),
false, No_Node),
Make_Assignment_Statement (
Make_Identifier ("Threads"),
......@@ -1507,7 +1507,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Processor is
New_List (
Make_Communication_Statement
(Make_Identifier ("ACTIVATION"),
New_List (Make_Identifier ("T_Begin")),
New_List (Make_Identifier ("T_Dispatch_Preemption")),
false, No_Node),
Make_Assignment_Statement (
Make_Identifier ("Threads"),
......@@ -1520,7 +1520,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Processor is
New_List (Make_Communication_Statement
(Make_Identifier ("ACTIVATION"),
New_List (Make_Identifier ("T_Preempt")),
New_List (Make_Identifier ("T_Preemption")),
false, No_Node))),
Make_Assignment_Statement (
Make_Identifier ("Threads"),
......@@ -1532,7 +1532,7 @@ package body Ocarina.Backends.LNT.Tree_Generator_Processor is
Make_Time_Const (0)))),
Make_Communication_Statement
(Make_Identifier ("ACTIVATION"),
New_List (Make_Identifier ("T_Ok")))),
New_List (Make_Identifier ("T_Complete")))),
New_List (
Make_Elsif_Statement
(Make_Infix_Function_Call_Expression (
......
......@@ -108,19 +108,19 @@ package body Ocarina.Backends.LNT.Tree_Generator_Types is
Make_Type_Exp (
No_Node,
New_List (
Make_Type_Constructor (Make_Identifier ("T_Begin"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier ("T_End"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier ("T_All"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier ("T_Preempt"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier
("T_Dispatch_Preemption"), No_List, No_List),
Make_Type_Constructor (Make_Identifier
("T_Preemption_Completion"), No_List, No_List),
Make_Type_Constructor (Make_Identifier
("T_Dispatch_Completion"), No_List, No_List),
Make_Type_Constructor (Make_Identifier
("T_Preemption"), No_List, No_List),
Make_Type_Constructor (Make_Identifier ("T_Stop"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier ("T_Error"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier ("T_Ok"),
Make_Type_Constructor (Make_Identifier ("T_Complete"),
No_List, No_List)),
false, false, false, false, false, false),
No_List,
......@@ -140,7 +140,18 @@ package body Ocarina.Backends.LNT.Tree_Generator_Types is
No_List,
No_List);
BLNu.Append_Node_To_List (N, L_Types);
-- When BA
if not Is_Empty (LNT_States_List) then
N := Make_Type_Def
(Make_Identifier ("LNT_Type_States"),
Make_Type_Exp (
No_Node,
LNT_States_List,
false, false, false, false, false, false),
No_List,
No_List);
BLNu.Append_Node_To_List (N, L_Types);
end if;
end Add_LNT_Types;
procedure Add_LNT_Channels (L_Channels : List_Id) is
......@@ -161,6 +172,31 @@ package body Ocarina.Backends.LNT.Tree_Generator_Types is
Make_Gate_Profile (New_List (Make_Identifier ("LNT_Type_Event")))));
BLNu.Append_Node_To_List (N, L_Channels);
-- When BA
if not Is_Empty (LNT_States_List) then
N := Make_Channel (
Make_Identifier ("LNT_Channel_Event_Port"),
New_List (
Make_Gate_Profile (New_List (Make_Identifier
("Bool")))));
BLNu.Append_Node_To_List (N, L_Channels);
N := Make_Channel (
Make_Identifier ("LNT_Channel_Event_Data_Port"),
New_List (
Make_Gate_Profile (New_List (
Make_Identifier ("LNT_Type_Data"),
Make_Identifier ("Bool")
))));
BLNu.Append_Node_To_List (N, L_Channels);
N := Make_Channel (
Make_Identifier ("LNT_Channel_Data_Port"),
New_List (
Make_Gate_Profile (New_List (Make_Identifier
("LNT_Type_Data")))));
BLNu.Append_Node_To_List (N, L_Channels);
end if;
end Add_LNT_Channels;
procedure Add_LNT_Functions (L_Functions : List_Id;
......@@ -329,19 +365,42 @@ package body Ocarina.Backends.LNT.Tree_Generator_Types is
(New_Identifier (Get_String_Name ("_Types"),
Get_Name_String (System_Name)));
Definitions_List := New_List;
-- Data generic type
N := Make_Type_Def
(Make_Identifier ("LNT_Type_Data"),
Make_Identifier ("AADLDATA"),
Make_Type_Exp (
No_Node,
New_List (
Make_Type_Constructor (Make_Identifier ("AADLDATA"),
No_List, No_List),
Make_Type_Constructor (Make_Identifier ("EMPTY"),
No_List, No_List)),
false, false, false, false, false, false),
No_List,
No_List);
BLNu.Append_Node_To_List (N, Definitions_List);
-- generic list of Data
N := Make_Type_Def
(Make_Identifier ("LNT_Type_Data_FIFO"),
Make_Type_Exp (
Make_Identifier ("LNT_Type_Data"),
No_List,
false, false, true, false, false, false),
No_List,
New_List (Make_Predefined_Function (K_Equality, true),
Make_Predefined_Function (K_Length, true),
Make_Predefined_Function (K_Append, true),
Make_Predefined_Function (K_Tail, true),
Make_Predefined_Function (K_Head, true),
Make_Predefined_Function (K_Inequality, true)
));
BLNu.Append_Node_To_List (N, Definitions_List);
-- generic channel
N := Make_Channel
(Make_Identifier ("LNT_Channel_Data"),
(Make_Identifier ("LNT_Channel_Port"),
New_List (
Make_Gate_Profile (New_List (
Make_Identifier ("LNT_Type_Data")))));
BLNu.Append_Node_To_List (N, Definitions_List);
Add_LNT_Types (Definitions_List, Thread_Number, Hyperperiod);
......
......@@ -59,7 +59,7 @@ package Ocarina.Backends.LNT is
Not_Periodic_Thread_Number : Natural := 0;
Hyperperiod : Integer := 0;
LNT_Thread_Instance_List : List_Id := No_List;
LNT_States_List : List_Id := No_List;
private
Separator : Types.Name_Id;
LNT_Threads : Node_Id;
......
......@@ -112,6 +112,13 @@ module Ocarina::Backends::LNT::Nodes {
interface First_Element : Predefined_Function {}; // "first"
interface Last_Element : Predefined_Function {}; // "last"
// predefined functions for LNT lists
interface Length : Predefined_Function {}; // "length"
interface Append : Predefined_Function {}; // "append"
interface Head : Predefined_Function {}; // "head"
interface Tail : Predefined_Function {}; // "tail"
interface Reverse : Predefined_Function {}; // "reverse"
// Functions on Booleans and, and then, or, or else, xor, implies
interface _And : Predefined_Function {};
interface _Or : Predefined_Function {};
......
......@@ -120,21 +120,6 @@ package body Ocarina.Analyzer.AADL_BA is
List_First_Node : in out Node_Id;
List_Last_Node : in out Node_Id);
function Is_Complete
(BA_Root : Node_Id;
State : Node_Id)
return boolean;
function Is_Initial
(BA_Root : Node_Id;
State : Node_Id)
return boolean;
function Is_Final
(BA_Root : Node_Id;
State : Node_Id)
return boolean;
function Exist_In_Modes
(Component : Node_Id;
State : Node_Id)
......
......@@ -38,4 +38,19 @@ package Ocarina.Analyzer.AADL_BA is
function Analyze_Model (Root : Node_Id) return Boolean;
-- Proceed to BA analysis
function Is_Complete
(BA_Root : Node_Id;
State : Node_Id)
return boolean;
function Is_Initial
(BA_Root : Node_Id;
State : Node_Id)
return boolean;
function Is_Final
(BA_Root : Node_Id;
State : Node_Id)
return boolean;
end Ocarina.Analyzer.AADL_BA;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment