Index: vis_dev/vis-2.3/models/debug/and2.v
===================================================================
--- vis_dev/vis-2.3/models/debug/and2.v	(revision 35)
+++ vis_dev/vis-2.3/models/debug/and2.v	(revision 36)
@@ -5,15 +5,11 @@
 
 reg c;
-wire x;
-wire y;
 
 initial c = 0;
 
-assign x = a & b;
-assign y = (a)?b:x;
 
 always @(posedge clk)
 begin
-	c = ~x + c;
+	c = a & b ;
 end
 endmodule 
Index: vis_dev/vis-2.3/src/debug/debug.c
===================================================================
--- vis_dev/vis-2.3/src/debug/debug.c	(revision 35)
+++ vis_dev/vis-2.3/src/debug/debug.c	(revision 36)
@@ -127,7 +127,9 @@
 
 
-static int CommandCreateAbnormal(Hrc_Manager_t ** hmgr,int  argc, char ** argv)
+static int CommandCreateAbnormal(Hrc_Manager_t ** hmgr, int  argc, char ** argv)
 {
   Ntk_Network_t * ntk;
+  int c,verbose;
+  Dbg_Abnormal_t * abnormal;
   ntk = Ntk_HrcManagerReadCurrentNetwork(*hmgr);
   if (ntk == NIL(Ntk_Network_t)) {
@@ -135,78 +137,14 @@
 	return 1;
   }
-  lsGen gen;
-  Ntk_Node_t* node;
-
-  (void) fprintf(vis_stdout, "** NODE **\n");
-  Ntk_NetworkForEachNode(ntk,gen,node){
-	  if(Ntk_NodeTestIsCombinational(node)){
-		if(Ntk_NodeReadNumFanins(node) > 1 && Ntk_NodeReadNumFanouts(node)> 0)
-		{
-		  if(strcmp(Ntk_NodeReadName(node),"_n2")==0)
-		  {
-			char * nodeName = util_strsav(Ntk_NodeReadName(node));
-	        printf("%s \n",  nodeName); 
-			(void) fprintf(vis_stdout, "** read table\n");
-			Tbl_Table_t    *table =  Ntk_NodeReadTable(node);
-
-			Tbl_TableWriteBlifMvToFile(table,2,vis_stdout);
-			// Build new variables abnormal  and  input
-			//abn
-			char * abnName = (char *) malloc(strlen(nodeName) + 5);
-			sprintf(abnName,"abn_%s",Ntk_NodeReadName(node));
-			Var_Variable_t * abn = Var_VariableAlloc(NIL(Hrc_Node_t),abnName);
-			Ntk_Node_t * newNode = Ntk_NodeCreateInNetwork(ntk, abnName,abn);
-			Ntk_NodeDeclareAsPrimaryInput(newNode);
-			//new free inputs
-			char * iName = (char *) malloc(strlen(nodeName) + 3);
-			sprintf(iName,"i_%s",Ntk_NodeReadName(node));
-			Var_Variable_t * i = Var_VariableAlloc(NIL(Hrc_Node_t),iName);
-			Ntk_Node_t * newNode2 = Ntk_NodeCreateInNetwork(ntk, iName, i);
-			Ntk_NodeDeclareAsPrimaryInput(newNode2);
-			//Add in the table
-			Tbl_TableAddColumn(table,abn,0);
-			int abnIndex = Tbl_TableReadVarIndex(table, abn, 0);
-			Tbl_TableAddColumn(table,i,0);
-			int iIndex = Tbl_TableReadVarIndex(table, i, 0);
-
-			//For each row already there in the table
-			int rowNum;
-			for(rowNum = 0; rowNum <  Tbl_TableReadNumRows(table);rowNum++){
-				Tbl_Entry_t *abnEntry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
-				Tbl_EntrySetValue(abnEntry,0,0);
-				Tbl_TableSetEntry(table, abnEntry, rowNum, abnIndex, 0);
-				Tbl_Entry_t *iEntry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
-				Tbl_EntrySetValue(iEntry,0,1);
-				Tbl_TableSetEntry(table, iEntry, rowNum, iIndex, 0);
-			}
-			//the new row
-			int r = Tbl_TableAddRow(table);
-
-			int colNum;
-		    for (colNum = 0; colNum < Tbl_TableReadNumInputs(table); colNum++) {
-				Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
-				printf("entry : colNum %d \n",colNum);
-				if(colNum == abnIndex || colNum == iIndex)
-					Tbl_EntrySetValue(entry,1,1);
-				else
-					Tbl_EntrySetValue(entry,0,1);
-			    Tbl_TableSetEntry(table, entry, r, colNum, 0);
-			}
-			for (colNum = 0; colNum < Tbl_TableReadNumOutputs(table); colNum++){
-				Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
-				Tbl_EntrySetValue(entry,1,1);
-			    Tbl_TableSetEntry(table, entry, r, colNum, 1);
-			}
-			 printf("---------------\n");
-			 Tbl_TablePrintStats(table, vis_stdout);
-			 Tbl_TableWriteBlifMvToFile(table,0,vis_stdout);
-			 free(abnName);
-			 free(iName);
-		  }
+  while ((c = util_getopt(argc, argv, "vh:m:k:o:")) != EOF) {
+	switch(c) {
+		case 'v':
+			verbose = 1;
+			break;
 		}
-	 }
-  }
-  // TODO
-  //Remplacer l'ancien network par le nouveau 
+ }
+  abnormal = Dbg_DebugAbnormalAlloc(ntk);
+  abnormal->verbose = verbose;
+  Dbg_AddAbnormalPredicatetoNetwork(abnormal);
 }
 /**Function********************************************************************
Index: vis_dev/vis-2.3/src/debug/debug.h
===================================================================
--- vis_dev/vis-2.3/src/debug/debug.h	(revision 35)
+++ vis_dev/vis-2.3/src/debug/debug.h	(revision 36)
@@ -65,5 +65,5 @@
 /* Type declarations                                                         */
 /*---------------------------------------------------------------------------*/
-
+typedef struct DbgAbnormalStruct Dbg_Abnormal_t;
 
 /*---------------------------------------------------------------------------*/
@@ -76,4 +76,42 @@
 /*---------------------------------------------------------------------------*/
 
+/**Macro***********************************************************************
+
+  Synopsis     [Iterates over the abnormal predicates.]
+
+  Description  [This macro iterates over the abnormal predicates. It is an error
+  ]
+
+  SideEffects  [This macro instantiates macros from the array package.  Hence
+  it is advisable not to nest this macro within array macros.]
+
+  SeeAlso      [Ntk_NodeForFreeInputs]
+
+******************************************************************************/
+#define Dbg_ForEachAbnormal(                                       \
+  /* Dbg_Abnormal_t * */ abnormal   /* abnormal to iterate abn */,            \
+  /* int */          i      /* local variable for iterator */,       \
+  /* Ntk_Node_t * */ abn  /* abn of node */                      \
+)                                                                   \
+  arrayForEachItem(Ntk_Node_t *, Dbg_ReadAbn(abnormal), i, abn)
+/**Macro***********************************************************************
+
+  Synopsis     [Iterates over the abnormal predicates.]
+
+  Description  [This macro iterates over the abnormal predicates. It is an error
+  ]
+
+  SideEffects  [This macro instantiates macros from the array package.  Hence
+  it is advisable not to nest this macro within array macros.]
+
+  SeeAlso      [Ntk_NodeForFreeInputs]
+
+******************************************************************************/
+#define Dbg_ForEachFreeInputs(                                       \
+  /* Dbg_Abnormal_t * */ abnormal   /* abnormal to iterate abn */,            \
+  /* int */          i      /* local variable for iterator */,       \
+  /* Ntk_Node_t * */ abn  /* abn of node */                      \
+)                                                                   \
+  arrayForEachItem(Ntk_Node_t *, Dbg_ReadFreeInputs(abnormal), i, abn)
 
 /**AutomaticStart*************************************************************/
@@ -83,10 +121,13 @@
 /*---------------------------------------------------------------------------*/
 
-void printLatch(st_table* CoiTable);
-st_table * generateAllLatches(Ntk_Network_t * ntk);
-void mdd_GetState_Values(mdd_manager *mgr, mdd_t * top, FILE * f);
 EXTERN void Debug_Init(void);
 EXTERN void Debug_End(void);
-
+EXTERN Dbg_Abnormal_t * Dbg_DebugAbnormalAlloc(Ntk_Network_t * network);
+EXTERN void  Dbg_DebugAbnormalFree(Dbg_Abnormal_t * abn);
+EXTERN void Dbg_AddAbnormalPredicatetoNetwork(Dbg_Abnormal_t* abnormal);
+EXTERN void Dbg_AddAbnormalPredicate(Dbg_Abnormal_t * abn, Ntk_Node_t* abnNode);
+EXTERN void Dbg_AddFreeInput(Dbg_Abnormal_t * abn, Ntk_Node_t* fNode);
+EXTERN array_t* Dbg_ReadFreeInputs(Dbg_Abnormal_t *abnormal);
+EXTERN array_t* Dbg_ReadAbn(Dbg_Abnormal_t *abnormal);
 /**AutomaticEnd***************************************************************/
 
Index: vis_dev/vis-2.3/src/debug/debug.make
===================================================================
--- vis_dev/vis-2.3/src/debug/debug.make	(revision 35)
+++ vis_dev/vis-2.3/src/debug/debug.make	(revision 36)
@@ -1,3 +1,3 @@
-CSRC += debug.c debugUtilities.c
+CSRC += debug.c debugUtilities.c debugAbnormal.c
 HEADERS += debug.h debugInt.h
 
Index: vis_dev/vis-2.3/src/debug/debugAbnormal.c
===================================================================
--- vis_dev/vis-2.3/src/debug/debugAbnormal.c	(revision 36)
+++ vis_dev/vis-2.3/src/debug/debugAbnormal.c	(revision 36)
@@ -0,0 +1,229 @@
+#include "debugInt.h"
+/**Function********************************************************************
+ 
+  Synopsis    [create New node]
+
+  Description [Create new primary input in the current network at a given
+  output node.  Return the variable created]
+
+  SideEffects [Modify the network]
+
+  SeeAlso     []
+
+******************************************************************************/
+Ntk_Node_t * Dbg_CreateNewNode(Ntk_Network_t * ntk,Ntk_Node_t*
+node, char * varName  )
+{
+	array_t * fanin = array_dup(Ntk_NodeReadFanins(node));
+	array_t * fanout = array_alloc(Ntk_Node_t*,0);
+	char * nodeName = util_strsav(Ntk_NodeReadName(node));
+	//Create var Name
+	char * newVarName = (char *) malloc(strlen(nodeName) + strlen(varName) +1);
+	sprintf(newVarName,"%s_%s",nodeName,varName);
+	Var_Variable_t * var = Var_VariableAlloc(NIL(Hrc_Node_t),newVarName);
+	//Create new Node
+	Ntk_Node_t * newNode = Ntk_NodeCreateInNetwork(ntk, newVarName,var);
+	Ntk_NodeDeclareAsPrimaryInput(newNode);
+	//Add in the fanin of the node
+    array_insert_last(Ntk_Node_t*,fanin,newNode);
+	Ntk_NodeSetFanins(node,fanin);
+	//Add Fanout to the newNode
+    array_insert_last(Ntk_Node_t*,fanout,node);
+	Ntk_NodeSetFanouts(newNode,fanout);
+	free(newVarName);
+
+	return newNode;
+
+}
+/**Function********************************************************************
+ 
+  Synopsis    [Add abnormal predicates to the network]
+
+  Description [Given a network after flatten the hierarchy,
+  change the table of each combinatorial node
+  with a new table including the abnormal predicate.
+  For a combinatorial node n is tranformed into (abn_n)?i_n:n 
+  If the abnormal predicate is activ then n is replaced by a free input]
+
+  SideEffects [fill the abnormal structure]
+
+  SeeAlso     []
+
+******************************************************************************/
+
+void Dbg_AddAbnormalPredicatetoNetwork(Dbg_Abnormal_t* abnormal ) /*abnormal struct*/
+{
+
+  Ntk_Network_t * ntk = abnormal->network;
+  lsGen gen;
+  Ntk_Node_t* node;
+  Ntk_NetworkForEachNode(ntk,gen,node){
+  //For each combinatorial node
+  if(Ntk_NodeTestIsCombinational(node)){
+	if(Ntk_NodeReadNumFanins(node) > 1 && Ntk_NodeReadNumFanouts(node)> 0)
+	{
+		char * nodeName = util_strsav(Ntk_NodeReadName(node));
+        printf("%s \n",  nodeName); 
+
+		Tbl_Table_t    *table =  Ntk_NodeReadTable(node);
+		(void) fprintf(vis_stdout, "** old table\n");
+		Tbl_TableWriteBlifMvToFile(table,2,vis_stdout);
+		// Build new variables abnormal  and  input
+		Ntk_Node_t * abnNode = Dbg_CreateNewNode(ntk,node,"abn");
+		Ntk_Node_t * iNode   = Dbg_CreateNewNode(ntk,node,"i");
+		Dbg_AddFreeInput(abnormal,iNode);
+		Dbg_AddAbnormalPredicate(abnormal,abnNode);
+		Var_Variable_t * abn = Ntk_NodeReadVariable(abnNode);
+		Var_Variable_t * i   = Ntk_NodeReadVariable(iNode);
+		//Add in the table
+		Tbl_TableAddColumn(table,abn,0);
+		int abnIndex = Tbl_TableReadVarIndex(table, abn, 0);
+		Tbl_TableAddColumn(table,i,0);
+		int iIndex = Tbl_TableReadVarIndex(table, i, 0);
+
+		//For each row already there in the table
+		int rowNum;
+		for(rowNum = 0; rowNum <  Tbl_TableReadNumRows(table);rowNum++){
+			Tbl_Entry_t *abnEntry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
+			Tbl_EntrySetValue(abnEntry,0,0);
+			Tbl_TableSetEntry(table, abnEntry, rowNum, abnIndex, 0);
+			Tbl_Entry_t *iEntry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
+			Tbl_EntrySetValue(iEntry,0,1);
+			Tbl_TableSetEntry(table, iEntry, rowNum, iIndex, 0);
+		}
+		//the new row
+		int r = Tbl_TableAddRow(table);
+
+		int colNum;
+	    for (colNum = 0; colNum < Tbl_TableReadNumInputs(table); colNum++) {
+			Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
+			if(colNum == abnIndex || colNum == iIndex)
+				Tbl_EntrySetValue(entry,1,1);
+			else
+				Tbl_EntrySetValue(entry,0,1);
+		    Tbl_TableSetEntry(table, entry, r, colNum, 0);
+		}
+		for (colNum = 0; colNum < Tbl_TableReadNumOutputs(table); colNum++){
+			Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c);
+			Tbl_EntrySetValue(entry,1,1);
+		    Tbl_TableSetEntry(table, entry, r, colNum, 1);
+		}
+		 printf("---------------\n");
+		 Tbl_TableWriteBlifMvToFile(table,0,vis_stdout);
+	  }
+	}
+}
+}
+/**Function********************************************************************
+ 
+  Synopsis    [Allocate a new abnormal structure]
+
+  Description [The structure contains the network with abnormal predicate,
+  and two sets of Ntk_Node_t for the abnormal and the free inputs]
+
+  SideEffects [Allocate the abnormal structure]
+
+  SeeAlso     []
+
+******************************************************************************/
+
+Dbg_Abnormal_t * Dbg_DebugAbnormalAlloc(Ntk_Network_t * network)
+{
+	 Dbg_Abnormal_t * abn = ALLOC(Dbg_Abnormal_t, 1);
+
+	 abn->network = network;
+	 abn->abnormal = array_alloc(Ntk_Node_t*,0);
+	 abn->freeInputs = array_alloc(Ntk_Node_t*,0);
+	 abn->verbose = 0;
+	 return abn;
+}	
+
+/**Function********************************************************************
+ 
+  Synopsis    [Deallocate a new abnormal structure]
+
+  Description [Free the arrays not the network]
+
+  SideEffects [free the abnormal structure]
+
+  SeeAlso     []
+
+******************************************************************************/
+
+void  Dbg_DebugAbnormalFree(Dbg_Abnormal_t * abn)
+{
+	 array_free(abn->abnormal);
+	 array_free(abn->freeInputs);
+	 FREE(abn);
+}	
+
+
+/**Function********************************************************************
+ 
+  Synopsis    [Add abnormal predicate]
+
+  Description [add a node to the predicates array, it should not be already
+  present by construction of abnormal predicate]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+
+void  Dbg_AddAbnormalPredicate(Dbg_Abnormal_t * abn, Ntk_Node_t* abnNode)
+{
+	assert(abnNode != NIL(Ntk_Node_t*));
+	array_insert_last(Ntk_Node_t*,abn->abnormal, abnNode);
+}
+/**Function********************************************************************
+ 
+  Synopsis    [Add free inputs]
+
+  Description [add a node to the free inputs, it should not be already
+  present by construction of abnormal predicate]
+
+  SideEffects []
+
+  SeeAlso     []
+
+******************************************************************************/
+void  Dbg_AddFreeInput(Dbg_Abnormal_t * abn, Ntk_Node_t* fNode)
+{
+	assert(fNode != NIL(Ntk_Node_t*));
+	array_insert_last(Ntk_Node_t*,abn->freeInputs, fNode);
+}
+
+/**Function********************************************************************
+ 
+  Synopsis    [returns a free inputs]
+
+  Description [returns the array of freeinputs]
+
+  SideEffects []
+
+  SeeAlso     [Dbg_ReadAbn]
+
+******************************************************************************/
+array_t* Dbg_ReadFreeInputs(Dbg_Abnormal_t *abnormal)
+{
+	assert(abnormal != NIL(Dbg_Abnormal_t));
+	return abnormal->freeInputs;
+}
+/**Function********************************************************************
+ 
+  Synopsis    [returns a abnormal predicates]
+
+  Description [returns the array of abnormal predicates]
+
+  SideEffects []
+
+  SeeAlso     [Dbg_ReadFreeInputs]
+
+******************************************************************************/
+array_t* Dbg_ReadAbn(Dbg_Abnormal_t *abnormal)
+{
+	assert(abnormal != NIL(Dbg_Abnormal_t));
+	return abnormal->abnormal;
+}
+
Index: vis_dev/vis-2.3/src/debug/debugInt.h
===================================================================
--- vis_dev/vis-2.3/src/debug/debugInt.h	(revision 35)
+++ vis_dev/vis-2.3/src/debug/debugInt.h	(revision 36)
@@ -32,6 +32,6 @@
 ******************************************************************************/
 
-#ifndef _TSTINT
-#define _TSTINT
+#ifndef _DBGINT
+#define _DBGINT
 
 /*---------------------------------------------------------------------------*/
@@ -51,4 +51,10 @@
 /* Structure declarations                                                    */
 /*---------------------------------------------------------------------------*/
+struct DbgAbnormalStruct{
+	Ntk_Network_t * network;
+	array_t * abnormal; /* Array of Ntk_Node_t* */
+	array_t * freeInputs; /* Array of Ntk_Node_t* */
+	int verbose;
+};
 
 
@@ -74,4 +80,7 @@
 /*---------------------------------------------------------------------------*/
 
+void printLatch(st_table* CoiTable);
+st_table * generateAllLatches(Ntk_Network_t * ntk);
+void mdd_GetState_Values(mdd_manager *mgr, mdd_t * top, FILE * f);
 
 /**AutomaticEnd***************************************************************/
