Commit 66f5d189 authored by Julien's avatar Julien

update code, ability to generate connections

information.
parent febe7139
......@@ -3897,6 +3897,21 @@ package body Ocarina.Backends.Utils is
return No_Node;
end Get_Associated_Bus;
------------------------
-- Get_Root_Component --
------------------------
function Get_Root_Component (C : Node_Id)
return Node_Id is
begin
if (Parent_Subcomponent (C) = No_Node) then
return C;
end if;
return Get_Root_Component
(Parent_Component (Parent_Subcomponent (C)));
end Get_Root_Component;
-----------------------------
-- Find_Associated_Process --
-----------------------------
......@@ -3909,11 +3924,7 @@ package body Ocarina.Backends.Utils is
Current_Node : Node_Id;
begin
if Root_Node = No_Node then
Current_Node := Runtime;
while (Parent_Subcomponent (Current_Node) /= No_Node) loop
Current_Node := Parent_Component
(Parent_Subcomponent (Current_Node));
end loop;
Current_Node := Get_Root_Component (Runtime);
else
Current_Node := Root_Node;
end if;
......@@ -3941,4 +3952,44 @@ package body Ocarina.Backends.Utils is
return No_Node;
end Find_Associated_Process;
---------------------------
-- Get_Partition_Runtime --
---------------------------
function Get_Partition_Runtime (Process : Node_Id;
Root_Node : Node_Id := No_Node)
return Node_Id is
T : Node_Id;
S : Node_Id;
Current_Node : Node_Id;
begin
if Root_Node = No_Node then
Current_Node := Get_Root_Component (Process);
else
Current_Node := Root_Node;
end if;
if Get_Category_Of_Component (Current_Node) = CC_Virtual_Processor
and then Get_Bound_Processor (Process) = Current_Node
then
return Current_Node;
end if;
if not AAU.Is_Empty (Subcomponents (Current_Node)) then
S := First_Node (Subcomponents (Current_Node));
while Present (S) loop
T := Get_Partition_Runtime
(Process, Corresponding_Instance (S));
if T /= No_Node then
return T;
end if;
S := Next_Node (S);
end loop;
end if;
return No_Node;
end Get_Partition_Runtime;
end Ocarina.Backends.Utils;
......@@ -490,4 +490,11 @@ package Ocarina.Backends.Utils is
Root_Node : Node_Id := No_Node)
return Node_Id;
function Get_Partition_Runtime (Process : Node_Id;
Root_Node : Node_Id := No_Node)
return Node_Id;
function Get_Root_Component (C : Node_Id)
return Node_Id;
end Ocarina.Backends.Utils;
-- with Locations;
with Ocarina.Backends.Utils;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.C_Common.Mapping;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
-- with Ocarina.Backends.Vxworks653_Conf.Mapping;
......@@ -13,6 +15,7 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
-- use Locations;
use Ocarina.ME_AADL;
use Ocarina.Backends.Utils;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
......@@ -20,16 +23,16 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
-- use Ocarina.Backends.Vxworks653_Conf.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
Root_Node : Node_Id := No_Node;
Schedules_Node : Node_Id := No_Node;
Connections_Node : Node_Id := No_Node;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
procedure Visit_System_Instance (E : Node_Id);
procedure Visit_Process_Instance (E : Node_Id);
procedure Visit_Processor_Instance (E : Node_Id);
procedure Visit_Bus_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
......@@ -72,9 +75,6 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
when CC_System =>
Visit_System_Instance (E);
when CC_Process =>
Visit_Process_Instance (E);
when CC_Processor =>
Visit_Processor_Instance (E);
......@@ -89,25 +89,6 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
end case;
end Visit_Component_Instance;
----------------------------
-- Visit_Process_Instance --
----------------------------
procedure Visit_Process_Instance (E : Node_Id) is
S : Node_Id;
begin
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end Visit_Process_Instance;
---------------------------
-- Visit_System_Instance --
---------------------------
......@@ -145,6 +126,7 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
procedure Visit_Processor_Instance (E : Node_Id) is
U : Node_Id;
P : Node_Id;
S : Node_Id;
begin
U := XTN.Unit (Backend_Node (Identifier (E)));
P := XTN.Node (Backend_Node (Identifier (E)));
......@@ -154,10 +136,22 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
Current_XML_Node := XTN.Root_Node (XTN.XML_File (U));
Schedules_Node := Make_XML_Node ("Connections");
Connections_Node := Make_XML_Node ("Connections");
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
if AINU.Is_Virtual_Processor (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
Append_Node_To_List
(Schedules_Node,
(Connections_Node,
XTN.Subitems (Current_XML_Node));
Pop_Entity;
......@@ -169,9 +163,69 @@ package body Ocarina.Backends.Vxworks653_Conf.Connections is
--------------------------------------
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
pragma Unreferenced (E);
Corresponding_Process : Node_Id;
Connection_Node : Node_Id;
Source_Node : Node_Id;
Destination_Node : Node_Id;
Feature : Node_Id;
Port_Source : Node_Id;
Port_Destination : Node_Id;
Partition_Destination : Node_Id;
begin
null;
Corresponding_Process := Find_Associated_Process (E);
Feature := First_Node (Features (Corresponding_Process));
while Present (Feature) loop
if Is_Data (Feature) and then Is_Out (Feature)
then
Port_Source := Feature;
Port_Destination := Item (First_Node (Destinations (Feature)));
Partition_Destination := Parent_Component (Port_Destination);
Connection_Node := Make_XML_Node ("Connection");
Source_Node := Make_XML_Node ("Source");
Add_Attribute ("PartitionNameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(E)))),
Source_Node);
Add_Attribute ("PortNameRef",
Get_Name_String
(C_Common.Mapping.Map_Port_Name
(Port_Source)),
Source_Node);
Append_Node_To_List (Source_Node,
XTN.Subitems (Connection_Node));
Destination_Node := Make_XML_Node ("Destination");
Add_Attribute ("PortNameRef",
Get_Name_String
(C_Common.Mapping.Map_Port_Name
(Port_Destination)),
Destination_Node);
Add_Attribute ("PartitionNameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(Get_Partition_Runtime
(Partition_Destination))))),
Destination_Node);
Append_Node_To_List (Destination_Node,
XTN.Subitems (Connection_Node));
Append_Node_To_List (Connection_Node,
XTN.Subitems (Connections_Node));
end if;
Feature := Next_Node (Feature);
end loop;
end Visit_Virtual_Processor_Instance;
end Ocarina.Backends.Vxworks653_Conf.Connections;
......@@ -4,6 +4,7 @@ with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.C_Common.Mapping;
with Ocarina.Backends.Properties;
with Ocarina.Backends.Utils;
with Ocarina.Backends.XML_Tree.Nodes;
......@@ -267,7 +268,10 @@ package body Ocarina.Backends.Vxworks653_Conf.Naming is
Port_Node := Make_XML_Node ("QueuingPort");
XTU.Add_Attribute ("MessageSize", "1", Port_Node);
XTU.Add_Attribute ("Name", "1", Port_Node);
XTU.Add_Attribute ("Name",
Get_Name_String
(C_Common.Mapping.Map_Port_Name (Feature)),
Port_Node);
XTU.Add_Attribute ("QueueLength", "1", Port_Node);
if not Is_In (Feature) and then
......@@ -384,7 +388,6 @@ package body Ocarina.Backends.Vxworks653_Conf.Naming is
Shared_Library_Description_Node : Node_Id;
Shared_Memory_Size_Node : Node_Id;
begin
-- We have to generate a file that will
-- look like the following.
--
-- <SharedLibraryRegions>
......
-- with Locations;
with Ocarina.Namet; use Ocarina.Namet;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
......@@ -21,6 +22,7 @@ package body Ocarina.Backends.Vxworks653_Conf.Payloads is
-- use Ocarina.Backends.Properties;
-- use Ocarina.Backends.Vxworks653_Conf.Mapping;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
......@@ -145,6 +147,7 @@ package body Ocarina.Backends.Vxworks653_Conf.Payloads is
procedure Visit_Processor_Instance (E : Node_Id) is
U : Node_Id;
P : Node_Id;
S : Node_Id;
Payloads_Node : Node_Id;
Core_OS_Payload_Node : Node_Id;
Shared_Library_Payload_Node : Node_Id;
......@@ -186,13 +189,28 @@ package body Ocarina.Backends.Vxworks653_Conf.Payloads is
Append_Node_To_List (Config_Record_Payload_Node,
XTN.Subitems (Payloads_Node));
Partition_Payload_Node
:= Make_XML_Node ("PartitionPayload");
Add_Attribute ("NameRef",
"tobefixed",
Partition_Payload_Node);
Append_Node_To_List (Partition_Payload_Node,
XTN.Subitems (Payloads_Node));
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
if AINU.Is_Virtual_Processor (Corresponding_Instance (S)) then
Partition_Payload_Node
:= Make_XML_Node ("PartitionPayload");
Add_Attribute ("NameRef",
Get_Name_String
(AIN.Name
(AIN.Identifier
(Parent_Subcomponent
(Corresponding_Instance (S))))),
Partition_Payload_Node);
Append_Node_To_List (Partition_Payload_Node,
XTN.Subitems (Payloads_Node));
end if;
S := Next_Node (S);
end loop;
end if;
Pop_Entity;
Pop_Entity;
......
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