Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_closeBaseV.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_closeBaseV.cpp	(revision 30)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_closeBaseV.cpp	(revision 32)
@@ -11,17 +11,8 @@
 
    void Parse::closeBaseV(){
-     int i;
-     for(i==0;i<LEVEL_MAX;i++)
-      {
-      delete ctemp[i];
-      delete arch[i];
-      delete ent[i];
-     }
-     delete pos;
      delete base;
      toplevel.clear();
      absolutePath.clear();
      base=NULL;
-     
    }
 
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_createParam.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_createParam.cpp	(revision 32)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_createParam.cpp	(revision 32)
@@ -0,0 +1,283 @@
+/*
+ *
+ * [desc.]
+ */
+#include "Tools/Viewer/Parser/include/parser.h"
+
+namespace morpheo{
+namespace tools{
+namespace viewer{
+namespace parser{
+
+  morpheo::tools::viewer::bdd::Param *Parse::createAddP(string namegrp,string nameparam)
+  {
+    morpheo::tools::viewer::bdd::Param *p;
+    morpheo::tools::viewer::bdd::LimitParam lp=base->searchLimitParam(nameparam);
+    if(lp.getName()=="")
+      p=new morpheo::tools::viewer::bdd::Param(nameparam,0,namegrp);
+    else
+      p=new morpheo::tools::viewer::bdd::Param(nameparam,lp.getDefault(),namegrp);
+    return p;
+  }
+
+  void Parse::createParam(){
+    int i,j,k,l;
+    morpheo::tools::viewer::bdd::LimitParam lp;
+    morpheo::tools::viewer::bdd::Group *g;
+    morpheo::tools::viewer::bdd::Param *p;
+    g=new morpheo::tools::viewer::bdd::Group("core",0);
+    g->addParam(createAddP("core","size_data"));
+    base->addGroup(g);
+    
+    g=new morpheo::tools::viewer::bdd::Group("cache_unit",1);
+    base->addGroup(g);
+    
+    g=new morpheo::tools::viewer::bdd::Group("icache",2);
+    lp=base->searchLimitParam("nb_icache");
+    for(i=0;i<lp.getDefault();i++)
+       {
+	 p=new morpheo::tools::viewer::bdd::Param("id",i,"icache");
+	 g->addParam(p);
+	 g->addParam(createAddP("icache","arbiter"));
+	 g->addParam(createAddP("icache","nb_port"));
+       }
+    base->addGroup(g);
+    
+    g=new morpheo::tools::viewer::bdd::Group("dcache",2);
+    lp=base->searchLimitParam("nb_dcache");
+    for(i=0;i<lp.getDefault();i++)
+      {
+	p=new morpheo::tools::viewer::bdd::Param("id",i,"dcache");
+	g->addParam(p);
+	g->addParam(createAddP("dcache","arbiter"));
+	g->addParam(createAddP("dcache","nb_port"));
+      }
+    base->addGroup(g);
+    
+    lp=base->searchLimitParam("nb_front_end");
+    j=lp.getDefault();
+    for(i=0;i<j;i++)
+      {
+	g=new morpheo::tools::viewer::bdd::Group("front_end",1);
+	p=new morpheo::tools::viewer::bdd::Param("id",i,"front_end");
+	g->addParam(p);
+	g->addParam(createAddP("front_end","link_icache"));
+	g->addParam(createAddP("front_end","link_out_of_order_engine"));
+	base->addGroup(g);
+	//
+	g=new morpheo::tools::viewer::bdd::Group("fetch_unit",2);
+	base->addGroup(g);
+	//
+	lp=base->searchLimitParam("nb_ifetch");
+	k=lp.getDefault();
+	for(l=0;l<k;l++)
+	  {
+	    g=new morpheo::tools::viewer::bdd::Group("ifetch",3);
+	    p=new morpheo::tools::viewer::bdd::Param("id",i,"ifetch");
+	    g->addParam(p);
+	    g->addParam(createAddP("ifetch","nb_inst"));
+	    g->addParam(createAddP("ifetch","size_queue"));
+	    g->addParam(createAddP("ifetch","link_decod"));
+	    base->addGroup(g);
+	  }
+	//
+	g=new morpheo::tools::viewer::bdd::Group("prediction_unit",2);
+	g->addParam(createAddP("prediction_unit","arbiter"));
+	g->addParam(createAddP("prediction_unit","nb_prediction"));
+	g->addParam(createAddP("prediction_unit","nb_branch_complete"));
+	base->addGroup(g);
+	//
+	g=new morpheo::tools::viewer::bdd::Group("branch_target_buffer",3);
+	g->addParam(createAddP("branch_target_buffer","size_queue"));
+	g->addParam(createAddP("branch_target_buffer","associativity"));
+	base->addGroup(g);
+	//
+	g=new morpheo::tools::viewer::bdd::Group("return_adress_stack",3);
+	g->addParam(createAddP("return_adress_stack","size_queue"));
+	base->addGroup(g);
+	//
+	g=new morpheo::tools::viewer::bdd::Group("branch_context",3);
+	g->addParam(createAddP("branch_context","size_queue"));
+	base->addGroup(g);
+	
+	//
+	g=new morpheo::tools::viewer::bdd::Group("meta_predictor",3);
+	g->addParam(createAddP("meta_predictor","have_meta_predictor"));
+
+	g->addParam(createAddP("meta_predictor","predictor_0_have_bht"));
+	g->addParam(createAddP("meta_predictor","predictor_0_bht_size_shifter"));
+	g->addParam(createAddP("meta_predictor","predictor_0_bht_nb_shifter"));
+	g->addParam(createAddP("meta_predictor","predictor_0_have_pht"));
+	g->addParam(createAddP("meta_predictor","predictor_0_pht_size_counter"));
+	g->addParam(createAddP("meta_predictor","predictor_0_pht_nb_counter"));
+	g->addParam(createAddP("meta_predictor","predictor_0_pht_size_address_share"));
+	
+	g->addParam(createAddP("meta_predictor","predictor_1_have_bht"));
+	g->addParam(createAddP("meta_predictor","predictor_1_bht_size_shifter"));
+	g->addParam(createAddP("meta_predictor","predictor_1_bht_nb_shifter"));
+	g->addParam(createAddP("meta_predictor","predictor_1_have_pht"));
+	g->addParam(createAddP("meta_predictor","predictor_1_pht_size_counter"));
+	g->addParam(createAddP("meta_predictor","predictor_1_pht_nb_counter"));
+	g->addParam(createAddP("meta_predictor","predictor_1_pht_size_address_share"));
+	
+	g->addParam(createAddP("meta_predictor","predictor_2_have_bht"));
+	g->addParam(createAddP("meta_predictor","predictor_2_bht_size_shifter"));
+	g->addParam(createAddP("meta_predictor","predictor_2_bht_nb_shifter"));
+	g->addParam(createAddP("meta_predictor","predictor_2_have_pht"));
+	g->addParam(createAddP("meta_predictor","predictor_2_pht_size_counter"));
+	g->addParam(createAddP("meta_predictor","predictor_2_pht_nb_counter"));
+	g->addParam(createAddP("meta_predictor","predictor_2_pht_size_address_share"));
+	
+	base->addGroup(g);
+	//
+	g=new morpheo::tools::viewer::bdd::Group("decod_unit",2);
+	base->addGroup(g);
+	//
+	lp=base->searchLimitParam("nb_decod");
+	k=lp.getDefault();
+	for(l=0;l<k;l++)
+	  {
+	    g=new morpheo::tools::viewer::bdd::Group("decod",3);
+	    p=new morpheo::tools::viewer::bdd::Param("id",i,"decod");
+	    g->addParam(p);
+	    g->addParam(createAddP("decod","arbiter"));
+	    g->addParam(createAddP("decod","nb_branch_decod"));
+	    g->addParam(createAddP("decod","nb_inst"));
+	    g->addParam(createAddP("decod","size_queue"));
+	    g->addParam(createAddP("decod","link_rename"));
+	    base->addGroup(g);
+	  }
+      }//end front_end
+
+    lp=base->searchLimitParam("nb_out_of_order_engine");
+    j=lp.getDefault();
+    for(i=0;i<j;i++)
+      {
+	g=new morpheo::tools::viewer::bdd::Group("out_of_order_engine",1);
+	p=new morpheo::tools::viewer::bdd::Param("id",i,"out_of_order_engine");
+	g->addParam(p);
+	g->addParam(createAddP("out_of_order_engine","link_execution_loop"));
+
+	base->addGroup(g);
+
+	g=new morpheo::tools::viewer::bdd::Group("rename",2);
+	g->addParam(createAddP("rename","arbiter"));
+	g->addParam(createAddP("rename","nb_inst"));
+	g->addParam(createAddP("rename","size_queue"));
+	g->addParam(createAddP("rename","size_windows"));
+	g->addParam(createAddP("rename","nb_gpr_physical"));
+	g->addParam(createAddP("rename","nb_gpr_free"));
+	g->addParam(createAddP("rename","nb_spr_physical"));
+	g->addParam(createAddP("rename","nb_spr_free"));
+	base->addGroup(g);
+
+	g=new morpheo::tools::viewer::bdd::Group("commit",2);
+	g->addParam(createAddP("commit","arbiter"));
+	g->addParam(createAddP("commit","nb_inst"));
+	g->addParam(createAddP("commit","size_queue"));
+	g->addParam(createAddP("commit","size_windows"));
+	g->addParam(createAddP("commit","commit_out_of_order_thread"));
+	base->addGroup(g);
+	
+      }//end out_of_order
+
+    lp=base->searchLimitParam("nb_execution_loop");
+    j=lp.getDefault();
+    for(i=0;i<j;i++)
+      {
+	g=new morpheo::tools::viewer::bdd::Group("execution_loop",1);
+	p=new morpheo::tools::viewer::bdd::Param("id",i,"execution_loop");
+	g->addParam(p);
+	g->addParam(createAddP("execution_loop","link_dcache"));
+	base->addGroup(g);
+
+	g=new morpheo::tools::viewer::bdd::Group("read_unit",2);
+	base->addGroup(g);
+
+	lp=base->searchLimitParam("nb_reservation_station");
+	k=lp.getDefault();
+	for(l=0;l<k;l++)
+	  {
+	    g=new morpheo::tools::viewer::bdd::Group("reservation_station",3);
+	    p=new morpheo::tools::viewer::bdd::Param("id",i,"reservation_station");
+	    g->addParam(p);
+	    g->addParam(createAddP("reservation_station","size_queue"));
+	    g->addParam(createAddP("reservation_station","one_queue"));
+	    base->addGroup(g);
+	    
+	    g=new morpheo::tools::viewer::bdd::Group("link",4);
+	    p=new morpheo::tools::viewer::bdd::Param("id",0,"link");
+	    g->addParam(p);
+	    base->addGroup(g);
+	    
+	  }
+	    g=new morpheo::tools::viewer::bdd:: Group("memory_unit",2);
+	    g->addParam(createAddP("memory_unit","size_queue"));
+	    g->addParam(createAddP("memory_unit","one_queue"));
+	    g->addParam(createAddP("memory_unit","nb_inst"));
+	    g->addParam(createAddP("memory_unit","size_windows"));
+	    g->addParam(createAddP("memory_unit","bypass_memory_out"));
+	    g->addParam(createAddP("memory_unit","keep_data"));
+	    g->addParam(createAddP("memory_unit","speculated_memory_read"));
+	    base->addGroup(g);
+	    
+	    g=new morpheo::tools::viewer::bdd::Group("link",3);
+	    p=new morpheo::tools::viewer::bdd::Param("id",0,"link");
+	    g->addParam(p);
+	    base->addGroup(g);
+
+	g=new morpheo::tools::viewer::bdd::Group("execution_unit",2);
+	base->addGroup(g);
+
+	lp=base->searchLimitParam("nb_execution");
+	k=lp.getDefault();
+	for(l=0;l<k;l++)
+	  {
+	    g=new morpheo::tools::viewer::bdd::Group("execution",3);
+	    p=new morpheo::tools::viewer::bdd::Param("id",i,"execution");
+	    g->addParam(p);
+	    g->addParam(createAddP("execution","type_mul"));
+	    g->addParam(createAddP("execution","type_div"));
+	    g->addParam(createAddP("execution","type_ext"));
+	    g->addParam(createAddP("execution","type_ff1"));
+	    g->addParam(createAddP("execution","type_fl1"));
+	    base->addGroup(g);
+	    
+	  }
+	
+	g=new morpheo::tools::viewer::bdd:: Group("write_unit",2);
+	base->addGroup(g);
+
+	lp=base->searchLimitParam("nb_writeback");
+	k=lp.getDefault();
+	for(l=0;l<k;l++)
+	  {
+	    g=new morpheo::tools::viewer::bdd::Group("writeback",3);
+	    p=new morpheo::tools::viewer::bdd::Param("id",i,"writeback");
+	    g->addParam(p);
+	    g->addParam(createAddP("writeback","size_queue"));
+	    g->addParam(createAddP("writeback","one_queue"));
+	    g->addParam(createAddP("writeback","bypass_execute_gpr"));
+	    g->addParam(createAddP("writeback","bypass_execute_spr"));
+	    g->addParam(createAddP("writeback","bypass_memory_in"));
+	    base->addGroup(g);
+
+	    g=new morpheo::tools::viewer::bdd::Group("link",4);
+	    p=new morpheo::tools::viewer::bdd::Param("id",0,"link");
+	    g->addParam(p);
+	    base->addGroup(g);
+	    
+	  }
+	
+	    
+	
+      }//end execution_loop
+    
+     
+   }
+
+
+};//end parser
+};//end viewer
+};//end tools
+};//end morpheo
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file.cpp	(revision 30)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file.cpp	(revision 32)
@@ -4,5 +4,5 @@
  */
 #include "Tools/Viewer/Parser/include/parser.h"
-
+#include "qfileinfo.h"
 namespace morpheo{
 namespace tools{
@@ -11,22 +11,22 @@
 
    int Parse::open_file(string name,int level){
-
+     bool pere=false;
     QFile file(QString::fromStdString(name));
-    QString testname,testname2;
-    QString tmppath=QString::fromStdString(name);
-    QString path=tmppath.left(tmppath.lastIndexOf('/',-1,Qt::CaseSensitive)+1);
-    absolutePath=path.toStdString();
-    testname=tmppath.right(tmppath.lastIndexOf('.',-1,Qt::CaseSensitive)-1);
-    testname2=testname.left(testname.lastIndexOf('.',-1,Qt::CaseSensitive));
-    
-    if(tmppath.contains('-') && level==0) //file not top level (first open file)
+    QFileInfo info(file);
+    QString testname;
+    absolutePath=info.absolutePath().toStdString();
+    absolutePath.append("/");
+    testname=info.baseName();
+    if(testname.contains('-') && level==0) //file not top level (first open file)
       {
-	testname2=testname2.left(testname2.lastIndexOf('-',-1,Qt::CaseSensitive));
+	testname=testname.left(testname.lastIndexOf('-',-1,Qt::CaseSensitive));
       }
+    else
+      pere=true;
     
     
      if( !file.open( QIODevice::ReadOnly ) )
        {
-	 cout << "Failed to load file. 1\n";
+	 cerr << "Position File :: Failed to load file. \n";
 	 return -1;
        }
@@ -35,5 +35,5 @@
      if( !doc.setContent( &file ) )
       {
-	cout <<  "Failed to load file.2\n";
+	cerr <<  "Failed XML parse file.\n";
 	file.close();
 	return -1;
@@ -43,5 +43,5 @@
      if( root.tagName() != "description" )
        {
-	 cout <<"Invalid file.\n";
+	 cerr <<"Invalid file.\n";
 	 return -1;
        }
@@ -54,14 +54,18 @@
 	 if(!base){
 	   base=new morpheo::tools::viewer::bdd::BaseV(); 
-	   toplevel=testname2.toStdString();
+	   toplevel=info.baseName().toStdString();
+	   if(pere==true)
+	     {
+	       string op="";
+	       op.append(absolutePath);
+	       op.append(toplevel);
+	       open_file_param(op);
+	     }
 	 }
 	 pos=new morpheo::tools::viewer::bdd::BaseP();
-	 //base->addBaseP(pos);
 	 parser_pos(root.firstChild(),level);    
+
 	 
        }
-
-     //     delete pos;
-     //delete ctemp;
      return 0;
    }
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file_param.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file_param.cpp	(revision 32)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_open_file_param.cpp	(revision 32)
@@ -0,0 +1,106 @@
+/*
+ *
+ * [desc.]
+ */
+#include "Tools/Viewer/Parser/include/parser.h"
+
+namespace morpheo{
+namespace tools{
+namespace viewer{
+namespace parser{
+
+  int Parse::open_file_param(string name){
+    /*!! name of entity top level!!*/
+    QString s,s2;
+
+    s.append(QString::fromStdString(name));
+
+    s2.append(QString::fromStdString(name));
+    
+    QFile file2(s.append(".gen"));
+
+    QFile file(s2.append(".cfg"));
+
+    
+    if( !file2.open( QIODevice::ReadOnly ) )
+       {
+	 cerr << "Failed to load file. File not found\n";
+	 return -1;
+       }
+
+    QDomDocument doc2( "pos" );
+     if( !doc2.setContent( &file2 ) )
+      {
+	cerr <<  "Failed to load file.Not Xml File\n";
+	file2.close();
+	return -1;
+      }
+     file2.close();
+     QDomElement root2 = doc2.documentElement();
+     if( root2.tagName() != "parameters" )
+       {
+	 cerr <<"Invalid file.\n";
+	 return -1;
+       }
+     else
+       {
+         #ifdef DBUG_PARSE
+	 cout << "parameters limit" <<endl;
+         #endif
+	 	 	 
+	 parser_limitparam(root2.firstChild());    
+	 
+       }
+    
+
+     if( !file.open( QIODevice::ReadOnly ) )
+       {
+	 cerr << "Failed to load file. File not found.\n";
+	 cerr << "search temporary file if exists.\n";
+	 file.setFileName (s2.append("~"));
+	 if( !file.open( QIODevice::ReadOnly ) )
+	   {
+	     cerr << "Failed to load temporary file. Create a default configuration.\n";
+	     createParam();
+	     return 0;
+	   }
+       
+	 
+       }
+
+     QDomDocument doc( "gen2" );
+     if( !doc.setContent( &file ) )
+      {
+	cerr <<  "Failed to load file.Not Xml File\n";
+	file.close();
+	return -1;
+      }
+     file.close();
+     QDomElement root = doc.documentElement();
+     if( root.tagName() != "cpu" && \
+	 strcmp((root.attribute("name","").toStdString()).c_str(),name.c_str()))
+       {
+	 cout <<"Invalid file.\n";
+	 return -1;
+       }
+     else
+       {
+         #ifdef DBUG_PARSE
+	 cout << "parameters" <<endl;
+         #endif
+	 
+	 parser_param(root.firstChild(),0);    
+	 
+       }
+
+     return 0;
+
+
+   }
+
+
+};//end parser
+};//end viewer
+};//end tools
+};//end morpheo
+
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_limitparam.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_limitparam.cpp	(revision 32)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_limitparam.cpp	(revision 32)
@@ -0,0 +1,68 @@
+/*
+ *
+ * [desc.]
+ */
+#include "Tools/Viewer/Parser/include/parser.h"
+using namespace morpheo::tools::viewer::bdd;
+namespace morpheo{
+namespace tools{
+namespace viewer{
+namespace parser{     
+
+  void Parse::parser_limitparam(QDomNode n){
+       while( !n.isNull() )
+      {
+	QDomElement e = n.toElement();
+	if( !e.isNull() )
+	  {
+	    
+	    if (e.tagName() == "parameter" )
+	      {
+                #ifdef DBUG_PARSE
+		cout << "parameter" <<endl;
+		cout << e.attribute("name","").toStdString() <<endl;
+		#endif
+		limit=new morpheo::tools::viewer::bdd::LimitParam\
+		  (e.attribute("name","").toStdString(),\
+		   e.attribute("min","").toInt(0,10),\
+		   e.attribute("max","").toInt(0,10),\
+		   e.attribute("step","").toStdString(),\
+		   e.attribute("default","").toInt(0,10),\
+		   e.attribute("level","").toInt(0,10));
+		
+		//base->addLimitParam(limit);		
+		parser_limitparam(n.firstChild());
+		if( (n.nextSibling().toElement()).tagName()!= "group"){
+		  base->addLimitParam(limit);		
+		  delete limit;
+		}
+	      } 
+	    if (e.tagName() == "group" )
+	      {
+
+		limit->setGroup(e.attribute("name","").toStdString());
+		base->addLimitParam(limit);		
+		delete limit;
+		
+	      }
+	    if (e.tagName() == "link" )
+	      {
+
+		base->addLinksrc(e.attribute("name","").toStdString(),\
+				 e.attribute("src","").toStdString());
+		base->addLinkdest(e.attribute("name","").toStdString(),\
+				 e.attribute("dest","").toStdString());
+	      }
+      
+	  }
+	n = n.nextSibling(); //next channel
+	    
+      }
+      
+  }
+
+};//end parser
+};//end viewer
+};//end tools
+};//end morpheo
+
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_param.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_param.cpp	(revision 32)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_param.cpp	(revision 32)
@@ -0,0 +1,45 @@
+/*
+ *
+ * [desc.]
+ */
+#include "Tools/Viewer/Parser/include/parser.h"
+using namespace morpheo::tools::viewer::bdd;
+namespace morpheo{
+namespace tools{
+namespace viewer{
+namespace parser{     
+
+  void Parse::parser_param(QDomNode n,int level){
+       while( !n.isNull() )
+      {
+	QDomElement e = n.toElement();
+	QDomNamedNodeMap a;
+	QDomAttr ab;
+	unsigned i;
+	if( !e.isNull() )
+	  {
+	    group=new Group(e.tagName().toStdString(),level);
+	    a=e.attributes();
+	    for(i=0;i<a.length();i++)
+	    {
+	      ab=a.item(i).toAttr();
+	      param=new Param(ab.name().toStdString(),ab.value().toInt(),e.tagName().toStdString());
+	      //cout << ab.name().toStdString()<<endl;
+	      group->addParam(param);
+	      delete param;
+	    }
+	    base->addGroup(group);
+	    delete group;
+	    parser_param(n.firstChild(),level+1);
+	  }
+	n = n.nextSibling(); //next channel
+	    
+      }
+      
+  }
+
+};//end parser
+};//end viewer
+};//end tools
+};//end morpheo
+
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_pos.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_pos.cpp	(revision 30)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_parser_pos.cpp	(revision 32)
@@ -51,5 +51,5 @@
 		    #endif
 		    base->addBaseP(pos,s);
-		    
+		    delete pos;
 		  }
 	      } 
@@ -76,6 +76,6 @@
 		
 		base->addBaseP(pos,s);
-
-		parser_pos(n.firstChild(),level);    
+		delete pos;
+		parser_pos(n.firstChild(),level);
 	      } 
 	    if (e.tagName() == "component" )
@@ -114,4 +114,5 @@
 		  ctemp[level]->addport(new Port(*it));
 		
+		
 	      } 
 	    if (e.tagName() == "port_map" )
@@ -127,5 +128,5 @@
 		
 		ctemp[level]->addPortMap(p);
-		
+		delete p;
 	      } 
       
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_refresh.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_refresh.cpp	(revision 32)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_refresh.cpp	(revision 32)
@@ -0,0 +1,30 @@
+/*
+ *
+ * [desc.]
+ */
+#include "Tools/Viewer/Parser/include/parser.h"
+
+namespace morpheo{
+namespace tools{
+namespace viewer{
+namespace parser{
+
+   int Parse::refresh(){
+     cout << "enregistrer dans un fichier tmp\n";
+     //save_file(new_name,1);
+     cout<< "detruire la base\n"; 
+     //delete base;
+     //toplevel.clear();
+     //absolutePath.clear();
+     //base=NULL;
+     cout <<"j'appelle les fonctions de regeneration de la lib Morpheo\n";
+     //??
+     cout <<"j'envoie un \"message\" que la partie graphique puisse l'ouvrir\n";
+     return 0;
+   }
+
+
+};//end parser
+};//end viewer
+};//end tools
+};//end morpheo
Index: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_save.cpp
===================================================================
--- trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_save.cpp	(revision 32)
+++ trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Parser/src/Parse_save.cpp	(revision 32)
@@ -0,0 +1,171 @@
+/*save configuration file
+ * name: file name
+ * type: 0 ->user save a file 
+ *       1 ->function apply() temporary save
+ */
+#include "Tools/Viewer/Parser/include/parser.h"
+#include "qmessagebox.h"
+namespace morpheo{
+namespace tools{
+namespace viewer{
+namespace parser{
+
+//   QDomElement Parse::createXMLNode( QDomDocument &d , morpheo::tools::viewer::bdd::Group &grp)
+//   {
+//     QDomElement cn;
+//     cn= d.createElement( QString::fromStdString(grp.getName()));
+      
+//     QList<morpheo::tools::viewer::bdd::Param> p=grp.getParam();
+//     if(p.size()!=0)
+//       {
+// 	for(QList<morpheo::tools::viewer::bdd::Param>::iterator it2=p.begin();it2!=p.end();++it2)
+// 	  {
+// 	    cn.setAttribute( QString::fromStdString(it2->getName()) ,it2->getValue() );
+// 	  }
+//       }
+    
+       
+//     return cn;
+//   }
+
+  
+  int Parse::save_file(string name,int type){
+ //    int level=0;
+//     QDomDocument doc( "Viewercfg" );
+//     QDomElement root = doc.createElement("cpu"); 
+//     QDomNode child=root.setAttribute("name",toplevel);
+//     doc.appendChild(root);
+    
+    
+//     QList<morpheo::tools::viewer::bdd::Group> g=base->getGroups();
+//    for( QList<morpheo::tools::viewer::bdd::Group>::iterator it = g.begin(); it != g.end(); ++it )
+//       {
+// 	//3 cas
+// 	if(it->getLevel()==0)
+//  	  save=root.appendChild(createXMLNode( doc , it));
+// 	if(it->getLevel()>level){
+// 	  child=root.appendChild(createXMLNode( doc , it));
+// 	  root=(QDomElement)child;
+// 	}
+// 	if(it->getLevel()==level){
+// 	  root= createXMLNode( doc , it);
+// 	  save=root;
+// 	}
+// 	if(it->getLevel()<level){
+// 	  root.appendChild(createXMLNode( doc , it));
+	  
+// 	}
+// 	root.appendChild(createXMLNode( doc , it));
+    
+//     }
+
+    
+    
+    QString s; 
+    if (type==0)
+      s.append(QString::fromStdString(name));
+    else {
+      s.append(QString::fromStdString(name));
+      s.append("~");
+    }
+
+    QFile file(s);
+    if (!file.open(QIODevice::WriteOnly))
+      {
+	//QMessageBox::warning( this, "Saving", "Failed to save file." );
+	cerr <<"Failed to save file. " <<endl;
+	return -1;
+      }
+    QString ecart;
+    QTextStream ts( &file );
+    ts << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" <<endl<<endl;
+    ts << "<cpu name=\"" << QString::fromStdString(toplevel) << "\" >" <<endl<<endl;
+    
+    
+    QList<morpheo::tools::viewer::bdd::Group> *g=base->getGroups();
+    for( QList<morpheo::tools::viewer::bdd::Group>::iterator it = g->begin(); it != g->end(); ++it )
+      {
+
+	ecart = "  ";
+	if(it->getLevel() == 1)
+	  ecart.append("     ");
+	if(it->getLevel() == 2)
+	  ecart.append("        ");
+	if(it->getLevel() == 3)
+	  ecart.append("          ");
+	if(it->getLevel() == 4)
+	  ecart.append("            ");
+	if(it->getLevel() == 5)
+	  ecart.append("              ");
+
+	ts << ecart << "<" << QString::fromStdString(it->getName()) ;
+	QList<morpheo::tools::viewer::bdd::Param> p=it->getParam();
+	if(p.size()!=0)
+	  {
+	    for(QList<morpheo::tools::viewer::bdd::Param>::iterator it2=p.begin();it2!=p.end();++it2)
+	      {
+		ts<< " " << QString::fromStdString(it2->getName()) << "=\"" << it2->getValue() << "\" " ;
+	      }
+	    if (it->getLevel()==0 ||it->getName()=="front_end" ||it->getName()=="prediction_unit"||\
+		it->getName()=="out_of_order_engine"||it->getName()=="execution_loop"||it->getName()=="reservation_station"||\
+		it->getName()=="writeback"||it->getName()=="memory_unit")
+	      ts  << "> " <<endl <<endl;
+	    else
+	      ts  << "/> " <<endl <<endl;
+	  }
+	else
+	  {
+	    ts << ">" <<endl <<endl;
+	  }
+
+	
+	if((it+1)!=g->end() && (it+1)->getName()=="front_end" && (it)->getName()=="dcache")
+	  ts << "     </cache_unit>" <<endl <<endl;
+	  
+	if((it+1)!=g->end() && (it+1)->getName()=="prediction_unit" && (it)->getName()=="ifetch")
+	  ts << "        </fetch_unit>" <<endl <<endl;
+	if((it+1)!=g->end() && (it+1)->getName()=="decod_unit" && (it)->getName()=="meta_predictor")
+	  ts << "        </prediction_unit>" <<endl <<endl;
+	  
+	if((it+1)!=g->end() && (it+1)->getName()=="out_of_order_engine" && (it)->getName()=="decod")
+	  {
+	    ts << "        </decod_unit>" <<endl <<endl;
+	    ts << "     </front_end>" <<endl <<endl;
+	  }
+	if((it+1)!=g->end() && (it+1)->getName()=="execution_loop" && (it)->getName()=="commit")
+	  ts << "       </out_of_order_engine>" <<endl <<endl;
+	if((it+1)!=g->end() && (it+1)->getName()=="memory_unit" && (it)->getName()=="link")
+	  {
+	    ts << "          </reservation_station>" <<endl <<endl;
+	    ts << "        </read_unit>" <<endl <<endl;
+	  }
+	
+	if((it+1)!=g->end() && (it+1)->getName()=="execution_unit" && (it)->getName()=="link")
+	    ts << "        </memory_unit>" <<endl <<endl;
+
+	if((it+1)!=g->end() && (it+1)->getName()=="write_unit" && (it)->getName()=="execution")
+	    ts << "        </execution_unit>" <<endl <<endl;
+
+	if((it+1)!=g->end() && (it+1)->getName()=="writeback" && (it)->getName()=="link")
+	    ts << "        </writeback>" <<endl <<endl;
+	
+	
+      }
+
+    ts << "         </writeback>" <<endl <<endl;
+    ts << "      </write_unit>" <<endl<<endl;
+    ts << "    </execution_loop>" <<endl<<endl;
+    ts << "  </core>" <<endl<<endl;
+    ts << "</cpu>" <<endl<<endl;
+    file.close();
+    return 0;
+
+
+  }
+
+
+};//end parser
+};//end viewer
+};//end tools
+};//end morpheo
+
