diff --git a/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/metadata/gpio2vci.sd b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/metadata/gpio2vci.sd
new file mode 100644
index 0000000000000000000000000000000000000000..03537d4e75290b8749f564a1246aa76345a11f47
--- /dev/null
+++ b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/metadata/gpio2vci.sd
@@ -0,0 +1,25 @@
+
+# -*- python -*-
+
+Module('caba:gpio2vci',
+       classname = 'soclib::caba::Gpio2Vci',
+           tmpl_parameters = [
+               parameter.Module('vci_param', default = 'caba:vci_param'),
+           ],
+       header_files = ['../source/include/gpio2vci.h',],
+       implementation_files = ['../source/src/gpio2vci.cpp',],
+       ports = [
+        Port('caba:clock_in', 'p_clk', auto = 'clock'),
+        Port('caba:bit_in', 'p_resetn', auto = 'resetn'),
+        Port('caba:vci_target', 'p_vci'),
+        ],
+       uses = [
+        Uses('caba:base_module'),
+        Uses('common:mapping_table'),
+        Uses('caba:vci_target'),
+        ],
+       instance_parameters = [
+        parameter.IntTab('ident'),
+        parameter.Module('mt', typename = 'common:mapping_table', auto = 'env:mapping_table'),
+        ],
+       )
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
new file mode 100644
index 0000000000000000000000000000000000000000..9574c43c8ea6c7fccf690a95580cdfe7327ee4ed
--- /dev/null
+++ b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/include/gpio2vci.h
@@ -0,0 +1,63 @@
+#ifndef GPIO2VCI_H
+#define GPIO2VCI_H
+
+#define sc_register sc_signal
+
+#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 {
+
+template <typename vci_param>
+class Gpio2Vci 
+      : public soclib::caba::BaseModule {    
+
+    sc_register< typename vci_param::data_t > r_rdata_ams, r_wdata_ams;
+    sc_register<int> r_fsm_state, r_buf_eop;
+    
+    enum fsm_state_e {
+      TARGET_IDLE = 0,
+      TARGET_WRITE,
+      TARGET_READ,
+    };
+
+    const soclib::common::Segment   m_segment;    
+
+protected:
+    SC_HAS_PROCESS(Gpio2Vci);
+
+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;
+    
+    Gpio2Vci( sc_module_name                insname,
+        const soclib::common::IntTab       &index,
+        const soclib::common::MappingTable &mt );
+
+    ~Gpio2Vci();
+
+private:
+    void transition();
+    void genMoore();
+
+};
+
+
+}
+}
+
+#endif // GPIO2VCI_H
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
new file mode 100644
index 0000000000000000000000000000000000000000..abd4b19fa9117f66d1260c67105c1595fc986986
--- /dev/null
+++ b/MPSoC/soclib/soclib/module/streaming_component/gpio2vci/caba/source/src/gpio2vci.cpp
@@ -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/modeling/LIP6/monoprocessor.xml b/modeling/LIP6/monoprocessor.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6489f65e99fdef9298ba2233ed9110c624147665
--- /dev/null
+++ b/modeling/LIP6/monoprocessor.xml
@@ -0,0 +1,674 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<TURTLEGMODELING version="1.0beta">
+
+<Modeling type="AVATAR Design" nameTab="AVATAR Design" >
+<AVATARBlockDiagramPanel name="Block Diagram" minX="10" maxX="1400" minY="10" maxY="900" zoom="1.0" >
+<MainCode value="void __user_init() {"/>
+<MainCode value="}"/>
+<Optimized value="true" />
+<Validated value="" />
+<Ignored value="" />
+
+<COMPONENT type="5000" id="25" >
+<cdparam x="117" y="236" />
+<sizeparam width="250" height="200" minWidth="5" minHeight="2" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="Block0" value="Block0" />
+<TGConnectingPoint num="0" id="1" />
+<TGConnectingPoint num="1" id="2" />
+<TGConnectingPoint num="2" id="3" />
+<TGConnectingPoint num="3" id="4" />
+<TGConnectingPoint num="4" id="5" />
+<TGConnectingPoint num="5" id="6" />
+<TGConnectingPoint num="6" id="7" />
+<TGConnectingPoint num="7" id="8" />
+<TGConnectingPoint num="8" id="9" />
+<TGConnectingPoint num="9" id="10" />
+<TGConnectingPoint num="10" id="11" />
+<TGConnectingPoint num="11" id="12" />
+<TGConnectingPoint num="12" id="13" />
+<TGConnectingPoint num="13" id="14" />
+<TGConnectingPoint num="14" id="15" />
+<TGConnectingPoint num="15" id="16" />
+<TGConnectingPoint num="16" id="17" />
+<TGConnectingPoint num="17" id="18" />
+<TGConnectingPoint num="18" id="19" />
+<TGConnectingPoint num="19" id="20" />
+<TGConnectingPoint num="20" id="21" />
+<TGConnectingPoint num="21" id="22" />
+<TGConnectingPoint num="22" id="23" />
+<TGConnectingPoint num="23" id="24" />
+<extraparam>
+<blockType data="block" color="-4072719" />
+<CryptoBlock value="false" />
+</extraparam>
+</COMPONENT>
+
+
+</AVATARBlockDiagramPanel>
+
+<AVATARStateMachineDiagramPanel name="Block0" minX="10" maxX="1400" minY="10" maxY="900" >
+<CONNECTOR type="5102" id="32" >
+<cdparam x="460" y="115" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="null" />
+<TGConnectingPoint num="0" id="31" />
+<P1  x="460" y="115" id="48" />
+<P2  x="456" y="164" id="40" />
+<AutomaticDrawing  data="true" />
+</CONNECTOR><SUBCOMPONENT type="-1" id="30" >
+<father id="32" num="0" />
+<cdparam x="458" y="139" />
+<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="List of all parameters of an Avatar SMD transition" value="" />
+<TGConnectingPoint num="0" id="26" />
+<TGConnectingPoint num="1" id="27" />
+<TGConnectingPoint num="2" id="28" />
+<TGConnectingPoint num="3" id="29" />
+<extraparam>
+<guard value="[ ]" />
+<afterMin value="" />
+<afterMax value="" />
+<computeMin value="" />
+<computeMax value="" />
+<probability value="" />
+</extraparam>
+</SUBCOMPONENT>
+
+<CONNECTOR type="5102" id="39" >
+<cdparam x="407" y="70" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="null" />
+<TGConnectingPoint num="0" id="38" />
+<P1  x="407" y="70" id="83" />
+<P2  x="410" y="71" id="62" />
+<AutomaticDrawing  data="true" />
+</CONNECTOR><SUBCOMPONENT type="-1" id="37" >
+<father id="39" num="0" />
+<cdparam x="407" y="110" />
+<sizeparam width="10" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="List of all parameters of an Avatar SMD transition" value="" />
+<TGConnectingPoint num="0" id="33" />
+<TGConnectingPoint num="1" id="34" />
+<TGConnectingPoint num="2" id="35" />
+<TGConnectingPoint num="3" id="36" />
+<extraparam>
+<guard value="[ ]" />
+<afterMin value="" />
+<afterMax value="" />
+<computeMin value="" />
+<computeMax value="" />
+<probability value="" />
+</extraparam>
+</SUBCOMPONENT>
+
+<COMPONENT type="5101" id="41" >
+<cdparam x="446" y="169" />
+<sizeparam width="20" height="20" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="stop state" value="null" />
+<TGConnectingPoint num="0" id="40" />
+</COMPONENT>
+
+<COMPONENT type="5106" id="82" >
+<cdparam x="410" y="65" />
+<sizeparam width="100" height="50" minWidth="40" minHeight="30" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="state0" value="state0" />
+<TGConnectingPoint num="0" id="42" />
+<TGConnectingPoint num="1" id="43" />
+<TGConnectingPoint num="2" id="44" />
+<TGConnectingPoint num="3" id="45" />
+<TGConnectingPoint num="4" id="46" />
+<TGConnectingPoint num="5" id="47" />
+<TGConnectingPoint num="6" id="48" />
+<TGConnectingPoint num="7" id="49" />
+<TGConnectingPoint num="8" id="50" />
+<TGConnectingPoint num="9" id="51" />
+<TGConnectingPoint num="10" id="52" />
+<TGConnectingPoint num="11" id="53" />
+<TGConnectingPoint num="12" id="54" />
+<TGConnectingPoint num="13" id="55" />
+<TGConnectingPoint num="14" id="56" />
+<TGConnectingPoint num="15" id="57" />
+<TGConnectingPoint num="16" id="58" />
+<TGConnectingPoint num="17" id="59" />
+<TGConnectingPoint num="18" id="60" />
+<TGConnectingPoint num="19" id="61" />
+<TGConnectingPoint num="20" id="62" />
+<TGConnectingPoint num="21" id="63" />
+<TGConnectingPoint num="22" id="64" />
+<TGConnectingPoint num="23" id="65" />
+<TGConnectingPoint num="24" id="66" />
+<TGConnectingPoint num="25" id="67" />
+<TGConnectingPoint num="26" id="68" />
+<TGConnectingPoint num="27" id="69" />
+<TGConnectingPoint num="28" id="70" />
+<TGConnectingPoint num="29" id="71" />
+<TGConnectingPoint num="30" id="72" />
+<TGConnectingPoint num="31" id="73" />
+<TGConnectingPoint num="32" id="74" />
+<TGConnectingPoint num="33" id="75" />
+<TGConnectingPoint num="34" id="76" />
+<TGConnectingPoint num="35" id="77" />
+<TGConnectingPoint num="36" id="78" />
+<TGConnectingPoint num="37" id="79" />
+<TGConnectingPoint num="38" id="80" />
+<TGConnectingPoint num="39" id="81" />
+<extraparam>
+<entryCode value="printf(&quot;Hello World! \n&quot;);" />
+</extraparam>
+</COMPONENT>
+
+<COMPONENT type="5100" id="84" >
+<cdparam x="400" y="50" />
+<sizeparam width="15" height="15" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="start state" value="null" />
+<TGConnectingPoint num="0" id="83" />
+</COMPONENT>
+
+
+</AVATARStateMachineDiagramPanel>
+
+</Modeling>
+
+
+
+
+<Modeling type="ADD" nameTab="Avatar Deployment" >
+<ADDDiagramPanel name="Deployment Diagram" minX="10" maxX="1400" minY="10" maxY="900" attributes="0" masterClockFrequency="200" >
+<COMPONENT type="5354" id="109" >
+<cdparam x="649" y="518" />
+<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="TTY0" value="name" />
+<TGConnectingPoint num="0" id="85" />
+<TGConnectingPoint num="1" id="86" />
+<TGConnectingPoint num="2" id="87" />
+<TGConnectingPoint num="3" id="88" />
+<TGConnectingPoint num="4" id="89" />
+<TGConnectingPoint num="5" id="90" />
+<TGConnectingPoint num="6" id="91" />
+<TGConnectingPoint num="7" id="92" />
+<TGConnectingPoint num="8" id="93" />
+<TGConnectingPoint num="9" id="94" />
+<TGConnectingPoint num="10" id="95" />
+<TGConnectingPoint num="11" id="96" />
+<TGConnectingPoint num="12" id="97" />
+<TGConnectingPoint num="13" id="98" />
+<TGConnectingPoint num="14" id="99" />
+<TGConnectingPoint num="15" id="100" />
+<TGConnectingPoint num="16" id="101" />
+<TGConnectingPoint num="17" id="102" />
+<TGConnectingPoint num="18" id="103" />
+<TGConnectingPoint num="19" id="104" />
+<TGConnectingPoint num="20" id="105" />
+<TGConnectingPoint num="21" id="106" />
+<TGConnectingPoint num="22" id="107" />
+<TGConnectingPoint num="23" id="108" />
+<extraparam>
+<info stereotype="TTY" nodeName="TTY0" />
+<attributes index="0" />
+</extraparam>
+</COMPONENT>
+
+<COMPONENT type="5365" id="134" >
+<cdparam x="942" y="75" />
+<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="cluster" value="cluster" />
+<TGConnectingPoint num="0" id="110" />
+<TGConnectingPoint num="1" id="111" />
+<TGConnectingPoint num="2" id="112" />
+<TGConnectingPoint num="3" id="113" />
+<TGConnectingPoint num="4" id="114" />
+<TGConnectingPoint num="5" id="115" />
+<TGConnectingPoint num="6" id="116" />
+<TGConnectingPoint num="7" id="117" />
+<TGConnectingPoint num="8" id="118" />
+<TGConnectingPoint num="9" id="119" />
+<TGConnectingPoint num="10" id="120" />
+<TGConnectingPoint num="11" id="121" />
+<TGConnectingPoint num="12" id="122" />
+<TGConnectingPoint num="13" id="123" />
+<TGConnectingPoint num="14" id="124" />
+<TGConnectingPoint num="15" id="125" />
+<TGConnectingPoint num="16" id="126" />
+<TGConnectingPoint num="17" id="127" />
+<TGConnectingPoint num="18" id="128" />
+<TGConnectingPoint num="19" id="129" />
+<TGConnectingPoint num="20" id="130" />
+<TGConnectingPoint num="21" id="131" />
+<TGConnectingPoint num="22" id="132" />
+<TGConnectingPoint num="23" id="133" />
+<extraparam>
+<info stereotype="SystemC-AMS Cluster" nodeName="cluster" />
+<attributes index="0" />
+</extraparam>
+</COMPONENT>
+
+<COMPONENT type="5363" id="159" >
+<cdparam x="523" y="309" />
+<sizeparam width="250" height="50" minWidth="100" minHeight="50" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="Bus0" value="name" />
+<TGConnectingPoint num="0" id="135" />
+<TGConnectingPoint num="1" id="136" />
+<TGConnectingPoint num="2" id="137" />
+<TGConnectingPoint num="3" id="138" />
+<TGConnectingPoint num="4" id="139" />
+<TGConnectingPoint num="5" id="140" />
+<TGConnectingPoint num="6" id="141" />
+<TGConnectingPoint num="7" id="142" />
+<TGConnectingPoint num="8" id="143" />
+<TGConnectingPoint num="9" id="144" />
+<TGConnectingPoint num="10" id="145" />
+<TGConnectingPoint num="11" id="146" />
+<TGConnectingPoint num="12" id="147" />
+<TGConnectingPoint num="13" id="148" />
+<TGConnectingPoint num="14" id="149" />
+<TGConnectingPoint num="15" id="150" />
+<TGConnectingPoint num="16" id="151" />
+<TGConnectingPoint num="17" id="152" />
+<TGConnectingPoint num="18" id="153" />
+<TGConnectingPoint num="19" id="154" />
+<TGConnectingPoint num="20" id="155" />
+<TGConnectingPoint num="21" id="156" />
+<TGConnectingPoint num="22" id="157" />
+<TGConnectingPoint num="23" id="158" />
+<extraparam>
+<info stereotype="VGSB" nodeName="Bus0" />
+<attributes index="0"  nbOfAttachedInitiators="0"  nbOfAttachedTargets="0"  minLatency="10"  fifoDepth="10" />
+</extraparam>
+</COMPONENT>
+
+<COMPONENT type="5355" id="184" >
+<cdparam x="218" y="386" />
+<sizeparam width="200" height="200" minWidth="100" minHeight="35" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="Memory0" value="name" />
+<TGConnectingPoint num="0" id="160" />
+<TGConnectingPoint num="1" id="161" />
+<TGConnectingPoint num="2" id="162" />
+<TGConnectingPoint num="3" id="163" />
+<TGConnectingPoint num="4" id="164" />
+<TGConnectingPoint num="5" id="165" />
+<TGConnectingPoint num="6" id="166" />
+<TGConnectingPoint num="7" id="167" />
+<TGConnectingPoint num="8" id="168" />
+<TGConnectingPoint num="9" id="169" />
+<TGConnectingPoint num="10" id="170" />
+<TGConnectingPoint num="11" id="171" />
+<TGConnectingPoint num="12" id="172" />
+<TGConnectingPoint num="13" id="173" />
+<TGConnectingPoint num="14" id="174" />
+<TGConnectingPoint num="15" id="175" />
+<TGConnectingPoint num="16" id="176" />
+<TGConnectingPoint num="17" id="177" />
+<TGConnectingPoint num="18" id="178" />
+<TGConnectingPoint num="19" id="179" />
+<TGConnectingPoint num="20" id="180" />
+<TGConnectingPoint num="21" id="181" />
+<TGConnectingPoint num="22" id="182" />
+<TGConnectingPoint num="23" id="183" />
+<extraparam>
+<info stereotype="RAM" nodeName="Memory0" />
+<attributes byteDataSize="1048576"  index="0"  processCode="" />
+</extraparam>
+</COMPONENT>
+
+<COMPONENT type="5351" id="218" >
+<cdparam x="113" y="44" />
+<sizeparam width="250" height="200" minWidth="150" minHeight="100" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="1400" minY="10" maxY="900" />
+<infoparam name="CPU0" value="name" />
+<TGConnectingPoint num="0" id="194" />
+<TGConnectingPoint num="1" id="195" />
+<TGConnectingPoint num="2" id="196" />
+<TGConnectingPoint num="3" id="197" />
+<TGConnectingPoint num="4" id="198" />
+<TGConnectingPoint num="5" id="199" />
+<TGConnectingPoint num="6" id="200" />
+<TGConnectingPoint num="7" id="201" />
+<TGConnectingPoint num="8" id="202" />
+<TGConnectingPoint num="9" id="203" />
+<TGConnectingPoint num="10" id="204" />
+<TGConnectingPoint num="11" id="205" />
+<TGConnectingPoint num="12" id="206" />
+<TGConnectingPoint num="13" id="207" />
+<TGConnectingPoint num="14" id="208" />
+<TGConnectingPoint num="15" id="209" />
+<TGConnectingPoint num="16" id="210" />
+<TGConnectingPoint num="17" id="211" />
+<TGConnectingPoint num="18" id="212" />
+<TGConnectingPoint num="19" id="213" />
+<TGConnectingPoint num="20" id="214" />
+<TGConnectingPoint num="21" id="215" />
+<TGConnectingPoint num="22" id="216" />
+<TGConnectingPoint num="23" id="217" />
+<extraparam>
+<info stereotype="CPU" nodeName="CPU0" />
+<attributes nbOfIrq="6"  iCacheWays="1"  iCacheSets="8"  iCacheWords="4"  dCacheWays="1"  dCacheSets="8"  dCacheWords="4" />
+</extraparam>
+</COMPONENT>
+<SUBCOMPONENT type="5352" id="193" >
+<father id="218" num="0" />
+<cdparam x="172" y="134" />
+<sizeparam width="176" height="40" minWidth="75" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="0" maxX="74" minY="0" maxY="160" />
+<infoparam name="TGComponent" value="AVATAR Design::Block0" />
+<TGConnectingPoint num="0" id="185" />
+<TGConnectingPoint num="1" id="186" />
+<TGConnectingPoint num="2" id="187" />
+<TGConnectingPoint num="3" id="188" />
+<TGConnectingPoint num="4" id="189" />
+<TGConnectingPoint num="5" id="190" />
+<TGConnectingPoint num="6" id="191" />
+<TGConnectingPoint num="7" id="192" />
+<extraparam>
+<info value="AVATAR Design::Block0" taskName="Block0" referenceTaskName="AVATAR Design" />
+</extraparam>
+</SUBCOMPONENT>
+
+<CONNECTOR type="5350" id="219" >
+<cdparam x="711" y="518" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="{info}" />
+<P1  x="711" y="518" id="93" />
+<P2  x="648" y="359" id="141" />
+<AutomaticDrawing  data="true" />
+<extraparam>
+<spy value="false" />
+</extraparam>
+</CONNECTOR>
+<CONNECTOR type="5350" id="220" >
+<cdparam x="1006" y="263" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="{info}" />
+<P1  x="942" y="125" id="120" />
+<P2  x="773" y="309" id="137" />
+<AutomaticDrawing  data="true" />
+<extraparam>
+<spy value="false" />
+</extraparam>
+</CONNECTOR>
+<CONNECTOR type="5350" id="221" >
+<cdparam x="418" y="436" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="{info}" />
+<P1  x="418" y="436" id="171" />
+<P2  x="523" y="359" id="140" />
+<AutomaticDrawing  data="true" />
+<extraparam>
+<spy value="false" />
+</extraparam>
+</CONNECTOR>
+<CONNECTOR type="5350" id="222" >
+<cdparam x="300" y="244" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="{info}" />
+<P1  x="300" y="244" id="209" />
+<P2  x="523" y="309" id="135" />
+<AutomaticDrawing  data="true" />
+<extraparam>
+<spy value="false" />
+</extraparam>
+</CONNECTOR>
+
+</ADDDiagramPanel>
+
+</Modeling>
+
+
+
+
+<Modeling type="SystemC-AMS" nameTab="SystemC_AMS" >
+<SysCAMSComponentTaskDiagramPanel name="SystemC-AMS Component Diagram" minX="10" maxX="2500" minY="10" maxY="1500" TDF="true" DE="true" zoom="1.0" >
+<CONNECTOR type="1601" id="223" >
+<cdparam x="1232" y="401" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="Connector between ports" />
+<P1  x="1232" y="401" id="226" />
+<P2  x="907" y="292" id="274" />
+<AutomaticDrawing  data="true" />
+</CONNECTOR>
+<CONNECTOR type="1601" id="224" >
+<cdparam x="733" y="410" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="Connector between ports" />
+<P1  x="811" y="410" id="284" />
+<P2  x="816" y="455" id="255" />
+<AutomaticDrawing  data="true" />
+</CONNECTOR>
+<CONNECTOR type="1601" id="225" >
+<cdparam x="860" y="449" />
+<sizeparam width="0" height="0" minWidth="0" minHeight="0" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<infoparam name="connector" value="Connector between ports" />
+<P1  x="907" y="333" id="294" />
+<P2  x="1232" y="447" id="236" />
+<AutomaticDrawing  data="true" />
+</CONNECTOR>
+<COMPONENT type="1608" id="254" >
+<cdparam x="1245" y="364" />
+<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="2500" minY="10" maxY="1500" />
+<infoparam name="Primitive component - Block GPIO2VCI" value="Block_GPIO2VCI" />
+<TGConnectingPoint num="0" id="246" />
+<TGConnectingPoint num="1" id="247" />
+<TGConnectingPoint num="2" id="248" />
+<TGConnectingPoint num="3" id="249" />
+<TGConnectingPoint num="4" id="250" />
+<TGConnectingPoint num="5" id="251" />
+<TGConnectingPoint num="6" id="252" />
+<TGConnectingPoint num="7" id="253" />
+</COMPONENT>
+<SUBCOMPONENT type="1605" id="235" >
+<father id="254" num="0" />
+<cdparam x="1232" y="388" />
+<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
+<infoparam name="Primitive port - Port DE" value="out" />
+<TGConnectingPoint num="0" id="226" />
+<TGConnectingPoint num="1" id="227" />
+<TGConnectingPoint num="2" id="228" />
+<TGConnectingPoint num="3" id="229" />
+<TGConnectingPoint num="4" id="230" />
+<TGConnectingPoint num="5" id="231" />
+<TGConnectingPoint num="6" id="232" />
+<TGConnectingPoint num="7" id="233" />
+<TGConnectingPoint num="8" id="234" />
+<extraparam>
+<Prop commName="out" commType="0" origin="1" type="int" sensitive="false" sensitive_method="positive" />
+</extraparam>
+</SUBCOMPONENT>
+<SUBCOMPONENT type="1605" id="245" >
+<father id="254" num="1" />
+<cdparam x="1232" y="434" />
+<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
+<infoparam name="Primitive port - Port DE" value="in" />
+<TGConnectingPoint num="0" id="236" />
+<TGConnectingPoint num="1" id="237" />
+<TGConnectingPoint num="2" id="238" />
+<TGConnectingPoint num="3" id="239" />
+<TGConnectingPoint num="4" id="240" />
+<TGConnectingPoint num="5" id="241" />
+<TGConnectingPoint num="6" id="242" />
+<TGConnectingPoint num="7" id="243" />
+<TGConnectingPoint num="8" id="244" />
+<extraparam>
+<Prop commName="in" commType="0" origin="0" type="int" sensitive="false" sensitive_method="positive" />
+</extraparam>
+</SUBCOMPONENT>
+
+<COMPONENT type="1607" id="321" >
+<cdparam x="303" y="181" />
+<sizeparam width="808" height="458" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="10" maxX="2500" minY="10" maxY="1500" />
+<infoparam name="Composite component - Cluster" value="cluster" />
+<TGConnectingPoint num="0" id="313" />
+<TGConnectingPoint num="1" id="314" />
+<TGConnectingPoint num="2" id="315" />
+<TGConnectingPoint num="3" id="316" />
+<TGConnectingPoint num="4" id="317" />
+<TGConnectingPoint num="5" id="318" />
+<TGConnectingPoint num="6" id="319" />
+<TGConnectingPoint num="7" id="320" />
+</COMPONENT>
+<SUBCOMPONENT type="1602" id="273" >
+<father id="321" num="0" />
+<cdparam x="705" y="468" />
+<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="0" maxX="608" minY="0" maxY="308" />
+<infoparam name="Primitive component - Block TDF" value="Sink" />
+<TGConnectingPoint num="0" id="265" />
+<TGConnectingPoint num="1" id="266" />
+<TGConnectingPoint num="2" id="267" />
+<TGConnectingPoint num="3" id="268" />
+<TGConnectingPoint num="4" id="269" />
+<TGConnectingPoint num="5" id="270" />
+<TGConnectingPoint num="6" id="271" />
+<TGConnectingPoint num="7" id="272" />
+<extraparam>
+<Attribute period="-1" time="" processCode="void processing() {
+	in.read();
+}
+        " listStruct="" nameTemplate="" typeTemplate="int" listTypedef="" />
+</extraparam>
+</SUBCOMPONENT>
+<SUBCOMPONENT type="1604" id="264" >
+<father id="273" num="0" />
+<cdparam x="803" y="455" />
+<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
+<infoparam name="Primitive port - Port TDF" value="in" />
+<TGConnectingPoint num="0" id="255" />
+<TGConnectingPoint num="1" id="256" />
+<TGConnectingPoint num="2" id="257" />
+<TGConnectingPoint num="3" id="258" />
+<TGConnectingPoint num="4" id="259" />
+<TGConnectingPoint num="5" id="260" />
+<TGConnectingPoint num="6" id="261" />
+<TGConnectingPoint num="7" id="262" />
+<TGConnectingPoint num="8" id="263" />
+<extraparam>
+<Prop commName="in" commType="0" origin="0" period="-1" time="us" rate="1" delay="-1" type="double" />
+</extraparam>
+</SUBCOMPONENT>
+<SUBCOMPONENT type="1602" id="312" >
+<father id="321" num="1" />
+<cdparam x="694" y="247" />
+<sizeparam width="200" height="150" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="0" maxX="608" minY="0" maxY="308" />
+<infoparam name="Primitive component - Block TDF" value="Sine" />
+<TGConnectingPoint num="0" id="304" />
+<TGConnectingPoint num="1" id="305" />
+<TGConnectingPoint num="2" id="306" />
+<TGConnectingPoint num="3" id="307" />
+<TGConnectingPoint num="4" id="308" />
+<TGConnectingPoint num="5" id="309" />
+<TGConnectingPoint num="6" id="310" />
+<TGConnectingPoint num="7" id="311" />
+<extraparam>
+<Attribute period="6" time="ns" processCode="void processing() {
+	double t = out_de.get_time().to_seconds();
+	double x = in_de.read() * sin(2.0 * M_PI * 5000000.0 * t);
+	out_de.write( (int) x);
+	tdf_out.write(x);
+}
+           " listStruct="" nameTemplate="" typeTemplate="int" listTypedef="" />
+</extraparam>
+</SUBCOMPONENT>
+<SUBCOMPONENT type="1606" id="283" >
+<father id="312" num="0" />
+<cdparam x="881" y="279" />
+<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
+<infoparam name="Primitive port - Port Converter" value="in_de" />
+<TGConnectingPoint num="0" id="274" />
+<TGConnectingPoint num="1" id="275" />
+<TGConnectingPoint num="2" id="276" />
+<TGConnectingPoint num="3" id="277" />
+<TGConnectingPoint num="4" id="278" />
+<TGConnectingPoint num="5" id="279" />
+<TGConnectingPoint num="6" id="280" />
+<TGConnectingPoint num="7" id="281" />
+<TGConnectingPoint num="8" id="282" />
+<extraparam>
+<Prop commName="in_de" commType="0" origin="0" period="-1" time="s" rate="-1" delay="-1" type="sc_uint&lt;32&gt;" />
+</extraparam>
+</SUBCOMPONENT>
+<SUBCOMPONENT type="1604" id="293" >
+<father id="312" num="1" />
+<cdparam x="798" y="384" />
+<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
+<infoparam name="Primitive port - Port TDF" value="tdf_out" />
+<TGConnectingPoint num="0" id="284" />
+<TGConnectingPoint num="1" id="285" />
+<TGConnectingPoint num="2" id="286" />
+<TGConnectingPoint num="3" id="287" />
+<TGConnectingPoint num="4" id="288" />
+<TGConnectingPoint num="5" id="289" />
+<TGConnectingPoint num="6" id="290" />
+<TGConnectingPoint num="7" id="291" />
+<TGConnectingPoint num="8" id="292" />
+<extraparam>
+<Prop commName="tdf_out" commType="0" origin="1" period="6" time="ns" rate="1" delay="-1" type="double" />
+</extraparam>
+</SUBCOMPONENT>
+<SUBCOMPONENT type="1606" id="303" >
+<father id="312" num="2" />
+<cdparam x="881" y="320" />
+<sizeparam width="26" height="26" minWidth="1" minHeight="1" maxWidth="2000" maxHeight="2000" minDesiredWidth="0" minDesiredHeight="0" />
+<hidden value="false" />
+<cdrectangleparam minX="-13" maxX="187" minY="-13" maxY="137" />
+<infoparam name="Primitive port - Port Converter" value="out_de" />
+<TGConnectingPoint num="0" id="294" />
+<TGConnectingPoint num="1" id="295" />
+<TGConnectingPoint num="2" id="296" />
+<TGConnectingPoint num="3" id="297" />
+<TGConnectingPoint num="4" id="298" />
+<TGConnectingPoint num="5" id="299" />
+<TGConnectingPoint num="6" id="300" />
+<TGConnectingPoint num="7" id="301" />
+<TGConnectingPoint num="8" id="302" />
+<extraparam>
+<Prop commName="out_de" commType="0" origin="1" period="6" time="ns" rate="1" delay="0" type="sc_uint&lt;32&gt;" />
+</extraparam>
+</SUBCOMPONENT>
+
+
+</SysCAMSComponentTaskDiagramPanel>
+
+</Modeling>
+
+
+
+
+</TURTLEGMODELING>
\ No newline at end of file
diff --git a/src/main/java/ddtranslatorSoclib/toTopCell/Header.java b/src/main/java/ddtranslatorSoclib/toTopCell/Header.java
index 9769b5217215b312ccfd2fc23a018d264acb1e4b..c3c2f760f13d570ffe1f02f50e61b4b55b6174a0 100755
--- a/src/main/java/ddtranslatorSoclib/toTopCell/Header.java
+++ b/src/main/java/ddtranslatorSoclib/toTopCell/Header.java
@@ -157,7 +157,7 @@ public class Header
         header += "#include \"gpio2vci.h\"" + CR;
         for (AvatarAmsCluster amsCluster:TopCellGenerator.avatardd.getAllAmsCluster ())
         {
-            header += "#include \"" + amsCluster.getAmsClusterName () + ".h\"" + CR;
+            header += "#include \"" + amsCluster.getAmsClusterName () + "_tdf.h\"" + CR;
         }
     }
 
diff --git a/src/main/java/syscamstranslator/toSysCAMS/Header.java b/src/main/java/syscamstranslator/toSysCAMS/Header.java
index 6e70a6e9042a4209f67bfce18eec2db6acf63ec3..6a08a46d7c90bdaf13a68fcb9cb315754abfe718 100644
--- a/src/main/java/syscamstranslator/toSysCAMS/Header.java
+++ b/src/main/java/syscamstranslator/toSysCAMS/Header.java
@@ -91,23 +91,17 @@ public class Header {
 	
 	public static String getClusterHeader(SysCAMSTCluster cluster) {
 		 if (cluster != null) {
-			 LinkedList<SysCAMSTBlockTDF> tdf = cluster.getBlockTDF();
-             LinkedList<SysCAMSTBlockDE> de = cluster.getBlockDE();
-
-             headerCluster = "#ifndef " + cluster.getClusterName().toUpperCase() + "_H"+ CR 
-                    + "#define " + cluster.getClusterName().toUpperCase() + "_H" + CR2;
-             headerCluster += "#include <systemc-ams>" + CR;
-             
-             for (SysCAMSTBlockTDF b : tdf) {
-                 headerCluster = headerCluster + "#include \"" + b.getName() + ".h\"" + CR;
-             }
-             for (SysCAMSTBlockDE b : de) {
-                 headerCluster = headerCluster + "#include \"" + b.getName() + ".h\"" + CR;
-             }
-             headerCluster = headerCluster + CR;
-         } else {
-             headerCluster = "";
-         }
-         return headerCluster;
+			 LinkedList<SysCAMSTBlockTDF> blocks = cluster.getBlockTDF();
+			 
+			 headerCluster = "#include <systemc-ams>" + CR;
+			 
+			 for (SysCAMSTBlockTDF b : blocks) {
+				 headerCluster = headerCluster + "#include \"" + b.getName() + ".h\"" + CR;
+			 }
+			 headerCluster = headerCluster + CR;
+		 } else {
+			 headerCluster = "";
+		 }
+		 return headerCluster;
 	} 
 }
\ No newline at end of file
diff --git a/src/main/java/syscamstranslator/toSysCAMS/PrimitiveCode.java b/src/main/java/syscamstranslator/toSysCAMS/PrimitiveCode.java
index 595b6121ee147c2fa2e495404e58c1e0d9a274c9..d088f050c8c8bedfb37121efd5b8fc9a7b814262 100644
--- a/src/main/java/syscamstranslator/toSysCAMS/PrimitiveCode.java
+++ b/src/main/java/syscamstranslator/toSysCAMS/PrimitiveCode.java
@@ -222,7 +222,7 @@ public class PrimitiveCode {
 			}
 
 			if (tdf.getPeriod() != -1) {
-				corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + "set_timestep(" + tdf.getPeriod() + ", sc_core::SC_" + tdf.getTime().toUpperCase() + ");" + CR;
+				corpsPrimitiveTDF = corpsPrimitiveTDF + "\tvoid set_attributes() {" + CR + "\t\t" + "set_timestep(" + tdf.getPeriod() + ", sc_core::SC_" + tdf.getTime().toUpperCase() + CR;
 				cpt2++;
 			}	
 			if (cpt2 > 0) {
diff --git a/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java b/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java
index 532c40bd3c2bd8dc09cfb54f2a11006cb71ed928..bdd086cb14809db39231753ad3e2768ddb88af3c 100644
--- a/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java
+++ b/src/main/java/syscamstranslator/toSysCAMS/TopCellGenerator.java
@@ -102,8 +102,8 @@ public class TopCellGenerator {
 
 		try {
 			// Save file .cpp
-			System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + ".h");
-			FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + ".h");
+			System.err.println(path + GENERATED_PATH1 + cluster.getClusterName() + ".cpp");
+			FileWriter fw = new FileWriter(path + GENERATED_PATH1 + "/" + cluster.getClusterName() + "_tb.cpp");
 			top = generateTopCell(cluster, connectors);
 			fw.write(top);
 			fw.close();
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