abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
base/abci/abcCut.c File Reference
#include "base/abc/abc.h"
#include "opt/cut/cut.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START void 
Abc_NtkPrintCuts (void *p, Abc_Ntk_t *pNtk, int fSeq)
 DECLARATIONS ///. More...
 
static void Abc_NtkPrintCuts_ (void *p, Abc_Ntk_t *pNtk, int fSeq)
 
static Vec_Int_tAbc_NtkGetNodeAttributes (Abc_Ntk_t *pNtk)
 
static int Abc_NtkComputeArea (Abc_Ntk_t *pNtk, Cut_Man_t *p)
 
void Abc_NtkCutsSubtractFanunt (Abc_Ntk_t *pNtk)
 FUNCTION DEFINITIONS ///. More...
 
void Abc_NtkCutsAddFanunt (Abc_Ntk_t *pNtk)
 
Cut_Man_tAbc_NtkCuts (Abc_Ntk_t *pNtk, Cut_Params_t *pParams)
 
void Abc_NtkCutsOracle (Abc_Ntk_t *pNtk, Cut_Oracle_t *p)
 
Cut_Man_tAbc_NtkSeqCuts (Abc_Ntk_t *pNtk, Cut_Params_t *pParams)
 
void * Abc_NodeGetCutsRecursive (void *p, Abc_Obj_t *pObj, int fDag, int fTree)
 
void * Abc_NodeGetCuts (void *p, Abc_Obj_t *pObj, int fDag, int fTree)
 
void Abc_NodeGetCutsSeq (void *p, Abc_Obj_t *pObj, int fTriv)
 
void * Abc_NodeReadCuts (void *p, Abc_Obj_t *pObj)
 
void Abc_NodeFreeCuts (void *p, Abc_Obj_t *pObj)
 
int Abc_NtkSubDagSize_rec (Abc_Obj_t *pObj, Vec_Int_t *vAttrs)
 
Vec_Int_tAbc_NtkGetNodeAttributes2 (Abc_Ntk_t *pNtk)
 

Variables

int nTotal
 DECLARATIONS ///. More...
 
int nGood
 
int nEqual
 

Function Documentation

void Abc_NodeFreeCuts ( void *  p,
Abc_Obj_t pObj 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 527 of file base/abci/abcCut.c.

528 {
529  Cut_NodeFreeCuts( (Cut_Man_t *)p, pObj->Id );
530 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Cut_NodeFreeCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:184
int Id
Definition: abc.h:132
void* Abc_NodeGetCuts ( void *  p,
Abc_Obj_t pObj,
int  fDag,
int  fTree 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 433 of file base/abci/abcCut.c.

434 {
435  Abc_Obj_t * pFanin;
436  int fDagNode, fTriv, TreeCode = 0;
437 // assert( Abc_NtkIsStrash(pObj->pNtk) );
438  assert( Abc_ObjFaninNum(pObj) == 2 );
439 
440  // check if the node is a DAG node
441  fDagNode = (Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj));
442  // increment the counter of DAG nodes
443  if ( fDagNode ) Cut_ManIncrementDagNodes( (Cut_Man_t *)p );
444  // add the trivial cut if the node is a DAG node, or if we compute all cuts
445  fTriv = fDagNode || !fDag;
446  // check if fanins are DAG nodes
447  if ( fTree )
448  {
449  pFanin = Abc_ObjFanin0(pObj);
450  TreeCode |= (Abc_ObjFanoutNum(pFanin) > 1 && !Abc_NodeIsMuxControlType(pFanin));
451  pFanin = Abc_ObjFanin1(pObj);
452  TreeCode |= ((Abc_ObjFanoutNum(pFanin) > 1 && !Abc_NodeIsMuxControlType(pFanin)) << 1);
453  }
454 
455  // changes due to the global/local cut computation
456  {
457  Cut_Params_t * pParams = Cut_ManReadParams((Cut_Man_t *)p);
458  if ( pParams->fLocal )
459  {
460  Vec_Int_t * vNodeAttrs = Cut_ManReadNodeAttrs((Cut_Man_t *)p);
461  fDagNode = Vec_IntEntry( vNodeAttrs, pObj->Id );
462  if ( fDagNode ) Cut_ManIncrementDagNodes( (Cut_Man_t *)p );
463 // fTriv = fDagNode || !pParams->fGlobal;
464  fTriv = !Vec_IntEntry( vNodeAttrs, pObj->Id );
465  TreeCode = 0;
466  pFanin = Abc_ObjFanin0(pObj);
467  TreeCode |= Vec_IntEntry( vNodeAttrs, pFanin->Id );
468  pFanin = Abc_ObjFanin1(pObj);
469  TreeCode |= (Vec_IntEntry( vNodeAttrs, pFanin->Id ) << 1);
470  }
471  }
472  return Cut_NodeComputeCuts( (Cut_Man_t *)p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
473  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj), fTriv, TreeCode );
474 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static Llb_Mgr_t * p
Definition: llb3Image.c:950
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
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
ABC_DLL int Abc_NodeIsMuxControlType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1357
void Cut_ManIncrementDagNodes(Cut_Man_t *p)
Definition: cutMan.c:309
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
Cut_Cut_t * Cut_NodeComputeCuts(Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int fTriv, int TreeCode)
Definition: cutNode.c:369
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
Cut_Params_t * Cut_ManReadParams(Cut_Man_t *p)
Definition: cutMan.c:277
Vec_Int_t * Cut_ManReadNodeAttrs(Cut_Man_t *p)
Definition: cutMan.c:293
void* Abc_NodeGetCutsRecursive ( void *  p,
Abc_Obj_t pObj,
int  fDag,
int  fTree 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 412 of file base/abci/abcCut.c.

413 {
414  void * pList;
415  if ( (pList = Abc_NodeReadCuts( p, pObj )) )
416  return pList;
417  Abc_NodeGetCutsRecursive( p, Abc_ObjFanin0(pObj), fDag, fTree );
418  Abc_NodeGetCutsRecursive( p, Abc_ObjFanin1(pObj), fDag, fTree );
419  return Abc_NodeGetCuts( p, pObj, fDag, fTree );
420 }
void * Abc_NodeGetCutsRecursive(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
void * Abc_NodeGetCuts(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
void * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
void Abc_NodeGetCutsSeq ( void *  p,
Abc_Obj_t pObj,
int  fTriv 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 487 of file base/abci/abcCut.c.

488 {
489 /*
490  int CutSetNum;
491  assert( Abc_NtkIsSeq(pObj->pNtk) );
492  assert( Abc_ObjFaninNum(pObj) == 2 );
493  fTriv = pObj->fMarkC ? 0 : fTriv;
494  CutSetNum = pObj->fMarkC ? (int)pObj->pCopy : -1;
495  Cut_NodeComputeCutsSeq( p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
496  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj), Seq_ObjFaninL0(pObj), Seq_ObjFaninL1(pObj), fTriv, CutSetNum );
497 */
498 }
void* Abc_NodeReadCuts ( void *  p,
Abc_Obj_t pObj 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file base/abci/abcCut.c.

512 {
513  return Cut_NodeReadCutsNew( (Cut_Man_t *)p, pObj->Id );
514 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Id
Definition: abc.h:132
Cut_Cut_t * Cut_NodeReadCutsNew(Cut_Man_t *p, int Node)
MACRO DEFINITIONS ///.
Definition: cutApi.c:45
int Abc_NtkComputeArea ( Abc_Ntk_t pNtk,
Cut_Man_t p 
)
static

Function*************************************************************

Synopsis [Computes area.]

Description []

SideEffects []

SeeAlso []

Definition at line 391 of file base/abci/abcCut.c.

392 {
393  Abc_Obj_t * pObj;
394  int Counter, i;
395  Counter = 0;
396  Abc_NtkForEachCo( pNtk, pObj, i )
397  Counter += Cut_ManMappingArea_rec( p, Abc_ObjFaninId0(pObj) );
398  return Counter;
399 }
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
int Cut_ManMappingArea_rec(Cut_Man_t *p, int Node)
Definition: cutNode.c:544
static int Counter
Cut_Man_t* Abc_NtkCuts ( Abc_Ntk_t pNtk,
Cut_Params_t pParams 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file base/abci/abcCut.c.

123 {
124  ProgressBar * pProgress;
125  Cut_Man_t * p;
126  Cut_Cut_t * pList;
127  Abc_Obj_t * pObj, * pNode;
128  Vec_Ptr_t * vNodes;
129  Vec_Int_t * vChoices;
130  int i;
131  abctime clk = Abc_Clock();
132 
133  extern void Abc_NtkBalanceAttach( Abc_Ntk_t * pNtk );
134  extern void Abc_NtkBalanceDetach( Abc_Ntk_t * pNtk );
135 
136  if ( pParams->fAdjust )
138 
139  nTotal = nGood = nEqual = 0;
140 
141  assert( Abc_NtkIsStrash(pNtk) );
142  // start the manager
143  pParams->nIdsMax = Abc_NtkObjNumMax( pNtk );
144  p = Cut_ManStart( pParams );
145  // compute node attributes if local or global cuts are requested
146  if ( pParams->fGlobal || pParams->fLocal )
147  {
148  extern Vec_Int_t * Abc_NtkGetNodeAttributes( Abc_Ntk_t * pNtk );
150  }
151  // prepare for cut dropping
152  if ( pParams->fDrop )
154  // set cuts for PIs
155  Abc_NtkForEachCi( pNtk, pObj, i )
156  if ( Abc_ObjFanoutNum(pObj) > 0 )
157  Cut_NodeSetTriv( p, pObj->Id );
158  // compute cuts for internal nodes
159  vNodes = Abc_AigDfs( pNtk, 0, 1 ); // collects POs
160  vChoices = Vec_IntAlloc( 100 );
161  pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(vNodes) );
162  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
163  {
164  // when we reached a CO, it is time to deallocate the cuts
165  if ( Abc_ObjIsCo(pObj) )
166  {
167  if ( pParams->fDrop )
169  continue;
170  }
171  // skip constant node, it has no cuts
172 // if ( Abc_NodeIsConst(pObj) )
173 // continue;
174  Extra_ProgressBarUpdate( pProgress, i, NULL );
175  // compute the cuts to the internal node
176  pList = (Cut_Cut_t *)Abc_NodeGetCuts( p, pObj, pParams->fDag, pParams->fTree );
177  if ( pParams->fNpnSave && pList )
178  {
179  extern void Npn_ManSaveOne( unsigned * puTruth, int nVars );
180  Cut_Cut_t * pCut;
181  for ( pCut = pList; pCut; pCut = pCut->pNext )
182  if ( pCut->nLeaves >= 4 )
183  Npn_ManSaveOne( Cut_CutReadTruth(pCut), pCut->nLeaves );
184  }
185  // consider dropping the fanins cuts
186  if ( pParams->fDrop )
187  {
190  }
191  // add cuts due to choices
192  if ( Abc_AigNodeIsChoice(pObj) )
193  {
194  Vec_IntClear( vChoices );
195  for ( pNode = pObj; pNode; pNode = (Abc_Obj_t *)pNode->pData )
196  Vec_IntPush( vChoices, pNode->Id );
197  Cut_NodeUnionCuts( p, vChoices );
198  }
199  }
200  Extra_ProgressBarStop( pProgress );
201  Vec_PtrFree( vNodes );
202  Vec_IntFree( vChoices );
203  Cut_ManPrintStats( p );
204 ABC_PRT( "TOTAL", Abc_Clock() - clk );
205 // printf( "Area = %d.\n", Abc_NtkComputeArea( pNtk, p ) );
206 //Abc_NtkPrintCuts( p, pNtk, 0 );
207 // Cut_ManPrintStatsToFile( p, pNtk->pSpec, Abc_Clock() - clk );
208 
209  // temporary printout of stats
210  if ( nTotal )
211  printf( "Total cuts = %d. Good cuts = %d. Ratio = %5.2f\n", nTotal, nGood, ((double)nGood)/nTotal );
212  if ( pParams->fAdjust )
213  Abc_NtkCutsAddFanunt( pNtk );
214  return p;
215 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
void Abc_NtkBalanceAttach(Abc_Ntk_t *pNtk)
Definition: abcBalance.c:506
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
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
int nEqual
Definition: cutTruth.c:39
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Cut_ManSetNodeAttrs(Cut_Man_t *p, Vec_Int_t *vFanCounts)
Definition: cutMan.c:245
static unsigned * Cut_CutReadTruth(Cut_Cut_t *p)
Definition: cut.h:94
void Npn_ManSaveOne(unsigned *puTruth, int nVars)
Definition: abcNpnSave.c:714
static Vec_Int_t * Abc_NtkGetNodeAttributes(Abc_Ntk_t *pNtk)
Cut_Cut_t * pNext
Definition: cut.h:88
void Abc_NtkCutsAddFanunt(Abc_Ntk_t *pNtk)
static abctime Abc_Clock()
Definition: abc_global.h:279
void Cut_NodeSetTriv(Cut_Man_t *p, int Node)
Definition: cutApi.c:145
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Cut_ManSetFanoutCounts(Cut_Man_t *p, Vec_Int_t *vFanCounts)
Definition: cutMan.c:229
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
unsigned nLeaves
Definition: cut.h:84
DECLARATIONS ///.
void * Abc_NodeGetCuts(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Cut_Cut_t * Cut_NodeUnionCuts(Cut_Man_t *p, Vec_Int_t *vNodes)
Definition: cutNode.c:678
void Cut_ManPrintStats(Cut_Man_t *p)
Definition: cutMan.c:155
void Cut_NodeTryDroppingCuts(Cut_Man_t *p, int Node)
Definition: cutApi.c:162
Cut_Man_t * Cut_ManStart(Cut_Params_t *pParams)
FUNCTION DEFINITIONS ///.
Definition: cutMan.c:47
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Abc_NtkCutsSubtractFanunt(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
void Extra_ProgressBarStop(ProgressBar *p)
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition: abcDfs.c:1014
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
int Id
Definition: abc.h:132
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int nGood
Definition: cutTruth.c:38
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
ABC_DLL Vec_Int_t * Abc_NtkFanoutCounts(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1701
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
void Abc_NtkBalanceDetach(Abc_Ntk_t *pNtk)
Definition: abcBalance.c:531
void * pData
Definition: abc.h:145
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
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 void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
ABC_INT64_T abctime
Definition: abc_global.h:278
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkCutsAddFanunt ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 89 of file base/abci/abcCut.c.

90 {
91  Abc_Obj_t * pObj, * pFan0, * pFan1, * pFanC;
92  int i, Counter = 0;
93  Abc_NtkForEachObj( pNtk, pObj, i )
94  {
95  if ( !Abc_NodeIsMuxType(pObj) )
96  continue;
97  pFanC = Abc_NodeRecognizeMux( pObj, &pFan1, &pFan0 );
98  pFanC = Abc_ObjRegular(pFanC);
99  pFan0 = Abc_ObjRegular(pFan0);
100  pFanC->vFanouts.nSize++;
101  Counter++;
102  if ( Abc_NodeIsExorType(pObj) )
103  {
104  pFan0->vFanouts.nSize++;
105  Counter++;
106  }
107  }
108  printf("Added %d fanouts\n", Counter );
109 }
ABC_DLL int Abc_NodeIsMuxType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1301
static int Counter
Vec_Int_t vFanouts
Definition: abc.h:144
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NodeIsExorType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1259
ABC_DLL Abc_Obj_t * Abc_NodeRecognizeMux(Abc_Obj_t *pNode, Abc_Obj_t **ppNodeT, Abc_Obj_t **ppNodeE)
Definition: abcUtil.c:1389
void Abc_NtkCutsOracle ( Abc_Ntk_t pNtk,
Cut_Oracle_t p 
)

Function*************************************************************

Synopsis [Cut computation using the oracle.]

Description []

SideEffects []

SeeAlso []

Definition at line 228 of file base/abci/abcCut.c.

229 {
230  Abc_Obj_t * pObj;
231  Vec_Ptr_t * vNodes;
232  int i; //, clk = Abc_Clock();
233  int fDrop = Cut_OracleReadDrop(p);
234 
235  assert( Abc_NtkIsStrash(pNtk) );
236 
237  // prepare cut droppping
238  if ( fDrop )
240 
241  // set cuts for PIs
242  Abc_NtkForEachCi( pNtk, pObj, i )
243  if ( Abc_ObjFanoutNum(pObj) > 0 )
244  Cut_OracleNodeSetTriv( p, pObj->Id );
245 
246  // compute cuts for internal nodes
247  vNodes = Abc_AigDfs( pNtk, 0, 1 ); // collects POs
248  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
249  {
250  // when we reached a CO, it is time to deallocate the cuts
251  if ( Abc_ObjIsCo(pObj) )
252  {
253  if ( fDrop )
255  continue;
256  }
257  // skip constant node, it has no cuts
258 // if ( Abc_NodeIsConst(pObj) )
259 // continue;
260  // compute the cuts to the internal node
261  Cut_OracleComputeCuts( p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
262  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj) );
263  // consider dropping the fanins cuts
264  if ( fDrop )
265  {
268  }
269  }
270  Vec_PtrFree( vNodes );
271 //ABC_PRT( "Total", Abc_Clock() - clk );
272 //Abc_NtkPrintCuts_( p, pNtk, 0 );
273 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
Cut_Cut_t * Cut_OracleComputeCuts(Cut_Oracle_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1)
Definition: cutOracle.c:320
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
int Cut_OracleReadDrop(Cut_Oracle_t *p)
Definition: cutOracle.c:176
static int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
void Cut_OracleTryDroppingCuts(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:407
if(last==0)
Definition: sparse_int.h:34
void Cut_OracleNodeSetTriv(Cut_Oracle_t *p, int Node)
Definition: cutOracle.c:192
ABC_DLL Vec_Ptr_t * Abc_AigDfs(Abc_Ntk_t *pNtk, int fCollectAll, int fCollectCos)
Definition: abcDfs.c:1014
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
void Cut_OracleSetFanoutCounts(Cut_Oracle_t *p, Vec_Int_t *vFanCounts)
Definition: cutOracle.c:160
ABC_DLL Vec_Int_t * Abc_NtkFanoutCounts(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1701
#define assert(ex)
Definition: util_old.h:213
static int Abc_ObjFaninId1(Abc_Obj_t *pObj)
Definition: abc.h:368
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkCutsSubtractFanunt ( Abc_Ntk_t pNtk)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 54 of file base/abci/abcCut.c.

55 {
56  Abc_Obj_t * pObj, * pFan0, * pFan1, * pFanC;
57  int i, Counter = 0;
58  Abc_NtkForEachObj( pNtk, pObj, i )
59  {
60  if ( !Abc_NodeIsMuxType(pObj) )
61  continue;
62  pFanC = Abc_NodeRecognizeMux( pObj, &pFan1, &pFan0 );
63  pFanC = Abc_ObjRegular(pFanC);
64  pFan0 = Abc_ObjRegular(pFan0);
65  assert( pFanC->vFanouts.nSize > 1 );
66  pFanC->vFanouts.nSize--;
67  Counter++;
68  if ( Abc_NodeIsExorType(pObj) )
69  {
70  assert( pFan0->vFanouts.nSize > 1 );
71  pFan0->vFanouts.nSize--;
72  Counter++;
73  }
74  }
75  printf("Substracted %d fanouts\n", Counter );
76 }
ABC_DLL int Abc_NodeIsMuxType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1301
static int Counter
Vec_Int_t vFanouts
Definition: abc.h:144
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define assert(ex)
Definition: util_old.h:213
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
ABC_DLL int Abc_NodeIsExorType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1259
ABC_DLL Abc_Obj_t * Abc_NodeRecognizeMux(Abc_Obj_t *pNode, Abc_Obj_t **ppNodeT, Abc_Obj_t **ppNodeE)
Definition: abcUtil.c:1389
Vec_Int_t * Abc_NtkGetNodeAttributes ( Abc_Ntk_t pNtk)
static

Function*************************************************************

Synopsis [Assigns global attributes randomly.]

Description [Old code.]

SideEffects []

SeeAlso []

Definition at line 589 of file base/abci/abcCut.c.

590 {
591  Vec_Int_t * vAttrs;
592 // Vec_Ptr_t * vNodes;
593  Abc_Obj_t * pObj;//, * pTemp;
594  int i;//, k;
595  int nNodesTotal = 0, nMffcsTotal = 0;
596  extern Vec_Ptr_t * Abc_NodeMffcInsideCollect( Abc_Obj_t * pNode );
597 
598  vAttrs = Vec_IntStart( Abc_NtkObjNumMax(pNtk) + 1 );
599 // Abc_NtkForEachCi( pNtk, pObj, i )
600 // Vec_IntWriteEntry( vAttrs, pObj->Id, 1 );
601 
602  Abc_NtkForEachObj( pNtk, pObj, i )
603  {
604  if ( Abc_ObjIsNode(pObj) )
605  nNodesTotal++;
606  if ( Abc_ObjIsCo(pObj) && Abc_ObjIsNode(Abc_ObjFanin0(pObj)) )
607  nMffcsTotal += Abc_NodeMffcSize( Abc_ObjFanin0(pObj) );
608 // if ( Abc_ObjIsNode(pObj) && (rand() % 4 == 0) )
609 // if ( Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj) && (rand() % 3 == 0) )
610  if ( Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj) )
611  {
612  int nMffc = Abc_NodeMffcSize(pObj);
613  nMffcsTotal += Abc_NodeMffcSize(pObj);
614 // printf( "%d ", nMffc );
615 
616  if ( nMffc > 2 || Abc_ObjFanoutNum(pObj) > 8 )
617  Vec_IntWriteEntry( vAttrs, pObj->Id, 1 );
618  }
619  }
620 /*
621  Abc_NtkForEachObj( pNtk, pObj, i )
622  {
623  if ( Vec_IntEntry( vAttrs, pObj->Id ) )
624  {
625  vNodes = Abc_NodeMffcInsideCollect( pObj );
626  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pTemp, k )
627  if ( pTemp != pObj )
628  Vec_IntWriteEntry( vAttrs, pTemp->Id, 0 );
629  Vec_PtrFree( vNodes );
630  }
631  }
632 */
633  printf( "Total nodes = %d. Total MFFC nodes = %d.\n", nNodesTotal, nMffcsTotal );
634  return vAttrs;
635 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_ObjIsCo(Abc_Obj_t *pObj)
Definition: abc.h:352
ABC_DLL int Abc_NodeIsMuxControlType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1357
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
ABC_DLL int Abc_NodeMffcSize(Abc_Obj_t *pNode)
FUNCTION DEFINITIONS ///.
Definition: abcRefs.c:48
Vec_Ptr_t * Abc_NodeMffcInsideCollect(Abc_Obj_t *pNode)
Definition: abcRefs.c:382
int Id
Definition: abc.h:132
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
Vec_Int_t* Abc_NtkGetNodeAttributes2 ( Abc_Ntk_t pNtk)

Function*************************************************************

Synopsis [Assigns global attributes randomly.]

Description [Old code.]

SideEffects []

SeeAlso []

Definition at line 673 of file base/abci/abcCut.c.

674 {
675  Vec_Int_t * vAttrs;
676  Abc_Obj_t * pObj;
677  int i, nSize;
678  assert( Abc_NtkIsDfsOrdered(pNtk) );
679  vAttrs = Vec_IntStart( Abc_NtkObjNumMax(pNtk) + 1 );
680  Abc_NtkForEachObj( pNtk, pObj, i )
681  {
682  // skip no-nodes and nodes without fanouts
683  if ( pObj->Id == 0 || !(Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj)) )
684  continue;
685  // the node has more than one fanout - count its sub-DAG size
686  Abc_NtkIncrementTravId( pNtk );
687  nSize = Abc_NtkSubDagSize_rec( pObj, vAttrs );
688  if ( nSize > 15 )
689  Vec_IntWriteEntry( vAttrs, pObj->Id, 1 );
690  }
691  return vAttrs;
692 }
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
ABC_DLL int Abc_NodeIsMuxControlType(Abc_Obj_t *pNode)
Definition: abcUtil.c:1357
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
int Id
Definition: abc.h:132
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
ABC_DLL int Abc_NtkIsDfsOrdered(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:667
#define assert(ex)
Definition: util_old.h:213
int Abc_NtkSubDagSize_rec(Abc_Obj_t *pObj, Vec_Int_t *vAttrs)
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
void Abc_NtkPrintCuts ( void *  p,
Abc_Ntk_t pNtk,
int  fSeq 
)
static

DECLARATIONS ///.

CFile****************************************************************

FileName [abcCut.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Interface to cut computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
abcCut.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 543 of file base/abci/abcCut.c.

544 {
545  Cut_Cut_t * pList;
546  Abc_Obj_t * pObj;
547  int i;
548  printf( "Cuts of the network:\n" );
549  Abc_NtkForEachObj( pNtk, pObj, i )
550  {
551  pList = (Cut_Cut_t *)Abc_NodeReadCuts( (Cut_Man_t *)p, pObj );
552  printf( "Node %s:\n", Abc_ObjName(pObj) );
553  Cut_CutPrintList( pList, fSeq );
554  }
555 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Cut_CutPrintList(Cut_Cut_t *pList, int fSeq)
Definition: cutCut.c:308
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
void * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
void Abc_NtkPrintCuts_ ( void *  p,
Abc_Ntk_t pNtk,
int  fSeq 
)
static

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 568 of file base/abci/abcCut.c.

569 {
570  Cut_Cut_t * pList;
571  Abc_Obj_t * pObj;
572  pObj = Abc_NtkObj( pNtk, 2 * Abc_NtkObjNum(pNtk) / 3 );
573  pList = (Cut_Cut_t *)Abc_NodeReadCuts( (Cut_Man_t *)p, pObj );
574  printf( "Node %s:\n", Abc_ObjName(pObj) );
575  Cut_CutPrintList( pList, fSeq );
576 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
void Cut_CutPrintList(Cut_Cut_t *pList, int fSeq)
Definition: cutCut.c:308
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
static int Abc_NtkObjNum(Abc_Ntk_t *pNtk)
Definition: abc.h:283
void * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
Cut_Man_t* Abc_NtkSeqCuts ( Abc_Ntk_t pNtk,
Cut_Params_t pParams 
)

Function*************************************************************

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 287 of file base/abci/abcCut.c.

288 {
289 /*
290  Cut_Man_t * p;
291  Abc_Obj_t * pObj, * pNode;
292  int i, nIters, fStatus;
293  Vec_Int_t * vChoices;
294  abctime clk = Abc_Clock();
295 
296  assert( Abc_NtkIsSeq(pNtk) );
297  assert( pParams->fSeq );
298 // assert( Abc_NtkIsDfsOrdered(pNtk) );
299 
300  // start the manager
301  pParams->nIdsMax = Abc_NtkObjNumMax( pNtk );
302  pParams->nCutSet = Abc_NtkCutSetNodeNum( pNtk );
303  p = Cut_ManStart( pParams );
304 
305  // set cuts for the constant node and the PIs
306  pObj = Abc_AigConst1(pNtk);
307  if ( Abc_ObjFanoutNum(pObj) > 0 )
308  Cut_NodeSetTriv( p, pObj->Id );
309  Abc_NtkForEachPi( pNtk, pObj, i )
310  {
311 //printf( "Setting trivial cut %d.\n", pObj->Id );
312  Cut_NodeSetTriv( p, pObj->Id );
313  }
314  // label the cutset nodes and set their number in the array
315  // assign the elementary cuts to the cutset nodes
316  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
317  {
318  assert( pObj->fMarkC == 0 );
319  pObj->fMarkC = 1;
320  pObj->pCopy = (Abc_Obj_t *)i;
321  Cut_NodeSetTriv( p, pObj->Id );
322 //printf( "Setting trivial cut %d.\n", pObj->Id );
323  }
324 
325  // process the nodes
326  vChoices = Vec_IntAlloc( 100 );
327  for ( nIters = 0; nIters < 10; nIters++ )
328  {
329 //printf( "ITERATION %d:\n", nIters );
330  // compute the cuts for the internal nodes
331  Abc_AigForEachAnd( pNtk, pObj, i )
332  {
333  Abc_NodeGetCutsSeq( p, pObj, nIters==0 );
334  // add cuts due to choices
335  if ( Abc_AigNodeIsChoice(pObj) )
336  {
337  Vec_IntClear( vChoices );
338  for ( pNode = pObj; pNode; pNode = pNode->pData )
339  Vec_IntPush( vChoices, pNode->Id );
340  Cut_NodeUnionCutsSeq( p, vChoices, (pObj->fMarkC ? (int)pObj->pCopy : -1), nIters==0 );
341  }
342  }
343  // merge the new cuts with the old cuts
344  Abc_NtkForEachPi( pNtk, pObj, i )
345  Cut_NodeNewMergeWithOld( p, pObj->Id );
346  Abc_AigForEachAnd( pNtk, pObj, i )
347  Cut_NodeNewMergeWithOld( p, pObj->Id );
348  // for the cutset, transfer temp cuts to new cuts
349  fStatus = 0;
350  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
351  fStatus |= Cut_NodeTempTransferToNew( p, pObj->Id, i );
352  if ( fStatus == 0 )
353  break;
354  }
355  Vec_IntFree( vChoices );
356 
357  // if the status is not finished, transfer new to old for the cutset
358  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
359  Cut_NodeNewMergeWithOld( p, pObj->Id );
360 
361  // transfer the old cuts to the new positions
362  Abc_NtkForEachObj( pNtk, pObj, i )
363  Cut_NodeOldTransferToNew( p, pObj->Id );
364 
365  // unlabel the cutset nodes
366  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
367  pObj->fMarkC = 0;
368 if ( pParams->fVerbose )
369 {
370  Cut_ManPrintStats( p );
371 ABC_PRT( "TOTAL ", Abc_Clock() - clk );
372 printf( "Converged after %d iterations.\n", nIters );
373 }
374 //Abc_NtkPrintCuts( p, pNtk, 1 );
375  return p;
376 */
377  return NULL;
378 }
int Abc_NtkSubDagSize_rec ( Abc_Obj_t pObj,
Vec_Int_t vAttrs 
)

Function*************************************************************

Synopsis [Assigns global attributes randomly.]

Description [Old code.]

SideEffects []

SeeAlso []

Definition at line 648 of file base/abci/abcCut.c.

649 {
650  if ( Abc_NodeIsTravIdCurrent(pObj) )
651  return 0;
653  if ( Vec_IntEntry( vAttrs, pObj->Id ) )
654  return 0;
655  if ( Abc_ObjIsCi(pObj) )
656  return 1;
657  assert( Abc_ObjFaninNum(pObj) == 2 );
658  return 1 + Abc_NtkSubDagSize_rec(Abc_ObjFanin0(pObj), vAttrs) +
659  Abc_NtkSubDagSize_rec(Abc_ObjFanin1(pObj), vAttrs);
660 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
int Abc_NtkSubDagSize_rec(Abc_Obj_t *pObj, Vec_Int_t *vAttrs)
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409

Variable Documentation

int nEqual

Definition at line 39 of file cutTruth.c.

int nGood

Definition at line 38 of file cutTruth.c.

int nTotal

DECLARATIONS ///.

CFile****************************************************************

FileName [cutTruth.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [K-feasible cut computation package.]

Synopsis [Incremental truth table computation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
cutTruth.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 37 of file cutTruth.c.