Commit 924596ab authored by Maxime Perrotin's avatar Maxime Perrotin

Improve ast entries for bus connections

parent 387c4cc8
......@@ -569,7 +569,9 @@ package body TASTE.AADL_Parser is
& To_String (T.Name),
Type_Name => Sort,
Remote_Partition_Name =>
Part.Unsafe_Just.Name));
Part.Unsafe_Just.Name,
Remote_Port_Name =>
Remote.Interface_Name));
else
-- Port already exists: just add this thread
Partition.Out_Ports
......
......@@ -520,12 +520,14 @@ package body TASTE.Concurrency_View is
Partition_VP : Vector_Tag; -- for TSP: VP binding
Part_Source_Name,
Part_Source_Port,
Part_Dest_Port,
Part_Dest_Name : Vector_Tag; -- Inter-partition connections (TSP)
Bus_Names,
Bus_AADL_Pkg,
Bus_Classifier : Vector_Tag; -- System busses
Device_Names,
Device_Node_Name,
Device_Partition_Name,
Device_AADL_Pkg,
Device_Classifier,
Device_CPU,
......@@ -621,6 +623,8 @@ package body TASTE.Concurrency_View is
& Out_Port.Port_Name;
Part_Dest_Name := Part_Dest_Name
& Out_Port.Remote_Partition_Name;
Part_Dest_Port := Part_Dest_Port
& Out_Port.Remote_Port_Name;
end loop;
end loop;
......@@ -641,6 +645,14 @@ package body TASTE.Concurrency_View is
-- nodes if needed, but for the concurrency view
-- in AADL they are only used at system level)
for N : Taste_Node of CV.Deployment.Nodes loop
-- Check that there if there are drivers, there is only one
-- partition in the node as the current design does not specify
-- what partition(s) use the drivers.
if not N.Drivers.Is_Empty and N.Partitions.Length > 1 then
raise Concurrency_View_Error with
"Drivers in multi-partition systems are not supported";
end if;
for D : Taste_Device_Driver of N.Drivers loop
declare
Dot : constant Natural := Index (D.Name, ".");
......@@ -655,6 +667,8 @@ package body TASTE.Concurrency_View is
Device_Names := Device_Names & Result;
end;
Device_Node_Name := Device_Node_Name & N.Name;
Device_Partition_Name := -- There must be only one
Device_Partition_Name & N.Partitions.First_Element.Name;
Device_AADL_Pkg := Device_AADL_Pkg & D.Package_Name;
Device_Classifier := Device_Classifier & D.Device_Classifier;
Device_CPU := Device_CPU & D.Associated_Processor_Name;
......@@ -689,6 +703,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Part_Source_Name", Part_Source_Name)
& Assoc ("Part_Source_Port", Part_Source_Port)
& Assoc ("Part_Dest_Name", Part_Dest_Name)
& Assoc ("Part_Dest_Port", Part_Dest_Port)
& Assoc ("Threads", Threads)
& Assoc ("Thread_Names", All_Thread_Names)
& Assoc ("Block_Names", All_Block_Names)
......@@ -698,6 +713,7 @@ package body TASTE.Concurrency_View is
& Assoc ("Bus_Classifier", Bus_Classifier)
& Assoc ("Device_Names", Device_Names)
& Assoc ("Device_Node_Name", Device_Node_Name)
& Assoc ("Device_Partition", Device_Partition_Name)
& Assoc ("Device_AADL_Pkg", Device_AADL_Pkg)
& Assoc ("Device_Classifier", Device_Classifier)
& Assoc ("Device_CPU", Device_CPU)
......
......@@ -98,7 +98,8 @@ package TASTE.Concurrency_View is
record
Port_Name, Type_Name : Unbounded_String;
Connected_Threads : String_Vectors.Vector;
Remote_Partition_Name : Unbounded_String; -- Other side
Remote_Partition_Name,
Remote_Port_Name : Unbounded_String; -- Other side
end record;
package Partition_Out_Ports is
......
......@@ -119,52 +119,57 @@ package body TASTE.Deployment_View is
function Parse_Connections (CI : Node_Id) return Bus_Connections.Vector
is
use Bus_Connections;
Conn : Node_Id;
Bound_Bus : Node_Id;
Src_Port : Node_Id;
Src_Name : Unbounded_String;
Dst_Name : Unbounded_String;
Dst_Port : Node_Id;
Bound_Bus_Name : Name_Id;
If1_Name : Name_Id;
Conn,
Bound_Bus,
SRC, DST : Node_Id;
SRC_PORT,
DST_PORT,
SRC_FUNCTION,
DST_FUNCTION : Unbounded_String;
Bound_Bus_Name,
If1_Name,
If2_Name : Name_Id;
Result : Bus_Connections.Vector;
begin
Conn := First_Node (Connections (CI));
while Present (Conn) loop
-- AADL is confusing because it reverses the meaning of source
-- and destination. Source is the message receiver (the PI) and
-- destination is the message sender (the RI)
Bound_Bus := Get_Bound_Bus (Conn, False);
if Bound_Bus /= No_Node then
Bound_Bus_Name := Name
(Identifier (Parent_Subcomponent (Bound_Bus)));
Src_Port := Get_Referenced_Entity (Source (Conn));
Dst_Port := Get_Referenced_Entity (Destination (Conn));
If1_Name := Get_Interface_Name (Src_Port);
If2_Name := Get_Interface_Name (Dst_Port);
DST := Get_Referenced_Entity (Source (Conn));
SRC := Get_Referenced_Entity (Destination (Conn));
If1_Name := Get_Interface_Name (DST); -- PI
If2_Name := Get_Interface_Name (SRC); -- RI
-- Get_Interface_Name is v1.3.5+ only
if If1_Name /= No_Name and If2_Name /= No_Name then
Src_Name := US (Get_Name_String (If1_Name));
Dst_Name := US (Get_Name_String (If2_Name));
DST_PORT := US (Get_Name_String (If1_Name)); -- PI
SRC_PORT := US (Get_Name_String (If2_Name)); -- RI
else
-- Keep compatibility with v1.2
Src_Name := US (Get_Name_String (Display_Name
(Identifier (Src_Port))));
Dst_Name := US (Get_Name_String (Display_Name
(Identifier (Dst_Port))));
DST_PORT := US (Get_Name_String (Display_Name
(Identifier (SRC))));
SRC_PORT := US (Get_Name_String (Display_Name
(Identifier (DST))));
end if;
Result := Result
& Bus_Connection'(Source_Node => Src_Name,
Source_Port => US (Get_Name_String
DST_FUNCTION := US (Get_Name_String
(Name (Identifier
(Parent_Subcomponent
(Parent_Component (Src_Port)))))),
Bus_Name =>
US (Get_Name_String (Bound_Bus_Name)),
Dest_Node => Dst_Name,
Dest_Port => US (Get_Name_String
(Parent_Component (DST))))));
SRC_FUNCTION := US (Get_Name_String
(Name (Identifier
(Parent_Subcomponent
(Parent_Component (Src_Port)))))));
(Parent_Component (SRC))))));
Result := Result
& Bus_Connection'(Dest_Port => DST_PORT,
Dest_Function => DST_FUNCTION,
Bus_Name =>
US (Get_Name_String (Bound_Bus_Name)),
Source_Port => SRC_PORT,
Source_Function => SRC_FUNCTION);
end if;
Conn := Next_Node (Conn);
end loop;
......@@ -587,7 +592,7 @@ package body TASTE.Deployment_View is
if Get_Category_Of_Component (CI) = CC_System then -- Node
if not Is_Empty (Connections (CI)) then
Conns := Conns & Parse_Connections (CI); -- Checkme
Conns := Conns & Parse_Connections (CI);
end if;
if not Is_Empty (Subcomponents (CI)) then
......@@ -697,11 +702,12 @@ package body TASTE.Deployment_View is
begin
for Each of DV.Connections loop
Put_Line (Output, "Connection on bus : " & To_String (Each.Bus_Name));
Put_Line (Output, " |_ Source Node : "
& To_String (Each.Source_Node));
Put_Line (Output, " |_ Source Function : "
& To_String (Each.Source_Function));
Put_Line (Output, " |_ Source Port : "
& To_String (Each.Source_Port));
Put_Line (Output, " |_ Dest Node : " & To_String (Each.Dest_Node));
Put_Line (Output, " |_ Dest Function : "
& To_String (Each.Dest_Function));
Put_Line (Output, " |_ Dest Port : " & To_String (Each.Dest_Port));
end loop;
end Dump_Connections;
......
......@@ -71,10 +71,10 @@ package TASTE.Deployment_View is
type Bus_Connection is tagged
record
Source_Node,
Source_Function,
Source_Port,
Bus_Name,
Dest_Node,
Dest_Function,
Dest_Port : Unbounded_String;
end record;
......
......@@ -110,10 +110,10 @@ package body TASTE.Dump is
Output_Tags : Translate_Set;
Functions : Unbounded_String;
Nodes : Unbounded_String;
Source_Nodes, -- Connections in deployment
Source_Functions, -- Connections in deployment
Source_Ports,
Bus_Names,
Dest_Nodes,
Dest_Functions,
Dest_Ports : Vector_Tag;
function Process_Interfaces (Interfaces : Template_Vectors.Vector)
......@@ -225,11 +225,11 @@ package body TASTE.Dump is
-- Add the deployment connections as vector tag
for C of Model.Deployment_View.Connections loop
Source_Nodes := Source_Nodes & C.Source_Node;
Source_Ports := Source_Ports & C.Source_Port;
Bus_Names := Bus_Names & C.Bus_Name;
Dest_Nodes := Dest_Nodes & C.Dest_Node;
Dest_Ports := Dest_Ports & C.Dest_Port;
Source_Functions := Source_Functions & C.Source_Function;
Source_Ports := Source_Ports & C.Source_Port;
Bus_Names := Bus_Names & C.Bus_Name;
Dest_Functions := Dest_Functions & C.Dest_Function;
Dest_Ports := Dest_Ports & C.Dest_Port;
end loop;
end if;
......@@ -242,10 +242,10 @@ package body TASTE.Dump is
-- Deployment view is made of nodes, connections and busses
DV_Tags := +Assoc ("Nodes", Nodes)
& Assoc ("Source_Nodes", Source_Nodes)
& Assoc ("Source_Functions", Source_Functions)
& Assoc ("Source_Ports", Source_Ports)
& Assoc ("Bus_Names", Bus_Names)
& Assoc ("Dest_Nodes", Dest_Nodes)
& Assoc ("Dest_Functions", Dest_Functions)
& Assoc ("Dest_Ports", Dest_Ports);
-- Output is made of interface, deployment and data views
......
......@@ -16,11 +16,13 @@
@@-- @_Part_Source_Name_@ : Inter-partition connections : partition source name (vector tag)
@@-- @_Part_Source_Port_@ : |_ Corresponding port name
@@-- @_Part_Dest_Name_@ : |_ Corresponding name of the remote partition
@@-- @_Part_Dest_Port_@ : |_ Corresponding name of the port on the remote partition
@@-- @_Bus_Names_@ : Vector tag: busses present in the system
@@-- @_Bus_AADL_Package_@ : |_ corresponding AADL Package
@@-- @_Bus_Classifier_@ : |_ corresponding AADL classifier
@@-- @_Device_Names_@
@@-- @_Device_Node_Name_@
@@-- @_Device_Partition_@ -- Partition name associated to the driver (currently only one supported per node)
@@-- @_Device_AADL_Pkg_@
@@-- @_Device_Classifier_@
@@-- @_Device_CPU_@
......@@ -119,7 +121,7 @@ subcomponents
@@TABLE'ALIGN_ON(":")@@
@_Device_Node_Name_@_@_Device_Names_@ : device @_Device_Classifier_@
{
Source_Text => ("../DriversConfig/PARTITION_NAME/DeviceConfig-@_Device_Node_Name_@-@_Device_Names_@.c");
Source_Text => ("../DriversConfig/@_Device_Partition_@/DeviceConfig-@_Device_Node_Name_@-@_Device_Names_@.c");
Type_Source_Name => "pohidrv_@_Device_Node_Name_@_@_Device_Names_@";
};
@@END_TABLE@@
......@@ -127,11 +129,15 @@ subcomponents
@@IF@@ @_Part_Source_Name'Length_@ > 0
connections
@@TABLE@@
@_Part_Source_Name_@_@_Part_Source_Port_@ : port @_Part_Source_Name_@.OUTPORT_@_Part_Source_Port_@ -> @_Part_Dest_Name_@.INPORT_@_Part_Source_Port_@;
@_Part_Source_Name_@_@_Part_Source_Port_@ : port @_Part_Source_Name_@.OUTPORT_@_Part_Source_Port_@ -> @_Part_Dest_Name_@.INPORT_@_Part_Dest_Port_@;
@@END_TABLE@@
@@END_IF@@
@@-- Then specify the bindings of the partitions to (virtual) processors
@@-- Specify the bus accesses
@@TABLE'ALIGN_ON("->")@@
bus access @_Device_Bus_Name_@ -> @_Device_Node_Name_@_@_Device_Names_@.link;
@@END_TABLE@@
properties
@@-- Specify the bindings of the partitions to (virtual) processors
@@TABLE'ALIGN_ON("applies")@@
@@-- Check if this is a TSP system, in which case bind the partitions to the corresponding virtual processor of the node
@@IF@@ @_Partition_VP_@ = ""
......@@ -141,6 +147,10 @@ properties
Actual_Memory_Binding => (reference (@_CAPITALIZE:Partition_Node_@_Memory.@_CAPITALIZE:Partition_Names_@_Segment)) applies to @_CAPITALIZE:Partition_Names_@;
@@END_IF@@
@@END_TABLE@@
@@-- Specify the bindings of the drivers to processors
@@TABLE'ALIGN_ON("applies")@@
Actual_Processor_Binding => (reference (@_CAPITALIZE:Device_Node_Name_@_@_Device_CPU_@)) applies to @_Device_Node_Name_@_@_Device_Names_@;
@@END_TABLE@@
@@-- TSP: specify the time allocated to each node and on each partition
@@TABLE'ALIGN_ON("applies")@@
@@IF@@ @_Node_Major_Frame_@ /= ""
......
@@-- template for deployment view
@@-- @_Nodes_@
@@-- @_Source_Nodes_@ : connection source node (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Nodes_@ : |_ destination node name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Source_Functions_@ : connection source function (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Functions_@ : |_ destination function name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Busses_@
<DeploymentView>
@_Nodes'Indent_@
@_Busses'Indent_@
@@TABLE@@
<Connection from_node="@_Source_Nodes_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Nodes_@" to_port="@_Dest_Ports_@"/>
<Connection from_node="@_Source_Functions_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Functions_@" to_port="@_Dest_Ports_@"/>
@@END_TABLE@@
</DeploymentView>
@@-- template for deployment view
@@-- @_Nodes_@
@@-- @_Source_Nodes_@ : connection source node (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Nodes_@ : |_ destination node name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Source_Functions_@ : connection source function (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Functions_@ : |_ destination function name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Busses_@
<DeploymentView>
@_Nodes'Indent_@
@_Busses'Indent_@
@@TABLE@@
<Connection from_node="@_Source_Nodes_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Nodes_@" to_port="@_Dest_Ports_@"/>
<Connection from_node="@_Source_Functions_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Functions_@" to_port="@_Dest_Ports_@"/>
@@END_TABLE@@
</DeploymentView>
@@-- template for deployment view
@@-- @_Nodes_@
@@-- @_Source_Nodes_@ : connection source node (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Nodes_@ : |_ destination node name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Source_Functions_@ : connection source function (vector tag)
@@-- @_Source_Ports_@ : |_ corresponding source port
@@-- @_Bus_Names_@ : |_ connected to bus name
@@-- @_Dest_Functions_@ : |_ destination function name
@@-- @_Dest_Ports_@ : |_ destination port name
@@-- @_Busses_@
<DeploymentView>
@_Nodes'Indent_@
@_Busses'Indent_@
@@TABLE@@
<Connection from_node="@_Source_Nodes_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Nodes_@" to_port="@_Dest_Ports_@"/>
<Connection from_node="@_Source_Functions_@" from_port="@_Source_Ports_@" to_bus="@_Bus_Names_@" to_node="@_Dest_Functions_@" to_port="@_Dest_Ports_@"/>
@@END_TABLE@@
</DeploymentView>
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