Commit 55bb8d1e authored by julien.delange's avatar julien.delange

* ocarina/src/backends/ocarina-backends-xtratum_conf-hardware_description.adb

   - Map Scheduling plan for the module



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@2156 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent f0d16166
......@@ -34,11 +34,14 @@
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.Properties;
with Ocarina.Backends.XML_Values;
with Ocarina.Backends.XML_Tree.Nodes;
......@@ -51,11 +54,14 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description 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.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 AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
package XTN renames Ocarina.Backends.XML_Tree.Nodes;
package XV renames Ocarina.Backends.XML_Values;
......@@ -67,8 +73,9 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
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;
Scheduling_Node : Node_Id;
Window_Number : Unsigned_Long_Long := 0;
Processor_Identifier : Unsigned_Long_Long := 0;
-----------
-- Visit --
......@@ -139,10 +146,11 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
---------------------------
procedure Visit_System_Instance (E : Node_Id) is
S : Node_Id;
Hw_Desc_Node : Node_Id;
U : Node_Id;
R : Node_Id;
S : Node_Id;
Hw_Desc_Node : Node_Id;
Processor_Node : Node_Id;
U : Node_Id;
R : Node_Id;
begin
U := XTN.Unit (Backend_Node (Identifier (E)));
R := XTN.Node (Backend_Node (Identifier (E)));
......@@ -154,6 +162,16 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
Hw_Desc_Node := Make_XML_Node ("HwDescription");
Append_Node_To_List (Hw_Desc_Node,
XTN.Subitems (Current_XML_Node));
Processor_Node := Make_XML_Node ("ProcessorTable");
Append_Node_To_List (Processor_Node,
XTN.Subitems (Hw_Desc_Node));
Current_XML_Node := Processor_Node;
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
......@@ -165,10 +183,6 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
S := Next_Node (S);
end loop;
end if;
Append_Node_To_List (Hw_Desc_Node,
XTN.Subitems (Current_XML_Node));
Pop_Entity;
Pop_Entity;
end Visit_System_Instance;
......@@ -178,19 +192,125 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
------------------------------
procedure Visit_Processor_Instance (E : Node_Id) is
S : Node_Id;
P : Node_Id;
Q : Node_Id;
S : Node_Id;
P : Node_Id;
Q : Node_Id;
Processor_Node : Node_Id;
Plan_Table_Node : Node_Id;
Plan_Node : Node_Id;
Start_Time : Unsigned_Long_Long := 0;
Slot_Node : Node_Id;
-- Partition : Node_Id;
Slot_Identifier : Unsigned_Long_Long := 0;
Slots : constant Time_Array
:= Get_POK_Slots (E);
Slots_Allocation : constant List_Id
:= Get_POK_Slots_Allocation (E);
begin
Scheduling_Node := Make_XML_Node ("Module_Schedule");
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 ("MajorFrameSeconds");
Scheduling_Node := Make_XML_Node ("Processor");
-- First, add a <Processor> node
Processor_Node := Make_XML_Node ("Processor");
Set_Str_To_Name_Buffer ("id");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal
(XV.New_Floating_Point_Value (To_Seconds (Get_POK_Major_Frame (E))));
(XV.New_Numeric_Value (Processor_Identifier, 0, 10));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Processor_Node));
Set_Str_To_Name_Buffer ("frequency");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer ("50Mhz");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Processor_Node));
-- Within the <processor/> node, add a <CyclicPlanTable/>
-- node.
Plan_Table_Node := Make_XML_Node ("CyclicPlanTable");
Append_Node_To_List (Plan_Table_Node, XTN.Subitems (Processor_Node));
-- Then, describe the scheduling plan for this node.
-- At this time, we support only one plan for each processor.
Plan_Node := Make_XML_Node ("Plan");
Append_Node_To_List (Plan_Node, XTN.Subitems (Plan_Table_Node));
Set_Str_To_Name_Buffer ("id");
P := Make_Defining_Identifier (Name_Find);
Q := Make_Literal (XV.New_Numeric_Value (0, 0, 10));
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Scheduling_Node));
(Make_Assignement (P, Q), XTN.Items (Plan_Node));
Set_Str_To_Name_Buffer ("majorFrame");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer
(Unsigned_Long_Long'Image
(To_Milliseconds (Get_POK_Major_Frame (E))));
Add_Str_To_Name_Buffer ("ms");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Plan_Node));
-- For each time slot for a partition, we declare
-- it in the scheduling plan.
S := ATN.First_Node (Slots_Allocation);
for I in Slots'Range loop
-- Create the node that corresponds to the slot.
Slot_Node := Make_XML_Node ("Slot");
-- Associate a fixed identifier to the slot.
Set_Str_To_Name_Buffer ("id");
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));
-- Define the duration attribute of the <slot/> element.
Set_Str_To_Name_Buffer ("duration");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer
(Unsigned_Long_Long'Image
(To_Milliseconds (Slots (I))));
Add_Str_To_Name_Buffer ("ms");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Slot_Node));
-- Define the start attribute of the <slot/> element.
Set_Str_To_Name_Buffer ("start");
P := Make_Defining_Identifier (Name_Find);
Set_Str_To_Name_Buffer
(Unsigned_Long_Long'Image (Start_Time));
Add_Str_To_Name_Buffer ("ms");
Q := Make_Defining_Identifier (Name_Find);
Append_Node_To_List
(Make_Assignement (P, Q), XTN.Items (Slot_Node));
Append_Node_To_List (Slot_Node, XTN.Subitems (Plan_Node));
Slot_Identifier := Slot_Identifier + 1;
Start_Time := Start_Time + To_Milliseconds (Slots (I));
S := ATN.Next_Node (S);
end loop;
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
......@@ -202,8 +322,10 @@ package body Ocarina.Backends.Xtratum_Conf.Hardware_Description is
S := Next_Node (S);
end loop;
end if;
Append_Node_To_List (Scheduling_Node,
XTN.Subitems (Current_XML_Node));
Processor_Identifier := Processor_Identifier + 1;
Append_Node_To_List (Processor_Node, XTN.Subitems (Current_XML_Node));
end Visit_Processor_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