Commit 07d201ef authored by julien.delange's avatar julien.delange
Browse files

* generate function calls that use the driver sender function

git-svn-id: 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent b122bda6
......@@ -751,8 +751,12 @@ package body Ocarina.Backends.PO_HI_C.Activity is
procedure Make_Send_Out_Ports is
N : Node_Id;
F : Node_Id;
Used_Bus : Node_Id;
Used_Device : Node_Id;
Send_Function_Node : Node_Id;
Send_Alternative_Label : List_Id;
Send_Alternative_Stmts : List_Id;
Send_Function_Name : Name_Id := No_Name;
Error_Already_Defined : Boolean := False;
N := Message_Comment ("Send the OUT ports");
......@@ -772,10 +776,34 @@ package body Ocarina.Backends.PO_HI_C.Activity is
(Map_C_Enumerator_Name (F)),
Used_Bus := Get_Associated_Bus (F);
if Used_Bus /= No_Node then
if AAU.Is_Virtual_Bus (Used_Bus) then
Used_Bus := Parent_Component
(Parent_Subcomponent (Used_Bus));
end if;
Used_Device := Get_Device_Of_Process
(Parent_Subcomponent (E))));
Send_Function_Name := Get_Send_Function_Name
(Corresponding_Instance (Used_Device));
end if;
if Send_Function_Name /= No_Name then
Send_Function_Node :=
Make_Defining_Identifier (Send_Function_Name);
Send_Function_Node := RE (RE_Transport_Send_Default);
end if;
(RE (RE_Transport_Send_Default),
(Make_Defining_Identifier (PN (P_Task)),
Make_Defining_Identifier (PN (P_Port))))),
......@@ -3969,7 +3969,40 @@ package body Ocarina.Backends.Properties is
end if;
return No_Name;
end Get_Driver_Name;
-- Get_Send_Function_Name --
function Get_Send_Function_Name (Device : Node_Id) return Name_Id is
Impl : Node_Id;
S : Node_Id;
I : Node_Id;
if Device = No_Node then
return No_Name;
end if;
Impl := Get_Implementation (Device);
if Impl /= No_Node then
if not AINU.Is_Empty (AIN.Subcomponents (Impl)) then
S := AIN.First_Node (AIN.Subcomponents (Impl));
while Present (S) loop
I := Corresponding_Instance (S);
if Is_Subprogram (I) and then
AIN.Name (AIN.Identifier (S))
= Get_String_Name ("sender") and then
Get_Source_Name (I) /= No_Name then
return Get_Source_Name (I);
end if;
S := AIN.Next_Node (S);
end loop;
end if;
end if;
return No_Name;
end Get_Send_Function_Name;
end Ocarina.Backends.Properties;
......@@ -766,6 +766,11 @@ package Ocarina.Backends.Properties is
function Get_Driver_Name (Device : Node_Id) return Name_Id;
-- Returns the name of the driver.
function Get_Send_Function_Name (Device : Node_Id) return Name_Id;
-- Returns the sender function name of a device.
-- It corresponds to the receiver subcomponent in the abstract
-- device that models the content of the device.
Empty_Name_Array : constant Name_Array (1 .. 0) := (others => No_Name);
......@@ -3699,4 +3699,65 @@ package body Ocarina.Backends.Utils is
return False;
end Process_Use_Defaults_Sockets;
-- Get_Associated_Bus --
function Get_Associated_Bus (Port : Node_Id)
return Node_Id is
C : Node_Id;
F : Node_Id;
B : Node_Id;
C_End : Node_Id;
End_List : List_Id;
Ports_To_Browse : List_Id;
if Is_In (Port) then
Ports_To_Browse := Sources (Port);
Ports_To_Browse := Destinations (Port);
end if;
if not AAU.Is_Empty (Ports_To_Browse) then
F := First_Node (Ports_To_Browse);
while Present (F) loop
-- We make two iteration to traverse (1) the sources
-- of F then (2) the destinations of F.
End_List := Sources (Item (F));
for I in Boolean'Range loop
if not AAU.Is_Empty (End_List) then
C_End := First_Node (End_List);
while Present (C_End) loop
-- Get the connection involving C_End
C := Extra_Item (C_End);
-- Get the bus of the connection
B := Get_Bound_Bus (C);
if B /= No_Node then
return B;
end if;
C_End := Next_Node (C_End);
end loop;
end if;
End_List := Destinations (Item (F));
end loop;
F := Next_Node (F);
end loop;
end if;
return No_Node;
end Get_Associated_Bus;
end Ocarina.Backends.Utils;
......@@ -487,4 +487,6 @@ package Ocarina.Backends.Utils is
function Process_Use_Defaults_Sockets (The_Process : Node_Id)
return Boolean;
function Get_Associated_Bus (Port : Node_Id) return Node_Id;
end Ocarina.Backends.Utils;
Supports Markdown
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