diff --git a/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/include/gpio2vci.h b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/include/gpio2vci.h
index 9574c43c8ea6c7fccf690a95580cdfe7327ee4ed..85d47f663db388b5d331d50b2fa416af4511e002 100644
--- a/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/include/gpio2vci.h
+++ b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/include/gpio2vci.h
@@ -6,15 +6,10 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <systemc.h>
-//#include <communication/vci/caba/source/include/vci_target.h>
-//#include <lib/base_module/include/base_module.h>
-//#include <lib/mapping_table/include/mapping_table.h>
 #include "caba_base_module.h"
 #include "vci_target.h"
 #include "mapping_table.h"
 
-//#include "vci_param.h"
-
 namespace soclib {
 namespace caba {
 
@@ -38,15 +33,15 @@ protected:
 
 public:
     //Ports
-    sc_in<bool> p_clk;
-    sc_in<bool> p_resetn;
-    soclib::caba::VciTarget<vci_param>  p_vci;
-    sc_in< typename vci_param::data_t > p_rdata_ams;
-    sc_out< typename vci_param::data_t > p_wdata_ams;
+    sc_in<bool>                             p_clk;
+    sc_in<bool>                             p_resetn;
+    soclib::caba::VciTarget<vci_param>      p_vci;
+    sc_in< typename vci_param::data_t >     p_rdata_ams;
+    sc_out< typename vci_param::data_t >    p_wdata_ams;
     
     Gpio2Vci( sc_module_name                insname,
-        const soclib::common::IntTab       &index,
-        const soclib::common::MappingTable &mt );
+        const soclib::common::IntTab        &index,
+        const soclib::common::MappingTable  &mt );
 
     ~Gpio2Vci();
 
diff --git a/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp
index abd4b19fa9117f66d1260c67105c1595fc986986..0cb459ac98064943d9e6535444afc067869226f4 100644
--- a/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp
+++ b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp
@@ -35,14 +35,11 @@ tmpl(void)::transition() {
         case TARGET_IDLE:
             if( p_vci.cmdval.read() ) {
                 r_buf_eop = p_vci.eop.read();
-                if ( p_vci.cmd.read() == vci_param::CMD_WRITE ) { //CMD_WRITE ) {
+                if ( p_vci.cmd.read() == vci_param::CMD_WRITE ) {
                     r_wdata_ams = p_vci.wdata.read();
-                    printf("IDLE CMD_WRITE: %d\n", (int)p_vci.wdata.read());
                     r_fsm_state = TARGET_WRITE;
                 }
                 else {  //VCI_CMD_READ
-                    cout << "@" << sc_time_stamp() << ": ";
-                    printf("Gpio2Vci_IDLE p_rdata_ams=%d\n",(int)p_rdata_ams.read());
                     r_rdata_ams = p_rdata_ams.read();
                     r_fsm_state = TARGET_READ;
                 }
@@ -52,7 +49,6 @@ tmpl(void)::transition() {
         case TARGET_WRITE:
         case TARGET_READ:
             if( p_vci.rspack.read() ) {
-                printf("READ-WRITE rspack \n");
                 r_fsm_state = TARGET_IDLE;
             }
             break;
diff --git a/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp-orig b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp-orig
new file mode 100644
index 0000000000000000000000000000000000000000..abd4b19fa9117f66d1260c67105c1595fc986986
--- /dev/null
+++ b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp-orig
@@ -0,0 +1,82 @@
+#include "../include/gpio2vci.h"
+#include <iostream>
+
+namespace soclib {
+namespace caba {
+  
+#define tmpl(x) template<typename vci_param> x Gpio2Vci<vci_param>
+
+tmpl(/**/)::Gpio2Vci( sc_module_name                     insname,
+                     const soclib::common::IntTab       &index,
+                     const soclib::common::MappingTable &mt )
+        : soclib::caba::BaseModule(insname),
+          m_segment(mt.getSegment(index)),
+          p_clk("p_clk"), 
+          p_resetn("p_resetn"),
+          p_vci("p_vci"),
+          p_rdata_ams("p_rdata_ams"),
+          p_wdata_ams("p_wdata_ams") {
+    std::cout << "  - Building Gpio2Vci " << insname << std::endl;      
+    
+    SC_METHOD(transition);
+    sensitive << p_clk.pos();
+    SC_METHOD (genMoore);
+    sensitive << p_clk.neg();
+}
+
+tmpl(/**/)::~Gpio2Vci(){}
+
+tmpl(void)::transition() {
+    if(p_resetn == false) {
+        r_fsm_state = TARGET_IDLE;
+    }
+    else {
+        switch( r_fsm_state ) {
+        case TARGET_IDLE:
+            if( p_vci.cmdval.read() ) {
+                r_buf_eop = p_vci.eop.read();
+                if ( p_vci.cmd.read() == vci_param::CMD_WRITE ) { //CMD_WRITE ) {
+                    r_wdata_ams = p_vci.wdata.read();
+                    printf("IDLE CMD_WRITE: %d\n", (int)p_vci.wdata.read());
+                    r_fsm_state = TARGET_WRITE;
+                }
+                else {  //VCI_CMD_READ
+                    cout << "@" << sc_time_stamp() << ": ";
+                    printf("Gpio2Vci_IDLE p_rdata_ams=%d\n",(int)p_rdata_ams.read());
+                    r_rdata_ams = p_rdata_ams.read();
+                    r_fsm_state = TARGET_READ;
+                }
+            }
+            break;
+
+        case TARGET_WRITE:
+        case TARGET_READ:
+            if( p_vci.rspack.read() ) {
+                printf("READ-WRITE rspack \n");
+                r_fsm_state = TARGET_IDLE;
+            }
+            break;
+        }
+    }
+      
+}
+
+tmpl(void)::genMoore() {
+    switch (r_fsm_state) {
+    case TARGET_IDLE:
+        p_vci.rspNop();
+        break;
+    case TARGET_WRITE:
+        p_vci.rspWrite( r_buf_eop.read() );
+        p_wdata_ams.write(r_wdata_ams);
+        break;
+    case TARGET_READ:
+        p_vci.rspRead( r_buf_eop.read(), r_rdata_ams );
+        break;
+    }   
+    // We only accept commands in Idle state
+    p_vci.cmdack = (r_fsm_state == TARGET_IDLE);
+}
+
+}
+}
diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java-orig b/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java-orig
deleted file mode 100755
index a1f9e53b28157ad9da3c2ad305448c0bd4d3adad..0000000000000000000000000000000000000000
--- a/src/main/java/ddtranslatorSoclib/toTopCell/NetList.java-orig
+++ /dev/null
@@ -1,1118 +0,0 @@
-/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
- * Daniela Genius, Lip6, UMR 7606 
- * 
- * ludovic.apvrille AT enst.fr
- * daniela.genius@lip6.fr
- * 
- * This software is a computer program whose purpose is to allow the
- * edition of TURTLE analysis, design and deployment diagrams, to
- * allow the generation of RT-LOTOS or Java code from this diagram,
- * and at last to allow the analysis of formal validation traces
- * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
- * from INRIA Rhone-Alpes.
- * 
- * This software is governed by the CeCILL  license under French law and
- * abiding by the rules of distribution of free software.  You can  use,
- * modify and/ or redistribute the software under the terms of the CeCILL
- * license as circulated by CEA, CNRS and INRIA at the following URL
- * "http://www.cecill.info".
- * 
- * As a counterpart to the access to the source code and  rights to copy,
- * modify and redistribute granted by the license, users are provided only
- * with a limited warranty  and the software's author,  the holder of the
- * economic rights,  and the successive licensors  have only  limited
- * liability.
- * 
- * In this respect, the user's attention is drawn to the risks associated
- * with loading,  using,  modifying and/or developing or reproducing the
- * software by the user in light of its specific status of free software,
- * that may mean  that it is complicated to manipulate,  and  that  also
- * therefore means  that it is reserved for developers  and  experienced
- * professionals having in-depth computer knowledge. Users are therefore
- * encouraged to load and test the software's suitability as regards their
- * requirements in conditions enabling the security of their systems and/or
- * data to be ensured and,  more generally, to use and operate it in the
- * same conditions as regards security.
- * 
- * The fact that you are presently reading this means that you have had
- * knowledge of the CeCILL license and that you accept its terms.
- */
-
-
-/* authors: v1.0 Raja GATGOUT 2014
-   v2.0 Daniela GENIUS, Julien HENON 2015 */
-
-package ddtranslatorSoclib.toTopCell;
-
-import avatartranslator.AvatarRelation;
-import avatartranslator.AvatarSpecification;
-import ddtranslatorSoclib.*;
-import ddtranslatorSoclib.AvatarCPU;
-import ddtranslatorSoclib.AvatarCoproMWMR;
-import ddtranslatorSoclib.AvatarRAM;
-import ddtranslatorSoclib.AvatarTTY;
-import ddtranslatorSoclib.AvatarAmsCluster;
-import ddtranslatorSoclib.AvatarCrossbar;
-
-
-public class NetList
-{
-    public static AvatarddSpecification avatardd;
-    public static final String NAME_CLK = "signal_clk";
-    public static final String CR = "\n";
-    public static final String CR2 = "\n\n";
-    private static final String NAME_RST = "signal_resetn";
-    private static boolean tracing;
- 
-    public static String getNetlist (AvatarddSpecification dd,String icn, boolean _tracing)
-    {
-	int nb_clusters = TopCellGenerator.avatardd.getAllCrossbar().size ();
-	int coproc_count = 0;
-	avatardd = dd;
-	tracing = _tracing;
-
-	String netlist;
-
-	netlist =
-	    CR2 +
-	    "//------------------------------Netlist---------------------------------"
-	    + CR2;
-
-	netlist = netlist + "// icu" + CR2;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"interrupt-parent\", vcifdtrom.get_device_phandle(\"vci_xicu\"));"
-	    + CR2;
-
-	netlist = netlist + "  vcixicu.p_clk(signal_clk);" + CR;
-	netlist = netlist + "  vcixicu.p_resetn(signal_resetn);" + CR2;
-	netlist = netlist + "  vcixicu.p_vci(signal_vci_xicu);" + CR2;
-
-	netlist =
-	    netlist +
-	    "  vcifdtrom.begin_device_node(\"vci_rttimer\", \"soclib:vci_rttimer\");"
-	    + CR;
-
-	netlist =
-	    netlist + "  vcifdtrom.add_property(\"interrupts\", 4);" + CR;
-	netlist =
-	    netlist + "  vcifdtrom.add_property(\"frequency\", 1000000);" +
-	    CR;
-	netlist = netlist + "  vcifdtrom.end_node();" + CR2;
-
-	netlist =
-	    netlist +
-	    "  vcifdtrom.begin_device_node(\"vci_xicu\", \"soclib:vci_xicu\");"
-	    + CR2;
-	netlist = netlist + "  int irq_map[cpus.size() * 3];" + CR;
-	netlist =
-	    netlist + "  for ( size_t i = 0; i < cpus.size(); ++i )" + CR;
-	netlist = netlist + "    {" + CR;
-	netlist = netlist + "      irq_map[i*3 + 0] = i;" + CR;
-	netlist =
-	    netlist +
-	    "      irq_map[i*3 + 1] = vcifdtrom.get_cpu_phandle(i);" + CR;
-	netlist = netlist + "      irq_map[i*3 + 2] = 0;" + CR;
-	netlist = netlist + "    }" + CR2;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"interrupt-map\", irq_map, cpus.size() * 3);"
-	    + CR;
-	netlist =
-	    netlist + "  vcifdtrom.add_property(\"frequency\", 1000000);" +
-	    CR2;
-
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"param-int-pti-count\", 1);" + CR;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"param-int-hwi-count\", xicu_n_irq);" +
-	    CR;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"param-int-wti-count\", cpus.size());"
-	    + CR;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"param-int-irq-count\", cpus.size());"
-	    + CR;
-	netlist = netlist + "  vcifdtrom.end_node();" + CR2;
-
-	netlist =
-	    netlist + "  for ( size_t i = 0; i < xicu_n_irq; ++i )" + CR;
-	netlist =
-	    netlist + "    vcixicu.p_hwi[i](signal_xicu_irq[i]);" + CR2;
-
-	netlist = netlist + "///////////////// cpus" + CR2;
-
-	netlist = netlist + "vcifdtrom.begin_cpus();" + CR2;
-	netlist =
-	    netlist + "for ( size_t i = 0; i < cpus.size(); ++i ){" + CR;
-	netlist = netlist + "   // configure het_rom" + CR;
-
-	int i=0;
-	if(nb_clusters==0){
-	    netlist =
-		netlist +
-		"  vcihetrom.add_srcid(*cpus[i]->text_ldr, IntTab(i));" + CR;
-	 
-	    netlist = netlist + "  // add cpu node to device tree" + CR;
-	    netlist =
-		netlist +
-		"  vcifdtrom.begin_cpu_node(std::string(\"cpu:\") + cpus[i]->type, i);"
-		+ CR;
-	    netlist =
-		netlist + "  vcifdtrom.add_property(\"freq\", 1000000);" + CR;
-	    netlist = netlist + "  vcifdtrom.end_node();" + CR2;
-            netlist = netlist + "cpus[i]->connect(cpus[i], signal_clk, signal_resetn, signal_vci_m[i]);" + CR2;
-	    netlist = netlist + "// connect cpu" + CR;
-	    //   netlist =netlist + " }"+ CR;
-	  
-	}  
-	else{
-	    for (AvatarCrossbar crossbar:TopCellGenerator.avatardd.getAllCrossbar ()){
-	    
-		netlist =netlist + "for ( size_t j = 0; j < " +TopCellGenerator.cpus_in_cluster(avatardd,i)+"; ++j ){" + CR;
-		netlist =  netlist +
-		    "  vcihetrom.add_srcid(*cpus[i]->text_ldr, IntTab("+crossbar.getClusterIndex() +",j));" + CR;
-		netlist = netlist + "  // add cpu node to device tree" + CR;
-		 
-		netlist = netlist +
-		    "  vcifdtrom.begin_cpu_node(std::string(\"cpu:\") + cpus[i]->type, i);"
-		    + CR;
-		netlist =
-		    netlist + "  vcifdtrom.add_property(\"freq\", 1000000);" + CR;
-		netlist = netlist + "  vcifdtrom.end_node();" + CR2;
-
-		netlist = netlist + "// connect cpu" + CR;
-		 
-		netlist =netlist + " }"+ CR;
-
-		netlist =netlist + "crossbar"+crossbar.getClusterIndex()+".p_initiator_to_up(signal_down"+crossbar.getClusterIndex()+");"+ CR;
-		netlist =netlist + "crossbar"+crossbar.getClusterIndex()+".p_target_to_up(signal_up"+crossbar.getClusterIndex()+");"+ CR;
-		if (icn == "vgmn"){
-		    netlist =netlist + "vgmn.p_to_initiator["+0+"](signal_down"+crossbar.getClusterIndex()+");"+ CR;
-		    netlist =netlist + "vgmn.p_to_target["+0+"](signal_up"+crossbar.getClusterIndex()+");"+ CR;
-		}
-		else{
-		    netlist =netlist + "vgsb.p_to_initiator["+0+"](signal_down"+crossbar.getClusterIndex()+");"+ CR;
-		    netlist =netlist + "vgsb.p_to_target["+0+"](signal_up"+crossbar.getClusterIndex()+");"+ CR;		    
-		}		 	  	      
-		netlist =netlist + "for ( size_t j = 0; j < " +  TopCellGenerator.cpus_in_cluster(avatardd,i)  +"; ++j ){" + CR;
-		netlist =
-		    netlist +
-		    "  cpus[i]->connect(cpus[i], signal_clk, signal_resetn, signal_vci_m"+crossbar.getClusterIndex()+"[j]);"+ CR;
-		netlist =
-		    netlist +"}" + CR;
-		netlist = netlist + "// connected cluster" +crossbar.getClusterIndex()+"."+CR2;
-		i++;
-	    }
-	}
-	  
-	if(nb_clusters==0){
-	    if (icn == "vgmn")
-		{
-		    netlist =
-			netlist + "vgmn.p_to_initiator[i](signal_vci_m[i]);" + CR;
-		}
-	    else
-		{
-		    netlist =
-			netlist + "vgsb.p_to_initiator[i](signal_vci_m[i]);" + CR;
-		}
-	}
-	else{
-	    int j;
-	    for (AvatarCrossbar crossbar:TopCellGenerator.avatardd.getAllCrossbar ()){
-		i=0;		   	      		      
-		for (j=0;j< TopCellGenerator.cpus_in_cluster(avatardd,i) ;j++){
-		    netlist =
-			netlist = netlist + "for ( size_t j = 0; j < " +  TopCellGenerator.cpus_in_cluster(avatardd,i)  +"; ++j ){" + CR;
-		    netlist = netlist + "crossbar"+crossbar.getClusterIndex()+".p_to_initiator[i](signal_vci_m"+crossbar.getClusterIndex()+"[j]);" + CR;
-		    netlist = netlist + "}"+CR;
-		    i++;
-		}  
-	    }
-	}
-
-	
-	netlist = netlist + "vcixicu.p_irq[i](cpus[i]->irq_sig[0]);" + CR;
-	netlist = netlist + " }" + CR;
-	netlist = netlist + " vcifdtrom.end_node();" + CR2;
-
-	netlist = netlist + "  vcihetrom.p_clk(signal_clk);" + CR;
-	netlist = netlist + "  vcifdtrom.p_clk(signal_clk);" + CR;
-	netlist = netlist + "  vcirom.p_clk(signal_clk);" + CR;
-	netlist = netlist + "  vcisimhelper.p_clk(signal_clk);" + CR;
-	netlist = netlist + "  vcirttimer.p_clk(signal_clk);" + CR;
-
-	netlist = netlist + "  vcihetrom.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "  vcifdtrom.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "  vcirom.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "  vcisimhelper.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "  vcirttimer.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "  vcihetrom.p_vci(signal_vci_vcihetrom);" + CR;
-
-	netlist = netlist + "  vcifdtrom.p_vci(signal_vci_vcifdtrom);" + CR;
-	netlist = netlist + "  vcirom.p_vci(signal_vci_vcirom);" + CR;
-	netlist =
-	    netlist + "  vcisimhelper.p_vci(signal_vci_vcisimhelper);" + CR;
-	netlist = netlist + "  vcirttimer.p_vci(signal_vci_vcirttimer);" + CR;
-	netlist =
-	    netlist + "  vcirttimer.p_irq[0](signal_xicu_irq[4]);" + CR2;
-	
-	if(nb_clusters==0){
-	    if (icn == "vgmn")
-		{
-		    netlist = netlist + " vgmn.p_clk(signal_clk);" + CR;
-		    netlist = netlist + "  vgmn.p_resetn(signal_resetn);" + CR;
-		    netlist =
-			netlist + "  vgmn.p_to_target[0](signal_vci_vcihetrom);" +
-			CR;
-		    netlist =
-			netlist + "  vgmn.p_to_target[1](signal_vci_vcirom);" + CR;
-		    netlist =
-			netlist +
-			"  vgmn.p_to_target[3](signal_vci_vcisimhelper);" + CR2;
-		    
-		    netlist =
-			netlist + "  vgmn.p_to_target[4](signal_vci_vcirttimer);" + CR2;
-		    netlist =
-			netlist + "  vgmn.p_to_target[5](signal_vci_xicu);" + CR;
-		    netlist =
-			netlist + "  vgmn.p_to_target[6](signal_vci_dma);" + CR;
-		    netlist =
-			netlist + "  vgmn.p_to_target[7](signal_vci_vcifdtrom);" +
-			CR2;
-		    netlist =
-			netlist +
-			"  vgmn.p_to_initiator[cpus.size()](signal_vci_bdi);" + CR;
-		    netlist =
-			netlist +
-			"  vgmn.p_to_initiator[cpus.size()+1](signal_vci_vcifdaccessi);"
-			+ CR;
-		    netlist =
-			netlist +
-			"  vgmn.p_to_initiator[cpus.size()+2](signal_vci_etherneti);"
-			+ CR2;
-		    netlist =
-			netlist +
-			"  vgmn.p_to_initiator[cpus.size()+3](signal_vci_dmai);"
-			+ CR2;
-		}
-	    else
-		{
-		    netlist = netlist + " vgsb.p_clk(signal_clk);" + CR;
-		    netlist = netlist + "  vgsb.p_resetn(signal_resetn);" + CR;
-		    netlist =
-			netlist + "  vgsb.p_to_target[0](signal_vci_vcihetrom);" +
-			CR;
-		    netlist =
-			netlist + "  vgsb.p_to_target[1](signal_vci_vcirom);" + CR;
-		    netlist =
-			netlist +
-			"  vgsb.p_to_target[3](signal_vci_vcisimhelper);" + CR2;
-		    netlist =
-			netlist + "  vgsb.p_to_target[4](signal_vci_xicu);" + CR;
-		    netlist =
-			netlist + "  vgsb.p_to_target[5](signal_vci_vcirttimer);" +
-			CR2;
-		    netlist =
-			netlist + "  vgsb.p_to_target[6](signal_vci_vcifdtrom);" +
-			CR2;
-		    netlist =
-			netlist +
-			"  vgsb.p_to_initiator[cpus.size()](signal_vci_bdi);" + CR;
-		    netlist =
-			netlist +
-			"  vgsb.p_to_initiator[cpus.size()+1](signal_vci_vcifdaccessi);"
-			+ CR;
-		    netlist =
-			netlist +
-			"  vgsb.p_to_initiator[cpus.size()+2](signal_vci_etherneti);"
-			+ CR2;
-		}
-	}
-	else{//clustered
-	    if (icn == "vgmn")
-		{
-		    netlist = netlist + " vgmn.p_clk(signal_clk);" + CR;
-		    netlist = netlist + "  vgmn.p_resetn(signal_resetn);" + CR;
-		}
-	    else{
-		netlist = netlist + " vgmn.p_clk(signal_clk);" + CR;
-		netlist = netlist + "  vgmn.p_resetn(signal_resetn);" + CR;	
-	    }
-	    //in any case for clustered, initiators and targets are attached to crossbar
-
-	    if (nb_clusters == 0){
-		netlist = netlist + " crossbar.p_clk(signal_clk);" + CR;
-		netlist = netlist + "  crossbar.p_resetn(signal_resetn);" + CR;
-	    }
-	    else{
-		for (  i = 0; i < nb_clusters; ++i ){
-		    netlist = netlist + " crossbar"+i+".p_clk(signal_clk);" + CR;
-		    netlist = netlist + "  crossbar"+i+".p_resetn(signal_resetn);" + CR;
-		}
-	    }
-	}
-	for (AvatarCrossbar crossbar:TopCellGenerator.avatardd.getAllCrossbar ()){
-	    i=0;
-	    netlist = netlist + "crossbar"+crossbar.getClusterIndex()+".p_to_initiator["+crossbar.getClusterIndex()+"](signal_vci_m"+crossbar.getClusterIndex()+"["+ TopCellGenerator.cpus_in_cluster(avatardd,i) +"]);" + CR;			
-	}
-	       
- 
-	if (nb_clusters == 0){
-	    netlist = netlist + "// RAM netlist" + CR2;
-	    for (AvatarRAM ram:TopCellGenerator.avatardd.
-		     getAllRAM ())
-		{
-
-		    netlist =
-			netlist + ram.getMemoryName () + ".p_clk(" +
-			NAME_CLK + ");" + CR;
-		    netlist =
-			netlist + ram.getMemoryName () + ".p_resetn(" +
-			NAME_RST + ");" + CR;
-		    netlist =
-			netlist + ram.getMemoryName () +
-			".p_vci(signal_vci_vciram" + ram.getIndex () + ");" +
-			CR2;
-		    if (icn == "vgmn")
-			{
-			    netlist =
-				netlist + "vgmn.p_to_target[" +
-				(ram.getNo_target ()) + "](signal_vci_vciram" +
-				ram.getIndex () + ");" + CR2;
-			}
-		    else
-			{
-			    netlist =
-				netlist + "vgsb.p_to_target[" +
-				(ram.getNo_target ()) + "](signal_vci_vciram" +
-				ram.getIndex () + ");" + CR2;
-			}
-		}
-	}
-
-	/* clustered version */
-	/* one or several ram, one locks engine, one mwmr ram and one mwmrd ram per cluster */
-	else
-	    {	     
-		netlist = netlist + "// RAM netlist" + CR2;
-		for (AvatarRAM ram:TopCellGenerator.avatardd.
-			 getAllRAM ())
-		    {
-
-			netlist =
-			    netlist + ram.getMemoryName () + ".p_clk(" +
-			    NAME_CLK + ");" + CR;
-			netlist =
-			    netlist + ram.getMemoryName () + ".p_resetn(" +
-			    NAME_RST + ");" + CR;
-			netlist =
-			    netlist + ram.getMemoryName () +
-			    ".p_vci(signal_vci_vciram" + TopCellGenerator.getCrossbarIndex (ram) +"_"+ram.getIndex () + ");" +
-			    CR2;
-			//target number for local cluster: this is set at avatardd creation                         
-			netlist =
-			    netlist + "crossbar" + TopCellGenerator.getCrossbarIndex (ram) +
-			    ".p_to_target[" + ram.getNo_target () +
-			    "](signal_vci_vciram"+TopCellGenerator.getCrossbarIndex(ram)+"_"+ ram.getIndex () + ");" + CR2;
-		    }
-
-	
-	    }
-
-	if (nb_clusters == 0)
-	    {
-
-		int l = 8;	//number of last tty 
-		if (icn == "vgmn")
-		    {
-			netlist =
-			    netlist + "vgmn.p_to_target[" + (l) +
-			    "](signal_vci_vcifdaccesst);" + CR;
-			netlist =
-			    netlist + "vgmn.p_to_target[" + (l + 1) +
-			    "](signal_vci_ethernett);" + CR;
-			netlist =
-			    netlist + "vgmn.p_to_target[" + (l + 2) +
-			    "](signal_vci_bdt);" + CR;		
-
-			for (i = 0; i < coproc_count; i++)
-			    {
-
-				netlist =
-				    netlist + "vgmn.p_to_target[" + (l + 4 + i) +
-				    "](signal_mwmr_" + i + "_target);" + CR;
-			    }
-		    }
-		else
-		    {		//vgsb 
-			netlist =
-			    netlist + "vgsb.p_to_target[" + (l) +
-			    "](signal_vci_vcifdaccesst);" + CR;
-			netlist =
-			    netlist + "vgsb.p_to_target[" + (l + 1) +
-			    "](signal_vci_ethernett);" + CR;
-			netlist =
-			    netlist + "vgsb.p_to_target[" + (l + 2) +
-			    "](signal_vci_bdt);" + CR;
-		  
-			for (i = 0; i < coproc_count; i++)
-			    {
-				netlist =
-				    netlist + "vgmn.p_to_target[" + (l + 4 + i) +
-				    "](signal_mwmr_" + i + "_target);" + CR;
-			    }
-		    }
-
-	    }
-	else
-	    {
-		/* cluster */
-		if (icn == "vgmn")
-		    {
-			netlist =
-			    netlist + "vgmn.p_to_target[" + 5 +
-			    "](signal_vci_vcifdaccesst);" + CR;
-			netlist =
-			    netlist + "vgmn.p_to_target[" + 6 +
-			    "](signal_vci_ethernett);" + CR;
-			netlist =
-			    netlist + "vgmn.p_to_target[" + 7 +
-			    "](signal_vci_bdt);" + CR;
-		    }
-		else
-		    {
-			netlist =
-			    netlist + "vgsb.p_to_target[" + 5 +
-			    "](signal_vci_vcifdaccesst);" + CR;
-			netlist =
-			    netlist + "vgsb.p_to_target[" + 6 +
-			    "](signal_vci_ethernett);" + CR;
-			netlist =
-			    netlist + "vgsb.p_to_target[" + 7 +
-			    "](signal_vci_bdt);" + CR;
-		    }
-	    }
-
-	netlist =
-	    netlist + "vcifdtrom.add_property(\"interrupts\", 0);" + CR2;
-	netlist = netlist + "vcifdtrom.end_node();;" + CR2;
-
-	netlist = netlist + "// TTY netlist" + CR2;
-	i=0;
-	int no_irq_tty = 0; //first TTY has interrupt number 0
-	for (AvatarTTY tty:TopCellGenerator.avatardd.getAllTTY ())
-	    {
-		if (no_irq_tty == 1){no_irq_tty+=5;}//all other TTYs have higher interrupt numbers; provisional; will later have to count DMAs if several; take into account clusters with one DMA each
-		if (nb_clusters == 0)
-		    {	netlist =
-			    netlist + tty.getTTYName () + ".p_clk(signal_clk);" + CR;
-			netlist =
-			    netlist + tty.getTTYName () + ".p_resetn(signal_resetn);" +
-			    CR;
-			netlist =
-			    netlist + tty.getTTYName () + ".p_vci(signal_vci_tty"+tty.getIndex() +
-			    ");" + CR2;}
-		else{
-		    netlist =
-			netlist + tty.getTTYName () + ".p_clk(signal_clk);" + CR;
-		    netlist =
-			netlist + tty.getTTYName () + ".p_resetn(signal_resetn);" +
-			CR;
-		    netlist =
-			netlist + tty.getTTYName () + ".p_vci(signal_vci_tty" + TopCellGenerator.getCrossbarIndex(tty) +"_"+tty.getIndex() +
-			");" + CR2;
-		}
-		if (nb_clusters == 0)
-		    {
-
-			if (icn == "vgmn")
-			    {
-				netlist =
-				    netlist +
-				    "vcifdtrom.begin_device_node(\"vci_multi_tty" +
-				    i + "\",\"soclib:vci_multi_tty"  + tty.getIndex() + "\");" +
-				    CR2;
-				netlist =
-				    netlist + "vgmn.p_to_target[" +
-				    tty.getNo_target () + "](signal_vci_tty" + tty.getIndex() +
-				    ");" + CR2;
-				netlist =
-				    netlist + tty.getTTYName () +
-				    ".p_irq[0](signal_xicu_irq[" + no_irq_tty +
-				    "]);" + CR2;
-			    }
-			else
-			    {
-				netlist =
-				    netlist +
-				    "vcifdtrom.begin_device_node(\"vci_multi_tty" +
-				    i + "\",\"soclib:vci_multi_tty" +tty.getIndex ()+"_"+
-				    TopCellGenerator.getCrossbarIndex(tty) + "\");" + CR2;
-				netlist =
-				    netlist + "vgsb.p_to_target[" +
-				    tty.getNo_target () + "](signal_vci_tty" +tty.getIndex ()+"_"+
-				    TopCellGenerator.getCrossbarIndex(tty)  +  
-				    ");" + CR2;
-				netlist =
-				    netlist + tty.getTTYName () +
-				    ".p_irq[0](signal_xicu_irq[" + no_irq_tty +
-				    "]);" + CR2;
-			    }
-		    }
-
-		//we have a clustered architecture: identify local crossbar 
-		else
-		    {
-			int j;
-			for (j = 0; j < nb_clusters; j++)
-			    {
-				netlist =
-				    netlist + "crossbar" + TopCellGenerator.getCrossbarIndex(tty) +  ".p_to_target["+tty.getNo_target ()
-				    + "](signal_vci_tty" + TopCellGenerator.getCrossbarIndex(tty)  +"_"+tty.getIndex()+
-				    ");" + CR2;
-				//recalculate irq addresses, 5 devices generating irq per cluster
-				//there are still strong assumptions that have to be corrected
-				netlist =
-				    netlist + tty.getTTYName () +
-				    ".p_irq[0](signal_xicu_irq[" +
-				    (TopCellGenerator.getCrossbarIndex (tty) * 5) + "]);" + CR2;
-			    }
-		    }
-		i++;
-		//One ICU per cluster per default
-		no_irq_tty ++;	//if there is more than one tty, irq >5
-	    }
-
-	//////////////// DMA access
-
-	netlist = netlist + "vcidma.p_clk(signal_clk);" + CR;
-	netlist = netlist + "vcidma.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "vcidma.p_vci_target(signal_vci_dma);" + CR;
-        netlist = netlist + "vcidma.p_vci_initiator(signal_vci_dmai);" + CR;
-	netlist = netlist + "vcidma.p_irq(signal_xicu_irq[5]);" + CR;
-	//	netlist = netlist + "vgmn.p_to_initiator[cpus.size()+3](signal_vci_dmai);;" + CR;
-	//////////////// fdrom
-
-	netlist = netlist + "{" + CR2;
-	netlist = netlist + "  vcifdtrom.begin_node(\"aliases\");" + CR;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"timer\", vcifdtrom.get_device_name(\"vci_rttimer\") + \"[0]\");"
-	    + CR;
-	netlist =
-	    netlist +
-	    "  vcifdtrom.add_property(\"console\", vcifdtrom.get_device_name(\"vci_multi_tty0\") + \"[0]\");"
-	    + CR;
-	netlist = netlist + "  vcifdtrom.end_node();" + CR;
-	netlist = netlist + "}" + CR2;
-
-	//////////////// ethernet
-
-	netlist = netlist + "vcieth.p_clk(signal_clk);" + CR;
-	netlist = netlist + "vcieth.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "vcieth.p_irq(signal_xicu_irq[3]);" + CR;
-	netlist = netlist + "vcieth.p_vci_target(signal_vci_ethernett);" + CR;
-	netlist =
-	    netlist + "vcieth.p_vci_initiator(signal_vci_etherneti);" + CR;
-
-	netlist =
-	    netlist +
-	    "vcifdtrom.begin_device_node(\"vci_ethernet\", \"soclib:vci_ethernet\");"
-	    + CR;
-	netlist = netlist + "vcifdtrom.add_property(\"interrupts\", 3);" + CR;
-	netlist = netlist + "vcifdtrom.end_node();" + CR;
-
-	//////////////// block device
-
-	netlist = netlist + "vcibd.p_clk(signal_clk);" + CR;
-	netlist = netlist + "vcibd.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "vcibd.p_irq(signal_xicu_irq[1]);" + CR;
-	netlist = netlist + "vcibd.p_vci_target(signal_vci_bdt);" + CR;
-	netlist = netlist + "vcibd.p_vci_initiator(signal_vci_bdi);" + CR;
-
-	netlist =
-	    netlist +
-	    "vcifdtrom.begin_device_node(\"vci_block_device\", \"soclib:vci_block_device\");"
-	    + CR;
-	netlist = netlist + "vcifdtrom.add_property(\"interrupts\", 1);" + CR;
-	netlist = netlist + "vcifdtrom.end_node();" + CR;
-
-	//////////////// fd access
-	netlist = netlist + "vcihetrom.add_srcid(*cpus[0]->text_ldr, IntTab(cpus.size()+1));" + CR;	/* allows dma read in rodata */
-
-	netlist = netlist + "vcifd.p_clk(signal_clk);" + CR;
-	netlist = netlist + "vcifd.p_resetn(signal_resetn);" + CR;
-	netlist = netlist + "vcifd.p_irq(signal_xicu_irq[2]);" + CR;
-	netlist =
-	    netlist + "vcifd.p_vci_target(signal_vci_vcifdaccesst);" + CR;
-	netlist =
-	    netlist + "vcifd.p_vci_initiator(signal_vci_vcifdaccessi);" + CR;
-
-	netlist =
-	    netlist +
-	    "vcifdtrom.begin_device_node(\"vci_fd_access\", \"soclib:vci_fd_access\");"
-	    + CR;
-	netlist = netlist + "vcifdtrom.add_property(\"interrupts\", 2);" + CR;
-	netlist = netlist + "vcifdtrom.end_node();" + CR2;
-
-	i = 0;
-	int j = 0;
-
-	for (AvatarCoproMWMR copro:TopCellGenerator.
-		 avatardd.getAllCoproMWMR ())
-	    {
-		//IE and OE packet engines are special cases as they have VCI an fifo initiator interface
-		if (copro.getCoprocType () == 0)
-		    {
-			i = 0;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_clk(signal_clk);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_resetn(signal_resetn);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_vci(signal_vci_IE);" + CR;
-
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_pktdesc[0](signal_fifo_" + j + "_" + i +
-			    "_to_ctrl);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_slin(signal_fifo_" + j + "_" + i +
-			    "_from_ctrl);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_slext(signal_fifo_" + j + "_" + (i + 1) +
-			    "_from_ctrl);" + CR;
-
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_running(signal_IE_from_ctrl);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_status(signal_IE_to_ctrl);" + CR2;
-			i = 0;
-		    }
-		else if (copro.getCoprocType () == 1)
-		    {
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_clk(signal_clk);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_resetn(signal_resetn);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_vci(signal_vci_OE);" + CR;
-
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_desc(signal_fifo_" + j + "_" + i +
-			    "_from_ctrl);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_slin(signal_fifo_" + j + "_" + i + "_to_ctrl);" +
-			    CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_slext(signal_fifo_" + j + "_" + (i + 1) +
-			    "_to_ctrl);" + CR;
-
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_running(signal_OE_from_ctrl);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_status(signal_OE_to_ctrl);" + CR2;
-			i = 0;
-		    }
-		else
-		    {
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_clk(signal_clk);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    ".p_resetn(signal_resetn);" + CR;
-			netlist =		
-			    netlist + copro.getCoprocName ()+ ".p_from_ctrl[" + i +
-			    "](signal_fifo_" + j + "_" + i + "_from_ctrl);" + CR;		
-			netlist =		
-			    netlist + copro.getCoprocName () + ".p_to_ctrl[" + i +
-			    "](signal_fifo_" + j + "_" + i + "_to_ctrl);" + CR2;
-		    }
-
-
-		//additional interfaces for IE and OE
-
-		if (copro.getCoprocType () == 0)
-		    {
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    "_wrapper.p_clk(signal_clk);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    "_wrapper.p_resetn(signal_resetn);" + CR;
-			netlist =
-			    netlist + copro.getCoprocName () +
-			    "_wrapper.p_vci_initiator(signal_mwmr_" + i +
-			    "_initiator);" + CR;
-			netlist = netlist + copro.getCoprocName () + "_wrapper.p_from_coproc[" + i + "](signal_fifo_" + j + "_" + i + "_from_ctrl);" + CR;	//pktdesc
-			netlist = netlist + copro.getCoprocName () + "_wrapper.p_from_coproc[" + (i + 1) + "](signal_fifo_" + j + "_" + (i + 1) + "_from_ctrl);" + CR;	//running
-			netlist = netlist + copro.getCoprocName () + "_wrapper.p_status[0](signal_IE_to_ctrl);" + CR;	//status
-			netlist = netlist + copro.getCoprocName () + "_wrapper.p_to_coproc[" + i + "](signal_fifo_" + j + "_" + i + "_to_ctrl);" + CR;	//slin
-			netlist = netlist + copro.getCoprocName () + "_wrapper.p_config[0](signal_IE_from_ctrl);" + CR;	//slext
-		    }
-		else
-		    {
-			if (copro.getCoprocType () == 1)
-			    {
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_clk(signal_clk);" + CR;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_resetn(signal_resetn);" + CR;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_vci_initiator(signal_mwmr_" + i +
-				    "_initiator);" + CR;
-				netlist = netlist + copro.getCoprocName () + "_wrapper.p_from_coproc[" + i + "](signal_fifo_" + j + "_" + i + "_from_ctrl);" + CR;	//desc
-				netlist = netlist + copro.getCoprocName () + "_wrapper.p_status[0](signal_OE_to_ctrl);" + CR;	//running
-				netlist = netlist + copro.getCoprocName () + "_wrapper.p_to_coproc[" + i + "](signal_fifo_" + j + "_" + i + "_to_ctrl);" + CR;	//status
-				netlist = netlist + copro.getCoprocName () + "_wrapper.p_to_coproc[" + (i + 1) + "](signal_fifo_" + j + "_" + (i + 1) + "_to_ctrl);" + CR;	//slin
-				netlist = netlist + copro.getCoprocName () + "_wrapper.p_config[0](signal_OE_from_ctrl);" + CR;	//slext
-			    }
-			else
-			    {
-
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_clk(signal_clk);" + CR;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_resetn(signal_resetn);" + CR;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_vci_initiator(signal_mwmr_" + i +
-				    "_initiator);" + CR;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_vci_target(signal_mwmr_" + i +
-				    "_target);" + CR2;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_from_coproc[" + i +
-				    "](signal_fifo_" + j + "_" + i +
-				    "_from_ctrl);" + CR;
-				netlist =
-				    netlist + copro.getCoprocName () +
-				    "_wrapper.p_to_coproc[" + i + "](signal_fifo_" +
-				    j + "_" + i + "_to_ctrl);" + CR;
-			    }
-			i++;
-		    }
-		j++;
-		coproc_count++;
-	    }
-
-	
-	//If there is a spy, add logger or stats to vci interface
-	if(nb_clusters==0){
-	    i = 0;
-	    for (AvatarCPU cpu:TopCellGenerator.avatardd.getAllCPU ())
-		{
-		    int number = cpu.getNo_proc ();
-		    if (cpu.getMonitored () == 1)
-			{
-			    netlist = netlist + CR +
-				"logger" + i + ".p_clk(signal_clk);" + CR +
-				"logger" + i + ".p_resetn(signal_resetn);" + CR +
-				"logger" + i + ".p_vci(signal_vci_m[" + number +
-				"]);" + CR2;
-			    i++;
-			}
-
-		}
-	    j = 0;
-	}
-	else{
-	    i = 0;
-	    for (AvatarCPU cpu:TopCellGenerator.avatardd.getAllCPU ())
-		{
-		    int number = cpu.getNo_proc ();
-		    if (cpu.getMonitored () == 1)
-			{
-			    netlist = netlist + CR +
-				"logger" + i + ".p_clk(signal_clk);" + CR +
-				"logger" + i + ".p_resetn(signal_resetn);" + CR +
-				"logger" + i + ".p_vci(signal_vci_m"+TopCellGenerator.getCrossbarIndex(cpu)+"[" + number +
-				"]);" + CR2;
-			    i++;
-			}
-
-		}
-	    j = 0;
-	}
-
-	if(nb_clusters==0){
-	    i = 0;
-	    for (AvatarRAM ram:TopCellGenerator.avatardd.getAllRAM ())
-		{
-		    if (ram.getMonitored () == 1)
-			{
-			    int number = number = ram.getIndex ();
-			    netlist += "logger" + i + ".p_clk(signal_clk);" + CR;
-			    netlist +=
-				"logger" + i + ".p_resetn(signal_resetn);" + CR;
-			    netlist +=
-				"logger" + i + ".p_vci(signal_vci_vciram"+ TopCellGenerator.getCrossbarIndex(ram) +"_" + number +
-				");" + CR2;
-			    i++;
-			}
-		    else
-			{
-
-			    if (ram.getMonitored () == 2)
-				{
-				    int number = number = ram.getIndex ();
-				    netlist +=
-					"mwmr_stats" + j + ".p_clk(signal_clk);" + CR;
-				    netlist +=
-					"mwmr_stats" + j + ".p_resetn(signal_resetn);" +
-					CR;
-				    netlist +=
-					"mwmr_stats" + j + ".p_vci(signal_vci_vciram"+ TopCellGenerator.getCrossbarIndex(ram) +"_" +
-					number + ");" + CR2;
-				    j++;
-				}
-			}
-		}
-	}
-	else{
-	    i = 0;
-	    for (AvatarRAM ram:TopCellGenerator.avatardd.getAllRAM ())
-		{
-		    if (ram.getMonitored () == 1)
-			{
-			    int number = number = ram.getIndex ();
-			    netlist += "logger" + i + ".p_clk(signal_clk);" + CR;
-			    netlist +=
-				"logger" + i + ".p_resetn(signal_resetn);" + CR;
-			    netlist +=
-				"logger" + i + ".p_vci(signal_vci_vciram" + number +
-				");" + CR2;
-			    i++;
-			}
-		    else
-			{
-
-			    if (ram.getMonitored () == 2)
-				{
-				    int number = number = ram.getIndex ();
-				    netlist +=
-					"mwmr_stats" + j + ".p_clk(signal_clk);" + CR;
-				    netlist +=
-					"mwmr_stats" + j + ".p_resetn(signal_resetn);" +
-					CR;
-				    netlist +=
-					"mwmr_stats" + j + ".p_vci(signal_vci_vciram" +
-					number + ");" + CR2;
-				    j++;
-				}
-			}
-		} 
-	}
-
-	int p = 0;
-
-    //AMS Cluster Netlist
-    netlist = netlist + "// AMS Cluster netlist" + CR2;
-    for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ())
-    {
-        netlist += "gpio2vci"+amsCluster.getNo_amsCluster ()+".p_clk(signal_clk);" + CR;
-        netlist += "gpio2vci"+amsCluster.getNo_amsCluster ()+".p_resetn(signal_resetn);" + CR;
-        netlist += "gpio2vci"+amsCluster.getNo_amsCluster ()+".p_vci(signal_vci_gpio2vci" +
-          amsCluster.getNo_amsCluster () + ");" + CR;
-        netlist += "gpio2vci"+amsCluster.getNo_amsCluster ()+".p_wdata_ams(signal_to_ams" +
-          amsCluster.getNo_amsCluster () + ");" + CR;
-        netlist += "gpio2vci"+amsCluster.getNo_amsCluster ()+".p_rdata_ams(signal_from_ams" +
-          amsCluster.getNo_amsCluster () + ");" + CR2;
-
-        netlist += amsCluster.getAmsClusterName () + amsCluster.getNo_amsCluster () +
-          ".in_ams(signal_to_ams"+amsCluster.getNo_amsCluster ()+ ");" + CR;
-        netlist += amsCluster.getAmsClusterName () + amsCluster.getNo_amsCluster () +
-          ".out_ams(signal_from_ams"+amsCluster.getNo_amsCluster ()+ ");" + CR2;
-        if (nb_clusters == 0)
-        {
-            if (icn == "vgmn")
-            {
-                netlist += "vgmn.p_to_target[" +
-                    amsCluster.getNo_target () + "](signal_vci_gpio2vci" + 
-                    amsCluster.getNo_amsCluster () + ");" + CR2;
-            }
-            else
-            {
-                netlist += "vgsb.p_to_target[" +
-                    amsCluster.getNo_target () + "](signal_vci_gpio2vci" + 
-                    amsCluster.getNo_amsCluster () + ");" + CR2;
-            }
-        }
-
-          //we have a clustered architecture: identify local crossbar 
-        else
-        {
-            for (j = 0; j < nb_clusters; j++)
-            {
-                netlist += "crossbar" + j + ".p_to_target[" +
-                  amsCluster.getNo_target () + "](signal_vci_gpio2vci" + j +
-                  ");" + CR2;
-            }
-        }
-    }
-
-	//generate trace file if marked trace option 
-
-	if (tracing)
-	    {
-		netlist += "sc_trace_file *tf;" + CR;
-		netlist += "tf=sc_create_vcd_trace_file(\"mytrace\");" + CR;
-		netlist += "sc_trace(tf,signal_clk,\"CLK\");" + CR;
-		netlist += "sc_trace(tf,signal_resetn,\"RESETN\");" + CR;
-
-		netlist +=
-		    "sc_trace(tf, signal_vci_xicu,\"signal_vci_xicu\");" + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_vcifdtrom,\"signal_vci_vcifdtrom\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_vcihetrom,\"signal_vci_vcihetrom\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_vcirom ,\"signal_vci_vcirom\");" +
-		    CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_vcisimhelper,\"signal_vci_vcisimhelper\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_vcirttimer ,\"signal_vci_vcirttimer\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_vcifdaccessi,\"signal_vci_vcifdaccessi\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf,signal_vci_vcifdaccesst ,\"signal_vci_vcifdaccesst\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf,signal_vci_bdi ,\"signal_vci_bdi\");" + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_bdt,\"signal_vci_bdt\");" + CR;
-		netlist +=
-		    "sc_trace(tf, signal_vci_etherneti,\"signal_vci_etherneti\");"
-		    + CR;
-		netlist +=
-		    "sc_trace(tf,signal_vci_ethernett ,\"signal_vci_ethernett\");"
-		    + CR;
-
-		for (i = 0; i < TopCellGenerator.avatardd.getNb_init (); i++)
-		    {
-			netlist +=
-			    "sc_trace(tf,signal_vci_m[" + i +
-			    "] ,\"signal_vci_m[" + i + "]\");" + CR;
-		    }
-
-		i = 0;
-		for (AvatarTTY tty:TopCellGenerator.avatardd.
-			 getAllTTY ())
-		    {
-
-			netlist +=
-			    "sc_trace(tf,signal_vci_tty" + tty.getIndex () +
-			    ",\"TTY" + tty.getIndex () + "\");" + CR;
-			netlist +=
-			    "sc_trace(tf,signal_xicu_irq[" + i +
-			    "] ,\"signal_xicu_irq[" + i + "]\");" + CR;
-			i++;
-		    }
-
-		netlist +=
-		    "sc_trace(tf,signal_xicu_irq[" + i +
-		    "] ,\"signal_xicu_irq[" + i + "]\");" + CR;
-		netlist +=
-		    "sc_trace(tf,signal_xicu_irq[" + i +
-		    "] ,\"signal_xicu_irq[" + i + "]\");" + CR;
-		netlist +=
-		    "sc_trace(tf,signal_xicu_irq[" + i +
-		    "] ,\"signal_xicu_irq[" + i + "]\");" + CR;
-
-            for (AvatarRAM ram:TopCellGenerator.avatardd.getAllRAM ())
-		    {
-			if (ram.getMonitored () == 0)
-			    {
-				netlist +=
-				    "sc_trace(tf,signal_vci_vciram" +
-				    ram.getIndex () + ",\"Memory" +
-				    ram.getIndex () + "\");" + CR;
-			    }
-		    }
-            for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster())
-            {
-                netlist +=
-                "sc_trace(tf,signal_vci_gpio2vci" + amsCluster.getNo_amsCluster() +
-                ",\"signal_vci_gpio2vci" + amsCluster.getNo_amsCluster() + "\");" + CR;
-                netlist +=
-                "sc_trace(tf,signal_to_ams" + amsCluster.getNo_amsCluster () +
-                ",\"signal_to_ams" + amsCluster.getNo_amsCluster() + "\");" + CR;
-                netlist +=
-                "sc_trace(tf,signal_from_ams" + amsCluster.getNo_amsCluster () +
-                ",\"signal_from_ams" + amsCluster.getNo_amsCluster() + "\");" + CR;
-            }
-            //Call trace function from the AMS cluster.
-            for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster())
-            {
-                netlist += CR +
-                "sca_util::sca_trace_file *tfp = sca_util::sca_create_tabular_trace_file(\"my_trace_analog\");" + CR;
-                netlist +=
-                "sca_util::sca_trace(tfp,signal_to_ams" + amsCluster.getNo_amsCluster() +
-                ",\"signal_to_ams" + amsCluster.getNo_amsCluster() + "\");" + CR;
-                netlist +=
-                "sca_util::sca_trace(tfp,signal_from_ams" + amsCluster.getNo_amsCluster() +
-                ",\"signal_from_ams" + amsCluster.getNo_amsCluster() + "\");" + CR;
-                
-                netlist +=
-                amsCluster.getAmsClusterName() + amsCluster.getNo_amsCluster() +
-                ".trace_" + amsCluster.getAmsClusterName() + "(tfp);" + CR;
-            }
-            
-            netlist += CR;
-	    }
-
-	netlist =
-	    netlist +
-	    "  sc_core::sc_start(sc_core::sc_time(0, sc_core::SC_NS));" + CR;
-	netlist = netlist + "  signal_resetn = false;" + CR;
-	netlist =
-	    netlist +
-	    "  sc_core::sc_start(sc_core::sc_time(1, sc_core::SC_NS));" + CR;
-	netlist = netlist + "  signal_resetn = true;" + CR;
-	netlist = netlist + "  sc_core::sc_start();" + CR;
-	if (tracing)
-	    {
-		netlist += CR + "sc_close_vcd_trace_file(tf);" + CR;
-        netlist += "sca_util::sca_close_tabular_trace_file(tfp);" + CR;
-	    }
-	netlist = netlist + CR + "  return EXIT_SUCCESS;" + CR;
-	netlist = netlist + "}" + CR;
-
-	return netlist;
-    }
-}
diff --git a/src/main/java/syscamstranslator/SysCAMSSpecification.java b/src/main/java/syscamstranslator/SysCAMSSpecification.java
index 6f214d7749f83e5925ed1e2f54bcf6908929194a..5beddeff342eafd521f16f9fb2be4615be840c32 100644
--- a/src/main/java/syscamstranslator/SysCAMSSpecification.java
+++ b/src/main/java/syscamstranslator/SysCAMSSpecification.java
@@ -238,6 +238,14 @@ public class SysCAMSSpecification{
         }
         return cons;
     }
+    
+    public LinkedList<SysCAMSTConnector> getAllConnectors(){
+        LinkedList<SysCAMSTConnector> cons = new LinkedList<SysCAMSTConnector>();
+        for (SysCAMSTConnector con : connectors) {
+            cons.add(con);
+        }
+        return cons;
+    }
 
 	public int getNbBlockTDF(){
 		return (getAllBlockTDF()).size();
diff --git a/src/main/java/syscamstranslator/SysCAMSTBlockDE.java b/src/main/java/syscamstranslator/SysCAMSTBlockDE.java
index dba0be54f7dcf9009ed094d8b102051933c58105..ea5bc822604116ba9bd47e4b1d19e211cc1dfd12 100644
--- a/src/main/java/syscamstranslator/SysCAMSTBlockDE.java
+++ b/src/main/java/syscamstranslator/SysCAMSTBlockDE.java
@@ -59,13 +59,14 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
 	private DefaultListModel<String> listStruct;
 	private String nameTemplate;
 	private String typeTemplate;
+    private String valueTemplate;
 	private DefaultListModel<String> listTypedef;
 	
 	private SysCAMSTCluster cluster;
 	
 	private LinkedList<SysCAMSTPortDE> portDE;
 	
-	public SysCAMSTBlockDE(String _name, String _nameFn, String _code, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
+	public SysCAMSTBlockDE(String _name, String _nameFn, String _code, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, String _valueTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
 		name = _name;
 //		period = _period;
 //		time = _time;
@@ -74,6 +75,7 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
 		listStruct = _listStruct;
 		nameTemplate = _nameTemplate;
 		typeTemplate = _typeTemplate;
+        valueTemplate = _valueTemplate;
 		listTypedef = _listTypedef;
 		cluster = _cluster;
 		portDE = new LinkedList<SysCAMSTPortDE>();
@@ -110,6 +112,10 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
 	public String getTypeTemplate() {
 		return typeTemplate;
 	}
+    
+    public String getValueTemplate() {
+		return valueTemplate;
+	}
 
 	public DefaultListModel<String> getListTypedef() {
 		return listTypedef;
@@ -126,4 +132,4 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
 	public void addPortDE(SysCAMSTPortDE de){
 		portDE.add(de);
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/syscamstranslator/SysCAMSTBlockTDF.java b/src/main/java/syscamstranslator/SysCAMSTBlockTDF.java
index 6b59d50f5056295d44133a274fa47879b374366a..083bb78420b820bcee22d8f133ee6e87e39c3886 100644
--- a/src/main/java/syscamstranslator/SysCAMSTBlockTDF.java
+++ b/src/main/java/syscamstranslator/SysCAMSTBlockTDF.java
@@ -57,9 +57,11 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
 	private double period;
 	private String time;
 	private String processCode;
+    private String constructorCode;
 	private DefaultListModel<String> listStruct;
 	private String nameTemplate;
 	private String typeTemplate;
+    private String valueTemplate;
 	private DefaultListModel<String> listTypedef;
 	
 	private SysCAMSTCluster cluster;
@@ -67,21 +69,25 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
 	private LinkedList<SysCAMSTPortTDF> portTDF;
 	private LinkedList<SysCAMSTPortConverter> portConverter;
     private SysCAMSTPortConverter localPortConverter;
+    private LinkedList<SysCAMSTPortConverter> localPortConverterList;
     private int n;
     private boolean isTimestepPropagated;
 	
-	public SysCAMSTBlockTDF(String _name, double _period, String _time, String _processCode, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
+	public SysCAMSTBlockTDF(String _name, double _period, String _time, String _processCode, String _constructorCode, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, String _valueTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
 		name = _name;
 		period = _period;
 		time = _time;
 		processCode = _processCode;
+        constructorCode = _constructorCode;
 		listStruct = _listStruct;
 		nameTemplate = _nameTemplate;
 		typeTemplate = _typeTemplate;
+        valueTemplate = _valueTemplate;
 		listTypedef = _listTypedef;
 		cluster = _cluster;
 		portTDF = new LinkedList<SysCAMSTPortTDF>();
 		portConverter = new LinkedList<SysCAMSTPortConverter>();
+        localPortConverterList = new LinkedList<SysCAMSTPortConverter>();
         n = 0;
         isTimestepPropagated = false;
 	}
@@ -105,6 +111,10 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
 	public String getProcessCode() {
 		return processCode;
 	}
+    
+    public String getConstructorCode() {
+		return constructorCode;
+	}
 
 	public DefaultListModel<String> getListStruct() {
 		return listStruct;
@@ -117,6 +127,10 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
 	public String getTypeTemplate() {
 		return typeTemplate;
 	}
+    
+    public String getValueTemplate() {
+		return valueTemplate;
+	}
 
 	public DefaultListModel<String> getListTypedef() {
 		return listTypedef;
@@ -153,8 +167,19 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
     public void syncTDFBlockDEBlock(double[] time_prev) throws SysCAMSValidateException {
         double tp;
         try{
+            //Order list to have input converter ports first, in case of multirate-multiport single-modules
+            localPortConverterList.clear();
             for(int i = 0; i < portConverter.size(); i++) {
                 localPortConverter = portConverter.get(i);
+                if(localPortConverter.getOrigin() == 0) { //Input
+                    localPortConverterList.addFirst(localPortConverter);
+                } else if (localPortConverter.getOrigin() == 1) { //Output
+                    localPortConverterList.addLast(localPortConverter);
+                }
+            }
+            
+            for(int i = 0; i < localPortConverterList.size(); i++) {
+                localPortConverter = localPortConverterList.get(i);
                 if(localPortConverter.getOrigin() == 0) { //Input
                     check_causality_in(time_prev);
                 } else if (localPortConverter.getOrigin() == 1) { //Output
@@ -169,8 +194,7 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
     }
     
     private void check_causality_in(double[] time_prev_max) throws SysCAMSValidateException {
-        double time_now_min_tdf, time_now_max_tdf, time_tmp_tdf, time_tmp_de,
-                time_now_min_de, time_now_max_de;
+        double time_now_max_de;
         double tm = 0.0;
         double tp = 0.0;
         int r = 1;
@@ -185,41 +209,22 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
         if(localPortConverter.getDelay() > 0)
             d = localPortConverter.getDelay();
 
-        time_now_min_tdf = (n*tm)+((k-1)*tp);
-        time_now_max_tdf = (n*tm)+((k-1)*tp);
-        time_now_min_de = (n*tm)+((k-1)*tp)-(d*tp);
-        time_now_max_de = (n*tm)+((k-1)*tp)-(d*tp);
-        
-        for (k = 1; k <= r; k++) {
-            time_tmp_tdf = (n*tm)+((k-1)*tp);
-            time_tmp_de = (n*tm)+((k-1)*tp)-(d*tp);
-            System.out.println("tmstmp_in_tdf: " + time_tmp_tdf);
-            System.out.println("tmstmp_in_de: " + time_tmp_de);
-            time_now_min_tdf = Math.min(time_tmp_tdf, time_now_min_tdf);
-            time_now_max_tdf = Math.max(time_tmp_tdf, time_now_max_tdf);
-            time_now_min_de = Math.min(time_tmp_de, time_now_min_de);
-            time_now_max_de = Math.max(time_tmp_de, time_now_max_de);
-            System.out.println("time_now_min_de: " + time_now_min_de);
-            System.out.println("time_now_max_de: " + time_now_max_de);
-            System.out.println("time_now_min_tdf: " + time_now_min_tdf);
-            System.out.println("time_now_max_tdf: " + time_now_max_tdf);
-        }
+        time_now_max_de = (n*tm)+((r-1)*tp)-(d*tp);
         
-        System.out.println("time_prev_max_out: " + time_prev_max[1]);
-        if(time_now_min_tdf < time_prev_max[1]) {
-            localPortConverter.setDelay((int)Math.ceil((time_prev_max[1]-time_now_min_de)/tp) + d);
+               
+        /*if(time_now_min_tdf2 < time_prev_max[1]) {
+            localPortConverter.setDelay((int)Math.ceil((time_prev_max[1]-time_now_min_tdf2)/tp) + d);
             localPortConverter.setRecompute(true);
             throw new SysCAMSValidateException("Timestamp of previous write port executed module is: " + time_prev_max[1]
                  + " and current timestamp is: " + time_now_min_tdf + ".\n"
-                 + "Suggested delay in port \"" + localPortConverter.getName() + "\": " + (Math.ceil((time_prev_max[1]-time_now_min_tdf)/tp) + d));
-        }
+                 + "Suggested delay in port \"" + localPortConverter.getName() + "\" using time_now_min_tdf: " + (Math.ceil((time_prev_max[1]-time_now_min_tdf)/tp) + d)
+                 + " and using time_now_min_de: " + (Math.ceil((time_prev_max[1]-time_now_min_de)/tp) + d));
+        }*/
         time_prev_max[0] = Double.valueOf(Math.max(time_prev_max[0],time_now_max_de));
-        System.out.println("New time_prev_max_in: " + time_prev_max[0]);
     }
     
     private void check_causality_out(double[] time_prev_max) throws SysCAMSValidateException {
-        double time_now_min_tdf, time_now_max_tdf, time_tmp_tdf, time_tmp_de,
-                time_now_min_de, time_now_max_de;
+        double time_now_min_tdf, time_now_max_de2;
         double tm = 0.0;
         double tp = 0.0;
         int r = 1;
@@ -234,36 +239,19 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
         if(localPortConverter.getDelay() > 0)
             d = localPortConverter.getDelay();
 
-        time_now_min_tdf = (n*tm)+((k-1)*tp);
-        time_now_max_tdf = (n*tm)+((k-1)*tp);
-        time_now_min_de = (n*tm)+((k-1)*tp)+(d*tp);
-        time_now_max_de = (n*tm)+((k-1)*tp)+(d*tp);
+        time_now_min_tdf = (n*tm)+((1-1)*tp)+(d*tp);
+        
+        time_now_max_de2 = (n*tm)+((r-1)*tp)-(d*tp);
         
-        for (k = 1; k <= r; k++) {
-            time_tmp_tdf = (n*tm)+((k-1)*tp);
-            time_tmp_de = (n*tm)+((k-1)*tp)+(d*tp);;
-            System.out.println("tmstmp_out_tdf: " + time_tmp_tdf);
-            System.out.println("tmstmp_out_de: " + time_tmp_de);
-            time_now_min_tdf = Math.min(time_tmp_tdf, time_now_min_tdf);
-            time_now_max_tdf = Math.max(time_tmp_tdf, time_now_max_tdf);
-            time_now_min_de = Math.min(time_tmp_de, time_now_min_de);
-            time_now_max_de = Math.max(time_tmp_de, time_now_max_de);
-            System.out.println("time_now_min_de: " + time_now_min_de);
-            System.out.println("time_now_max_de: " + time_now_max_de);
-            System.out.println("time_now_min_tdf: " + time_now_min_tdf);
-            System.out.println("time_now_max_tdf: " + time_now_max_tdf);
-        }
         
-        System.out.println("time_prev_max_in: " + time_prev_max[0]);
-        if(time_now_min_de < time_prev_max[0]) {
-            localPortConverter.setDelay((int)Math.ceil((time_prev_max[0]-time_now_min_de)/tp) + d);
+        if(time_now_min_tdf < time_prev_max[0]) {
+            localPortConverter.setDelay((int)Math.ceil((time_prev_max[0]-time_now_min_tdf)/tp) + d);
             localPortConverter.setRecompute(true);
             throw new SysCAMSValidateException("Timestamp of previous read port executed module is: " + time_prev_max[0]
-                 + " and current timestamp is: " + time_now_min_de + ".\n"
-                 + "Suggested delay in port " + localPortConverter.getName() + ": " + (Math.ceil((time_prev_max[0]-time_now_min_de)/tp) + d));
+                 + " and current timestamp is: " + time_now_min_tdf + ".\n"
+                 + "Suggested delay in port " + localPortConverter.getName() + ": " + (Math.ceil((time_prev_max[0]-time_now_min_tdf)/tp) + d));
         }
-        time_prev_max[1] = Double.valueOf(Math.max(time_prev_max[1],time_now_max_tdf));
-        System.out.println("New time_prev_max_out: " + time_prev_max[1]);
+        time_prev_max[1] = Double.valueOf(Math.max(time_prev_max[1],time_now_max_de2));
     }
     
     public void setN(int _n) {
diff --git a/src/main/java/syscamstranslator/SysCAMSTPortTDF.java b/src/main/java/syscamstranslator/SysCAMSTPortTDF.java
index ef12060e8313aa8acdb27fda1f9e783d4bb10a37..48e3ab275ef78aebf92a114192f443ed0cbe775f 100644
--- a/src/main/java/syscamstranslator/SysCAMSTPortTDF.java
+++ b/src/main/java/syscamstranslator/SysCAMSTPortTDF.java
@@ -58,6 +58,7 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent {
 	private int delay;
 	private int origin;
 	private String TDFType;
+    private boolean recompute;
 	
 	private SysCAMSTBlockTDF blockTDF;
 	private ELNTCluster cluster;
@@ -71,6 +72,7 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent {
 		delay = _delay;
 		origin = _origin;
 		TDFType = _TDFType;
+        recompute = false;
 		blockTDF = _blockTDF;
 	}
 	
@@ -127,6 +129,14 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent {
     public void setDelay(int _delay) {
 		delay = _delay;
 	}
+    
+    public boolean getRecompute() {
+        return recompute;
+    }
+    
+    public void setRecompute(boolean _recompute) {
+        recompute = _recompute;
+    }
 
 	public int getOrigin() {
 		return origin;
diff --git a/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java b/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java
index bdd086cb14809db39231753ad3e2768ddb88af3c..2ae2ba4e62b131cc2313743f413e490c57ca8601 100644
--- a/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java
+++ b/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java
@@ -103,10 +103,14 @@ public class TopCellGenerator {
 		try {
 			// Save file .cpp
 			System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + ".cpp");
+			System.err.println(path + cluster.getClusterName() + ".cpp");//ajoute DG	
 			FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + "_tb.cpp");
+			FileWriter fw2 = new FileWriter(path + "/" + cluster.getClusterName() + "_tb.cpp");//ajoute DG
 			top = generateTopCell(cluster, connectors);
 			fw.write(top);
 			fw.close();
+			fw2.write(top);	//ajoute DG
+			fw2.close();	//ajoute DG
 		} catch (Exception ex) {
 			ex.printStackTrace();
 		}
@@ -122,12 +126,16 @@ public class TopCellGenerator {
 		for (SysCAMSTBlockTDF t : tdf) {
 			try {
 				System.err.println(path + GENERATED_PATH2 + t.getName() + ".h");
+				System.err.println(path + t.getName() + ".h");	//ajoute DG
 				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + ".h");
+				FileWriter fw2 = new FileWriter(path + "/" + t.getName() + ".h");//ajoute DG
 				headerTDF = Header.getPrimitiveHeaderTDF(t);
 				fw.write(headerTDF);
 				codeTDF = PrimitiveCode.getPrimitiveCodeTDF(t);
 				fw.write(codeTDF);
 				fw.close();
+				fw2.write(codeTDF);	//ajoute DG
+				fw2.close();	//ajoute DG
 			} catch (Exception ex) {
 				ex.printStackTrace();
 			}
@@ -135,15 +143,19 @@ public class TopCellGenerator {
 		for (SysCAMSTBlockDE t : de) {
 			try {
 				System.err.println(path + GENERATED_PATH2 + t.getName() + ".h");
+				System.err.println(path + t.getName() + ".h");//ajoute DG
 				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + ".h");
+				FileWriter fw2 = new FileWriter(path + "/" + t.getName() + ".h");	//ajoute DG
 				headerDE = Header.getPrimitiveHeaderDE(t);
 				fw.write(headerDE);
 				codeDE = PrimitiveCode.getPrimitiveCodeDE(t);
 				fw.write(codeDE);
 				fw.close();
+				fw2.write(codeDE);	//ajoute DG
+				fw2.close();	//ajoute DG
 			} catch (Exception ex) {
 				ex.printStackTrace();
 			}
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java b/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java
index d76cc5ddced8e6a5e6c42ab8811f6c334c9c1717..29d02fdab71c7528dc8d04496b2cc0b207a9453b 100644
--- a/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java
+++ b/src/main/java/syscamstranslator/toSysCAMSCluster/ClusterCode.java
@@ -69,39 +69,42 @@ public class ClusterCode {
 			LinkedList<SysCAMSTBlockTDF> tdf = cluster.getBlockTDF();
 			LinkedList<SysCAMSTBlockDE> de = cluster.getBlockDE();
 			
-			System.out.println("Number of AMS connectors: " + connectors.size());
                         
             corpsCluster = "template <typename vci_param>" + CR +
                           "class " +cluster.getClusterName()+ " : public sc_core::sc_module { "+ CR;
+                          
+            for (SysCAMSTBlockTDF t : tdf) {
+                if (!t.getListTypedef().isEmpty()) {
+                    for (int i = 0; i < t.getListTypedef().getSize(); i++) {
+                        String select = t.getListTypedef().get(i);
+                        String[] split = select.split(" : ");
+                        corpsCluster = corpsCluster + "\ttypedef " + split[1] + "<"+ t.getValueTemplate() +"> " + split[0] + ";" + CR;
+                    }
+                }
+            }
+            
+            for (SysCAMSTBlockDE t : de) {
+                if (!t.getListTypedef().isEmpty()) {
+                    for (int i = 0; i < t.getListTypedef().getSize(); i++) {
+                        String select = t.getListTypedef().get(i);
+                        String[] split = select.split(" : ");
+                        corpsCluster = corpsCluster + "\ttypedef " + split[1] + "<"+ t.getValueTemplate() +"> " + split[0] + ";" + CR;
+                    }
+                }
+            }
 			
-			corpsCluster = corpsCluster + "\t// Declare signals to interconnect." + CR;
+			corpsCluster = corpsCluster + CR + "\t// Declare signals to interconnect." + CR;
 			
-			//for (SysCAMSTConnector c : connectors) {
             for (int i = 0; i < connectors.size(); i++) {
                 nb_con = i;
                 if ( !((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) 
                 || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
-                    /*if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortTDF) {
-                        corpsCluster = corpsCluster + "\tsca_tdf::sca_signal<" + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getTDFType() + "> " 
-                        + "sig_" + nb_con + ";" + CR;
-                        //nb_con++;
-                    } else if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortConverter) {
-                        corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getConvType() + "> " 
-                        + "sig_" + nb_con + ";" + CR;
-                        //nb_con++;
-                    } else if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
-                        corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getDEType() + "> " 
-                        + "sig_" + nb_con + ";" + CR;
-                        //nb_con++;
-                    }*/
-
                     if ((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortTDF && connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortTDF) 
                             || (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortTDF && connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortTDF)) {
                         if (connectors.get(i).getName().equals("")) {
                             corpsCluster = corpsCluster + "\tsca_tdf::sca_signal<" + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getTDFType() + "> " 
                                     + "sig_" + nb_con + ";" + CR;
                             names.add("sig_" + nb_con);
-                            //nb_con++;
                         } else {
                             corpsCluster = corpsCluster + "\tsca_tdf::sca_signal<" + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getTDFType() + "> " 
                                     + connectors.get(i).getName() + ";" + CR;
@@ -112,7 +115,6 @@ public class ClusterCode {
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getConvType() + "> " 
                                     + "sig_" + nb_con + ";" + CR;
                             names.add("sig_" + nb_con);
-                            //nb_con++;
                         } else {
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getConvType() + "> " 
                                     + connectors.get(i).getName() + ";" + CR;
@@ -123,7 +125,6 @@ public class ClusterCode {
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getConvType() + "> " 
                                     + "sig_" + nb_con + ";" + CR;
                             names.add("sig_" + nb_con);
-                            //nb_con++;
                         } else {
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getConvType() + "> " 
                                     + connectors.get(i).getName() + ";" + CR;
@@ -135,7 +136,6 @@ public class ClusterCode {
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getDEType() + "> " 
                                     + "sig_" + nb_con + ";" + CR;
                             names.add("sig_" + nb_con);
-                            //nb_con++;
                         } else {
                             corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getDEType() + "> " 
                                     + connectors.get(i).getName() + ";" + CR;
@@ -150,14 +150,20 @@ public class ClusterCode {
 
 			corpsCluster = corpsCluster + CR + "\t// Instantiate cluster's modules." + CR;
             for (SysCAMSTBlockTDF t : tdf) {
-                corpsCluster = corpsCluster + "\t" + t.getName() + " " +
-                  t.getName() + "_" + nb_block + ";" + CR;
+                corpsCluster = corpsCluster + "\t" + t.getName();
+                if (!t.getListTypedef().isEmpty()) {
+                    corpsCluster += "<"+t.getValueTemplate()+">";
+                }
+                corpsCluster += " " + t.getName() + "_" + nb_block + ";" + CR;
                 nb_block++;
             }
             
             for (SysCAMSTBlockDE t : de) {
-                corpsCluster = corpsCluster + "\t" + t.getName() + " " +
-                  t.getName() + "_" + nb_block + ";" + CR;
+                corpsCluster = corpsCluster + "\t" + t.getName();
+                if (!t.getListTypedef().isEmpty()) {
+                    corpsCluster += "<"+t.getValueTemplate()+">";
+                }
+                corpsCluster += " " + t.getName() + "_" + nb_block + ";" + CR;
                 nb_block++;
             }
             
@@ -244,33 +250,40 @@ public class ClusterCode {
 			
 				for (SysCAMSTPortDE p : portDE) {
 					for (int i = 0; i < connectors.size(); i++) {
-						/*nb_con = i;
-						if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
-							if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
-								corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
-							} 
-						} else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
-							if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
-								corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
-							}
-						}*/
-                        if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
-                            if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
-                                corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
-                            } else if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
-                                corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
-                            }
-                        } else if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortConverter && connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
-                            if (((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(t.getName())) {
-                                corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
-                            } else if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
-                                corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                        if ( !((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) 
+                        || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
+                            if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
+                                if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                                } else if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                                }
+                            } else if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortConverter && connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
+                                if (((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                                } else if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                                }
+                            } else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortConverter && connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
+                                if (((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                                } else if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                                }
                             }
-                        } else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortConverter && connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
-                            if (((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(t.getName())) {
-                                corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
-                            } else if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
-                                corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + names.get(i) + ");" + CR;
+                        } else {
+                            if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) {
+                                if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
+                                    if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
+                                        corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(in_ams);" + CR;                                    
+                                    }
+                                }
+                            } else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null) {
+                                if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
+                                    if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
+                                        corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(out_ams);" + CR;                                    
+                                    }
+                                }
                             }
                         }
 					}
@@ -281,21 +294,16 @@ public class ClusterCode {
             
             corpsCluster = corpsCluster + "\t}" + CR2;
 			
-			/*corpsCluster = corpsCluster + "\t// Configure signal tracing." + CR 
-                    + "\tsca_trace_file* tfp = sca_create_tabular_trace_file(\"" + cluster.getClusterName() + "_tb\");" + CR;
-            
-            nb_con = 0;
+			corpsCluster = corpsCluster + "\t// Configure signal tracing." + CR;
+            corpsCluster += "\tvoid trace_" + cluster.getClusterName() +"(sca_util::sca_trace_file* tf) {" + CR;
             for (int i = 0; i < connectors.size(); i++) {
                 if ( !((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) 
-                || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
-                    corpsCluster = corpsCluster + "\tsca_trace(tfp, "+ "sig_" + nb_con + ", \"" + "sig_" + nb_con + "\");" + CR;
-                    nb_con++;
+                        || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
+                    corpsCluster += "\t\tsca_trace(tf, "+ names.get(i) + ", \"" + names.get(i) + "\");" + CR;
                 }
             }
-            corpsCluster = corpsCluster + CR + "\t// Close trace file and stop simulation to enable clean-up by" + CR
-                    + "\t// asking SystemC to execute all end_of_simulation() callbacks." + CR
-                    + "\tsca_close_tabular_trace_file(tfp);" + CR;
-              */
+            corpsCluster += "\t}" +CR;
+              
             corpsCluster = corpsCluster + "};" + CR2;
             corpsCluster = corpsCluster + "#endif // " + cluster.getClusterName().toUpperCase() + "_TDF_H"+ CR;
 		} else {
diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/MakefileCode.java b/src/main/java/syscamstranslator/toSysCAMSCluster/MakefileCode.java
index e438ff4d5b7defcf042833235b819f56504b5f77..6080c5e4dd30844b5e12be61e623727f1f168627 100644
--- a/src/main/java/syscamstranslator/toSysCAMSCluster/MakefileCode.java
+++ b/src/main/java/syscamstranslator/toSysCAMSCluster/MakefileCode.java
@@ -43,7 +43,7 @@
 /* authors: v1.0 Raja GATGOUT 2014
             v2.0 Daniela GENIUS, Julien HENON 2015 */
 
-package syscamstranslator.toSysCAMSCluster;
+package syscamstranslator.toSysCAMS;
 
 import java.util.LinkedList;
 
diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCode.java b/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCode.java
index b5bc316143abb564b37a08cc8f4fbfef4518c948..ba49f4323ef9a1cf4ddec0eb6e38d51b6915c5df 100644
--- a/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCode.java
+++ b/src/main/java/syscamstranslator/toSysCAMSCluster/PrimitiveCode.java
@@ -127,14 +127,12 @@ public class PrimitiveCode {
 					if (i == 0) {
 						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t: " + identifier + "(" + value + ")" + CR;
 					} 
-					if ((i > 0) && (i < tdf.getListStruct().getSize()-1)) {
+					if ((i > 0)) {
 						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t, " + identifier + "(" + value + ")" + CR;
 					} 
-					if (i == tdf.getListStruct().getSize()-1 && i != 0) {
-						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t, " + identifier + "(" + value + ")" + CR + "\t\t{}" + CR;
-					} else {
-						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t{}" + CR;
-					}
+                    if (i == tdf.getListStruct().getSize()-1) {
+                        corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t{}" + CR;
+                    }
 				}
 				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t};" + CR2;
 			}
@@ -218,8 +216,9 @@ public class PrimitiveCode {
 						}
 					}
 				}
-				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t{}" + CR2 + "protected:" + CR;
 			}
+            String ctorcode = tdf.getConstructorCode();
+			corpsPrimitiveTDF = corpsPrimitiveTDF + "\t{\n"+ctorcode+"\n\t}" + CR2 + "protected:" + CR;
 
 			if (tdf.getPeriod() != -1) {
 				corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + "set_timestep(" + tdf.getPeriod() + ", sc_core::SC_" + tdf.getTime().toUpperCase() + ");" + CR;
@@ -389,7 +388,7 @@ public class PrimitiveCode {
 				corpsPrimitiveDE = corpsPrimitiveDE + "template<" + de.getTypeTemplate() + " " + de.getNameTemplate() + ">" + CR;
 			}
 			//corpsPrimitive = "SCA_TDF_MODULE(" + de.getName() + ") {" + CR2;
-			corpsPrimitiveDE = corpsPrimitiveDE + "class " + de.getName() + " : public sca_core::sca_module {" + CR2 + "public:" + CR;
+			corpsPrimitiveDE = corpsPrimitiveDE + "class " + de.getName() + " : public sc_core::sc_module {" + CR2 + "public:" + CR;
 
 			if (!de.getListTypedef().isEmpty()) {
 				for (int i = 0; i < de.getListTypedef().getSize(); i++) {
@@ -438,14 +437,12 @@ public class PrimitiveCode {
 					if (i == 0) {
 						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t: " + identifier + "(" + value + ")" + CR;
 					} 
-					if ((i > 0) && (i < de.getListStruct().getSize()-1)) {
+					if ((i > 0)) {
 						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t, " + identifier + "(" + value + ")" + CR;
 					} 
-					if (i == de.getListStruct().getSize()-1 && i != 0) {
-						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t, " + identifier + "(" + value + ")" + CR + "\t\t{}" + CR;
-					} else {
-						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t{}" + CR;
-					}
+                    if (i == de.getListStruct().getSize()-1) {
+                        corpsPrimitiveDE = corpsPrimitiveDE + "\t\t{}" + CR;
+                    }
 				}
 				corpsPrimitiveDE = corpsPrimitiveDE + "\t};" + CR2;
 			}
@@ -453,9 +450,9 @@ public class PrimitiveCode {
 			if (!deports.isEmpty()) {
 				for (SysCAMSTPortDE t : deports) {
 					if (t.getOrigin() == 0) {
-						corpsPrimitiveDE = corpsPrimitiveDE + "\tsca_core::sca_in<" + t.getDEType() + "> " + t.getName() + ";" + CR;
+						corpsPrimitiveDE = corpsPrimitiveDE + "\tsc_core::sc_in< " + t.getDEType() + " > " + t.getName() + ";" + CR;
 					} else if (t.getOrigin() == 1) {
-						corpsPrimitiveDE = corpsPrimitiveDE + "\tsca_core::sca_out<" + t.getDEType() + "> " + t.getName() + ";" + CR;
+						corpsPrimitiveDE = corpsPrimitiveDE + "\tsc_core::sc_out< " + t.getDEType() + " > " + t.getName() + ";" + CR;
 					}
 				}
 			}
@@ -518,12 +515,14 @@ public class PrimitiveCode {
 					if (method == false) {
 						corpsPrimitiveDE = corpsPrimitiveDE + "\t{" + CR;
 					} 
-					corpsPrimitiveDE = corpsPrimitiveDE + "\t\tsensitive << " + t.getName() + ".";
+					corpsPrimitiveDE = corpsPrimitiveDE + "\t\tsensitive << " + t.getName();
 					if (t.getSensitiveMethod().equals("positive")) {
-						corpsPrimitiveDE = corpsPrimitiveDE + "pos();" + CR;
+						corpsPrimitiveDE = corpsPrimitiveDE + ".pos();" + CR;
 					} else if (t.getSensitiveMethod().equals("negative")) {
-						corpsPrimitiveDE = corpsPrimitiveDE + "neg();" + CR;						
-					}
+						corpsPrimitiveDE = corpsPrimitiveDE + ".neg();" + CR;
+					} else if (t.getSensitiveMethod().equals("")) {
+                        corpsPrimitiveDE = corpsPrimitiveDE + ";" + CR;
+                    }
 					sensitive = true;
 				}
 			}
@@ -602,4 +601,4 @@ public class PrimitiveCode {
 		}
 		return corpsPrimitiveDE;
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java b/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java
index ccdc017d7be379f32c1fb7009b54b10c84c975f0..6090657bb9e7613e76a25375162b7263c1243026 100644
--- a/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java
+++ b/src/main/java/syscamstranslator/toSysCAMSCluster/TopCellGeneratorCluster.java
@@ -74,7 +74,7 @@ public class TopCellGeneratorCluster {
 		if (c == null) {
 			System.out.println("***Warning: require at least one cluster***");
 		}
-		if (TopCellGeneratorCluster.syscams.getNbBlockTDF() == 0) {
+		/*if (TopCellGeneratorCluster.syscams.getNbBlockTDF() == 0) {
 			System.out.println("***Warning: require at least one TDF block***");
 		}
 		if (TopCellGeneratorCluster.syscams.getNbPortTDF() == 0) {
@@ -91,24 +91,28 @@ public class TopCellGeneratorCluster {
 		}
 		if (TopCellGeneratorCluster.syscams.getNbConnectorCluster() == 0) {
 			System.out.println("***Warning: require at least one connector***");
-		}
+		}*/
 		String top = Header.getClusterHeader(c) + ClusterCode.getClusterCode(c, connectors);
 		return (top);
 	}
 
 	public void saveFile(String path) {
 		SysCAMSTCluster cluster = TopCellGeneratorCluster.syscams.getCluster();
-		LinkedList<SysCAMSTConnector> connectors = TopCellGeneratorCluster.syscams.getAllConnectorsCluster4Soclib();
+		LinkedList<SysCAMSTConnector> connectors = TopCellGeneratorCluster.syscams.getAllConnectors();
 
 		String top;
 
 		try {
 			// Save file .cpp
 			System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + "_tdf.h");
+			System.err.println(path + cluster.getClusterName() + "_tdf.h");//ajouteDG
 			FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + "_tdf.h");
+			FileWriter fw2 = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + "_tdf.h");//ajouteDG
 			top = generateTopCell(cluster, connectors);
 			fw.write(top);
 			fw.close();
+			fw2.write(top);//ajouteDG
+			fw2.close();//ajouteDG
 		} catch (Exception ex) {
 			ex.printStackTrace();
 		}
@@ -124,25 +128,33 @@ public class TopCellGeneratorCluster {
 		for (SysCAMSTBlockTDF t : tdf) {
 			try {
 				System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");
-				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");
+				System.err.println(path + t.getName() + "_tdf.h");//ajoute DG
+				FileWriter fw = new FileWriter(path + "/" + t.getName() + "_tdf.h");
+				FileWriter fw2 = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");//ajoute DG
 				headerTDF = Header.getPrimitiveHeaderTDF(t);
 				fw.write(headerTDF);
 				codeTDF = PrimitiveCode.getPrimitiveCodeTDF(t);
 				fw.write(codeTDF);
 				fw.close();
+				fw2.write(codeTDF);//ajoute DG
+				fw2.close();//ajoute DG
 			} catch (Exception ex) {
 				ex.printStackTrace();
 			}
 		}
 		for (SysCAMSTBlockDE t : de) {
 			try {
-				System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");
+				System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");	System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");
 				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");
+				
+				FileWriter fw2 = new FileWriter(path +"/" + t.getName() + "_tdf.h");//ajoute DG
 				headerDE = Header.getPrimitiveHeaderDE(t);
 				fw.write(headerDE);
 				codeDE = PrimitiveCode.getPrimitiveCodeDE(t);
 				fw.write(codeDE);
 				fw.close();
+				fw2.write(codeDE);//ajoute DG
+				fw2.close();//ajoute DG
 			} catch (Exception ex) {
 				ex.printStackTrace();
 			}
diff --git a/src/main/java/syscamstranslator/toSysCAMS_rodrigo/ClusterCode.java b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/ClusterCode.java
new file mode 100644
index 0000000000000000000000000000000000000000..3ffc4f2cd159f89f2d5fa85c0769cec5cbe65aef
--- /dev/null
+++ b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/ClusterCode.java
@@ -0,0 +1,236 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package syscamstranslator.toSysCAMS;
+
+import java.util.LinkedList;
+
+import syscamstranslator.*;
+
+/**
+ * Class ClusterCode
+ * Principal code of a cluster component
+ * Creation: 14/05/2018
+ * @version 1.0 14/05/2018
+ * @author Irina Kit Yan LEE
+*/
+
+public class ClusterCode {
+	static private String corpsCluster;
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	ClusterCode() {}
+
+	public static String getClusterCode(SysCAMSTCluster cluster, LinkedList<SysCAMSTConnector> connectors) {
+		int nb_con = 0;
+		int nb_block = 0;
+		
+		if (cluster != null) {
+			LinkedList<SysCAMSTBlockTDF> tdf = cluster.getBlockTDF();
+			LinkedList<SysCAMSTBlockDE> de = cluster.getBlockDE();
+			
+			System.out.println("Number of AMS connectors: " + connectors.size());
+                        
+            corpsCluster = "template <typename vci_param>" + CR +
+                          "class " +cluster.getClusterName()+ " : public sc_core::sc_module { "+ CR;
+			
+			corpsCluster = corpsCluster + "\t// Declare signals to interconnect." + CR;
+			
+			//for (SysCAMSTConnector c : connectors) {
+            for (int i = 0; i < connectors.size(); i++) {
+                nb_con = i;
+                if ( !((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) 
+                || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
+                    if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortTDF) {
+                        corpsCluster = corpsCluster + "\tsca_tdf::sca_signal<" + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getTDFType() + "> " 
+                        + "sig_" + nb_con + ";" + CR;
+                        //nb_con++;
+                    } else if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortConverter) {
+                        corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getConvType() + "> " 
+                        + "sig_" + nb_con + ";" + CR;
+                        //nb_con++;
+                    } else if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
+                        corpsCluster = corpsCluster + "\tsc_core::sc_signal<" + ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getDEType() + "> " 
+                        + "sig_" + nb_con + ";" + CR;
+                        //nb_con++;
+                    }
+                }
+			}
+
+			corpsCluster = corpsCluster + CR + "\t// Instantiate cluster's modules." + CR;
+            for (SysCAMSTBlockTDF t : tdf) {
+                corpsCluster = corpsCluster + "\t" + t.getName() + " " +
+                  t.getName() + "_" + nb_block + ";" + CR;
+                nb_block++;
+            }
+            
+            for (SysCAMSTBlockDE t : de) {
+                corpsCluster = corpsCluster + "\t" + t.getName() + " " +
+                  t.getName() + "_" + nb_block + ";" + CR;
+                nb_block++;
+            }
+            
+            corpsCluster = corpsCluster + "public:" + CR;
+            corpsCluster = corpsCluster + "\tsc_in< typename vci_param::data_t > in_ams;" + CR;
+            corpsCluster = corpsCluster + "\tsc_out< typename vci_param::data_t > out_ams;" + CR2;
+            
+            nb_block = 0;
+            corpsCluster = corpsCluster + "\tSC_CTOR(" +cluster.getClusterName()+ ") :" + CR;
+            for (SysCAMSTBlockTDF t : tdf) {
+                corpsCluster = corpsCluster + "\t" + t.getName() + "_" + nb_block + "(\"" + t.getName() + "_" + nb_block + "\")," + CR;
+                nb_block++;
+            }
+            for (SysCAMSTBlockDE t : de) {
+                corpsCluster = corpsCluster + "\t" + t.getName() + "_" + nb_block + "(\"" + t.getName() + "_" + nb_block + "\")," + CR;
+                nb_block++;
+            }
+            corpsCluster = corpsCluster + "\tin_ams(\"in_ams\")," + CR;
+            corpsCluster = corpsCluster + "\tout_ams(\"out_ams\") {" + CR;
+            
+            nb_block = 0;
+			for (SysCAMSTBlockTDF t : tdf) {
+				//corpsCluster = corpsCluster + "\t" + t.getName() + " " + t.getName() + "_" + nb_block + "(\"" + t.getName() + "_" + nb_block + "\");" + CR;
+				
+				LinkedList<SysCAMSTPortTDF> portTDF = t.getPortTDF();
+				LinkedList<SysCAMSTPortConverter> portConv = t.getPortConverter();
+			
+				for (SysCAMSTPortTDF p : portTDF) {
+					for (int i = 0; i < connectors.size(); i++) {
+						nb_con = i;
+						if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortTDF) {
+							if (((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+								corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
+							} else if (((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+								corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
+							}
+						} 
+					}
+				}
+					
+				for (SysCAMSTPortConverter p : portConv) {
+					for (int i = 0; i < connectors.size(); i++) {
+                        nb_con = i;
+                        
+                        if ( !((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) 
+                        || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
+                            if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortConverter) {
+                                if (((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
+                                }
+                            } else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortConverter) {
+                                if (((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+                                    corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
+                                }
+                            }
+                        } else {
+                            if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) {
+                                if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortConverter) {
+                                    if (((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+                                        corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(in_ams);" + CR;                                    
+                                    }
+                                }
+                            } else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null) {
+                                if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortConverter) {
+                                    if (((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortConverter) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(t.getName())) {
+                                        corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(out_ams);" + CR;                                    
+                                    }
+                                }
+                            }
+                        } 
+                    }
+				}
+				corpsCluster = corpsCluster + CR;
+				nb_block++;
+			}
+			
+			for (SysCAMSTBlockDE t : de) {
+				//corpsCluster = corpsCluster + "\t" + t.getName() + " " + t.getName() + "_" + nb_block + "(\"" + t.getName() + "_" + nb_block + "\");" + CR;
+				
+				LinkedList<SysCAMSTPortDE> portDE = t.getPortDE();
+			
+				for (SysCAMSTPortDE p : portDE) {
+					for (int i = 0; i < connectors.size(); i++) {
+						nb_con = i;
+						if (connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE) {
+							if (((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockDE().getName().equals(t.getName())) {
+								corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
+							} 
+						} else if (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE) {
+							if (((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getName().equals(p.getName()) && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockDE().getName().equals(t.getName())) {
+								corpsCluster = corpsCluster + "\t\t" + t.getName() + "_" + nb_block + "." + p.getName() + "(" + "sig_" + nb_con + ");" + CR;
+							}
+						}
+					}
+				}
+				corpsCluster = corpsCluster + CR;
+				nb_block++;
+			}
+            
+            corpsCluster = corpsCluster + "\t}" + CR2;
+			
+			/*corpsCluster = corpsCluster + "\t// Configure signal tracing." + CR 
+                    + "\tsca_trace_file* tfp = sca_create_tabular_trace_file(\"" + cluster.getClusterName() + "_tb\");" + CR;
+            
+            nb_con = 0;
+            for (int i = 0; i < connectors.size(); i++) {
+                if ( !((connectors.get(i).get_p1().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p1().getComponent()).getBlockGPIO2VCI() != null) 
+                || (connectors.get(i).get_p2().getComponent() instanceof SysCAMSTPortDE && ((SysCAMSTPortDE) connectors.get(i).get_p2().getComponent()).getBlockGPIO2VCI() != null)) ) {
+                    corpsCluster = corpsCluster + "\tsca_trace(tfp, "+ "sig_" + nb_con + ", \"" + "sig_" + nb_con + "\");" + CR;
+                    nb_con++;
+                }
+            }
+            corpsCluster = corpsCluster + CR + "\t// Close trace file and stop simulation to enable clean-up by" + CR
+                    + "\t// asking SystemC to execute all end_of_simulation() callbacks." + CR
+                    + "\tsca_close_tabular_trace_file(tfp);" + CR;
+              */
+            corpsCluster = corpsCluster + "};" + CR2;
+            corpsCluster = corpsCluster + "#endif // " + cluster.getClusterName().toUpperCase() + "_TDF_H"+ CR;
+		} else {
+			corpsCluster = "";
+		}
+		return corpsCluster;
+	}
+}
diff --git a/src/main/java/syscamstranslator/toSysCAMS_rodrigo/Header.java b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/Header.java
new file mode 100644
index 0000000000000000000000000000000000000000..75b79e595bd7f8d67a5cd6a98c48e5f4edb6b82e
--- /dev/null
+++ b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/Header.java
@@ -0,0 +1,113 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package syscamstranslator.toSysCAMS;
+
+import java.util.LinkedList;
+
+import syscamstranslator.*;
+
+/**
+ * Class Header
+ * Header of files .h and .cpp
+ * Creation: 14/05/2018
+ * @version 1.0 14/05/2018
+ * @author Irina Kit Yan LEE
+*/
+
+public class Header {
+	static private String headerPrimitiveTDF;
+	static private String headerPrimitiveDE;
+	static private String headerCluster;
+	
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	Header() {}
+
+	public static String getPrimitiveHeaderTDF(SysCAMSTBlockTDF tdf) {
+		if (tdf != null) {
+			headerPrimitiveTDF = "#ifndef " + tdf.getName().toUpperCase() + "_TDF_H"+ CR 
+					+ "#define " + tdf.getName().toUpperCase() + "_TDF_H" + CR2
+					+ "#include <cmath>" + CR + "#include <iostream>" + CR + "#include <systemc-ams>" + CR2;
+		} else {
+			headerPrimitiveTDF = "";
+		}
+		return headerPrimitiveTDF;
+	}
+	
+	public static String getPrimitiveHeaderDE(SysCAMSTBlockDE de) {
+		if (de != null) {
+			headerPrimitiveDE = "#ifndef " + de.getName().toUpperCase() + "_TDF_H"+ CR 
+					+ "#define " + de.getName().toUpperCase() + "_TDF_H" + CR2
+					+ "#include <cmath>" + CR + "#include <iostream>" + CR + "#include <systemc>" + CR2;
+		} else {
+			headerPrimitiveDE = "";
+		}
+		return headerPrimitiveDE;
+	}
+	
+	public static String getClusterHeader(SysCAMSTCluster cluster) {
+		 if (cluster != null) {
+			 LinkedList<SysCAMSTBlockTDF> tdf = cluster.getBlockTDF();
+             LinkedList<SysCAMSTBlockDE> de = cluster.getBlockDE();
+
+             headerCluster = "#ifndef " + cluster.getClusterName().toUpperCase() + "_TDF_H"+ CR 
+                    + "#define " + cluster.getClusterName().toUpperCase() + "_TDF_H" + CR2;
+             headerCluster += "#include <systemc-ams>" + CR;
+             
+             for (SysCAMSTBlockTDF b : tdf) {
+                 headerCluster = headerCluster + "#include \"" + b.getName() + "_tdf.h\"" + CR;
+             }
+             for (SysCAMSTBlockDE b : de) {
+                 headerCluster = headerCluster + "#include \"" + b.getName() + "_tdf.h\"" + CR;
+             }
+             headerCluster = headerCluster + CR;
+         } else {
+             headerCluster = "";
+         }
+         return headerCluster;
+	} 
+}
\ No newline at end of file
diff --git a/src/main/java/syscamstranslator/toSysCAMS_rodrigo/MakefileCode.java b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/MakefileCode.java
new file mode 100644
index 0000000000000000000000000000000000000000..6080c5e4dd30844b5e12be61e623727f1f168627
--- /dev/null
+++ b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/MakefileCode.java
@@ -0,0 +1,113 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package syscamstranslator.toSysCAMS;
+
+import java.util.LinkedList;
+
+import syscamstranslator.*;
+
+/**
+ * Class MakefileCode Principal code of a makefile Creation: 02/06/2018
+ * 
+ * @version 1.0 02/06/2018
+ * @author Irina Kit Yan LEE
+ */
+
+public class MakefileCode {
+	static private String corpsMakefile;
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	MakefileCode() {
+	}
+
+	public static String getMakefileCode(LinkedList<SysCAMSTCluster> clusters) {
+		if (clusters != null) {
+			corpsMakefile = "# Compiler and linker flags" + CR + "CXXFLAGS = -g -Wall -I. $(SYSTEMC_INCLUDE_DIRS)" + CR
+					+ "LDFLAGS = $(SYSTEMC_LIBRARY_DIRS)" + CR2 + "# List of all ecutables to be compiled" + CR
+					+ "EXECUTABLES = ";
+
+			for (int i = 0; i < clusters.size(); i++) {
+				if (i == 0) {
+					corpsMakefile = corpsMakefile + clusters.get(i).getClusterName() + "_tb";
+				}
+				if (i > 0) {
+					corpsMakefile = corpsMakefile + " " + clusters.get(i).getClusterName() + "_tb";
+				}
+				if (i == clusters.size() - 1) {
+					corpsMakefile = corpsMakefile + CR2;
+				}
+			}
+
+			corpsMakefile = corpsMakefile + "# .PHONY targets don't generate files" + CR + ".PHONY:	all clean" + CR2
+					+ "# Default targets" + CR + "all:	$(EXECUTABLES)" + CR2;
+
+			for (int i = 0; i < clusters.size(); i++) {
+				LinkedList<SysCAMSTBlockTDF> tdf = clusters.get(i).getBlockTDF();
+				LinkedList<SysCAMSTBlockDE> de = clusters.get(i).getBlockDE();
+
+				corpsMakefile = corpsMakefile + clusters.get(i).getClusterName() + "_tb: "
+						+ clusters.get(i).getClusterName() + "_tb.cpp";
+
+				for (SysCAMSTBlockTDF t : tdf) {
+					corpsMakefile = corpsMakefile + " " + t.getName() + ".h";
+				}
+
+				for (SysCAMSTBlockDE t : de) {
+					corpsMakefile = corpsMakefile + " " + t.getName() + ".h";
+				}
+				corpsMakefile = corpsMakefile + CR
+						+ "\t$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< -lsystemc-ams -lsystemc | c++filt" + CR2;
+			}
+
+			corpsMakefile = corpsMakefile + "# Clean rule to delete temporary and generated files" + CR + "clean:" + CR
+					+ "\trm -rf *~ *.o *.dat *.vcd *.dSYM $(EXECUTABLES)" + CR;
+		} else {
+			corpsMakefile = "";
+		}
+		return corpsMakefile;
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/syscamstranslator/toSysCAMS_rodrigo/PrimitiveCode.java b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/PrimitiveCode.java
new file mode 100644
index 0000000000000000000000000000000000000000..9aee16b42eec544fb71459170d681c3d608b011a
--- /dev/null
+++ b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/PrimitiveCode.java
@@ -0,0 +1,605 @@
+/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+ * Daniela Genius, Lip6, UMR 7606 
+ * 
+ * ludovic.apvrille AT enst.fr
+ * daniela.genius@lip6.fr
+ * 
+ * This software is a computer program whose purpose is to allow the
+ * edition of TURTLE analysis, design and deployment diagrams, to
+ * allow the generation of RT-LOTOS or Java code from this diagram,
+ * and at last to allow the analysis of formal validation traces
+ * obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
+ * from INRIA Rhone-Alpes.
+ * 
+ * This software is governed by the CeCILL  license under French law and
+ * abiding by the rules of distribution of free software.  You can  use,
+ * modify and/ or redistribute the software under the terms of the CeCILL
+ * license as circulated by CEA, CNRS and INRIA at the following URL
+ * "http://www.cecill.info".
+ * 
+ * As a counterpart to the access to the source code and  rights to copy,
+ * modify and redistribute granted by the license, users are provided only
+ * with a limited warranty  and the software's author,  the holder of the
+ * economic rights,  and the successive licensors  have only  limited
+ * liability.
+ * 
+ * In this respect, the user's attention is drawn to the risks associated
+ * with loading,  using,  modifying and/or developing or reproducing the
+ * software by the user in light of its specific status of free software,
+ * that may mean  that it is complicated to manipulate,  and  that  also
+ * therefore means  that it is reserved for developers  and  experienced
+ * professionals having in-depth computer knowledge. Users are therefore
+ * encouraged to load and test the software's suitability as regards their
+ * requirements in conditions enabling the security of their systems and/or
+ * data to be ensured and,  more generally, to use and operate it in the
+ * same conditions as regards security.
+ * 
+ * The fact that you are presently reading this means that you have had
+ * knowledge of the CeCILL license and that you accept its terms.
+ */
+
+/* this class produces the lines containing essentially the initial #includes; we include all potential components event if they are not used in the deployment diagram*/
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package syscamstranslator.toSysCAMS;
+
+import java.util.LinkedList;
+
+import syscamstranslator.*;
+
+/**
+ * Class PrimitiveCode
+ * Principal code of a primive component
+ * Creation: 14/05/2018
+ * @version 1.0 14/05/2018
+ * @author Irina Kit Yan LEE
+ */
+
+public class PrimitiveCode {
+	static private String corpsPrimitiveTDF;
+	static private String corpsPrimitiveDE;
+	private final static String CR = "\n";
+	private final static String CR2 = "\n\n";
+
+	PrimitiveCode() {}
+
+	public static String getPrimitiveCodeTDF(SysCAMSTBlockTDF tdf) {
+		corpsPrimitiveTDF = "";
+		
+		if (tdf != null) {
+			LinkedList<SysCAMSTPortTDF> tdfports = tdf.getPortTDF();
+			LinkedList<SysCAMSTPortConverter> convports = tdf.getPortConverter();
+			int cpt = 0;
+			int cpt2 = 0;
+
+			if ((!tdf.getTypeTemplate().equals("")) && (!tdf.getNameTemplate().equals("")))  {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "template<" + tdf.getTypeTemplate() + " " + tdf.getNameTemplate() + ">" + CR;
+			}
+			//corpsPrimitive = "SCA_TDF_MODULE(" + tdf.getName() + ") {" + CR2;
+			corpsPrimitiveTDF = corpsPrimitiveTDF + "class " + tdf.getName() + " : public sca_tdf::sca_module {" + CR2 + "public:" + CR;
+
+			if (!tdf.getListTypedef().isEmpty()) {
+				for (int i = 0; i < tdf.getListTypedef().getSize(); i++) {
+					String select = tdf.getListTypedef().get(i);
+					String[] split = select.split(" : ");
+					corpsPrimitiveTDF = corpsPrimitiveTDF + "\ttypedef " + split[1] + "<" + tdf.getNameTemplate() + "> " + split[0] + ";" + CR;
+					if (i == tdf.getListTypedef().getSize()-1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + CR;
+					}
+				}
+			}
+			
+			if (tdf.getListStruct().getSize() != 0) {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\tstruct parameters {" + CR;
+
+				String identifier, value, type;
+				for (int i = 0; i < tdf.getListStruct().size(); i++) {
+					String select = tdf.getListStruct().get(i);
+					String[] splita = select.split(" = ");
+					identifier = splita[0];
+					String[] splitb = splita[1].split(" : ");
+					value = splitb[0];
+					String[] splitc = splitb[1].split(" ");
+					if (splitc[0].equals("const")) {
+						type = splitc[1];
+					} else {
+						type = splitc[0];
+					}
+					corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + type + " " + identifier + ";" + CR;
+				}
+
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\tparameters()" + CR;
+
+				for (int i = 0; i < tdf.getListStruct().size(); i++) {
+					String select = tdf.getListStruct().get(i);
+					String[] splita = select.split(" = ");
+					identifier = splita[0];
+					String[] splitb = splita[1].split(" : ");
+					value = splitb[0];
+					String[] splitc = splitb[1].split(" ");
+					if (splitc[0].equals("const")) {
+						type = splitc[1];
+					} else {
+						type = splitc[0];
+					}
+					if (i == 0) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t: " + identifier + "(" + value + ")" + CR;
+					} 
+					if ((i > 0) && (i < tdf.getListStruct().getSize()-1)) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t, " + identifier + "(" + value + ")" + CR;
+					} 
+					if (i == tdf.getListStruct().getSize()-1 && i != 0) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t, " + identifier + "(" + value + ")" + CR + "\t\t{}" + CR;
+					} else {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t{}" + CR;
+					}
+				}
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t};" + CR2;
+			}
+
+			if (!tdfports.isEmpty()) {
+				for (SysCAMSTPortTDF t : tdfports) {
+					if (t.getOrigin() == 0) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\tsca_tdf::sca_in< " + t.getTDFType() + " > " + t.getName() + ";" + CR;
+					} else if (t.getOrigin() == 1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\tsca_tdf::sca_out< " + t.getTDFType() + " > " + t.getName() + ";" + CR;
+					}
+				}
+			}
+			if (!convports.isEmpty()) {
+				for (SysCAMSTPortConverter conv : convports) {
+					if (conv.getOrigin() == 0) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\tsca_tdf::sca_de::sca_in< " + conv.getConvType() + " > " + conv.getName() + ";" + CR;
+					} else if (conv.getOrigin() == 1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\tsca_tdf::sca_de::sca_out< " + conv.getConvType() + " > " + conv.getName() + ";" + CR;
+					}
+				}
+			}
+
+			//corpsPrimitive = corpsPrimitive + CR + "\t// Constructor" + CR + "\tSCA_CTOR(" + tdf.getName() + ")" + CR;
+			corpsPrimitiveTDF = corpsPrimitiveTDF + CR + "\texplicit " + tdf.getName() + "(sc_core::sc_module_name nm";
+
+			if (tdf.getListStruct().getSize() != 0) {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + ", const parameters& p = parameters())" + CR;
+			} else {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + ")" + CR;
+			}
+
+			if (!tdfports.isEmpty() || !convports.isEmpty() || !tdf.getListStruct().isEmpty()) {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t: ";
+				if (!tdfports.isEmpty()) {
+					for (int i = 0; i < tdfports.size(); i++) {
+						if (tdfports.size() >= 1) {
+							if (cpt == 0) {
+								corpsPrimitiveTDF = corpsPrimitiveTDF + tdfports.get(i).getName() + "(\"" + tdfports.get(i).getName() + "\")" + CR;
+								cpt++;
+							} else {
+								corpsPrimitiveTDF = corpsPrimitiveTDF + "\t, " + tdfports.get(i).getName() + "(\"" + tdfports.get(i).getName() + "\")" + CR;
+							}
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + tdfports.get(i).getName() + "(\"" + tdfports.get(i).getName() + "\")" + CR;
+							cpt++;
+						}
+					}
+				}
+				if (!convports.isEmpty()) {
+					for (int i = 0; i < convports.size(); i++) {
+						if (convports.size() >= 1) {
+							if (cpt == 0) {
+								corpsPrimitiveTDF = corpsPrimitiveTDF + convports.get(i).getName() + "(\"" + convports.get(i).getName() + "\")" + CR;
+								cpt++;
+							} else {
+								corpsPrimitiveTDF = corpsPrimitiveTDF + "\t, " + convports.get(i).getName() + "(\"" + convports.get(i).getName() + "\")" + CR;
+							}
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + convports.get(i).getName() + "(\"" + convports.get(i).getName() + "\")" + CR;
+							cpt++;
+						}
+					}
+				}
+				String identifier;
+				if (!tdf.getListStruct().isEmpty()) {
+					for (int i = 0; i < tdf.getListStruct().size(); i++) {
+						String select = tdf.getListStruct().get(i);
+						String[] splita = select.split(" = ");
+						identifier = splita[0];
+						if (tdf.getListStruct().getSize() >= 1) {
+							if (cpt == 0) {
+								corpsPrimitiveTDF = corpsPrimitiveTDF + identifier + "(p." + identifier + ")" + CR;
+								cpt++;
+							} else {
+								corpsPrimitiveTDF = corpsPrimitiveTDF + "\t, " + identifier + "(p." + identifier + ")" + CR;
+							}
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + identifier + "(p." + identifier + ")" + CR;
+							cpt++;
+						}
+					}
+				}
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t{}" + CR2 + "protected:" + CR;
+			}
+
+			if (tdf.getPeriod() != -1) {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + "set_timestep(" + tdf.getPeriod() + ", sc_core::SC_" + tdf.getTime().toUpperCase() + ");" + CR;
+				cpt2++;
+			}	
+			if (cpt2 > 0) {
+				for (SysCAMSTPortTDF t : tdfports) {
+					if (t.getPeriod() != -1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_timestep(" + t.getPeriod() + ", sc_core::SC_" + t.getTime().toUpperCase() + ");" + CR;
+					} 
+					if (t.getRate() != -1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_rate(" + t.getRate() + ");" + CR;
+					} 
+					if (t.getDelay() != -1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_delay(" + t.getDelay() + ");" + CR;
+					} 
+				}
+			} else {
+				for (SysCAMSTPortTDF t : tdfports) {
+					if (t.getPeriod() != -1) {
+						if (cpt2 == 0) {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + t.getName() + ".set_timestep(" + t.getPeriod() + ", sc_core::SC_" + t.getTime().toUpperCase() + ");" + CR;
+							cpt2++;
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_timestep(" + t.getPeriod() + ", sc_core::SC_" + t.getTime().toUpperCase() + ");" + CR;
+						}
+					} 
+					if (t.getRate() != -1) {
+						if (cpt2 == 0) {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + t.getName() + ".set_rate(" + t.getRate() + ");" + CR;
+							cpt2++;
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_rate(" + t.getRate() + ");" + CR;
+						}
+					} 
+					if (t.getDelay() != -1) {
+						if (cpt2 == 0) {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + t.getName() + ".set_delay(" + t.getDelay() + ");" + CR;
+							cpt2++;
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_delay(" + t.getDelay() + ");" + CR;
+						}
+					} 
+				}
+			}
+			if (cpt2 > 0) {
+				for (SysCAMSTPortConverter t : convports) {
+					if (t.getPeriod() != -1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_timestep(" + t.getPeriod() + ", sc_core::SC_" + t.getTime().toUpperCase() + ");" + CR;
+					} 
+					if (t.getRate() != -1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_rate(" + t.getRate() + ");" + CR;
+					} 
+					if (t.getDelay() != -1) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_delay(" + t.getDelay() + ");" + CR;
+					} 
+				}
+			} else {
+				for (SysCAMSTPortConverter t : convports) {
+					if (t.getPeriod() != -1) {
+						if (cpt2 == 0) {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + t.getName() + ".set_timestep(" + t.getPeriod() + ", sc_core::SC_" + t.getTime().toUpperCase() + ");" + CR;
+							cpt2++;
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_timestep(" + t.getPeriod() + ", sc_core::SC_" + t.getTime().toUpperCase() + ");" + CR;
+						}
+					} 
+					if (t.getRate() != -1 && cpt2 == 0) {
+						if (cpt2 == 0) {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + t.getName() + ".set_rate(" + t.getRate() + ");" + CR;
+							cpt2++;
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_rate(" + t.getRate() + ");" + CR;
+						}
+					} 
+					if (t.getDelay() != -1 && cpt2 == 0) {
+						if (cpt2 == 0) {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + t.getName() + ".set_delay(" + t.getDelay() + ");" + CR;
+							cpt2++;
+						} else {
+							corpsPrimitiveTDF = corpsPrimitiveTDF + "\t\t" + t.getName() + ".set_delay(" + t.getDelay() + ");" + CR;
+						}
+					} 
+				}
+			}
+
+			if (cpt2 > 0) {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\t}" + CR2;
+			}
+
+			StringBuffer pcbuf = new StringBuffer(tdf.getProcessCode());
+			StringBuffer buffer = new StringBuffer("");
+			int tab = 0;
+			int begin = 0;
+
+			for(int pos = 0; pos != tdf.getProcessCode().length(); pos++) {
+				char c = pcbuf.charAt(pos);
+				switch(c) {
+				case '\t':  
+					begin = 1;
+					tab++;
+					break;
+				default:  
+					if (begin == 1) {
+						int i = tab;
+						while (i >= 0) {
+							buffer.append("\t"); 
+							i--;
+						}
+						buffer.append(pcbuf.charAt(pos)); 	
+						begin = 0;
+						tab = 0;
+					} else {
+						if (c == '}') {
+							buffer.append("\t"); 
+						}
+						buffer.append(pcbuf.charAt(pos)); 	
+					}
+					break;
+				}
+			}
+
+			String pc = buffer.toString();
+
+			corpsPrimitiveTDF = corpsPrimitiveTDF + "\t" + pc + CR;
+
+			if (tdf.getListStruct().getSize() != 0) {
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "private:" + CR;
+
+				String identifier, type, constant;
+				for (int i = 0; i < tdf.getListStruct().size(); i++) {
+					String select = tdf.getListStruct().get(i);
+					String[] splita = select.split(" = ");
+					identifier = splita[0];
+					String[] splitb = splita[1].split(" : ");
+					String[] splitc = splitb[1].split(" ");
+					if (splitc[0].equals("const")) {
+						constant = splitc[0];
+						type = splitc[1];
+					} else {
+						constant = "";
+						type = splitc[0];
+					}
+					if (constant.equals("")) {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t" + type + " " + identifier + ";" + CR;
+					} else {
+						corpsPrimitiveTDF = corpsPrimitiveTDF + "\t" + constant + " " + type + " " + identifier + ";" + CR;
+					}
+				}
+			}
+			corpsPrimitiveTDF = corpsPrimitiveTDF + "};" + CR2 + "#endif" + " // " + tdf.getName().toUpperCase() + "_H";
+		} else {
+			corpsPrimitiveTDF = "";
+		}
+		return corpsPrimitiveTDF;
+	}
+	
+	public static String getPrimitiveCodeDE(SysCAMSTBlockDE de) {
+		corpsPrimitiveDE = "";
+		
+		if (de != null) {
+			LinkedList<SysCAMSTPortDE> deports = de.getPortDE();
+			int cpt = 0;
+			int cpt2 = 0;
+
+			if ((!de.getTypeTemplate().equals("")) && (!de.getNameTemplate().equals("")))  {
+				corpsPrimitiveDE = corpsPrimitiveDE + "template<" + de.getTypeTemplate() + " " + de.getNameTemplate() + ">" + CR;
+			}
+			//corpsPrimitive = "SCA_TDF_MODULE(" + de.getName() + ") {" + CR2;
+			corpsPrimitiveDE = corpsPrimitiveDE + "class " + de.getName() + " : public sca_core::sca_module {" + CR2 + "public:" + CR;
+
+			if (!de.getListTypedef().isEmpty()) {
+				for (int i = 0; i < de.getListTypedef().getSize(); i++) {
+					String select = de.getListTypedef().get(i);
+					String[] split = select.split(" : ");
+					corpsPrimitiveDE = corpsPrimitiveDE + "\ttypedef " + split[1] + "<" + de.getNameTemplate() + "> " + split[0] + ";" + CR;
+					if (i == de.getListTypedef().getSize()-1) {
+						corpsPrimitiveDE = corpsPrimitiveDE + CR;
+					}
+				}
+			}
+			
+			if (de.getListStruct().getSize() != 0) {
+				corpsPrimitiveDE = corpsPrimitiveDE + "\tstruct parameters {" + CR;
+
+				String identifier, value, type;
+				for (int i = 0; i < de.getListStruct().size(); i++) {
+					String select = de.getListStruct().get(i);
+					String[] splita = select.split(" = ");
+					identifier = splita[0];
+					String[] splitb = splita[1].split(" : ");
+					value = splitb[0];
+					String[] splitc = splitb[1].split(" ");
+					if (splitc[0].equals("const")) {
+						type = splitc[1];
+					} else {
+						type = splitc[0];
+					}
+					corpsPrimitiveDE = corpsPrimitiveDE + "\t\t" + type + " " + identifier + ";" + CR;
+				}
+
+				corpsPrimitiveDE = corpsPrimitiveDE + "\t\tparameters()" + CR;
+
+				for (int i = 0; i < de.getListStruct().size(); i++) {
+					String select = de.getListStruct().get(i);
+					String[] splita = select.split(" = ");
+					identifier = splita[0];
+					String[] splitb = splita[1].split(" : ");
+					value = splitb[0];
+					String[] splitc = splitb[1].split(" ");
+					if (splitc[0].equals("const")) {
+						type = splitc[1];
+					} else {
+						type = splitc[0];
+					}
+					if (i == 0) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t: " + identifier + "(" + value + ")" + CR;
+					} 
+					if ((i > 0) && (i < de.getListStruct().getSize()-1)) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t, " + identifier + "(" + value + ")" + CR;
+					} 
+					if (i == de.getListStruct().getSize()-1 && i != 0) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t, " + identifier + "(" + value + ")" + CR + "\t\t{}" + CR;
+					} else {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t\t{}" + CR;
+					}
+				}
+				corpsPrimitiveDE = corpsPrimitiveDE + "\t};" + CR2;
+			}
+
+			if (!deports.isEmpty()) {
+				for (SysCAMSTPortDE t : deports) {
+					if (t.getOrigin() == 0) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\tsca_core::sca_in<" + t.getDEType() + "> " + t.getName() + ";" + CR;
+					} else if (t.getOrigin() == 1) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\tsca_core::sca_out<" + t.getDEType() + "> " + t.getName() + ";" + CR;
+					}
+				}
+			}
+
+			corpsPrimitiveDE = corpsPrimitiveDE + CR + "\tSC_HAS_PROCESS(" + de.getName() + ");" + CR + 
+			"\texplicit " + de.getName() + "(sc_core::sc_module_name nm";
+
+			if (de.getListStruct().getSize() != 0) {
+				corpsPrimitiveDE = corpsPrimitiveDE + ", const parameters& p = parameters())" + CR;
+			} else {
+				corpsPrimitiveDE = corpsPrimitiveDE + ")" + CR;
+			}
+
+			if (!deports.isEmpty() || !de.getListStruct().isEmpty()) {
+				corpsPrimitiveDE = corpsPrimitiveDE + "\t: ";
+				if (!deports.isEmpty()) {
+					for (int i = 0; i < deports.size(); i++) {
+						if (deports.size() >= 1) {
+							if (cpt == 0) {
+								corpsPrimitiveDE = corpsPrimitiveDE + deports.get(i).getName() + "(\"" + deports.get(i).getName() + "\")" + CR;
+								cpt++;
+							} else {
+								corpsPrimitiveDE = corpsPrimitiveDE + "\t, " + deports.get(i).getName() + "(\"" + deports.get(i).getName() + "\")" + CR;
+							}
+						} else {
+							corpsPrimitiveDE = corpsPrimitiveDE + deports.get(i).getName() + "(\"" + deports.get(i).getName() + "\")" + CR;
+							cpt++;
+						}
+					}
+				}
+				String identifier;
+				if (!de.getListStruct().isEmpty()) {
+					for (int i = 0; i < de.getListStruct().size(); i++) {
+						String select = de.getListStruct().get(i);
+						String[] splita = select.split(" = ");
+						identifier = splita[0];
+						if (de.getListStruct().getSize() >= 1) {
+							if (cpt == 0) {
+								corpsPrimitiveDE = corpsPrimitiveDE + identifier + "(p." + identifier + ")" + CR;
+								cpt++;
+							} else {
+								corpsPrimitiveDE = corpsPrimitiveDE + "\t, " + identifier + "(p." + identifier + ")" + CR;
+							}
+						} else {
+							corpsPrimitiveDE = corpsPrimitiveDE + identifier + "(p." + identifier + ")" + CR;
+							cpt++;
+						}
+					}
+				}
+			}
+
+			boolean sensitive = false, method = false;
+			if (!de.getCode().equals("")) {
+				corpsPrimitiveDE = corpsPrimitiveDE + "\t{" + CR + "\t\tSC_METHOD(" + de.getNameFn() + ");" + CR;
+				method = true;
+			} 
+			
+			for (SysCAMSTPortDE t : deports) {
+				if (t.getSensitive() == true) {
+					if (method == false) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t{" + CR;
+					} 
+					corpsPrimitiveDE = corpsPrimitiveDE + "\t\tsensitive << " + t.getName() + ".";
+					if (t.getSensitiveMethod().equals("positive")) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "pos();" + CR;
+					} else if (t.getSensitiveMethod().equals("negative")) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "neg();" + CR;						
+					}
+					sensitive = true;
+				}
+			}
+			if (sensitive == true || method == true) {
+				corpsPrimitiveDE = corpsPrimitiveDE + "\t}" + CR2;
+			} else {
+				corpsPrimitiveDE = corpsPrimitiveDE + "\t{}" + CR2;
+			}
+			
+			corpsPrimitiveDE = corpsPrimitiveDE + "private:" + CR;
+			
+			if (de.getListStruct().getSize() != 0) {
+				String identifier, type, constant;
+				for (int i = 0; i < de.getListStruct().size(); i++) {
+					String select = de.getListStruct().get(i);
+					String[] splita = select.split(" = ");
+					identifier = splita[0];
+					String[] splitb = splita[1].split(" : ");
+					String[] splitc = splitb[1].split(" ");
+					if (splitc[0].equals("const")) {
+						constant = splitc[0];
+						type = splitc[1];
+					} else {
+						constant = "";
+						type = splitc[0];
+					}
+					if (constant.equals("")) {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t" + type + " " + identifier + ";" + CR;
+					} else {
+						corpsPrimitiveDE = corpsPrimitiveDE + "\t" + constant + " " + type + " " + identifier + ";" + CR;
+					}
+					if (i == de.getListStruct().size()-1) {
+						corpsPrimitiveDE = corpsPrimitiveDE + CR;
+					}
+				}
+			}
+			
+			StringBuffer pcbuf = new StringBuffer(de.getCode());
+			StringBuffer buffer = new StringBuffer("");
+			int tab = 0;
+			int begin = 0;
+
+			for(int pos = 0; pos != de.getCode().length(); pos++) {
+				char c = pcbuf.charAt(pos);
+				switch(c) {
+				case '\t':  
+					begin = 1;
+					tab++;
+					break;
+				default:  
+					if (begin == 1) {
+						int i = tab;
+						while (i >= 0) {
+							buffer.append("\t"); 
+							i--;
+						}
+						buffer.append(pcbuf.charAt(pos)); 	
+						begin = 0;
+						tab = 0;
+					} else {
+						if (c == '}') {
+							buffer.append("\t"); 
+						}
+						buffer.append(pcbuf.charAt(pos)); 	
+					}
+					break;
+				}
+			}
+
+			String pc = buffer.toString();
+			corpsPrimitiveDE = corpsPrimitiveDE + "\t" + pc;
+			
+			corpsPrimitiveDE = corpsPrimitiveDE + CR + "};" + CR2 + "#endif" + " // " + de.getName().toUpperCase() + "_TDF_H";
+		} else {
+			corpsPrimitiveDE = "";
+		}
+		return corpsPrimitiveDE;
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/syscamstranslator/toSysCAMS_rodrigo/TopCellGenerator.java b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/TopCellGenerator.java
new file mode 100644
index 0000000000000000000000000000000000000000..6f9e043e003e27ec374039172139ceeb5b91c8ac
--- /dev/null
+++ b/src/main/java/syscamstranslator/toSysCAMS_rodrigo/TopCellGenerator.java
@@ -0,0 +1,149 @@
+/**Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
+  Daniela Genius, Lip6, UMR 7606 
+
+  ludovic.apvrille AT enst.fr
+  daniela.genius@lip6.fr
+
+  This software is a computer program whose purpose is to allow the 
+  edition of TURTLE analysis, design and deployment diagrams, to 
+  allow the generation of RT-LOTOS or Java code from this diagram, 
+  and at last to allow the analysis of formal validation traces 
+  obtained from external tools, e.g. RTL from LAAS-CNRS and CADP 
+  from INRIA Rhone-Alpes.
+
+  This software is governed by the CeCILL  license under French law and
+  abiding by the rules of distribution of free software.  You can  use, 
+  modify and/ or redistribute the software under the terms of the CeCILL
+  license as circulated by CEA, CNRS and INRIA at the following URL
+  "http://www.cecill.info". 
+
+  As a counterpart to the access to the source code and  rights to copy,
+  modify and redistribute granted by the license, users are provided only
+  with a limited warranty  and the software's author,  the holder of the
+  economic rights,  and the successive licensors  have only  limited
+  liability. 
+
+  In this respect, the user's attention is drawn to the risks associated
+  with loading,  using,  modifying and/or developing or reproducing the
+  software by the user in light of its specific status of free software,
+  that may mean  that it is complicated to manipulate,  and  that  also
+  therefore means  that it is reserved for developers  and  experienced
+  professionals having in-depth computer knowledge. Users are therefore
+  encouraged to load and test the software's suitability as regards their
+  requirements in conditions enabling the security of their systems and/or 
+  data to be ensured and,  more generally, to use and operate it in the 
+  same conditions as regards security. 
+
+  The fact that you are presently reading this means that you have had
+  knowledge of the CeCILL license and that you accept its terms.
+*/
+
+/* Generator of the top cell for simulation with SoCLib virtual component 
+   library */
+
+/* authors: v1.0 Raja GATGOUT 2014
+            v2.0 Daniela GENIUS, Julien HENON 2015 */
+
+package syscamstranslator.toSysCAMS;
+
+import syscamstranslator.*;
+import java.io.*;
+import java.util.LinkedList;
+
+/**
+ * Class TopCellGenerator
+ * Save the components and connectors in files
+ * Creation: 14/05/2018
+ * @version 1.0 14/05/2018
+ * @author Irina Kit Yan LEE
+*/
+
+public class TopCellGenerator {
+	public static SysCAMSSpecification syscams;
+
+	private final static String GENERATED_PATH1 = "generated_CPP" + File.separator;
+	private final static String GENERATED_PATH2 = "generated_H" + File.separator;
+
+	public TopCellGenerator(SysCAMSSpecification sys) {
+		syscams = sys;
+	}
+
+	public String generateTopCell(SysCAMSTCluster c, LinkedList<SysCAMSTConnector> connectors) {
+		if (c == null) {
+			System.out.println("***Warning: require at least one cluster***");
+		}
+		if (TopCellGenerator.syscams.getNbBlockTDF() == 0) {
+			System.out.println("***Warning: require at least one TDF block***");
+		}
+		if (TopCellGenerator.syscams.getNbPortTDF() == 0) {
+			System.out.println("***Warning: require at least one TDF port***");
+		}
+		if (TopCellGenerator.syscams.getNbBlockDE() == 0) {
+			System.out.println("***Warning: require at least one DE block***");
+		}
+		if (TopCellGenerator.syscams.getNbPortDE() == 0) {
+			System.out.println("***Warning: require at least one DE port***");
+		}
+		if (TopCellGenerator.syscams.getNbPortConverter() == 0) {
+			System.out.println("***Warning: require at least one converter port***");
+		}
+		if (TopCellGenerator.syscams.getNbConnectorCluster() == 0) {
+			System.out.println("***Warning: require at least one connector***");
+		}
+		String top = Header.getClusterHeader(c) + ClusterCode.getClusterCode(c, connectors);
+		return (top);
+	}
+
+	public void saveFile(String path) {
+		SysCAMSTCluster cluster = TopCellGenerator.syscams.getCluster();
+		LinkedList<SysCAMSTConnector> connectors = TopCellGenerator.syscams.getAllConnectorCluster();
+
+		String top;
+
+		try {
+			// Save file .cpp
+			System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + "_tdf.h");
+			FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + "_tdf.h");
+			top = generateTopCell(cluster, connectors);
+			fw.write(top);
+			fw.close();
+		} catch (Exception ex) {
+			ex.printStackTrace();
+		}
+		// Save files .h
+		saveFileBlock(path, cluster);
+	}
+
+	public void saveFileBlock(String path, SysCAMSTCluster c) {
+		String headerTDF, headerDE, codeTDF, codeDE;
+		LinkedList<SysCAMSTBlockTDF> tdf = c.getBlockTDF();
+		LinkedList<SysCAMSTBlockDE> de = c.getBlockDE();
+		
+		for (SysCAMSTBlockTDF t : tdf) {
+			try {
+				System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");
+				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");
+				headerTDF = Header.getPrimitiveHeaderTDF(t);
+				fw.write(headerTDF);
+				codeTDF = PrimitiveCode.getPrimitiveCodeTDF(t);
+				fw.write(codeTDF);
+				fw.close();
+			} catch (Exception ex) {
+				ex.printStackTrace();
+			}
+		}
+		for (SysCAMSTBlockDE t : de) {
+			try {
+				System.err.println(path + GENERATED_PATH2 + t.getName() + "_tdf.h");
+				FileWriter fw = new FileWriter(path + GENERATED_PATH2 + "/" + t.getName() + "_tdf.h");
+				headerDE = Header.getPrimitiveHeaderDE(t);
+				fw.write(headerDE);
+				codeDE = PrimitiveCode.getPrimitiveCodeDE(t);
+				fw.write(codeDE);
+				fw.close();
+			} catch (Exception ex) {
+				ex.printStackTrace();
+			}
+		}
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/ui/SysCAMSPanelTranslator.java b/src/main/java/ui/SysCAMSPanelTranslator.java
index c590afb21c4b313d4d822e5d689fc5487a6e0397..7a108e5dd3aa84991c5c795b3f05b9e507cd95bb 100644
--- a/src/main/java/ui/SysCAMSPanelTranslator.java
+++ b/src/main/java/ui/SysCAMSPanelTranslator.java
@@ -128,7 +128,7 @@ public class SysCAMSPanelTranslator {
 //				String typeTemplate = blockDE.getTypeTemplate();
 //				DefaultListModel<String> listTypedef = blockDE.getListTypedef();
 
-				SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, "", "", null, "", "", null, null);
+				SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, "", "", null, "", "", "", null, null);
 
 				List<SysCAMSPortDE> portsDE = blockDE.getAllInternalPortsDE();
 				for (int i = 0; i < portsDE.size(); i++) {
@@ -173,12 +173,14 @@ public class SysCAMSPanelTranslator {
                         timeBlock = "us";
                     }
 					String processCode = blockTDF.getProcessCode();
+                    String constructorCode = blockTDF.getConstructorCode();
 					DefaultListModel<String> listStruct = blockTDF.getListStruct();
 					String nameTemplate = blockTDF.getNameTemplate();
 					String typeTemplate = blockTDF.getTypeTemplate();
+                    String valueTemplate = blockTDF.getValueTemplate();
 					DefaultListModel<String> listTypedef = blockTDF.getListTypedef();
 
-					SysCAMSTBlockTDF syscamsBlockTDF = new SysCAMSTBlockTDF(blockTDFName, periodBlock, timeBlock, processCode, listStruct, nameTemplate, typeTemplate, listTypedef, syscamsCluster);				
+					SysCAMSTBlockTDF syscamsBlockTDF = new SysCAMSTBlockTDF(blockTDFName, periodBlock, timeBlock, processCode, constructorCode, listStruct, nameTemplate, typeTemplate, valueTemplate, listTypedef, syscamsCluster);				
 
 					List<SysCAMSPortTDF> portsTDF = blockTDF.getAllInternalPortsTDF();
 					for (int j = 0; j < portsTDF.size(); j++) {
@@ -241,9 +243,10 @@ public class SysCAMSPanelTranslator {
 					DefaultListModel<String> listStruct = blockDE.getListStruct();
 					String nameTemplate = blockDE.getNameTemplate();
 					String typeTemplate = blockDE.getTypeTemplate();
+                    String valueTemplate = blockDE.getValueTemplate();
 					DefaultListModel<String> listTypedef = blockDE.getListTypedef();
 
-					SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, nameFn, code, listStruct, nameTemplate, typeTemplate, listTypedef, syscamsCluster);
+					SysCAMSTBlockDE syscamsBlockDE = new SysCAMSTBlockDE(blockDEName, nameFn, code, listStruct, nameTemplate, typeTemplate, valueTemplate, listTypedef, syscamsCluster);
 
 					List<SysCAMSPortDE> portsDE = blockDE.getAllInternalPortsDE();
 					for (int j = 0; j < portsDE.size(); j++) {
diff --git a/src/main/java/ui/TGConnector.java b/src/main/java/ui/TGConnector.java
index 7c32074a4a0ca4763f84088d46ac23fc187c8b8a..cb2c5ca63f8a650c73624ffc491ffc49b7ff01cb 100644
--- a/src/main/java/ui/TGConnector.java
+++ b/src/main/java/ui/TGConnector.java
@@ -217,9 +217,7 @@ public abstract class TGConnector extends TGCScalableWithInternalComponent {
             
             drawLastSegment(g, p4.getX(), p4.getY(), p2.getX(), p2.getY());
         } else {
-        	if (p1!=null && p2!=null){
-	            drawLastSegment(g, p1.getX(), p1.getY(), p2.getX(), p2.getY());
-	    	}
+            drawLastSegment(g, p1.getX(), p1.getY(), p2.getX(), p2.getY());
         }
     }
 
@@ -605,7 +603,7 @@ public abstract class TGConnector extends TGCScalableWithInternalComponent {
             }
 
         } else {
-            if (p2 != null && p1!=null) {
+            if (p2 != null) {
                 if ((int)(Line2D.ptSegDistSq(p1.getX(), p1.getY(), p2.getX(), p2.getY(), x1, y1)) < distanceSelected) {
                     return this;
                 }
@@ -727,9 +725,8 @@ public abstract class TGConnector extends TGCScalableWithInternalComponent {
 
     }
 
-
     @Override
-    public StringBuffer saveInXML(boolean saveSubComponents, boolean saveAsComponentEvenIfNonNullFather) {
+    public StringBuffer saveInXML() {
         StringBuffer sb = new StringBuffer(XML_CONNECTOR_HEAD);
         sb.append(getType());
         sb.append(XML_ID);
@@ -756,11 +753,8 @@ public abstract class TGConnector extends TGCScalableWithInternalComponent {
     }
 
     public String translateP1() {
-    	if (p1!=null){
-        	int id = p1.getId();
-	        return ("<P1  x=\"" + p1.getX() + "\" y=\"" + p1.getY() + "\" id=\"" + id + "\" />\n");
-	    }
-	    return "";
+        int id = p1.getId();
+        return ("<P1  x=\"" + p1.getX() + "\" y=\"" + p1.getY() + "\" id=\"" + id + "\" />\n");
     }
 
     public String translateP2() {
diff --git a/src/main/java/ui/syscams/SysCAMSBlockDE.java b/src/main/java/ui/syscams/SysCAMSBlockDE.java
index 257a643d49d4d124cc9fbab96b916fe0844ff821..df9f7ca4ceae1aa3600f5cba90d85292b4d598f8 100644
--- a/src/main/java/ui/syscams/SysCAMSBlockDE.java
+++ b/src/main/java/ui/syscams/SysCAMSBlockDE.java
@@ -67,6 +67,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 	private DefaultListModel<String> listStruct;
 	private String nameTemplate;
 	private String typeTemplate;
+    private String valueTemplate;
 	private DefaultListModel<String> listTypedef;
 
 	private int maxFontSize = 14;
@@ -114,6 +115,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 		setListStruct(new DefaultListModel<String>());
 		setNameTemplate("");
 		setTypeTemplate("");
+        setValueTemplate("");
 		setListTypedef(new DefaultListModel<String>());
 
 		myImageIcon = IconManager.imgic1202;
@@ -210,7 +212,8 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 					null,
 					getValue());
 			if ((s != null) && (s.length() > 0)) {
-				if (!TAttribute.isAValidId(s, false, false, false)) {
+			    //if (!TAttribute.isAValidId(s, false, false)) {//DG
+			    if (!TAttribute.isAValidId(s, false, false, false)) {
 					JOptionPane.showMessageDialog(frame,
 							"Could not change the name of the component: the new name is not a valid name",
 							"Error",
@@ -305,6 +308,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 		sb.append("\" listStruct=\"" + splitParameters(getListStruct()));
 		sb.append("\" nameTemplate=\"" + getNameTemplate());
 		sb.append("\" typeTemplate=\"" + getTypeTemplate());
+        sb.append("\" valueTemplate=\"" + getValueTemplate());
 		sb.append("\" listTypedef=\"" + splitParameters(getListTypedef()));
 		sb.append("\" />\n");
 		sb.append("</extraparam>\n");
@@ -430,7 +434,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 			Node n1, n2;
 			Element elt;
 
-			String code, nameFn, listStruct, nameTemplate, typeTemplate, listTypedef;
+			String code, nameFn, listStruct, nameTemplate, typeTemplate, valueTemplate, listTypedef;
 
 			for(int i=0; i<nl.getLength(); i++) {
 				n1 = nl.item(i);
@@ -448,6 +452,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 								listStruct = elt.getAttribute("listStruct");
 								nameTemplate = elt.getAttribute("nameTemplate");
 								typeTemplate = elt.getAttribute("typeTemplate");
+                                valueTemplate = elt.getAttribute("valueTemplate");
 								listTypedef = elt.getAttribute("listTypedef");
 //								setPeriod(period);
 //								setTime(time);
@@ -464,6 +469,7 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 								setListStruct(lista);
 								setNameTemplate(nameTemplate);
 								setTypeTemplate(typeTemplate);
+                                setValueTemplate(valueTemplate);
 								String[] splitb = listTypedef.split("\\|");
 								DefaultListModel<String> listb = new DefaultListModel<String>();
 								for (String s : splitb) {
@@ -574,6 +580,14 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 	public void setTypeTemplate(String _typeTemplate) {
 		typeTemplate = _typeTemplate;
 	}
+    
+    public String getValueTemplate() {
+        return valueTemplate;
+    }
+    
+    public void setValueTemplate(String _valueTemplate) {
+		valueTemplate = _valueTemplate;
+	}
 
 	public DefaultListModel<String> getListTypedef() {
 		return listTypedef;
@@ -582,4 +596,4 @@ public class SysCAMSBlockDE extends TGCScalableWithInternalComponent implements
 	public void setListTypedef(DefaultListModel<String> _listTypedef) {
 		listTypedef = _listTypedef;
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/syscams/SysCAMSBlockTDF.java b/src/main/java/ui/syscams/SysCAMSBlockTDF.java
index 65ca8ee7a047e18f41c5663ed3246520ec71a25f..d03e9bc7a419fec0f31f3823376addeca75213de 100644
--- a/src/main/java/ui/syscams/SysCAMSBlockTDF.java
+++ b/src/main/java/ui/syscams/SysCAMSBlockTDF.java
@@ -62,9 +62,11 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 	private double period;
 	private String time;
 	private String processCode;
+    private String constructorCode;
 	private DefaultListModel<String> listStruct;
 	private String nameTemplate;
 	private String typeTemplate;
+    private String valueTemplate;
 	private DefaultListModel<String> listTypedef;
 
 	private int maxFontSize = 14;
@@ -109,9 +111,11 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 		setPeriod(-1);
 		setTime("");
 		setProcessCode("void processing() {\n\n}");
+        setConstructorCode("");
 		setListStruct(new DefaultListModel<String>());
 		setNameTemplate("");
 		setTypeTemplate("");
+        setValueTemplate("");
 		setListTypedef(new DefaultListModel<String>());
 
 		myImageIcon = IconManager.imgic1202;
@@ -209,7 +213,8 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 					getValue());
 			if ((s != null) && (s.length() > 0)) {
 
-				if (!TAttribute.isAValidId(s, false, false, false)) {
+			    //if (!TAttribute.isAValidId(s, false, false)) {
+			    if (!TAttribute.isAValidId(s, false, false, false)) {
 					JOptionPane.showMessageDialog(frame,
 							"Could not change the name of the component: the new name is not a valid name",
 							"Error",
@@ -316,9 +321,11 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 		sb.append("<Attribute period=\"" + getPeriod());
 		sb.append("\" time=\"" + getTime());
 		sb.append("\" processCode=\"" + encode(getProcessCode()));
+        sb.append("\" constructorCode=\"" + encode(getConstructorCode()));
 		sb.append("\" listStruct=\"" + splitParameters(getListStruct()));
 		sb.append("\" nameTemplate=\"" + getNameTemplate());
 		sb.append("\" typeTemplate=\"" + getTypeTemplate());
+        sb.append("\" valueTemplate=\"" + getValueTemplate());
 		sb.append("\" listTypedef=\"" + splitParameters(getListTypedef()));
 		sb.append("\" />\n");
 		sb.append("</extraparam>\n");
@@ -448,7 +455,7 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 			Element elt;
 
 			double period;
-			String time, processCode, listStruct, nameTemplate, typeTemplate, listTypedef;
+			String time, processCode, constructorCode, listStruct, nameTemplate, typeTemplate, valueTemplate, listTypedef;
 
 			for(int i=0; i<nl.getLength(); i++) {
 				n1 = nl.item(i);
@@ -462,14 +469,18 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 								period = Double.valueOf(elt.getAttribute("period")).doubleValue();
 								time = elt.getAttribute("time");
 								processCode = elt.getAttribute("processCode");
+                                constructorCode = elt.getAttribute("constructorCode");
 								listStruct = elt.getAttribute("listStruct");
 								nameTemplate = elt.getAttribute("nameTemplate");
 								typeTemplate = elt.getAttribute("typeTemplate");
+                                valueTemplate = elt.getAttribute("valueTemplate");
 								listTypedef = elt.getAttribute("listTypedef");
 								setPeriod(period);
 								setTime(time);
 								processCode = decode(processCode).toString();
 								setProcessCode(processCode);
+                                constructorCode = decode(constructorCode).toString();
+                                setConstructorCode(constructorCode);
 								String[] splita = listStruct.split("\\|");
 								DefaultListModel<String> lista = new DefaultListModel<String>();
 								for (String s : splita) {
@@ -480,6 +491,7 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 								setListStruct(lista);
 								setNameTemplate(nameTemplate);
 								setTypeTemplate(typeTemplate);
+                                setValueTemplate(valueTemplate);
 								String[] splitb = listTypedef.split("\\|");
 								DefaultListModel<String> listb = new DefaultListModel<String>();
 								for (String s : splitb) {
@@ -591,6 +603,14 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 	public void setProcessCode(String _processCode) {
 		processCode = _processCode;
 	}
+
+    public String getConstructorCode() {
+		return constructorCode;
+	}
+    
+    public void setConstructorCode(String _constructorCode) {
+		constructorCode = _constructorCode;
+	}
 	
 	public DefaultListModel<String> getListStruct() {
 		return listStruct;
@@ -607,7 +627,7 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 	public void setNameTemplate(String _nameTemplate) {
 		nameTemplate = _nameTemplate;
 	}
-
+    
 	public String getTypeTemplate() {
 		return typeTemplate;
 	}
@@ -615,6 +635,14 @@ public class SysCAMSBlockTDF extends TGCScalableWithInternalComponent implements
 	public void setTypeTemplate(String _typeTemplate) {
 		typeTemplate = _typeTemplate;
 	}
+    
+    public String getValueTemplate() {
+        return valueTemplate;
+    }
+    
+    public void setValueTemplate(String _valueTemplate) {
+		valueTemplate = _valueTemplate;
+	}
 
 	public DefaultListModel<String> getListTypedef() {
 		return listTypedef;
diff --git a/src/main/java/ui/syscams/SysCAMSCompositeComponent.java b/src/main/java/ui/syscams/SysCAMSCompositeComponent.java
index b90006b1522b2b9d33e6b50c36327d4e31f4f8e5..d68014a44929b37fbf5fa3d985047fdb933bf9ea 100644
--- a/src/main/java/ui/syscams/SysCAMSCompositeComponent.java
+++ b/src/main/java/ui/syscams/SysCAMSCompositeComponent.java
@@ -170,7 +170,8 @@ public class SysCAMSCompositeComponent extends TGCScalableWithInternalComponent
         null,
         getValue());
         if ((s != null) && (s.length() > 0)) {
-			if (!TAttribute.isAValidId(s, false, false, false)) {
+	    //if (!TAttribute.isAValidId(s, false, false)) {//DG
+	    if (!TAttribute.isAValidId(s, false, false, false)) {
 				JOptionPane.showMessageDialog(frame,
 					"Could not change the name of the component: the new name is not a valid name",
 					"Error",
@@ -410,4 +411,4 @@ public class SysCAMSCompositeComponent extends TGCScalableWithInternalComponent
     	}
     	return false;
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogSelectSysCAMSComponent.java b/src/main/java/ui/window/JDialogSelectSysCAMSComponent.java
index ac3c8ab3b30744310a7044834f06b045b56e521b..92443e49dc7106d60c103a708bb4fcbd4fd3a163 100644
--- a/src/main/java/ui/window/JDialogSelectSysCAMSComponent.java
+++ b/src/main/java/ui/window/JDialogSelectSysCAMSComponent.java
@@ -81,7 +81,7 @@ public class JDialogSelectSysCAMSComponent extends JDialogBase implements Action
     private JButton allIgnored;
     protected JCheckBox optimize;
 
-    /* Creates new form  */
+    /** Creates new form  */
     public JDialogSelectSysCAMSComponent(Frame f, Vector<TGComponent> _back, List<TGComponent> componentList, String title) {
         super(f, title, true);
 
@@ -132,7 +132,7 @@ public class JDialogSelectSysCAMSComponent extends JDialogBase implements Action
 
         for(int i=0; i<list.size(); i++) {
             tgc = list.get(i);
-            //
+            //
             if (tgc instanceof SysCAMSBlockTDF) {
                 v.addElement(tgc);
             }
@@ -164,7 +164,7 @@ public class JDialogSelectSysCAMSComponent extends JDialogBase implements Action
             
             if (((tgc instanceof SysCAMSBlockTDF) || (tgc instanceof SysCAMSBlockDE)) && (!added.contains(tgc)) && (!notSource.contains(tgc))){
                 added.addElement( tgc ) ;
-                //
+                //
             }
         }
     }
diff --git a/src/main/java/ui/window/JDialogSysCAMSBlockDE.java b/src/main/java/ui/window/JDialogSysCAMSBlockDE.java
index 6096eb29035e5b2ca4cd28d8ee7428f9356ef071..516e328e0ab4bb4c446e5cf7e5d9f7c539c64850 100644
--- a/src/main/java/ui/window/JDialogSysCAMSBlockDE.java
+++ b/src/main/java/ui/window/JDialogSysCAMSBlockDE.java
@@ -75,6 +75,7 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
 	private DefaultListModel<String> structListModel;
 	private boolean structBool = false;
 	private JTextField nameTemplateTextField;
+    private JTextField valueTemplateTextField;
 	private String listTypeTemplateString[];
 	private JComboBox<String> typeTemplateComboBoxString;
 	private JTextField nameTypedefTextField;
@@ -394,15 +395,35 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
 					new Insets(5, 10, 5, 10), 0, 0);
 			templateGridBag.setConstraints(nameTemplateTextField, templateConstraint);
 			templatePanel.add(nameTemplateTextField);
+            
+            //CHANGES
+            JLabel egalTemplateLabel = new JLabel("=");
+            templateConstraint = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+                    new Insets(5, 10, 5, 10), 0, 0);
+            templateGridBag.setConstraints(egalTemplateLabel, templateConstraint);
+            templatePanel.add(egalTemplateLabel);
+
+            JLabel valueTemplateLabel = new JLabel("value");
+            templateConstraint = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+                    new Insets(5, 10, 5, 10), 0, 0);
+            templateGridBag.setConstraints(valueTemplateLabel, templateConstraint);
+            templatePanel.add(valueTemplateLabel);
+
+            valueTemplateTextField = new JTextField(block.getValueTemplate());
+            templateConstraint = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+                    new Insets(5, 10, 5, 10), 0, 0);
+            templateGridBag.setConstraints(valueTemplateTextField, templateConstraint);
+            templatePanel.add(valueTemplateTextField);
+            //CHANGES
 
 			JLabel pointsTemplateLabel = new JLabel(":");
-			templateConstraint = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+			templateConstraint = new GridBagConstraints(3, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
 					new Insets(5, 10, 5, 10), 0, 0);
 			templateGridBag.setConstraints(pointsTemplateLabel, templateConstraint);
 			templatePanel.add(pointsTemplateLabel);
 
 			JLabel typeTemplateLabel = new JLabel("type");
-			templateConstraint = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+			templateConstraint = new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
 					new Insets(5, 10, 5, 10), 0, 0);
 			templateGridBag.setConstraints(typeTemplateLabel, templateConstraint);
 			templatePanel.add(typeTemplateLabel);
@@ -414,7 +435,7 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
 				typeTemplateComboBoxString.setSelectedIndex(0);
 			}
 			typeTemplateComboBoxString.addActionListener(this);
-			templateConstraint = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+			templateConstraint = new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
 					new Insets(5, 10, 5, 10), 0, 0);
 			templateGridBag.setConstraints(typeTemplateComboBoxString, templateConstraint);
 			templatePanel.add(typeTemplateComboBoxString);
@@ -1005,8 +1026,8 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
 				block.setListStruct(structListModel);
 				block.setNameTemplate(nameTemplateTextField.getText());
 				block.setTypeTemplate((String) typeTemplateComboBoxString.getSelectedItem());
+                block.setValueTemplate(valueTemplateTextField.getText());
 				block.setListTypedef(typedefListModel);
-				
 				block.setNameFn(nameFnTextField.getText());
 				block.setCode(codeTextArea.getText());
 			}
@@ -1111,4 +1132,4 @@ public class JDialogSysCAMSBlockDE extends JDialog implements ActionListener, Li
 			}
 		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java b/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java
index 1a05043233513cbe84c1a4aa608859044baf3ef6..6073e921f05c96170da504af6bb03267dcefb5b7 100644
--- a/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java
+++ b/src/main/java/ui/window/JDialogSysCAMSBlockTDF.java
@@ -74,6 +74,7 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 	private DefaultListModel<String> structListModel;
 	private boolean structBool = false;
 	private JTextField nameTemplateTextField;
+    private JTextField valueTemplateTextField;
 	private String listTypeTemplateString[];
 	private JComboBox<String> typeTemplateComboBoxString;
 	private JTextField nameTypedefTextField;
@@ -89,6 +90,7 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 
 	private JTextArea processCodeTextArea;
 	private String finalString;
+    private JTextArea constructorCodeTextArea;
 
 	private SysCAMSBlockTDF block;
 
@@ -190,9 +192,11 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 		JPanel attributesMainPanel = new JPanel();
 		JPanel parametersMainPanel = new JPanel();
 		JPanel processMainPanel = new JPanel();
+        JPanel contructorMainPanel = new JPanel();
 		tabbedPane.add("Attributes", attributesMainPanel);
 		tabbedPane.add("Parameters", parametersMainPanel);
 		tabbedPane.add("Process Code", processMainPanel);
+        tabbedPane.add("Contructor Code", contructorMainPanel);
 
 		mainPanel.add(tabbedPane, BorderLayout.NORTH); 
 
@@ -387,15 +391,35 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 				new Insets(5, 10, 5, 10), 0, 0);
 		templateGridBag.setConstraints(nameTemplateTextField, templateConstraint);
 		templatePanel.add(nameTemplateTextField);
+        
+        //CHANGES
+        JLabel egalTemplateLabel = new JLabel("=");
+		templateConstraint = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+				new Insets(5, 10, 5, 10), 0, 0);
+		templateGridBag.setConstraints(egalTemplateLabel, templateConstraint);
+		templatePanel.add(egalTemplateLabel);
+
+		JLabel valueTemplateLabel = new JLabel("value");
+		templateConstraint = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+				new Insets(5, 10, 5, 10), 0, 0);
+		templateGridBag.setConstraints(valueTemplateLabel, templateConstraint);
+		templatePanel.add(valueTemplateLabel);
+
+		valueTemplateTextField = new JTextField(block.getValueTemplate());
+		templateConstraint = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+				new Insets(5, 10, 5, 10), 0, 0);
+		templateGridBag.setConstraints(valueTemplateTextField, templateConstraint);
+		templatePanel.add(valueTemplateTextField);
+        //CHANGES
 
 		JLabel pointsTemplateLabel = new JLabel(":");
-		templateConstraint = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+		templateConstraint = new GridBagConstraints(3, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
 				new Insets(5, 10, 5, 10), 0, 0);
 		templateGridBag.setConstraints(pointsTemplateLabel, templateConstraint);
 		templatePanel.add(pointsTemplateLabel);
 
 		JLabel typeTemplateLabel = new JLabel("type");
-		templateConstraint = new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+		templateConstraint = new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
 				new Insets(5, 10, 5, 10), 0, 0);
 		templateGridBag.setConstraints(typeTemplateLabel, templateConstraint);
 		templatePanel.add(typeTemplateLabel);
@@ -407,7 +431,7 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 			typeTemplateComboBoxString.setSelectedIndex(0);
 		}
 		typeTemplateComboBoxString.addActionListener(this);
-		templateConstraint = new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
+		templateConstraint = new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
 				new Insets(5, 10, 5, 10), 0, 0);
 		templateGridBag.setConstraints(typeTemplateComboBoxString, templateConstraint);
 		templatePanel.add(typeTemplateComboBoxString);
@@ -608,7 +632,39 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 
 		codeBox.add(codeBoxPanel);
 		processMainPanel.add(codeBox, BorderLayout.PAGE_START);
-
+        
+        // --- ContructorCode --- //
+        contructorMainPanel.setLayout(new BorderLayout());
+
+		Box codeBox2 = Box.createVerticalBox();
+		codeBox2.setBorder(BorderFactory.createTitledBorder("Contructor code of TDF block"));
+
+		JPanel codeBoxPanel2 = new JPanel(new BorderLayout());
+        
+        //StringBuffer stringbuf2 = encode(block.getConstructorCode());
+		//String beginString2 = stringbuf2.toString();
+		//finalString = beginString2.replaceAll("\t}", "}");
+        finalString = block.getConstructorCode();
+
+		constructorCodeTextArea = new JTextArea(finalString);
+		constructorCodeTextArea.setSize(100, 100);
+		constructorCodeTextArea.setTabSize(2);
+
+		constructorCodeTextArea.setFont(new Font("Arial", Font.PLAIN, 16));
+		constructorCodeTextArea.setLineWrap(true);
+		constructorCodeTextArea.setWrapStyleWord(true);
+
+		JScrollPane constructorScrollPane = new JScrollPane(constructorCodeTextArea);
+		constructorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+		constructorScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+		constructorScrollPane.setPreferredSize(new Dimension(200, 300));
+		constructorScrollPane.setBorder(new EmptyBorder(15, 10, 15, 10));
+
+		codeBoxPanel2.add(constructorScrollPane, BorderLayout.SOUTH);
+
+		codeBox2.add(codeBoxPanel2);
+		contructorMainPanel.add(codeBox2, BorderLayout.PAGE_START);
+        
 		// --- Button --- //
 		JPanel downPanel = new JPanel(new FlowLayout());
 
@@ -954,9 +1010,11 @@ public class JDialogSysCAMSBlockTDF extends JDialog implements ActionListener, L
 			}
 
 			block.setProcessCode(processCodeTextArea.getText());
+            block.setConstructorCode(constructorCodeTextArea.getText());
 			block.setListStruct(structListModel);
 			block.setNameTemplate(nameTemplateTextField.getText());
 			block.setTypeTemplate((String) typeTemplateComboBoxString.getSelectedItem());
+            block.setValueTemplate(valueTemplateTextField.getText());
 			block.setListTypedef(typedefListModel);
 
 			this.dispose();
diff --git a/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java b/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java
index c5c80dd0739270ae2bfee31a50ececaca37d6352..761a9fc1df887ce4d150af1419442c1342fef990 100644
--- a/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java
+++ b/src/main/java/ui/window/JDialogSysCAMSExecutableCodeGeneration.java
@@ -520,13 +520,9 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                     } else {
                         jta.append("\nPerforming Validation for \""+(syscalsspec.getCluster()).getClusterName()+"\".\n");
                         LinkedList<SysCAMSTConnector> connectors = syscalsspec.getAllConnectorsCluster4Matrix();
-                        System.out.printf("Connectors4matrix for 1 cluster = %d.\n", connectors.size());
                         LinkedList<SysCAMSTBlockTDF> tdfBlocks = syscalsspec.getAllBlockTDF();
-                        System.out.printf("Blocks for 1 cluster = %d.\n", tdfBlocks.size());
                         LinkedList<SysCAMSTConnector> connectorsTdfDe = syscalsspec.getAllConnectorsTdfDe();
-                        System.out.printf("ConnectorsTdfDe for 1 cluster = %d.\n", connectorsTdfDe.size());
-                        LinkedList<SysCAMSTConnector> allConnectors = syscalsspec.getAllConnectorsCluster4Soclib();
-                        System.out.printf("All Connectors for 1 cluster = %d.\n", allConnectors.size());
+                        LinkedList<SysCAMSTConnector> allConnectors = syscalsspec.getAllConnectors();
                         LinkedList<SysCAMSTBlockDE> deBlocks = syscalsspec.getAllBlockDE();
                         LinkedList<SysCAMSTBlockGPIO2VCI> gpioBlocks = syscalsspec.getAllBlockGPIO2VCI();
                         //Validate that all ports are connected
@@ -577,53 +573,140 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                         //Validate Block parameters (rate, Tp, Tm, Delay) and propagate timesteps to all blocks
                         //try {
                             propagateTimestep(connectorsTdfDe, tdfBlocks);
-                        
-                            //TODO-DELETE THIS, after debugging:
-                            for(SysCAMSTBlockTDF tdfBlock : tdfBlocks) {
-                                System.out.println("params of Block: " +tdfBlock.getName());
-                                System.out.println("Tm: " + tdfBlock.getPeriod());
-                                for(SysCAMSTPortTDF portTdf : tdfBlock.getPortTDF()) {
-                                    System.out.println("Port: " + portTdf.getName());
-                                    System.out.println("Tp: " + portTdf.getPeriod());
-                                    System.out.println("Rate: " + portTdf.getRate());
-                                    System.out.println("Delay: " + portTdf.getDelay());
-                                }
-                                
-                                for(SysCAMSTPortConverter portConverter : tdfBlock.getPortConverter()) {
-                                    System.out.println("Port: " + portConverter.getName());
-                                    System.out.println("Tp: " + portConverter.getPeriod());
-                                    System.out.println("Rate: " + portConverter.getRate());
-                                    System.out.println("Delay: " + portConverter.getDelay());
+                            if(tdfBlocks.size() == 1) {
+                                if(connectors.size() > 0) { //Case when self-loops exist.
+                                    for(int i = 0; i < connectors.size(); i++) {
+                                        if( (((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() + ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay()) < ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getRate() ) {
+                                            jta.append("Static schedule can not be computed due to missing delays in loops.\n");
+                                            jta.append("The following delays are suggested:\n");
+                                            jta.append("In Port: \"" + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getName() + "\". Insert delay of " + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getRate() + "\n");
+                                        }
+                                        
+                                    }
+                                    if(allConnectors.size() > 0) { //Case when connections to DE exist.
+                                        boolean recompute = false;
+                                        boolean suggest_delays = false;
+                                        double[] time_prev = {0.0, 0.0}; //array to store "in" ([0]) and "out" ([1]) previous times
+                                        do{
+                                            try {
+                                                for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
+                                                    tdfBlock.syncTDFBlockDEBlock(time_prev);
+                                                }
+                                                recompute = false;
+                                                
+                                            } catch (SysCAMSValidateException se) {
+                                                recompute = true;
+                                                suggest_delays = true;
+                                                //System.out.println("Causality exception: " + se.getMessage());
+                                            }
+                                        } while (recompute);
+                                        if(suggest_delays){
+                                            jta.append("The following delays are suggested to solve synchronization issues between DE and TDF modules:\n");
+                                            for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
+                                                for(SysCAMSTPortConverter portConverter : tdfBlock.getPortConverter()) {
+                                                    if(portConverter.getRecompute()){
+                                                        jta.append("In Block: \"" + tdfBlock.getName() + "\". Port: \"" + portConverter.getName() + "\". Insert delay of " + portConverter.getDelay() + "\n");
+                                                    }
+                                                }
+                                            }
+                                        }
+                                    }
+                                } else if(allConnectors.size() > 0) { //Case when connections to DE exist - no self-loops
+                                    boolean recompute = false;
+                                    boolean suggest_delays = false;
+                                    double[] time_prev = {0.0, 0.0}; //array to store "in" ([0]) and "out" ([1]) previous times
+                                    do{
+                                        try {
+                                            for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
+                                                tdfBlock.syncTDFBlockDEBlock(time_prev);
+                                            }
+                                            recompute = false;
+                                            
+                                        } catch (SysCAMSValidateException se) {
+                                            recompute = true;
+                                            suggest_delays = true;
+                                            //System.out.println("Causality exception: " + se.getMessage());
+                                        }
+                                    } while (recompute);
+                                    if(suggest_delays){
+                                        jta.append("The following delays are suggested to solve synchronization issues between DE and TDF modules:\n");
+                                        for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
+                                            for(SysCAMSTPortConverter portConverter : tdfBlock.getPortConverter()) {
+                                                if(portConverter.getRecompute()){
+                                                    jta.append("In Block: \"" + tdfBlock.getName() + "\". Port: \"" + portConverter.getName() + "\". Insert delay of " + portConverter.getDelay() + "\n");
+                                                }
+                                            }
+                                        }
+                                    }
                                 }
-                            }
-                            
-                            //TODO: verify trivial case when only 1 block and no connectors. 
-                            if(connectors.size() > 0) {
-                                boolean recompute = false;
+                            } else if(connectors.size() > 0) { //Case for more than 1 TDF block.
+                                boolean[] recompute = {false, false};   //[0]-for sync issues [1]-for loop delays
                                 boolean suggest_delays = false;
+                                boolean suggest_delays_loops = false;
+                                SysCAMSTPortTDF tdfPort1;
+                                SysCAMSTPortTDF tdfPort2;
                                 RealVector buffer = new ArrayRealVector(connectors.size());
                                 RealVectorFormat printFormat = new RealVectorFormat();
                                 RealMatrix topologyMatrix = buildTopologyMatrix(connectors, tdfBlocks, buffer);
-                                System.out.println("Buffer after topMatrix is: " + printFormat.format(buffer) );
-                                //try {
                                 RealVector execRate = solveTopologyMatrix(topologyMatrix, tdfBlocks);
-                                //TODO: to recompute missing delays in loops: modify buffer with the suggested delay, and loop.
                                 do {
                                     recompute = computeSchedule(execRate, topologyMatrix, buffer, tdfBlocks, connectors);
-                                    if(recompute)
+                                    if(recompute[0])
                                         suggest_delays = true;
-                                } while (recompute);
-                                if(suggest_delays){
+                                    if(recompute[1]) {
+                                        RealVector bufferLoopDelays = new ArrayRealVector(connectors.size());
+                                        bufferLoopDelays = rebuildBuffer(connectors, tdfBlocks, bufferLoopDelays);
+                                        buffer = bufferLoopDelays.copy();
+                                        suggest_delays_loops = true;
+                                    }
+                                } while (recompute[0] || recompute[1]);
+                                
+                                if(suggest_delays_loops) {
+                                    jta.append("Static schedule can not be computed due to missing delays in loops.\n");
+                                    jta.append("The following delays are suggested:\n");
+                                    for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
+                                        for(SysCAMSTPortTDF tdfPort : tdfBlock.getPortTDF()) {
+                                            if(tdfPort.getRecompute()){
+                                                jta.append("In Block: \"" + tdfBlock.getName() + "\". Port: \"" + tdfPort.getName() + "\". Insert delay of " + tdfPort.getDelay() + "\n");
+                                            }
+                                        }
+                                        for(int j = 0; j < connectors.size(); j++) {
+                                            tdfPort1 = ((SysCAMSTPortTDF) connectors.get(j).get_p1().getComponent());
+                                            tdfPort2 = ((SysCAMSTPortTDF) connectors.get(j).get_p2().getComponent());
+                                            if( tdfPort1.getBlockTDF().getName().equals(tdfBlock.getName()) && tdfPort2.getBlockTDF().getName().equals(tdfBlock.getName()) ) {
+                                                if( (tdfPort1.getDelay() + tdfPort2.getDelay()) < tdfPort1.getRate() ) {
+                                                    jta.append("In Block: \"" + tdfBlock.getName() + "\". Port: \"" + tdfPort1.getName() + "\". Insert delay of " + tdfPort1.getRate() + "\n");
+                                                }
+                                            }
+                                        }
+                                    }
+                                } else {
+                                    for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
+                                        for(int j = 0; j < connectors.size(); j++) {
+                                            tdfPort1 = ((SysCAMSTPortTDF) connectors.get(j).get_p1().getComponent());
+                                            tdfPort2 = ((SysCAMSTPortTDF) connectors.get(j).get_p2().getComponent());
+                                            if( tdfPort1.getBlockTDF().getName().equals(tdfBlock.getName()) && tdfPort2.getBlockTDF().getName().equals(tdfBlock.getName()) ) {
+                                                if( (tdfPort1.getDelay() + tdfPort2.getDelay()) < tdfPort1.getRate() ) {
+                                                    jta.append("Static schedule can not be computed due to missing delays in loops.\n");
+                                                    jta.append("The following delays are suggested:\n");
+                                                    jta.append("In Block: \"" + tdfBlock.getName() + "\". Port: \"" + tdfPort1.getName() + "\". Insert delay of " + tdfPort1.getRate() + "\n");
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                                
+                                if(suggest_delays) {
                                     jta.append("The following delays are suggested to solve synchronization issues between DE and TDF modules:\n");
                                     for(SysCAMSTBlockTDF tdfBlock : tdfBlocks){
                                         for(SysCAMSTPortConverter portConverter : tdfBlock.getPortConverter()) {
-                                            if(portConverter.getRecompute()){
+                                            if(portConverter.getRecompute()) {
                                                 jta.append("In Block: \"" + tdfBlock.getName() + "\". Port: \"" + portConverter.getName() + "\". Insert delay of " + portConverter.getDelay() + "\n");
                                             }
                                         }
                                     }
                                 }
-                            }
+                            } 
                             jta.append("Validation for \""+(syscalsspec.getCluster()).getClusterName()+"\" completed.\n");
                         } catch (InterruptedException ie) {
                             System.err.println("Interrupted");
@@ -631,7 +714,6 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                             mode = STOPPED;
                             setButtons();
                             hasError = true;
-                            //return;
                         } catch (Exception e) {
                             e.printStackTrace();
                             mode = STOPPED;
@@ -675,7 +757,7 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                 			System.err.println("Saving SysCAMS code in files\n");
                 			pathCode = code2.getText();
 
-                			System.err.println("SYSCAMS TOPCELL : " + syscalsspec.getCluster().getClusterName() + "saved in " + code2.getText());
+                			System.err.println("SYSCAMS TOPCELL : " + syscalsspec.getCluster().getClusterName() + " saved in " + code2.getText());
                 			topCellGenerator.saveFile(pathCode);
                             topCellGeneratorCluster.saveFile(pathCode);
 
@@ -909,7 +991,7 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                 }
             }
         }
-        jta.append("Error: At least one Module or Port Timestep should be entered in at least one TDF block of this cluster.\n");
+        jta.append("Error: At least one Module Timestep or Port Timestep should be entered in at least one TDF block of this cluster.\n");
         throw new InterruptedException(); 
     }
     
@@ -941,7 +1023,7 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
             if(tp > 0) {
                 //validate timestep consistency (rate*tp == tm)
                 if(rate*tp != tm){
-                    jta.append("Error: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with timestep Tp of port \"" + tdfPort.getName()+"\".\n");
+                    jta.append("Error while propagating Timesteps: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with Rate or timestep Tp of port \"" + tdfPort.getName()+"\".\n");
                     return false;
                 }
             } else {
@@ -962,8 +1044,8 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                         } else {
                             //validate timestep consitency between 2 ports.
                             if(p2_tdfPort.getPeriod() != tp) {
-                                jta.append("Error: In block \""+tdfBlock.getName()+"\" Timestep Tp of port \"" +tdfPort.getName()
-                               + "\" is inconsistent with timestep Tp of port \"" + p2_tdfPort.getName()+"\" from block \""+p2_tdfPort.getBlockTDF().getName()+"\".\n");
+                                jta.append("Error while propagating Timesteps: In block \""+tdfBlock.getName()+"\" Rate or Timestep Tp of port \"" +tdfPort.getName()
+                               + "\" is inconsistent with Rate or timestep Tp of port \"" + p2_tdfPort.getName()+"\" from block \""+p2_tdfPort.getBlockTDF().getName()+"\".\n");
                                 return false;
                             }
                             //if connected block was not visited yet, then propagate timestep
@@ -982,8 +1064,8 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                         } else {
                             //validate timestep consitency between 2 ports.
                             if(p1_tdfPort.getPeriod() != tp) {
-                               jta.append("Error: In block \""+tdfBlock.getName()+"\" Timestep Tp of port \"" +tdfPort.getName()
-                               + "\" is inconsistent with timestep Tp of port \"" + p1_tdfPort.getName()+"\" from block \""+p1_tdfPort.getBlockTDF().getName()+"\".\n");
+                               jta.append("Error while propagating Timesteps: In block \""+tdfBlock.getName()+"\" Rate or Timestep Tp of port \"" +tdfPort.getName()
+                               + "\" is inconsistent with Rate or timestep Tp of port \"" + p1_tdfPort.getName()+"\" from block \""+p1_tdfPort.getBlockTDF().getName()+"\".\n");
                                return false;
                             }
                             //if connected block was not visited yet, then propagate timestep
@@ -1004,7 +1086,7 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
            if(tp > 0) {
                //validate timestep consistency (rate*tp == tm)
                if(rate*tp != tm){
-                   jta.append("Error: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with timestep Tp of port \"" + converterPort.getName()+"\".\n");
+                   jta.append("Error while propagating Timesteps: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with Rate or timestep Tp of port \"" + converterPort.getName()+"\".\n");
                    return false;
                }
            } else {
@@ -1029,7 +1111,7 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
         int rate = tdfPort.getRate();
         if(tm > 0) {
             if(rate*tp != tm) {
-                jta.append("Error: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with timestep Tp of port \"" + tdfPort.getName()+"\".\n");
+                jta.append("Error while propagating Timesteps: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with Rate or timestep Tp of port \"" + tdfPort.getName()+"\".\n");
                 return false;
             } 
         } else {
@@ -1046,7 +1128,7 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
         int rate = converterPort.getRate();
         if(tm > 0) {
             if(rate*tp != tm) {
-                jta.append("Error: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with timestep Tp of port \"" + converterPort.getName()+"\".\n");
+                jta.append("Error while propagating Timesteps: In block \""+tdfBlock.getName()+ "\" Timestep Tm is inconsistent with Rate or timestep Tp of port \"" + converterPort.getName()+"\".\n");
                 return false;
             } 
         } else {
@@ -1061,14 +1143,21 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
         double [][] tArray = new double[connectors.size()][blocks.size()];
         for(int i = 0; i < connectors.size(); i++) {
             for(int j = 0; j < blocks.size(); j++) {
-                if( ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) ) {
-                    System.out.println("Inserting in : "+ i + " " + j + " From port: "+ ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getName() +" Rate: " + ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getRate() );
+                if( ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) &&
+                ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) ) {
+                    tArray[i][j] = ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getRate() - ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getRate() ;
+                    if(((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() > 0) {
+                        buffer.addToEntry(i, ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() ); 
+                    }
+                    if(((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay() > 0) {
+                        buffer.addToEntry(i, ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay() );
+                    }
+                } else if( ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) ) {
                     tArray[i][j] = ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getRate();
                     if(((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() > 0) {
                         buffer.addToEntry(i, ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() ); 
                     }
                 } else if( ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) ) {
-                    System.out.println("Inserting in : "+ i + " " + j + " From port: "+ ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getName() +" Rate: " + -((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getRate() );
                     tArray[i][j] = -((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getRate();
                     if(((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay() > 0) {
                         buffer.addToEntry(i, ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay() );
@@ -1076,14 +1165,27 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                 }
             }
         }
-        
-        //double[][] tArray = { { 2, -1, 0 }, { 0, 2, -4 }, { -1, 0, 1 } };
-        //double[][] tArray = { { 2, 3, 5 }, { -4, 2, 3} };
-        //double[][] tArray = { { 3, -2, 0, 0 }, { 0, 4, 0, -3 }, { 0, 1, -3, 0 }, { -1, 0, 2, 0 }, { -2, 0, 0, 1 } };
-        //double[][] tArray = { { 3, -2 } };
         RealMatrix tMatrix = new Array2DRowRealMatrix(tArray);
         return tMatrix;
     }
+    
+    public RealVector rebuildBuffer(LinkedList<SysCAMSTConnector> connectors, LinkedList<SysCAMSTBlockTDF> blocks, RealVector buffer) {
+        for(int i = 0; i < connectors.size(); i++) {
+            for(int j = 0; j < blocks.size(); j++) {
+                if( ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) ) {
+                    if(((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() > 0) {
+                        buffer.addToEntry(i, ((SysCAMSTPortTDF) connectors.get(i).get_p1().getComponent()).getDelay() ); 
+                    }
+                } else if( ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getBlockTDF().getName().equals(blocks.get(j).getName()) ) {
+                    if(((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay() > 0) {
+                        buffer.addToEntry(i, ((SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent()).getDelay() );
+                    }
+                }
+            }
+        }
+        
+        return buffer;
+    }
 
     public RealVector solveTopologyMatrix(RealMatrix matrixA, LinkedList<SysCAMSTBlockTDF> blocks) throws InterruptedException {
         double dropThreshold = 1e-7;
@@ -1094,55 +1196,44 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
         int rank = qr.getRank(dropThreshold);
         if(rank != blocks.size()-1){
             jta.append("Error: Port sample rates are inconsistent. Topology matrix can not be solved.\n");
-            System.err.println("Port sample rates are inconsistent. Topology matrix can not be solved. Rank: " +rank+" != #blocks-1");
             throw new InterruptedException(); 
         }
-        System.out.println("Checking kernel columns ...");
         RealMatrix zMatrix = matrixA.multiply(qMatrix);
-        for (int c = rank; c < matrixA.getColumnDimension(); c++) {
-            System.out.printf("The product of A with column %d of Q has sup "
-                            + "norm %f.\n",
-                            c, zMatrix.getColumnMatrix(c).getNorm());
-            //TODO: verify if norm is not zero, throw error that kernel could not be found.              
-        }
-        
         RealMatrix kernelMatrix = qMatrix.getSubMatrix( 0, qMatrix.getRowDimension()-1, rank, qMatrix.getColumnDimension()-1 );
         double[] resultArray = new double[kernelMatrix.getRowDimension()];
         double result_tmp = 0.0;
         int v_lcm = 1;
         BigFraction[] resultFractionArray = new BigFraction[kernelMatrix.getRowDimension()];
         for (int i = 0; i < kernelMatrix.getRowDimension(); i++) {
-            System.out.printf("The kernelMatrix is %f .\n", kernelMatrix.getEntry(i, 0) );
             resultArray[i] = kernelMatrix.getEntry(i, 0) / kernelMatrix.getEntry(kernelMatrix.getRowDimension()-1, 0);
             result_tmp = kernelMatrix.getEntry(i, 0) / kernelMatrix.getEntry(kernelMatrix.getRowDimension()-1, 0);
             resultFractionArray[i] = new BigFraction(result_tmp, 2147483647);
-            System.out.println("The resultArray is: "+ resultArray[i] + ", result_tmp: " + result_tmp);
-            System.out.println("The resultFractionArray is: "+ resultFractionArray[i].toString() + " with num: " + resultFractionArray[i].getNumeratorAsInt() + " and denom: "+ resultFractionArray[i].getDenominatorAsInt()
-            + " and given as a double: " + resultFractionArray[i].doubleValue());
             v_lcm = ArithmeticUtils.lcm(resultFractionArray[i].getDenominatorAsInt() , v_lcm);
-            System.out.println("The lcm is: "+ v_lcm );
         }
         int[] tmpResult = new int[kernelMatrix.getRowDimension()];
         double[] finalResult = new double[kernelMatrix.getRowDimension()];
         for (int i = 0; i < kernelMatrix.getRowDimension(); i++) {
             tmpResult[i] = (resultFractionArray[i].multiply(v_lcm)).intValue();
             finalResult[i] = (double)tmpResult[i];
-            System.out.println("The finalResult is: "+ finalResult[i] + " - " + blocks.get(i).getName() );
         }
             RealVector xVector = new ArrayRealVector(finalResult);
             return xVector;
     }
     
-    public boolean computeSchedule(RealVector q, RealMatrix gamma, RealVector buffer, LinkedList<SysCAMSTBlockTDF> tdfBlocks, LinkedList<SysCAMSTConnector> connectors) throws InterruptedException {
+    public boolean[] computeSchedule(RealVector q, RealMatrix gamma, RealVector buffer, LinkedList<SysCAMSTBlockTDF> tdfBlocks, LinkedList<SysCAMSTConnector> connectors) throws InterruptedException {
         RealVector q1 = new ArrayRealVector(q.getDimension());
         RealVector nu = new ArrayRealVector(q.getDimension());
         RealVector tmpBuffer = new ArrayRealVector(gamma.getRowDimension());;
         RealVectorFormat printFormat = new RealVectorFormat();
+        String last_schedule = "Current scheduled modules list is: ";
         boolean deadlock = false;
-        boolean recompute = false;
+        boolean[] recompute = {false, false};   //[0]-for sync issues [1]-for loop delays
         SysCAMSTBlockTDF tdfBlock;
-        LinkedList<SysCAMSTPortConverter> portConvertersTmp;
+        SysCAMSTPortTDF tdfPort;
+        SysCAMSTPortTDF tdfPort1;
+        SysCAMSTPortTDF tdfPort2;
         double[] time_prev = {0.0, 0.0}; //array to store "in" ([0]) and "out" ([1]) previous times
+        
         //Reset the number of times all blocks have been executed
         for(int i = 0; i < tdfBlocks.size(); i++) {
             tdfBlocks.get(i).setN(0);
@@ -1155,18 +1246,14 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                     tdfBlock = tdfBlocks.get(i);
                     //check if block is runnable: If it has not run q times 
                     //and it won't cause a buffer size to go negative.
-                    System.out.println("q1 is: " + printFormat.format(q1) );
-                    System.out.println("q is: " + printFormat.format(q) );
                     if(q1.getEntry(i) != q.getEntry(i)) {
                         nu.setEntry(i, 1);
                         tmpBuffer = buffer.add(gamma.operate(nu));
-                        System.out.println("tmpBuffer is: " + printFormat.format(tmpBuffer) );
                         if(tmpBuffer.getMinValue() >= 0) {
                             deadlock = false;
                             q1 = q1.add(nu);
                             buffer = tmpBuffer.copy();
-                            System.out.println("Schedule " + tdfBlock.getName() );
-                            System.out.println("Buffer is: " + printFormat.format(buffer) );
+                            last_schedule += tdfBlock.getName() + " - ";
                             //Validate sync bewtween TDF/DE 
                             tdfBlock.syncTDFBlockDEBlock(time_prev);
                         }
@@ -1175,23 +1262,24 @@ public class JDialogSysCAMSExecutableCodeGeneration extends javax.swing.JFrame i
                 }
             }
         } catch (SysCAMSValidateException se) {
-            recompute = true;
-            System.out.println("Causality exception: " + se.getMessage());
+            recompute[0] = true;
+            //System.out.println("Causality exception: " + se.getMessage());
         }
         if (deadlock){
-            System.out.println("Static schedule can not be computed due to missing delays in loops" );
-            jta.append("Error: Static schedule can not be computed due to missing delays in loops\n" );
+            //System.out.println(last_schedule);
             int minIndex = tmpBuffer.getMinIndex();
-            //TODO: for the suggested delay, I need to first detect loops within the graph(DFS?), then recompute recursively with the suggested delay until it can be solved.
-            /*jta.append("Following delay is suggested:\n" );
-            int currentDelay = ((SysCAMSTPortTDF) connectors.get(minIndex).get_p2().getComponent()).getDelay();
-            jta.append(currentDelay-(int)tmpBuffer.getMinValue() +" in port \""
-            +((SysCAMSTPortTDF) connectors.get(minIndex).get_p2().getComponent()).getName()
-            +"\" from block \""+ ((SysCAMSTPortTDF) connectors.get(minIndex).get_p2().getComponent()).getBlockTDF().getName()+"\"\n");
-            */
-            throw new InterruptedException(); 
-        } else {
-            System.out.println("Schedule complete-STOP" );
+            int currentDelay = 0;
+            int suggestedDelay;
+            for(int i = 0; i < tmpBuffer.getDimension(); i++) {
+                if (tmpBuffer.getEntry(i) < 0) {
+                    tdfPort = (SysCAMSTPortTDF) connectors.get(i).get_p2().getComponent();
+                    currentDelay = tdfPort.getDelay();
+                    suggestedDelay = tdfPort.getDelay() - (int)tmpBuffer.getEntry(i);
+                    tdfPort.setDelay(suggestedDelay);
+                    tdfPort.setRecompute(true);
+                }
+            }
+            recompute[1] = true;
         }
         return recompute;
     }
diff --git a/src/main/java/ui/window/JDialogSysCAMSPortDE.java b/src/main/java/ui/window/JDialogSysCAMSPortDE.java
index 2605b466eaa45ea49d3a6b2d2b4f32c69884fcf6..aeb730be449fcfd7a01f671fd30f5243036f40bf 100644
--- a/src/main/java/ui/window/JDialogSysCAMSPortDE.java
+++ b/src/main/java/ui/window/JDialogSysCAMSPortDE.java
@@ -215,6 +215,7 @@ public class JDialogSysCAMSPortDE extends JDialog implements ActionListener {
 		listArrayTypeString.add("int");
 		listArrayTypeString.add("bool");
 		listArrayTypeString.add("double");
+        listArrayTypeString.add("sc_uint<32>");
 		if (port.getFather() != null) {
 			if (port.getFather() instanceof SysCAMSBlockDE) {
 				if (!((SysCAMSBlockDE) port.getFather()).getListTypedef().isEmpty()) {
@@ -291,14 +292,17 @@ public class JDialogSysCAMSPortDE extends JDialog implements ActionListener {
 		gridBag.setConstraints(sensitivePanel, constraints);
 		boxPanel.add(sensitivePanel);
 		
-		listSensitiveString = new String[2];
-		listSensitiveString[0] = "positive";
-		listSensitiveString[1] = "negative";
+		listSensitiveString = new String[3];
+		listSensitiveString[0] = "";
+        listSensitiveString[1] = "positive";
+		listSensitiveString[2] = "negative";
 		sensitiveComboBoxString = new JComboBox<String>(listSensitiveString);
-		if (port.getSensitiveMethod().equals("") || port.getSensitiveMethod().equals("positive")) {
+		if (port.getSensitiveMethod().equals("")) {
 			sensitiveComboBoxString.setSelectedIndex(0);
+        } else if (port.getSensitiveMethod().equals("positive")) {
+            sensitiveComboBoxString.setSelectedIndex(1);
 		} else if (port.getSensitiveMethod().equals("negative")) {
-			sensitiveComboBoxString.setSelectedIndex(1);
+			sensitiveComboBoxString.setSelectedIndex(2);
 		}
 		sensitiveComboBoxString.setActionCommand("Sensitive_method");
 		sensitiveComboBoxString.setEnabled(port.getSensitive());
@@ -413,4 +417,4 @@ public class JDialogSysCAMSPortDE extends JDialog implements ActionListener {
 			this.dispose();
 		}
 	}
-}
\ No newline at end of file
+}