Commit 974a1b68 authored by julien.delange's avatar julien.delange
Browse files

generate files according to marco panunzio recommendations



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@1400 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent ed0dafbd
...@@ -77,6 +77,8 @@ package body Ocarina.Backends.MAST.Main is ...@@ -77,6 +77,8 @@ package body Ocarina.Backends.MAST.Main is
return Name_Id; return Name_Id;
function Map_Driver_Scheduling_Server_Name (The_Device : Node_Id) function Map_Driver_Scheduling_Server_Name (The_Device : Node_Id)
return Name_Id; return Name_Id;
function Map_Scheduler_Name (The_Processor : Node_Id) return Name_Id;
function Make_Driver_Wrapper (The_Device : Node_Id) return Node_Id; function Make_Driver_Wrapper (The_Device : Node_Id) return Node_Id;
function Map_Operation_Message_Transmission_Name function Map_Operation_Message_Transmission_Name
(The_Data : Node_Id) (The_Data : Node_Id)
...@@ -84,6 +86,19 @@ package body Ocarina.Backends.MAST.Main is ...@@ -84,6 +86,19 @@ package body Ocarina.Backends.MAST.Main is
Root_System_Node : Node_Id := No_Node; Root_System_Node : Node_Id := No_Node;
function Map_Scheduler_Name (The_Processor : Node_Id) return Name_Id is
N : Name_Id;
begin
Get_Name_String
(Normalize_Name
(Name
(Identifier
(Parent_Subcomponent (The_Processor)))));
Add_Str_To_Name_Buffer ("_scheduler");
N := Name_Find;
return N;
end Map_Scheduler_Name;
--------------------------------------------- ---------------------------------------------
-- Map_Operation_Message_Transmission_Name -- -- Map_Operation_Message_Transmission_Name --
--------------------------------------------- ---------------------------------------------
...@@ -370,7 +385,21 @@ package body Ocarina.Backends.MAST.Main is ...@@ -370,7 +385,21 @@ package body Ocarina.Backends.MAST.Main is
begin begin
N := MTU.Make_Processing_Resource N := MTU.Make_Processing_Resource
(Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))), (Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))),
PR_Fixed_Priority_Processor); PR_Regular_Processor);
MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File));
N := MTU.Make_Scheduler
(Map_Scheduler_Name (E),
Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))));
MTN.Set_Is_Primary_Scheduler (N, True);
MTN.Set_Use_Fixed_Priority (N, True);
MTN.Set_Min_Priority
(N, Make_Literal
(New_Numeric_Value (1, 1, 10)));
MTN.Set_Max_Priority
(N, Make_Literal
(New_Numeric_Value (256, 1, 10)));
MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File)); MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File));
...@@ -505,11 +534,13 @@ package body Ocarina.Backends.MAST.Main is ...@@ -505,11 +534,13 @@ package body Ocarina.Backends.MAST.Main is
N := Make_Scheduling_Server N := Make_Scheduling_Server
(Server_Sched_Name, (Server_Sched_Name,
Normalize_Name No_Name);
(Name (Identifier (Parent_Subcomponent MTN.Set_Associated_Scheduler
(N,
Map_Scheduler_Name
(Get_Bound_Processor (Get_Bound_Processor
(Parent_Component (Parent_Component
(Parent_Subcomponent (E)))))))); (Parent_Subcomponent (E)))));
MTN.Set_Parameters (N, Server_Parameters); MTN.Set_Parameters (N, Server_Parameters);
...@@ -613,7 +644,6 @@ package body Ocarina.Backends.MAST.Main is ...@@ -613,7 +644,6 @@ package body Ocarina.Backends.MAST.Main is
Make_Literal Make_Literal
(New_Numeric_Value (New_Numeric_Value
(1, 1, 10))); (1, 1, 10)));
end if; end if;
Append_Node_To_List (Operation, MTN.Declarations (MAST_File)); Append_Node_To_List (Operation, MTN.Declarations (MAST_File));
......
...@@ -64,6 +64,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is ...@@ -64,6 +64,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is
procedure Generate_Operation (N : Node_Id); procedure Generate_Operation (N : Node_Id);
procedure Generate_Shared_Resource (N : Node_Id); procedure Generate_Shared_Resource (N : Node_Id);
procedure Generate_Driver (N : Node_Id); procedure Generate_Driver (N : Node_Id);
procedure Generate_Scheduler (N : Node_Id);
procedure Generate_Event_Timing_Requirements (N : Node_Id); procedure Generate_Event_Timing_Requirements (N : Node_Id);
procedure Generate_Scheduling_Server_Parameters (N : Node_Id); procedure Generate_Scheduling_Server_Parameters (N : Node_Id);
...@@ -176,6 +177,9 @@ package body Ocarina.Backends.MAST_Tree.Generator is ...@@ -176,6 +177,9 @@ package body Ocarina.Backends.MAST_Tree.Generator is
when K_Scheduling_Server => when K_Scheduling_Server =>
Generate_Scheduling_Server (N); Generate_Scheduling_Server (N);
when K_Scheduler =>
Generate_Scheduler (N);
when K_Transaction => when K_Transaction =>
Generate_Transaction (N); Generate_Transaction (N);
...@@ -497,7 +501,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is ...@@ -497,7 +501,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Write_Line ("Type => Regular,"); Write_Line ("Type => Regular,");
else else
Write_Str ("Type => "); Write_Str ("Type => ");
Write_Name (Associated_Scheduler (N)); Write (Tok_Unknown);
Write_Line (Tok_Colon); Write_Line (Tok_Colon);
end if; end if;
...@@ -523,6 +527,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is ...@@ -523,6 +527,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Write_Eol; Write_Eol;
end if; end if;
if MTN.Server_Processing_Resource (N) /= No_Name then
Write_Indentation (-1); Write_Indentation (-1);
Write (Tok_Server_Processing_Resource); Write (Tok_Server_Processing_Resource);
Write_Space; Write_Space;
...@@ -530,6 +535,17 @@ package body Ocarina.Backends.MAST_Tree.Generator is ...@@ -530,6 +535,17 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Write_Space; Write_Space;
Write_Name (MTN.Server_Processing_Resource (N)); Write_Name (MTN.Server_Processing_Resource (N));
Write_Line (");"); Write_Line (");");
end if;
if MTN.Associated_Scheduler (N) /= No_Name then
Write_Indentation (-1);
Write (Tok_Scheduler);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write_Name (MTN.Associated_Scheduler (N));
Write_Line (");");
end if;
end Generate_Scheduling_Server; end Generate_Scheduling_Server;
-------------------------- --------------------------
...@@ -1012,4 +1028,94 @@ package body Ocarina.Backends.MAST_Tree.Generator is ...@@ -1012,4 +1028,94 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Decrement_Indentation; Decrement_Indentation;
end Generate_Driver; end Generate_Driver;
------------------------
-- Generate_Scheduler --
------------------------
procedure Generate_Scheduler (N : Node_Id) is
begin
Write (Tok_Scheduler);
Write_Space;
Write (Tok_Left_Paren);
Increment_Indentation;
Write (Tok_Type);
Write_Space;
Write (Tok_Assign);
Write_Space;
if Is_Primary_Scheduler (N) then
Write (Tok_Primary_Scheduler);
else
Write (Tok_Unknown);
end if;
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Name);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write_Name (Node_Name (N));
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Host);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write_Name (Host (N));
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Policy);
Write_Space;
Write (Tok_Assign);
Increment_Indentation;
Write_Eol;
Write_Indentation (-1);
Write (Tok_Left_Paren);
Write_Space;
Write_Eol;
Write_Indentation (-1);
Write (Tok_Type);
Write_Space;
Write (Tok_Assign);
Write_Space;
if Use_Fixed_Priority (N) then
Write (Tok_Fixed_Priority);
else
Write (Tok_Unknown);
end if;
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Max_Priority);
Write_Space;
Write (Tok_Assign);
Write_Space;
Generate (Max_Priority (N));
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Min_Priority);
Write_Space;
Write (Tok_Assign);
Write_Space;
Generate (Min_Priority (N));
Write (Tok_Right_Paren);
Decrement_Indentation;
Write (Tok_Right_Paren);
Write (Tok_Semicolon);
Decrement_Indentation;
Write_Eol;
end Generate_Scheduler;
end Ocarina.Backends.MAST_Tree.Generator; end Ocarina.Backends.MAST_Tree.Generator;
...@@ -51,10 +51,15 @@ module Ocarina::Backends::MAST_Tree::Nodes { ...@@ -51,10 +51,15 @@ module Ocarina::Backends::MAST_Tree::Nodes {
interface Scheduler : MAST_Node interface Scheduler : MAST_Node
{ {
boolean Is_Primary_Scheduler;
Name_Id Host; Name_Id Host;
Node_Id Policy;
boolean Use_Fixed_Priority;
Node_Id Max_Priority;
Node_Id Min_Priority;
}; };
interface Scheduler_Policy : Node_Id interface Scheduler_Policy : MAST_Node
{ {
Name_Id Scheduling_Type; Name_Id Scheduling_Type;
Node_Id Worst_Context_Switch; Node_Id Worst_Context_Switch;
......
...@@ -584,8 +584,8 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ...@@ -584,8 +584,8 @@ package body Ocarina.Backends.MAST_Tree.Nutils is
N := New_Node (MTN.K_Scheduling_Server); N := New_Node (MTN.K_Scheduling_Server);
MTN.Set_Node_Name (N, Server_Name); MTN.Set_Node_Name (N, Server_Name);
MTN.Set_Server_Processing_Resource (N, Associated_Processor); MTN.Set_Server_Processing_Resource (N, Associated_Processor);
MTN.Set_Is_Regular (N, False); MTN.Set_Is_Regular (N, True);
MTN.Set_Associated_Scheduler (N, Get_String_Name ("Fixed_Priority")); MTN.Set_Associated_Scheduler (N, No_Name);
MTN.Set_Parameters (N, No_Node); MTN.Set_Parameters (N, No_Node);
return N; return N;
end Make_Scheduling_Server; end Make_Scheduling_Server;
...@@ -815,4 +815,19 @@ package body Ocarina.Backends.MAST_Tree.Nutils is ...@@ -815,4 +815,19 @@ package body Ocarina.Backends.MAST_Tree.Nutils is
return N; return N;
end Make_Driver; end Make_Driver;
--------------------
-- Make_Scheduler --
--------------------
function Make_Scheduler (Sched_Name : Name_Id; Host_Name : Name_Id)
return Node_Id
is
N : Node_Id;
begin
N := New_Node (MTN.K_Scheduler);
MTN.Set_Node_Name (N, Sched_Name);
MTN.Set_Host (N, Host_Name);
return N;
end Make_Scheduler;
end Ocarina.Backends.MAST_Tree.Nutils; end Ocarina.Backends.MAST_Tree.Nutils;
...@@ -68,6 +68,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is ...@@ -68,6 +68,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Event_Handlers, Tok_Event_Handlers,
Tok_External_Events, Tok_External_Events,
Tok_Full_Duplex, Tok_Full_Duplex,
Tok_Fixed_Priority,
Tok_Fixed_Priority_Policy, Tok_Fixed_Priority_Policy,
Tok_Half_Duplex, Tok_Half_Duplex,
Tok_Hard_Global_Deadline, Tok_Hard_Global_Deadline,
...@@ -96,6 +97,8 @@ package Ocarina.Backends.MAST_Tree.Nutils is ...@@ -96,6 +97,8 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Packet_Receive_Operation, Tok_Packet_Receive_Operation,
Tok_Parameters, Tok_Parameters,
Tok_Period, Tok_Period,
Tok_Policy,
Tok_Primary_Scheduler,
Tok_Processing_Resource, Tok_Processing_Resource,
Tok_RTA_Overhead_Model, Tok_RTA_Overhead_Model,
Tok_Referenced_Event, Tok_Referenced_Event,
...@@ -300,4 +303,6 @@ package Ocarina.Backends.MAST_Tree.Nutils is ...@@ -300,4 +303,6 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Partitioning : Boolean; Partitioning : Boolean;
Overhead_Kind : RTA_Overhead_Model_Kind) return Node_Id; Overhead_Kind : RTA_Overhead_Model_Kind) return Node_Id;
function Make_Scheduler (Sched_Name : Name_Id; Host_Name : Name_Id)
return Node_Id;
end Ocarina.Backends.MAST_Tree.Nutils; end Ocarina.Backends.MAST_Tree.Nutils;
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