34static int fForceZero = 0;
58 pF->
vSimsPi = Vec_WrdStartRandom( Gia_ManCiNum(pF) *
nWords );
62 assert( Gia_ManObjNum(pF) *
nWords == Vec_WrdSize(vSimsF) );
63 for ( i = 0; i < Gia_ManCoNum(pF)/2; i++ )
65 Gia_Obj_t * pObjFb = Gia_ManCo( pF, 2*i+0 );
66 Gia_Obj_t * pObjFx = Gia_ManCo( pF, 2*i+1 );
67 Gia_Obj_t * pObjGb = Gia_ManCo( pG, 2*i+0 );
68 Gia_Obj_t * pObjGx = Gia_ManCo( pG, 2*i+1 );
69 word * pSimFb = Vec_WrdEntryP(vSimsF, Gia_ObjId(pF, pObjFb)*
nWords);
70 word * pSimFx = Vec_WrdEntryP(vSimsF, Gia_ObjId(pF, pObjFx)*
nWords);
71 word * pSimGb = Vec_WrdEntryP(vSimsG, Gia_ObjId(pG, pObjGb)*
nWords);
72 word * pSimGx = Vec_WrdEntryP(vSimsG, Gia_ObjId(pG, pObjGx)*
nWords);
74 int nBitsFx = Abc_TtCountOnesVec(pSimFx,
nWords);
75 int nBitsF1 = Abc_TtCountOnesVecMask(pSimFx, pSimFb,
nWords, 1);
76 int nBitsF0 =
nWords*64 - nBitsFx - nBitsF1;
78 int nBitsGx = Abc_TtCountOnesVec(pSimGx,
nWords);
79 int nBitsG1 = Abc_TtCountOnesVecMask(pSimGx, pSimGb,
nWords, 1);
80 int nBitsG0 =
nWords*64 - nBitsGx - nBitsG1;
82 printf(
"Output %4d : ", i );
85 printf(
"0 =%7.3f %% ", 100.0*nBitsF0/64/
nWords );
86 printf(
"1 =%7.3f %% ", 100.0*nBitsF1/64/
nWords );
87 printf(
"X =%7.3f %% ", 100.0*nBitsFx/64/
nWords );
90 printf(
"0 =%7.3f %% ", 100.0*nBitsG0/64/
nWords );
91 printf(
"1 =%7.3f %% ", 100.0*nBitsG1/64/
nWords );
92 printf(
"X =%7.3f %% ", 100.0*nBitsGx/64/
nWords );
100 for ( j = 0; j < 20; j++ )
102 for ( n = 0; n < 2; n++ )
104 for ( i = 0; i < Gia_ManCoNum(pF)/2; i++ )
106 Gia_Obj_t * pObjFb = Gia_ManCo( pF, 2*i+0 );
107 Gia_Obj_t * pObjFx = Gia_ManCo( pF, 2*i+1 );
108 Gia_Obj_t * pObjGb = Gia_ManCo( pG, 2*i+0 );
109 Gia_Obj_t * pObjGx = Gia_ManCo( pG, 2*i+1 );
110 word * pSimFb = Vec_WrdEntryP(vSimsF, Gia_ObjId(pF, pObjFb)*
nWords);
111 word * pSimFx = Vec_WrdEntryP(vSimsF, Gia_ObjId(pF, pObjFx)*
nWords);
112 word * pSimGb = Vec_WrdEntryP(vSimsG, Gia_ObjId(pG, pObjGb)*
nWords);
113 word * pSimGx = Vec_WrdEntryP(vSimsG, Gia_ObjId(pG, pObjGx)*
nWords);
114 word * pSimb = n ? pSimGb : pSimFb;
115 word * pSimx = n ? pSimGx : pSimFx;
116 if ( Abc_TtGetBit(pSimx, j) )
118 else if ( Abc_TtGetBit(pSimb, j) )
128 Vec_WrdFree( vSimsF );
129 Vec_WrdFree( vSimsG );
146 LitZ[0] = Abc_LitNot(LitA[0]);
149 if ( fForceZero ) LitZ[0] =
Gia_ManHashAnd(
p, LitZ[0], Abc_LitNot(LitZ[1]) );
157 if ( fForceZero ) LitZ[0] =
Gia_ManHashAnd(
p, LitZ[0], Abc_LitNot(LitZ[1]) );
164 for ( i = 0; i < n; i++ )
173 int ZeroA =
Gia_ManHashAnd(
p, Abc_LitNot(LitA[0]), Abc_LitNot(LitA[1]) );
174 int ZeroB =
Gia_ManHashAnd(
p, Abc_LitNot(LitB[0]), Abc_LitNot(LitB[1]) );
185 int i, LitZero = 0, LitOne = 0;
187 for ( i = 0; i < n; i++ )
189 int Lit =
Gia_ManHashAnd(
p, Abc_LitNot(pLits[2*i]), Abc_LitNot(pLits[2*i+1]) );
196 if ( fForceZero ) LitZ[0] =
Gia_ManHashAnd(
p, LitZ[0], Abc_LitNot(LitZ[1]) );
211 if ( fForceZero ) LitZ[0] =
Gia_ManHashAnd(
p, LitZ[0], Abc_LitNot(LitZ[1]) );
230 int Cond =
Gia_ManHashAnd(
p, Abc_LitNot(LitT[1]), Abc_LitNot(LitE[1]) );
236 if ( fForceZero ) LitZ[0] =
Gia_ManHashAnd(
p, LitZ[0], Abc_LitNot(LitZ[1]) );
260 int * pFanin, iFanin, k, Type;
261 assert( !Acb_ObjIsCio(
p, iObj) );
262 Vec_IntClear( vTemp );
265 int * pLits = Vec_IntEntryP( vCopies, 2*iFanin );
266 assert( pLits[0] >= 0 && pLits[1] >= 0 );
267 Vec_IntPushTwo( vTemp, pLits[0], pLits[1] );
269 Type = Acb_ObjType(
p, iObj );
290 pRes[0] = Vec_IntEntry(vTemp, 0);
291 pRes[1] = Vec_IntEntry(vTemp, 1);
303 assert( Vec_IntSize(vTemp) == 4 );
304 Gia_ManDualDc( pNew, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + 2, pRes );
311 assert( Vec_IntSize(vTemp) == 6 );
312 ABC_SWAP(
int, Vec_IntArray(vTemp)[0], Vec_IntArray(vTemp)[4] );
313 ABC_SWAP(
int, Vec_IntArray(vTemp)[1], Vec_IntArray(vTemp)[5] );
314 Gia_ManDualMux( pNew, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + 2, Vec_IntArray(vTemp) + 4, pRes );
319 Gia_ManDualAndN( pNew, Vec_IntArray(vTemp), Vec_IntSize(vTemp)/2, pRes );
321 pRes[0] = Abc_LitNot( pRes[0] );
326 int * pArray = Vec_IntArray( vTemp );
327 for ( k = 0; k < Vec_IntSize(vTemp)/2; k++ )
328 pArray[2*k] = Abc_LitNot( pArray[2*k] );
331 pRes[0] = Abc_LitNot( pRes[0] );
336 assert( Vec_IntSize(vTemp) == 4 );
337 Gia_ManDualXor2( pNew, Vec_IntArray(vTemp), Vec_IntArray(vTemp) + 2, pRes );
339 pRes[0] = Abc_LitNot( pRes[0] );
349 Vec_Int_t * vCopies = Vec_IntStartFull( 2*Acb_NtkObjNum(
p) );
350 int i, iObj, * pLits;
352 pNew->
pName = Abc_UtilStrsav(Acb_NtkName(
p));
354 pLits = Vec_IntEntryP( vCopies, 0 );
359 pLits = Vec_IntEntryP( vCopies, 2*iObj );
360 pLits[0] = Gia_ManAppendCi(pNew);
363 vFanins = Vec_IntAlloc( 4 );
367 pLits = Vec_IntEntryP( vCopies, 2*iObj );
370 Vec_IntFree( vNodes );
371 Vec_IntFree( vFanins );
374 pLits = Vec_IntEntryP( vCopies, 2*Acb_ObjFanin(
p, iObj, 0) );
375 Gia_ManAppendCo( pNew, pLits[0] );
376 Gia_ManAppendCo( pNew, pLits[1] );
378 Vec_IntFree( vCopies );
400 assert( Gia_ManCiNum(pOne) == Gia_ManCiNum(pTwo) );
401 assert( Gia_ManCoNum(pOne) == Gia_ManCoNum(pTwo) );
402 pNew =
Gia_ManStart( Gia_ManObjNum(pOne) + Gia_ManObjNum(pTwo) + 5*Gia_ManCoNum(pOne)/2 );
403 pNew->
pName = Abc_UtilStrsav(
"miter" );
406 Gia_ManConst0(pOne)->Value = 0;
407 Gia_ManConst0(pTwo)->Value = 0;
409 pObj->
Value = Gia_ManAppendCi( pNew );
411 pObj->
Value = Gia_ManCi(pOne, i)->Value;
417 pObj->
Value = Gia_ObjFanin0Copy(pObj);
419 pObj->
Value = Gia_ObjFanin0Copy(pObj);
422 for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 )
424 unsigned pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value };
425 unsigned pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value };
426 Gia_ManAppendCo( pNew, pLitsF[0] );
427 Gia_ManAppendCo( pNew, pLitsS[0] );
430 else if ( Type == 1 )
432 for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 )
434 unsigned pLitsF[2] = { Gia_ManCo(pOne, i)->Value, Gia_ManCo(pOne, i+1)->Value };
435 unsigned pLitsS[2] = { Gia_ManCo(pTwo, i)->Value, Gia_ManCo(pTwo, i+1)->Value };
436 Gia_ManAppendCo( pNew, pLitsF[1] );
437 Gia_ManAppendCo( pNew, pLitsS[1] );
442 for ( i = 0; i < Gia_ManCoNum(pOne); i += 2 )
444 int pLitsF[2] = { (int)Gia_ManCo(pOne, i)->Value, (int)Gia_ManCo(pOne, i+1)->Value };
445 int pLitsS[2] = { (int)Gia_ManCo(pTwo, i)->Value, (int)Gia_ManCo(pTwo, i+1)->Value };
469 const char * pFileName0 = pFileName? pFileName :
"output";
470 FILE * pFile = fopen( pFileName0,
"wb" );
473 printf(
"Cannot open results file \"%s\".\n", pFileName0 );
476 if ( pModel == NULL )
477 fprintf( pFile,
"EQ\n" );
487 fprintf( pFile,
"NEQ\n" );
489 fprintf( pFile,
"%s %d\n", Acb_ObjNameStr(pNtkF, iObj), pModel[i] );
492 printf(
"Produced output file \"%s\".\n\n", pFileName0 );
508 int * pModel = pNtkTemp->
pModel;
511 printf(
"The networks are %s. ", RetValue == 1 ?
"equivalent" : (RetValue == 0 ?
"NOT equivalent" :
"UNDECIDED") );
512 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
532 int iObj, nDcs = 0, nMuxes = 0;
539 printf(
"PI = %6d ", Acb_NtkCiNum(pNtk) );
540 printf(
"PO = %6d ", Acb_NtkCoNum(pNtk) );
541 printf(
"Obj = %6d ", Acb_NtkObjNum(pNtk) );
542 printf(
"DC = %4d ", nDcs );
543 printf(
"Mux = %4d ", nMuxes );
562 Vec_Int_t * vOrder = Vec_IntStartFull( Acb_NtkCiNum(pNtkG) );
564 Vec_IntWriteEntry( vMap, Acb_ObjName(pNtkG, iObj), i );
567 int NameIdG = Acb_ManStrId( pNtkG->
pDesign, Acb_ObjNameStr(pNtkF, iObj) );
568 int iPerm = NameIdG < Vec_IntSize(vMap) ? Vec_IntEntry( vMap, NameIdG ) : -1;
570 printf(
"Cannot find name \"%s\" of PI %d of F among PIs of G.\n", Acb_ObjNameStr(pNtkF, iObj), i );
572 Vec_IntWriteEntry( vOrder, iPerm, iObj );
574 Vec_IntClear( &pNtkF->
vCis );
575 Vec_IntAppend( &pNtkF->
vCis, vOrder );
576 Vec_IntFree( vOrder );
581 int i, nPis = Acb_NtkCiNum(pNtkF);
582 for ( i = 0; i < nPis; i++ )
584 char * pNameF = Acb_ObjNameStr( pNtkF, Acb_NtkCi(pNtkF, i) );
585 char * pNameG = Acb_ObjNameStr( pNtkG, Acb_NtkCi(pNtkG, i) );
586 if (
strcmp(pNameF, pNameG) )
589 printf(
"Networks have different PI names. Reordering PIs of the implementation network.\n" );
595 printf(
"Networks have the same PI names.\n" );
622 if ( !pNtkF || !pNtkG )
625 assert( Acb_NtkCiNum(pNtkF) == Acb_NtkCiNum(pNtkG) );
626 assert( Acb_NtkCoNum(pNtkF) == Acb_NtkCoNum(pNtkG) );
ABC_DLL int Abc_NtkIvyProve(Abc_Ntk_t **ppNtk, void *pPars)
struct Abc_Ntk_t_ Abc_Ntk_t
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
#define ABC_SWAP(Type, a, b)
unsigned Abc_Random(int fReset)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Gia_ManDualXorN(Gia_Man_t *p, int *pLits, int n, int LitZ[2])
Gia_Man_t * Acb_NtkGiaDeriveMiter(Gia_Man_t *pOne, Gia_Man_t *pTwo, int Type)
void Gia_ManDualNot(Gia_Man_t *p, int LitA[2], int LitZ[2])
void Acb_NtkPrintCecStats(Acb_Ntk_t *pNtk)
void Gia_ManDualDc(Gia_Man_t *p, int LitC[2], int LitD[2], int LitZ[2])
int * Acb_NtkSolve(Gia_Man_t *p)
int Acb_NtkCheckPiOrder(Acb_Ntk_t *pNtkF, Acb_Ntk_t *pNtkG)
void Gia_ManSimTry(Gia_Man_t *pF, Gia_Man_t *pG)
FUNCTION DEFINITIONS ///.
void Gia_ManDualAndN(Gia_Man_t *p, int *pLits, int n, int LitZ[2])
void Gia_ManDualXor2(Gia_Man_t *p, int LitA[2], int LitB[2], int LitZ[2])
void Gia_ManDualAnd2(Gia_Man_t *p, int LitA[2], int LitB[2], int LitZ[2])
void Acb_NtkUpdateCiOrder(Acb_Ntk_t *pNtkF, Acb_Ntk_t *pNtkG)
void Acb_OutputFile(char *pFileName, Acb_Ntk_t *pNtkF, int *pModel)
void Acb_NtkRunTest(char *pFileNames[4], int fFancy, int fVerbose)
void Gia_ManDualMux(Gia_Man_t *p, int LitC[2], int LitT[2], int LitE[2], int LitZ[2])
Gia_Man_t * Acb_NtkGiaDeriveDual(Acb_Ntk_t *p)
int Gia_ManDualCompare(Gia_Man_t *p, int LitF[2], int LitS[2])
void Acb_ObjToGiaDual(Gia_Man_t *pNew, Acb_Ntk_t *p, int iObj, Vec_Int_t *vTemp, Vec_Int_t *vCopies, int pRes[2])
Vec_Int_t * Acb_NtkFindNodes2(Acb_Ntk_t *p)
Acb_Ntk_t * Acb_VerilogSimpleRead(char *pFileName, char *pFileNameW)
#define Acb_NtkForEachCi(p, iObj, i)
struct Acb_Ntk_t_ Acb_Ntk_t
#define Acb_NtkForEachCo(p, iObj, i)
#define Acb_NtkForEachPi(p, iObj, i)
#define Acb_NtkForEachNode(p, i)
#define Acb_ObjForEachFaninFast(p, iObj, pFanins, iFanin, k)
void Aig_ManStop(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
void Prove_ParamsSetDefault(Prove_Params_t *pParams)
FUNCTION DEFINITIONS ///.
Aig_Man_t * Gia_ManToAig(Gia_Man_t *p, int fChoices)
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
DECLARATIONS ///.
void Gia_ManStop(Gia_Man_t *p)
#define Gia_ManForEachAnd(p, pObj, i)
void Gia_ManHashAlloc(Gia_Man_t *p)
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
int Gia_ManHashOr(Gia_Man_t *p, int iLit0, int iLit1)
struct Gia_Obj_t_ Gia_Obj_t
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
struct Gia_Man_t_ Gia_Man_t
Vec_Wrd_t * Gia_ManSimPatSim(Gia_Man_t *p)
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
#define Gia_ManForEachCo(p, pObj, i)
#define Gia_ManForEachCi(p, pObj, i)
void Gia_ManHashStop(Gia_Man_t *p)
void Gia_AigerWrite(Gia_Man_t *p, char *pFileName, int fWriteSymbols, int fCompact, int fWriteNewLine)
struct Prove_ParamsStruct_t_ Prove_Params_t
unsigned __int64 word
DECLARATIONS ///.
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.