- Timestamp:
- Jan 4, 2012, 12:03:00 PM (13 years ago)
- Location:
- vis_dev/vis-2.3
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vis_dev/vis-2.3/models/debug/and2.v
r33 r36 5 5 6 6 reg c; 7 wire x;8 wire y;9 7 10 8 initial c = 0; 11 9 12 assign x = a & b;13 assign y = (a)?b:x;14 10 15 11 always @(posedge clk) 16 12 begin 17 c = ~x + c;13 c = a & b ; 18 14 end 19 15 endmodule -
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******************************************************************** -
vis_dev/vis-2.3/src/debug/debug.h
r35 r36 65 65 /* Type declarations */ 66 66 /*---------------------------------------------------------------------------*/ 67 67 typedef struct DbgAbnormalStruct Dbg_Abnormal_t; 68 68 69 69 /*---------------------------------------------------------------------------*/ … … 76 76 /*---------------------------------------------------------------------------*/ 77 77 78 /**Macro*********************************************************************** 79 80 Synopsis [Iterates over the abnormal predicates.] 81 82 Description [This macro iterates over the abnormal predicates. It is an error 83 ] 84 85 SideEffects [This macro instantiates macros from the array package. Hence 86 it is advisable not to nest this macro within array macros.] 87 88 SeeAlso [Ntk_NodeForFreeInputs] 89 90 ******************************************************************************/ 91 #define Dbg_ForEachAbnormal( \ 92 /* Dbg_Abnormal_t * */ abnormal /* abnormal to iterate abn */, \ 93 /* int */ i /* local variable for iterator */, \ 94 /* Ntk_Node_t * */ abn /* abn of node */ \ 95 ) \ 96 arrayForEachItem(Ntk_Node_t *, Dbg_ReadAbn(abnormal), i, abn) 97 /**Macro*********************************************************************** 98 99 Synopsis [Iterates over the abnormal predicates.] 100 101 Description [This macro iterates over the abnormal predicates. It is an error 102 ] 103 104 SideEffects [This macro instantiates macros from the array package. Hence 105 it is advisable not to nest this macro within array macros.] 106 107 SeeAlso [Ntk_NodeForFreeInputs] 108 109 ******************************************************************************/ 110 #define Dbg_ForEachFreeInputs( \ 111 /* Dbg_Abnormal_t * */ abnormal /* abnormal to iterate abn */, \ 112 /* int */ i /* local variable for iterator */, \ 113 /* Ntk_Node_t * */ abn /* abn of node */ \ 114 ) \ 115 arrayForEachItem(Ntk_Node_t *, Dbg_ReadFreeInputs(abnormal), i, abn) 78 116 79 117 /**AutomaticStart*************************************************************/ … … 83 121 /*---------------------------------------------------------------------------*/ 84 122 85 void printLatch(st_table* CoiTable);86 st_table * generateAllLatches(Ntk_Network_t * ntk);87 void mdd_GetState_Values(mdd_manager *mgr, mdd_t * top, FILE * f);88 123 EXTERN void Debug_Init(void); 89 124 EXTERN void Debug_End(void); 90 125 EXTERN Dbg_Abnormal_t * Dbg_DebugAbnormalAlloc(Ntk_Network_t * network); 126 EXTERN void Dbg_DebugAbnormalFree(Dbg_Abnormal_t * abn); 127 EXTERN void Dbg_AddAbnormalPredicatetoNetwork(Dbg_Abnormal_t* abnormal); 128 EXTERN void Dbg_AddAbnormalPredicate(Dbg_Abnormal_t * abn, Ntk_Node_t* abnNode); 129 EXTERN void Dbg_AddFreeInput(Dbg_Abnormal_t * abn, Ntk_Node_t* fNode); 130 EXTERN array_t* Dbg_ReadFreeInputs(Dbg_Abnormal_t *abnormal); 131 EXTERN array_t* Dbg_ReadAbn(Dbg_Abnormal_t *abnormal); 91 132 /**AutomaticEnd***************************************************************/ 92 133 -
vis_dev/vis-2.3/src/debug/debug.make
r35 r36 1 CSRC += debug.c debugUtilities.c 1 CSRC += debug.c debugUtilities.c debugAbnormal.c 2 2 HEADERS += debug.h debugInt.h 3 3 -
vis_dev/vis-2.3/src/debug/debugInt.h
r27 r36 32 32 ******************************************************************************/ 33 33 34 #ifndef _ TSTINT35 #define _ TSTINT34 #ifndef _DBGINT 35 #define _DBGINT 36 36 37 37 /*---------------------------------------------------------------------------*/ … … 51 51 /* Structure declarations */ 52 52 /*---------------------------------------------------------------------------*/ 53 struct DbgAbnormalStruct{ 54 Ntk_Network_t * network; 55 array_t * abnormal; /* Array of Ntk_Node_t* */ 56 array_t * freeInputs; /* Array of Ntk_Node_t* */ 57 int verbose; 58 }; 53 59 54 60 … … 74 80 /*---------------------------------------------------------------------------*/ 75 81 82 void printLatch(st_table* CoiTable); 83 st_table * generateAllLatches(Ntk_Network_t * ntk); 84 void mdd_GetState_Values(mdd_manager *mgr, mdd_t * top, FILE * f); 76 85 77 86 /**AutomaticEnd***************************************************************/
Note: See TracChangeset
for help on using the changeset viewer.