38 return w^((~(w&(w>>1)))&0x55555555);
42 return (u&w)|((((u&(u>>1)&w&~(w>>1))|(w&(w>>1)&u&~(u>>1)))&0x55555555)<<1);
51 return w^((~w)&(w>>1)&0x55555555);
55 assert( v == 0 || v == 1 || v == 3 );
56 return v? ((v==1)? 0x55555555 : 0xffffffff) : 0;
82 for ( w = 0; w <
nWords; w++ )
105 for ( w = 0; w <
nWords; w++ )
106 pSim[w] = 0xffffffff;
129 for ( w = 0; w <
nWords; w++ )
153 for ( w = 0; w <
nWords; w++ )
177 for ( w = 0; w <
nWords; w++ )
196 unsigned * pSim0, * pSim1, * pSim;
206 for ( w = 0; w <
nWords; w++ )
211 for ( w = 0; w <
nWords; w++ )
216 for ( w = 0; w <
nWords; w++ )
221 for ( w = 0; w <
nWords; w++ )
232 for ( w = 0; w <
nWords; w++ )
237 for ( w = 0; w <
nWords; w++ )
257 unsigned * pSim0, * pSim1;
263 for ( w = 0; w <
nWords; w++ )
283 int * pCounters, i, w, b;
284 int iPatBest, iTernMin;
290 for ( w = 0; w <
nWords; w++ )
291 for ( b = 0; b < 16; b++ )
292 if ( ((pSim[w] >> (b << 1)) & 3) == 3 )
293 pCounters[16 * w + b]++;
298 for ( b = 0; b < 16 *
nWords; b++ )
299 if ( iTernMin > pCounters[b] )
301 iTernMin = pCounters[b];
327 assert( iPat < 16 * nWords );
331 Value = (pSim[iPat>>4] >> ((iPat&0xf) << 1)) & 3;
340 Value = (pSim[iPat>>4] >> ((iPat&0xf) << 1)) & 3;
341 Counter += (Value == 3);
344 for ( w = 0; w <
nWords; w++ )
373 for ( i = 0; i < nIters; i++ )
386 Counter += (Value == 3);
410 int nTerPrev, nTerCur = 0, nTerCur2;
411 int iPatBest, RetValue, s, t;
423 for ( s = 0; s < nStepsMax && nTerPrev > 0; s++ )
425 for ( t = 0; t < nTriesMax; t++ )
430 if ( nTerCur < nTerPrev )
433 if ( t == nTriesMax )
436 assert( nTerCur == nTerCur2 );
441 printf(
"Count not initialize %d registers.\n", nTerPrev );
513 if ( vSequence == NULL )
514 printf(
"Design 1: Synchronizing sequence is not found. " );
516 printf(
"Design 1: Synchronizing sequence of length %4d is found. ",
Vec_StrSize(vSequence) /
Saig_ManPiNum(pAig) );
523 if ( vSequence == NULL )
525 printf(
"Quitting synchronization.\n" );
581 printf(
"Design 1: " );
583 printf(
"Design 2: " );
591 printf(
"Design 1: Synchronizing sequence is not found. " );
605 printf(
"Design 2: Synchronizing sequence is not found. " );
616 if ( vSeq1 == NULL || vSeq2 == NULL )
618 printf(
"Quitting synchronization.\n" );
653 printf(
"Miter of the synchronized designs is constructed. " );
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
void Saig_SynchTernarySimulate(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords)
static int Aig_ObjFaninId0(Aig_Obj_t *pObj)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
void Aig_ManStop(Aig_Man_t *p)
static char * Vec_StrArray(Vec_Str_t *p)
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
void Saig_SynchSetConstant1(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords)
FUNCTION DEFINITIONS ///.
void Saig_SynchInitRegsBinary(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
void Aig_ManPrintStats(Aig_Man_t *p)
void Saig_SynchInitPisRandom(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords)
Vec_Str_t * Saig_SynchSequence(Aig_Man_t *pAig, int nWords)
static unsigned Saig_SynchTernary(int v)
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
unsigned Aig_ManRandom(int fReset)
static Vec_Str_t * Vec_StrAlloc(int nCap)
static abctime Abc_Clock()
static int Aig_ObjFaninId1(Aig_Obj_t *pObj)
static int Abc_MaxInt(int a, int b)
static void Vec_StrPush(Vec_Str_t *p, char Entry)
static int Aig_ManNodeNum(Aig_Man_t *p)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Aig_Man_t * Saig_ManDupInitZero(Aig_Man_t *p)
void Saig_SynchTernaryTransferState(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords)
void Saig_SynchInitPisGiven(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords, char *pValues)
#define Aig_ManForEachNode(p, pObj, i)
Aig_Man_t * Saig_Synchronize(Aig_Man_t *pAig1, Aig_Man_t *pAig2, int nWords, int fVerbose)
Aig_Man_t * Saig_ManCreateMiter(Aig_Man_t *p1, Aig_Man_t *p2, int Oper)
static unsigned Saig_SynchRandomBinary()
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
#define Saig_ManForEachLi(p, pObj, i)
static void Vec_StrFree(Vec_Str_t *p)
#define ABC_NAMESPACE_IMPL_END
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
int Saig_SynchCountX(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords, int *piPat)
#define Saig_ManForEachLo(p, pObj, i)
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
int Saig_SynchSequenceRun(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, Vec_Str_t *vSequence, int fTernary)
Aig_Man_t * Saig_SynchSequenceApply(Aig_Man_t *pAig, int nWords, int fVerbose)
void Saig_SynchInitRegsTernary(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords)
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
static int Saig_ManRegNum(Aig_Man_t *p)
static int Aig_ManObjNumMax(Aig_Man_t *p)
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
#define ABC_NAMESPACE_IMPL_START
static unsigned Saig_SynchRandomTernary()
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static int Vec_StrSize(Vec_Str_t *p)
static int Saig_ManPiNum(Aig_Man_t *p)
MACRO DEFINITIONS ///.
void Aig_ManCleanMarkA(Aig_Man_t *p)
#define ABC_CALLOC(type, num)
static int Aig_ObjFaninC1(Aig_Obj_t *pObj)
#define Saig_ManForEachPo(p, pObj, i)
static ABC_NAMESPACE_IMPL_START unsigned Saig_SynchNot(unsigned w)
DECLARATIONS ///.
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
char * Abc_UtilStrsav(char *s)
int Aig_ManCleanup(Aig_Man_t *p)
static unsigned Saig_SynchAnd(unsigned u, unsigned w)
static Vec_Ptr_t * Vec_PtrAllocSimInfo(int nEntries, int nWords)
static void Vec_PtrFree(Vec_Ptr_t *p)
#define Saig_ManForEachPi(p, pObj, i)
int Saig_SynchSavePattern(Aig_Man_t *pAig, Vec_Ptr_t *vSimInfo, int nWords, int iPat, Vec_Str_t *vSequence)