abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaHcd.c File Reference
#include "gia.h"
#include "giaAig.h"
#include "aig/aig/aig.h"
#include "opt/dar/dar.h"

Go to the source code of this file.

Data Structures

struct  Hcd_Pars_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Hcd_Pars_t_ 
Hcd_Pars_t
 DECLARATIONS ///. More...
 

Functions

void Gia_ComputeEquivalences (Gia_Man_t *pMiter, int nBTLimit, int fUseMiniSat, int fVerbose)
 
void Hcd_ManSetDefaultParams (Hcd_Pars_t *p)
 FUNCTION DEFINITIONS ///. More...
 
Aig_Man_tHcd_Compress (Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose)
 
Aig_Man_tHcd_Compress2 (Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
 
Vec_Ptr_tHcd_ChoiceSynthesis (Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose)
 
int Hcd_ManChoiceMiter_rec (Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
 
Gia_Man_tHcd_ManChoiceMiter (Vec_Ptr_t *vGias)
 
int Hcd_ObjCheckTfi_rec (Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode, Vec_Ptr_t *vVisited)
 
int Hcd_ObjCheckTfi (Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
 
void Hcd_ManAddNextEntry_rec (Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
 
void Hcd_ManEquivToChoices_rec (Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
 
void Hcd_ManRemoveBadChoices (Gia_Man_t *p)
 
Gia_Man_tHcd_ManEquivToChoices (Gia_Man_t *p, int nSnapshots)
 
Aig_Man_tHcd_ComputeChoices (Aig_Man_t *pAig, int nBTLimit, int fSynthesis, int fUseMiniSat, int fVerbose)
 
void Hcd_ComputeChoicesTest (Gia_Man_t *pGia, int nBTLimit, int fSynthesis, int fUseMiniSat, int fVerbose)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Hcd_Pars_t_ Hcd_Pars_t

DECLARATIONS ///.

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

FileName [giaHcd.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [New choice computation package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 34 of file giaHcd.c.

Function Documentation

void Gia_ComputeEquivalences ( Gia_Man_t pGia,
int  nBTLimit,
int  fUseMiniSat,
int  fVerbose 
)

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

Synopsis [Performs computation of AIGs with choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 1030 of file giaGiarf.c.

1031 {
1032  Hcd_Man_t * p;
1033  Vec_Ptr_t * vRoots;
1034  Gia_Man_t * pGiaLev;
1035  int i, Lev, nLevels, nIters;
1036  clock_t clk;
1037  Gia_ManRandom( 1 );
1038  Gia_ManSetPhase( pGia );
1039  nLevels = Gia_ManLevelNum( pGia );
1040  Gia_ManIncrementTravId( pGia );
1041  // start the manager
1042  p = Gia_ManEquivStart( pGia, nBTLimit, fVerbose );
1043  // create trivial classes
1044  Hcd_ManClassesCreate( p );
1045  // refine
1046  for ( i = 0; i < 3; i++ )
1047  {
1048  clk = clock();
1049  Hcd_ManSimulationInit( p );
1050  Hcd_ManSimulateSimple( p );
1051  ABC_PRT( "Sim", clock() - clk );
1052  clk = clock();
1053  Hcd_ManClassesRefine( p );
1054  ABC_PRT( "Ref", clock() - clk );
1055  }
1056  // process in the levelized order
1057  for ( Lev = 1; Lev < nLevels; Lev++ )
1058  {
1059  clk = clock();
1060  printf( "LEVEL %3d (out of %3d) ", Lev, nLevels );
1061  pGiaLev = Gia_GenerateReducedLevel( pGia, Lev, &vRoots );
1062  nIters = Gia_ComputeEquivalencesLevel( p, pGiaLev, vRoots, Lev, fUseMiniSat );
1063  Gia_ManStop( pGiaLev );
1064  Vec_PtrFree( vRoots );
1065  printf( "Iters = %3d " );
1066  ABC_PRT( "Time", clock() - clk );
1067  }
1068  Gia_GiarfPrintClasses( pGia );
1069  // clean up
1070  Gia_ManEquivStop( p );
1071 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_NAMESPACE_IMPL_END ABC_NAMESPACE_IMPL_START int Gia_ComputeEquivalencesLevel(Hcd_Man_t *p, Gia_Man_t *pGiaLev, Vec_Ptr_t *vOldRoots, int Level, int fUseMiniSat)
Definition: giaGiarf.c:757
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Gia_Man_t * Gia_GenerateReducedLevel(Gia_Man_t *p, int Level, Vec_Ptr_t **pvRoots)
Definition: giaGiarf.c:532
unsigned Gia_ManRandom(int fReset)
FUNCTION DEFINITIONS ///.
Definition: giaUtil.c:49
void Hcd_ManClassesCreate(Hcd_Man_t *p)
Definition: giaGiarf.c:374
void Hcd_ManClassesRefine(Hcd_Man_t *p)
Definition: giaGiarf.c:343
void Gia_ManEquivStop(Hcd_Man_t *p)
Definition: giaGiarf.c:100
void Hcd_ManSimulationInit(Hcd_Man_t *p)
Definition: giaGiarf.c:396
typedefABC_NAMESPACE_IMPL_START struct Hcd_Man_t_ Hcd_Man_t
DECLARATIONS ///.
Definition: giaGiarf.c:30
Definition: gia.h:95
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Gia_GiarfPrintClasses(Gia_Man_t *pGia)
Definition: giaGiarf.c:721
Hcd_Man_t * Gia_ManEquivStart(Gia_Man_t *pGia, int nBTLimit, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: giaGiarf.c:67
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
int Gia_ManLevelNum(Gia_Man_t *p)
Definition: giaUtil.c:505
void Gia_ManIncrementTravId(Gia_Man_t *p)
Definition: giaUtil.c:149
void Hcd_ManSimulateSimple(Hcd_Man_t *p)
Definition: giaGiarf.c:415
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
Vec_Ptr_t* Hcd_ChoiceSynthesis ( Aig_Man_t pAig,
int  fBalance,
int  fUpdateLevel,
int  fPower,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress2".]

Description []

SideEffects []

SeeAlso []

Definition at line 259 of file giaHcd.c.

262 {
263  Vec_Ptr_t * vGias;
264  Gia_Man_t * pGia;
265 
266  vGias = Vec_PtrAlloc( 3 );
267  pGia = Gia_ManFromAig(pAig);
268  Vec_PtrPush( vGias, pGia );
269 
270  pAig = Hcd_Compress( pAig, fBalance, fUpdateLevel, fPower, fVerbose );
271  pGia = Gia_ManFromAig(pAig);
272  Vec_PtrPush( vGias, pGia );
273 //Aig_ManPrintStats( pAig );
274 
275  pAig = Hcd_Compress2( pAig, fBalance, fUpdateLevel, 1, fPower, fVerbose );
276  pGia = Gia_ManFromAig(pAig);
277  Vec_PtrPush( vGias, pGia );
278 //Aig_ManPrintStats( pAig );
279 
280  Aig_ManStop( pAig );
281  return vGias;
282 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition: giaAig.c:73
Aig_Man_t * Hcd_Compress(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose)
Definition: giaHcd.c:96
Aig_Man_t * Hcd_Compress2(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose)
Definition: giaHcd.c:161
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Definition: gia.h:95
Aig_Man_t* Hcd_Compress ( Aig_Man_t pAig,
int  fBalance,
int  fUpdateLevel,
int  fPower,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress".]

Description []

SideEffects []

SeeAlso []

Definition at line 96 of file giaHcd.c.

98 {
99  Aig_Man_t * pTemp;
100 
101  Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
102  Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
103 
104  Dar_ManDefaultRwrParams( pParsRwr );
105  Dar_ManDefaultRefParams( pParsRef );
106 
107  pParsRwr->fUpdateLevel = fUpdateLevel;
108  pParsRef->fUpdateLevel = fUpdateLevel;
109 
110  pParsRwr->fPower = fPower;
111 
112  pParsRwr->fVerbose = 0;//fVerbose;
113  pParsRef->fVerbose = 0;//fVerbose;
114 
115 // pAig = Aig_ManDupDfs( pAig );
116  if ( fVerbose ) Aig_ManPrintStats( pAig );
117 
118  // rewrite
119  Dar_ManRewrite( pAig, pParsRwr );
120  pAig = Aig_ManDupDfs( pTemp = pAig );
121  Aig_ManStop( pTemp );
122  if ( fVerbose ) Aig_ManPrintStats( pAig );
123 
124  // refactor
125  Dar_ManRefactor( pAig, pParsRef );
126  pAig = Aig_ManDupDfs( pTemp = pAig );
127  Aig_ManStop( pTemp );
128  if ( fVerbose ) Aig_ManPrintStats( pAig );
129 
130  // balance
131  if ( fBalance )
132  {
133  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
134  Aig_ManStop( pTemp );
135  if ( fVerbose ) Aig_ManPrintStats( pAig );
136  }
137 
138  pParsRwr->fUseZeros = 1;
139  pParsRef->fUseZeros = 1;
140 
141  // rewrite
142  Dar_ManRewrite( pAig, pParsRwr );
143  pAig = Aig_ManDupDfs( pTemp = pAig );
144  Aig_ManStop( pTemp );
145  if ( fVerbose ) Aig_ManPrintStats( pAig );
146 
147  return pAig;
148 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int fUpdateLevel
Definition: dar.h:64
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
Definition: darCore.c:78
int fVerbose
Definition: dar.h:66
int Dar_ManRefactor(Aig_Man_t *pAig, Dar_RefPar_t *pPars)
Definition: darRefact.c:496
void Dar_ManDefaultRefParams(Dar_RefPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darRefact.c:85
int fUseZeros
Definition: dar.h:65
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51
Aig_Man_t* Hcd_Compress2 ( Aig_Man_t pAig,
int  fBalance,
int  fUpdateLevel,
int  fFanout,
int  fPower,
int  fVerbose 
)

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

Synopsis [Reproduces script "compress2".]

Description []

SideEffects []

SeeAlso []

Definition at line 161 of file giaHcd.c.

163 {
164  Aig_Man_t * pTemp;
165 
166  Dar_RwrPar_t ParsRwr, * pParsRwr = &ParsRwr;
167  Dar_RefPar_t ParsRef, * pParsRef = &ParsRef;
168 
169  Dar_ManDefaultRwrParams( pParsRwr );
170  Dar_ManDefaultRefParams( pParsRef );
171 
172  pParsRwr->fUpdateLevel = fUpdateLevel;
173  pParsRef->fUpdateLevel = fUpdateLevel;
174  pParsRwr->fFanout = fFanout;
175  pParsRwr->fPower = fPower;
176 
177  pParsRwr->fVerbose = 0;//fVerbose;
178  pParsRef->fVerbose = 0;//fVerbose;
179 
180 // pAig = Aig_ManDupDfs( pAig );
181  if ( fVerbose ) Aig_ManPrintStats( pAig );
182 
183  // rewrite
184  Dar_ManRewrite( pAig, pParsRwr );
185  pAig = Aig_ManDupDfs( pTemp = pAig );
186  Aig_ManStop( pTemp );
187  if ( fVerbose ) Aig_ManPrintStats( pAig );
188 
189  // refactor
190  Dar_ManRefactor( pAig, pParsRef );
191  pAig = Aig_ManDupDfs( pTemp = pAig );
192  Aig_ManStop( pTemp );
193  if ( fVerbose ) Aig_ManPrintStats( pAig );
194 
195  // balance
196 // if ( fBalance )
197  {
198  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
199  Aig_ManStop( pTemp );
200  if ( fVerbose ) Aig_ManPrintStats( pAig );
201  }
202 
203  // rewrite
204  Dar_ManRewrite( pAig, pParsRwr );
205  pAig = Aig_ManDupDfs( pTemp = pAig );
206  Aig_ManStop( pTemp );
207  if ( fVerbose ) Aig_ManPrintStats( pAig );
208 
209  pParsRwr->fUseZeros = 1;
210  pParsRef->fUseZeros = 1;
211 
212  // rewrite
213  Dar_ManRewrite( pAig, pParsRwr );
214  pAig = Aig_ManDupDfs( pTemp = pAig );
215  Aig_ManStop( pTemp );
216  if ( fVerbose ) Aig_ManPrintStats( pAig );
217 
218  // balance
219  if ( fBalance )
220  {
221  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
222  Aig_ManStop( pTemp );
223  if ( fVerbose ) Aig_ManPrintStats( pAig );
224  }
225 
226  // refactor
227  Dar_ManRefactor( pAig, pParsRef );
228  pAig = Aig_ManDupDfs( pTemp = pAig );
229  Aig_ManStop( pTemp );
230  if ( fVerbose ) Aig_ManPrintStats( pAig );
231 
232  // rewrite
233  Dar_ManRewrite( pAig, pParsRwr );
234  pAig = Aig_ManDupDfs( pTemp = pAig );
235  Aig_ManStop( pTemp );
236  if ( fVerbose ) Aig_ManPrintStats( pAig );
237 
238  // balance
239  if ( fBalance )
240  {
241  pAig = Dar_ManBalance( pTemp = pAig, fUpdateLevel );
242  Aig_ManStop( pTemp );
243  if ( fVerbose ) Aig_ManPrintStats( pAig );
244  }
245  return pAig;
246 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
int fUpdateLevel
Definition: dar.h:64
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
void Aig_ManPrintStats(Aig_Man_t *p)
Definition: aigMan.c:379
int Dar_ManRewrite(Aig_Man_t *pAig, Dar_RwrPar_t *pPars)
Definition: darCore.c:78
int fVerbose
Definition: dar.h:66
int Dar_ManRefactor(Aig_Man_t *pAig, Dar_RefPar_t *pPars)
Definition: darRefact.c:496
void Dar_ManDefaultRefParams(Dar_RefPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darRefact.c:85
int fUseZeros
Definition: dar.h:65
typedefABC_NAMESPACE_HEADER_START struct Dar_RwrPar_t_ Dar_RwrPar_t
INCLUDES ///.
Definition: dar.h:42
Aig_Man_t * Dar_ManBalance(Aig_Man_t *p, int fUpdateLevel)
Definition: darBalance.c:554
void Dar_ManDefaultRwrParams(Dar_RwrPar_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: darCore.c:51
Aig_Man_t* Hcd_ComputeChoices ( Aig_Man_t pAig,
int  nBTLimit,
int  fSynthesis,
int  fUseMiniSat,
int  fVerbose 
)

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

Synopsis [Performs computation of AIGs with choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 610 of file giaHcd.c.

611 {
612  Vec_Ptr_t * vGias;
613  Gia_Man_t * pGia, * pMiter;
614  Aig_Man_t * pAigNew;
615  int i;
616  clock_t clk = clock();
617  // perform synthesis
618  if ( fSynthesis )
619  {
620  vGias = Hcd_ChoiceSynthesis( Aig_ManDupDfs(pAig), 1, 1, 0, 0 );
621  if ( fVerbose )
622  ABC_PRT( "Synthesis time", clock() - clk );
623  // create choices
624  clk = clock();
625  pMiter = Hcd_ManChoiceMiter( vGias );
626  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
627  Gia_ManStop( pGia );
628 
629  Gia_AigerWrite( pMiter, "m3.aig", 0, 0 );
630  }
631  else
632  {
633  vGias = Vec_PtrStart( 3 );
634  pMiter = Gia_ManFromAig(pAig);
635  }
636  // perform choicing
637  Gia_ComputeEquivalences( pMiter, nBTLimit, fUseMiniSat, fVerbose );
638  // derive AIG with choices
639  pGia = Hcd_ManEquivToChoices( pMiter, Vec_PtrSize(vGias) );
640  Gia_ManSetRegNum( pGia, Aig_ManRegNum(pAig) );
641  Gia_ManStop( pMiter );
642  Vec_PtrFree( vGias );
643  if ( fVerbose )
644  ABC_PRT( "Choicing time", clock() - clk );
645 // Gia_ManHasChoices_very_old( pGia );
646  // transform back
647  pAigNew = Gia_ManToAig( pGia, 1 );
648  Gia_ManStop( pGia );
649 
650  if ( fVerbose )
651  {
652  extern int Dch_DeriveChoiceCountReprs( Aig_Man_t * pAig );
653  extern int Dch_DeriveChoiceCountEquivs( Aig_Man_t * pAig );
654  printf( "Choices : Reprs = %5d. Equivs = %5d. Choices = %5d.\n",
655  Dch_DeriveChoiceCountReprs( pAigNew ),
656  Dch_DeriveChoiceCountEquivs( pAigNew ),
657  Aig_ManChoiceNum( pAigNew ) );
658  }
659 
660  return pAigNew;
661 }
static Vec_Ptr_t * Vec_PtrStart(int nSize)
Definition: vecPtr.h:106
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Aig_Man_t * Aig_ManDupDfs(Aig_Man_t *p)
Definition: aigDup.c:563
void Gia_ComputeEquivalences(Gia_Man_t *pMiter, int nBTLimit, int fUseMiniSat, int fVerbose)
Definition: giaGiarf.c:1030
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition: giaAig.c:73
Vec_Ptr_t * Hcd_ChoiceSynthesis(Aig_Man_t *pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose)
Definition: giaHcd.c:259
else
Definition: sparse_int.h:55
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
int Dch_DeriveChoiceCountEquivs(Aig_Man_t *pAig)
Definition: dchChoice.c:89
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact)
Definition: giaAiger.c:1024
int Aig_ManChoiceNum(Aig_Man_t *p)
Definition: aigUtil.c:1007
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
Gia_Man_t * Hcd_ManEquivToChoices(Gia_Man_t *p, int nSnapshots)
Definition: giaHcd.c:559
Definition: gia.h:95
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Gia_Man_t * Hcd_ManChoiceMiter(Vec_Ptr_t *vGias)
Definition: giaHcd.c:318
int Dch_DeriveChoiceCountReprs(Aig_Man_t *pAig)
FUNCTION DECLARATIONS ///.
Definition: dchChoice.c:75
#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 Hcd_ComputeChoicesTest ( Gia_Man_t pGia,
int  nBTLimit,
int  fSynthesis,
int  fUseMiniSat,
int  fVerbose 
)

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

Synopsis [Performs computation of AIGs with choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 674 of file giaHcd.c.

675 {
676  Aig_Man_t * pAig, * pAigNew;
677  pAig = Gia_ManToAig( pGia, 0 );
678  pAigNew = Hcd_ComputeChoices( pAig, nBTLimit, fSynthesis, fUseMiniSat, fVerbose );
679  Aig_ManStop( pAigNew );
680  Aig_ManStop( pAig );
681 }
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
Aig_Man_t * Hcd_ComputeChoices(Aig_Man_t *pAig, int nBTLimit, int fSynthesis, int fUseMiniSat, int fVerbose)
Definition: giaHcd.c:610
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
Definition: giaAig.c:277
void Hcd_ManAddNextEntry_rec ( Gia_Man_t p,
Gia_Obj_t pOld,
Gia_Obj_t pNode 
)

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

Synopsis [Adds the next entry while making choices.]

Description []

SideEffects []

SeeAlso []

Definition at line 431 of file giaHcd.c.

432 {
433  if ( Gia_ObjNext(p, Gia_ObjId(p, pOld)) == 0 )
434  {
435  Gia_ObjSetNext( p, Gia_ObjId(p, pOld), Gia_ObjId(p, pNode) );
436  return;
437  }
438  Hcd_ManAddNextEntry_rec( p, Gia_ObjNextObj(p, Gia_ObjId(p, pOld)), pNode );
439 }
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ObjNextObj(Gia_Man_t *p, int Id)
Definition: gia.h:911
void Hcd_ManAddNextEntry_rec(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
Definition: giaHcd.c:431
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
Gia_Man_t* Hcd_ManChoiceMiter ( Vec_Ptr_t vGias)

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

Synopsis [Derives the miter of several AIGs for choice computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 318 of file giaHcd.c.

319 {
320  Gia_Man_t * pNew, * pGia, * pGia0;
321  int i, k, iNode, nNodes;
322  // make sure they have equal parameters
323  assert( Vec_PtrSize(vGias) > 0 );
324  pGia0 = (Gia_Man_t *)Vec_PtrEntry( vGias, 0 );
325  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
326  {
327  assert( Gia_ManCiNum(pGia) == Gia_ManCiNum(pGia0) );
328  assert( Gia_ManCoNum(pGia) == Gia_ManCoNum(pGia0) );
329  assert( Gia_ManRegNum(pGia) == Gia_ManRegNum(pGia0) );
330  Gia_ManFillValue( pGia );
331  Gia_ManConst0(pGia)->Value = 0;
332  }
333  // start the new manager
334  pNew = Gia_ManStart( Vec_PtrSize(vGias) * Gia_ManObjNum(pGia0) );
335  pNew->pName = Abc_UtilStrsav( pGia0->pName );
336  pNew->pSpec = Abc_UtilStrsav( pGia0->pSpec );
337  // create new CIs and assign them to the old manager CIs
338  for ( k = 0; k < Gia_ManCiNum(pGia0); k++ )
339  {
340  iNode = Gia_ManAppendCi(pNew);
341  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
342  Gia_ManCi( pGia, k )->Value = iNode;
343  }
344  // create internal nodes
345  Gia_ManHashAlloc( pNew );
346  for ( k = 0; k < Gia_ManCoNum(pGia0); k++ )
347  {
348  Vec_PtrForEachEntry( Gia_Man_t *, vGias, pGia, i )
349  Hcd_ManChoiceMiter_rec( pNew, pGia, Gia_ManCo( pGia, k ) );
350  }
351  Gia_ManHashStop( pNew );
352  // check the presence of dangling nodes
353  nNodes = Gia_ManHasDangling( pNew );
354  assert( nNodes == 0 );
355  return pNew;
356 }
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
for(p=first;p->value< newval;p=p->next)
int Gia_ManHasDangling(Gia_Man_t *p)
Definition: giaUtil.c:1155
char * pName
Definition: gia.h:97
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int Hcd_ManChoiceMiter_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaHcd.c:296
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Hcd_ManChoiceMiter_rec ( Gia_Man_t pNew,
Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 296 of file giaHcd.c.

297 {
298  if ( ~pObj->Value )
299  return pObj->Value;
300  Hcd_ManChoiceMiter_rec( pNew, p, Gia_ObjFanin0(pObj) );
301  if ( Gia_ObjIsCo(pObj) )
302  return pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
303  Hcd_ManChoiceMiter_rec( pNew, p, Gia_ObjFanin1(pObj) );
304  return pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
305 }
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
int Hcd_ManChoiceMiter_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaHcd.c:296
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
unsigned Value
Definition: gia.h:87
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
Gia_Man_t* Hcd_ManEquivToChoices ( Gia_Man_t p,
int  nSnapshots 
)

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

Synopsis [Reduces AIG using equivalence classes.]

Description []

SideEffects []

SeeAlso []

Definition at line 559 of file giaHcd.c.

560 {
561  Gia_Man_t * pNew, * pTemp;
562  Gia_Obj_t * pObj, * pRepr;
563  int i;
564  assert( (Gia_ManCoNum(p) % nSnapshots) == 0 );
565  Gia_ManSetPhase( p );
566  pNew = Gia_ManStart( Gia_ManObjNum(p) );
567  pNew->pName = Abc_UtilStrsav( p->pName );
568  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
569  pNew->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(p) );
570  pNew->pNexts = ABC_CALLOC( int, Gia_ManObjNum(p) );
571  for ( i = 0; i < Gia_ManObjNum(p); i++ )
572  Gia_ObjSetRepr( pNew, i, GIA_VOID );
573  Gia_ManFillValue( p );
574  Gia_ManConst0(p)->Value = 0;
575  Gia_ManForEachCi( p, pObj, i )
576  pObj->Value = Gia_ManAppendCi(pNew);
577  Gia_ManForEachRo( p, pObj, i )
578  if ( (pRepr = Gia_ObjReprObj(p, Gia_ObjId(p, pObj))) )
579  {
580  assert( Gia_ObjIsConst0(pRepr) || Gia_ObjIsRo(p, pRepr) );
581  pObj->Value = pRepr->Value;
582  }
583  Gia_ManHashAlloc( pNew );
584  Gia_ManForEachCo( p, pObj, i )
585  Hcd_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
586  Gia_ManForEachCo( p, pObj, i )
587  if ( i % nSnapshots == 0 )
588  Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
589  Gia_ManHashStop( pNew );
590  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
591  Hcd_ManRemoveBadChoices( pNew );
592 // Gia_ManEquivPrintClasses( pNew, 0, 0 );
593  pNew = Gia_ManCleanup( pTemp = pNew );
594  Gia_ManStop( pTemp );
595 // Gia_ManEquivPrintClasses( pNew, 0, 0 );
596  return pNew;
597 }
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
int * pNexts
Definition: gia.h:122
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
Definition: gia.h:75
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
char * pName
Definition: gia.h:97
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
void Hcd_ManRemoveBadChoices(Gia_Man_t *p)
Definition: giaHcd.c:511
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static Gia_Obj_t * Gia_ObjReprObj(Gia_Man_t *p, int Id)
Definition: gia.h:886
#define GIA_VOID
Definition: gia.h:45
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define Gia_ManForEachRo(p, pObj, i)
Definition: gia.h:1038
Gia_Rpr_t * pReprs
Definition: gia.h:121
#define assert(ex)
Definition: util_old.h:213
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
unsigned Value
Definition: gia.h:87
void Hcd_ManEquivToChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaHcd.c:452
void Gia_ManHashAlloc(Gia_Man_t *p)
Definition: giaHash.c:99
Definition: gia.h:56
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
void Hcd_ManEquivToChoices_rec ( Gia_Man_t pNew,
Gia_Man_t p,
Gia_Obj_t pObj 
)

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

Synopsis [Duplicates the AIG in the DFS order.]

Description []

SideEffects []

SeeAlso []

Definition at line 452 of file giaHcd.c.

453 {
454  Gia_Obj_t * pRepr, * pReprNew, * pObjNew;
455  if ( ~pObj->Value )
456  return;
457  if ( (pRepr = Gia_ObjReprObj(p, Gia_ObjId(p, pObj))) )
458  {
459  if ( Gia_ObjIsConst0(pRepr) )
460  {
461  pObj->Value = Abc_LitNotCond( pRepr->Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
462  return;
463  }
464  Hcd_ManEquivToChoices_rec( pNew, p, pRepr );
465  assert( Gia_ObjIsAnd(pObj) );
466  Hcd_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
467  Hcd_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin1(pObj) );
468  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
469  if ( Abc_LitRegular(pObj->Value) == Abc_LitRegular(pRepr->Value) )
470  {
471  assert( (int)pObj->Value == Abc_LitNotCond( pRepr->Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) ) );
472  return;
473  }
474  if ( pRepr->Value > pObj->Value ) // should never happen with high resource limit
475  return;
476  assert( pRepr->Value < pObj->Value );
477  pReprNew = Gia_ManObj( pNew, Abc_Lit2Var(pRepr->Value) );
478  pObjNew = Gia_ManObj( pNew, Abc_Lit2Var(pObj->Value) );
479  if ( Gia_ObjReprObj( pNew, Gia_ObjId(pNew, pObjNew) ) )
480  {
481  assert( Gia_ObjReprObj( pNew, Gia_ObjId(pNew, pObjNew) ) == pReprNew );
482  pObj->Value = Abc_LitNotCond( pRepr->Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
483  return;
484  }
485  if ( !Hcd_ObjCheckTfi( pNew, pReprNew, pObjNew ) )
486  {
487  assert( Gia_ObjNext(pNew, Gia_ObjId(pNew, pObjNew)) == 0 );
488  Gia_ObjSetRepr( pNew, Gia_ObjId(pNew, pObjNew), Gia_ObjId(pNew, pReprNew) );
489  Hcd_ManAddNextEntry_rec( pNew, pReprNew, pObjNew );
490  }
491  pObj->Value = Abc_LitNotCond( pRepr->Value, Gia_ObjPhaseReal(pRepr) ^ Gia_ObjPhaseReal(pObj) );
492  return;
493  }
494  assert( Gia_ObjIsAnd(pObj) );
495  Hcd_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin0(pObj) );
496  Hcd_ManEquivToChoices_rec( pNew, p, Gia_ObjFanin1(pObj) );
497  pObj->Value = Gia_ManHashAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
498 }
static int Gia_ObjPhaseReal(Gia_Obj_t *pObj)
Definition: gia.h:416
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
int Hcd_ObjCheckTfi(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
Definition: giaHcd.c:405
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjFanin1Copy(Gia_Obj_t *pObj)
Definition: gia.h:482
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
void Hcd_ManAddNextEntry_rec(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode)
Definition: giaHcd.c:431
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static Gia_Obj_t * Gia_ObjReprObj(Gia_Man_t *p, int Id)
Definition: gia.h:886
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
static int Abc_LitRegular(int Lit)
Definition: abc_global.h:268
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
void Hcd_ManEquivToChoices_rec(Gia_Man_t *pNew, Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: giaHcd.c:452
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition: giaHash.c:572
void Hcd_ManRemoveBadChoices ( Gia_Man_t p)

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

Synopsis [Removes choices, which contain fanouts.]

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file giaHcd.c.

512 {
513  Gia_Obj_t * pObj;
514  int i, iObj, iPrev, Counter = 0;
515  // mark nodes with fanout
516  Gia_ManForEachObj( p, pObj, i )
517  {
518  pObj->fMark0 = 0;
519  if ( Gia_ObjIsAnd(pObj) )
520  {
521  Gia_ObjFanin0(pObj)->fMark0 = 1;
522  Gia_ObjFanin1(pObj)->fMark0 = 1;
523  }
524  else if ( Gia_ObjIsCo(pObj) )
525  Gia_ObjFanin0(pObj)->fMark0 = 1;
526  }
527  // go through the classes and remove
528  Gia_ManForEachClass( p, i )
529  {
530  for ( iPrev = i, iObj = Gia_ObjNext(p, i); iObj; iObj = Gia_ObjNext(p, iPrev) )
531  {
532  if ( !Gia_ManObj(p, iObj)->fMark0 )
533  {
534  iPrev = iObj;
535  continue;
536  }
537  Gia_ObjSetRepr( p, iObj, GIA_VOID );
538  Gia_ObjSetNext( p, iPrev, Gia_ObjNext(p, iObj) );
539  Gia_ObjSetNext( p, iObj, 0 );
540  Counter++;
541  }
542  }
543  // remove the marks
544  Gia_ManCleanMark0( p );
545 // printf( "Removed %d bad choices.\n", Counter );
546 }
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition: giaUtil.c:215
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static void Gia_ObjSetRepr(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:888
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Counter
static int Gia_ObjIsCo(Gia_Obj_t *pObj)
Definition: gia.h:421
static int Gia_ObjNext(Gia_Man_t *p, int Id)
Definition: gia.h:912
static void Gia_ObjSetNext(Gia_Man_t *p, int Id, int Num)
Definition: gia.h:913
#define GIA_VOID
Definition: gia.h:45
unsigned fMark0
Definition: gia.h:79
static int Gia_ObjIsAnd(Gia_Obj_t *pObj)
Definition: gia.h:422
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
#define Gia_ManForEachClass(p, i)
Definition: gia.h:927
void Hcd_ManSetDefaultParams ( Hcd_Pars_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 69 of file giaHcd.c.

70 {
71  memset( p, 0, sizeof(Hcd_Pars_t) );
72  p->nWords = 8; // the number of simulation words
73  p->nBTLimit = 1000; // conflict limit at a node
74  p->nSatVarMax = 5000; // the max number of SAT variables
75  p->fSynthesis = 1; // derives three snapshots
76  p->fPolarFlip = 1; // uses polarity adjustment
77  p->fSimulateTfo = 1; // simulate TFO
78  p->fPower = 0; // power-aware rewriting
79  p->fVerbose = 0; // verbose stats
80  p->nNodesAhead = 1000; // the lookahead in terms of nodes
81  p->nCallsRecycle = 100; // calls to perform before recycling SAT solver
82 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Hcd_Pars_t_ Hcd_Pars_t
DECLARATIONS ///.
Definition: giaHcd.c:34
int Hcd_ObjCheckTfi ( Gia_Man_t p,
Gia_Obj_t pOld,
Gia_Obj_t pNode 
)

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

Synopsis [Returns 1 if pOld is in the TFI of pNode.]

Description []

SideEffects []

SeeAlso []

Definition at line 405 of file giaHcd.c.

406 {
407  Vec_Ptr_t * vVisited;
408  Gia_Obj_t * pObj;
409  int RetValue, i;
410  assert( !Gia_IsComplement(pOld) );
411  assert( !Gia_IsComplement(pNode) );
412  vVisited = Vec_PtrAlloc( 100 );
413  RetValue = Hcd_ObjCheckTfi_rec( p, pOld, pNode, vVisited );
414  Vec_PtrForEachEntry( Gia_Obj_t *, vVisited, pObj, i )
415  pObj->fMark0 = 0;
416  Vec_PtrFree( vVisited );
417  return RetValue;
418 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Definition: gia.h:75
static int Gia_IsComplement(Gia_Obj_t *p)
Definition: gia.h:380
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Hcd_ObjCheckTfi_rec(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode, Vec_Ptr_t *vVisited)
Definition: giaHcd.c:369
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Hcd_ObjCheckTfi_rec ( Gia_Man_t p,
Gia_Obj_t pOld,
Gia_Obj_t pNode,
Vec_Ptr_t vVisited 
)

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

Synopsis [Returns 1 if pOld is in the TFI of pNode.]

Description []

SideEffects []

SeeAlso []

Definition at line 369 of file giaHcd.c.

370 {
371  // check the trivial cases
372  if ( pNode == NULL )
373  return 0;
374  if ( Gia_ObjIsCi(pNode) )
375  return 0;
376 // if ( pNode->Id < pOld->Id ) // cannot use because of choices of pNode
377 // return 0;
378  if ( pNode == pOld )
379  return 1;
380  // skip the visited node
381  if ( pNode->fMark0 )
382  return 0;
383  pNode->fMark0 = 1;
384  Vec_PtrPush( vVisited, pNode );
385  // check the children
386  if ( Hcd_ObjCheckTfi_rec( p, pOld, Gia_ObjFanin0(pNode), vVisited ) )
387  return 1;
388  if ( Hcd_ObjCheckTfi_rec( p, pOld, Gia_ObjFanin1(pNode), vVisited ) )
389  return 1;
390  // check equivalent nodes
391  return Hcd_ObjCheckTfi_rec( p, pOld, Gia_ObjNextObj(p, Gia_ObjId(p, pNode)), vVisited );
392 }
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static Gia_Obj_t * Gia_ObjNextObj(Gia_Man_t *p, int Id)
Definition: gia.h:911
unsigned fMark0
Definition: gia.h:79
static Gia_Obj_t * Gia_ObjFanin1(Gia_Obj_t *pObj)
Definition: gia.h:455
int Hcd_ObjCheckTfi_rec(Gia_Man_t *p, Gia_Obj_t *pOld, Gia_Obj_t *pNode, Vec_Ptr_t *vVisited)
Definition: giaHcd.c:369
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420