Commit 62e7f0ca authored by bouazizrahma's avatar bouazizrahma Committed by Jerome Hugues

Start implementation of mapping many transitions in BA of a sporadic thread

parent fff1ccb4
......@@ -594,14 +594,16 @@ package body Ocarina.Backends.C_Common.BA is
& "subprogram are not supported",
Fatal => True);
elsif AINU.Is_Thread (S) then
if Get_Thread_Dispatch_Protocol (S) = Thread_Periodic then
if Get_Thread_Dispatch_Protocol (S) = Thread_Periodic or else
Get_Thread_Dispatch_Protocol (S) = Thread_Sporadic
then
Map_C_Many_Transitions_Of_A_Thread
(S, Declarations, Statements);
else
Display_Error
("The mapping of many transitions in the BA of a non-periodic"
& "thread is not supported",
Fatal => True);
("The mapping of many BA transitions is only "
& " supported of periodic or sporadic threads",
Fatal => True);
end if;
end if;
end if;
......@@ -1975,17 +1977,28 @@ package body Ocarina.Backends.C_Common.BA is
Declarations : List_Id;
Statements : List_Id)
is
N : Node_Id;
begin
Map_BA_States_To_C_Types (S);
Make_States_Initialization_Function (S);
if Is_To_Make_Init_Sequence (S) then
Make_BA_Initialization_Function (S);
end if;
if Get_Thread_Dispatch_Protocol (S) = Thread_Periodic then
if Is_To_Make_Init_Sequence (S) then
Make_BA_Initialization_Function (S);
end if;
Make_BA_Body_Function (S, Declarations, Statements);
Make_BA_Body_Function (S, Declarations, Statements);
elsif Get_Thread_Dispatch_Protocol (S) = Thread_Sporadic then
N := Message_Comment
("Mapping many transitions in BA of Sporadic thread.");
CTU.Append_Node_To_List (N, Statements);
Map_C_Implementation_of_BA_Body_Function
(S, Declarations, Statements);
end if;
end Map_C_Many_Transitions_Of_A_Thread;
......
......@@ -1144,7 +1144,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
----------------------------------------
procedure Make_Thread_Behavior_Specification is
N : Node_Id;
N, N1 : Node_Id;
Parameter_List : constant List_Id := New_List (CTN.K_List_Id);
Def_Idt : Node_Id;
begin
......@@ -1172,16 +1172,46 @@ package body Ocarina.Backends.PO_HI_C.Activity is
if P = Thread_Sporadic then
Append_Node_To_List
(Make_Defining_Identifier (VN (V_Port)),
Call_Parameters);
N := Make_Variable_Address
(Make_Defining_Identifier (VN (V_Port)));
Append_Node_To_List (N, Call_Parameters);
N :=
Make_Parameter_Specification
(Make_Defining_Identifier (VN (V_Port)),
Parameter_Type => RE (RE_Port_T));
Parameter_Type => CTU.Make_Pointer_Type (RE (RE_Port_T)));
Append_Node_To_List (N, Parameter_List);
-- add data subcomponents of the thread to the call_parameters
-- of the procedure <<thread_instance_name>>_ba_body
if not AAU.Is_Empty (Subcomponents (E)) then
N1 := First_Node (Subcomponents (E));
while Present (N1) loop
if AAU.Is_Data (Corresponding_Instance (N1)) then
N :=
Make_Variable_Address
(Map_C_Defining_Identifier (N1));
Append_Node_To_List (N, Call_Parameters);
N :=
Make_Parameter_Specification
(Map_C_Defining_Identifier (N1),
Parameter_Type =>
CTU.Make_Pointer_Type
(Map_C_Data_Type_Designator
(Corresponding_Instance (N1))));
Append_Node_To_List (N, Parameter_List);
end if;
N1 := Next_Node (N1);
end loop;
end if;
end if;
N :=
......@@ -1429,7 +1459,7 @@ package body Ocarina.Backends.PO_HI_C.Activity is
-- when the BA of the thread has more than one state **/
--
-- producer_th_states_initialization ();
if P = Thread_Periodic then
if P = Thread_Periodic or else P = Thread_Sporadic then
declare
BA : Node_Id;
begin
......
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