Changeset 42
- Timestamp:
- Jan 13, 2012, 6:32:51 PM (13 years ago)
- Location:
- vis_dev/vis-2.3/src/debug
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vis_dev/vis-2.3/src/debug/debug.c
r41 r42 191 191 array_t * LTLformulaArray; 192 192 char * ltlFileName = NIL(char); 193 193 array_t * faultNodes = array_alloc(Ntk_Node_t*,0); 194 194 195 195 /* … … 286 286 287 287 288 array_t 288 array_t *objClause = NIL(array_t); 289 289 objClause = array_alloc(int, 0); 290 290 array_insert_last(int, objClause, noLoopIndex); … … 295 295 st_table * nodeToMvfAigTable = NIL(st_table); 296 296 nodeToMvfAigTable = 297 (st_table *) Ntk_NetworkReadApplInfo(network, MVFAIG_NETWORK_APPL_KEY);298 assert(nodeToMvfAigTable != NIL(st_table));297 (st_table *) Ntk_NetworkReadApplInfo(network, MVFAIG_NETWORK_APPL_KEY); 298 assert(nodeToMvfAigTable != NIL(st_table)); 299 299 300 300 Dbg_InitAbn(abn,manager, nodeToMvfAigTable,cnfClauses); 301 301 302 302 //loop abnormal 303 303 int aIndex; 304 304 Ntk_Node_t * abnNode; 305 306 if(aIndex<=0){307 305 Dbg_ForEachAbnormal(abn,aIndex,abnNode){ 306 char * nodeName = Ntk_NodeReadName(abnNode); 307 //set abnormal 308 308 int cnfIndex = array_fetch(int,abn->abnCnfIndexArray, aIndex); 309 309 bAigEdge_t* abnBAig = array_fetch(bAigEdge_t*,abn->abnAigArray, aIndex); 310 310 int abnIndex = BmcGenerateCnfFormulaForAigFunction(manager,abnBAig[1],0,cnfClauses); 311 311 array_insert(int,cnfClauses->clauseArray,cnfIndex,abnIndex); 312 313 312 FILE *cnfFile = Cmd_FileOpen(options->satInFile, "w", NIL(char *), 0); 314 313 BmcWriteClauses(manager, cnfFile, cnfClauses, options); 315 314 fclose(cnfFile); 316 315 317 316 //SAT procedure 318 int res = Dbg_SatCheck("assig",options->cnfFileName); 319 320 array_insert(int,cnfClauses->clauseArray,cnfIndex,-abnIndex); 321 } 322 } 317 //assig assig input from cex 318 //TODO build cex correctly 319 int res = Dbg_SatCheck("assig",options->cnfFileName,options->verbosityLevel); 320 // Build set of FaultCandidates 321 if (res == SAT_SAT) 322 { 323 char * realNodeName = util_strsav(nodeName); 324 realNodeName[strlen(nodeName)-4] = '\0'; 325 Ntk_Node_t * realNode = Ntk_NetworkFindNodeByName(network,realNodeName); 326 array_insert_last(Ntk_Node_t*,faultNodes,realNode); 327 } 328 329 330 array_insert(int,cnfClauses->clauseArray,cnfIndex,-abnIndex); 331 } 323 332 324 333 if(verbose) 325 334 (void) fprintf(vis_stdout, "The _sat_debug generates %d clauses with %d\ 326 latches %d nodetomvf.\n",cnfClauses->noOfClauses,st_count(CoiTable),st_count(nodeToMvfAigTable)); 327 335 latches %d \n",cnfClauses->noOfClauses,st_count(CoiTable)); 336 337 (void) fprintf(vis_stdout,"Number of Fault candidates %d\n", 338 array_n(faultNodes)); 339 (void) fprintf(vis_stdout,"gates : \n"); 340 printNodeArray(faultNodes); 341 342 328 343 Ctlsp_FormulaArrayFree(LTLformulaArray); 329 344 BmcCnfClausesFree(cnfClauses); 330 345 BmcOptionFree(options); 346 array_free(faultNodes); 331 347 return 0; 332 348 -
vis_dev/vis-2.3/src/debug/debug.h
r41 r42 134 134 EXTERN void Dbg_InitAbn(Dbg_Abnormal_t * abn, bAig_Manager_t * manager, 135 135 st_table * nodeToMvfAigTable, BmcCnfClauses_t *cnfClauses); 136 EXTERN int Dbg_SatCheck(char * forceAssigName, char * cnfFileName );136 EXTERN int Dbg_SatCheck(char * forceAssigName, char * cnfFileName, int verbose); 137 137 EXTERN BmcCnfClauses_t* Dbg_GenerateCNF(Ntk_Network_t * network, 138 138 BmcOption_t * option, st_table *CoiTable); 139 EXTERN int Dbg_GetDefaultValue(Tbl_Table_t * table); 139 140 140 141 -
vis_dev/vis-2.3/src/debug/debugAbnormal.c
r41 r42 44 44 with a new table including the abnormal predicate. 45 45 For a combinatorial node n is tranformed into (abn_n)?i_n:n 46 If the abnormal predicate is activ then n is replaced by a free input] 46 If the abnormal predicate is active then n is replaced by a free input. 47 We assume that the combinatorial gate at on one bit only.] 47 48 48 49 SideEffects [fill the abnormal structure] … … 67 68 68 69 Tbl_Table_t *table = Ntk_NodeReadTable(node); 69 (void) fprintf(vis_stdout, "** old table\n"); 70 Tbl_TableWriteBlifMvToFile(table,2,vis_stdout); 70 if(abnormal->verbose){ 71 (void) fprintf(vis_stdout, "** old table\n"); 72 Tbl_TableWriteBlifMvToFile(table,2,vis_stdout); 73 } 71 74 // Build new variables abnormal and input 72 75 Ntk_Node_t * abnNode = Dbg_CreateNewNode(ntk,node,"abn"); … … 81 84 Tbl_TableAddColumn(table,i,0); 82 85 int iIndex = Tbl_TableReadVarIndex(table, i, 0); 83 84 //For each row already there in the table 86 85 87 int rowNum; 86 88 for(rowNum = 0; rowNum < Tbl_TableReadNumRows(table);rowNum++){ … … 94 96 //the new row 95 97 int r = Tbl_TableAddRow(table); 96 98 97 99 int colNum; 98 100 for (colNum = 0; colNum < Tbl_TableReadNumInputs(table); colNum++) { … … 104 106 Tbl_TableSetEntry(table, entry, r, colNum, 0); 105 107 } 108 int defaultVal = Dbg_GetDefaultValue(table); 109 if(defaultVal == -1) 110 { 111 (void) fprintf(vis_stdout, "Error default value of the table \ 112 of node %s\n", nodeName); 113 return; 114 } 115 int outVal = (defaultVal +1 )% 2; 116 if(abnormal->verbose) 117 (void) fprintf(vis_stdout, "Default value : %d\n",defaultVal); 106 118 for (colNum = 0; colNum < Tbl_TableReadNumOutputs(table); colNum++){ 107 119 Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c); 108 Tbl_EntrySetValue(entry, 1,1);120 Tbl_EntrySetValue(entry,outVal,outVal); 109 121 Tbl_TableSetEntry(table, entry, r, colNum, 1); 110 122 } 123 if(abnormal->verbose){ 111 124 printf("---------------\n"); 112 125 Tbl_TableWriteBlifMvToFile(table,0,vis_stdout); 126 } 113 127 } 114 128 } -
vis_dev/vis-2.3/src/debug/debugInt.h
r41 r42 85 85 st_table * generateAllLatches(Ntk_Network_t * ntk); 86 86 void mdd_GetState_Values(mdd_manager *mgr, mdd_t * top, FILE * f); 87 void printNodeArray(array_t * nodeArray); 87 88 88 89 /**AutomaticEnd***************************************************************/ -
vis_dev/vis-2.3/src/debug/debugUtilities.c
r41 r42 1 1 #include "debug.h" 2 void printNodeArray(array_t * nodeArray) 3 { 4 int i; 5 Ntk_Node_t* node; 6 arrayForEachItem(Ntk_Node_t *, nodeArray, i, node){ 7 printf("%s\n",Ntk_NodeReadName(node)); 8 } 9 10 11 } 12 2 13 void printLatch(st_table* CoiTable) 3 14 { … … 98 109 ******************************************************************************/ 99 110 100 int Dbg_SatCheck(char * forceAssigName, char * cnfFileName 111 int Dbg_SatCheck(char * forceAssigName, char * cnfFileName,int verbose 101 112 ) 102 113 { … … 138 149 sat_Main(cm); 139 150 151 if(verbose){ 140 152 if(cm->status == SAT_UNSAT) { 141 153 if(cm->option->forcedAssignArr) … … 154 166 sat_FreeManager(cm); 155 167 } 168 } 156 169 return cm->status; 157 170 } … … 192 205 193 206 } 207 /**Function******************************************************************** 208 209 Synopsis [Return the default value of a Node] 210 211 Description [Given a table of a node , return its default value if it exists 212 else -1 This function only work for binary gate with only one default 213 value.] 214 SideEffects [] 215 216 SeeAlso [] 217 218 ******************************************************************************/ 219 int Dbg_GetDefaultValue(Tbl_Table_t * table) 220 { 221 Tbl_Entry_t * defEntry; 222 int defIndex; 223 lsList * rangeList; 224 Tbl_TableForEachDefaultEntry(table,defEntry,defIndex) 225 { 226 rangeList = Tbl_EntryReadList(defEntry); 227 int length = lsLength(rangeList); 228 if ( length != 1) 229 return -1; 230 Tbl_Range_t * range; 231 int valDefault; 232 lsGen gen; 233 Tbl_EntryForEachValue(defEntry,valDefault,gen,range){ 234 return Tbl_RangeEnd(range); 235 } 236 } 237 } 238
Note: See TracChangeset
for help on using the changeset viewer.