diff --git a/src/main/java/ui/avatardd/ADDMemoryNode.java b/src/main/java/ui/avatardd/ADDMemoryNode.java
index 5ca4c15e711a0ede9ac839bda75372b801087a11..25806b8ba6dc3e3aca24a2db58661524a6015315 100755
--- a/src/main/java/ui/avatardd/ADDMemoryNode.java
+++ b/src/main/java/ui/avatardd/ADDMemoryNode.java
@@ -250,12 +250,12 @@ public abstract class ADDMemoryNode extends ADDCommunicationNode implements With
         sb.append("\" />\n");
         sb.append("<attributes byteDataSize=\"" + byteDataSize + "\" ");
         sb.append(" index=\"" + index + "\" ");
+        sb.append(" processCode=\"" + ((ADDRAMNode)this).getProcessCode() + "\" ");
         sb.append("/>\n");
         sb.append("</extraparam>\n");
         return new String(sb);
     }
 
-    @Override
     public void loadExtraParam(NodeList nl, int decX, int decY, int decId) throws MalformedModelingException{
         //System.out.println("*** load extra synchro ***");
         try {
@@ -266,6 +266,7 @@ public abstract class ADDMemoryNode extends ADDCommunicationNode implements With
           //  int t1id;
             String sstereotype = null, snodeName = null;
             monitored = 0;
+            String processCode;
 
             for(int i=0; i<nl.getLength(); i++) {
                 n1 = nl.item(i);
@@ -292,7 +293,8 @@ public abstract class ADDMemoryNode extends ADDCommunicationNode implements With
                                 byteDataSize = Integer.decode(elt.getAttribute("byteDataSize")).intValue();
                                 //monitored = Integer.decode(elt.getAttribute("monitored")).intValue();
                                 index = Integer.decode(elt.getAttribute("index")).intValue();
-
+                                processCode = elt.getAttribute("processCode");
+                                ((ADDRAMNode) this).setProcessCode(processCode);
                             }
                         }
                     }
diff --git a/src/main/java/ui/avatardd/ADDRAMNode.java b/src/main/java/ui/avatardd/ADDRAMNode.java
index a1fb222af7ae55e7a03f2d660e2cc83354be431d..ded7552cc5509b8478a5f72c4f95a9e1eb339910 100755
--- a/src/main/java/ui/avatardd/ADDRAMNode.java
+++ b/src/main/java/ui/avatardd/ADDRAMNode.java
@@ -36,9 +36,6 @@
  * knowledge of the CeCILL license and that you accept its terms.
  */
 
-
-
-
 package ui.avatardd;
 
 import ui.*;
@@ -46,17 +43,20 @@ import ui.util.IconManager;
 
 import java.util.Vector;
 
-
 /**
    * Class ADDRAMNode
    * Node. To be used in avatar deployment diagrams.
    * Creation: 01/07/2014
    * @version 1.0 01/07/2014
    * @author Ludovic APVRILLE
+   * @version 1.1 18/06/2018 (Add processCode)
+   * @author Irina Kit Yan LEE
  */
+
 public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, WithAttributes {
 
     protected int monitored = 0;
+    private String processCode;
 
     public ADDRAMNode(int _x, int _y, int _minX, int _maxX, int _minY, int _maxY, boolean _pos, TGComponent _father, TDiagramPanel _tdp)  {
         super(_x, _y, _minX, _maxX, _minY, _maxY, _pos, _father, _tdp);
@@ -102,11 +102,10 @@ public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, Wit
         value = "name";
 
         myImageIcon = IconManager.imgic700;
+        
+        setProcessCode("");
     }
 
-
-
-
     public int getType() {
         return TGComponentManager.ADD_RAMNODE;
     }
@@ -114,7 +113,6 @@ public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, Wit
     public boolean acceptSwallowedTGComponent(TGComponent tgc) {
         //TraceManager.addDev("Accept swallowed?");
         return tgc instanceof ADDBlockArtifact;
-
     }
 
     public boolean addSwallowedTGComponent(TGComponent tgc, int x, int y) {
@@ -128,16 +126,13 @@ public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, Wit
             addInternalComponent(tgc, 0);
             return true;
         }
-
         return false;
-
     }
 
     public void removeSwallowedTGComponent(TGComponent tgc) {
         removeInternalComponent(tgc);
     }
 
-
     public Vector<ADDChannelArtifact> getArtifactList() {
         Vector<ADDChannelArtifact> v = new Vector<ADDChannelArtifact>();
         
@@ -155,16 +150,21 @@ public class ADDRAMNode extends ADDMemoryNode implements SwallowTGComponent, Wit
                 tgcomponent[i].resizeWithFather();
             }
         }
-
     }
 
-
     public int getMonitored() {
         return monitored;
     }
 
     public void setMonitored(int _monitored){
-	monitored = _monitored;
+    	monitored = _monitored;
     }
 
-}
+	public String getProcessCode() {
+		return processCode;
+	}
+
+	public void setProcessCode(String _processCode) {
+		processCode = _processCode;
+	}
+}
\ No newline at end of file
diff --git a/src/main/java/ui/window/JDialogADDMemoryNode.java b/src/main/java/ui/window/JDialogADDMemoryNode.java
index 947a4b830b4ad3bb2cfaa0e6b847cecb06bfdea7..15abfd4195897e05c5c1b973f8cd4139840efcf0 100755
--- a/src/main/java/ui/window/JDialogADDMemoryNode.java
+++ b/src/main/java/ui/window/JDialogADDMemoryNode.java
@@ -43,6 +43,7 @@ package ui.window;
 
 import ui.util.IconManager;
 import ui.avatardd.ADDMemoryNode;
+import ui.avatardd.ADDRAMNode;
 
 import javax.swing.*;
 import java.awt.*;
@@ -59,6 +60,8 @@ import java.awt.event.ActionListener;
  * Creation: 21/08/2014
  * @version 1.0 21/08/2014
  * @author Ludovic APVRILLE
+ * @version 1.1 18/06/2018 (Add processCode)
+ * @author Irina Kit Yan LEE
  */
 public class JDialogADDMemoryNode extends JDialogBase implements ActionListener  {
 
@@ -66,7 +69,11 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
     private static String[] tracemodeTab = {"VCI logger","VCI stats"};
     private boolean regularClose;
     
-    private JPanel panel2;
+    private JPanel panel2, panel3;
+    private JTabbedPane tabbedPane;
+    private JComboBox<String> periodComboBoxString;
+	private JTextArea processCodeTextArea;
+	private String finalString;
     private Frame frame;
     private ADDMemoryNode node;
     
@@ -81,12 +88,16 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
     protected JTextField dataSize;
     protected JTextField monitored;	
     
+    private String memoryName;
+    
     /** Creates new form  */
     public JDialogADDMemoryNode(Frame _frame, String _title, ADDMemoryNode _node) {
         super(_frame, _title, true);
         frame = _frame;
         node = _node;
         
+        memoryName = _title.split(" ")[1];
+        
         initComponents();
         myInitComponents();
         pack();
@@ -95,6 +106,77 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
     private void myInitComponents() {
     }
     
+    public StringBuffer encode(String data) {
+    	StringBuffer databuf = new StringBuffer(data);
+    	StringBuffer buffer = new StringBuffer("");
+    	int endline = 0;
+    	int nb_arobase = 0;
+    	int condition = 0;
+    	
+        for(int pos = 0; pos != data.length(); pos++) {
+        	char c = databuf.charAt(pos);
+            switch(c) {
+                case '\n' :
+                	break;
+                case '\t' :
+                	break;
+                case '{'  : 
+                	buffer.append("{\n"); 
+                	endline = 1;
+                	nb_arobase++;
+                	break;
+                case '}'  : 
+                	if (nb_arobase == 1) {
+                		buffer.append("}\n"); 
+                		endline = 0;
+                	} else {
+                		int i = nb_arobase;
+                		while (i >= 1) {
+                			buffer.append("\t");
+                			i--;
+                		}
+                		buffer.append("}\n"); 
+                		endline = 1;
+                	}
+                	nb_arobase--;
+                	break;
+                case ';'  :
+                	if (condition == 1) {
+                		buffer.append(";");
+                	} else {
+                		buffer.append(";\n");
+                		endline = 1;
+                	}
+                	break;
+                case ' '  :
+                	if (endline == 0) {
+                		buffer.append(databuf.charAt(pos)); 
+                	}
+                	break;
+                case '(' :
+                	buffer.append("(");
+                	condition = 1;
+                	break;
+                case ')' :
+                	buffer.append(")");
+                	condition = 0;
+                	break;
+                default   : 
+                	if (endline == 1) {
+                		endline = 0;
+                		int i = nb_arobase;
+                		while (i >= 1) {
+                			buffer.append("\t");
+                			i--;
+                		}
+                	}
+                	buffer.append(databuf.charAt(pos)); 
+                	break;
+            }
+        }
+        return buffer;
+    }
+    
     private void initComponents() {
         Container c = getContentPane();
         GridBagLayout gridbag0 = new GridBagLayout();
@@ -109,12 +191,24 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
         
         setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
         
+        if (memoryName.equals("RAM")) {
+			panel3 = new JPanel();
+	        panel3.setLayout(new BorderLayout());
+			panel3.setBorder(new javax.swing.border.TitledBorder("C Code"));
+			panel3.setPreferredSize(new Dimension(400, 200));
+        }
         
         panel2 = new JPanel();
         panel2.setLayout(gridbag2);
         panel2.setBorder(new javax.swing.border.TitledBorder("Memory attributes"));
         panel2.setPreferredSize(new Dimension(400, 200));
         
+        if (memoryName.equals("RAM")) {
+        	tabbedPane = new JTabbedPane();
+        	tabbedPane.add("Attributes", panel2);
+			tabbedPane.add("C Code", panel3);
+        }
+        
 		c1.gridwidth = 1;
         c1.gridheight = 1;
         c1.weighty = 1.0;
@@ -126,14 +220,12 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
         nodeName.setEditable(true);
         nodeName.setFont(new Font("times", Font.PLAIN, 12));
 		panel2.add(nodeName, c1);
- 
         
         c2.gridwidth = 1;
         c2.gridheight = 1;
         c2.weighty = 1.0;
         c2.weightx = 1.0;
         c2.fill = GridBagConstraints.HORIZONTAL;
-      
         
         c2.gridwidth = 1;
         panel2.add(new JLabel("Index:"), c2);
@@ -147,27 +239,54 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
         dataSize = new JTextField(""+node.getDataSize(), 15);
         panel2.add(dataSize, c2);
         
-	/*		c2.gridwidth = 1;
+        /*c2.gridwidth = 1;
         panel2.add(new JLabel("Monitored:"), c2);
         c2.gridwidth = GridBagConstraints.REMAINDER; //end row
         monitored = new JTextField(""+node.getMonitored(), 15);
         panel2.add(monitored, c2);*/
 
-	c2.gridwidth = 1;
+        c2.gridwidth = 1;
         panel2.add(new JLabel("Monitored:"), c2);
         //c2.gridwidth = GridBagConstraints.REMAINDER; //end row
         //monitored = new JTextField(""+node.getMonitored(), 15);//DG 19.04.
-	tracemode = new JComboBox<>(tracemodeTab);
+        tracemode = new JComboBox<>(tracemodeTab);
         tracemode.setSelectedIndex(selectedTracemode);
         tracemode.addActionListener(this);
         panel2.add(tracemode, c2);
         
+        if (memoryName.equals("RAM")) {
+			panel3.add(new JLabel("Behavior function of RAM : "), BorderLayout.NORTH);
+			StringBuffer stringbuf = encode(((ADDRAMNode) node).getProcessCode());
+			String beginString = stringbuf.toString();
+			finalString = beginString.replaceAll("\t}", "}");
+			
+			processCodeTextArea = new JTextArea(finalString);
+			processCodeTextArea.setSize(100, 100);
+			processCodeTextArea.setTabSize(2);
+	
+			processCodeTextArea.setFont(new Font("Arial", Font.PLAIN, 16));
+			processCodeTextArea.setLineWrap(true);
+			processCodeTextArea.setWrapStyleWord(true);
+	
+			JScrollPane processScrollPane = new JScrollPane(processCodeTextArea);
+			processScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+			processScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
+			processScrollPane.setPreferredSize(new Dimension(200, 150));
+	
+			panel3.add(processScrollPane, BorderLayout.SOUTH);
+        }
+        
         // main panel;
         c0.gridheight = 10;
         c0.weighty = 1.0;
         c0.weightx = 1.0;
         c0.gridwidth = GridBagConstraints.REMAINDER; //end row
-        c.add(panel2, c0);
+        
+        if (memoryName.equals("RAM")) {
+            c.add(tabbedPane, c0);
+    	} else {
+    		c.add(panel2, c0);
+    	}
         
         c0.gridwidth = 1;
         c0.gridheight = 1;
@@ -182,12 +301,16 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
             initialValue.setEnabled(b);
             return;
         }*/
-	if (evt.getSource() == tracemode) {
-           selectedTracemode = tracemode.getSelectedIndex();                   
-	}
+		if (evt.getSource() == tracemode) {
+	           selectedTracemode = tracemode.getSelectedIndex();                   
+		}
         
         String command = evt.getActionCommand();
         
+        if (memoryName.equals("RAM")) {
+        	((ADDRAMNode) node).setProcessCode(processCodeTextArea.getText());
+        }
+        
         // Compare the action command to the known actions.
         if (command.equals("Save and Close"))  {
             closeDialog();
@@ -222,10 +345,8 @@ public class JDialogADDMemoryNode extends JDialogBase implements ActionListener
     }
 
     public int getMonitored() {
-	//return tracemodeTab[tracemode.getSelectedIndex()];
-	return tracemode.getSelectedIndex();
+    	//return tracemodeTab[tracemode.getSelectedIndex()];
+    	return tracemode.getSelectedIndex();
         //return monitored.getText();
     }
-    
-    
-}
+}
\ No newline at end of file