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

handle data and devices, almost all mast elements can now be generated



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/ocarina@1363 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 73821733
......@@ -65,10 +65,18 @@ package body Ocarina.Backends.MAST.Main is
procedure Visit_Thread (E : Node_Id);
procedure Visit_Subprogram (E : Node_Id);
procedure Visit_Bus (E : Node_Id);
procedure Visit_Data (E : Node_Id);
procedure Visit_Device (E : Node_Id);
procedure Visit_Virtual_Processor (E : Node_Id);
function Map_Port_Operation_Name (The_Thread : Node_Id; The_Port : Node_Id)
return Name_Id;
function Map_Driver_Receive_Operation_Name (The_Device : Node_Id)
return Name_Id;
function Map_Driver_Send_Operation_Name (The_Device : Node_Id)
return Name_Id;
function Map_Driver_Scheduling_Server_Name (The_Device : Node_Id)
return Name_Id;
Root_System_Node : Node_Id := No_Node;
......@@ -87,6 +95,57 @@ package body Ocarina.Backends.MAST.Main is
return Name_Find;
end Map_Port_Operation_Name;
------------------------------------
-- Map_Driver_Send_Operation_Name --
------------------------------------
function Map_Driver_Send_Operation_Name (The_Device : Node_Id)
return Name_Id is
N : Name_Id;
begin
Set_Str_To_Name_Buffer ("");
Get_Name_String
(Normalize_Name
(Name (Identifier (Parent_Subcomponent (The_Device)))));
Add_Str_To_Name_Buffer ("_operation_send");
N := Name_Find;
return N;
end Map_Driver_Send_Operation_Name;
---------------------------------------
-- Map_Driver_Receive_Operation_Name --
---------------------------------------
function Map_Driver_Receive_Operation_Name (The_Device : Node_Id)
return Name_Id is
N : Name_Id;
begin
Set_Str_To_Name_Buffer ("");
Get_Name_String
(Normalize_Name
(Name (Identifier (Parent_Subcomponent (The_Device)))));
Add_Str_To_Name_Buffer ("_operation_receive");
N := Name_Find;
return N;
end Map_Driver_Receive_Operation_Name;
---------------------------------------
-- Map_Driver_Scheduling_Server_Name --
---------------------------------------
function Map_Driver_Scheduling_Server_Name (The_Device : Node_Id)
return Name_Id is
N : Name_Id;
begin
Set_Str_To_Name_Buffer ("");
Get_Name_String
(Normalize_Name
(Name (Identifier (Parent_Subcomponent (The_Device)))));
Add_Str_To_Name_Buffer ("_scheduling_server");
N := Name_Find;
return N;
end Map_Driver_Scheduling_Server_Name;
-----------
-- Visit --
-----------
......@@ -127,6 +186,12 @@ package body Ocarina.Backends.MAST.Main is
when CC_Process =>
Visit_Process (E);
when CC_Data =>
Visit_Data (E);
when CC_Device =>
Visit_Device (E);
when CC_Thread =>
Visit_Thread (E);
......@@ -161,6 +226,37 @@ package body Ocarina.Backends.MAST.Main is
null;
end Visit_Virtual_Processor;
------------------
-- Visit_Device --
------------------
procedure Visit_Device (E : Node_Id) is
S : Node_Id;
N : Node_Id;
begin
N := MTU.Make_Driver
(Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))),
Packet,
Map_Driver_Scheduling_Server_Name (E),
Map_Driver_Send_Operation_Name (E),
Map_Driver_Receive_Operation_Name (E),
False,
Coupled);
MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File));
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end Visit_Device;
---------------------
-- Visit_Processor --
---------------------
......@@ -170,7 +266,7 @@ package body Ocarina.Backends.MAST.Main is
N : Node_Id;
begin
N := MTU.Make_Processing_Resource
(Normalize_Name (Name (Identifier (E))),
(Normalize_Name (Name (Identifier (Parent_Subcomponent (E)))),
PR_Fixed_Priority_Processor);
MTU.Append_Node_To_List (N, MTN.Declarations (MAST_File));
......@@ -206,6 +302,37 @@ package body Ocarina.Backends.MAST.Main is
end if;
end Visit_Process;
----------------
-- Visit_Data --
-------------------
procedure Visit_Data (E : Node_Id) is
S : Node_Id;
N : Node_Id;
CP : constant Supported_Concurrency_Control_Protocol
:= Get_Concurrency_Protocol (E);
begin
if CP = Concurrency_Protected_Access or else
CP = concurrency_Priority_Ceiling or else
Is_Protected_Data (E) or else
Get_Data_Representation (E) = Data_With_Accessors then
N := Make_Shared_Resource
(Immediate_Ceiling, Normalize_Name (Name (Identifier (E))));
Append_Node_To_List (N, MTN.Declarations (MAST_File));
end if;
if not AINU.Is_Empty (Subcomponents (E)) then
S := First_Node (Subcomponents (E));
while Present (S) loop
-- Visit the component instance corresponding to the
-- subcomponent S.
Visit (Corresponding_Instance (S));
S := Next_Node (S);
end loop;
end if;
end Visit_Data;
------------------
-- Visit_Thread --
------------------
......@@ -253,8 +380,11 @@ package body Ocarina.Backends.MAST.Main is
N := Make_Scheduling_Server
(Server_Sched_Name,
Normalize_Name (Name (Identifier (Get_Bound_Processor
(Parent_Component (Parent_Subcomponent (E)))))));
Normalize_Name
(Name (Identifier (Parent_Subcomponent
(Get_Bound_Processor
(Parent_Component
(Parent_Subcomponent (E))))))));
MTN.Set_Parameters (N, Server_Parameters);
......
......@@ -62,6 +62,8 @@ package body Ocarina.Backends.MAST_Tree.Generator is
procedure Generate_Event (N : Node_Id);
procedure Generate_Event_Handler (N : Node_Id);
procedure Generate_Operation (N : Node_Id);
procedure Generate_Shared_Resource (N : Node_Id);
procedure Generate_Driver (N : Node_Id);
procedure Generate_Event_Timing_Requirements (N : Node_Id);
procedure Generate_Scheduling_Server_Parameters (N : Node_Id);
......@@ -180,6 +182,12 @@ package body Ocarina.Backends.MAST_Tree.Generator is
when K_Operation =>
Generate_Operation (N);
when K_Shared_Resource =>
Generate_Shared_Resource (N);
when K_Driver =>
Generate_Driver (N);
when K_Event_Timing_Requirements =>
Generate_Event_Timing_Requirements (N);
......@@ -642,6 +650,41 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Write (Tok_Right_Paren);
end Generate_Event_Handler;
------------------------------
-- Generate_Shared_Resource --
------------------------------
procedure Generate_Shared_Resource (N : Node_Id) is
begin
Write (Tok_Shared_Resource);
Write_Space;
Write (Tok_Left_Paren);
Increment_Indentation;
Write_Eol;
Write_Indentation (-1);
Write (Tok_Type);
Write_Space;
Write (Tok_Assign);
Write_Space;
if Is_Immediate_Ceiling_Resource (N) then
Write (Tok_Immediate_Ceiling_Resource);
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_Right_Paren);
Write (Tok_Semicolon);
end Generate_Shared_Resource;
------------------------
-- Generate_Operation --
------------------------
......@@ -720,6 +763,89 @@ package body Ocarina.Backends.MAST_Tree.Generator is
Write (Tok_Right_Paren);
end if;
Write_Line (");");
Decrement_Indentation;
Write_Eol;
end Generate_Operation;
---------------------
-- Generate_Driver --
---------------------
procedure Generate_Driver (N : Node_Id) is
begin
Write (Tok_Driver);
Write_Space;
Write (Tok_Left_Paren);
Increment_Indentation;
Write_Eol;
Write_Indentation (-1);
Write (Tok_Type);
Write_Space;
Write (Tok_Assign);
Write_Space;
if Is_Packet_Driver (N) then
Write (Tok_Packet_Driver);
else
Write (Tok_Character_Packet_Driver);
end if;
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Packet_Server);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write_Name (Scheduling_Server (N));
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Packet_Send_Operation);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write_Name (Send_Operation_Name (N));
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Packet_Receive_Operation);
Write_Space;
Write (Tok_Assign);
Write_Space;
Write_Name (Receive_Operation_Name (N));
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_Message_Partitioning);
Write_Space;
Write (Tok_Assign);
Write_Space;
if Message_Partitioning (N) then
Write_Str ("Yes");
else
Write_Str ("No");
end if;
Write (Tok_Colon);
Write_Eol;
Write_Indentation (-1);
Write (Tok_RTA_Overhead_Model);
Write_Space;
Write (Tok_Assign);
Write_Space;
if Is_RTA_Overhead_Model_Coupled (N) then
Write (Tok_Coupled);
else
Write (Tok_Decoupled);
end if;
Write (Tok_Right_Paren);
Write (Tok_Semicolon);
Decrement_Indentation;
Write_Eol;
end Generate_Driver;
end Ocarina.Backends.MAST_Tree.Generator;
......@@ -26,6 +26,15 @@ module Ocarina::Backends::MAST_Tree::Nodes {
Name_Id Node_Type;
};
interface Driver : MAST_Node {
boolean Is_Packet_Driver;
Name_Id Send_Operation_Name;
Name_Id Scheduling_Server;
Name_Id Receive_Operation_Name;
boolean Message_Partitioning;
boolean Is_RTA_Overhead_Model_Coupled;
};
interface Processing_Resource : MAST_Node {
Node_Id Max_Interrupt_Priority;
Node_Id Min_Interrupt_Priority;
......@@ -103,6 +112,10 @@ module Ocarina::Backends::MAST_Tree::Nodes {
Node_Id Period;
};
interface Shared_Resource : MAST_Node {
boolean Is_Immediate_Ceiling_Resource;
};
interface Event_Timing_Requirements : Node_Id {
boolean Is_Hard_Deadline;
Node_Id Deadline;
......
......@@ -732,4 +732,62 @@ package body Ocarina.Backends.MAST_Tree.Nutils is
return N;
end Make_Event_Timing_Requirement;
--------------------------
-- Make_Shared_Resource --
--------------------------
function Make_Shared_Resource
(Res_Kind : Shared_Resource_Kind; Res_Name : Name_Id)
return Node_Id
is
N : Node_Id;
begin
N := New_Node (MTN.K_Shared_Resource);
MTN.Set_Node_Name (N, Res_Name);
MTN.Set_Is_Immediate_Ceiling_Resource (N, False);
if Res_Kind = Immediate_Ceiling then
MTN.Set_Is_Immediate_Ceiling_Resource (N, True);
end if;
return N;
end Make_Shared_Resource;
-----------------
-- Make_Driver --
-----------------
function Make_Driver
(Driver_Name : Name_Id;
Drv_Kind : Driver_Kind;
Server_Sched_Name : Name_Id;
Send_Name : Name_Id;
Receive_Name : Name_Id;
Partitioning : Boolean;
Overhead_Kind : RTA_Overhead_Model_Kind)
return Node_Id
is
N : Node_Id;
begin
N := New_Node (MTN.K_Driver);
MTN.Set_Is_Packet_Driver (N, False);
if Drv_Kind = Packet then
MTN.Set_Is_Packet_Driver (N, True);
end if;
MTN.Set_Node_Name (N, Driver_Name);
MTN.Set_Scheduling_Server (N, Server_Sched_Name);
MTN.Set_Send_Operation_Name (N, Send_Name);
MTN.Set_Receive_Operation_Name (N, Receive_Name);
MTN.Set_Message_Partitioning (N, Partitioning);
MTN.Set_Is_RTA_Overhead_Model_Coupled (N, False);
if Overhead_Kind = Coupled then
MTN.Set_Is_RTA_Overhead_Model_Coupled (N, True);
end if;
return N;
end Make_Driver;
end Ocarina.Backends.MAST_Tree.Nutils;
......@@ -58,13 +58,18 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Best_Case_Execution_time,
Tok_Best_Context_Switch,
Tok_Best_ISR_Switch,
Tok_Character_Packet_Driver,
Tok_Composite_Operation_List,
Tok_Coupled,
Tok_Deadline,
Tok_Decoupled,
Tok_Driver,
Tok_Event_Handlers,
Tok_External_Events,
Tok_Fixed_Priority_Policy,
Tok_Hard_Global_Deadline,
Tok_Host,
Tok_Immediate_Ceiling_Resource,
Tok_Internal_Events,
Tok_Input_Event,
Tok_List_Of_Drivers,
......@@ -72,12 +77,14 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Max_Packet_Size,
Tok_Max_Priority,
Tok_Max_ISR_Switch,
Tok_Message_Partitioning,
Tok_Min_Interarrival,
Tok_Min_Packet_Size,
Tok_Min_Priority,
Tok_Name,
Tok_Output_Event,
Tok_Packet_Server,
Tok_Packet_Driver,
Tok_Packet_Send_Operation,
Tok_Packet_Receive_Operation,
Tok_Parameters,
......@@ -90,6 +97,7 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Tok_Server_Processing_Resource,
Tok_Server_Sched_Parameters,
Tok_Speed_Factor,
Tok_Shared_Resource,
Tok_The_Priority,
Tok_Throughput,
Tok_Timing_Requirements,
......@@ -261,4 +269,23 @@ package Ocarina.Backends.MAST_Tree.Nutils is
Ref_Event : Name_Id)
return Node_Id;
type Shared_Resource_Kind is (Immediate_Ceiling, Unknown);
function Make_Shared_Resource
(Res_Kind : Shared_Resource_Kind; Res_Name : Name_Id)
return Node_Id;
type RTA_Overhead_Model_Kind is (Coupled, Decoupled);
type Driver_Kind is (Character, Packet);
function Make_Driver
(Driver_Name : Name_Id;
Drv_Kind : Driver_Kind;
Server_Sched_Name : Name_Id;
Send_Name : Name_Id;
Receive_Name : Name_Id;
Partitioning : Boolean;
Overhead_Kind : RTA_Overhead_Model_Kind) return Node_Id;
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