Commit 65fb3511 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix support of multiple ports for AIR

parent 5b68ef08
......@@ -371,6 +371,7 @@ package body TASTE.AADL_Parser is
Deployment => Model.Deployment_View,
Configuration => Model.Configuration,
others => <>);
use String_Vectors;
begin
-- Initialize the lists of nodes and partitions based on the DV
for Node of Model.Deployment_View.Nodes loop
......@@ -492,8 +493,8 @@ package body TASTE.AADL_Parser is
Set_Calling_Threads (Partition);
-- Define ports at partition (process) level
-- (ports are for all interfaces of a function are not located
-- in the same partition of the system)
-- (ports are for all interfaces of a function not located
-- in the same partition of the system)
for T of Partition.Threads loop
-- Check each Remote PI of the entry port of the thread
for Remote of T.PI.Remote_Interfaces loop
......@@ -516,6 +517,8 @@ package body TASTE.AADL_Parser is
if Part.Has_Value
and then Part.Unsafe_Just.Name
/= Partition.Deployment_Partition.Name
and then not Partition.In_Ports.Contains
(To_String (T.Entry_Port_Name))
then
-- shouldn't we check for presence first in case
-- there are multiple callers?
......@@ -553,15 +556,27 @@ package body TASTE.AADL_Parser is
if Part.Has_Value and then Part.Unsafe_Just.Name
/= Partition.Deployment_Partition.Name
then
-- CHECKME: if the key is already present,
-- this will fail (test-tsp1).
Partition.Out_Ports.Insert
(Key => To_String (Out_Port.RI.Name),
New_Item => (Port_Name => Out_Port.RI.Name,
Thread_Name => T.Name,
Type_Name => Sort,
Remote_Partition_Name
=> Part.Unsafe_Just.Name));
if not Partition.Out_Ports.Contains
(To_String (Out_Port.RI.Name))
then
-- Create a new port and reference the thread
Partition.Out_Ports.Insert
(Key => To_String (Out_Port.RI.Name),
New_Item => (Port_Name =>
Out_Port.RI.Name,
Connected_Threads =>
String_Vectors.Empty_Vector
& To_String (T.Name),
Type_Name => Sort,
Remote_Partition_Name =>
Part.Unsafe_Just.Name));
else
-- Port already exists: just add this thread
Partition.Out_Ports
(To_String
(Out_Port.RI.Name)).Connected_Threads
.Append (To_String (T.Name));
end if;
end if;
else
Put_Error ("This should never happen.");
......
......@@ -229,8 +229,9 @@ package body TASTE.Concurrency_View is
Input_Port_Type_Name,
Input_Port_Thread_Name : Vector_Tag;
Output_Port_Names,
Output_Port_Type_Name,
Output_Port_Thread_Name : Vector_Tag;
Output_Port_Type_Name : Vector_Tag;
Part_Out_Port_Names, -- there can be multiple threads
Connected_Threads : Vector_Tag; -- on one partition outport
-- Optionally generate partition code in separate files
-- (if filepart.tmplt is present and contains a filename)
......@@ -256,8 +257,12 @@ package body TASTE.Concurrency_View is
Output_Port_Names := Output_Port_Names & Each.Port_Name;
Output_Port_Type_Name := Output_Port_Type_Name
& Each.Type_Name;
Output_Port_Thread_Name :=
Output_Port_Thread_Name & Each.Thread_Name;
-- Set the connection between threads and partition outports
for T of Each.Connected_Threads loop
Part_Out_Port_Names := Part_Out_Port_Names
& Each.Port_Name;
Connected_Threads := Connected_Threads & T;
end loop;
end loop;
for T of Partition.Threads loop
......@@ -399,8 +404,9 @@ package body TASTE.Concurrency_View is
& Assoc ("In_Port_Thread_Name", Input_Port_Thread_Name)
& Assoc ("In_Port_Type_Name", Input_Port_Type_Name)
& Assoc ("Out_Port_Names", Output_Port_Names)
& Assoc ("Out_Port_Thread_Name", Output_Port_Thread_Name)
& Assoc ("Out_Port_Type_Name", Output_Port_Type_Name)
& Assoc ("Part_Out_Port_Name", Part_Out_Port_Names)
& Assoc ("Connected_Threads", Connected_Threads)
& Assoc ("Thread_Src_Name", Thread_Src_Name)
& Assoc ("Thread_Src_Port", Thread_Src_Port)
& Assoc ("Thread_Dst_Name", Thread_Dst_Name)
......
......@@ -83,21 +83,34 @@ package TASTE.Concurrency_View is
package AADL_Threads is new Indefinite_Ordered_Maps (String, AADL_Thread);
type Partition_Port is
type Partition_In_Port is
record
Port_Name, Thread_Name, Type_Name : Unbounded_String;
Remote_Partition_Name : Unbounded_String; -- Other side
end record;
package Partition_Ports is
new Indefinite_Ordered_Maps (String, Partition_Port);
package Partition_In_Ports is
new Indefinite_Ordered_Maps (String, Partition_In_Port);
-- Output ports of partitions can be connected to more than one
-- thread output port. A vector of thread is needed to hold the list
type Partition_Out_Port is
record
Port_Name, Type_Name : Unbounded_String;
Connected_Threads : String_Vectors.Vector;
Remote_Partition_Name : Unbounded_String; -- Other side
end record;
package Partition_Out_Ports is
new Indefinite_Ordered_Maps (String, Partition_Out_Port);
type CV_Partition is tagged
record
Deployment_Partition : Taste_Partition;
Threads : AADL_Threads.Map;
Blocks : Protected_Blocks.Map;
In_Ports, Out_Ports : Partition_Ports.Map;
In_Ports : Partition_In_Ports.Map;
Out_Ports : Partition_Out_Ports.Map;
end record;
package CV_Partitions is new Indefinite_Ordered_Maps (String, CV_Partition);
......
......@@ -25,8 +25,9 @@
@@-- @_In_Port_Thread_Name_@ : |_ corresponding thread inside the partition
@@-- @_In_Port_Type_Name_@ : |_ corresponding parameter type name (optional)
@@-- @_Out_Port_Names_@ : Vector tag: output ports of the partition
@@-- @_Out_Port_Thread_Name_@ : |_ corresponding thread inside the partition
@@-- @_Out_Port_Type_Name_@ : |_ corresponding parameter type name (optional)
@@-- @_Part_Out_Port_Name_@ : Vector tag: output ports of the partition (can be several times the same)
@@-- @_Connected_Threads_@ : |_ Corresponding thread connected to it
process @_CAPITALIZE:Name_@ extends DeploymentView::DV::@_CAPITALIZE:Node_Name_@::@_CAPITALIZE:Name_@
@@IF@@ @_In_Port_Names'Length_@ > 0 or @_Out_Port_Names'Length_@ > 0
......@@ -67,7 +68,7 @@ connections
port INPORT_@_In_Port_Names_@ -> @_In_Port_Thread_Name_@.INPORT_@_In_Port_Names_@;
@@END_TABLE@@
@@TABLE@@
port @_Out_Port_Thread_Name_@.OUTPORT_@_Out_Port_Names_@ -> OUTPORT_@_Out_Port_Names_@;
port @_Connected_Threads_@.OUTPORT_@_Part_Out_Port_Name_@ -> OUTPORT_@_Part_Out_Port_Name_@;
@@END_TABLE@@
@@END_IF@@
end @_CAPITALIZE:Name_@.final;
......@@ -103,39 +103,39 @@ dataview/C/built: ${DATAVIEW_UNIQ}
cd dataview/C && msgPrinter ../dataview-uniq.asn
cd dataview/C && msgPrinterASN1 ../dataview-uniq.asn
touch $@
@@TABLE@@
@@IF@@ @_Unique_Languages_@ = "Ada" or @_Unique_Languages_@ = "SDL"
@@SET@@ Enable=FALSE
@@SET@@ Need_Ada=TRUE
@@ELSIF@@ @_Unique_Languages_@ = "C" or @_Unique_Languages_@ = "CPP" or @_Unique_Languages_@ = "Blackbox_C"
@@SET@@ Enable=FALSE
@@-- do nothing, C is always done, only once
@@ELSIF@@ @_Unique_Languages_@ = "GUI"
@@SET@@ Enable=TRUE
@@SET@@ Lang=Python
@@-- for DMT, GUI means Python
dataview/Python/built: ${DATAVIEW_UNIQ}
mkdir -p $(dir $@)
asn2dataModel -o $(dir $@) -toPython ${DATAVIEW_UNIQ} @@-- Ignore context parameters for python interface
$(MAKE) -C dataview/Python -f Makefile.python
@@TABLE@@
@@IF@@ @_Language_@ = GUI
cp dataview/Python/* @_LOWER:Function_Names_@/GUI/wrappers/python
cp dataview/C/* @_LOWER:Function_Names_@/GUI/wrappers/python
cp dataview/C/* @_LOWER:Function_Names_@/GUI/wrappers/python
cd @_LOWER:Function_Names_@/GUI/wrappers/python && \
gcc -g -fPIC -c `python-config --cflags` gui_api.c ../../src/queue_manager.c timeInMS.c debug_messages.c -I. -I../../src && \
gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt
@@END_IF@@
@@END_TABLE@@
touch $@
@@ELSE@@
@@SET@@ Enable=TRUE
@@SET@@ Lang=@_Unique_Languages_@
@@END_IF@@
@@IF@@ @_Enable_@=TRUE
dataview/@_Lang_@/built: ${DATAVIEW_UNIQ}
dataview/@_Unique_Languages_@/built: ${DATAVIEW_UNIQ}
@@INLINE( )(\n )(\n)@@
mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -to@_Lang_@ ${DATAVIEW_UNIQ} \
mkdir -p $(dir $@) && asn2dataModel -o $(dir $@) -to@_Unique_Languages_@ ${DATAVIEW_UNIQ} \
@@INLINE( )( \\\n )(\n )@@
@@TABLE@@
@_REPLACE(,/ ):CP_Files_@
@@END_TABLE@@
@@END_INLINE@@
@@END_INLINE@@
@@IF@@ @_Lang_@ = Python
$(MAKE) -C dataview/Python -f Makefile.python
cp dataview/Python/* @_LOWER:Function_Names_@/GUI/wrappers/python
cp dataview/C/* @_LOWER:Function_Names_@/GUI/wrappers/python
cp dataview/C/* @_LOWER:Function_Names_@/GUI/wrappers/python
cd @_LOWER:Function_Names_@/GUI/wrappers/python && \
gcc -g -fPIC -c `python-config --cflags` gui_api.c ../../src/queue_manager.c timeInMS.c debug_messages.c -I. -I../../src && \
gcc -g -shared -o PythonAccess.so gui_api.o queue_manager.o timeInMS.o debug_messages.o `python-config --ldflags` -lrt
@@END_IF@@
touch $@
@@END_IF@@
@@END_TABLE@@
......
......@@ -225,6 +225,6 @@ PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.0";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("../../../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
Taste::HWLibraries => ("/home/taste/tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
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