Commit 39051125 authored by julien.delange's avatar julien.delange

generated MAST files now parse



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@1357 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 3df128dd
......@@ -153,7 +153,7 @@ package body Ocarina.Backends.MAST.Main is
begin
N := MTU.Make_Processing_Resource
(Normalize_Name (Name (Identifier (E))),
PR_Regular_Processor);
PR_Fixed_Priority_Processor);
MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File));
......@@ -204,12 +204,14 @@ package body Ocarina.Backends.MAST.Main is
Output_Event : Node_Id;
Output_Event_Name : Name_Id;
Event_Handler : Node_Id;
Server_Parameters : Node_Id;
Server_Sched_Name : Name_Id;
Operation_Name : Name_Id;
Operation : Node_Id;
Operations_List : constant List_Id
:= MTU.New_List (MTN.K_List_Id);
Output_Event_Req : Node_Id := No_Node;
Prio : Unsigned_Long_Long;
begin
Set_Str_To_Name_Buffer ("");
Get_Name_String (Normalize_Name (Name (Identifier (E))));
......@@ -221,10 +223,20 @@ package body Ocarina.Backends.MAST.Main is
Add_Str_To_Name_Buffer ("_sched_server");
Server_Sched_Name := Name_Find;
Prio := Get_Thread_Priority (E);
if Prio = 0 then
Prio := 1;
end if;
Server_Parameters := Make_Scheduling_Server_Parameters
(Fixed_Priority, Prio);
N := Make_Scheduling_Server
(Server_Sched_Name,
Normalize_Name (Name (Identifier (Get_Bound_Processor
(Parent_Component (Parent_Subcomponent (E)))))));
MTN.Set_Parameters (N, Server_Parameters);
Append_Node_To_List (N, MTN.Declarations (MAST_File));
N := Make_Transaction
......
......@@ -63,6 +63,7 @@ package body Ocarina.Backends.MAST_Tree.Generator is
procedure Generate_Event_Handler (N : Node_Id);
procedure Generate_Operation (N : Node_Id);
procedure Generate_Event_Timing_Requirements (N : Node_Id);
procedure Generate_Scheduling_Server_Parameters (N : Node_Id);
procedure Write (T : Token_Type);
procedure Write_Line (T : Token_Type);
......@@ -182,6 +183,9 @@ package body Ocarina.Backends.MAST_Tree.Generator is
when K_Event_Timing_Requirements =>
Generate_Event_Timing_Requirements (N);
when K_Scheduling_Server_Parameters =>
Generate_Scheduling_Server_Parameters (N);
when others =>
Display_Error ("other element in generator", Fatal => False);
null;
......@@ -260,6 +264,8 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Write_Indentation (-1);
if Regular_Processor (N) then
Write_Line ("Type => Regular_Processor,");
elsif Fixed_Priority_Processor (N) then
Write_Line ("Type => Fixed_Priority_Processor,");
else
Write_Line ("Type => Packet_Based_Network,");
end if;
......@@ -308,6 +314,32 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Decrement_Indentation;
end Generate_Processing_Resource;
-------------------------------------------
-- Generate_Scheduling_Server_Parameters --
-------------------------------------------
procedure Generate_Scheduling_Server_Parameters (N : Node_Id) is
begin
Write (Tok_Type);
Write_Space;
Write (Tok_Assign);
Write_Space;
if MTN.Fixed_Priority (N) then
Write (Tok_Fixed_Priority_Policy);
else
Write (Tok_Unknown);
end if;
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_The_Priority);
Write_Space;
Write (Tok_Assign);
Write_Space;
Generate (Priority (N));
end Generate_Scheduling_Server_Parameters;
--------------------------------
-- Generate_Scheduling_Server --
--------------------------------
......@@ -333,14 +365,19 @@ package body Ocarina.Backends.MAST_Tree.Generator is
if Parameters (N) /= No_Node then
Write_Indentation (-1);
Write (Tok_Parameters);
Write (Tok_Server_Sched_Parameters);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write (Tok_Left_Paren);
Increment_Indentation;
Write_Eol;
Write_Indentation (-1);
Generate (Parameters (N));
Write (Tok_Right_Paren);
Write_Line (Tok_Colon);
Write (Tok_Colon);
Decrement_Indentation;
Write_Eol;
end if;
Write_Indentation (-1);
......
......@@ -35,6 +35,7 @@ module Ocarina::Backends::MAST_Tree::Nodes {
Node_Id Speed_Factor;
boolean Regular_Processor;
boolean Packet_Based_Network;
boolean Fixed_Priority_Processor;
};
interface Scheduling_Server : MAST_Node {
......@@ -45,6 +46,7 @@ module Ocarina::Backends::MAST_Tree::Nodes {
};
interface Scheduling_Server_Parameters : Node_Id {
boolean Fixed_Priority;
Node_Id Sched_Type;
Node_Id Priority;
boolean Is_Preassigned;
......
......@@ -535,12 +535,18 @@ package body Ocarina.Backends.MAST_Tree.Nutils is
N : Node_Id;
begin
N := New_Node (MTN.K_Processing_Resource);
MTN.Set_Node_Name (N, PR_Name);
MTN.Set_Regular_Processor (N, False);
MTN.Set_Fixed_Priority_Processor (N, False);
MTN.Set_Packet_Based_Network (N, False);
if PR_Type = PR_Regular_Processor then
MTN.Set_Regular_Processor (N, True);
MTN.Set_Packet_Based_Network (N, False);
elsif PR_Type = PR_Fixed_Priority_Processor then
MTN.Set_Fixed_Priority_Processor (N, True);
else
MTN.Set_Regular_Processor (N, False);
MTN.Set_Packet_Based_Network (N, True);
end if;
return N;
......@@ -565,6 +571,30 @@ package body Ocarina.Backends.MAST_Tree.Nutils is
return N;
end Make_Scheduling_Server;
---------------------------------------
-- Make_Scheduling_Server_Parameters --
---------------------------------------
function Make_Scheduling_Server_Parameters
(Server_Kind : Scheduling_Server_Parameter_Kind;
Prio : Unsigned_Long_Long)
return Node_Id is
N : Node_Id;
begin
N := New_Node (MTN.K_Scheduling_Server_Parameters);
MTN.Set_Fixed_Priority (N, False);
MTN.Set_Is_Preassigned (N, False);
MTN.Set_Priority
(N, Make_Literal
(New_Numeric_Value (Prio, 1, 10)));
if Server_Kind = Fixed_Priority then
MTN.Set_Fixed_Priority (N, True);
end if;
return N;
end Make_Scheduling_Server_Parameters;
----------------------
-- Make_Transaction --
----------------------
......
......@@ -62,6 +62,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Deadline,
Tok_Event_Handlers,
Tok_External_Events,
Tok_Fixed_Priority_Policy,
Tok_Hard_Global_Deadline,
Tok_Host,
Tok_Internal_Events,
......@@ -88,9 +89,11 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Server_Processing_Resource,
Tok_Server_Sched_Parameters,
Tok_Speed_Factor,
Tok_The_Priority,
Tok_Throughput,
Tok_Timing_Requirements,
Tok_Type,
Tok_Unknown,
Tok_Worst_Case_Execution_Time,
Tok_Worst_Context_Switch,
Tok_Worst_ISR_Switch,
......@@ -190,6 +193,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is
type Processing_Resource_Kind is
(
PR_Regular_Processor,
PR_Fixed_Priority_Processor,
PR_Packet_Based_Network
);
......@@ -197,6 +201,17 @@ package Ocarina.Backends.MAST_Tree.Nutils is
(PR_Name : Name_Id; PR_Type : Processing_Resource_Kind)
return Node_Id;
type Scheduling_Server_Parameter_Kind is
(
Fixed_Priority,
Unknown
);
function Make_Scheduling_Server_Parameters
(Server_Kind : Scheduling_Server_Parameter_Kind;
Prio : Unsigned_Long_Long)
return Node_Id;
function Make_Scheduling_Server
(Server_Name : Name_Id;
Associated_Processor : Name_Id)
......
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