Commit a1647df7 authored by Julien's avatar Julien

Start to map memory and sampling ports in DEOS conf

parent 12bb75c6
...@@ -967,6 +967,39 @@ package body Ocarina.Backends.Deos_Conf.Mapping is ...@@ -967,6 +967,39 @@ package body Ocarina.Backends.Deos_Conf.Mapping is
return Module_HM; return Module_HM;
end Map_Processor_HM_Table; end Map_Processor_HM_Table;
-----------------------
-- Map_Sampling_Port --
-----------------------
function Map_Sampling_Port (Port : Node_Id) return Node_Id is
Sampling_Port : Node_Id;
Size : Unsigned_Long_Long;
begin
Sampling_Port := Make_XML_Node ("SamplingPort");
Size := To_Bytes (Get_Data_Size
(Corresponding_Instance (Port)));
XTU.Add_Attribute ("Name",
Get_Name_String
(AIN.Name (Identifier (Port))),
Sampling_Port);
XTU.Add_Attribute ("MaxMessageSize",
Trim (Unsigned_Long_Long'Image
(Size), Left),
Sampling_Port);
if Is_In (Port) then
XTU.Add_Attribute ("Direction", "DESTINATION", Sampling_Port);
elsif Is_Out (Port) then
XTU.Add_Attribute ("Direction", "SOURCE", Sampling_Port);
end if;
XTU.Add_Attribute ("SourcePartitionName", "", Sampling_Port);
XTU.Add_Attribute ("SourcePortName", "", Sampling_Port);
XTU.Add_Attribute ("CustomIOFunction", "", Sampling_Port);
XTU.Add_Attribute ("AccessRateInNanoseconds", "12500000", Sampling_Port);
return Sampling_Port;
end Map_Sampling_Port;
------------------- -------------------
-- Map_Partition -- -- Map_Partition --
------------------- -------------------
......
...@@ -43,4 +43,6 @@ package Ocarina.Backends.Deos_Conf.Mapping is ...@@ -43,4 +43,6 @@ package Ocarina.Backends.Deos_Conf.Mapping is
function Map_Processor_HM_Table (Processor : Node_Id) return Node_Id; function Map_Processor_HM_Table (Processor : Node_Id) return Node_Id;
function Map_Sampling_Port (Port : Node_Id) return Node_Id;
end Ocarina.Backends.Deos_Conf.Mapping; end Ocarina.Backends.Deos_Conf.Mapping;
...@@ -31,8 +31,10 @@ ...@@ -31,8 +31,10 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ada.Strings; use Ada.Strings; -- with Ada.Strings; use Ada.Strings;
with Ada.Strings.Fixed; use Ada.Strings.Fixed; -- with Ada.Strings.Fixed; use Ada.Strings.Fixed;
with Ada.Text_IO;
with Ada.Integer_Text_IO;
with Ocarina.Backends.Messages; with Ocarina.Backends.Messages;
with Ocarina.ME_AADL; with Ocarina.ME_AADL;
with Ocarina.ME_AADL.AADL_Instances.Nodes; with Ocarina.ME_AADL.AADL_Instances.Nodes;
...@@ -41,13 +43,14 @@ with Ocarina.ME_AADL.AADL_Instances.Entities; ...@@ -41,13 +43,14 @@ with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.Backends.Utils; with Ocarina.Backends.Utils;
with Ocarina.Backends.Properties; with Ocarina.Backends.Properties;
with Ocarina.Backends.XML_Values;
with Ocarina.Backends.XML_Tree.Nodes; with Ocarina.Backends.XML_Tree.Nodes;
with Ocarina.Backends.XML_Tree.Nutils; with Ocarina.Backends.XML_Tree.Nutils;
with Ocarina.Backends.Deos_Conf.Mapping; with Ocarina.Backends.Deos_Conf.Mapping;
package body Ocarina.Backends.Deos_Conf.Partitions is package body Ocarina.Backends.Deos_Conf.Partitions is
use Ada.Text_IO;
use Ada.Integer_Text_IO;
use Ocarina.ME_AADL; use Ocarina.ME_AADL;
use Ocarina.Backends.Utils; use Ocarina.Backends.Utils;
...@@ -57,7 +60,6 @@ package body Ocarina.Backends.Deos_Conf.Partitions is ...@@ -57,7 +60,6 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
use Ocarina.Backends.XML_Tree.Nutils; use Ocarina.Backends.XML_Tree.Nutils;
use Ocarina.Backends.Properties; use Ocarina.Backends.Properties;
use Ocarina.Backends.Deos_Conf.Mapping; use Ocarina.Backends.Deos_Conf.Mapping;
use Ocarina.Backends.XML_Values;
package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes; package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils; package AINU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
...@@ -94,6 +96,29 @@ package body Ocarina.Backends.Deos_Conf.Partitions is ...@@ -94,6 +96,29 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
function Make_Default_Memory_Region return Node_Id; function Make_Default_Memory_Region return Node_Id;
function Make_Memory_Region (Segment : Node_Id) return Node_Id; function Make_Memory_Region (Segment : Node_Id) return Node_Id;
function Hex_Print (Num : in Integer;
Num_Of_Digits : in Positive) return String;
function Hex_Print (Num : in Integer;
Num_Of_Digits : in Positive) return String is
Temp_Str : String (1 .. Num_Of_Digits + 5) := (others => '0');
New_Str : String (1 .. Num_Of_Digits) := (others => '0');
First_Digit : Positive;
begin
Put (To => Temp_Str, Item => Num, Base => 16);
for I in 1 .. Num_Of_Digits + 4 loop
if Temp_Str (I) = '#' then
First_Digit := I + 1;
exit;
end if;
end loop;
New_Str (First_Digit - 4 .. Num_Of_Digits) :=
Temp_Str (First_Digit .. Num_Of_Digits + 4);
return New_Str;
end Hex_Print;
-------------------------------- --------------------------------
-- Make_Default_Memory_Region -- -- Make_Default_Memory_Region --
...@@ -126,15 +151,18 @@ package body Ocarina.Backends.Deos_Conf.Partitions is ...@@ -126,15 +151,18 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
XTU.Add_Attribute ("Name", "Initial RAM Pool", N); XTU.Add_Attribute ("Name", "Initial RAM Pool", N);
XTU.Add_Attribute ("Type", "Initial RAM Pool", N); XTU.Add_Attribute ("Type", "Initial RAM Pool", N);
XTU.Add_Attribute ("Address", XTU.Add_Attribute ("Address",
New_Numeric_Value (Get_Base_Address (Segment), 1, 16), "0x" & Hex_Print
(Integer
(Get_Base_Address (Segment)), 8),
N); N);
-- Put (Size_Str, To_Bytes
-- (Get_Memory_Size (Segment)), 16);
XTU.Add_Attribute ("Size", XTU.Add_Attribute ("Size",
Trim "0x" & Hex_Print
(Unsigned_Long_Long'Image (Integer (To_Bytes
(To_Bytes (Get_Memory_Size (Segment))), 8),
(Get_Memory_Size (Segment))),
Left),
N); N);
XTU.Add_Attribute ("AccessRights", "READ_WRITE", N); XTU.Add_Attribute ("AccessRights", "READ_WRITE", N);
XTU.Add_Attribute ("PlatformMemoryPool", "0", N); XTU.Add_Attribute ("PlatformMemoryPool", "0", N);
...@@ -411,9 +439,11 @@ package body Ocarina.Backends.Deos_Conf.Partitions is ...@@ -411,9 +439,11 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
procedure Visit_Virtual_Processor_Instance (E : Node_Id) is procedure Visit_Virtual_Processor_Instance (E : Node_Id) is
S : Node_Id; S : Node_Id;
F : Node_Id;
Corresponding_Process : Node_Id := No_Node; Corresponding_Process : Node_Id := No_Node;
Memory_Segment : Node_Id := No_Node; Memory_Segment : Node_Id := No_Node;
Partition_Node : Node_Id; Partition_Node : Node_Id;
Sampling_Ports : Node_Id := No_Node;
begin begin
Corresponding_Process := Find_Associated_Process (E); Corresponding_Process := Find_Associated_Process (E);
...@@ -468,6 +498,42 @@ package body Ocarina.Backends.Deos_Conf.Partitions is ...@@ -468,6 +498,42 @@ package body Ocarina.Backends.Deos_Conf.Partitions is
Append_Node_To_List Append_Node_To_List
(Memory_Regions, (Memory_Regions,
XTN.Subitems (Partition_Node)); XTN.Subitems (Partition_Node));
--
-- Then, we configure the inter-partitions communication
-- ports (sampling/queueing).
--
if not AINU.Is_Empty (Features (Corresponding_Process)) then
Sampling_Ports := Make_XML_Node ("SamplingPorts");
F := First_Node (Features (Corresponding_Process));
while Present (F) loop
if Kind (F) = K_Port_Spec_Instance
and then Get_Connection_Pattern (F) = Inter_Process
then
if Is_Data (F) and then not Is_Event (F)
and then not (Is_In (F) and then Is_Out (F))
then
Append_Node_To_List
(Map_Sampling_Port (F),
XTN.Subitems (Sampling_Ports));
end if;
end if;
F := Next_Node (F);
end loop;
end if;
if Sampling_Ports /= No_Node and then
XTN.Subitems (Sampling_Ports) /= No_List
then
Append_Node_To_List
(Sampling_Ports,
XTN.Subitems (Partition_Node));
end if;
Partition_Identifier := Partition_Identifier + 1;
end if; end if;
if not AINU.Is_Empty (Subcomponents (E)) then if not AINU.Is_Empty (Subcomponents (E)) then
......
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