Commit 0b881f19 authored by Maxime Perrotin's avatar Maxime Perrotin

Iterate on deployment view xml dump

parent bbd9d908
......@@ -13,14 +13,15 @@ begin
Transformed : TASTE_Model := Transform (Model);
begin
if Model.Configuration.Debug_Flag then
TASTE.Dump.Dump_Input_Model (Model);
TASTE.Dump.Dump_Input_Model (Transformed);
Transformed.Dump;
end if;
if Transformed.Configuration.Glue then
Transformed.Add_Concurrency_View;
Transformed.Concurrency_View.Generate_CV;
end if;
Transformed.Dump;
Transformed.Generate_Build_Script;
Transformed.Generate_Code;
end;
......
......@@ -22,8 +22,8 @@ package body TASTE.Dump is
Newline : Character renames Ada.Characters.Latin_1.LF;
-- iterate over template folders
procedure Dump_Everything (Model : TASTE_Model)
-- iterate over template folders in the dump directory
procedure Dump_Input_Model (Model : TASTE_Model)
is
IV : constant IV_As_Template :=
Interface_View_Template (Model.Interface_View);
......@@ -86,6 +86,8 @@ package body TASTE.Dump is
Data_Template : constant String := Path & "/dataview.tmplt";
Func_Template : constant String := Path & "/function.tmplt";
IF_Template : constant String := Path & "/interface.tmplt";
Node_Template : constant String := Path & "/node.tmplt";
Part_Template : constant String := Path & "/partition.tmplt";
-- Verify that all templates files are present
Check : constant Boolean :=
......@@ -93,7 +95,8 @@ package body TASTE.Dump is
and then Exists (Trig_Template) and then Exists (Out_Template)
and then Exists (IV_Template) and then Exists (DV_Template)
and then Exists (Data_Template) and then Exists (Func_Template)
and then Exists (IF_Template);
and then Exists (IF_Template) and then Exists (Node_Template)
and then Exists (Part_Template);
-- Get the output path and filename from the template,
-- and evaluate the trigger condition
......@@ -105,9 +108,11 @@ package body TASTE.Dump is
Trigger : constant Boolean :=
(Check and then (Strip_String (Parse (Trig_Template)) = "TRUE"));
IV_Tags : Translate_Set;
IV_Tags : Translate_Set; -- Interface View
DV_Tags : Translate_Set; -- Deployment View
Output_Tags : Translate_Set;
Functions : Unbounded_String;
Nodes : Unbounded_String;
function Process_Interfaces (Interfaces : St_Interfaces.Vector)
return Unbounded_String
......@@ -125,6 +130,7 @@ package body TASTE.Dump is
return;
else
Put_Info ("Generating Dump from " & Path);
-- Prepare the interface view
for F of IV.Funcs loop
declare
Func_Map : constant Translate_Set := F.Header
......@@ -138,18 +144,97 @@ package body TASTE.Dump is
Functions := Functions & Result & Newline;
end;
end loop;
-- Prepare the deployment view
for N of Model.Deployment_View.Nodes loop
if N.Name = "interfaceview" then
goto Next_Node;
end if;
declare
Node_Map : Translate_Set :=
+Assoc ("Node_Name", N.Name)
& Assoc ("CPU_Name", N.CPU_Name)
& Assoc ("CPU_Platform", N.CPU_Platform'Img)
& Assoc ("CPU_Classifier", N.CPU_Classifier)
& Assoc ("Ada_Runtime", N.Ada_Runtime);
Partitions : Unbounded_String;
Device_Names,
Package_Names,
Device_Classifiers,
Proc_Names,
Config,
Bus_Names,
Port_Names,
Asn1_Files,
Asn1_Typenames,
Asn1_Modules : Vector_Tag;
begin
for Driver of N.Drivers loop
Device_Names := Device_Names & Driver.Name;
Package_Names := Package_Names & Driver.Package_Name;
Device_Classifiers :=
Device_Classifiers & Driver.Device_Classifier;
Proc_Names :=
Proc_Names & Driver.Associated_Processor_Name;
Config := Config & Driver.Device_Configuration;
Bus_Names := Bus_Names & Driver.Accessed_Bus_Name;
Port_Names :=
Port_Names & Driver.Accessed_Port_Name;
Asn1_Files := Asn1_Files & Driver.ASN1_Filename;
Asn1_Typenames :=
Asn1_Typenames & Driver.ASN1_Typename;
Asn1_Modules := Asn1_Modules & Driver.ASN1_Module;
end loop;
-- Add drivers to the node map
Node_Map := Node_Map
& Assoc ("Device_Names", Device_Names)
& Assoc ("Package_Names", Package_Names)
& Assoc ("Device_Classifiers", Device_Classifiers)
& Assoc ("Proc_Names", Proc_Names)
& Assoc ("Config", Config)
& Assoc ("Bus_Names", Bus_Names)
& Assoc ("Port_Names", Port_Names)
& Assoc ("Asn1_Files", Asn1_Files)
& Assoc ("Asn1_Typenames", Asn1_Typenames)
& Assoc ("Asn1_Modules", Asn1_Modules);
for P of N.Partitions loop
declare
Part : constant String :=
Parse (Part_Template, P.To_Template);
begin
Partitions := Partitions & Part & Newline;
end;
end loop;
-- Add partitions to the node map
Node_Map := Node_Map & Assoc ("Partitions", Partitions);
Nodes :=
Nodes & String'(Parse (Node_Template, Node_Map))
& Newline;
end;
<<Next_Node>>
end loop;
end if;
-- Interface view is made of functions and connections
IV_Tags := +Assoc ("Functions", Functions)
IV_Tags := +Assoc ("Functions", Functions)
& Assoc ("Callers", IV.Callers)
& Assoc ("Callees", IV.Callees)
& Assoc ("Caller_RIs", IV.RI_Names)
& Assoc ("Callee_PIs", IV.PI_Names);
-- Deployment view is made of nodes, connections and busses
DV_Tags := +Assoc ("Nodes", Nodes);
-- Output is made of interface, deployment and data views
Output_Tags := +Assoc
("Interface_View", String'(Parse (IV_Template, IV_Tags)));
Output_Tags := +Assoc ("Interface_View",
String'(Parse (IV_Template, IV_Tags)))
& Assoc ("Deployment_View",
String'(Parse (DV_Template, DV_Tags)));
Create_Path (Output_Prefix & "/" & Output_Path);
Create (File => Output_File,
......@@ -163,16 +248,10 @@ package body TASTE.Dump is
<<continue>>
end loop;
End_Search (ST);
end Dump_Everything;
procedure Dump_Input_Model (Model : TASTE_Model) is
begin
Dump_Everything (Model);
exception
when Error : others =>
Put_Error ("Dump : "
& Ada.Exceptions.Exception_Message (Error));
raise Quit_Taste;
end Dump_Input_Model;
end TASTE.Dump;
@@-- template for deployment view
@@-- @_Nodes_@
@@-- @_Source_Nodes_@ : connection source node (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Nodes_@ : |_ destination node name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Busses_@
<DeploymentView>
@_Nodes'Indent_@
@_Busses'Indent_@
@@TABLE@@
<Connection from_node="@_Source_Nodes_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Nodes_@" to_port="@_Dest_Ports_@"/>
@@END_TABLE@@
</DeploymentView>
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the function
@@-- @_Language_@ : The implementation language
@@-- @_List_Of_PIs_@ : List of all Provided Interfaces (just names)
@@-- @_List_Of_RIs_@ : List of all Required Interfaces (just names)
@@-- @_List_Of_Sync_PIs@ : List of synchronous Provided Interfaces
@@-- @_List_Of_Sync_RIs@ : List of synchronous Required Interfaces
@@-- @_List_Of_ASync_PIs@ : List of asynchronous Provided Interfaces
@@-- @_List_Of_ASync_RIs@ : List of asynchronous Required Interfaces
@@-- @_ASN1_Modules_@ : List of ASN.1 Modules names
@@-- @_ASN1_Files_@ : List of ASN.1 Files with path
@@-- @_Timers_@ : List of timers (just names)
@@-- @_Has_Context_@ : Flag, True if there are context parameters
@@-- @_CP_Names_@ : Tag: Context Parameters - name
@@-- @_CP_Types_@ : |_ asn1 type
@@-- @_CP_Values_@ : |_ value
@@-- @_CP_Asn1Modules_@ : |_ asn1 module
@@-- @_CP_Asn1Filenames_@ : |_ asn1 filenames
@@-- @_Provided_Interfaces_@ : From template: Provided interfaces with params
@@-- @_Required_Interfaces_@ : From template: Required interfaces with params
@@-- @_Property_Names_@ : List of User-defined properties (names)
@@-- @_Property_Values_@ : List of User-defined properties (values)
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
<Function name="@_Name_@" language="@_Language_@" is_type="@_YES_NO:Is_Type_@" instance_of="@_Instance_Of_@">
@@TABLE@@
<Timer name="@_Timers_@"/>
@@END_TABLE@@
@@TABLE@@
<Context_Parameter name="@_CP_Names_@" type="@_WEB_ENCODE:CP_Types_@" value="@_WEB_ENCODE:CP_Values_@" asn1module="@_WEB_ENCODE:CP_Asn1Modules_@" asn1file="@_WEB_ENCODE:CP_Asn1Filenames_@"/>
@@END_TABLE@@
@@TABLE@@
<Property name="@_WEB_ENCODE:Property_Names_@" value="@_WEB_ENCODE:Property_Values_@"/>
@@END_TABLE@@
@_Provided_Interfaces'Indent_@
@_Required_Interfaces'Indent_@
</Function>
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : The name of the interface
@@-- @_Direction_@ : "PI" or "RI"
@@-- @_Kind_@ : The RCM Kind
@@-- @_Parent_Function_@ : The name of the function
@@-- @_Param_Names_@ : List of parameter names
@@-- @_Param_Types_@ : |_ Corresponding parameter types
@@-- @_Param_Directions_@ : |_ Corresponding direction
@@-- @_Param_Encodings_@ : |_ Corresponding ASN.1 encoding
@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : Properties of the interface
@@-- @_IF_Property_Names_@, _Values_@ : User-defined properties (vector tag)
@@IF@@ @_Direction_@ = "PI"
<Provided_Interface name="@_Name_@" kind="@_Kind_@" period="@_Period_@" wcet="@_WCET_@" queue_size="@_Queue_Size_@">
@@ELSE@@
<Required_Interface name="@_Name_@" kind="@_Kind_@">
@@END_IF@@
@@TABLE@@
@@IF@@ @_Param_Directions_@ = "PARAM_IN"
<Input_Parameter name="@_Param_Names_@" type="@_WEB_ENCODE:Param_Types_@" encoding="@_Param_Encodings_@"/>
@@ELSE@@
<Output_Parameter name="@_Param_Names_@" type="@_WEB_ENCODE:Param_Types_@" encoding="@_Param_Encodings_@"/>
@@END_IF@@
@@END_TABLE@@
@@TABLE@@
<Property name="@_WEB_ENCODE:IF_Property_Names_@" value="@_WEB_ENCODE:IF_Property_Values_@"/>
@@END_TABLE@@
@@IF@@ @_Direction_@ = "PI"
</Provided_Interface>
@@ELSE@@
</Required_Interface>
@@END_IF@@
@@-- @_Functions_@ : functions generated from functions.tmplt
@@-- @_Callers_@ : connection vector tag: caller function names
@@-- @_Callees_@ : |_ corresponding callee function names
@@-- @_Caller_RIs_@ : |_ corresponding name of RIs
@@-- @_Callee_PIs_@ : |_ corresponding name of PIs
<InterfaceView>
@_Functions'Indent_@
@@TABLE@@
<Connection from="@_Callers_@" ri_name="@_Caller_RIs_@" to="@_Callees_@" pi_name="@_Callee_PIs_@"/>
@@END_TABLE@@
</InterfaceView>
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_CPU_Name_@, _Platform_@, _Classifier_@, _Ada_Runtime_@ : Info about CPU
@@-- @_Device_Names_@ : Vector tag for device drivers - name
@@-- @_Package_Names_@ : |_ aadl package
@@-- @_Device_Classifiers_@ : |_ aadl classifier
@@-- @_Proc_Names_@ : |_ associated processor name
@@-- @_Config_@ : |_ device configuration (asn1 string)
@@-- @_Bus_Names_@ : |_ accessed bus name
@@-- @_Port_Names_@ : |_ accessed port name
@@-- @_Asn1_Files_@ : |_ asn1 filename for the configuration type
@@-- @_Asn1_Typenames_@ : |_ asn1 configuration type name
@@-- @_Asn1_Modules_@ : |_ asn1 module name containing the type
<Node name="@_Node_Name_@">
@_Partitions'Indent_@
@@TABLE@@
<Device name="@_Device_Names_@" pkg="@_Package_Names_@" classifier="@_Device_Classifiers_@" proc="@_Proc_Names_@" config="@_WEB_ENCODE:Config_@" bus="@_Bus_Names_@" port="@_Port_Names_@" asn1file="@_Asn1_Files_@" asn1type="@_Asn1_Typenames_@" asn1module="@_Asn1_Modules_@"/>
@@END_TABLE@@
</Node>
@@-- The following tags are available in this template:
@@--
@@-- @_Name_@ : Partition name (usually the name of the binary)
@@-- @_Coverage_@ : True if user requested code coverage enable
@@-- @_Package_Name_@ : AADL Package name for the target (e.g. ocarina_porocessors_x86)
@@-- @_CPU_Name_@ : CPU Name (e.g. x86_linux)
@@-- @_CPU_Platform_@ : AADL CPU_Platform (e.g. PLATFORM_NATIVE)
@@-- @_CPU_Classifier_@ : AADL CPU Classifier (e.g. ocarina_processors_x86::x86.linux)
@@-- @_VP_Name_@ : Virtual processor name on which the partition is bounded
@@-- @_VP_Platform_@ : Virtual processor platform (e.g. PLATFORM_AIR)
@@-- @_VP_Classifier_@ : Virtual processor classifier
@@-- @_Bound_Functions_@ : List of user functions from Interface view
@@-- @_Ada_Runtime_@ : Ada runtime for the CPU
<Partition name="@_Name_@" coverage="@_Coverage_@" package="@_Package_Name_@" cpu="@_CPU_Name_@" cpu_platform="@_CPU_Platform_@" cpu_classifier="@_CPU_Classifier_@" vp_name="@_VP_Name_@" vp_platform="@_VP_Platform_@" vp_classifier="@_VP_Classifier_@" ada_runtime="@_Ada_Runtime_@">
@@TABLE@@
<function>@_Bound_Functions_@</function>
@@END_TABLE@@
</Partition>
......@@ -8,7 +8,7 @@
@@-- @_Busses_@
<DeploymentView>
@_Nodes'Indent_@
@_Busses'Ident_@
@_Busses'Indent_@
@@TABLE@@
<Connection from_node="@_Source_Nodes_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Nodes_@" to_port="@_Dest_Ports_@"/>
@@END_TABLE@@
......
@@-- The following tags are available in this template:
@@--
@@-- @_Node_Name_@ : Name of the node from deployment view
@@-- @_Partition_Names_@ : Tag listing the partitions in this node
@@-- @_Partitions_@ : List of rendered code for partitions
@@-- @_CPU_Name_@, _Platform_@, _Classifier_@, _Ada_Runtime_@ : Info about CPU
@@-- @_Device_Names_@ : Vector tag for device drivers - name
......
......@@ -11,7 +11,7 @@
@@-- @_VP_Classifier_@ : Virtual processor classifier
@@-- @_Bound_Functions_@ : List of user functions from Interface view
@@-- @_Ada_Runtime_@ : Ada runtime for the CPU
<Partition name="@_Name_@" coverage="@_Coverage_@" package="@_Package_Name_@" cpu="@_CPU_Name_@" cpu_platform="@_CPU_Platform_@" cpu_classifier="@_CPU_Classifier_@" vp_name="@_VP_Name_@" vp_platform="@_VP_Platform_@" vp_classifier="@_VP_Classifier_" ada_runtime="@_Ada_Runtime_@">
<Partition name="@_Name_@" coverage="@_Coverage_@" package="@_Package_Name_@" cpu="@_CPU_Name_@" cpu_platform="@_CPU_Platform_@" cpu_classifier="@_CPU_Classifier_@" vp_name="@_VP_Name_@" vp_platform="@_VP_Platform_@" vp_classifier="@_VP_Classifier_@" ada_runtime="@_Ada_Runtime_@">
@@TABLE@@
<function>@_Bound_Functions_@</function>
@@END_TABLE@@
......
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