Commit e8634ba1 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Parse memory

parent 746cc541
......@@ -419,6 +419,8 @@ package body TASTE.Concurrency_View is
Node_Assoc := +Assoc ("Partitions", Partitions)
& Assoc ("Partition_Names", Partition_Names)
& Assoc ("Has_Memory", Boolean'
(CV.Nodes (Node_Name).Deployment_Node.Memory.Name /= ""))
& Assoc ("VP_Names", VP_Names)
& Assoc ("VP_Package_Names", VP_Package_Names)
& Assoc ("VP_Platforms", VP_Platforms)
......@@ -449,12 +451,14 @@ package body TASTE.Concurrency_View is
(if Valid_Dir then Strip_String (Parse (Tmpl_File)) else "");
Trig_Sys : constant Boolean := Exists (Tmpl_Sys);
Set_Sys : Translate_Set;
Node_Names : Vector_Tag; -- List of nodes
Node_CPU : Vector_Tag; -- Corresponding CPU name
Node_CPU_Cls : Vector_Tag; -- Corresponding CPU classifier
Partition_Names : Vector_Tag; -- List of processes
Partition_Node : Vector_Tag; -- Corresponding node name
Partition_CPU : Vector_Tag; -- Corresponding CPU name
Node_Names, -- List of nodes
Node_CPU, -- Corresponding CPU name
Node_CPU_Cls, -- Corresponding CPU classifier
Node_Has_Memory : Vector_Tag; -- Corresponding memory flag
Partition_Names, -- List of partitions
Partition_Node, -- Corresponding node name
Partition_CPU, -- Corresponding CPU name
Partition_VP : Vector_Tag; -- for TSP: VP binding
begin
for Node in CV.Nodes.Iterate loop
declare
......@@ -499,12 +503,16 @@ package body TASTE.Concurrency_View is
if Trigger then
-- Associate node name, CPU name and CPU classifier
-- Also set flag if a memory region is defined
-- (this is needed for AADL backends)
Node_Names := Node_Names & Node_Name;
Node_CPU := Node_CPU
& CV.Nodes (Node_Name).Deployment_Node.CPU_Name;
Node_CPU_Cls := Node_CPU_Cls
& CV.Nodes (Node_Name).Deployment_Node.CPU_Classifier;
Node_Has_Memory := Node_Has_Memory
& (CV.Nodes (Node_Name)
.Deployment_Node.Memory.Name /= "");
-- Associate partition name, corresponding node and CPU
-- for AADL backends
......@@ -515,6 +523,9 @@ package body TASTE.Concurrency_View is
Partition_CPU := Partition_CPU
& CV_Partitions.Element (Partition)
.Deployment_Partition.CPU_Name;
Partition_VP := Partition_VP
& CV_Partitions.Element (Partition)
.Deployment_Partition.VP_Name;
Partition_Node := Partition_Node & Node_Name;
end loop;
......@@ -536,9 +547,11 @@ package body TASTE.Concurrency_View is
& Assoc ("Node_Names", Node_Names)
& Assoc ("Node_CPU", Node_CPU)
& Assoc ("Node_CPU_Classifier", Node_CPU_Cls)
& Assoc ("Node_Has_Memory", Node_Has_Memory)
& Assoc ("Partition_Names", Partition_Names)
& Assoc ("Partition_Node", Partition_Node)
& Assoc ("Partition_CPU", Partition_CPU)
& Assoc ("Partition_VP", Partition_VP)
& Assoc ("Threads", Threads)
& Assoc ("Thread_Names", All_Thread_Names)
& Assoc ("Target_Packages", All_Target_Names);
......
......@@ -322,6 +322,23 @@ package body TASTE.Deployment_View is
& Exception_Message (Error);
end Parse_Device;
-- TSP systems have memory regions, declared in the deployment view
-- the partitions are bound to the memory region. This function
-- is a placeholder to parse any required memory information.
-- Currently the backends only need to know that a memory is defined
-- actual size or segements information are not needed to build the
-- concurrency view.
function Parse_Memory (CI : Node_Id;
dummy_Depl : Node_Id) return Taste_Memory
is
Result : Taste_Memory;
begin
Result.Name := -- Memory identifier (usually "main_memory")
US (Get_Name_String (ATN.Name (ATN.Component_Type_Identifier
(Corresponding_Declaration (CI)))));
return Result;
end Parse_Memory;
function Parse_Partition (CI : Node_Id; Depl : Node_Id)
return Taste_Partition is
Result : Taste_Partition;
......@@ -477,17 +494,22 @@ package body TASTE.Deployment_View is
end Parse_Partition;
function Parse_Node (Depl_View_System : Node_Id) return Taste_Node is
Processes : Node_Id;
Subcos : Node_Id;
CI : Node_Id;
Result : Taste_Node;
Partition : Taste_Partition;
begin
Processes := First_Node (Subcomponents (Depl_View_System));
Subcos := First_Node (Subcomponents (Depl_View_System));
while Present (Subcos) loop
CI := Corresponding_Instance (Subcos);
while Present (Processes) loop
CI := Corresponding_Instance (Processes);
if Get_Category_Of_Component (CI) = CC_Device then
Result.Drivers.Append (Parse_Device (CI));
elsif Get_Category_Of_Component (CI) = CC_Memory then
Result.Memory := Parse_Memory (CI, Depl_View_System);
elsif Get_Category_Of_Component (CI) = CC_Process then
Partition := Parse_Partition (CI, Depl_View_System);
Result.Partitions.Insert
......@@ -512,7 +534,7 @@ package body TASTE.Deployment_View is
end if;
end if;
Processes := Next_Node (Processes);
Subcos := Next_Node (Subcos);
end loop;
return Result;
end Parse_Node;
......
......@@ -116,6 +116,13 @@ package TASTE.Deployment_View is
package Taste_Drivers is
new Indefinite_Vectors (Natural, Taste_Device_Driver);
-- Memory component specified at node level
type Taste_Memory is
record
Name : Unbounded_String;
Bound_Partitions : String_Sets.Set;
end record;
-- Partition in the deployment view
-- Supported_Execution_Platform is defined in:
-- ocarina/src/backends/ocarina-backends-properties.ads
......@@ -134,6 +141,7 @@ package TASTE.Deployment_View is
VP_Name : Unbounded_String := US ("");
VP_Platform : Supported_Execution_Platform := Platform_None;
VP_Classifier : Unbounded_String := US ("");
Memory_Region : Unbounded_String := US (""); -- TSP only
Ada_Runtime : Unbounded_String; -- if CPU_Platform = GNAT_Runtime
Bound_Functions : String_Sets.Set;
end record;
......@@ -152,6 +160,7 @@ package TASTE.Deployment_View is
& Assoc ("VP_Name", P.VP_Name)
& Assoc ("VP_Platform", P.VP_Platform'Img)
& Assoc ("VP_Classifier", P.VP_Classifier)
& Assoc ("Memory_Region", P.Memory_Region)
& Assoc ("Ada_Runtime", P.Ada_Runtime)
& Assoc ("Bound_Functions", To_Template_Tag (P.Bound_Functions)));
......@@ -177,6 +186,7 @@ package TASTE.Deployment_View is
Name : Unbounded_String;
Drivers : Taste_Drivers.Vector;
Partitions : Taste_Partitions.Map;
Memory : Taste_Memory;
Virtual_CPUs : Virtual_Processors.Map;
Package_Name : Unbounded_String;
CPU_Name : Unbounded_String; -- AADL Identifier
......
......@@ -2,6 +2,7 @@
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partition_Names_@ : Tag listing the partitions in this node
@@-- @_Has_Memory_@ : Boolean flag indicating that a memory is defined for this node
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_VP_Names_@ : Vector tag: list of virtual processors on this node
@@-- VP_Package_Names : |_ Corresponding package name
......@@ -18,11 +19,11 @@
-- @_VP_Classifiers_@
@@-- Test if the node contains several partitions (virtual processors)
@@-- If that's the case we need to generate a new AADL processor for TSP support
@@IF@@ @_VP_Names'Length_@ > 0
processor @_Node_Name_@_@_CPU_Name_@ extends @_Package_Name_@::@_CPU_Family_@
end @_Node_Name_@_@_CPU_Name_@;
processor @_Node_Name_@_Board extends @_Package_Name_@::@_CPU_Family_@
end @_Node_Name_@_Board;
processor implementation @_Node_Name_@_@_CPU_Name_@.final extends @_CPU_Classifier_@
processor implementation @_Node_Name_@_Board.final extends @_CPU_Classifier_@
@@IF@@ @_VP_Names'Length_@ > 0
subcomponents
@@TABLE@@
@_VP_Names_@ : virtual processor deploymentview::DV::@_Node_Name_@::@_VP_Names_@.others;
......@@ -32,6 +33,6 @@ properties
Scheduling_Protocol => (POSIX_1003_Highest_Priority_First_Protocol) applies to @_VP_Names_@;
Arinc653::DAL => Level_A applies to @_VP_Names_@;
@@END_TABLE@@
end @_Node_Name_@_@_CPU_Name_@.final;
@@END_IF@@
end @_Node_Name_@_Board.final;
@_Partitions_@
......@@ -7,6 +7,7 @@
@@-- @_Partition_Names_@ : Vector Tag of partition names
@@-- @_Partition_Node_@ : |_ Corresponding node name
@@-- @_Partition_CPU_@ : |_ Corresponding CPU name
@@-- @_Partition_VP_@ : |_ Virtual processor binding (TSP only)
@@-- @_Threads_@ : Code generated for the threads
@@-- @_Thread_Names_@ : List of all threads in the complete system
@@-- @_Target_Packages_@ : List of all target package names in the complete system
......@@ -58,14 +59,26 @@ end DeploymentView;
system implementation DeploymentView.final
subcomponents
@@TABLE'ALIGN_ON(":")@@
@@-- First declare the partitions
@_CAPITALIZE:Partition_Names_@ : process @_CAPITALIZE:Partition_Names_@.final;
@@END_TABLE@@
@@-- Then the processor boards (they may contain several virtual processors for TSP systems) and optionally memory
@@TABLE'ALIGN_ON(":")@@
@_CAPITALIZE:Node_Names_@_@_Node_CPU_@ : processor @_CAPITALIZE:Node_CPU_Classifier_@;
@_CAPITALIZE:Node_Names_@_@_Node_CPU_@ : processor @_CAPITALIZE:Node_Names_@_Board.final;
@@IF@@ @_Node_Has_Memory_@
@_CAPITALIZE:Node_Names_@_Memory : memory deploymentview::DV::@_CAPITALIZE:Node_Names_@::main_memory.others;
@@END_IF@@
@@END_TABLE@@
@@-- Then specify the bindings of the partitions to (virtual) processors
properties
@@TABLE@@
@@TABLE'ALIGN_ON("applies")@@
@@-- Check if this is a TSP system, in which case bind the partitions to the corresponding virtual processor of the node
@@IF@@ @_Partition_VP_@ = ""
Actual_Processor_Binding => (reference (@_CAPITALIZE:Partition_Node_@_@_Partition_CPU_@)) applies to @_CAPITALIZE:Partition_Names_@;
@@ELSE@@
Actual_Processor_Binding => (reference (@_CAPITALIZE:Partition_Node_@_@_Partition_CPU_@.@_Partition_VP_@)) applies to @_CAPITALIZE:Partition_Names_@;
Actual_Memory_Binding => (reference (@_CAPITALIZE:Partition_Node_@_Memory.@_CAPITALIZE:Partition_Names_@_Segment)) applies to @_CAPITALIZE:Partition_Names_@;
@@END_IF@@
@@END_TABLE@@
end DeploymentView.final;
......
......@@ -40,7 +40,7 @@ with @_CAPITALIZE:Block_Names_@;
package adainit is end adainit;' >@_LOWER:Name_@_adainit/tasteada.ads && \
@@END_INLINE@@
cd @_LOWER:Name_@_adainit && \
@@INLINE( )(:)(\\)@@
@@INLINE( )(:)( \\)@@
ADA_INCLUDE_PATH=../../dataview/Ada
@@TABLE'TERSE@@
@@IF@@ @_LOWER:Block_Languages_@ = sdl
......
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