abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
wlcBlast.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [wlcBlast.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Verilog parser.]
8 
9  Synopsis [Bit-blasting.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - August 22, 2014.]
16 
17  Revision [$Id: wlcBlast.c,v 1.00 2014/09/12 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "wlc.h"
22 #include "misc/tim/tim.h"
23 
25 
26 
27 ////////////////////////////////////////////////////////////////////////
28 /// DECLARATIONS ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 ////////////////////////////////////////////////////////////////////////
32 /// FUNCTION DEFINITIONS ///
33 ////////////////////////////////////////////////////////////////////////
34 
35 /**Function*************************************************************
36 
37  Synopsis [Helper functions.]
38 
39  Description []
40 
41  SideEffects []
42 
43  SeeAlso []
44 
45 ***********************************************************************/
47 {
48  Wlc_Obj_t * pObj;
49  int i, nBits = 0;
50  Wlc_NtkCleanCopy( p );
51  Wlc_NtkForEachObj( p, pObj, i )
52  {
53  Wlc_ObjSetCopy( p, i, nBits );
54  nBits += Wlc_ObjRange(pObj);
55  }
56  return nBits;
57 }
58 int * Wlc_VecCopy( Vec_Int_t * vOut, int * pArray, int nSize )
59 {
60  int i; Vec_IntClear( vOut );
61  for( i = 0; i < nSize; i++)
62  Vec_IntPush( vOut, pArray[i] );
63  return Vec_IntArray( vOut );
64 }
65 int * Wlc_VecLoadFanins( Vec_Int_t * vOut, int * pFanins, int nFanins, int nTotal, int fSigned )
66 {
67  int Fill = fSigned ? pFanins[nFanins-1] : 0;
68  int i; Vec_IntClear( vOut );
69  assert( nFanins <= nTotal );
70  for( i = 0; i < nTotal; i++)
71  Vec_IntPush( vOut, i < nFanins ? pFanins[i] : Fill );
72  return Vec_IntArray( vOut );
73 }
74 int Wlc_BlastGetConst( int * pNum, int nNum )
75 {
76  int i, Res = 0;
77  for ( i = 0; i < nNum; i++ )
78  if ( pNum[i] == 1 )
79  Res |= (1 << i);
80  else if ( pNum[i] != 0 )
81  return -1;
82  return Res;
83 }
84 int Wlc_NtkMuxTree_rec( Gia_Man_t * pNew, int * pCtrl, int nCtrl, Vec_Int_t * vData, int Shift )
85 {
86  int iLit0, iLit1;
87  if ( nCtrl == 0 )
88  return Vec_IntEntry( vData, Shift );
89  iLit0 = Wlc_NtkMuxTree_rec( pNew, pCtrl, nCtrl-1, vData, Shift );
90  iLit1 = Wlc_NtkMuxTree_rec( pNew, pCtrl, nCtrl-1, vData, Shift + (1<<(nCtrl-1)) );
91  return Gia_ManHashMux( pNew, pCtrl[nCtrl-1], iLit1, iLit0 );
92 }
93 
94 /**Function*************************************************************
95 
96  Synopsis [Bit blasting for specific operations.]
97 
98  Description []
99 
100  SideEffects []
101 
102  SeeAlso []
103 
104 ***********************************************************************/
105 void Wlc_BlastShiftRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
106 {
107  int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
108  int Fill = fSticky ? pNum[nNum-1] : 0;
109  int i, j, fShort = 0;
110  assert( nShift <= 32 );
111  for( i = 0; i < nShift; i++ )
112  for( j = 0; j < nNum - fSticky; j++ )
113  {
114  if( fShort || j + (1<<i) >= nNum )
115  {
116  pRes[j] = Gia_ManHashMux( pNew, pShift[i], Fill, pRes[j] );
117  if ( (1<<i) > nNum )
118  fShort = 1;
119  }
120  else
121  pRes[j] = Gia_ManHashMux( pNew, pShift[i], pRes[j+(1<<i)], pRes[j] );
122  }
123 }
124 void Wlc_BlastShiftLeft( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, int fSticky, Vec_Int_t * vRes )
125 {
126  int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
127  int Fill = fSticky ? pNum[0] : 0;
128  int i, j, fShort = 0;
129  assert( nShift <= 32 );
130  for( i = 0; i < nShift; i++ )
131  for( j = nNum-1; j >= fSticky; j-- )
132  {
133  if( fShort || (1<<i) > j )
134  {
135  pRes[j] = Gia_ManHashMux( pNew, pShift[i], Fill, pRes[j] );
136  if ( (1<<i) > nNum )
137  fShort = 1;
138  }
139  else
140  pRes[j] = Gia_ManHashMux( pNew, pShift[i], pRes[j-(1<<i)], pRes[j] );
141  }
142 }
143 void Wlc_BlastRotateRight( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, Vec_Int_t * vRes )
144 {
145  int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
146  int i, j, * pTemp = ABC_ALLOC( int, nNum );
147  assert( nShift <= 32 );
148  for( i = 0; i < nShift; i++, pRes = Wlc_VecCopy(vRes, pTemp, nNum) )
149  for( j = 0; j < nNum; j++ )
150  pTemp[j] = Gia_ManHashMux( pNew, pShift[i], pRes[(j+(1<<i))%nNum], pRes[j] );
151  ABC_FREE( pTemp );
152 }
153 void Wlc_BlastRotateLeft( Gia_Man_t * pNew, int * pNum, int nNum, int * pShift, int nShift, Vec_Int_t * vRes )
154 {
155  int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
156  int i, j, * pTemp = ABC_ALLOC( int, nNum );
157  assert( nShift <= 32 );
158  for( i = 0; i < nShift; i++, pRes = Wlc_VecCopy(vRes, pTemp, nNum) )
159  for( j = 0; j < nNum; j++ )
160  {
161  int move = (j >= (1<<i)) ? (j-(1<<i))%nNum : (nNum - (((1<<i)-j)%nNum)) % nNum;
162  pTemp[j] = Gia_ManHashMux( pNew, pShift[i], pRes[move], pRes[j] );
163 // pTemp[j] = Gia_ManHashMux( pNew, pShift[i], pRes[((unsigned)(nNum-(1<<i)+j))%nNum], pRes[j] );
164  }
165  ABC_FREE( pTemp );
166 }
167 int Wlc_BlastReduction( Gia_Man_t * pNew, int * pFans, int nFans, int Type )
168 {
169  if ( Type == WLC_OBJ_REDUCT_AND )
170  {
171  int k, iLit = 1;
172  for ( k = 0; k < nFans; k++ )
173  iLit = Gia_ManHashAnd( pNew, iLit, pFans[k] );
174  return iLit;
175  }
176  if ( Type == WLC_OBJ_REDUCT_OR )
177  {
178  int k, iLit = 0;
179  for ( k = 0; k < nFans; k++ )
180  iLit = Gia_ManHashOr( pNew, iLit, pFans[k] );
181  return iLit;
182  }
183  if ( Type == WLC_OBJ_REDUCT_XOR )
184  {
185  int k, iLit = 0;
186  for ( k = 0; k < nFans; k++ )
187  iLit = Gia_ManHashXor( pNew, iLit, pFans[k] );
188  return iLit;
189  }
190  assert( 0 );
191  return -1;
192 }
193 int Wlc_BlastLess( Gia_Man_t * pNew, int * pArg0, int * pArg1, int nBits )
194 {
195  int k, iKnown = 0, iRes = 0;
196  for ( k = nBits - 1; k >= 0; k-- )
197  {
198  iRes = Gia_ManHashMux( pNew, iKnown, iRes, Gia_ManHashAnd(pNew, Abc_LitNot(pArg0[k]), pArg1[k]) );
199  iKnown = Gia_ManHashOr( pNew, iKnown, Gia_ManHashXor(pNew, pArg0[k], pArg1[k]) );
200  if ( iKnown == 1 )
201  break;
202  }
203  return iRes;
204 }
205 int Wlc_BlastLessSigned( Gia_Man_t * pNew, int * pArg0, int * pArg1, int nBits )
206 {
207  int iDiffSign = Gia_ManHashXor( pNew, pArg0[nBits-1], pArg1[nBits-1] );
208  return Gia_ManHashMux( pNew, iDiffSign, pArg0[nBits-1], Wlc_BlastLess(pNew, pArg0, pArg1, nBits-1) );
209 }
210 void Wlc_BlastAdder( Gia_Man_t * pNew, int * pAdd0, int * pAdd1, int nBits ) // result is in pAdd0
211 {
212  int iCarry = 0, iTerm1, iTerm2, iTerm3, iSum, b;
213  for ( b = 0; b < nBits; b++ )
214  {
215  iSum = Gia_ManHashXor( pNew, iCarry, Gia_ManHashXor(pNew, pAdd0[b], pAdd1[b]) );
216  iTerm1 = Gia_ManHashAnd( pNew, pAdd0[b], pAdd1[b] );
217  iTerm2 = Gia_ManHashAnd( pNew, pAdd0[b], iCarry );
218  iTerm3 = Gia_ManHashAnd( pNew, pAdd1[b], iCarry );
219  iCarry = Gia_ManHashOr( pNew, iTerm1, Gia_ManHashOr(pNew, iTerm2, iTerm3) );
220  pAdd0[b] = iSum;
221  }
222 }
223 void Wlc_BlastSubtract( Gia_Man_t * pNew, int * pAdd0, int * pAdd1, int nBits ) // result is in pAdd0
224 {
225  int borrow = 0, top_bit, b;
226  for ( b = 0; b < nBits; b++ )
227  {
228  top_bit = Gia_ManHashMux(pNew, borrow, Abc_LitNot(pAdd0[b]), pAdd0[b]);
229  borrow = Gia_ManHashMux(pNew, pAdd0[b], Gia_ManHashAnd(pNew, borrow, pAdd1[b]), Gia_ManHashOr(pNew, borrow, pAdd1[b]));
230  pAdd0[b] = Gia_ManHashXor(pNew, top_bit, pAdd1[b]);
231  }
232 }
233 void Wlc_BlastMinus( Gia_Man_t * pNew, int * pNum, int nNum, Vec_Int_t * vRes )
234 {
235  int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
236  int i, invert = 0;
237  for ( i = 0; i < nNum; i++ )
238  {
239  pRes[i] = Gia_ManHashMux( pNew, invert, Abc_LitNot(pRes[i]), pRes[i] );
240  invert = Gia_ManHashOr( pNew, invert, pNum[i] );
241  }
242 }
243 void Wlc_BlastMultiplier( Gia_Man_t * pNew, int * pArg0, int * pArg1, int nBits, Vec_Int_t * vTemp, Vec_Int_t * vRes )
244 {
245  int i, j;
246  Vec_IntFill( vRes, nBits, 0 );
247  for ( i = 0; i < nBits; i++ )
248  {
249  Vec_IntFill( vTemp, i, 0 );
250  for ( j = 0; Vec_IntSize(vTemp) < nBits; j++ )
251  Vec_IntPush( vTemp, Gia_ManHashAnd(pNew, pArg0[j], pArg1[i]) );
252  assert( Vec_IntSize(vTemp) == nBits );
253  Wlc_BlastAdder( pNew, Vec_IntArray(vRes), Vec_IntArray(vTemp), nBits );
254  }
255 }
256 void Wlc_BlastDivider( Gia_Man_t * pNew, int * pNum, int nNum, int * pDiv, int nDiv, int fQuo, Vec_Int_t * vRes )
257 {
258  int * pRes = Wlc_VecCopy( vRes, pNum, nNum );
259  int * pQuo = ABC_ALLOC( int, nNum );
260  int * pTemp = ABC_ALLOC( int, nNum );
261  int i, j, known, borrow, y_bit, top_bit;
262  assert( nNum == nDiv );
263  for ( j = nNum - 1; j >= 0; j-- )
264  {
265  known = 0;
266  for ( i = nNum - 1; i > nNum - 1 - j; i-- )
267  {
268  known = Gia_ManHashOr( pNew, known, pDiv[i] );
269  if( known == 1 )
270  break;
271  }
272  pQuo[j] = known;
273  for ( i = nNum - 1; i >= 0; i-- )
274  {
275  if ( known == 1 )
276  break;
277  y_bit = (i >= j) ? pDiv[i-j] : 0;
278  pQuo[j] = Gia_ManHashMux( pNew, known, pQuo[j], Gia_ManHashAnd( pNew, y_bit, Abc_LitNot(pRes[i]) ) );
279  known = Gia_ManHashOr( pNew, known, Gia_ManHashXor(pNew, y_bit, pRes[i]));
280  }
281  pQuo[j] = Abc_LitNot(pQuo[j]);
282  if ( pQuo[j] == 0 )
283  continue;
284  borrow = 0;
285  for ( i = 0; i < nNum; i++ )
286  {
287  top_bit = Gia_ManHashMux( pNew, borrow, Abc_LitNot(pRes[i]), pRes[i] );
288  y_bit = (i >= j) ? pDiv[i-j] : 0;
289  borrow = Gia_ManHashMux( pNew, pRes[i], Gia_ManHashAnd(pNew, borrow, y_bit), Gia_ManHashOr(pNew, borrow, y_bit) );
290  pTemp[i] = Gia_ManHashXor( pNew, top_bit, y_bit );
291  }
292  if ( pQuo[j] == 1 )
293  Wlc_VecCopy( vRes, pTemp, nNum );
294  else
295  for( i = 0; i < nNum; i++ )
296  pRes[i] = Gia_ManHashMux( pNew, pQuo[j], pTemp[i], pRes[i] );
297  }
298  ABC_FREE( pTemp );
299  if ( fQuo )
300  Wlc_VecCopy( vRes, pQuo, nNum );
301  ABC_FREE( pQuo );
302 }
303 void Wlc_BlastDividerSigned( Gia_Man_t * pNew, int * pNum, int nNum, int * pDiv, int nDiv, int fQuo, Vec_Int_t * vRes )
304 {
305  Vec_Int_t * vNum = Vec_IntAlloc( nNum );
306  Vec_Int_t * vDiv = Vec_IntAlloc( nDiv );
307  Vec_Int_t * vRes00 = Vec_IntAlloc( nNum );
308  Vec_Int_t * vRes01 = Vec_IntAlloc( nNum );
309  Vec_Int_t * vRes10 = Vec_IntAlloc( nNum );
310  Vec_Int_t * vRes11 = Vec_IntAlloc( nNum );
311  Vec_Int_t * vRes2 = Vec_IntAlloc( nNum );
312  int k, iDiffSign = Gia_ManHashXor( pNew, pNum[nNum-1], pDiv[nDiv-1] );
313  Wlc_BlastMinus( pNew, pNum, nNum, vNum );
314  Wlc_BlastMinus( pNew, pDiv, nDiv, vDiv );
315  Wlc_BlastDivider( pNew, pNum, nNum, pDiv, nDiv, fQuo, vRes00 );
316  Wlc_BlastDivider( pNew, pNum, nNum, Vec_IntArray(vDiv), nDiv, fQuo, vRes01 );
317  Wlc_BlastDivider( pNew, Vec_IntArray(vNum), nNum, pDiv, nDiv, fQuo, vRes10 );
318  Wlc_BlastDivider( pNew, Vec_IntArray(vNum), nNum, Vec_IntArray(vDiv), nDiv, fQuo, vRes11 );
319  Vec_IntClear( vRes );
320  for ( k = 0; k < nNum; k++ )
321  {
322  int Data0 = Gia_ManHashMux( pNew, pDiv[nDiv-1], Vec_IntEntry(vRes01,k), Vec_IntEntry(vRes00,k) );
323  int Data1 = Gia_ManHashMux( pNew, pDiv[nDiv-1], Vec_IntEntry(vRes11,k), Vec_IntEntry(vRes10,k) );
324  Vec_IntPush( vRes, Gia_ManHashMux(pNew, pNum[nNum-1], Data1, Data0) );
325  }
326  Wlc_BlastMinus( pNew, Vec_IntArray(vRes), nNum, vRes2 );
327  for ( k = 0; k < nNum; k++ )
328  Vec_IntWriteEntry( vRes, k, Gia_ManHashMux(pNew, fQuo ? iDiffSign : pNum[nNum-1], Vec_IntEntry(vRes2,k), Vec_IntEntry(vRes,k)) );
329  Vec_IntFree( vNum );
330  Vec_IntFree( vDiv );
331  Vec_IntFree( vRes00 );
332  Vec_IntFree( vRes01 );
333  Vec_IntFree( vRes10 );
334  Vec_IntFree( vRes11 );
335  Vec_IntFree( vRes2 );
336  assert( Vec_IntSize(vRes) == nNum );
337 }
338 void Wlc_BlastZeroCondition( Gia_Man_t * pNew, int * pDiv, int nDiv, Vec_Int_t * vRes )
339 {
340  int i, Entry, iLit = Wlc_BlastReduction( pNew, pDiv, nDiv, WLC_OBJ_REDUCT_OR );
341  Vec_IntForEachEntry( vRes, Entry, i )
342  Vec_IntWriteEntry( vRes, i, Gia_ManHashAnd(pNew, iLit, Entry) );
343 }
344 void Wlc_BlastTable( Gia_Man_t * pNew, word * pTable, int * pFans, int nFans, int nOuts, Vec_Int_t * vRes )
345 {
346  extern int Kit_TruthToGia( Gia_Man_t * pMan, unsigned * pTruth, int nVars, Vec_Int_t * vMemory, Vec_Int_t * vLeaves, int fHash );
347  Vec_Int_t * vMemory = Vec_IntAlloc( 0 );
348  Vec_Int_t vLeaves = { nFans, nFans, pFans };
349  word * pTruth = ABC_ALLOC( word, Abc_TtWordNum(nFans) );
350  int o, i, m, iLit, nMints = (1 << nFans);
351  Vec_IntClear( vRes );
352  for ( o = 0; o < nOuts; o++ )
353  {
354  // derive truth table
355  memset( pTruth, 0, sizeof(word) * Abc_TtWordNum(nFans) );
356  for ( m = 0; m < nMints; m++ )
357  for ( i = 0; i < nFans; i++ )
358  if ( Abc_TtGetBit( pTable, m * nFans + i ) )
359  Abc_TtSetBit( pTruth, m );
360  // implement truth table
361  if ( nFans < 6 )
362  pTruth[0] = Abc_Tt6Stretch( pTruth[0], nFans );
363  iLit = Kit_TruthToGia( pNew, (unsigned *)pTruth, nFans, vMemory, &vLeaves, 1 );
364  Vec_IntPush( vRes, iLit );
365  }
366  Vec_IntFree( vMemory );
367  ABC_FREE( pTruth );
368 }
369 void Wlc_BlastPower( Gia_Man_t * pNew, int * pNum, int nNum, int * pExp, int nExp, Vec_Int_t * vTemp, Vec_Int_t * vRes )
370 {
371  Vec_Int_t * vDegrees = Vec_IntAlloc( nNum );
372  Vec_Int_t * vResTemp = Vec_IntAlloc( nNum );
373  int i, * pDegrees = NULL, * pRes = Vec_IntArray(vRes);
374  int k, * pResTemp = Vec_IntArray(vResTemp);
375  Vec_IntFill( vRes, nNum, 0 );
376  Vec_IntWriteEntry( vRes, 0, 1 );
377  for ( i = 0; i < nExp; i++ )
378  {
379  if ( i == 0 )
380  pDegrees = Wlc_VecCopy( vDegrees, pNum, nNum );
381  else
382  {
383  Wlc_BlastMultiplier( pNew, pDegrees, pDegrees, nNum, vTemp, vResTemp );
384  pDegrees = Wlc_VecCopy( vDegrees, pResTemp, nNum );
385  }
386  Wlc_BlastMultiplier( pNew, pRes, pDegrees, nNum, vTemp, vResTemp );
387  for ( k = 0; k < nNum; k++ )
388  pRes[k] = Gia_ManHashMux( pNew, pExp[i], pResTemp[k], pRes[k] );
389  }
390  Vec_IntFree( vResTemp );
391  Vec_IntFree( vDegrees );
392 }
393 
394 /**Function*************************************************************
395 
396  Synopsis []
397 
398  Description []
399 
400  SideEffects []
401 
402  SeeAlso []
403 
404 ***********************************************************************/
406 {
407  int fVerbose = 0;
408  Tim_Man_t * pManTime = NULL;
409  Gia_Man_t * pTemp, * pNew, * pExtra = NULL;
410  Wlc_Obj_t * pObj, * pPrev = NULL;
411  Vec_Int_t * vBits, * vTemp0, * vTemp1, * vTemp2, * vRes;
412  int nBits = Wlc_NtkPrepareBits( p );
413  int nRange, nRange0, nRange1, nRange2;
414  int i, k, b, iFanin, iLit, nAndPrev, * pFans0, * pFans1, * pFans2;
415  int nFFins = 0, nFFouts = 0, curPi = 0, curPo = 0;
416  int nBitCis = 0, nBitCos = 0;
417  vBits = Vec_IntAlloc( nBits );
418  vTemp0 = Vec_IntAlloc( 1000 );
419  vTemp1 = Vec_IntAlloc( 1000 );
420  vTemp2 = Vec_IntAlloc( 1000 );
421  vRes = Vec_IntAlloc( 1000 );
422  // clean AND-gate counters
423  memset( p->nAnds, 0, sizeof(int) * WLC_OBJ_NUMBER );
424  // create AIG manager
425  pNew = Gia_ManStart( 5 * Wlc_NtkObjNum(p) + 1000 );
426  pNew->pName = Abc_UtilStrsav( p->pName );
427  Gia_ManHashAlloc( pNew );
428  // prepare for AIG with boxes
429  if ( vBoxIds )
430  {
431  int nNewCis = 0, nNewCos = 0;
432  Wlc_NtkForEachObj( p, pObj, i )
433  pObj->Mark = 0;
434  // count bit-width of regular CIs/COs
435  Wlc_NtkForEachCi( p, pObj, i )
436  nBitCis += Wlc_ObjRange( pObj );
437  Wlc_NtkForEachCo( p, pObj, i )
438  nBitCos += Wlc_ObjRange( pObj );
439  // count bit-width of additional CIs/COs due to selected multipliers
440  assert( Vec_IntSize(vBoxIds) > 0 );
441  Wlc_NtkForEachObjVec( vBoxIds, p, pObj, i )
442  {
443  // currently works only for multipliers
444  assert( pObj->Type == WLC_OBJ_ARI_MULTI );
445  nNewCis += Wlc_ObjRange( pObj );
446  nNewCos += Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) );
447  nNewCos += Wlc_ObjRange( Wlc_ObjFanin1(p, pObj) );
448  pObj->Mark = 1;
449  }
450  // create hierarchy manager
451  pManTime = Tim_ManStart( nBitCis + nNewCis, nBitCos + nNewCos );
452  curPi = nBitCis;
453  curPo = 0;
454  // create AIG manager for logic of the boxes
455  pExtra = Gia_ManStart( Wlc_NtkObjNum(p) );
456  Gia_ManHashAlloc( pExtra );
457  }
458  // blast in the topological order
459  Wlc_NtkForEachObj( p, pObj, i )
460  {
461 // char * pName = Wlc_ObjName(p, i);
462  nAndPrev = Gia_ManAndNum(pNew);
463  nRange = Wlc_ObjRange( pObj );
464  nRange0 = Wlc_ObjFaninNum(pObj) > 0 ? Wlc_ObjRange( Wlc_ObjFanin0(p, pObj) ) : -1;
465  nRange1 = Wlc_ObjFaninNum(pObj) > 1 ? Wlc_ObjRange( Wlc_ObjFanin1(p, pObj) ) : -1;
466  nRange2 = Wlc_ObjFaninNum(pObj) > 2 ? Wlc_ObjRange( Wlc_ObjFanin2(p, pObj) ) : -1;
467  pFans0 = Wlc_ObjFaninNum(pObj) > 0 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId0(pObj)) ) : NULL;
468  pFans1 = Wlc_ObjFaninNum(pObj) > 1 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId1(pObj)) ) : NULL;
469  pFans2 = Wlc_ObjFaninNum(pObj) > 2 ? Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjFaninId2(pObj)) ) : NULL;
470  Vec_IntClear( vRes );
471  assert( nRange > 0 );
472  if ( vBoxIds && pObj->Mark )
473  {
474  pObj->Mark = 0;
475 
476  // create new box
477  Tim_ManCreateBox( pManTime, curPo, nRange0 + nRange1, curPi, nRange, -1 );
478  curPi += nRange;
479  curPo += nRange0 + nRange1;
480 
481  // create combinational outputs in the normal manager
482  for ( k = 0; k < nRange0; k++ )
483  Gia_ManAppendCo( pNew, pFans0[k] );
484  for ( k = 0; k < nRange1; k++ )
485  Gia_ManAppendCo( pNew, pFans1[k] );
486 
487  // make sure there is enough primary inputs in the manager
488  for ( k = Gia_ManPiNum(pExtra); k < nRange0 + nRange1; k++ )
489  Gia_ManAppendCi( pExtra );
490  // create combinational inputs
491  Vec_IntClear( vTemp0 );
492  for ( k = 0; k < nRange0; k++ )
493  Vec_IntPush( vTemp0, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, k)) );
494  Vec_IntClear( vTemp1 );
495  for ( k = 0; k < nRange1; k++ )
496  Vec_IntPush( vTemp1, Gia_Obj2Lit(pExtra, Gia_ManPi(pExtra, nRange0+k)) );
497  // get new fanin arrays
498  pFans0 = Vec_IntArray( vTemp0 );
499  pFans1 = Vec_IntArray( vTemp1 );
500  // bit-blast the multiplier in the external manager
501  {
502  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
503  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
504  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
505  Wlc_BlastMultiplier( pExtra, pArg0, pArg1, nRange, vTemp2, vRes );
506  Vec_IntShrink( vRes, nRange );
507  }
508  // create outputs in the external manager
509  for ( k = 0; k < nRange; k++ )
510  Gia_ManAppendCo( pExtra, Vec_IntEntry(vRes, k) );
511 
512  // create combinational inputs in the normal manager
513  Vec_IntClear( vRes );
514  for ( k = 0; k < nRange; k++ )
515  Vec_IntPush( vRes, Gia_ManAppendCi(pNew) );
516  }
517  else if ( Wlc_ObjIsCi(pObj) )
518  {
519  for ( k = 0; k < nRange; k++ )
520  Vec_IntPush( vRes, Gia_ManAppendCi(pNew) );
521  if ( pObj->Type == WLC_OBJ_FO )
522  nFFouts += Vec_IntSize(vRes);
523  }
524  else if ( pObj->Type == WLC_OBJ_BUF )
525  {
526  int nRangeMax = Abc_MaxInt( nRange0, nRange );
527  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed );
528  for ( k = 0; k < nRange; k++ )
529  Vec_IntPush( vRes, pArg0[k] );
530  }
531  else if ( pObj->Type == WLC_OBJ_CONST )
532  {
533  word * pTruth = (word *)Wlc_ObjFanins(pObj);
534  for ( k = 0; k < nRange; k++ )
535  Vec_IntPush( vRes, Abc_TtGetBit(pTruth, k) );
536  }
537  else if ( pObj->Type == WLC_OBJ_MUX )
538  {
539  assert( 1 + (1 << nRange0) == Wlc_ObjFaninNum(pObj) );
540  for ( b = 0; b < nRange; b++ )
541  {
542  Vec_IntClear( vTemp0 );
543  Wlc_ObjForEachFanin( pObj, iFanin, k )
544  {
545  if ( !k ) continue;
546  //assert( nRange == Wlc_ObjRange(Wlc_NtkObj(p, iFanin)) );
547  pFans1 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, iFanin) );
548  Vec_IntPush( vTemp0, b < Wlc_ObjRange(Wlc_NtkObj(p, iFanin)) ? pFans1[b] : 0 );
549  }
550  Vec_IntPush( vRes, Wlc_NtkMuxTree_rec(pNew, pFans0, nRange0, vTemp0, 0) );
551  }
552  }
553  else if ( pObj->Type == WLC_OBJ_SHIFT_R || pObj->Type == WLC_OBJ_SHIFT_RA ||
554  pObj->Type == WLC_OBJ_SHIFT_L || pObj->Type == WLC_OBJ_SHIFT_LA )
555  {
556  int nRangeMax = Abc_MaxInt( nRange, nRange0 );
557  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed );
558  if ( pObj->Type == WLC_OBJ_SHIFT_R || pObj->Type == WLC_OBJ_SHIFT_RA )
559  Wlc_BlastShiftRight( pNew, pArg0, nRangeMax, pFans1, nRange1, Wlc_ObjFanin0(p, pObj)->Signed && pObj->Type == WLC_OBJ_SHIFT_RA, vRes );
560  else
561  Wlc_BlastShiftLeft( pNew, pArg0, nRangeMax, pFans1, nRange1, 0, vRes );
562  Vec_IntShrink( vRes, nRange );
563  }
564  else if ( pObj->Type == WLC_OBJ_ROTATE_R )
565  {
566  assert( nRange0 == nRange );
567  Wlc_BlastRotateRight( pNew, pFans0, nRange0, pFans1, nRange1, vRes );
568  }
569  else if ( pObj->Type == WLC_OBJ_ROTATE_L )
570  {
571  assert( nRange0 == nRange );
572  Wlc_BlastRotateLeft( pNew, pFans0, nRange0, pFans1, nRange1, vRes );
573  }
574  else if ( pObj->Type == WLC_OBJ_BIT_NOT )
575  {
576  int nRangeMax = Abc_MaxInt( nRange, nRange0 );
577  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed );
578  for ( k = 0; k < nRange; k++ )
579  Vec_IntPush( vRes, Abc_LitNot(pArg0[k]) );
580  }
581  else if ( pObj->Type == WLC_OBJ_BIT_AND )
582  {
583  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
584  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
585  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
586  for ( k = 0; k < nRange; k++ )
587  Vec_IntPush( vRes, Gia_ManHashAnd(pNew, pArg0[k], pArg1[k]) );
588  }
589  else if ( pObj->Type == WLC_OBJ_BIT_OR )
590  {
591  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
592  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
593  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
594  for ( k = 0; k < nRange; k++ )
595  Vec_IntPush( vRes, Gia_ManHashOr(pNew, pArg0[k], pArg1[k]) );
596  }
597  else if ( pObj->Type == WLC_OBJ_BIT_XOR )
598  {
599  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
600  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
601  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
602  for ( k = 0; k < nRange; k++ )
603  Vec_IntPush( vRes, Gia_ManHashXor(pNew, pArg0[k], pArg1[k]) );
604  }
605  else if ( pObj->Type == WLC_OBJ_BIT_SELECT )
606  {
607  Wlc_Obj_t * pFanin = Wlc_ObjFanin0(p, pObj);
608  int End = Wlc_ObjRangeEnd(pObj);
609  int Beg = Wlc_ObjRangeBeg(pObj);
610  assert( nRange == End - Beg + 1 );
611  assert( (int)pFanin->Beg <= Beg && End <= (int)pFanin->End );
612  for ( k = Beg; k <= End; k++ )
613  Vec_IntPush( vRes, pFans0[k - pFanin->Beg] );
614  }
615  else if ( pObj->Type == WLC_OBJ_BIT_CONCAT )
616  {
617  int iFanin, nTotal = 0;
618  Wlc_ObjForEachFanin( pObj, iFanin, k )
619  nTotal += Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
620  assert( nRange == nTotal );
621  Wlc_ObjForEachFaninReverse( pObj, iFanin, k )
622  {
623  nRange0 = Wlc_ObjRange( Wlc_NtkObj(p, iFanin) );
624  pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, iFanin) );
625  for ( b = 0; b < nRange0; b++ )
626  Vec_IntPush( vRes, pFans0[b] );
627  }
628  }
629  else if ( pObj->Type == WLC_OBJ_BIT_ZEROPAD || pObj->Type == WLC_OBJ_BIT_SIGNEXT )
630  {
631  int Pad = pObj->Type == WLC_OBJ_BIT_ZEROPAD ? 0 : pFans0[nRange0-1];
632  assert( nRange0 < nRange );
633  for ( k = 0; k < nRange0; k++ )
634  Vec_IntPush( vRes, pFans0[k] );
635  for ( ; k < nRange; k++ )
636  Vec_IntPush( vRes, Pad );
637  }
638  else if ( pObj->Type == WLC_OBJ_LOGIC_NOT )
639  {
640  iLit = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
641  Vec_IntFill( vRes, 1, Abc_LitNot(iLit) );
642  for ( k = 1; k < nRange; k++ )
643  Vec_IntPush( vRes, 0 );
644  }
645  else if ( pObj->Type == WLC_OBJ_LOGIC_AND )
646  {
647  int iLit0 = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
648  int iLit1 = Wlc_BlastReduction( pNew, pFans1, nRange1, WLC_OBJ_REDUCT_OR );
649  Vec_IntFill( vRes, 1, Gia_ManHashAnd(pNew, iLit0, iLit1) );
650  for ( k = 1; k < nRange; k++ )
651  Vec_IntPush( vRes, 0 );
652  }
653  else if ( pObj->Type == WLC_OBJ_LOGIC_OR )
654  {
655  int iLit0 = Wlc_BlastReduction( pNew, pFans0, nRange0, WLC_OBJ_REDUCT_OR );
656  int iLit1 = Wlc_BlastReduction( pNew, pFans1, nRange1, WLC_OBJ_REDUCT_OR );
657  Vec_IntFill( vRes, 1, Gia_ManHashOr(pNew, iLit0, iLit1) );
658  for ( k = 1; k < nRange; k++ )
659  Vec_IntPush( vRes, 0 );
660  }
661  else if ( pObj->Type == WLC_OBJ_COMP_EQU || pObj->Type == WLC_OBJ_COMP_NOTEQU )
662  {
663  int iLit = 0, nRangeMax = Abc_MaxInt( nRange0, nRange1 );
664  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
665  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
666  for ( k = 0; k < nRangeMax; k++ )
667  iLit = Gia_ManHashOr( pNew, iLit, Gia_ManHashXor(pNew, pArg0[k], pArg1[k]) );
668  Vec_IntFill( vRes, 1, Abc_LitNotCond(iLit, pObj->Type == WLC_OBJ_COMP_EQU) );
669  for ( k = 1; k < nRange; k++ )
670  Vec_IntPush( vRes, 0 );
671  }
672  else if ( pObj->Type == WLC_OBJ_COMP_LESS || pObj->Type == WLC_OBJ_COMP_MOREEQU ||
673  pObj->Type == WLC_OBJ_COMP_MORE || pObj->Type == WLC_OBJ_COMP_LESSEQU )
674  {
675  int nRangeMax = Abc_MaxInt( nRange0, nRange1 );
676  int fSigned = Wlc_ObjIsSignedFanin01(p, pObj);
677  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, fSigned );
678  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, fSigned );
679  int fSwap = (pObj->Type == WLC_OBJ_COMP_MORE || pObj->Type == WLC_OBJ_COMP_LESSEQU);
680  int fCompl = (pObj->Type == WLC_OBJ_COMP_MOREEQU || pObj->Type == WLC_OBJ_COMP_LESSEQU);
681  if ( fSwap ) ABC_SWAP( int *, pArg0, pArg1 );
682  if ( fSigned )
683  iLit = Wlc_BlastLessSigned( pNew, pArg0, pArg1, nRangeMax );
684  else
685  iLit = Wlc_BlastLess( pNew, pArg0, pArg1, nRangeMax );
686  iLit = Abc_LitNotCond( iLit, fCompl );
687  Vec_IntFill( vRes, 1, iLit );
688  for ( k = 1; k < nRange; k++ )
689  Vec_IntPush( vRes, 0 );
690  }
691  else if ( pObj->Type == WLC_OBJ_REDUCT_AND || pObj->Type == WLC_OBJ_REDUCT_OR || pObj->Type == WLC_OBJ_REDUCT_XOR )
692  {
693  Vec_IntPush( vRes, Wlc_BlastReduction( pNew, pFans0, nRange0, pObj->Type ) );
694  for ( k = 1; k < nRange; k++ )
695  Vec_IntPush( vRes, 0 );
696  }
697  else if ( pObj->Type == WLC_OBJ_ARI_ADD || pObj->Type == WLC_OBJ_ARI_SUB )
698  {
699  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
700  int * pArg0 = Wlc_VecLoadFanins( vRes, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
701  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
702  if ( pObj->Type == WLC_OBJ_ARI_ADD )
703  Wlc_BlastAdder( pNew, pArg0, pArg1, nRange ); // result is in pFan0 (vRes)
704  else
705  Wlc_BlastSubtract( pNew, pArg0, pArg1, nRange ); // result is in pFan0 (vRes)
706  Vec_IntShrink( vRes, nRange );
707  }
708  else if ( pObj->Type == WLC_OBJ_ARI_MULTI )
709  {
710  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
711  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
712  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, Wlc_ObjIsSignedFanin01(p, pObj) );
713  Wlc_BlastMultiplier( pNew, pArg0, pArg1, nRange, vTemp2, vRes );
714  Vec_IntShrink( vRes, nRange );
715  }
716  else if ( pObj->Type == WLC_OBJ_ARI_DIVIDE || pObj->Type == WLC_OBJ_ARI_MODULUS )
717  {
718  int nRangeMax = Abc_MaxInt( nRange, Abc_MaxInt(nRange0, nRange1) );
719  int fSigned = Wlc_ObjIsSignedFanin01(p, pObj);
720  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, fSigned );
721  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRangeMax, fSigned );
722  if ( fSigned )
723  Wlc_BlastDividerSigned( pNew, pArg0, nRangeMax, pArg1, nRangeMax, pObj->Type == WLC_OBJ_ARI_DIVIDE, vRes );
724  else
725  Wlc_BlastDivider( pNew, pArg0, nRangeMax, pArg1, nRangeMax, pObj->Type == WLC_OBJ_ARI_DIVIDE, vRes );
726  Vec_IntShrink( vRes, nRange );
727  Wlc_BlastZeroCondition( pNew, pFans1, nRange1, vRes );
728  }
729  else if ( pObj->Type == WLC_OBJ_ARI_MINUS )
730  {
731  int nRangeMax = Abc_MaxInt( nRange0, nRange );
732  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed );
733  Wlc_BlastMinus( pNew, pArg0, nRangeMax, vRes );
734  Vec_IntShrink( vRes, nRange );
735  }
736  else if ( pObj->Type == WLC_OBJ_ARI_POWER )
737  {
738  int nRangeMax = Abc_MaxInt(nRange0, nRange);
739  int * pArg0 = Wlc_VecLoadFanins( vTemp0, pFans0, nRange0, nRangeMax, Wlc_ObjFanin0(p, pObj)->Signed );
740  int * pArg1 = Wlc_VecLoadFanins( vTemp1, pFans1, nRange1, nRange1, Wlc_ObjFanin1(p, pObj)->Signed );
741  Wlc_BlastPower( pNew, pArg0, nRangeMax, pArg1, nRange1, vTemp2, vRes );
742  Vec_IntShrink( vRes, nRange );
743  }
744  else if ( pObj->Type == WLC_OBJ_TABLE )
745  Wlc_BlastTable( pNew, Wlc_ObjTable(p, pObj), pFans0, nRange0, nRange, vRes );
746  else assert( 0 );
747  assert( Vec_IntSize(vBits) == Wlc_ObjCopy(p, i) );
748  Vec_IntAppend( vBits, vRes );
749  pPrev = pObj;
750  p->nAnds[pObj->Type] += Gia_ManAndNum(pNew) - nAndPrev;
751  }
752  p->nAnds[0] = Gia_ManAndNum(pNew);
753  assert( nBits == Vec_IntSize(vBits) );
754  Vec_IntFree( vTemp0 );
755  Vec_IntFree( vTemp1 );
756  Vec_IntFree( vTemp2 );
757  Vec_IntFree( vRes );
758  // create COs
759  Wlc_NtkForEachCo( p, pObj, i )
760  {
761  nRange = Wlc_ObjRange( pObj );
762  pFans0 = Vec_IntEntryP( vBits, Wlc_ObjCopy(p, Wlc_ObjId(p, pObj)) );
763  if ( fVerbose )
764  printf( "%s(%d) ", Wlc_ObjName(p, Wlc_ObjId(p, pObj)), Gia_ManCoNum(pNew) );
765  for ( k = 0; k < nRange; k++ )
766  Gia_ManAppendCo( pNew, pFans0[k] );
767  if ( pObj->fIsFi )
768  nFFins += nRange;
769  }
770  if ( fVerbose )
771  printf( "\n" );
772  Vec_IntFree( vBits );
773  Vec_IntErase( &p->vCopies );
774  // set the number of registers
775  assert( nFFins == nFFouts );
776  Gia_ManSetRegNum( pNew, nFFins );
777  // finalize AIG
778  pNew = Gia_ManCleanup( pTemp = pNew );
779  Gia_ManStop( pTemp );
780  // finalize AIG with boxes
781  if ( vBoxIds )
782  {
783  curPo += nBitCos;
784  assert( curPi == Tim_ManCiNum(pManTime) );
785  assert( curPo == Tim_ManCoNum(pManTime) );
786  // finalize the extra AIG
787  pExtra = Gia_ManCleanup( pTemp = pExtra );
788  Gia_ManStop( pTemp );
789  assert( Gia_ManPoNum(pExtra) == Gia_ManCiNum(pNew) - nBitCis );
790  // attach
791  pNew->pAigExtra = pExtra;
792  pNew->pManTime = pManTime;
793  // normalize AIG
794  pNew = Gia_ManDupNormalize( pTemp = pNew );
795  Gia_ManTransferTiming( pNew, pTemp );
796  Gia_ManStop( pTemp );
797  //Tim_ManPrint( pManTime );
798  }
799  return pNew;
800 }
801 
802 
803 ////////////////////////////////////////////////////////////////////////
804 /// END OF FILE ///
805 ////////////////////////////////////////////////////////////////////////
806 
807 
809 
char * memset()
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
void Wlc_BlastPower(Gia_Man_t *pNew, int *pNum, int nNum, int *pExp, int nExp, Vec_Int_t *vTemp, Vec_Int_t *vRes)
Definition: wlcBlast.c:369
#define Wlc_NtkForEachCo(p, pCo, i)
Definition: wlc.h:216
void Wlc_BlastDividerSigned(Gia_Man_t *pNew, int *pNum, int nNum, int *pDiv, int nDiv, int fQuo, Vec_Int_t *vRes)
Definition: wlcBlast.c:303
void Wlc_BlastAdder(Gia_Man_t *pNew, int *pAdd0, int *pAdd1, int nBits)
Definition: wlcBlast.c:210
static int Wlc_ObjId(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:161
char * Wlc_ObjName(Wlc_Ntk_t *p, int iObj)
Definition: wlcNtk.c:167
static Wlc_Obj_t * Wlc_ObjFanin2(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:173
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
void Wlc_BlastTable(Gia_Man_t *pNew, word *pTable, int *pFans, int nFans, int nOuts, Vec_Int_t *vRes)
Definition: wlcBlast.c:344
static int Wlc_ObjFaninId1(Wlc_Obj_t *p)
Definition: wlc.h:168
Gia_Man_t * pAigExtra
Definition: gia.h:149
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
#define Wlc_ObjForEachFanin(pObj, iFanin, i)
Definition: wlc.h:221
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:658
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Wlc_NtkObjNum(Wlc_Ntk_t *p)
Definition: wlc.h:141
ABC_NAMESPACE_IMPL_START int Wlc_NtkPrepareBits(Wlc_Ntk_t *p)
DECLARATIONS ///.
Definition: wlcBlast.c:46
static Wlc_Obj_t * Wlc_NtkObj(Wlc_Ntk_t *p, int Id)
Definition: wlc.h:149
#define Wlc_NtkForEachObjVec(vVec, p, pObj, i)
Definition: wlc.h:208
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Wlc_BlastDivider(Gia_Man_t *pNew, int *pNum, int nNum, int *pDiv, int nDiv, int fQuo, Vec_Int_t *vRes)
Definition: wlcBlast.c:256
static int Wlc_ObjRangeEnd(Wlc_Obj_t *p)
Definition: wlc.h:176
static Wlc_Obj_t * Wlc_ObjFanin0(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:171
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static void Vec_IntErase(Vec_Int_t *p)
Definition: vecInt.h:266
void Wlc_BlastRotateLeft(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, Vec_Int_t *vRes)
Definition: wlcBlast.c:153
static void Abc_TtSetBit(word *p, int i)
Definition: utilTruth.h:150
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
void Wlc_BlastShiftRight(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, int fSticky, Vec_Int_t *vRes)
Definition: wlcBlast.c:105
void Wlc_BlastZeroCondition(Gia_Man_t *pNew, int *pDiv, int nDiv, Vec_Int_t *vRes)
Definition: wlcBlast.c:338
int Wlc_BlastReduction(Gia_Man_t *pNew, int *pFans, int nFans, int Type)
Definition: wlcBlast.c:167
int Wlc_BlastLessSigned(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits)
Definition: wlcBlast.c:205
static int Abc_TtGetBit(word *p, int i)
MACRO DEFINITIONS ///.
Definition: utilTruth.h:149
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Wlc_ObjRange(Wlc_Obj_t *p)
Definition: wlc.h:175
int * Wlc_VecLoadFanins(Vec_Int_t *vOut, int *pFanins, int nFanins, int nTotal, int fSigned)
Definition: wlcBlast.c:65
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static void Wlc_NtkCleanCopy(Wlc_Ntk_t *p)
Definition: wlc.h:185
int Wlc_BlastLess(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits)
Definition: wlcBlast.c:193
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static word * Wlc_ObjTable(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:183
int Wlc_BlastGetConst(int *pNum, int nNum)
Definition: wlcBlast.c:74
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
unsigned Beg
Definition: wlc.h:109
static int Wlc_ObjFaninId0(Wlc_Obj_t *p)
Definition: wlc.h:167
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
#define Wlc_ObjForEachFaninReverse(pObj, iFanin, i)
Definition: wlc.h:223
static int Gia_ManAndNum(Gia_Man_t *p)
Definition: gia.h:389
void Wlc_BlastMultiplier(Gia_Man_t *pNew, int *pArg0, int *pArg1, int nBits, Vec_Int_t *vTemp, Vec_Int_t *vRes)
Definition: wlcBlast.c:243
static void Wlc_ObjSetCopy(Wlc_Ntk_t *p, int iObj, int i)
Definition: wlc.h:187
void Wlc_BlastRotateRight(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, Vec_Int_t *vRes)
Definition: wlcBlast.c:143
static Gia_Obj_t * Gia_ManPi(Gia_Man_t *p, int v)
Definition: gia.h:405
#define Wlc_NtkForEachCi(p, pCi, i)
Definition: wlc.h:214
char * pName
Definition: gia.h:97
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
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p)
Definition: giaTim.c:134
char * pName
Definition: wlc.h:117
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition: giaHash.c:677
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static word Abc_Tt6Stretch(word t, int nVars)
Definition: utilTruth.h:708
unsigned Type
Definition: wlc.h:102
static int Wlc_ObjIsCi(Wlc_Obj_t *p)
Definition: wlc.h:158
void Wlc_BlastSubtract(Gia_Man_t *pNew, int *pAdd0, int *pAdd1, int nBits)
Definition: wlcBlast.c:223
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
int Wlc_NtkMuxTree_rec(Gia_Man_t *pNew, int *pCtrl, int nCtrl, Vec_Int_t *vData, int Shift)
Definition: wlcBlast.c:84
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
static void Vec_IntAppend(Vec_Int_t *vVec1, Vec_Int_t *vVec2)
void * pManTime
Definition: gia.h:165
int nAnds[WLC_OBJ_NUMBER]
Definition: wlc.h:124
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
#define Wlc_NtkForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: wlc.h:206
void Wlc_BlastMinus(Gia_Man_t *pNew, int *pNum, int nNum, Vec_Int_t *vRes)
Definition: wlcBlast.c:233
static int Wlc_ObjRangeBeg(Wlc_Obj_t *p)
Definition: wlc.h:177
ABC_NAMESPACE_IMPL_START int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.
Definition: kitHop.c:80
Vec_Int_t vCopies
Definition: wlc.h:138
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
Definition: wlc.h:47
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Vec_Int_t *vBoxIds)
Definition: wlcBlast.c:405
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static int Wlc_ObjCopy(Wlc_Ntk_t *p, int iObj)
Definition: wlc.h:188
static int Abc_LitNot(int Lit)
Definition: abc_global.h:266
unsigned End
Definition: wlc.h:108
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
void Wlc_BlastShiftLeft(Gia_Man_t *pNew, int *pNum, int nNum, int *pShift, int nShift, int fSticky, Vec_Int_t *vRes)
Definition: wlcBlast.c:124
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int * Wlc_ObjFanins(Wlc_Obj_t *p)
Definition: wlc.h:165
Definition: gia.h:95
unsigned Mark
Definition: wlc.h:104
static Wlc_Obj_t * Wlc_ObjFanin1(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:172
#define assert(ex)
Definition: util_old.h:213
unsigned fIsFi
Definition: wlc.h:106
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
Definition: vecInt.h:417
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static int Wlc_ObjFaninId2(Wlc_Obj_t *p)
Definition: wlc.h:169
static int Wlc_ObjIsSignedFanin01(Wlc_Ntk_t *p, Wlc_Obj_t *pObj)
Definition: wlc.h:179
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:611
int * Wlc_VecCopy(Vec_Int_t *vOut, int *pArray, int nSize)
Definition: wlcBlast.c:58
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
static int Gia_Obj2Lit(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:433
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384