abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
opt/cut/abcCut.c File Reference
#include "base/abc/abc.h"
#include "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)
 
Vec_Int_tAbc_NtkGetNodeAttributes (Abc_Ntk_t *pNtk)
 
Cut_Man_tAbc_NtkCuts (Abc_Ntk_t *pNtk, Cut_Params_t *pParams)
 FUNCTION DEFINITIONS ///. More...
 
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)
 

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 439 of file opt/cut/abcCut.c.

440 {
441  Cut_NodeFreeCuts( p, pObj->Id );
442 }
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 345 of file opt/cut/abcCut.c.

346 {
347  Abc_Obj_t * pFanin;
348  int fDagNode, fTriv, TreeCode = 0;
349 // assert( Abc_NtkIsStrash(pObj->pNtk) );
350  assert( Abc_ObjFaninNum(pObj) == 2 );
351 
352 
353  // check if the node is a DAG node
354  fDagNode = (Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj));
355  // increment the counter of DAG nodes
356  if ( fDagNode ) Cut_ManIncrementDagNodes( p );
357  // add the trivial cut if the node is a DAG node, or if we compute all cuts
358  fTriv = fDagNode || !fDag;
359  // check if fanins are DAG nodes
360  if ( fTree )
361  {
362  pFanin = Abc_ObjFanin0(pObj);
363  TreeCode |= (Abc_ObjFanoutNum(pFanin) > 1 && !Abc_NodeIsMuxControlType(pFanin));
364  pFanin = Abc_ObjFanin1(pObj);
365  TreeCode |= ((Abc_ObjFanoutNum(pFanin) > 1 && !Abc_NodeIsMuxControlType(pFanin)) << 1);
366  }
367 
368 
369  // changes due to the global/local cut computation
370  {
371  Cut_Params_t * pParams = Cut_ManReadParams(p);
372  if ( pParams->fLocal )
373  {
374  Vec_Int_t * vNodeAttrs = Cut_ManReadNodeAttrs(p);
375  fDagNode = Vec_IntEntry( vNodeAttrs, pObj->Id );
376  if ( fDagNode ) Cut_ManIncrementDagNodes( p );
377 // fTriv = fDagNode || !pParams->fGlobal;
378  fTriv = !Vec_IntEntry( vNodeAttrs, pObj->Id );
379  TreeCode = 0;
380  pFanin = Abc_ObjFanin0(pObj);
381  TreeCode |= Vec_IntEntry( vNodeAttrs, pFanin->Id );
382  pFanin = Abc_ObjFanin1(pObj);
383  TreeCode |= (Vec_IntEntry( vNodeAttrs, pFanin->Id ) << 1);
384  }
385  }
386  return Cut_NodeComputeCuts( p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
387  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj), fTriv, TreeCode );
388 }
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 324 of file opt/cut/abcCut.c.

325 {
326  void * pList;
327  if ( pList = Abc_NodeReadCuts( p, pObj ) )
328  return pList;
329  Abc_NodeGetCutsRecursive( p, Abc_ObjFanin0(pObj), fDag, fTree );
330  Abc_NodeGetCutsRecursive( p, Abc_ObjFanin1(pObj), fDag, fTree );
331  return Abc_NodeGetCuts( p, pObj, fDag, fTree );
332 }
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_NodeGetCutsRecursive(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
void * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
void * Abc_NodeGetCuts(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
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 401 of file opt/cut/abcCut.c.

402 {
403  int CutSetNum;
404  assert( Abc_NtkIsSeq(pObj->pNtk) );
405  assert( Abc_ObjFaninNum(pObj) == 2 );
406  fTriv = pObj->fMarkC ? 0 : fTriv;
407  CutSetNum = pObj->fMarkC ? (int)pObj->pCopy : -1;
409  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj), Seq_ObjFaninL0(pObj), Seq_ObjFaninL1(pObj), fTriv, CutSetNum );
410 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
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 int Abc_ObjFaninId0(Abc_Obj_t *pObj)
Definition: abc.h:367
Abc_Obj_t * pCopy
Definition: abc.h:148
unsigned fMarkC
Definition: abc.h:136
void Cut_NodeComputeCutsSeq(Cut_Man_t *p, int Node, int Node0, int Node1, int fCompl0, int fCompl1, int nLat0, int nLat1, int fTriv, int CutSetNum)
Definition: cutSeq.c:72
Abc_Ntk_t * pNtk
Definition: abc.h:130
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
void* Abc_NodeReadCuts ( void *  p,
Abc_Obj_t pObj 
)

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 423 of file opt/cut/abcCut.c.

424 {
425  return Cut_NodeReadCutsNew( p, pObj->Id );
426 }
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
Cut_Man_t* Abc_NtkCuts ( Abc_Ntk_t pNtk,
Cut_Params_t pParams 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 72 of file opt/cut/abcCut.c.

73 {
74  ProgressBar * pProgress;
75  Cut_Man_t * p;
76  Abc_Obj_t * pObj, * pNode;
77  Vec_Ptr_t * vNodes;
78  Vec_Int_t * vChoices;
79  int i;
80  clock_t clk = clock();
81 
82  extern void Abc_NtkBalanceAttach( Abc_Ntk_t * pNtk );
83  extern void Abc_NtkBalanceDetach( Abc_Ntk_t * pNtk );
84 
85  nTotal = nGood = nEqual = 0;
86 
87  assert( Abc_NtkIsStrash(pNtk) );
88  // start the manager
89  pParams->nIdsMax = Abc_NtkObjNumMax( pNtk );
90  p = Cut_ManStart( pParams );
91  // compute node attributes if local or global cuts are requested
92  if ( pParams->fGlobal || pParams->fLocal )
93  {
94  extern Vec_Int_t * Abc_NtkGetNodeAttributes( Abc_Ntk_t * pNtk );
96  }
97  // prepare for cut dropping
98  if ( pParams->fDrop )
100  // set cuts for PIs
101  Abc_NtkForEachCi( pNtk, pObj, i )
102  if ( Abc_ObjFanoutNum(pObj) > 0 )
103  Cut_NodeSetTriv( p, pObj->Id );
104  // compute cuts for internal nodes
105  vNodes = Abc_AigDfs( pNtk, 0, 1 ); // collects POs
106  vChoices = Vec_IntAlloc( 100 );
107  pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(vNodes) );
108  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
109  {
110  // when we reached a CO, it is time to deallocate the cuts
111  if ( Abc_ObjIsCo(pObj) )
112  {
113  if ( pParams->fDrop )
115  continue;
116  }
117  // skip constant node, it has no cuts
118 // if ( Abc_NodeIsConst(pObj) )
119 // continue;
120  Extra_ProgressBarUpdate( pProgress, i, NULL );
121  // compute the cuts to the internal node
122  Abc_NodeGetCuts( p, pObj, pParams->fDag, pParams->fTree );
123  // consider dropping the fanins cuts
124  if ( pParams->fDrop )
125  {
128  }
129  // add cuts due to choices
130  if ( Abc_AigNodeIsChoice(pObj) )
131  {
132  Vec_IntClear( vChoices );
133  for ( pNode = pObj; pNode; pNode = pNode->pData )
134  Vec_IntPush( vChoices, pNode->Id );
135  Cut_NodeUnionCuts( p, vChoices );
136  }
137  }
138  Extra_ProgressBarStop( pProgress );
139  Vec_PtrFree( vNodes );
140  Vec_IntFree( vChoices );
141 PRT( "Total", clock() - clk );
142 //Abc_NtkPrintCuts( p, pNtk, 0 );
143 // Cut_ManPrintStatsToFile( p, pNtk->pSpec, clock() - clk );
144 
145  // temporary printout of stats
146  if ( nTotal )
147  printf( "Total cuts = %d. Good cuts = %d. Ratio = %5.2f\n", nTotal, nGood, ((double)nGood)/nTotal );
148  return p;
149 }
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
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
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
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
DECLARATIONS ///.
int nEqual
Definition: cutTruth.c:39
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_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
int nGood
Definition: cutTruth.c:38
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
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
void * Abc_NodeGetCuts(void *p, Abc_Obj_t *pObj, int fDag, int fTree)
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
Vec_Int_t * Abc_NtkGetNodeAttributes(Abc_Ntk_t *pNtk)
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkCutsOracle ( Abc_Ntk_t pNtk,
Cut_Oracle_t p 
)

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

Synopsis [Cut computation using the oracle.]

Description []

SideEffects []

SeeAlso []

Definition at line 162 of file opt/cut/abcCut.c.

163 {
164  Abc_Obj_t * pObj;
165  Vec_Ptr_t * vNodes;
166  int i;
167  clock_t clk = clock();
168  int fDrop = Cut_OracleReadDrop(p);
169 
170  assert( Abc_NtkIsStrash(pNtk) );
171 
172  // prepare cut droppping
173  if ( fDrop )
175 
176  // set cuts for PIs
177  Abc_NtkForEachCi( pNtk, pObj, i )
178  if ( Abc_ObjFanoutNum(pObj) > 0 )
179  Cut_OracleNodeSetTriv( p, pObj->Id );
180 
181  // compute cuts for internal nodes
182  vNodes = Abc_AigDfs( pNtk, 0, 1 ); // collects POs
183  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
184  {
185  // when we reached a CO, it is time to deallocate the cuts
186  if ( Abc_ObjIsCo(pObj) )
187  {
188  if ( fDrop )
190  continue;
191  }
192  // skip constant node, it has no cuts
193 // if ( Abc_NodeIsConst(pObj) )
194 // continue;
195  // compute the cuts to the internal node
196  Cut_OracleComputeCuts( p, pObj->Id, Abc_ObjFaninId0(pObj), Abc_ObjFaninId1(pObj),
197  Abc_ObjFaninC0(pObj), Abc_ObjFaninC1(pObj) );
198  // consider dropping the fanins cuts
199  if ( fDrop )
200  {
203  }
204  }
205  Vec_PtrFree( vNodes );
206 //PRT( "Total", clock() - clk );
207 //Abc_NtkPrintCuts_( p, pNtk, 0 );
208 }
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
Vec_Int_t* Abc_NtkGetNodeAttributes ( Abc_Ntk_t pNtk)

Definition at line 39 of file opt/cut/abcCut.c.

40 {
41  Vec_Int_t * vAttrs = Vec_IntStart( Abc_NtkObjNumMax(pNtk) + 1 );
42  int i;
43  Abc_Obj_t * pObj;
44 
45 // Abc_NtkForEachCi( pNtk, pObj, i )
46 // Vec_IntWriteEntry( vAttrs, pObj->Id, 1 );
47 
48  Abc_NtkForEachObj( pNtk, pObj, i )
49  {
50 // if ( Abc_ObjIsNode(pObj) && (rand() % 4 == 0) )
51  if ( Abc_ObjIsNode(pObj) && Abc_ObjFanoutNum(pObj) > 1 && !Abc_NodeIsMuxControlType(pObj) && (rand() % 3 == 0) )
52  Vec_IntWriteEntry( vAttrs, pObj->Id, 1 );
53  }
54  return vAttrs;
55 }
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
#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 455 of file opt/cut/abcCut.c.

456 {
457  Cut_Man_t * pMan = p;
458  Cut_Cut_t * pList;
459  Abc_Obj_t * pObj;
460  int i;
461  printf( "Cuts of the network:\n" );
462  Abc_NtkForEachObj( pNtk, pObj, i )
463  {
464  pList = Abc_NodeReadCuts( p, pObj );
465  printf( "Node %s:\n", Abc_ObjName(pObj) );
466  Cut_CutPrintList( pList, fSeq );
467  }
468 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
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_NtkPrintCuts_ ( void *  p,
Abc_Ntk_t pNtk,
int  fSeq 
)
static

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

Synopsis [Computes the cuts for the network.]

Description []

SideEffects []

SeeAlso []

Definition at line 481 of file opt/cut/abcCut.c.

482 {
483  Cut_Man_t * pMan = p;
484  Cut_Cut_t * pList;
485  Abc_Obj_t * pObj;
486  pObj = Abc_NtkObj( pNtk, 2 * Abc_NtkObjNum(pNtk) / 3 );
487  pList = Abc_NodeReadCuts( p, pObj );
488  printf( "Node %s:\n", Abc_ObjName(pObj) );
489  Cut_CutPrintList( pList, fSeq );
490 }
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 * Abc_NodeReadCuts(void *p, Abc_Obj_t *pObj)
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
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 222 of file opt/cut/abcCut.c.

223 {
224 /*
225  Cut_Man_t * p;
226  Abc_Obj_t * pObj, * pNode;
227  int i, nIters, fStatus;
228  Vec_Int_t * vChoices;
229  clock_t clk = clock();
230 
231  assert( Abc_NtkIsSeq(pNtk) );
232  assert( pParams->fSeq );
233 // assert( Abc_NtkIsDfsOrdered(pNtk) );
234 
235  // start the manager
236  pParams->nIdsMax = Abc_NtkObjNumMax( pNtk );
237  pParams->nCutSet = Abc_NtkCutSetNodeNum( pNtk );
238  p = Cut_ManStart( pParams );
239 
240  // set cuts for the constant node and the PIs
241  pObj = Abc_AigConst1(pNtk);
242  if ( Abc_ObjFanoutNum(pObj) > 0 )
243  Cut_NodeSetTriv( p, pObj->Id );
244  Abc_NtkForEachPi( pNtk, pObj, i )
245  {
246 //printf( "Setting trivial cut %d.\n", pObj->Id );
247  Cut_NodeSetTriv( p, pObj->Id );
248  }
249  // label the cutset nodes and set their number in the array
250  // assign the elementary cuts to the cutset nodes
251  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
252  {
253  assert( pObj->fMarkC == 0 );
254  pObj->fMarkC = 1;
255  pObj->pCopy = (Abc_Obj_t *)i;
256  Cut_NodeSetTriv( p, pObj->Id );
257 //printf( "Setting trivial cut %d.\n", pObj->Id );
258  }
259 
260  // process the nodes
261  vChoices = Vec_IntAlloc( 100 );
262  for ( nIters = 0; nIters < 10; nIters++ )
263  {
264 //printf( "ITERATION %d:\n", nIters );
265  // compute the cuts for the internal nodes
266  Abc_AigForEachAnd( pNtk, pObj, i )
267  {
268  Abc_NodeGetCutsSeq( p, pObj, nIters==0 );
269  // add cuts due to choices
270  if ( Abc_AigNodeIsChoice(pObj) )
271  {
272  Vec_IntClear( vChoices );
273  for ( pNode = pObj; pNode; pNode = pNode->pData )
274  Vec_IntPush( vChoices, pNode->Id );
275  Cut_NodeUnionCutsSeq( p, vChoices, (pObj->fMarkC ? (int)pObj->pCopy : -1), nIters==0 );
276  }
277  }
278  // merge the new cuts with the old cuts
279  Abc_NtkForEachPi( pNtk, pObj, i )
280  Cut_NodeNewMergeWithOld( p, pObj->Id );
281  Abc_AigForEachAnd( pNtk, pObj, i )
282  Cut_NodeNewMergeWithOld( p, pObj->Id );
283  // for the cutset, transfer temp cuts to new cuts
284  fStatus = 0;
285  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
286  fStatus |= Cut_NodeTempTransferToNew( p, pObj->Id, i );
287  if ( fStatus == 0 )
288  break;
289  }
290  Vec_IntFree( vChoices );
291 
292  // if the status is not finished, transfer new to old for the cutset
293  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
294  Cut_NodeNewMergeWithOld( p, pObj->Id );
295 
296  // transfer the old cuts to the new positions
297  Abc_NtkForEachObj( pNtk, pObj, i )
298  Cut_NodeOldTransferToNew( p, pObj->Id );
299 
300  // unlabel the cutset nodes
301  Abc_SeqForEachCutsetNode( pNtk, pObj, i )
302  pObj->fMarkC = 0;
303 if ( pParams->fVerbose )
304 {
305 PRT( "Total", clock() - clk );
306 printf( "Converged after %d iterations.\n", nIters );
307 }
308 //Abc_NtkPrintCuts( p, pNtk, 1 );
309  return p;
310 */
311 }

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.