Index: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_link.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_link.cpp	(revision 65)
+++ trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal_link.cpp	(revision 78)
@@ -17,4 +17,6 @@
 		     bool     signal_dest_is_port)
   {
+    // signal_dest_is_port == 1 when the signal dest is in a top level interface. (else, signal_dest is type "INTERNAL")
+    
     log_printf(FUNC,Behavioural,FUNCTION,"Begin");
 
@@ -23,9 +25,7 @@
     // Test
     if (signal_src ->_is_allocate == false)
-      throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\", can't map with signal \""+        get_name()+"\", because the first signal is not already allocate."));
+      throw (ERRORMORPHEO (FUNCTION,"Signal \""+_name+"\", can't map with signal \""+        get_name()+"\", because the first signal is not already allocate."));
     if (signal_dest->_is_allocate == false)
-      throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\", can't map with signal \""+signal_dest->get_name()+"\", because the second signal is not already allocate."));
-    if (signal_src ->_is_map_as_src  == true)
-      throw (ErrorMorpheo ("<Signal::mapping> Can't mapping signal \""+_name+"\" with \""+signal_dest->get_name()+"\", because the first signal is already mapped."));
+      throw (ERRORMORPHEO (FUNCTION,"Signal \""+_name+"\", can't map with signal \""+signal_dest->get_name()+"\", because the second signal is not already allocate."));
 
     // List of all case
@@ -43,21 +43,39 @@
 	not (not signal_dest_is_port and (((signal_src->_direction == IN ) and (signal_dest->_direction == INTERNAL)) or
 					  ((signal_src->_direction == OUT) and (signal_dest->_direction == INTERNAL)))))
-      throw (ErrorMorpheo ("<Signal::link> Signal \""+_name+"\" can't been linked with signal \""+signal_dest->get_name()+"\" : illegal direction ("+toString(signal_src->_direction)+" with "+toString(signal_dest->_direction)+")."));
+      throw (ERRORMORPHEO (FUNCTION,"Signal \""+_name+"\" can't been linked with signal \""+signal_dest->get_name()+"\" : illegal direction ("+toString(signal_src->_direction)+" with "+toString(signal_dest->_direction)+")."));
+
+
+    // Multi consumer is authorized , no to multi producer!
+    bool source_have_multi_consumer      = (signal_src ->_connect_to_signal != NULL);
+//     bool destination_have_multi_producer = (signal_dest->_connect_from_signal != NULL) and (signal_dest_is_port == false);
+//     if (destination_have_multi_producer)
+// //       throw (ERRORMORPHEO (FUNCTION,"Signal \""+_name+"\" can't been linked with signal \""+signal_dest->get_name()+"\" : destination have multi producer."));
+//       log_printf(NONE,Behavioural,FUNCTION,"Signal \"%s\" can't been linked with signal \"%s\" : destination have multi producer.",_name.c_str(),signal_dest->get_name().c_str());
 
     // update info source
-    signal_src ->_connect_to_signal   = signal_dest;
-    signal_src ->_is_map_as_src       = true;
+    signal_src ->_connect_to_signal       = signal_dest;
+    signal_src ->_is_map_as_component_src = true;
+
+    // update info destination
+    if (signal_dest_is_port == true)
+      signal_dest->_is_map_as_toplevel_dest = true; // because toplevel port can't be a source
+    else
+      // signal_dest is a internal signal
+      if (signal_src->_direction == OUT)
+	signal_dest->_is_map_as_component_dest = true;
+      else
+	signal_dest->_is_map_as_component_src  = true;
     
-    // update info destination
-    signal_dest->_connect_from_signal = signal_src;
-    signal_dest->_is_map_as_dest      = true;
-
     // an internal signal and port can't be a source. 
     // also, to fill the connect_to_signal's field 
-    if ((signal_src->_direction == OUT) and 
-	(signal_dest->_direction == INTERNAL))
-      {
-	signal_dest->_connect_to_signal = signal_src;
-      }
+    if (signal_dest->_direction == INTERNAL)
+      if (signal_src->_direction == OUT)
+	signal_dest->_connect_from_signal = signal_src;
+      else
+	signal_dest->_connect_to_signal   = signal_src;
+    else
+      signal_dest->_connect_from_signal   = signal_src;
+    
+
 
     // vhdl_testbench : to read an output producte by a internal component
@@ -66,6 +84,8 @@
 	(signal_src ->_direction == OUT))
       signal_dest->_sc_signal_map = signal_src ->_sc_signal_map;
-    
-    connect (signal_dest);
+
+    // A signal can be connect once
+    if (not source_have_multi_consumer)
+      connect (signal_dest);
 
     log_printf(FUNC,Behavioural,FUNCTION,"End");
