Commit 49105389 authored by Julien's avatar Julien

Output scheduling and and memory configuration for

each partition
parent 44e8768d
......@@ -988,7 +988,26 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
pragma Unreferenced (Buffers_Size);
pragma Unreferenced (Process);
Partition_Node : Node_Id;
Partition_Period : Time_Type;
Partition_Duration : Time_Type;
Period_Ns : Unsigned_Long_Long;
Duration_Ns : Unsigned_Long_Long;
begin
Partition_Period := Get_Period (Runtime);
Partition_Duration := Get_Execution_Time (Runtime);
if Partition_Period = Null_Time then
Period_Ns := 0;
else
Period_Ns := To_Nanoseconds (Partition_Period);
end if;
if Partition_Duration = Null_Time then
Duration_Ns := 0;
else
Duration_Ns := To_Nanoseconds (Partition_Duration);
end if;
Partition_Node := Make_XML_Node ("Partition");
XTU.Add_Attribute ("Name",
......@@ -1006,8 +1025,21 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
XTU.Add_Attribute ("Identifier",
Trim (Integer'Image (Partition_Identifier), Left),
Partition_Node);
XTU.Add_Attribute ("Period", "25000000", Partition_Node);
XTU.Add_Attribute ("Duration", "6000000", Partition_Node);
XTU.Add_Attribute ("Period",
Trim
(Unsigned_Long_Long'Image
(Period_Ns),
Left) & "000000",
Partition_Node);
XTU.Add_Attribute ("Duration",
Trim
(Unsigned_Long_Long'Image
(Duration_Ns),
Left) & "000000",
Partition_Node);
XTU.Add_Attribute ("ExecutableImageName",
Get_Name_String
(AIN.Name
......
......@@ -31,6 +31,8 @@
-- --
------------------------------------------------------------------------------
with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ocarina.Backends.Messages;
with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes;
......@@ -83,8 +85,13 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
function Find_Associated_Process (Runtime : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id;
function Find_Associated_Memory_Segment
(Process : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id;
function Make_Default_Memory_Region return Node_Id;
function Make_Memory_Region (Segment : Node_Id) return Node_Id;
--------------------------------
-- Make_Default_Memory_Region --
......@@ -105,6 +112,36 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
return N;
end Make_Default_Memory_Region;
------------------------
-- Make_Memory_Region --
------------------------
function Make_Memory_Region (Segment : Node_Id)
return Node_Id is
N : Node_Id;
begin
N := Make_XML_Node ("MemoryRegion");
XTU.Add_Attribute ("Name", "Initial RAM Pool", N);
XTU.Add_Attribute ("Type", "Initial RAM Pool", N);
XTU.Add_Attribute ("Address",
Trim
(Unsigned_Long_Long'Image
(Get_Base_Address (Segment)), Left),
N);
XTU.Add_Attribute ("Size",
Trim
(Unsigned_Long_Long'Image
(To_Bytes
(Get_Memory_Size (Segment))),
Left),
N);
XTU.Add_Attribute ("AccessRights", "READ_WRITE", N);
XTU.Add_Attribute ("PlatformMemoryPool", "0", N);
return N;
end Make_Memory_Region;
-----------------------------
-- Find_Associated_Process --
-----------------------------
......@@ -138,6 +175,40 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
return No_Node;
end Find_Associated_Process;
------------------------------------
-- Find_Associated_Memory_Segment --
------------------------------------
function Find_Associated_Memory_Segment
(Process : Node_Id;
Current_Node : Node_Id := Root_Node)
return Node_Id is
T : Node_Id;
S : Node_Id;
begin
if Get_Category_Of_Component (Current_Node) = CC_Memory and then
Get_Bound_Memory (Process) = Current_Node
then
return Current_Node;
end if;
if not AINU.Is_Empty (Subcomponents (Current_Node)) then
S := First_Node (Subcomponents (Current_Node));
while Present (S) loop
T := Find_Associated_Memory_Segment
(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 Find_Associated_Memory_Segment;
-----------
-- Visit --
-----------
......@@ -339,9 +410,10 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
--------------------------------------
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
S : Node_Id;
Corresponding_Process : Node_Id := No_Node;
Partition_Node : Node_Id;
S : Node_Id;
Corresponding_Process : Node_Id := No_Node;
Memory_Segment : Node_Id := No_Node;
Partition_Node : Node_Id;
begin
Corresponding_Process := Find_Associated_Process (E);
......@@ -380,13 +452,18 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Memory_Regions := Make_XML_Node ("MemoryRegions");
--
-- FIXME: for now, we associate with the default
-- memory. Has to work to get the AADL memory component.
--
Append_Node_To_List
(Make_Default_Memory_Region,
XTN.Subitems (Memory_Regions));
Memory_Segment := Find_Associated_Memory_Segment
(Corresponding_Process);
if Memory_Segment = No_Node then
Append_Node_To_List
(Make_Default_Memory_Region,
XTN.Subitems (Memory_Regions));
else
Append_Node_To_List
(Make_Memory_Region (Memory_Segment),
XTN.Subitems (Memory_Regions));
end if;
Append_Node_To_List
(Memory_Regions,
......
......@@ -160,14 +160,6 @@ package body Ocarina.Backends.Deos_Conf.Schedule is
:= Get_Module_Schedule_Property (Processor);
begin
for J in Module_Schedule'Range loop
-- Put_Line ("Module Schedule slot #" & J'Img);
-- Put_Line (" -> "
-- & Get_Name_String (Module_Schedule (J).Partition));
-- Put_Line (" -> "
-- & Module_Schedule (J).Duration.T'Img
-- & " " & Module_Schedule (J).Duration.U'Img);
-- Put_Line (" -> "
-- & Module_Schedule (J).Periodic_Processing_Start'Img);
Time_Window_Node := Make_XML_Node ("PartitionTimeWindow");
......
......@@ -104,6 +104,8 @@ package body Ocarina.Backends.Properties is
-------------------------------
Base_Type : Name_Id;
Base_Address : Name_Id;
Memory_Size : Name_Id;
Code_Set : Name_Id;
Data_Digits : Name_Id;
Data_Scale : Name_Id;
......@@ -347,6 +349,7 @@ package body Ocarina.Backends.Properties is
Provided_Virtual_Bus_Class : Name_Id;
Allowed_Connection_Binding_Class : Name_Id;
Compute_Execution_Time : Name_Id;
Execution_Time : Name_Id;
Compute_Deadline : Name_Id;
--------------------
......@@ -1969,6 +1972,26 @@ package body Ocarina.Backends.Properties is
end case;
end Get_Thread_Period;
----------------
-- Get_Period --
----------------
function Get_Period (T : Node_Id) return Time_Type is
The_Period : Time_Type;
begin
The_Period := Get_Time_Property_Value (T, Thread_Period);
return The_Period;
end Get_Period;
------------------------
-- Get_Execution_Time --
------------------------
function Get_Execution_Time (T : Node_Id) return Time_Type is
begin
return Get_Time_Property_Value (T, Execution_Time);
end Get_Execution_Time;
------------------------------------
-- Get_Thread_First_Dispatch_Time --
------------------------------------
......@@ -3076,6 +3099,8 @@ package body Ocarina.Backends.Properties is
Queue_Size := Get_String_Name ("queue_size");
Base_Address := Get_String_Name ("base_address");
Memory_Size := Get_String_Name ("memory_size");
Data_Array_Name := Get_String_Name ("array");
Data_Boolean_Name := Get_String_Name ("boolean");
Data_Character_Name := Get_String_Name ("character");
......@@ -3376,6 +3401,7 @@ package body Ocarina.Backends.Properties is
Get_String_Name ("allowed_connection_binding_class");
Compute_Execution_Time := Get_String_Name ("compute_execution_time");
Execution_Time := Get_String_Name ("execution_time");
Compute_Deadline := Get_String_Name ("compute_deadline");
......@@ -4392,4 +4418,22 @@ package body Ocarina.Backends.Properties is
return No_Name;
end Get_Send_Function_Name;
---------------------
-- Get_Memory_Size --
---------------------
function Get_Base_Address (D : Node_Id) return Unsigned_Long_Long is
begin
return Check_And_Get_Property (D, Base_Address);
end Get_Base_Address;
---------------------
-- Get_Memory_Size --
---------------------
function Get_Memory_Size (D : Node_Id) return Size_Type is
begin
return Get_Size_Property_Value (D, Memory_Size);
end Get_Memory_Size;
end Ocarina.Backends.Properties;
......@@ -795,6 +795,12 @@ package Ocarina.Backends.Properties is
-- It corresponds to the receiver subcomponent in the abstract
-- device that models the content of the device.
function Get_Execution_Time (T : Node_Id) return Time_Type;
function Get_Period (T : Node_Id) return Time_Type;
function Get_Base_Address (D : Node_Id) return Unsigned_Long_Long;
function Get_Memory_Size (D : Node_Id) return Size_Type;
private
Empty_Name_Array : constant Name_Array (1 .. 0) := (others => No_Name);
......
......@@ -2803,6 +2803,15 @@ package body Ocarina.Backends.Utils is
return Unsigned_Long_Long (To_Seconds (S) * 1_000.0);
end To_Milliseconds;
---------------------
-- To_Nanoseconds --
---------------------
function To_Nanoseconds (S : Time_Type) return Unsigned_Long_Long is
begin
return Unsigned_Long_Long (To_Seconds (S) * 1_000_000_000.0);
end To_Nanoseconds;
--------------
-- To_Bytes --
--------------
......
......@@ -485,4 +485,6 @@ package Ocarina.Backends.Utils is
function Get_Associated_Bus (Port : Node_Id) return Node_Id;
function To_Nanoseconds (S : Time_Type) return Unsigned_Long_Long;
end Ocarina.Backends.Utils;
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