Commit ffc9a157 authored by julien.delange's avatar julien.delange

* Map the XMHypervisor part of the XML configuration of Xtratum



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2157 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 55bb8d1e
......@@ -35,33 +35,36 @@ with Namet; use Namet;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Tree.Nodes;
-- with Ocarina.ME_AADL.AADL_Tree.Entities;
with Ocarina.ME_AADL.AADL_Tree.Entities;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Instances.Queries;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Messages;
with Ocarina.Backends.Properties;
with Ocarina.Backends.XML_Values;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.Xtratum_Conf.Mapping;
package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Instances.Queries;
use Ocarina.Backends.Utils;
use Ocarina.Backends.Messages;
use Ocarina.Backends.Properties;
use Ocarina.Backends.XML_Values;
use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.Xtratum_Conf.Mapping;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
-- package ATE renames Ocarina.ME_AADL.AADL_Tree.Entities;
package ATE renames Ocarina.ME_AADL.AADL_Tree.Entities;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XV renames Ocarina.Backends.XML_Values;
......@@ -70,11 +73,10 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
procedure Visit_Component_Instance (E : Node_Id);
procedure Visit_System_Instance (E : Node_Id);
procedure Visit_Process_Instance (E : Node_Id);
procedure Visit_Memory_Instance (E : Node_Id);
procedure Visit_Processor_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
Scheduling_Node : Node_Id;
Window_Number : Unsigned_Long_Long := 0;
Processor_Identifier : Unsigned_Long_Long := 0;
-----------
......@@ -122,6 +124,9 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
when CC_Processor =>
Visit_Processor_Instance (E);
when CC_Memory =>
Visit_Memory_Instance (E);
when CC_Virtual_Processor =>
Visit_Virtual_Processor_Instance (E);
......@@ -135,10 +140,9 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
----------------------------
procedure Visit_Process_Instance (E : Node_Id) is
N : Node_Id;
pragma Unreferenced (E);
begin
Map_Process_Scheduling (E, Window_Number, N);
Append_Node_To_List (N, XTN.Subitems (Scheduling_Node));
null;
end Visit_Process_Instance;
---------------------------
......@@ -149,6 +153,7 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
S : Node_Id;
Hw_Desc_Node : Node_Id;
Processor_Node : Node_Id;
Memory_Node : Node_Id;
U : Node_Id;
R : Node_Id;
begin
......@@ -172,6 +177,9 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
Current_XML_Node := Processor_Node;
-- First, create the <ProcessorTable> section of the hardware
-- description of the system.
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
......@@ -183,6 +191,29 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
S := Next_Node (S);
end loop;
end if;
-- Then, create the <MemoryLayout> section of the hardware
-- description of the system.
Memory_Node := Make_XML_Node ("MemoryLayout");
Append_Node_To_List (Memory_Node,
XTN.Subitems (Hw_Desc_Node));
Current_XML_Node := Memory_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_Memory (Corresponding_Instance (S)) then
Visit (Corresponding_Instance (S));
end if;
S := Next_Node (S);
end loop;
end if;
Pop_Entity;
Pop_Entity;
end Visit_System_Instance;
......@@ -200,7 +231,7 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
Plan_Node : Node_Id;
Start_Time : Unsigned_Long_Long := 0;
Slot_Node : Node_Id;
-- Partition : Node_Id;
Partition : Node_Id;
Slot_Identifier : Unsigned_Long_Long := 0;
Slots : constant Time_Array
:= Get_POK_Slots (E);
......@@ -213,8 +244,6 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
Fatal => True);
end if;
Scheduling_Node := Make_XML_Node ("Processor");
-- First, add a <Processor> node
Processor_Node := Make_XML_Node ("Processor");
......@@ -269,6 +298,8 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
S := ATN.First_Node (Slots_Allocation);
for I in Slots'Range loop
Partition := ATE.Get_Referenced_Entity (S);
-- Create the node that corresponds to the slot.
Slot_Node := Make_XML_Node ("Slot");
......@@ -279,6 +310,15 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal (XV.New_Numeric_Value (Slot_Identifier, 0, 10));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Slot_Node));
-- Associate a fixed identifier to the slot.
Set_Str_To_Name_Buffer ("partitionId");
P := Make_Defining_Identifier (Name_Find);
Q := Copy_Node (Backend_Node (Identifier (Partition)));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Slot_Node));
......@@ -334,7 +374,6 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
S : Node_Id;
Processes : List_Id;
begin
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
......@@ -346,15 +385,49 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
S := Next_Node (S);
end loop;
end if;
if Present (Backend_Node (Identifier (E))) then
Processes := XTN.Processes (Backend_Node (Identifier (E)));
S := XTN.First_Node (Processes);
while Present (S) loop
Visit (XTN.Content (S));
S := XTN.Next_Node (S);
end loop;
end if;
end Visit_Virtual_Processor_Instance;
---------------------------
-- Visit_Memory_Instance --
---------------------------
procedure Visit_Memory_Instance (E : Node_Id) is
P : Node_Id;
Q : Node_Id;
Memory_Node : Node_Id;
begin
Memory_Node := Make_XML_Node ("Region");
-- Add the start attribute of the region node.
Set_Str_To_Name_Buffer ("start");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Numeric_Value
(Get_Integer_Property (E, "base_address"), 0, 10));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Memory_Node));
-- Add the size attribute of the region node.
Set_Str_To_Name_Buffer ("size");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Numeric_Value
(Get_Integer_Property (E, "byte_count"), 0, 10));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Memory_Node));
-- Add the type attribute of the region node.
Set_Str_To_Name_Buffer ("type");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("stram");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Memory_Node));
Append_Node_To_List (Memory_Node, XTN.Subitems (Current_XML_Node));
end Visit_Memory_Instance;
end Ocarina.Backends.Xtratum_Conf.Hardware_Description;
......@@ -33,14 +33,11 @@
with Namet; use Namet;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Tree.Nodes;
with Ocarina.ME_AADL.AADL_Tree.Entities;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
with Ocarina.ME_AADL.AADL_Instances.Nutils;
with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Messages;
with Ocarina.Backends.XML_Common.Mapping;
with Ocarina.Backends.XML_Values;
with Ocarina.Backends.XML_Tree.Nodes;
......@@ -52,13 +49,10 @@ package body Ocarina.Backends.Xtratum_Conf.Mapping is
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.Utils;
use Ocarina.Backends.Messages;
use Ocarina.Backends.XML_Common.Mapping;
use Ocarina.Backends.XML_Tree.Nodes;
use Ocarina.Backends.XML_Tree.Nutils;
package ATN renames Ocarina.ME_AADL.AADL_Tree.Nodes;
package ATE renames Ocarina.ME_AADL.AADL_Tree.Entities;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XV renames Ocarina.Backends.XML_Values;
......@@ -809,118 +803,6 @@ package body Ocarina.Backends.Xtratum_Conf.Mapping is
return N;
end Map_Process_Memory;
----------------------------
-- Map_Process_Scheduling --
----------------------------
procedure Map_Process_Scheduling
(Process : Node_Id;
Window_Number : in out Unsigned_Long_Long;
N : out Node_Id)
is
P : Node_Id;
Q : Node_Id;
Window_Node : Node_Id;
Associated_Virtual_Processor : constant Node_Id
:= Get_Bound_Processor (Process);
Associated_Processor : constant Node_Id
:= Parent_Component
(Parent_Subcomponent (Associated_Virtual_Processor));
Slots : constant Time_Array
:= Get_POK_Slots (Associated_Processor);
Slots_Allocation : List_Id;
S : Node_Id;
Referenced_Entity : Node_Id;
Start_Time : Long_Double := 0.0;
Duration_Time : Long_Double := 0.0;
begin
N := Make_XML_Node ("Partition_Schedule");
Slots_Allocation := Get_POK_Slots_Allocation
(Associated_Processor);
if Slots_Allocation = No_List then
Display_Error
("You must provide the slots allocation for each processor",
Fatal => True);
end if;
Set_Str_To_Name_Buffer ("PartitionName");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Defining_Identifier
(To_XML_Name
(Display_Name
(Identifier
(Parent_Subcomponent (Process)))));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
if Present (Backend_Node (Identifier (Process))) then
Set_Str_To_Name_Buffer ("PartitionIdentifier");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement
(Q, Copy_Node (Backend_Node (Identifier (Process)))),
XTN.Items (N));
end if;
Set_Str_To_Name_Buffer ("PeriodSeconds");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Floating_Point_Value
(To_Seconds
(Get_POK_Major_Frame
(Associated_Processor))));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
Start_Time := 0.0;
S := ATN.First_Node (Slots_Allocation);
for I in Slots'Range loop
Referenced_Entity := ATE.Get_Referenced_Entity (S);
if Referenced_Entity = Associated_Virtual_Processor then
Window_Node := Make_XML_Node ("Window_Schedule");
Set_Str_To_Name_Buffer ("WindowStartSeconds");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Floating_Point_Value (Start_Time));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Window_Node));
Set_Str_To_Name_Buffer ("WindowIdentifier");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Numeric_Value
(Window_Number, 1, 10));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Window_Node));
Set_Str_To_Name_Buffer ("WindowDurationSeconds");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Floating_Point_Value
(To_Seconds (Slots (I))));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Window_Node));
Append_Node_To_List (Window_Node, XTN.Subitems (N));
Window_Number := Window_Number + 1;
Duration_Time := Duration_Time + To_Seconds (Slots (I));
end if;
Start_Time := Start_Time + To_Seconds (Slots (I));
S := ATN.Next_Node (S);
end loop;
Set_Str_To_Name_Buffer ("PeriodDurationSeconds");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Floating_Point_Value (Duration_Time));
Append_Node_To_List (Make_Assignement (P, Q), XTN.Items (N));
end Map_Process_Scheduling;
--------------
-- Map_Port --
--------------
......
......@@ -53,11 +53,6 @@ package Ocarina.Backends.Xtratum_Conf.Mapping is
function Map_Port_Connection (E : Node_Id) return Node_Id;
function Map_Process_Memory (Process : Node_Id) return Node_Id;
function Map_System_Description (System : Node_Id) return Node_Id;
procedure Map_Process_Scheduling
(Process : Node_Id;
Window_Number : in out Unsigned_Long_Long;
N : out Node_Id);
function Map_Connection
(Connection : Node_Id; Channel_Identifier : Unsigned_Long_Long)
return Node_Id;
......
......@@ -37,6 +37,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.XML_Values;
with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.Xtratum_Conf.Mapping;
......@@ -47,12 +48,14 @@ package body Ocarina.Backends.Xtratum_Conf.System_Description is
use Ocarina.ME_AADL;
use Ocarina.ME_AADL.AADL_Instances.Nodes;
use Ocarina.ME_AADL.AADL_Instances.Entities;
use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.Xtratum_Conf.Mapping;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XV renames Ocarina.Backends.XML_Values;
procedure Visit_Architecture_Instance (E : Node_Id);
procedure Visit_Component_Instance (E : Node_Id);
......@@ -62,6 +65,8 @@ package body Ocarina.Backends.Xtratum_Conf.System_Description is
procedure Visit_Bus_Instance (E : Node_Id);
procedure Visit_Virtual_Processor_Instance (E : Node_Id);
Partition_Identifier : Unsigned_Long_Long := 0;
-----------
-- Visit --
-----------
......@@ -223,8 +228,16 @@ package body Ocarina.Backends.Xtratum_Conf.System_Description is
--------------------------------------
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
S : Node_Id;
S : Node_Id;
Partition_Identifier_Node : Node_Id;
begin
Partition_Identifier_Node :=
Make_Literal (XV.New_Numeric_Value
(Partition_Identifier, 1, 10));
AIN.Set_Backend_Node
(Identifier (E), Partition_Identifier_Node);
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
......@@ -235,6 +248,9 @@ package body Ocarina.Backends.Xtratum_Conf.System_Description is
S := Next_Node (S);
end loop;
end if;
Partition_Identifier := Partition_Identifier + 1;
end Visit_Virtual_Processor_Instance;
end Ocarina.Backends.Xtratum_Conf.System_Description;
......@@ -41,6 +41,7 @@ with Ocarina.Backends.XML_Tree.Generator;
with Ocarina.Backends.Utils;
with Ocarina.Backends.Xtratum_Conf.System_Description;
with Ocarina.Backends.Xtratum_Conf.Hardware_Description;
with Ocarina.Backends.Xtratum_Conf.Xm_Hypervisor;
with GNAT.Command_Line; use GNAT.Command_Line;
......@@ -162,6 +163,7 @@ package body Ocarina.Backends.Xtratum_Conf is
System_Description.Visit (E);
Hardware_Description.Visit (E);
Xm_Hypervisor.Visit (E);
XTU.Pop_Entity;
end Visit_Architecture_Instance;
......
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