Commit 141206ec authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Complete thread templates for aadl output

parent 25d2154c
......@@ -108,30 +108,38 @@ package body TASTE.Concurrency_View is
-- This function translates a thread definition into a template
function To_Template (T : AADL_Thread) return Translate_Set is
Remote_Thread : Vector_Tag;
Remote_PI : Vector_Tag;
Remote_PI_Param : Vector_Tag;
Remote_Thread : Vector_Tag;
Remote_PI : Vector_Tag; -- Name of the remote PI
Remote_PI_Sort : Vector_Tag; -- ASN.1 type of the parameter
Remote_PI_Module : Vector_Tag; -- ASN.1 module containing the type
begin
for Out_Port of T.Output_Ports loop
Remote_Thread := Remote_Thread & To_String (Out_Port.Remote_Thread);
Remote_PI := Remote_PI & To_String (Out_Port.Remote_PI);
Remote_PI_Param := Remote_PI_Param
& (if Out_Port.RI.Params.Length > 0
then Out_Port.RI.Params.First_Element.Sort
else US (""));
-- Set the Asn.1 module and type of the optional RI parameter
if Out_Port.RI.Params.Length > 0 then
Remote_PI_Sort := Remote_PI_Sort
& Out_Port.RI.Params.First_Element.Sort;
Remote_PI_Module := Remote_PI_Module
& Out_Port.RI.Params.First_Element.ASN1_Module;
else
Remote_PI_Sort := Remote_PI_Sort & "";
Remote_PI_Module := Remote_PI_Module & "";
end if;
end loop;
return Result : constant Translate_Set :=
T.PI.To_Template -- Template of the PI used to create the thread
& Assoc ("Thread_Name", To_String (T.Name))
& Assoc ("Entry_Port_Name", To_String (T.Entry_Port_Name))
& Assoc ("RCM", To_String (T.RCM))
& Assoc ("Pro_Block_Name", To_String (T.Protected_Block_Name))
& Assoc ("Node_Name", To_String (T.Node.Value_Or
(Taste_Node'(Name => US (""), others => <>)).Name))
& Assoc ("Remote_Threads", Remote_Thread)
& Assoc ("Remote_PIs", Remote_PI)
& Assoc ("Remote_PI_Params", Remote_PI_Param);
T.PI.To_Template -- Template of the PI used to create the thread
& Assoc ("Thread_Name", To_String (T.Name))
& Assoc ("Entry_Port_Name", To_String (T.Entry_Port_Name))
& Assoc ("RCM", To_String (T.RCM))
& Assoc ("Pro_Block_Name", To_String (T.Protected_Block_Name))
& Assoc ("Node_Name", To_String (T.Node.Value_Or
(Taste_Node'(Name => US (""), others => <>)).Name))
& Assoc ("Remote_Threads", Remote_Thread)
& Assoc ("Remote_PIs", Remote_PI)
& Assoc ("Remote_PI_Sorts", Remote_PI_Sort)
& Assoc ("Remote_PI_Modules", Remote_PI_Module);
end To_Template;
-- Generate the the code by iterating over template folders
......
......@@ -964,18 +964,20 @@ package body TASTE.Interface_View is
-- Create a Templates_Parser translate set for an interface (PI or RI)
function To_Template (TI : Taste_Interface) return Translate_Set is
Param_Names : Vector_Tag;
Param_Types : Vector_Tag;
Param_Directions : Vector_Tag;
Param_Encodings : Vector_Tag;
Property_Names : Vector_Tag;
Property_Values : Vector_Tag;
Param_Names,
Param_Types,
Param_ASN1_Modules,
Param_Directions,
Param_Encodings,
Property_Names,
Property_Values : Vector_Tag;
begin
for Each of TI.Params loop
Param_Names := Param_Names & Each.Name;
Param_Types := Param_Types & Each.Sort;
Param_Directions := Param_Directions & Each.Direction'Img;
Param_Encodings := Param_Encodings & Each.Encoding'Img;
Param_Names := Param_Names & Each.Name;
Param_Types := Param_Types & Each.Sort;
Param_ASN1_Modules := Param_ASN1_Modules & Each.ASN1_Module;
Param_Directions := Param_Directions & Each.Direction'Img;
Param_Encodings := Param_Encodings & Each.Encoding'Img;
end loop;
-- Add all function user-defined properties
for Each of TI.User_Properties loop
......@@ -991,6 +993,7 @@ package body TASTE.Interface_View is
& Assoc ("Queue_Size", TI.Queue_Size.Value_Or (1)'Img)
& Assoc ("Param_Names", Param_Names)
& Assoc ("Param_Types", Param_Types)
& Assoc ("Param_ASN1_Modules", Param_ASN1_Modules)
& Assoc ("Param_Encodings", Param_Encodings)
& Assoc ("Param_Directions", Param_Directions)
& Assoc ("IF_Property_Names", Property_Names)
......
@@-- The following tags are available in this template:
@@--
@@-- @_Thread_Name_@ : Thread name
@@-- @_Entry_Port_Name_@ : Name of the PI
@@-- @_RCM_@ : One of "CYCLIC_OPERATION", "SPORADIC_OPERATION"
@@-- @_Pro_Block_Name_@ : Name of the protected function
@@-- @_Node_Name_@ : Name of the deployment node
@@-- @_Remote_Threads_@ : Vector tag: output remote thread list
@@-- @_Remote_PIs_@ : |_ Associated PI Name
@@-- @_Remote_PI_Params_@ : |_ Optional param of the remote thread
@@-- @_Thread_Name_@ : Thread name
@@-- @_Entry_Port_Name_@ : Name of the PI
@@-- @_RCM_@ : One of "CYCLIC_OPERATION", "SPORADIC_OPERATION"
@@-- @_Pro_Block_Name_@ : Name of the protected function
@@-- @_Node_Name_@ : Name of the deployment node
@@-- @_Remote_Threads_@ : Vector tag: output remote thread list
@@-- @_Remote_PIs_@ : |_ Associated PI Name
@@-- @_Remote_PI_Sorts_@ : |_ Optional param type of the remote thread
@@-- @_Remote_PI_Modules_@ : |_ Asn1 module of the optional param type
@@-- Tags related to the PI that is at the origin of the thread creation:
@@-- @_Name_@, @_Kind_@, @_Parent_Function_@ : shoud be useless here
@@-- @_Param_Names_@, _Types_@, _Encodings_@, _Directions_@ : param vector tag
@@-- @_Param_Names_@, _Types_@, _ASN1_Modules, _Encodings_@, _Directions_@ : param vector tag
@@-- @_Period_@, @_WCET_@, @_Queue_Size_@ : relevant here
@@-- @_IF_Property_Names_@, _Values_@ : user properties (vector tag)
@@--
......@@ -25,20 +26,20 @@ thread @_Thread_Name_@
features
@@INLINE( )()()@@
@@IF@@ @_Param_Names'Length_@ > 0
INPORT_@_Entry_Port_Name_@ : in event data port @_Param_Types_@
INPORT_@_Entry_Port_Name_@ : in event data port DataView::@_REPLACE_ALL((-)/_):Param_Types_@_Buffer.impl
@@ELSE@@
INPORT_@_Entry_Port_Name_@ : in event port
@@END_IF@@
@@END_INLINE@@
{ Compute_Execution_Time => @_WCET_@ .. @_WCET_@ ms;
{ Compute_Execution_Time => @_WCET_@ ms .. @_WCET_@ ms;
Queue_Size => @_Queue_Size_@;
Compute_Entrypoint_Source_Text => "@_Thread_Name_@_Wrappers.@_Entry_Port_Name_@"; };
@@TABLE@@
@@INLINE( )(\n )()@@
@@IF@@ @_Param_Names'Length_@ > 0
OUTPUT @_Remote_PIs_@ : out event data port @_Param_Types_@;
@@INLINE( )()()@@
@@IF@@ @_Remote_PI_Sorts_@ /= ""
OUTPUT @_Remote_PIs_@ : out event data port DataView::@_REPLACE_ALL((-)/_):Remote_PI_Sorts_@_Buffer.impl;
@@ELSE@@
OUTPUT @_Remote_PIs_@ : out event port;
OUTPUT @_Remote_PIs_@ : out event port;
@@END_IF@@
@@END_INLINE@@
@@END_TABLE@@
......@@ -49,14 +50,14 @@ properties
Initialize_Entrypoint_Source_Text => "@_Name_@_Wrappers.C_Init_@_Name_@";
@@INLINE( )()()@@
@@IF@@ @_RCM_@ = "SPORADIC_OPERATION"
Dispatch_Protocol = Sporadic;
Dispatch_Protocol => Sporadic;
@@ELSE@@
Dispatch_Protocol => Periodic;
@@END_IF@@
@@END_INLINE@@
Period => @_Period_@;
Dispatch_Offset => 0;
Compute_Execution_Time => @_WCET_@ .. @_WCET_@ ms;
Compute_Execution_Time => @_WCET_@ ms .. @_WCET_@ ms;
Stack_Size => 50 KBytes;
Priority => 1;
end @_Name_@.others;
......
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