53static inline int Ssw_RarGetBinPat(
Ssw_RarMan_t *
p,
int iBin,
int iPat )
55 assert( iBin >= 0 && iBin < Aig_ManRegNum(
p->pAig) /
p->nBinSize );
56 assert( iPat >= 0 && iPat < (1 <<
p->nBinSize) );
57 return p->pRarity[iBin * (1 <<
p->nBinSize) + iPat];
59static inline void Ssw_RarSetBinPat(
Ssw_RarMan_t *
p,
int iBin,
int iPat,
int Value )
61 assert( iBin >= 0 && iBin < Aig_ManRegNum(
p->pAig) /
p->nBinSize );
62 assert( iPat >= 0 && iPat < (1 <<
p->nBinSize) );
63 p->pRarity[iBin * (1 <<
p->nBinSize) + iPat] = Value;
65static inline void Ssw_RarAddToBinPat(
Ssw_RarMan_t *
p,
int iBin,
int iPat )
67 assert( iBin >= 0 && iBin < Aig_ManRegNum(
p->pAig) /
p->nBinSize );
68 assert( iPat >= 0 && iPat < (1 <<
p->nBinSize) );
69 p->pRarity[iBin * (1 <<
p->nBinSize) + iPat]++;
90 if ( Aig_ManRegNum(pAig) < nBinSize || nBinSize <= 0 )
96 p->nBinSize = nBinSize;
97 p->fVerbose = fVerbose;
98 p->nGroups = Aig_ManRegNum(pAig) / nBinSize;
99 p->pRarity =
ABC_CALLOC(
int, (1 << nBinSize) *
p->nGroups );
122 Vec_PtrFreeP( &
p->vSimInfo );
123 Vec_IntFreeP( &
p->vInits );
154 for ( k = 0; k <
p->nWords * 32; k++ )
156 for ( i = 0; i <
p->nGroups; i++ )
157 p->pGroupValues[i] = 0;
160 pData = (
unsigned *)Vec_PtrEntry(
p->vSimInfo, Aig_ObjId(pObj) ) +
p->nWords * (
p->nFrames - 1);
161 if ( Abc_InfoHasBit(pData, k) && i /
p->nBinSize <
p->nGroups )
162 p->pGroupValues[i /
p->nBinSize] |= (1 << (i %
p->nBinSize));
164 for ( i = 0; i <
p->nGroups; i++ )
165 Ssw_RarAddToBinPat(
p, i,
p->pGroupValues[i] );
195 for ( k = 0; k <
p->nWords * 32; k++ )
197 for ( i = 0; i <
p->nGroups; i++ )
198 p->pGroupValues[i] = 0;
202 pData = (
unsigned *)Vec_PtrEntry(
p->vSimInfo, Aig_ObjId(pObj) ) +
p->nWords * (
p->nFrames - 1);
203 if ( Abc_InfoHasBit(pData, k) && i /
p->nBinSize <
p->nGroups )
204 p->pGroupValues[i /
p->nBinSize] |= (1 << (i %
p->nBinSize));
207 p->pPatCosts[k] = 0.0;
208 for ( i = 0; i <
p->nGroups; i++ )
210 Value = Ssw_RarGetBinPat(
p, i,
p->pGroupValues[i] );
212 p->pPatCosts[k] += 1.0/(Value*Value);
219 Vec_IntClear( vInits );
220 for ( i = 0; i <
p->nWords; i++ )
225 for ( k = 0; k <
p->nWords * 32; k++ )
226 if ( iCostBest < p->pPatCosts[k] )
228 iCostBest =
p->pPatCosts[k];
237 pData = (
unsigned *)Vec_PtrEntry(
p->vSimInfo, Aig_ObjId(pObj) ) +
p->nWords * (
p->nFrames - 1);
238 Vec_IntPush( vInits, Abc_InfoHasBit(pData, iPatBest) );
242 assert( Vec_IntSize(vInits) == Aig_ManRegNum(
p->pAig) *
p->nWords );
264 pObj->
fMarkB = Abc_InfoHasBit( pCex->pData, i );
267 for ( f = 0; f <= pCex->iFrame; f++ )
270 Aig_ManConst1(pAig)->fMarkB = 1;
272 pObj->
fMarkB = Abc_InfoHasBit( pCex->pData, iBit++ );
277 pObj->
fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) )
278 & ( Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj) );
281 pObj->
fMarkB = ( Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj) );
283 assert( iBit == pCex->nBits );
289 vInit = Vec_IntAlloc( Saig_ManRegNum(pAig) );
291 Vec_IntPush( vInit, pObj->
fMarkB );
312 abctime clk, clkTotal = Abc_Clock();
313 abctime nTimeToStop = TimeOut ? TimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
315 assert( Aig_ManRegNum(pAig) > 0 );
316 assert( Aig_ManConstrNum(pAig) == 0 );
318 if ( Aig_ManNodeNum(pAig) == 0 )
321 Abc_Print( 1,
"Simulating %d words through %d frames with %d binsize, %d rounds, and %d sec timeout.\n",
322 nWords, nFrames, nBinSize, nRounds, TimeOut );
327 p = Ssw_RarManStart( pAig,
nWords, nFrames, nBinSize, fVerbose );
328 p->vInits = Vec_IntStart( Aig_ManRegNum(pAig) *
nWords );
332 for ( r = 0; r < nRounds; r++ )
339 if ( fVerbose ) Abc_Print( 1,
"\n" );
340 Abc_Print( 1,
"Simulation asserted a PO in frame f: %d <= f < %d.\n", r * nFrames, (r+1) * nFrames );
345 Ssw_RarUpdateCounters(
p );
346 Ssw_RarTransferPatterns(
p,
p->vInits );
356 if ( TimeOut && Abc_Clock() > nTimeToStop )
358 if ( fVerbose ) Abc_Print( 1,
"\n" );
359 Abc_Print( 1,
"Reached timeout (%d seconds).\n", TimeOut );
365 if ( fVerbose ) Abc_Print( 1,
"\n" );
366 Abc_Print( 1,
"Simulation did not assert POs in the first %d frames. ", nRounds * nFrames );
367 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkTotal );
391 abctime clkTotal = Abc_Clock();
392 abctime nTimeToStop = TimeOut ? TimeOut * CLOCKS_PER_SEC + Abc_Clock(): 0;
394 assert( Aig_ManRegNum(pAig) > 0 );
395 assert( Aig_ManConstrNum(pAig) == 0 );
397 if ( Aig_ManNodeNum(pAig) == 0 )
400 Abc_Print( 1,
"Filtering equivs with %d words through %d frames with %d binsize, %d rounds, and %d sec timeout.\n",
401 nWords, nFrames, nBinSize, nRounds, TimeOut );
406 p = Ssw_RarManStart( pAig,
nWords, nFrames, nBinSize, fVerbose );
410 p->vInits = Ssw_RarFindStartingState( pAig, pCex );
412 p->vInits = Vec_IntStart( Aig_ManRegNum(pAig) );
414 for ( i = 1; i <
nWords; i++ )
415 for ( k = 0; k < Aig_ManRegNum(pAig); k++ )
416 Vec_IntPush(
p->vInits, Vec_IntEntry(
p->vInits, k) );
417 assert( Vec_IntSize(
p->vInits) == Aig_ManRegNum(pAig) *
nWords );
422 if ( pAig->pReprs == NULL )
430 Abc_Print( 1,
"Initial : " );
434 for ( r = 0; r < nRounds; r++ )
439 Abc_Print( 1,
"All equivalences are refined away.\n" );
446 if ( fVerbose ) Abc_Print( 1,
"\n" );
447 Abc_Print( 1,
"Simulation asserted a PO in frame f: %d <= f < %d.\n", r * nFrames, (r+1) * nFrames );
457 Abc_Print( 1,
"Round %3d: ", r );
461 Ssw_RarUpdateCounters(
p );
462 Ssw_RarTransferPatterns(
p,
p->vInits );
465 if ( TimeOut && Abc_Clock() > nTimeToStop )
467 if ( fVerbose ) Abc_Print( 1,
"\n" );
468 Abc_Print( 1,
"Reached timeout (%d seconds).\n", TimeOut );
474 Abc_Print( 1,
"Simulation did not assert POs in the first %d frames. ", nRounds * nFrames );
475 Abc_PrintTime( 1,
"Time", Abc_Clock() - clkTotal );
498 if (
p->pReprs != NULL )
#define ABC_INFINITY
MACRO DEFINITIONS ///.
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManStop(Aig_Man_t *p)
struct Aig_Obj_t_ Aig_Obj_t
#define Aig_ManForEachNode(p, pObj, i)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
#define Aig_ManForEachCo(p, pObj, i)
unsigned Aig_ManRandom(int fReset)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
void Gia_ManReprFromAigRepr(Aig_Man_t *pAig, Gia_Man_t *pGia)
void Gia_ManReprToAigRepr2(Aig_Man_t *pAig, Gia_Man_t *pGia)
struct Gia_Man_t_ Gia_Man_t
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
#define Saig_ManForEachLi(p, pObj, i)
#define Saig_ManForEachLo(p, pObj, i)
#define Saig_ManForEachPi(p, pObj, i)
Ssw_Cla_t * Ssw_ClassesPrepareFromReprs(Aig_Man_t *pAig)
int Ssw_ClassesCand1Num(Ssw_Cla_t *p)
Ssw_Cla_t * Ssw_ClassesPrepareSimple(Aig_Man_t *pAig, int fLatchCorr, int nMaxLevs)
int Ssw_ClassesRefineConst1(Ssw_Cla_t *p, int fRecursive)
int Ssw_ClassesClassNum(Ssw_Cla_t *p)
void Ssw_ClassesPrint(Ssw_Cla_t *p, int fVeryVerbose)
void Ssw_ClassesSetData(Ssw_Cla_t *p, void *pManData, unsigned(*pFuncNodeHash)(void *, Aig_Obj_t *), int(*pFuncNodeIsConst)(void *, Aig_Obj_t *), int(*pFuncNodesAreEqual)(void *, Aig_Obj_t *, Aig_Obj_t *))
void Ssw_ClassesStop(Ssw_Cla_t *p)
int Ssw_ClassesRefine(Ssw_Cla_t *p, int fRecursive)
Ssw_Sml_t * Ssw_SmlStart(Aig_Man_t *pAig, int nPref, int nFrames, int nWordsFrame)
struct Ssw_Cla_t_ Ssw_Cla_t
void Ssw_SmlSimulateOne(Ssw_Sml_t *p)
int Ssw_SmlObjIsConstWord(Ssw_Sml_t *p, Aig_Obj_t *pObj)
int Ssw_RarSignalFilter2(Aig_Man_t *pAig, int nFrames, int nWords, int nBinSize, int nRounds, int TimeOut, Abc_Cex_t *pCex, int fLatchOnly, int fVerbose)
int Ssw_RarSimulate2(Aig_Man_t *pAig, int nFrames, int nWords, int nBinSize, int nRounds, int TimeOut, int fVerbose)
int Ssw_RarSignalFilterGia2(Gia_Man_t *p, int nFrames, int nWords, int nBinSize, int nRounds, int TimeOut, Abc_Cex_t *pCex, int fLatchOnly, int fVerbose)
typedefABC_NAMESPACE_IMPL_START struct Ssw_RarMan_t_ Ssw_RarMan_t
DECLARATIONS ///.
struct Ssw_Sml_t_ Ssw_Sml_t
Vec_Ptr_t * Ssw_SmlSimDataPointers(Ssw_Sml_t *p)
int Ssw_SmlObjsAreEqualWord(Ssw_Sml_t *p, Aig_Obj_t *pObj0, Aig_Obj_t *pObj1)
void Ssw_SmlInitializeSpecial(Ssw_Sml_t *p, Vec_Int_t *vInit)
int Ssw_SmlCheckNonConstOutputs(Ssw_Sml_t *p)
void Ssw_SmlStop(Ssw_Sml_t *p)
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.