abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcIf.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcIf.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Interface with the FPGA mapping package.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - November 21, 2006.]
16 
17  Revision [$Id: abcIf.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "base/main/main.h"
23 #include "map/if/if.h"
24 #include "bool/kit/kit.h"
25 #include "aig/aig/aig.h"
26 
28 
29 
30 ////////////////////////////////////////////////////////////////////////
31 /// DECLARATIONS ///
32 ////////////////////////////////////////////////////////////////////////
33 
34 extern If_Man_t * Abc_NtkToIf( Abc_Ntk_t * pNtk, If_Par_t * pPars );
35 static Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk );
36 extern Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t * pIfObj, Vec_Int_t * vCover );
37 static Hop_Obj_t * Abc_NodeIfToHop( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_Obj_t * pIfObj );
38 static Vec_Ptr_t * Abc_NtkFindGoodOrder( Abc_Ntk_t * pNtk );
39 
40 extern void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose );
41 extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose );
42 
43 ////////////////////////////////////////////////////////////////////////
44 /// FUNCTION DEFINITIONS ///
45 ////////////////////////////////////////////////////////////////////////
46 
47 /**Function*************************************************************
48 
49  Synopsis [Interface with the FPGA mapping package.]
50 
51  Description []
52 
53  SideEffects []
54 
55  SeeAlso []
56 
57 ***********************************************************************/
59 {
60  abctime clk = Abc_Clock();
61  Gia_Man_t * pNew;
62  Vec_Int_t * vCopy;
63  If_Obj_t * pIfObj;
64  int i;
65  assert( pIfMan->vSwitching == NULL );
66  // create the new manager
67  pNew = Gia_ManStart( If_ManObjNum(pIfMan) );
68  vCopy = Vec_IntAlloc( If_ManObjNum(pIfMan) );
69  // constant and inputs
70  Vec_IntPush( vCopy, 1 );
71  If_ManForEachCi( pIfMan, pIfObj, i )
72  Vec_IntPush( vCopy, Gia_ManAppendCi(pNew) );
73  // internal nodes
74  If_ManForEachNode( pIfMan, pIfObj, i )
75  {
76  int iLit0 = Abc_LitNotCond( Vec_IntEntry(vCopy, If_ObjFanin0(pIfObj)->Id), If_ObjFaninC0(pIfObj) );
77  int iLit1 = Abc_LitNotCond( Vec_IntEntry(vCopy, If_ObjFanin1(pIfObj)->Id), If_ObjFaninC1(pIfObj) );
78  Vec_IntPush( vCopy, Gia_ManAppendAnd(pNew, iLit0, iLit1) );
79  }
80  // outputs
81  If_ManForEachCo( pIfMan, pIfObj, i )
82  {
83  int iLit0 = Abc_LitNotCond( Vec_IntEntry(vCopy, If_ObjFanin0(pIfObj)->Id), If_ObjFaninC0(pIfObj) );
84  Vec_IntPush( vCopy, Gia_ManAppendCo(pNew, iLit0) );
85  }
86  assert( Vec_IntSize(vCopy) == If_ManObjNum(pIfMan) );
87  Vec_IntFree( vCopy );
88  // compute switching activity
89  pIfMan->vSwitching = Gia_ManComputeSwitchProbs( pNew, 48, 16, 0 );
90  Gia_ManStop( pNew );
91  if ( pIfMan->pPars->fVerbose )
92  Abc_PrintTime( 1, "Computing switching activity", Abc_Clock() - clk );
93 }
94 
95 /**Function*************************************************************
96 
97  Synopsis [Interface with the FPGA mapping package.]
98 
99  Description []
100 
101  SideEffects []
102 
103  SeeAlso []
104 
105 ***********************************************************************/
106 Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
107 {
108  Abc_Ntk_t * pNtkNew, * pTemp;
109  If_Man_t * pIfMan;
110 
111  assert( Abc_NtkIsStrash(pNtk) );
112 
113  // get timing information
114  pPars->pTimesArr = Abc_NtkGetCiArrivalFloats(pNtk);
115  pPars->pTimesReq = Abc_NtkGetCoRequiredFloats(pNtk);
116 
117  // set the latch paths
118  if ( pPars->fLatchPaths && pPars->pTimesArr )
119  {
120  int c;
121  for ( c = 0; c < Abc_NtkPiNum(pNtk); c++ )
122  pPars->pTimesArr[c] = -ABC_INFINITY;
123  }
124 
125  // create FPGA mapper
126  pIfMan = Abc_NtkToIf( pNtk, pPars );
127  if ( pIfMan == NULL )
128  return NULL;
129  if ( pPars->fPower )
130  If_ManComputeSwitching( pIfMan );
131 
132  // create DSD manager
133  if ( pPars->fUseDsd )
134  {
136  assert( pPars->nLutSize <= If_DsdManVarNum(p) );
137  assert( (pPars->pLutStruct == NULL && If_DsdManLutSize(p) == 0) || (pPars->pLutStruct && pPars->pLutStruct[0] - '0' == If_DsdManLutSize(p)) );
139  if ( pPars->fDsdBalance )
140  If_DsdManAllocIsops( pIfMan->pIfDsdMan, pPars->nLutSize );
141  }
142 
143  // perform FPGA mapping
144  if ( !If_ManPerformMapping( pIfMan ) )
145  {
146  If_ManStop( pIfMan );
147  return NULL;
148  }
149 
150  // transform the result of mapping into the new network
151  pNtkNew = Abc_NtkFromIf( pIfMan, pNtk );
152  if ( pNtkNew == NULL )
153  return NULL;
154  If_ManStop( pIfMan );
155  if ( pPars->fDelayOpt || pPars->fDsdBalance || pPars->fUserRecLib )
156  {
157  pNtkNew = Abc_NtkStrash( pTemp = pNtkNew, 0, 0, 0 );
158  Abc_NtkDelete( pTemp );
159  }
160  else if ( pPars->fBidec && pPars->nLutSize <= 8 )
161  Abc_NtkBidecResyn( pNtkNew, 0 );
162 
163  // duplicate EXDC
164  if ( pNtk->pExdc )
165  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
166  // make sure that everything is okay
167  if ( !Abc_NtkCheck( pNtkNew ) )
168  {
169  printf( "Abc_NtkIf: The network check has failed.\n" );
170  Abc_NtkDelete( pNtkNew );
171  return NULL;
172  }
173  return pNtkNew;
174 }
175 
176 /**Function*************************************************************
177 
178  Synopsis [Load the network into FPGA manager.]
179 
180  Description []
181 
182  SideEffects []
183 
184  SeeAlso []
185 
186 ***********************************************************************/
187 static inline If_Obj_t * Abc_ObjIfCopy( Abc_Obj_t * pNode ) { return (If_Obj_t *)pNode->pCopy; }
189 {
190  ProgressBar * pProgress;
191  If_Man_t * pIfMan;
192  Vec_Ptr_t * vNodes;
193  Abc_Obj_t * pNode, * pPrev;
194  int i;
195 
196  assert( Abc_NtkIsStrash(pNtk) );
197 
198  // start the mapping manager and set its parameters
199  pIfMan = If_ManStart( pPars );
200  pIfMan->pName = Abc_UtilStrsav( Abc_NtkName(pNtk) );
201 
202  // print warning about excessive memory usage
203  if ( 1.0 * Abc_NtkObjNum(pNtk) * pIfMan->nObjBytes / (1<<30) > 1.0 )
204  printf( "Warning: The mapper will allocate %.1f GB for to represent the subject graph with %d AIG nodes.\n",
205  1.0 * Abc_NtkObjNum(pNtk) * pIfMan->nObjBytes / (1<<30), Abc_NtkObjNum(pNtk) );
206 
207  // create PIs and remember them in the old nodes
208  Abc_NtkCleanCopy( pNtk );
209  Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)If_ManConst1( pIfMan );
210  Abc_NtkForEachCi( pNtk, pNode, i )
211  {
212  pNode->pCopy = (Abc_Obj_t *)If_ManCreateCi( pIfMan );
213  // transfer logic level information
214  Abc_ObjIfCopy(pNode)->Level = pNode->Level;
215  }
216 
217  // load the AIG into the mapper
218  pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) );
219  vNodes = Abc_AigDfs( pNtk, 0, 0 );
220  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
221  {
222  Extra_ProgressBarUpdate( pProgress, i, "Initial" );
223  // add the node to the mapper
224  pNode->pCopy = (Abc_Obj_t *)If_ManCreateAnd( pIfMan,
227  // set up the choice node
228  if ( Abc_AigNodeIsChoice( pNode ) )
229  {
230  Abc_Obj_t * pEquiv;
231 // int Counter = 0;
233  for ( pPrev = pNode, pEquiv = Abc_ObjEquiv(pPrev); pEquiv; pPrev = pEquiv, pEquiv = Abc_ObjEquiv(pPrev) )
234  If_ObjSetChoice( Abc_ObjIfCopy(pPrev), Abc_ObjIfCopy(pEquiv) );//, Counter++;
235 // printf( "%d ", Counter );
236  If_ManCreateChoice( pIfMan, Abc_ObjIfCopy(pNode) );
237  }
238  }
239  Extra_ProgressBarStop( pProgress );
240  Vec_PtrFree( vNodes );
241 
242  // set the primary outputs without copying the phase
243  Abc_NtkForEachCo( pNtk, pNode, i )
244  pNode->pCopy = (Abc_Obj_t *)If_ManCreateCo( pIfMan, If_NotCond( Abc_ObjIfCopy(Abc_ObjFanin0(pNode)), Abc_ObjFaninC0(pNode) ) );
245  return pIfMan;
246 }
247 
248 
249 /**Function*************************************************************
250 
251  Synopsis [Box mapping procedures.]
252 
253  Description []
254 
255  SideEffects []
256 
257  SeeAlso []
258 
259 ***********************************************************************/
260 static inline void Abc_MapBoxSetPrevNext( Vec_Ptr_t * vDrivers, Vec_Int_t * vMapIn, Vec_Int_t * vMapOut, int Id )
261 {
262  Abc_Obj_t * pNode;
263  pNode = (Abc_Obj_t *)Vec_PtrEntry(vDrivers, Id+2);
264  Vec_IntWriteEntry( vMapIn, Abc_ObjId(Abc_ObjFanin0(pNode)), Id );
265  pNode = (Abc_Obj_t *)Vec_PtrEntry(vDrivers, Id+4);
266  Vec_IntWriteEntry( vMapOut, Abc_ObjId(Abc_ObjFanin0(pNode)), Id );
267 }
268 static inline int Abc_MapBox2Next( Vec_Ptr_t * vDrivers, Vec_Int_t * vMapIn, Vec_Int_t * vMapOut, int Id )
269 {
270  Abc_Obj_t * pNode = (Abc_Obj_t *)Vec_PtrEntry(vDrivers, Id+4);
271  return Vec_IntEntry( vMapIn, Abc_ObjId(Abc_ObjFanin0(pNode)) );
272 }
273 static inline int Abc_MapBox2Prev( Vec_Ptr_t * vDrivers, Vec_Int_t * vMapIn, Vec_Int_t * vMapOut, int Id )
274 {
275  Abc_Obj_t * pNode = (Abc_Obj_t *)Vec_PtrEntry(vDrivers, Id+2);
276  return Vec_IntEntry( vMapOut, Abc_ObjId(Abc_ObjFanin0(pNode)) );
277 }
278 
279 /**Function*************************************************************
280 
281  Synopsis [Creates the mapped network.]
282 
283  Description [Assuming the copy field of the mapped nodes are NULL.]
284 
285  SideEffects []
286 
287  SeeAlso []
288 
289 ***********************************************************************/
291 {
292  ProgressBar * pProgress;
293  Abc_Ntk_t * pNtkNew;
294  Abc_Obj_t * pNode, * pNodeNew;
295  Vec_Int_t * vCover;
296  int i, nDupGates;
297  // create the new network
298  if ( pIfMan->pPars->fUseBdds || pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv )
299  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_BDD );
300  else if ( pIfMan->pPars->fUseSops || pIfMan->pPars->nGateSize > 0 )
301  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
302  else
303  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_AIG );
304  // prepare the mapping manager
305  If_ManCleanNodeCopy( pIfMan );
306  If_ManCleanCutData( pIfMan );
307  // make the mapper point to the new network
309  Abc_NtkForEachCi( pNtk, pNode, i )
310  If_ObjSetCopy( If_ManCi(pIfMan, i), pNode->pCopy );
311 
312  // process the nodes in topological order
313  vCover = Vec_IntAlloc( 1 << 16 );
314  pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) );
315  Abc_NtkForEachCo( pNtk, pNode, i )
316  {
317  Extra_ProgressBarUpdate( pProgress, i, "Final" );
318  pNodeNew = Abc_NodeFromIf_rec( pNtkNew, pIfMan, If_ObjFanin0(If_ManCo(pIfMan, i)), vCover );
319  pNodeNew = Abc_ObjNotCond( pNodeNew, If_ObjFaninC0(If_ManCo(pIfMan, i)) );
320  Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
321  }
322  Extra_ProgressBarStop( pProgress );
323  Vec_IntFree( vCover );
324 
325  // remove the constant node if not used
326  pNodeNew = (Abc_Obj_t *)If_ObjCopy( If_ManConst1(pIfMan) );
327  if ( Abc_ObjFanoutNum(pNodeNew) == 0 && !Abc_ObjIsNone(pNodeNew) )
328  Abc_NtkDeleteObj( pNodeNew );
329  // minimize the node
330  if ( pIfMan->pPars->fUseBdds || pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv )
331  Abc_NtkSweep( pNtkNew, 0 );
332  if ( pIfMan->pPars->fUseBdds )
333  Abc_NtkBddReorder( pNtkNew, 0 );
334  // decouple the PO driver nodes to reduce the number of levels
335  nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !pIfMan->pPars->fUseBuffs );
336  if ( nDupGates && pIfMan->pPars->fVerbose && !Abc_FrameReadFlag("silentmode") )
337  {
338  if ( pIfMan->pPars->fUseBuffs )
339  printf( "Added %d buffers/inverters to decouple the CO drivers.\n", nDupGates );
340  else
341  printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
342  }
343  return pNtkNew;
344 }
345 
346 /**Function*************************************************************
347 
348  Synopsis [Rebuilds GIA from mini AIG.]
349 
350  Description []
351 
352  SideEffects []
353 
354  SeeAlso []
355 
356 ***********************************************************************/
357 Hop_Obj_t * Abc_NodeBuildFromMiniInt( Hop_Man_t * pMan, Vec_Int_t * vAig, int nLeaves )
358 {
359  assert( Vec_IntSize(vAig) > 0 );
360  assert( Vec_IntEntryLast(vAig) < 2 );
361  if ( Vec_IntSize(vAig) == 1 ) // const
362  {
363  assert( nLeaves == 0 );
364  return Hop_NotCond( Hop_ManConst0(pMan), Vec_IntEntry(vAig, 0) );
365  }
366  if ( Vec_IntSize(vAig) == 2 ) // variable
367  {
368  assert( Vec_IntEntry(vAig, 0) == 0 );
369  assert( nLeaves == 1 );
370  return Hop_NotCond( Hop_IthVar(pMan, 0), Vec_IntEntry(vAig, 1) );
371  }
372  else
373  {
374  int i, iVar0, iVar1, iLit0, iLit1;
375  Hop_Obj_t * piLit0, * piLit1, * piLit = NULL;
376  assert( Vec_IntSize(vAig) & 1 );
377  Vec_IntForEachEntryDouble( vAig, iLit0, iLit1, i )
378  {
379  iVar0 = Abc_Lit2Var( iLit0 );
380  iVar1 = Abc_Lit2Var( iLit1 );
381  piLit0 = Hop_NotCond( iVar0 < nLeaves ? Hop_IthVar(pMan, iVar0) : (Hop_Obj_t *)Vec_PtrEntry((Vec_Ptr_t *)vAig, iVar0 - nLeaves), Abc_LitIsCompl(iLit0) );
382  piLit1 = Hop_NotCond( iVar1 < nLeaves ? Hop_IthVar(pMan, iVar1) : (Hop_Obj_t *)Vec_PtrEntry((Vec_Ptr_t *)vAig, iVar1 - nLeaves), Abc_LitIsCompl(iLit1) );
383  piLit = Hop_And( pMan, piLit0, piLit1 );
384  assert( (i & 1) == 0 );
385  Vec_PtrWriteEntry( (Vec_Ptr_t *)vAig, Abc_Lit2Var(i), piLit ); // overwriting entries
386  }
387  assert( i == Vec_IntSize(vAig) - 1 );
388  piLit = Hop_NotCond( piLit, Vec_IntEntry(vAig, i) );
389  Vec_IntClear( vAig ); // useless
390  return piLit;
391  }
392 }
393 Hop_Obj_t * Abc_NodeBuildFromMini( Hop_Man_t * pMan, If_Man_t * p, If_Cut_t * pCut, int fUseDsd )
394 {
395  int Delay;
396  if ( fUseDsd )
397  Delay = If_CutDsdBalanceEval( p, pCut, p->vArray );
398  else
399  Delay = If_CutSopBalanceEval( p, pCut, p->vArray );
400  assert( Delay >= 0 );
401  return Abc_NodeBuildFromMiniInt( pMan, p->vArray, If_CutLeaveNum(pCut) );
402 }
403 
404 /**Function*************************************************************
405 
406  Synopsis [Derive one node after FPGA mapping.]
407 
408  Description []
409 
410  SideEffects []
411 
412  SeeAlso []
413 
414 ***********************************************************************/
415 Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t * pIfObj, Vec_Int_t * vCover )
416 {
417  Abc_Obj_t * pNodeNew;
418  If_Cut_t * pCutBest;
419  If_Obj_t * pIfLeaf;
420  int i;
421  // return if the result if known
422  pNodeNew = (Abc_Obj_t *)If_ObjCopy( pIfObj );
423  if ( pNodeNew )
424  return pNodeNew;
425  assert( pIfObj->Type == IF_AND );
426  // get the parameters of the best cut
427  // create a new node
428  pNodeNew = Abc_NtkCreateNode( pNtkNew );
429  pCutBest = If_ObjCutBest( pIfObj );
430 // printf( "%d 0x%02X %d\n", pCutBest->nLeaves, 0xff & *If_CutTruth(pCutBest), pIfMan->pPars->pFuncCost(pCutBest) );
431 // if ( pIfMan->pPars->pLutLib && pIfMan->pPars->pLutLib->fVarPinDelays )
432  if ( !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDelayOptLut && !pIfMan->pPars->fDsdBalance && !pIfMan->pPars->fUseTtPerm && !pIfMan->pPars->pLutStruct && !pIfMan->pPars->fUserRecLib && !pIfMan->pPars->nGateSize )
433  If_CutRotatePins( pIfMan, pCutBest );
434  if ( pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv )
435  {
436  If_CutForEachLeafReverse( pIfMan, pCutBest, pIfLeaf, i )
437  Abc_ObjAddFanin( pNodeNew, Abc_NodeFromIf_rec(pNtkNew, pIfMan, pIfLeaf, vCover) );
438  }
439  else
440  {
441  If_CutForEachLeaf( pIfMan, pCutBest, pIfLeaf, i )
442  Abc_ObjAddFanin( pNodeNew, Abc_NodeFromIf_rec(pNtkNew, pIfMan, pIfLeaf, vCover) );
443  }
444  // set the level of the new node
445  pNodeNew->Level = Abc_ObjLevelNew( pNodeNew );
446  // derive the function of this node
447  if ( pIfMan->pPars->fTruth )
448  {
449  if ( pIfMan->pPars->fUseBdds )
450  {
451  // transform truth table into the BDD
452  pNodeNew->pData = Kit_TruthToBdd( (DdManager *)pNtkNew->pManFunc, If_CutTruth(pIfMan, pCutBest), If_CutLeaveNum(pCutBest), 0 ); Cudd_Ref((DdNode *)pNodeNew->pData);
453  }
454  else if ( pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv )
455  {
456  // transform truth table into the BDD
457  pNodeNew->pData = Kit_TruthToBdd( (DdManager *)pNtkNew->pManFunc, If_CutTruth(pIfMan, pCutBest), If_CutLeaveNum(pCutBest), 1 ); Cudd_Ref((DdNode *)pNodeNew->pData);
458  }
459  else if ( pIfMan->pPars->fUseSops || pIfMan->pPars->nGateSize > 0 )
460  {
461  // transform truth table into the SOP
462  int RetValue = Kit_TruthIsop( If_CutTruth(pIfMan, pCutBest), If_CutLeaveNum(pCutBest), vCover, 1 );
463  assert( RetValue == 0 || RetValue == 1 );
464  // check the case of constant cover
465  if ( Vec_IntSize(vCover) == 0 || (Vec_IntSize(vCover) == 1 && Vec_IntEntry(vCover,0) == 0) )
466  {
467  assert( RetValue == 0 );
468  pNodeNew->pData = Abc_SopCreateAnd( (Mem_Flex_t *)pNtkNew->pManFunc, If_CutLeaveNum(pCutBest), NULL );
469  pNodeNew = (Vec_IntSize(vCover) == 0) ? Abc_NtkCreateNodeConst0(pNtkNew) : Abc_NtkCreateNodeConst1(pNtkNew);
470  }
471  else
472  {
473  // derive the AIG for that tree
474  pNodeNew->pData = Abc_SopCreateFromIsop( (Mem_Flex_t *)pNtkNew->pManFunc, If_CutLeaveNum(pCutBest), vCover );
475  if ( RetValue )
476  Abc_SopComplement( (char *)pNodeNew->pData );
477  }
478  }
479  else if ( pIfMan->pPars->fDelayOpt )
480  pNodeNew->pData = Abc_NodeBuildFromMini( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest, 0 );
481  else if ( pIfMan->pPars->fDsdBalance )
482  pNodeNew->pData = Abc_NodeBuildFromMini( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest, 1 );
483  else if ( pIfMan->pPars->fUserRecLib )
484  {
485  extern Hop_Obj_t * Abc_RecToHop3( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, If_Obj_t * pIfObj );
486  pNodeNew->pData = Abc_RecToHop3( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest, pIfObj );
487  }
488  else
489  {
490  extern Hop_Obj_t * Kit_TruthToHop( Hop_Man_t * pMan, unsigned * pTruth, int nVars, Vec_Int_t * vMemory );
491  word * pTruth = If_CutTruthW(pIfMan, pCutBest);
492  if ( pIfMan->pPars->fUseTtPerm )
493  for ( i = 0; i < (int)pCutBest->nLeaves; i++ )
494  if ( If_CutLeafBit(pCutBest, i) )
495  Abc_TtFlip( pTruth, Abc_TtWordNum(pCutBest->nLeaves), i );
496  pNodeNew->pData = Kit_TruthToHop( (Hop_Man_t *)pNtkNew->pManFunc, (unsigned *)pTruth, If_CutLeaveNum(pCutBest), vCover );
497 // if ( pIfMan->pPars->fUseBat )
498 // Bat_ManFuncPrintCell( *pTruth );
499  }
500  // complement the node if the cut was complemented
501  if ( pCutBest->fCompl && !pIfMan->pPars->fDelayOpt && !pIfMan->pPars->fDsdBalance )
502  Abc_NodeComplement( pNodeNew );
503  }
504  else
505  {
506  pNodeNew->pData = Abc_NodeIfToHop( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pIfObj );
507  }
508  If_ObjSetCopy( pIfObj, pNodeNew );
509  return pNodeNew;
510 }
511 
512 /**Function*************************************************************
513 
514  Synopsis [Recursively derives the truth table for the cut.]
515 
516  Description []
517 
518  SideEffects []
519 
520  SeeAlso []
521 
522 ***********************************************************************/
523 Hop_Obj_t * Abc_NodeIfToHop_rec( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_Obj_t * pIfObj, Vec_Ptr_t * vVisited )
524 {
525  If_Cut_t * pCut;
526  Hop_Obj_t * gFunc, * gFunc0, * gFunc1;
527  // get the best cut
528  pCut = If_ObjCutBest(pIfObj);
529  // if the cut is visited, return the result
530  if ( If_CutData(pCut) )
531  return (Hop_Obj_t *)If_CutData(pCut);
532  // compute the functions of the children
533  gFunc0 = Abc_NodeIfToHop_rec( pHopMan, pIfMan, pIfObj->pFanin0, vVisited );
534  gFunc1 = Abc_NodeIfToHop_rec( pHopMan, pIfMan, pIfObj->pFanin1, vVisited );
535  // get the function of the cut
536  gFunc = Hop_And( pHopMan, Hop_NotCond(gFunc0, pIfObj->fCompl0), Hop_NotCond(gFunc1, pIfObj->fCompl1) );
537  assert( If_CutData(pCut) == NULL );
538  If_CutSetData( pCut, gFunc );
539  // add this cut to the visited list
540  Vec_PtrPush( vVisited, pCut );
541  return gFunc;
542 }
543 
544 
545 /**Function*************************************************************
546 
547  Synopsis [Recursively derives the truth table for the cut.]
548 
549  Description []
550 
551  SideEffects []
552 
553  SeeAlso []
554 
555 ***********************************************************************/
556 Hop_Obj_t * Abc_NodeIfToHop2_rec( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_Obj_t * pIfObj, Vec_Ptr_t * vVisited )
557 {
558  If_Cut_t * pCut;
559  If_Obj_t * pTemp;
560  Hop_Obj_t * gFunc, * gFunc0, * gFunc1;
561  // get the best cut
562  pCut = If_ObjCutBest(pIfObj);
563  // if the cut is visited, return the result
564  if ( If_CutData(pCut) )
565  return (Hop_Obj_t *)If_CutData(pCut);
566  // mark the node as visited
567  Vec_PtrPush( vVisited, pCut );
568  // insert the worst case
569  If_CutSetData( pCut, (void *)1 );
570  // skip in case of primary input
571  if ( If_ObjIsCi(pIfObj) )
572  return (Hop_Obj_t *)If_CutData(pCut);
573  // compute the functions of the children
574  for ( pTemp = pIfObj; pTemp; pTemp = pTemp->pEquiv )
575  {
576  gFunc0 = Abc_NodeIfToHop2_rec( pHopMan, pIfMan, pTemp->pFanin0, vVisited );
577  if ( gFunc0 == (void *)1 )
578  continue;
579  gFunc1 = Abc_NodeIfToHop2_rec( pHopMan, pIfMan, pTemp->pFanin1, vVisited );
580  if ( gFunc1 == (void *)1 )
581  continue;
582  // both branches are solved
583  gFunc = Hop_And( pHopMan, Hop_NotCond(gFunc0, pTemp->fCompl0), Hop_NotCond(gFunc1, pTemp->fCompl1) );
584  if ( pTemp->fPhase != pIfObj->fPhase )
585  gFunc = Hop_Not(gFunc);
586  If_CutSetData( pCut, gFunc );
587  break;
588  }
589  return (Hop_Obj_t *)If_CutData(pCut);
590 }
591 
592 /**Function*************************************************************
593 
594  Synopsis [Derives the truth table for one cut.]
595 
596  Description []
597 
598  SideEffects []
599 
600  SeeAlso []
601 
602 ***********************************************************************/
603 Hop_Obj_t * Abc_NodeIfToHop( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_Obj_t * pIfObj )
604 {
605  If_Cut_t * pCut;
606  Hop_Obj_t * gFunc;
607  If_Obj_t * pLeaf;
608  int i;
609  // get the best cut
610  pCut = If_ObjCutBest(pIfObj);
611  assert( pCut->nLeaves > 1 );
612  // set the leaf variables
613  If_CutForEachLeaf( pIfMan, pCut, pLeaf, i )
614  If_CutSetData( If_ObjCutBest(pLeaf), Hop_IthVar(pHopMan, i) );
615  // recursively compute the function while collecting visited cuts
616  Vec_PtrClear( pIfMan->vTemp );
617  gFunc = Abc_NodeIfToHop2_rec( pHopMan, pIfMan, pIfObj, pIfMan->vTemp );
618  if ( gFunc == (void *)1 )
619  {
620  printf( "Abc_NodeIfToHop(): Computing local AIG has failed.\n" );
621  return NULL;
622  }
623  // clean the cuts
624  If_CutForEachLeaf( pIfMan, pCut, pLeaf, i )
625  If_CutSetData( If_ObjCutBest(pLeaf), NULL );
626  Vec_PtrForEachEntry( If_Cut_t *, pIfMan->vTemp, pCut, i )
627  If_CutSetData( pCut, NULL );
628  return gFunc;
629 }
630 
631 
632 /**Function*************************************************************
633 
634  Synopsis [Comparison for two nodes with the flow.]
635 
636  Description []
637 
638  SideEffects []
639 
640  SeeAlso []
641 
642 ***********************************************************************/
643 int Abc_ObjCompareFlow( Abc_Obj_t ** ppNode0, Abc_Obj_t ** ppNode1 )
644 {
645  float Flow0 = Abc_Int2Float((int)(ABC_PTRINT_T)(*ppNode0)->pCopy);
646  float Flow1 = Abc_Int2Float((int)(ABC_PTRINT_T)(*ppNode1)->pCopy);
647  if ( Flow0 > Flow1 )
648  return -1;
649  if ( Flow0 < Flow1 )
650  return 1;
651  return 0;
652 }
653 
654 /**Function*************************************************************
655 
656  Synopsis [Orders AIG nodes so that nodes from larger cones go first.]
657 
658  Description []
659 
660  SideEffects []
661 
662  SeeAlso []
663 
664 ***********************************************************************/
666 {
667  if ( !Abc_ObjIsNode(pNode) )
668  return;
669  assert( Abc_ObjIsNode( pNode ) );
670  // if this node is already visited, skip
671  if ( Abc_NodeIsTravIdCurrent( pNode ) )
672  return;
673  // mark the node as visited
674  Abc_NodeSetTravIdCurrent( pNode );
675  // visit the transitive fanin of the node
676  Abc_NtkFindGoodOrder_rec( Abc_ObjFanin0(pNode), vNodes );
677  Abc_NtkFindGoodOrder_rec( Abc_ObjFanin1(pNode), vNodes );
678  // add the node after the fanins have been added
679  Vec_PtrPush( vNodes, pNode );
680 }
681 
682 /**Function*************************************************************
683 
684  Synopsis [Orders AIG nodes so that nodes from larger cones go first.]
685 
686  Description []
687 
688  SideEffects []
689 
690  SeeAlso []
691 
692 ***********************************************************************/
694 {
695  Vec_Ptr_t * vNodes, * vCos;
696  Abc_Obj_t * pNode, * pFanin0, * pFanin1;
697  float Flow0, Flow1;
698  int i;
699 
700  // initialize the flow
701  Abc_AigConst1(pNtk)->pCopy = NULL;
702  Abc_NtkForEachCi( pNtk, pNode, i )
703  pNode->pCopy = NULL;
704  // compute the flow
705  Abc_AigForEachAnd( pNtk, pNode, i )
706  {
707  pFanin0 = Abc_ObjFanin0(pNode);
708  pFanin1 = Abc_ObjFanin1(pNode);
709  Flow0 = Abc_Int2Float((int)(ABC_PTRINT_T)pFanin0->pCopy)/Abc_ObjFanoutNum(pFanin0);
710  Flow1 = Abc_Int2Float((int)(ABC_PTRINT_T)pFanin1->pCopy)/Abc_ObjFanoutNum(pFanin1);
711  pNode->pCopy = (Abc_Obj_t *)(ABC_PTRINT_T)Abc_Float2Int(Flow0 + Flow1+(float)1.0);
712  }
713  // find the flow of the COs
714  vCos = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
715  Abc_NtkForEachCo( pNtk, pNode, i )
716  {
717  pNode->pCopy = Abc_ObjFanin0(pNode)->pCopy;
718 // pNode->pCopy = (Abc_Obj_t *)Abc_Float2Int((float)Abc_ObjFanin0(pNode)->Level);
719  Vec_PtrPush( vCos, pNode );
720  }
721 
722  // sort nodes in the increasing order of the flow
723  qsort( (Abc_Obj_t **)Vec_PtrArray(vCos), Abc_NtkCoNum(pNtk),
724  sizeof(Abc_Obj_t *), (int (*)(const void *, const void *))Abc_ObjCompareFlow );
725  // verify sorting
726  pFanin0 = (Abc_Obj_t *)Vec_PtrEntry(vCos, 0);
727  pFanin1 = (Abc_Obj_t *)Vec_PtrEntryLast(vCos);
728  assert( Abc_Int2Float((int)(ABC_PTRINT_T)pFanin0->pCopy) >= Abc_Int2Float((int)(ABC_PTRINT_T)pFanin1->pCopy) );
729 
730  // collect the nodes in the topological order from the new array
731  Abc_NtkIncrementTravId( pNtk );
732  vNodes = Vec_PtrAlloc( 100 );
733  Vec_PtrForEachEntry( Abc_Obj_t *, vCos, pNode, i )
734  Abc_NtkFindGoodOrder_rec( Abc_ObjFanin0(pNode), vNodes );
735  Vec_PtrFree( vCos );
736  return vNodes;
737 }
738 
739 
740 /**Function*************************************************************
741 
742  Synopsis [Sets PO drivers.]
743 
744  Description []
745 
746  SideEffects []
747 
748  SeeAlso []
749 
750 ***********************************************************************/
751 void Abc_NtkMarkMux( Abc_Obj_t * pDriver, Abc_Obj_t ** ppNode1, Abc_Obj_t ** ppNode2 )
752 {
753  Abc_Obj_t * pNodeC, * pNodeT, * pNodeE;
754  If_Obj_t * pIfObj;
755 
756  *ppNode1 = NULL;
757  *ppNode2 = NULL;
758  if ( pDriver == NULL )
759  return;
760  if ( !Abc_NodeIsMuxType(pDriver) )
761  return;
762 
763  pNodeC = Abc_NodeRecognizeMux( pDriver, &pNodeT, &pNodeE );
764 
765  pIfObj = If_Regular( (If_Obj_t *)Abc_ObjFanin0(pDriver)->pCopy );
766  if ( If_ObjIsAnd(pIfObj) )
767  pIfObj->fSkipCut = 1;
768  pIfObj = If_Regular( (If_Obj_t *)Abc_ObjFanin1(pDriver)->pCopy );
769  if ( If_ObjIsAnd(pIfObj) )
770  pIfObj->fSkipCut = 1;
771 
772  pIfObj = If_Regular( (If_Obj_t *)Abc_ObjRegular(pNodeC)->pCopy );
773  if ( If_ObjIsAnd(pIfObj) )
774  pIfObj->fSkipCut = 1;
775 
776 /*
777  pIfObj = If_Regular( (If_Obj_t *)Abc_ObjRegular(pNodeT)->pCopy );
778  if ( If_ObjIsAnd(pIfObj) )
779  pIfObj->fSkipCut = 1;
780  pIfObj = If_Regular( (If_Obj_t *)Abc_ObjRegular(pNodeE)->pCopy );
781  if ( If_ObjIsAnd(pIfObj) )
782  pIfObj->fSkipCut = 1;
783 */
784  *ppNode1 = Abc_ObjRegular(pNodeC);
785  *ppNode2 = Abc_ObjRegular(pNodeT);
786 }
787 
788 
789 ////////////////////////////////////////////////////////////////////////
790 /// END OF FILE ///
791 ////////////////////////////////////////////////////////////////////////
792 
793 
795 
If_Obj_t * pFanin0
Definition: if.h:321
void If_CutRotatePins(If_Man_t *p, If_Cut_t *pCut)
Definition: ifTruth.c:67
If_DsdMan_t * pIfDsdMan
Definition: if.h:243
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static int Gia_ManAppendAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: gia.h:592
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
static int Abc_MapBox2Prev(Vec_Ptr_t *vDrivers, Vec_Int_t *vMapIn, Vec_Int_t *vMapOut, int Id)
Definition: abcIf.c:273
unsigned nLeaves
Definition: if.h:289
static If_Obj_t * If_NotCond(If_Obj_t *p, int c)
Definition: if.h:357
static Vec_Ptr_t * Abc_NtkFindGoodOrder(Abc_Ntk_t *pNtk)
Definition: abcIf.c:693
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
int fUseMv
Definition: if.h:151
unsigned Type
Definition: if.h:305
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
void Abc_NtkMarkMux(Abc_Obj_t *pDriver, Abc_Obj_t **ppNode1, Abc_Obj_t **ppNode2)
Definition: abcIf.c:751
#define If_ManForEachNode(p, pObj, i)
Definition: if.h:468
int nLutSize
Definition: if.h:103
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Definition: cudd.h:278
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int If_ObjId(If_Obj_t *pObj)
Definition: if.h:379
int fUseCnfs
Definition: if.h:150
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static void * If_ObjCopy(If_Obj_t *pObj)
Definition: if.h:384
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:104
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Abc_Ntk_t * pExdc
Definition: abc.h:201
Definition: if.h:100
int Abc_ObjCompareFlow(Abc_Obj_t **ppNode0, Abc_Obj_t **ppNode1)
Definition: abcIf.c:643
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * vTemp
Definition: if.h:191
If_Man_t * If_ManStart(If_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: ifMan.c:50
Definition: if.h:303
static int If_ObjIsAnd(If_Obj_t *pObj)
Definition: if.h:377
Definition: if.h:275
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: if.h:474
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int If_CutLeaveNum(If_Cut_t *pCut)
Definition: if.h:390
int fDelayOptLut
Definition: if.h:122
int fVerbose
Definition: if.h:140
void Abc_NtkBidecResyn(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcBidec.c:110
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
#define If_CutForEachLeafReverse(p, pCut, pLeaf, i)
Definition: if.h:476
static void If_CutSetData(If_Cut_t *pCut, void *pData)
Definition: if.h:412
Hop_Obj_t * Abc_RecToHop3(Hop_Man_t *pMan, If_Man_t *pIfMan, If_Cut_t *pCut, If_Obj_t *pIfObj)
Definition: abcRec3.c:1031
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int If_ObjFaninC0(If_Obj_t *pObj)
Definition: if.h:382
Hop_Obj_t * Abc_NodeIfToHop_rec(Hop_Man_t *pHopMan, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Ptr_t *vVisited)
Definition: abcIf.c:523
ABC_DLL char * Abc_SopCreateAnd(Mem_Flex_t *pMan, int nVars, int *pfCompl)
Definition: abcSop.c:162
Hop_Obj_t * Abc_NodeBuildFromMiniInt(Hop_Man_t *pMan, Vec_Int_t *vAig, int nLeaves)
Definition: abcIf.c:357
static If_Obj_t * Abc_ObjIfCopy(Abc_Obj_t *pNode)
Definition: abcIf.c:187
DdNode * Kit_TruthToBdd(DdManager *dd, unsigned *pTruth, int nVars, int fMSBonTop)
Definition: kitBdd.c:182
ABC_DLL char * Abc_SopCreateFromIsop(Mem_Flex_t *pMan, int nVars, Vec_Int_t *vCover)
Definition: abcSop.c:416
char * pLutStruct
Definition: if.h:141
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
Abc_Ntk_t * Abc_NtkIf(Abc_Ntk_t *pNtk, If_Par_t *pPars)
Definition: abcIf.c:106
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
ABC_DLL float * Abc_NtkGetCoRequiredFloats(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:676
static If_Obj_t * If_ObjFanin0(If_Obj_t *pObj)
Definition: if.h:380
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int If_ObjIsCi(If_Obj_t *pObj)
Definition: if.h:373
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static abctime Abc_Clock()
Definition: abc_global.h:279
Vec_Int_t * vSwitching
Definition: if.h:208
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Definition: hop.h:65
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
void If_ManComputeSwitching(If_Man_t *pIfMan)
FUNCTION DEFINITIONS ///.
Definition: abcIf.c:58
Hop_Obj_t * Kit_TruthToHop(Hop_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Definition: kitHop.c:146
static int Abc_ObjIsNone(Abc_Obj_t *pObj)
Definition: abc.h:346
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
unsigned Level
Definition: abc.h:142
If_Obj_t * If_ManCreateCo(If_Man_t *p, If_Obj_t *pDriver)
Definition: ifMan.c:338
Definition: if.h:68
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
void If_DsdManAllocIsops(If_DsdMan_t *p, int nLutSize)
Definition: ifDsd.c:289
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
int nGateSize
Definition: if.h:107
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int If_ObjFaninC1(If_Obj_t *pObj)
Definition: if.h:383
static word * If_CutTruthW(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:421
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static Hop_Obj_t * Abc_NodeIfToHop(Hop_Man_t *pHopMan, If_Man_t *pIfMan, If_Obj_t *pIfObj)
Definition: abcIf.c:603
#define If_ManForEachCi(p, pObj, i)
Definition: if.h:445
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
char * pName
Definition: if.h:182
DECLARATIONS ///.
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
static int Abc_Float2Int(float Val)
Definition: abc_global.h:249
Abc_Obj_t * pCopy
Definition: abc.h:148
ABC_DLL void Abc_NtkDeleteObj(Abc_Obj_t *pObj)
Definition: abcObj.c:167
ABC_DLL int Abc_NodeIsMuxType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1301
int fDsdBalance
Definition: if.h:123
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_NAMESPACE_IMPL_START If_Man_t * Abc_NtkToIf(Abc_Ntk_t *pNtk, If_Par_t *pPars)
DECLARATIONS ///.
Definition: abcIf.c:188
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
static If_Obj_t * If_ManCo(If_Man_t *p, int i)
Definition: if.h:367
int fTruth
Definition: if.h:146
int fLatchPaths
Definition: if.h:117
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
FUNCTION DEFINITIONS ///.
Definition: kitIsop.c:55
static void Abc_MapBoxSetPrevNext(Vec_Ptr_t *vDrivers, Vec_Int_t *vMapIn, Vec_Int_t *vMapOut, int Id)
Definition: abcIf.c:260
Definition: if.h:180
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
static void If_ObjSetCopy(If_Obj_t *pObj, void *pCopy)
Definition: if.h:387
static If_Obj_t * If_ManConst1(If_Man_t *p)
Definition: if.h:365
unsigned fSkipCut
Definition: if.h:314
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
Vec_Int_t * vArray
Definition: if.h:215
float * pTimesArr
Definition: if.h:161
Abc_Obj_t * Abc_NodeFromIf_rec(Abc_Ntk_t *pNtkNew, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Int_t *vCover)
Definition: abcIf.c:415
int If_DsdManVarNum(If_DsdMan_t *p)
Definition: ifDsd.c:165
static unsigned * If_CutTruth(If_Man_t *p, If_Cut_t *pCut)
Definition: if.h:422
static If_Obj_t * If_ManCi(If_Man_t *p, int i)
Definition: if.h:366
static If_Obj_t * If_ObjFanin1(If_Obj_t *pObj)
Definition: if.h:381
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
ABC_DLL void * Abc_FrameReadManDsd()
Definition: mainFrame.c:62
If_Obj_t * pFanin1
Definition: if.h:322
int fBidec
Definition: if.h:125
float * pTimesReq
Definition: if.h:162
void Extra_ProgressBarStop(ProgressBar *p)
If_Obj_t * pEquiv
Definition: if.h:323
static void * If_CutData(If_Cut_t *pCut)
Definition: if.h:411
int If_CutSopBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
Definition: ifDelay.c:248
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition: vecInt.h:66
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Hop_Obj_t * Abc_NodeIfToHop2_rec(Hop_Man_t *pHopMan, If_Man_t *pIfMan, If_Obj_t *pIfObj, Vec_Ptr_t *vVisited)
Definition: abcIf.c:556
unsigned Level
Definition: if.h:315
void Abc_NtkFindGoodOrder_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vNodes)
Definition: abcIf.c:665
static void Abc_TtFlip(word *pTruth, int nWords, int iVar)
Definition: utilTruth.h:1130
int nObjBytes
Definition: if.h:228
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition: abcDfs.c:1014
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int If_ManObjNum(If_Man_t *p)
Definition: if.h:363
static int If_CutLeafBit(If_Cut_t *pCut, int i)
Definition: if.h:396
int fUseDsd
Definition: if.h:133
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Definition: abcUtil.c:1047
static int Vec_IntEntryLast(Vec_Int_t *p)
Definition: bblif.c:319
static void If_ObjSetChoice(If_Obj_t *pObj, If_Obj_t *pEqu)
Definition: if.h:388
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
static If_Obj_t * If_Regular(If_Obj_t *p)
Definition: if.h:355
static Abc_Obj_t * Abc_ObjEquiv(Abc_Obj_t *pObj)
Definition: abc.h:337
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
If_Par_t * pPars
Definition: if.h:184
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
int fUseBdds
Definition: if.h:148
ABC_DLL void Abc_SopComplement(char *pSop)
Definition: abcSop.c:600
static char * Abc_NtkName(Abc_Ntk_t *pNtk)
Definition: abc.h:270
ABC_DLL float * Abc_NtkGetCiArrivalFloats(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:658
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
#define If_ManForEachCo(p, pObj, i)
Definition: if.h:448
ABC_DLL int Abc_NtkSweep(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcSweep.c:574
static Hop_Obj_t * Hop_NotCond(Hop_Obj_t *p, int c)
Definition: hop.h:128
void If_ManCreateChoice(If_Man_t *p, If_Obj_t *pRepr)
Definition: ifMan.c:442
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
int If_DsdManLutSize(If_DsdMan_t *p)
Definition: ifDsd.c:173
Definition: gia.h:95
void If_ManCleanCutData(If_Man_t *p)
Definition: ifUtil.c:64
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
int fUserRecLib
Definition: if.h:124
int fPower
Definition: if.h:119
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
If_Obj_t * If_ManCreateCi(If_Man_t *p)
Definition: ifMan.c:316
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
int fDelayOpt
Definition: if.h:121
static float Abc_Int2Float(int Num)
Definition: abc_global.h:250
int fUseBuffs
Definition: if.h:127
int fUseTtPerm
Definition: if.h:137
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
static Abc_Ntk_t * Abc_NtkFromIf(If_Man_t *pIfMan, Abc_Ntk_t *pNtk)
Definition: abcIf.c:290
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
int fUseSops
Definition: if.h:149
If_Obj_t * If_ManCreateAnd(If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
Definition: ifMan.c:366
void If_ManCleanNodeCopy(If_Man_t *p)
DECLARATIONS ///.
Definition: ifUtil.c:45
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
ABC_DLL char * Abc_FrameReadFlag(char *pFlag)
Definition: mainFrame.c:64
static Hop_Obj_t * Hop_ManConst0(Hop_Man_t *p)
Definition: hop.h:131
int If_CutDsdBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
Definition: ifDsd.c:2288
unsigned fCompl
Definition: if.h:285
void * pData
Definition: abc.h:145
Hop_Obj_t * Abc_NodeBuildFromMini(Hop_Man_t *pMan, If_Man_t *p, If_Cut_t *pCut, int fUseDsd)
Definition: abcIf.c:393
void Cudd_Ref(DdNode *n)
Definition: cuddRef.c:129
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_MapBox2Next(Vec_Ptr_t *vDrivers, Vec_Int_t *vMapIn, Vec_Int_t *vMapOut, int Id)
Definition: abcIf.c:268
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Abc_NtkObjNum(Abc_Ntk_t *pNtk)
Definition: abc.h:283
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Definition: giaSwitch.c:658
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
ABC_DLL void Abc_NodeComplement(Abc_Obj_t *pNode)
Definition: abcObj.c:980
static void ** Vec_PtrArray(Vec_Ptr_t *p)
Definition: vecPtr.h:279
unsigned fCompl1
Definition: if.h:307
unsigned fCompl0
Definition: if.h:306
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205
unsigned fPhase
Definition: if.h:308
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
ABC_DLL Abc_Obj_t * Abc_NodeRecognizeMux(Abc_Obj_t *pNode, Abc_Obj_t **ppNodeT, Abc_Obj_t **ppNodeE)
Definition: abcUtil.c:1389
ABC_DLL int Abc_ObjLevelNew(Abc_Obj_t *pObj)
Definition: abcTiming.c:1058
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
void Abc_NtkBddReorder(Abc_Ntk_t *pNtk, int fVerbose)
Definition: abcReorder.c:77
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223