abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
wlcNtk.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [wlcNtk.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Verilog parser.]
8 
9  Synopsis [Network data-structure.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - August 22, 2014.]
16 
17  Revision [$Id: wlcNtk.c,v 1.00 2014/09/12 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "wlc.h"
22 #include "misc/vec/vecWec.h"
23 
25 
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// DECLARATIONS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 // object types
32 static char * Wlc_Names[WLC_OBJ_NUMBER+1] = {
33  NULL, // 00: unknown
34  "pi", // 01: primary input
35  "po", // 02: primary output
36  "bo", // 03: box output
37  "bi", // 04: box input
38  "ff", // 05: flop
39  "const", // 06: constant
40  "buf", // 07: buffer
41  "mux", // 08: multiplexer
42  ">>", // 09: shift right
43  ">>>", // 10: shift right (arithmetic)
44  "<<", // 11: shift left
45  "<<<", // 12: shift left (arithmetic)
46  "rotateR", // 13: shift left (arithmetic)
47  "rotateL", // 14: shift left (arithmetic)
48  "~", // 15: bitwise NOT
49  "&", // 16: bitwise AND
50  "|", // 17: bitwise OR
51  "^", // 18: bitwise XOR
52  "[:]", // 19: bit selection
53  "{,}", // 20: bit concatenation
54  "zeroPad", // 21: zero padding
55  "signExt", // 22: sign extension
56  "!", // 23: logic NOT
57  "&&", // 24: logic AND
58  "||", // 25: logic OR
59  "==", // 26: compare equal
60  "!=", // 27: compare not equal
61  "<", // 28: compare less
62  ">", // 29: compare more
63  "<=", // 30: compare less or equal
64  ">=", // 31: compare more or equal
65  "&", // 32: reduction AND
66  "|", // 33: reduction OR
67  "^", // 34: reduction XOR
68  "+", // 35: arithmetic addition
69  "-", // 36: arithmetic subtraction
70  "*", // 37: arithmetic multiplier
71  "//", // 38: arithmetic division
72  "%", // 39: arithmetic modulus
73  "**", // 40: arithmetic power
74  "-", // 41: arithmetic minus
75  "table", // 42: bit table
76  NULL // 43: unused
77 };
78 
79 ////////////////////////////////////////////////////////////////////////
80 /// FUNCTION DEFINITIONS ///
81 ////////////////////////////////////////////////////////////////////////
82 
83 /**Function*************************************************************
84 
85  Synopsis [Working with models.]
86 
87  Description []
88 
89  SideEffects []
90 
91  SeeAlso []
92 
93 ***********************************************************************/
94 Wlc_Ntk_t * Wlc_NtkAlloc( char * pName, int nObjsAlloc )
95 {
96  Wlc_Ntk_t * p;
97  p = ABC_CALLOC( Wlc_Ntk_t, 1 );
98  p->pName = Extra_FileNameGeneric( pName );
99  Vec_IntGrow( &p->vPis, 111 );
100  Vec_IntGrow( &p->vPos, 111 );
101  Vec_IntGrow( &p->vCis, 111 );
102  Vec_IntGrow( &p->vCos, 111 );
103  Vec_IntGrow( &p->vFfs, 111 );
104  p->pMemFanin = Mem_FlexStart();
105  p->nObjsAlloc = nObjsAlloc;
106  p->pObjs = ABC_CALLOC( Wlc_Obj_t, p->nObjsAlloc );
107  p->iObj = 1;
108  return p;
109 }
111 {
112  assert( Wlc_ObjIsCi(pObj) );
113  assert( Wlc_ObjFaninNum(pObj) == 0 );
114  if ( Wlc_NtkPiNum(p) == Wlc_NtkCiNum(p) || pObj->Type != WLC_OBJ_PI )
115  {
116  pObj->Fanins[1] = Vec_IntSize(&p->vCis);
117  Vec_IntPush( &p->vCis, Wlc_ObjId(p, pObj) );
118  }
119  else // insert in the array of CI at the end of PIs
120  {
121  Wlc_Obj_t * pTemp; int i;
122  Vec_IntInsert( &p->vCis, Wlc_NtkPiNum(p), Wlc_ObjId(p, pObj) );
123  // other CI IDs are invalidated... naive fix!
124  Wlc_NtkForEachCi( p, pTemp, i )
125  pTemp->Fanins[1] = i;
126  }
127  if ( pObj->Type == WLC_OBJ_PI )
128  Vec_IntPush( &p->vPis, Wlc_ObjId(p, pObj) );
129 }
130 void Wlc_ObjSetCo( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int fFlopInput )
131 {
132 // pObj->Fanins[1] = Vec_IntSize(&p->vCos);
133  Vec_IntPush( &p->vCos, Wlc_ObjId(p, pObj) );
134  if ( !fFlopInput )
135  Vec_IntPush( &p->vPos, Wlc_ObjId(p, pObj) );
136  if ( fFlopInput )
137  pObj->fIsFi = 1;
138  else
139  pObj->fIsPo = 1;
140 }
141 int Wlc_ObjAlloc( Wlc_Ntk_t * p, int Type, int Signed, int End, int Beg )
142 {
143  Wlc_Obj_t * pObj;
144  assert( Type != WLC_OBJ_PO && Type != WLC_OBJ_FI );
145  if ( p->iObj == p->nObjsAlloc )
146  {
147  p->pObjs = ABC_REALLOC( Wlc_Obj_t, p->pObjs, 2 * p->nObjsAlloc );
148  memset( p->pObjs + p->nObjsAlloc, 0, sizeof(Wlc_Obj_t) * p->nObjsAlloc );
149  p->nObjsAlloc *= 2;
150  }
151  pObj = Wlc_NtkObj( p, p->iObj );
152  pObj->Type = Type;
153  pObj->Signed = Signed;
154  pObj->End = End;
155  pObj->Beg = Beg;
156  if ( Wlc_ObjIsCi(pObj) )
157  Wlc_ObjSetCi( p, pObj );
158  p->nObjs[Type]++;
159  return p->iObj++;
160 }
161 int Wlc_ObjCreate( Wlc_Ntk_t * p, int Type, int Signed, int End, int Beg, Vec_Int_t * vFanins )
162 {
163  int iFaninNew = Wlc_ObjAlloc( p, Type, Signed, End, Beg );
164  Wlc_ObjAddFanins( p, Wlc_NtkObj(p, iFaninNew), vFanins );
165  return iFaninNew;
166 }
167 char * Wlc_ObjName( Wlc_Ntk_t * p, int iObj )
168 {
169  static char Buffer[100];
170  if ( Wlc_NtkHasNameId(p) && Wlc_ObjNameId(p, iObj) )
171  return Abc_NamStr( p->pManName, Wlc_ObjNameId(p, iObj) );
172  sprintf( Buffer, "n%d", iObj );
173  return Buffer;
174 }
175 void Wlc_ObjUpdateType( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, int Type )
176 {
177  assert( pObj->Type == WLC_OBJ_NONE );
178  p->nObjs[pObj->Type]--;
179  pObj->Type = Type;
180  p->nObjs[pObj->Type]++;
181 }
182 void Wlc_ObjAddFanins( Wlc_Ntk_t * p, Wlc_Obj_t * pObj, Vec_Int_t * vFanins )
183 {
184  assert( pObj->nFanins == 0 );
185  pObj->nFanins = Vec_IntSize(vFanins);
186  if ( Wlc_ObjHasArray(pObj) )
187  pObj->pFanins[0] = (int *)Mem_FlexEntryFetch( p->pMemFanin, Vec_IntSize(vFanins) * sizeof(int) );
188  memcpy( Wlc_ObjFanins(pObj), Vec_IntArray(vFanins), sizeof(int) * Vec_IntSize(vFanins) );
189  // special treatment of CONST, SELECT and TABLE
190  if ( pObj->Type == WLC_OBJ_CONST )
191  pObj->nFanins = 0;
192  else if ( pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE )
193  pObj->nFanins = 1;
194 }
196 {
197  if ( p->pManName )
198  Abc_NamStop( p->pManName );
199  if ( p->pMemFanin )
200  Mem_FlexStop( p->pMemFanin, 0 );
201  if ( p->pMemTable )
202  Mem_FlexStop( p->pMemTable, 0 );
203  Vec_PtrFreeP( &p->vTables );
204  ABC_FREE( p->vPis.pArray );
205  ABC_FREE( p->vPos.pArray );
206  ABC_FREE( p->vCis.pArray );
207  ABC_FREE( p->vCos.pArray );
208  ABC_FREE( p->vFfs.pArray );
209  ABC_FREE( p->vTravIds.pArray );
210  ABC_FREE( p->vNameIds.pArray );
211  ABC_FREE( p->vCopies.pArray );
212  ABC_FREE( p->pObjs );
213  ABC_FREE( p->pName );
214  ABC_FREE( p );
215 }
217 {
218  int Mem = sizeof(Wlc_Ntk_t);
219  Mem += 4 * p->vPis.nCap;
220  Mem += 4 * p->vPos.nCap;
221  Mem += 4 * p->vCis.nCap;
222  Mem += 4 * p->vCos.nCap;
223  Mem += 4 * p->vFfs.nCap;
224  Mem += sizeof(Wlc_Obj_t) * p->nObjsAlloc;
225  Mem += Abc_NamMemUsed(p->pManName);
226  Mem += Mem_FlexReadMemUsage(p->pMemFanin);
227  return Mem;
228 }
229 
230 /**Function*************************************************************
231 
232  Synopsis [Prints distribution of operator types.]
233 
234  Description []
235 
236  SideEffects []
237 
238  SeeAlso []
239 
240 ***********************************************************************/
241 static inline void Vec_WrdSelectSortCost2( word * pArray, int nSize, word * pCosts )
242 {
243  int i, j, best_i;
244  for ( i = 0; i < nSize-1; i++ )
245  {
246  best_i = i;
247  for ( j = i+1; j < nSize; j++ )
248  if ( pCosts[j] < pCosts[best_i] )
249  best_i = j;
250  ABC_SWAP( word, pArray[i], pArray[best_i] );
251  ABC_SWAP( word, pCosts[i], pCosts[best_i] );
252  }
253 }
254 static inline word Wlc_NtkPrintDistribMakeSign( int s, int s0, int s1 )
255 {
256  return ((word)s1 << 42) | ((word)s0 << 21) | (word)s;
257 }
258 static inline void Wlc_NtkPrintDistribFromSign( word sss, int * s, int * s0, int * s1 )
259 {
260  *s1 = (int)(sss >> 42); *s0 = (int)(sss >> 21) & 0x1FFFFF; *s = (int)sss & 0x1FFFFF;
261 }
262 static inline void Wlc_NtkPrintDistribAddOne( Vec_Ptr_t * vTypes, Vec_Ptr_t * vOccurs, int Type, word Sign )
263 {
264  Vec_Wrd_t * vType = (Vec_Wrd_t *)Vec_PtrEntry( vTypes, Type );
265  Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, Type );
266  word Entry; int i;
267  Vec_WrdForEachEntry( vType, Entry, i )
268  if ( Entry == Sign )
269  {
270  Vec_WrdAddToEntry( vOccur, i, 1 );
271  return;
272  }
273  Vec_WrdPush( vType, Sign );
274  Vec_WrdPush( vOccur, 1 );
275 }
276 void Wlc_NtkPrintDistribSortOne( Vec_Ptr_t * vTypes, Vec_Ptr_t * vOccurs, int Type )
277 {
278  Vec_Wrd_t * vType = (Vec_Wrd_t *)Vec_PtrEntry( vTypes, Type );
279  Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, Type );
280  Vec_WrdSelectSortCost2( Vec_WrdArray(vType), Vec_WrdSize(vType), Vec_WrdArray(vOccur) );
281  Vec_WrdReverseOrder( vType );
282  Vec_WrdReverseOrder( vOccur );
283 }
284 void Wlc_NtkPrintDistrib( Wlc_Ntk_t * p, int fVerbose )
285 {
286  Wlc_Obj_t * pObj;
287  Vec_Ptr_t * vTypes, * vOccurs;
288  word Sign;
289  int i, k, s, s0, s1;
290  // allocate statistics arrays
291  vTypes = Vec_PtrStart( WLC_OBJ_NUMBER );
292  vOccurs = Vec_PtrStart( WLC_OBJ_NUMBER );
293  for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
294  Vec_PtrWriteEntry( vTypes, i, Vec_WrdAlloc(16) );
295  for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
296  Vec_PtrWriteEntry( vOccurs, i, Vec_WrdAlloc(16) );
297  // add nodes
298  Wlc_NtkForEachObj( p, pObj, i )
299  {
300 // char * pName = Wlc_ObjName(p, i);
301  if ( Wlc_ObjSign(pObj) > 0x1FFFFF )
302  printf( "Object %6d has range %d, which is reduced to %d in the statistics.\n",
303  i, Wlc_ObjRange(pObj), Wlc_ObjRange(pObj) & 0xFFFFF );
304  if ( pObj->Beg )
305  printf( "Object %6d has non-standard range %d=[%d:%d]\n", i, Wlc_ObjRange(pObj), pObj->End, pObj->Beg );
306  // 0-input types
307  if ( Wlc_ObjIsCi(pObj) || pObj->Type == WLC_OBJ_CONST || pObj->Type == WLC_OBJ_BIT_CONCAT )
308  Sign = Wlc_NtkPrintDistribMakeSign( Wlc_ObjSign(pObj), 0, 0 );
309  // 1-input types
310  else if ( pObj->Type == WLC_OBJ_BUF || pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE ||
311  pObj->Type == WLC_OBJ_BIT_ZEROPAD || pObj->Type == WLC_OBJ_BIT_SIGNEXT ||
312  pObj->Type == WLC_OBJ_BIT_NOT || pObj->Type == WLC_OBJ_LOGIC_NOT || pObj->Type == WLC_OBJ_ARI_MINUS )
314  // 2-input types (including MUX)
315  else if ( Wlc_ObjFaninNum(pObj) == 1 )
317  else
318  {
319  assert( Wlc_ObjFaninNum(pObj) >= 2 );
321  }
322  // add to storage
323  Wlc_NtkPrintDistribAddOne( vTypes, vOccurs, pObj->Type, Sign );
324  }
325  // print by occurrence
326  printf( "ID : name occurrence (occurrence)<output_range>=<input_range>.<input_range> ...\n" );
327  for ( i = 0; i < WLC_OBJ_NUMBER; i++ )
328  {
329  Vec_Wrd_t * vType = (Vec_Wrd_t *)Vec_PtrEntry( vTypes, i );
330  Vec_Wrd_t * vOccur = (Vec_Wrd_t *)Vec_PtrEntry( vOccurs, i );
331  if ( p->nObjs[i] == 0 )
332  continue;
333  printf( "%2d : %-8s %6d ", i, Wlc_Names[i], p->nObjs[i] );
334  // sort by occurence
335  Wlc_NtkPrintDistribSortOne( vTypes, vOccurs, i );
336  Vec_WrdForEachEntry( vType, Sign, k )
337  {
338  Wlc_NtkPrintDistribFromSign( Sign, &s, &s0, &s1 );
339  if ( ((k % 8) == 7 && s1) || ((k % 10) == 9 && !s1) )
340  printf( "\n " );
341  printf( "(%d)", (int)Vec_WrdEntry( vOccur, k ) );
342  printf( "%s%d", Abc_LitIsCompl(s)?"-":"", Abc_Lit2Var(s) );
343  if ( s0 )
344  printf( "=%s%d", Abc_LitIsCompl(s0)?"-":"", Abc_Lit2Var(s0) );
345  if ( s1 )
346  printf( ".%s%d", Abc_LitIsCompl(s1)?"-":"", Abc_Lit2Var(s1) );
347  printf( " " );
348  }
349  printf( "\n" );
350  }
351  Vec_VecFree( (Vec_Vec_t *)vTypes );
352  Vec_VecFree( (Vec_Vec_t *)vOccurs );
353 }
354 void Wlc_NtkPrintNodes( Wlc_Ntk_t * p, int Type )
355 {
356  Wlc_Obj_t * pObj;
357  int i, Counter = 0;
358  printf( "Operation %s\n", Wlc_Names[Type] );
359  Wlc_NtkForEachObj( p, pObj, i )
360  {
361  if ( (int)pObj->Type != Type )
362  continue;
363  printf( "%8d :", Counter++ );
364  printf( "%8d : ", i );
365  printf( "%3d%s = ", Wlc_ObjRange(pObj), Wlc_ObjIsSigned(pObj) ? "s" : " " );
366  printf( "%3d%s %s ", Wlc_ObjRange(Wlc_ObjFanin0(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin0(p, pObj)) ? "s" : " ", Wlc_Names[Type] );
367  printf( "%3d%s ", Wlc_ObjRange(Wlc_ObjFanin1(p, pObj)), Wlc_ObjIsSigned(Wlc_ObjFanin1(p, pObj)) ? "s" : " " );
368  printf( " : " );
369  printf( "%-12s = ", Wlc_ObjName(p, i) );
370  printf( "%-12s %s ", Wlc_ObjName(p, Wlc_ObjFaninId0(pObj)), Wlc_Names[Type] );
371  printf( "%-12s ", Wlc_ObjName(p, Wlc_ObjFaninId1(pObj)) );
372  printf( "\n" );
373  }
374 }
375 void Wlc_NtkPrintStats( Wlc_Ntk_t * p, int fDistrib, int fVerbose )
376 {
377  int i;
378  printf( "%-20s : ", p->pName );
379  printf( "PI = %4d ", Wlc_NtkPiNum(p) );
380  printf( "PO = %4d ", Wlc_NtkPoNum(p) );
381  printf( "FF = %4d ", Wlc_NtkFfNum(p) );
382  printf( "Obj = %6d ", Wlc_NtkObjNum(p) );
383  printf( "Mem = %.3f MB", 1.0*Wlc_NtkMemUsage(p)/(1<<20) );
384  printf( "\n" );
385  if ( fDistrib )
386  {
387  Wlc_NtkPrintDistrib( p, fVerbose );
388  return;
389  }
390  if ( !fVerbose )
391  return;
392  printf( "Node type statistics:\n" );
393  for ( i = 1; i < WLC_OBJ_NUMBER; i++ )
394  {
395  if ( !p->nObjs[i] )
396  continue;
397  if ( p->nAnds[0] && p->nAnds[i] )
398  printf( "%2d : %-8s %6d %7.2f %%\n", i, Wlc_Names[i], p->nObjs[i], 100.0*p->nAnds[i]/p->nAnds[0] );
399  else
400  printf( "%2d : %-8s %6d\n", i, Wlc_Names[i], p->nObjs[i] );
401  }
402 }
403 
404 /**Function*************************************************************
405 
406  Synopsis [Duplicates the network in a topological order.]
407 
408  Description []
409 
410  SideEffects []
411 
412  SeeAlso []
413 
414 ***********************************************************************/
415 void Wlc_ObjCollectCopyFanins( Wlc_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
416 {
417  int i, iFanin;
418  Wlc_Obj_t * pObj = Wlc_NtkObj( p, iObj );
419  Vec_IntClear( vFanins );
420  Wlc_ObjForEachFanin( pObj, iFanin, i )
421  Vec_IntPush( vFanins, Wlc_ObjCopy(p, iFanin) );
422  // special treatment of CONST and SELECT
423  if ( pObj->Type == WLC_OBJ_CONST )
424  {
425  int * pInts = Wlc_ObjConstValue( pObj );
426  int nInts = Abc_BitWordNum( Wlc_ObjRange(pObj) );
427  for ( i = 0; i < nInts; i++ )
428  Vec_IntPush( vFanins, pInts[i] );
429  }
430  else if ( pObj->Type == WLC_OBJ_BIT_SELECT || pObj->Type == WLC_OBJ_TABLE )
431  {
432  assert( Vec_IntSize(vFanins) == 1 );
433  Vec_IntPush( vFanins, pObj->Fanins[1] );
434  }
435 }
436 int Wlc_ObjDup( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
437 {
438  Wlc_Obj_t * pObj = Wlc_NtkObj( p, iObj );
439  int iFaninNew = Wlc_ObjAlloc( pNew, pObj->Type, Wlc_ObjIsSigned(pObj), pObj->End, pObj->Beg );
440  Wlc_Obj_t * pObjNew = Wlc_NtkObj(pNew, iFaninNew);
441  Wlc_ObjCollectCopyFanins( p, iObj, vFanins );
442  Wlc_ObjAddFanins( pNew, pObjNew, vFanins );
443  Wlc_ObjSetCopy( p, iObj, iFaninNew );
444  return iFaninNew;
445 }
446 void Wlc_NtkDupDfs_rec( Wlc_Ntk_t * pNew, Wlc_Ntk_t * p, int iObj, Vec_Int_t * vFanins )
447 {
448  Wlc_Obj_t * pObj;
449  int i, iFanin;
450  if ( Wlc_ObjCopy(p, iObj) )
451  return;
452  pObj = Wlc_NtkObj( p, iObj );
453  Wlc_ObjForEachFanin( pObj, iFanin, i )
454  Wlc_NtkDupDfs_rec( pNew, p, iFanin, vFanins );
455  Wlc_ObjDup( pNew, p, iObj, vFanins );
456 }
458 {
459  Wlc_Ntk_t * pNew;
460  Wlc_Obj_t * pObj;
461  Vec_Int_t * vFanins;
462  int i;
463  Wlc_NtkCleanCopy( p );
464  vFanins = Vec_IntAlloc( 100 );
465  pNew = Wlc_NtkAlloc( p->pName, p->nObjsAlloc );
466  Wlc_NtkForEachCi( p, pObj, i )
467  Wlc_ObjDup( pNew, p, Wlc_ObjId(p, pObj), vFanins );
468  Wlc_NtkForEachCo( p, pObj, i )
469  Wlc_NtkDupDfs_rec( pNew, p, Wlc_ObjId(p, pObj), vFanins );
470  Wlc_NtkForEachCo( p, pObj, i )
471  Wlc_ObjSetCo( pNew, Wlc_ObjCopyObj(pNew, p, pObj), pObj->fIsFi );
472  Vec_IntFree( vFanins );
473  return pNew;
474 }
476 {
477  int i;
478  assert( !Wlc_NtkHasCopy(pNew) && Wlc_NtkHasCopy(p) );
479  assert( !Wlc_NtkHasNameId(pNew) && Wlc_NtkHasNameId(p) );
480  assert( pNew->pManName == NULL && p->pManName != NULL );
481  Wlc_NtkCleanNameId( pNew );
482  for ( i = 0; i < p->nObjsAlloc; i++ )
483  if ( Wlc_ObjCopy(p, i) && i < Vec_IntSize(&p->vNameIds) && Wlc_ObjNameId(p, i) )
484  Wlc_ObjSetNameId( pNew, Wlc_ObjCopy(p, i), Wlc_ObjNameId(p, i) );
485  pNew->pManName = p->pManName;
486  p->pManName = NULL;
487  Vec_IntErase( &p->vNameIds );
488  // transfer table
489  pNew->pMemTable = p->pMemTable; p->pMemTable = NULL;
490  pNew->vTables = p->vTables; p->vTables = NULL;
491 }
492 
493 ////////////////////////////////////////////////////////////////////////
494 /// END OF FILE ///
495 ////////////////////////////////////////////////////////////////////////
496 
497 
499 
char * memset()
static void Wlc_NtkPrintDistribAddOne(Vec_Ptr_t *vTypes, Vec_Ptr_t *vOccurs, int Type, word Sign)
Definition: wlcNtk.c:262
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static ABC_NAMESPACE_IMPL_START char * Wlc_Names[WLC_OBJ_NUMBER+1]
DECLARATIONS ///.
Definition: wlcNtk.c:32
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
Mem_Flex_t * pMemFanin
Definition: wlc.h:129
void Wlc_ObjUpdateType(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int Type)
Definition: wlcNtk.c:175
Mem_Flex_t * pMemTable
Definition: wlc.h:130
#define Wlc_NtkForEachCo(p, pCo, i)
Definition: wlc.h:216
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Abc_NamStop(Abc_Nam_t *p)
Definition: utilNam.c:110
static int Wlc_ObjId(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:161
void Wlc_NtkPrintNodes(Wlc_Ntk_t *p, int Type)
Definition: wlcNtk.c:354
unsigned nFanins
Definition: wlc.h:107
void Wlc_ObjCollectCopyFanins(Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition: wlcNtk.c:415
static int Wlc_ObjFaninId1(Wlc_Obj_t *p)
Definition: wlc.h:168
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
Vec_Int_t vCis
Definition: wlc.h:120
static int Wlc_ObjIsSigned(Wlc_Obj_t *p)
Definition: wlc.h:178
static word Wlc_NtkPrintDistribMakeSign(int s, int s0, int s1)
Definition: wlcNtk.c:254
void Wlc_ObjAddFanins(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, Vec_Int_t *vFanins)
Definition: wlcNtk.c:182
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
Definition: wlc.h:221
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * vTables
Definition: wlc.h:131
void Wlc_NtkTransferNames(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p)
Definition: wlcNtk.c:475
static int Wlc_NtkObjNum(Wlc_Ntk_t *p)
Definition: wlc.h:141
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
int Wlc_ObjDup(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition: wlcNtk.c:436
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
static Wlc_Obj_t * Wlc_NtkObj(Wlc_Ntk_t *p, int Id)
Definition: wlc.h:149
Wlc_Obj_t * pObjs
Definition: wlc.h:126
int nObjs[WLC_OBJ_NUMBER]
Definition: wlc.h:123
static Wlc_Obj_t * Wlc_ObjFanin0(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:171
char * memcpy()
int iObj
Definition: wlc.h:127
static void Vec_WrdSelectSortCost2(word *pArray, int nSize, word *pCosts)
Definition: wlcNtk.c:241
static int Wlc_ObjSign(Wlc_Obj_t *p)
Definition: wlc.h:180
static void Vec_IntErase(Vec_Int_t *p)
Definition: vecInt.h:266
static int Wlc_NtkFfNum(Wlc_Ntk_t *p)
Definition: wlc.h:147
static void Vec_IntInsert(Vec_Int_t *p, int iHere, int Entry)
Definition: vecInt.h:975
static void Vec_WrdReverseOrder(Vec_Wrd_t *p)
Definition: vecWrd.h:897
static int Wlc_ObjRange(Wlc_Obj_t *p)
Definition: wlc.h:175
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecWrd.h:54
Wlc_Ntk_t * Wlc_NtkDupDfs(Wlc_Ntk_t *p)
Definition: wlcNtk.c:457
static void Wlc_NtkCleanCopy(Wlc_Ntk_t *p)
Definition: wlc.h:185
Vec_Int_t vPis
Definition: wlc.h:118
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
void Wlc_NtkDupDfs_rec(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, int iObj, Vec_Int_t *vFanins)
Definition: wlcNtk.c:446
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
void Wlc_NtkPrintDistribSortOne(Vec_Ptr_t *vTypes, Vec_Ptr_t *vOccurs, int Type)
Definition: wlcNtk.c:276
Definition: wlc.h:48
int Wlc_ObjAlloc(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg)
Definition: wlcNtk.c:141
unsigned Beg
Definition: wlc.h:109
static int Wlc_ObjFaninId0(Wlc_Obj_t *p)
Definition: wlc.h:167
static void Wlc_NtkCleanNameId(Wlc_Ntk_t *p)
Definition: wlc.h:191
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
static word Vec_WrdAddToEntry(Vec_Wrd_t *p, int i, word Addition)
Definition: vecWrd.h:435
static int Wlc_NtkHasNameId(Wlc_Ntk_t *p)
Definition: wlc.h:192
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
static void Wlc_ObjSetCopy(Wlc_Ntk_t *p, int iObj, int i)
Definition: wlc.h:187
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Wlc_NtkPoNum(Wlc_Ntk_t *p)
Definition: wlc.h:144
static int Wlc_NtkCiNum(Wlc_Ntk_t *p)
Definition: wlc.h:145
int Wlc_NtkMemUsage(Wlc_Ntk_t *p)
Definition: wlcNtk.c:216
#define Wlc_NtkForEachCi(p, pCi, i)
Definition: wlc.h:214
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Wlc_ObjFaninNum(Wlc_Obj_t *p)
Definition: wlc.h:163
int Abc_NamMemUsed(Abc_Nam_t *p)
Definition: utilNam.c:202
static int Wlc_ObjHasArray(Wlc_Obj_t *p)
Definition: wlc.h:164
char * pName
Definition: wlc.h:117
char * Extra_FileNameGeneric(char *FileName)
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
unsigned Type
Definition: wlc.h:102
static int Wlc_ObjIsCi(Wlc_Obj_t *p)
Definition: wlc.h:158
static int Wlc_ObjNameId(Wlc_Ntk_t *p, int iObj)
Definition: wlc.h:194
int * pFanins[1]
Definition: wlc.h:111
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
char * sprintf()
static int Counter
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition: wlc.h:114
static int * Wlc_ObjConstValue(Wlc_Obj_t *p)
Definition: wlc.h:181
int nAnds[WLC_OBJ_NUMBER]
Definition: wlc.h:124
static Wlc_Obj_t * Wlc_ObjCopyObj(Wlc_Ntk_t *pNew, Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:189
static char s1[largest_string]
Definition: set.c:514
unsigned fIsPo
Definition: wlc.h:105
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: wlc.h:206
unsigned Signed
Definition: wlc.h:103
static void Wlc_ObjSetNameId(Wlc_Ntk_t *p, int iObj, int i)
Definition: wlc.h:193
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition: utilNam.c:479
Vec_Int_t vCopies
Definition: wlc.h:138
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
int nObjsAlloc
Definition: wlc.h:128
static Vec_Wrd_t * Vec_WrdAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecWrd.h:80
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition: wlcNtk.c:167
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Definition: wlc.h:45
static int Wlc_ObjCopy(Wlc_Ntk_t *p, int iObj)
Definition: wlc.h:188
unsigned End
Definition: wlc.h:108
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static word * Vec_WrdArray(Vec_Wrd_t *p)
Definition: vecWrd.h:316
Vec_Int_t vTravIds
Definition: wlc.h:137
Vec_Int_t vPos
Definition: wlc.h:119
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int * Wlc_ObjFanins(Wlc_Obj_t *p)
Definition: wlc.h:165
struct Wlc_Obj_t_ Wlc_Obj_t
BASIC TYPES ///.
Definition: wlc.h:99
void Wlc_NtkPrintDistrib(Wlc_Ntk_t *p, int fVerbose)
Definition: wlcNtk.c:284
void Wlc_ObjSetCi(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlcNtk.c:110
int Mem_FlexReadMemUsage(Mem_Flex_t *p)
Definition: mem.c:445
Definition: wlc.h:46
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
static Wlc_Obj_t * Wlc_ObjFanin1(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:172
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
Vec_Int_t vNameIds
Definition: wlc.h:134
static int Wlc_NtkPiNum(Wlc_Ntk_t *p)
Definition: wlc.h:143
Vec_Int_t vCos
Definition: wlc.h:121
void Wlc_NtkFree(Wlc_Ntk_t *p)
Definition: wlcNtk.c:195
static int Abc_BitWordNum(int nBits)
Definition: abc_global.h:255
int Fanins[2]
Definition: wlc.h:110
#define assert(ex)
Definition: util_old.h:213
unsigned fIsFi
Definition: wlc.h:106
static int Wlc_NtkHasCopy(Wlc_Ntk_t *p)
Definition: wlc.h:186
void Wlc_NtkPrintStats(Wlc_Ntk_t *p, int fDistrib, int fVerbose)
Definition: wlcNtk.c:375
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Vec_Int_t vFfs
Definition: wlc.h:122
Abc_Nam_t * pManName
Definition: wlc.h:133
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Wlc_Ntk_t * Wlc_NtkAlloc(char *pName, int nObjsAlloc)
FUNCTION DEFINITIONS ///.
Definition: wlcNtk.c:94
int Wlc_ObjCreate(Wlc_Ntk_t *p, int Type, int Signed, int End, int Beg, Vec_Int_t *vFanins)
Definition: wlcNtk.c:161
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static void Wlc_NtkPrintDistribFromSign(word sss, int *s, int *s0, int *s1)
Definition: wlcNtk.c:258
void Wlc_ObjSetCo(Wlc_Ntk_t *p, Wlc_Obj_t *pObj, int fFlopInput)
Definition: wlcNtk.c:130