Commit d62799a8 authored by jhugues's avatar jhugues
Browse files

* Minor reformatting



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@5936 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent b682b081
......@@ -61,76 +61,76 @@ package body Ocarina.Backends.PN.Components is
package OAV renames Ocarina.AADL_Values;
procedure Pn_Process_Final_System
(Pn_Generated : Node_Id;
Pn_P_Init_Proc : Pn_Init_Node;
Pn_P_New_Proc : Pn_New_Node;
Pn_A_Init_Proc : Pn_Init_Arc;
Pn_A_New_Proc : Pn_New_Node;
Pn_Dup_Arc_Proc : Pn_Dup_Arc);
procedure PN_Process_Final_System
(PN_Generated : Node_Id;
PN_P_Init_Proc : PN_Init_Node;
PN_P_New_Proc : PN_New_Node;
PN_A_Init_Proc : PN_Init_Arc;
PN_A_New_Proc : PN_New_Node;
PN_Dup_Arc_Proc : PN_Dup_Arc);
function Process_Component_Instance
(Instance : Types.Node_Id;
Pn_Generated : Types.Node_Id)
PN_Generated : Types.Node_Id)
return Boolean;
function Process_Thread_Instance
(Aadl_Instance : Types.Node_Id;
Pn_Generated : Types.Node_Id)
PN_Generated : Types.Node_Id)
return Boolean;
procedure Pn_Process_Thread_Pattern
procedure PN_Process_Thread_Pattern
(Aadl_Instance : Types.Node_Id;
Pn_Thread : Types.Node_Id;
Pn_Generated : Types.Node_Id;
Pn_P_Init_Proc : Pn_Init_Node;
Pn_P_New_Proc : Pn_New_Node;
Pn_T_Init_Proc : Pn_Init_Node;
Pn_T_New_Proc : Pn_New_Node;
Pn_A_Init_Proc : Pn_Init_Arc;
Pn_A_New_Proc : Pn_New_Node);
procedure Pn_Thread_Skeleton
PN_Thread : Types.Node_Id;
PN_Generated : Types.Node_Id;
PN_P_Init_Proc : PN_Init_Node;
PN_P_New_Proc : PN_New_Node;
PN_T_Init_Proc : PN_Init_Node;
PN_T_New_Proc : PN_New_Node;
PN_A_Init_Proc : PN_Init_Arc;
PN_A_New_Proc : PN_New_Node);
procedure PN_Thread_Skeleton
(Aadl_Instance : Types.Node_Id;
Pn_Thread : Types.Node_Id;
Pn_Generated : Types.Node_Id;
Pn_P_Init_Proc : Pn_Init_Node;
Pn_P_New_Proc : Pn_New_Node;
Pn_T_Init_Proc : Pn_Init_Node;
Pn_T_New_Proc : Pn_New_Node;
Pn_A_Init_Proc : Pn_Init_Arc;
Pn_A_New_Proc : Pn_New_Node);
procedure Pn_Build_Spg_Par
PN_Thread : Types.Node_Id;
PN_Generated : Types.Node_Id;
PN_P_Init_Proc : PN_Init_Node;
PN_P_New_Proc : PN_New_Node;
PN_T_Init_Proc : PN_Init_Node;
PN_T_New_Proc : PN_New_Node;
PN_A_Init_Proc : PN_Init_Arc;
PN_A_New_Proc : PN_New_Node);
procedure PN_Build_Spg_Par
(Aadl_Instance : Types.Node_Id;
Pn_Generated : Types.Node_Id;
PN_Generated : Types.Node_Id;
Spg_Feat : Types.Node_Id;
Pn_Spg_Call : Types.Node_Id;
PN_Spg_Call : Types.Node_Id;
In_Par : Boolean := True;
Pn_P_Init_Proc : Pn_Init_Node;
Pn_P_New_Proc : Pn_New_Node;
Pn_T_Init_Proc : Pn_Init_Node;
Pn_T_New_Proc : Pn_New_Node;
Pn_A_Init_Proc : Pn_Init_Arc;
Pn_A_New_Proc : Pn_New_Node);
procedure Pn_Build_Port (Aadl_Instance : Types.Node_Id;
Pn_Generated : Types.Node_Id;
Pn_Thread : Types.Node_Id;
PN_P_Init_Proc : PN_Init_Node;
PN_P_New_Proc : PN_New_Node;
PN_T_Init_Proc : PN_Init_Node;
PN_T_New_Proc : PN_New_Node;
PN_A_Init_Proc : PN_Init_Arc;
PN_A_New_Proc : PN_New_Node);
procedure PN_Build_Port (Aadl_Instance : Types.Node_Id;
PN_Generated : Types.Node_Id;
PN_Thread : Types.Node_Id;
F : Types.Value_Id);
procedure Pn_Build_Tpn_Port
procedure PN_Build_Tpn_Port
(Aadl_Instance : Node_Id;
Pn_Generated : Types.Node_Id;
PN_Generated : Types.Node_Id;
Port_Instance : Node_Id;
Pn_Port : Node_Id;
PN_Port : Node_Id;
Is_Data : Boolean := True);
procedure Pn_Build_Cpn_Port
procedure PN_Build_Cpn_Port
(Aadl_Instance : Node_Id;
Pn_Generated : Types.Node_Id;
PN_Generated : Types.Node_Id;
Port_Instance : Node_Id;
Pn_Port : Node_Id;
PN_Port : Node_Id;
Is_Data : Boolean := True);
-----------------------------------
......@@ -149,7 +149,7 @@ package body Ocarina.Backends.PN.Components is
use Ocarina.Backends.PN.Nodes;
Instance : Node_Id;
Pn_Generated : Node_Id;
PN_Generated : Node_Id;
Success : Boolean := False;
-- 0 for CPN, 1 for TPN
......@@ -162,77 +162,77 @@ package body Ocarina.Backends.PN.Components is
Instance := Root_System (Architecture_Instance);
-- initialization of the Petri Net top box
Pn_Generated := Pn_Get_New_Pn_Generated;
Pn_Init_Pn_Generated (Pn_Generated,
PN_Generated := PN_Get_New_PN_Generated;
PN_Init_PN_Generated (PN_Generated,
Formalism);
declare
F : constant Value_Type := Get_Value_Type
(OPN.Formalism (Pn_Generated));
(OPN.Formalism (PN_Generated));
begin
case F.Ival is
when 0 =>
-- CPN Pattern
Set_Pn_Formalism_Specific_Informations
(Pn_Generated,
Pn_Get_New_CPn_Informations);
Set_PN_Formalism_Specific_Informations
(PN_Generated,
PN_Get_New_CPN_Informations);
if Instance /= No_Node and then Pn_Generated /= No_Node then
if Instance /= No_Node and then PN_Generated /= No_Node then
Success := Process_Component_Instance (Instance,
Pn_Generated);
PN_Generated);
if Success then
null;
end if;
end if;
-- assembly and final processing
Pn_Process_Final_System (Pn_Generated,
Pn_Cpn_Init_Place'Access,
Pn_Cpn_Get_New_Place'Access,
Pn_Cpn_Init_Arc'Access,
Pn_Cpn_Get_New_Arc'Access,
Pn_Cpn_Duplicate_Arc'Access);
PN_Process_Final_System (PN_Generated,
PN_Cpn_Init_Place'Access,
PN_Cpn_Get_New_Place'Access,
PN_Cpn_Init_Arc'Access,
PN_Cpn_Get_New_Arc'Access,
PN_Cpn_Duplicate_Arc'Access);
when 1 =>
-- TPN Pattern
-- set specific informations
Set_Pn_Formalism_Specific_Informations
(Pn_Generated,
Pn_Get_New_TPn_Informations);
Set_PN_Formalism_Specific_Informations
(PN_Generated,
PN_Get_New_TPN_Informations);
if Instance /= No_Node and then Pn_Generated /= No_Node then
if Instance /= No_Node and then PN_Generated /= No_Node then
Success := Process_Component_Instance (Instance,
Pn_Generated);
PN_Generated);
if Success then
null;
end if;
end if;
-- assembly and final processing
Pn_Process_Final_System (Pn_Generated,
Pn_Tpn_Init_Place'Access,
Pn_Tpn_Get_New_Place'Access,
Pn_Tpn_Init_Arc'Access,
Pn_Tpn_Get_New_Arc'Access,
Pn_Tpn_Duplicate_Arc'Access);
PN_Process_Final_System (PN_Generated,
PN_Tpn_Init_Place'Access,
PN_Tpn_Get_New_Place'Access,
PN_Tpn_Init_Arc'Access,
PN_Tpn_Get_New_Arc'Access,
PN_Tpn_Duplicate_Arc'Access);
when others =>
null;
end case;
end;
return Pn_Generated;
return PN_Generated;
end Process_Architecture_Instance;
-------------------------------
-- Pn_Process_Final_System --
-- PN_Process_Final_System --
-------------------------------
procedure Pn_Process_Final_System
(Pn_Generated : Node_Id;
Pn_P_Init_Proc : Pn_Init_Node;
Pn_P_New_Proc : Pn_New_Node;
Pn_A_Init_Proc : Pn_Init_Arc;
Pn_A_New_Proc : Pn_New_Node;
Pn_Dup_Arc_Proc : Pn_Dup_Arc)
procedure PN_Process_Final_System
(PN_Generated : Node_Id;
PN_P_Init_Proc : PN_Init_Node;
PN_P_New_Proc : PN_New_Node;
PN_A_Init_Proc : PN_Init_Arc;
PN_A_New_Proc : PN_New_Node;
PN_Dup_Arc_Proc : PN_Dup_Arc)
is
use OPN;
......@@ -250,8 +250,8 @@ package body Ocarina.Backends.PN.Components is
begin
Thread_Iter := OPN.First_Node
(Pn_Subcomponents
(Pn_Box (Pn_Generated)));
(PN_Subcomponents
(PN_Box (PN_Generated)));
-- run across subcomponents
while Present (Thread_Iter) loop
......@@ -259,12 +259,12 @@ package body Ocarina.Backends.PN.Components is
if OPN.Kind (Thread_Iter) = K_Thread_Pattern then
-- run across threads
if OPN.Kind (Pn_Formalism_Specific_Informations (Pn_Generated))
if OPN.Kind (PN_Formalism_Specific_Informations (PN_Generated))
= K_TPN_Specific_Informations then
-- manage processor
declare
Pn_Proc : Node_Id;
PN_Proc : Node_Id;
Aadl_Proc : constant Node_Id
:= Get_Bound_Processor (AIN.Corresponding_Instance
(Get_Container_Process
......@@ -274,44 +274,44 @@ package body Ocarina.Backends.PN.Components is
begin
if Aadl_Proc /= No_Node then
Pn_Proc := Get_Handling (Aadl_Proc,
PN_Proc := Get_Handling (Aadl_Proc,
By_Node,
H_PN_Proc_Creation);
if Pn_Proc = No_Node then
if PN_Proc = No_Node then
-- create processor
Pn_Proc := Pn_Get_New_Processor_Pattern;
Pn_Init_Processor_Pattern (Pn_Proc,
PN_Proc := PN_Get_New_Processor_Pattern;
PN_Init_Processor_Pattern (PN_Proc,
Aadl_Proc);
-- add place in component
declare
P_Proc : Node_Id;
begin
P_Proc := Pn_Tpn_Get_New_Place;
Pn_Tpn_Init_Place (P_Proc,
P_Proc := PN_Tpn_Get_New_Place;
PN_Tpn_Init_Place (P_Proc,
Aadl_Proc,
Get_String_Name ("_Processor"),
Pn_Generated,
PN_Generated,
0);
Set_Tokens_Number (P_Proc,
New_Integer_Value (1));
-- add place into component
Append_Node_To_List (P_Proc,
Internal_Places (Pn_Proc));
Internal_Places (PN_Proc));
end;
Set_Handling (Aadl_Proc,
By_Node,
H_PN_Proc_Creation,
Pn_Proc);
PN_Proc);
-- add processor into components list
Append_Node_To_List (Pn_Proc,
Pn_Subcomponents
(Pn_Box (Pn_Generated)));
Append_Node_To_List (PN_Proc,
PN_Subcomponents
(PN_Box (PN_Generated)));
end if;
-- here we have the processor component
......@@ -320,23 +320,23 @@ package body Ocarina.Backends.PN.Components is
-- first, find dedicated entry in tpn_info to update
-- priorities
if Is_Empty (Priorities
(Pn_Formalism_Specific_Informations
(Pn_Generated))) then
(PN_Formalism_Specific_Informations
(PN_Generated))) then
-- first entry in the list
Proc_Prio_Node := Pn_Get_New_Processor_Priority;
Pn_Init_Processor_Priority (Proc_Prio_Node,
Proc_Prio_Node := PN_Get_New_Processor_Priority;
PN_Init_Processor_Priority (Proc_Prio_Node,
Aadl_Proc);
Append_Node_To_List
(Proc_Prio_Node,
Priorities
(Pn_Formalism_Specific_Informations
(Pn_Generated)));
(PN_Formalism_Specific_Informations
(PN_Generated)));
else
-- find it
Proc_Prio_Node := OPN.First_Node
(Priorities
(Pn_Formalism_Specific_Informations
(Pn_Generated)));
(PN_Formalism_Specific_Informations
(PN_Generated)));
while Present (Proc_Prio_Node) loop
if P_Instance (Proc_Prio_Node) = Aadl_Proc then
-- leave loop
......@@ -353,7 +353,7 @@ package body Ocarina.Backends.PN.Components is
declare
Cs_Iter, Spg_Iter, Trans_Iter : Node_Id;
P_Proc : constant Node_Id :=
OPN.First_Node (Internal_Places (Pn_Proc));
OPN.First_Node (Internal_Places (PN_Proc));
begin
Cs_Iter := OPN.First_Node (Call_Seq (Thread_Iter));
while Present (Cs_Iter) loop
......@@ -371,8 +371,8 @@ package body Ocarina.Backends.PN.Components is
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_A_New_Proc.all;
Pn_A_Init_Proc (New_Arc,
New_Arc := PN_A_New_Proc.all;
PN_A_Init_Proc (New_Arc,
Th_Instance
(Thread_Iter),
P_Proc,
......@@ -381,7 +381,7 @@ package body Ocarina.Backends.PN.Components is
Append_Node_To_List
(New_Arc,
Pn_Arcs_In (Trans_Iter));
PN_Arcs_In (Trans_Iter));
end;
-- since it is begin,
-- its priority needs to be
......@@ -398,8 +398,8 @@ package body Ocarina.Backends.PN.Components is
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_A_New_Proc.all;
Pn_A_Init_Proc (New_Arc,
New_Arc := PN_A_New_Proc.all;
PN_A_Init_Proc (New_Arc,
Th_Instance
(Thread_Iter),
Trans_Iter,
......@@ -408,7 +408,7 @@ package body Ocarina.Backends.PN.Components is
Append_Node_To_List
(New_Arc,
Pn_Arcs_Out (Trans_Iter));
PN_Arcs_Out (Trans_Iter));
end;
-- handle context switch
......@@ -418,8 +418,8 @@ package body Ocarina.Backends.PN.Components is
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_A_New_Proc.all;
Pn_A_Init_Proc (New_Arc,
New_Arc := PN_A_New_Proc.all;
PN_A_Init_Proc (New_Arc,
Th_Instance
(Thread_Iter),
Trans_Iter,
......@@ -428,7 +428,7 @@ package body Ocarina.Backends.PN.Components is
Append_Node_To_List
(New_Arc,
Pn_Arcs_Out (Trans_Iter));
PN_Arcs_Out (Trans_Iter));
end;
-- since it is preemp1, its priority needs
-- to be recorded
......@@ -444,8 +444,8 @@ package body Ocarina.Backends.PN.Components is
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_A_New_Proc.all;
Pn_A_Init_Proc (New_Arc,
New_Arc := PN_A_New_Proc.all;
PN_A_Init_Proc (New_Arc,
Th_Instance
(Thread_Iter),
P_Proc,
......@@ -454,7 +454,7 @@ package body Ocarina.Backends.PN.Components is
Append_Node_To_List
(New_Arc,
Pn_Arcs_In (Trans_Iter));
PN_Arcs_In (Trans_Iter));
end;
-- next
......@@ -471,14 +471,14 @@ package body Ocarina.Backends.PN.Components is
end;
end if; -- tpn for processors
if OPN.Kind (Pn_Formalism_Specific_Informations (Pn_Generated))
if OPN.Kind (PN_Formalism_Specific_Informations (PN_Generated))
= K_TPN_Specific_Informations then
-- TPN
-- set hyperperiod
Set_Hyperperiod (Thread_Iter,
Hyperperiod
(Pn_Formalism_Specific_Informations
(Pn_Generated)));
(PN_Formalism_Specific_Informations
(PN_Generated)));
-- set hyperperiod values to hyperperiod place
declare
......@@ -576,10 +576,10 @@ package body Ocarina.Backends.PN.Components is
begin
-- look at in arcs
Arc_Iter := OPN.First_Node
(Pn_Arcs_In (Pop_Node));
(PN_Arcs_In (Pop_Node));
while Present (Arc_Iter) loop
Pn_Dup_Arc_Proc.all
PN_Dup_Arc_Proc.all
(Arc_Iter,
Th_Instance
(Thread_Iter),
......@@ -593,10 +593,10 @@ package body Ocarina.Backends.PN.Components is
-- look at out arcs
Arc_Iter := OPN.First_Node
(Pn_Arcs_Out (Pop_Node));
(PN_Arcs_Out (Pop_Node));
while Present (Arc_Iter) loop
Pn_Dup_Arc_Proc.all
PN_Dup_Arc_Proc.all
(Arc_Iter,
Th_Instance
(Thread_Iter),
......@@ -689,10 +689,10 @@ package body Ocarina.Backends.PN.Components is
begin
-- look at in arcs
Arc_Iter := OPN.First_Node
(Pn_Arcs_In (Push_Node));
(PN_Arcs_In (Push_Node));
while Present (Arc_Iter) loop
Pn_Dup_Arc_Proc.all
PN_Dup_Arc_Proc.all
(Arc_Iter,
Th_Instance
(Thread_Iter),
......@@ -706,10 +706,10 @@ package body Ocarina.Backends.PN.Components is
-- look at out arcs
Arc_Iter := OPN.First_Node
(Pn_Arcs_Out (Push_Node));
(PN_Arcs_Out (Push_Node));
while Present (Arc_Iter) loop
Pn_Dup_Arc_Proc.all
PN_Dup_Arc_Proc.all
(Arc_Iter,
Th_Instance
(Thread_Iter),
......@@ -798,10 +798,10 @@ package body Ocarina.Backends.PN.Components is
Arc_Iter : Node_Id;
begin
-- look at in arcs
Arc_Iter := OPN.First_Node (Pn_Arcs_In (End_Node));
Arc_Iter := OPN.First_Node (PN_Arcs_In (End_Node));
while Present (Arc_Iter) loop
Pn_Dup_Arc_Proc.all
PN_Dup_Arc_Proc.all
(Arc_Iter,
Th_Instance (Thread_Iter),
Begin_Next_Node,
......@@ -812,10 +812,10 @@ package body Ocarina.Backends.PN.Components is
end loop;
-- look at out arcs
Arc_Iter := OPN.First_Node (Pn_Arcs_Out (End_Node));
Arc_Iter := OPN.First_Node (PN_Arcs_Out (End_Node));
while Present (Arc_Iter) loop
Pn_Dup_Arc_Proc.all
PN_Dup_Arc_Proc.all
(Arc_Iter,
Th_Instance (Thread_Iter),
Begin_Next_Node,
......@@ -879,15 +879,15 @@ package body Ocarina.Backends.PN.Components is
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_A_New_Proc.all;
Pn_A_Init_Proc (New_Arc,
New_Arc := PN_A_New_Proc.all;
PN_A_Init_Proc (New_Arc,
Th_Instance (Thread_Iter),
Wait_Node,
Pop_Node,
1);
Append_Node_To_List (New_Arc,
Pn_Arcs_In
PN_Arcs_In
(Pop_Node));
end;
......@@ -905,7 +905,7 @@ package body Ocarina.Backends.PN.Components is
(Th_Instance (Thread_Iter)) = Thread_Periodic then
-- manage periodic
declare
Beg_Node : Node_Id;
Beg_Node : Node_Id := No_Node;
Wait_Node : Node_Id;
Clock_Node : Node_Id;
Node_Iter : Node_Id;
......@@ -918,8 +918,8 @@ package body Ocarina.Backends.PN.Components is
-- find clock place
if not Is_Empty (Internal_Places (Thread_Iter)) then
if OPN.Kind (Pn_Formalism_Specific_Informations
(Pn_Generated))
if OPN.Kind (PN_Formalism_Specific_Informations
(PN_Generated))
= K_TPN_Specific_Informations then
Node_Iter := OPN.First_Node
......@@ -961,40 +961,42 @@ package body Ocarina.Backends.PN.Components is
end if;
-- add new arc for clock
if OPN.Kind (Pn_Formalism_Specific_Informations
(Pn_Generated))
= K_TPN_Specific_Informations then
if Present (Beg_Node)
and then OPN.Kind (PN_Formalism_Specific_Informations
(PN_Generated))
= K_TPN_Specific_Informations
then
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_Tpn_Get_New_Arc;
Pn_Tpn_Init_Arc (New_Arc,
New_Arc := PN_Tpn_Get_New_Arc;
PN_Tpn_Init_Arc (New_Arc,
Th_Instance (Thread_Iter),
Clock_Node,
Beg_Node,
0);
Append_Node_To_List (New_Arc,
Pn_Arcs_In (Beg_Node));
PN_Arcs_In (Beg_Node));
end;
end if;
-- add new arc for wait node
declare
New_Arc : Node_Id;
begin
New_Arc := Pn_A_New_Proc.all;