Changeset 36 for vis_dev/vis-2.3/src/debug/debug.c
- Timestamp:
- Jan 4, 2012, 12:03:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vis_dev/vis-2.3/src/debug/debug.c
r35 r36 127 127 128 128 129 static int CommandCreateAbnormal(Hrc_Manager_t ** hmgr, int argc, char ** argv)129 static int CommandCreateAbnormal(Hrc_Manager_t ** hmgr, int argc, char ** argv) 130 130 { 131 131 Ntk_Network_t * ntk; 132 int c,verbose; 133 Dbg_Abnormal_t * abnormal; 132 134 ntk = Ntk_HrcManagerReadCurrentNetwork(*hmgr); 133 135 if (ntk == NIL(Ntk_Network_t)) { … … 135 137 return 1; 136 138 } 137 lsGen gen; 138 Ntk_Node_t* node; 139 140 (void) fprintf(vis_stdout, "** NODE **\n"); 141 Ntk_NetworkForEachNode(ntk,gen,node){ 142 if(Ntk_NodeTestIsCombinational(node)){ 143 if(Ntk_NodeReadNumFanins(node) > 1 && Ntk_NodeReadNumFanouts(node)> 0) 144 { 145 if(strcmp(Ntk_NodeReadName(node),"_n2")==0) 146 { 147 char * nodeName = util_strsav(Ntk_NodeReadName(node)); 148 printf("%s \n", nodeName); 149 (void) fprintf(vis_stdout, "** read table\n"); 150 Tbl_Table_t *table = Ntk_NodeReadTable(node); 151 152 Tbl_TableWriteBlifMvToFile(table,2,vis_stdout); 153 // Build new variables abnormal and input 154 //abn 155 char * abnName = (char *) malloc(strlen(nodeName) + 5); 156 sprintf(abnName,"abn_%s",Ntk_NodeReadName(node)); 157 Var_Variable_t * abn = Var_VariableAlloc(NIL(Hrc_Node_t),abnName); 158 Ntk_Node_t * newNode = Ntk_NodeCreateInNetwork(ntk, abnName,abn); 159 Ntk_NodeDeclareAsPrimaryInput(newNode); 160 //new free inputs 161 char * iName = (char *) malloc(strlen(nodeName) + 3); 162 sprintf(iName,"i_%s",Ntk_NodeReadName(node)); 163 Var_Variable_t * i = Var_VariableAlloc(NIL(Hrc_Node_t),iName); 164 Ntk_Node_t * newNode2 = Ntk_NodeCreateInNetwork(ntk, iName, i); 165 Ntk_NodeDeclareAsPrimaryInput(newNode2); 166 //Add in the table 167 Tbl_TableAddColumn(table,abn,0); 168 int abnIndex = Tbl_TableReadVarIndex(table, abn, 0); 169 Tbl_TableAddColumn(table,i,0); 170 int iIndex = Tbl_TableReadVarIndex(table, i, 0); 171 172 //For each row already there in the table 173 int rowNum; 174 for(rowNum = 0; rowNum < Tbl_TableReadNumRows(table);rowNum++){ 175 Tbl_Entry_t *abnEntry = Tbl_EntryAlloc(Tbl_EntryNormal_c); 176 Tbl_EntrySetValue(abnEntry,0,0); 177 Tbl_TableSetEntry(table, abnEntry, rowNum, abnIndex, 0); 178 Tbl_Entry_t *iEntry = Tbl_EntryAlloc(Tbl_EntryNormal_c); 179 Tbl_EntrySetValue(iEntry,0,1); 180 Tbl_TableSetEntry(table, iEntry, rowNum, iIndex, 0); 181 } 182 //the new row 183 int r = Tbl_TableAddRow(table); 184 185 int colNum; 186 for (colNum = 0; colNum < Tbl_TableReadNumInputs(table); colNum++) { 187 Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c); 188 printf("entry : colNum %d \n",colNum); 189 if(colNum == abnIndex || colNum == iIndex) 190 Tbl_EntrySetValue(entry,1,1); 191 else 192 Tbl_EntrySetValue(entry,0,1); 193 Tbl_TableSetEntry(table, entry, r, colNum, 0); 194 } 195 for (colNum = 0; colNum < Tbl_TableReadNumOutputs(table); colNum++){ 196 Tbl_Entry_t * entry = Tbl_EntryAlloc(Tbl_EntryNormal_c); 197 Tbl_EntrySetValue(entry,1,1); 198 Tbl_TableSetEntry(table, entry, r, colNum, 1); 199 } 200 printf("---------------\n"); 201 Tbl_TablePrintStats(table, vis_stdout); 202 Tbl_TableWriteBlifMvToFile(table,0,vis_stdout); 203 free(abnName); 204 free(iName); 205 } 139 while ((c = util_getopt(argc, argv, "vh:m:k:o:")) != EOF) { 140 switch(c) { 141 case 'v': 142 verbose = 1; 143 break; 206 144 } 207 208 }209 // TODO210 //Remplacer l'ancien network par le nouveau145 } 146 abnormal = Dbg_DebugAbnormalAlloc(ntk); 147 abnormal->verbose = verbose; 148 Dbg_AddAbnormalPredicatetoNetwork(abnormal); 211 149 } 212 150 /**Function********************************************************************
Note: See TracChangeset
for help on using the changeset viewer.