Commit 4e9f9724 by Alan Mishchenko

Changes to enable CEX minimization.

parent 8af417ba
...@@ -105,6 +105,7 @@ static inline int Saig_ObjIsLo( Aig_Man_t * p, Aig_Obj_t * pObj ) { ...@@ -105,6 +105,7 @@ static inline int Saig_ObjIsLo( Aig_Man_t * p, Aig_Obj_t * pObj ) {
static inline int Saig_ObjIsLi( Aig_Man_t * p, Aig_Obj_t * pObj ) { return Aig_ObjIsPo(pObj) && Aig_ObjPioNum(pObj) >= Saig_ManPoNum(p); } static inline int Saig_ObjIsLi( Aig_Man_t * p, Aig_Obj_t * pObj ) { return Aig_ObjIsPo(pObj) && Aig_ObjPioNum(pObj) >= Saig_ManPoNum(p); }
static inline Aig_Obj_t * Saig_ObjLoToLi( Aig_Man_t * p, Aig_Obj_t * pObj ) { assert(Saig_ObjIsLo(p, pObj)); return (Aig_Obj_t *)Vec_PtrEntry(p->vPos, Saig_ManPoNum(p)+Aig_ObjPioNum(pObj)-Saig_ManPiNum(p)); } static inline Aig_Obj_t * Saig_ObjLoToLi( Aig_Man_t * p, Aig_Obj_t * pObj ) { assert(Saig_ObjIsLo(p, pObj)); return (Aig_Obj_t *)Vec_PtrEntry(p->vPos, Saig_ManPoNum(p)+Aig_ObjPioNum(pObj)-Saig_ManPiNum(p)); }
static inline Aig_Obj_t * Saig_ObjLiToLo( Aig_Man_t * p, Aig_Obj_t * pObj ) { assert(Saig_ObjIsLi(p, pObj)); return (Aig_Obj_t *)Vec_PtrEntry(p->vPis, Saig_ManPiNum(p)+Aig_ObjPioNum(pObj)-Saig_ManPoNum(p)); } static inline Aig_Obj_t * Saig_ObjLiToLo( Aig_Man_t * p, Aig_Obj_t * pObj ) { assert(Saig_ObjIsLi(p, pObj)); return (Aig_Obj_t *)Vec_PtrEntry(p->vPis, Saig_ManPiNum(p)+Aig_ObjPioNum(pObj)-Saig_ManPoNum(p)); }
static inline int Saig_ObjRegId( Aig_Man_t * p, Aig_Obj_t * pObj ) { if ( Saig_ObjIsLo(p, pObj) ) return Aig_ObjPioNum(pObj)-Saig_ManPiNum(p); if ( Saig_ObjIsLi(p, pObj) ) return Aig_ObjPioNum(pObj)-Saig_ManPoNum(p); else assert(0); return -1; }
// iterator over the primary inputs/outputs // iterator over the primary inputs/outputs
#define Saig_ManForEachPi( p, pObj, i ) \ #define Saig_ManForEachPi( p, pObj, i ) \
......
...@@ -151,6 +151,16 @@ Abc_Cex_t * Saig_ManCbaReason2Cex( Saig_ManCba_t * p, Vec_Int_t * vReasons ) ...@@ -151,6 +151,16 @@ Abc_Cex_t * Saig_ManCbaReason2Cex( Saig_ManCba_t * p, Vec_Int_t * vReasons )
iFrame = Vec_IntEntry( p->vMapPiF2A, 2*Entry+1 ); iFrame = Vec_IntEntry( p->vMapPiF2A, 2*Entry+1 );
Aig_InfoSetBit( pCare->pData, pCare->nRegs + pCare->nPis * iFrame + iInput ); Aig_InfoSetBit( pCare->pData, pCare->nRegs + pCare->nPis * iFrame + iInput );
} }
/*
for ( iFrame = 0; iFrame <= pCare->iFrame; iFrame++ )
{
int Count = 0;
for ( i = 0; i < pCare->nPis; i++ )
Count += Aig_InfoHasBit(pCare->pData, pCare->nRegs + pCare->nPis * iFrame + i);
printf( "%d ", Count );
}
printf( "\n" );
*/
return pCare; return pCare;
} }
...@@ -216,28 +226,19 @@ void Saig_ManCbaFindReason_rec( Aig_Man_t * p, Aig_Obj_t * pObj, Vec_Int_t * vPr ...@@ -216,28 +226,19 @@ void Saig_ManCbaFindReason_rec( Aig_Man_t * p, Aig_Obj_t * pObj, Vec_Int_t * vPr
Vec_Int_t * Saig_ManCbaFindReason( Saig_ManCba_t * p ) Vec_Int_t * Saig_ManCbaFindReason( Saig_ManCba_t * p )
{ {
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
Vec_Int_t * vPrios, * vPi2Prio, * vReasons; Vec_Int_t * vPrios, * vReasons;
int i, CountPrios; int i;
vPi2Prio = Vec_IntStartFull( Saig_ManPiNum(p->pAig) );
vPrios = Vec_IntStartFull( Aig_ManObjNumMax(p->pFrames) );
// set PI values according to CEX // set PI values according to CEX
CountPrios = 0; vPrios = Vec_IntStartFull( Aig_ManObjNumMax(p->pFrames) );
Aig_ManConst1(p->pFrames)->fPhase = 1; Aig_ManConst1(p->pFrames)->fPhase = 1;
Aig_ManForEachPi( p->pFrames, pObj, i ) Aig_ManForEachPi( p->pFrames, pObj, i )
{ {
int iInput = Vec_IntEntry( p->vMapPiF2A, 2*i ); int iInput = Vec_IntEntry( p->vMapPiF2A, 2*i );
int iFrame = Vec_IntEntry( p->vMapPiF2A, 2*i+1 ); int iFrame = Vec_IntEntry( p->vMapPiF2A, 2*i+1 );
pObj->fPhase = Aig_InfoHasBit( p->pCex->pData, p->pCex->nRegs + p->pCex->nPis * iFrame + iInput ); pObj->fPhase = Aig_InfoHasBit( p->pCex->pData, p->pCex->nRegs + p->pCex->nPis * iFrame + iInput );
// assign priority
if ( Vec_IntEntry(vPi2Prio, iInput) == ~0 )
Vec_IntWriteEntry( vPi2Prio, iInput, CountPrios++ );
// Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), Vec_IntEntry(vPi2Prio, iInput) );
Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), i ); Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), i );
} }
// printf( "Priority numbers = %d.\n", CountPrios );
Vec_IntFree( vPi2Prio );
// traverse and set the priority // traverse and set the priority
Aig_ManForEachNode( p->pFrames, pObj, i ) Aig_ManForEachNode( p->pFrames, pObj, i )
...@@ -341,7 +342,9 @@ Aig_Man_t * Saig_ManCbaUnrollWithCex( Aig_Man_t * pAig, Abc_Cex_t * pCex, int nI ...@@ -341,7 +342,9 @@ Aig_Man_t * Saig_ManCbaUnrollWithCex( Aig_Man_t * pAig, Abc_Cex_t * pCex, int nI
Saig_ManCbaUnrollCollect_rec( pAig, pObj, Saig_ManCbaUnrollCollect_rec( pAig, pObj,
Vec_VecEntryInt(vFrameObjs, f), Vec_VecEntryInt(vFrameObjs, f),
(Vec_Int_t *)(f ? Vec_VecEntry(vFrameCos, f-1) : NULL) ); (Vec_Int_t *)(f ? Vec_VecEntry(vFrameCos, f-1) : NULL) );
//printf( "%d ", Vec_VecLevelSize(vFrameCos, f) );
} }
//printf( "\n" );
// derive unrolled timeframes // derive unrolled timeframes
pFrames = Aig_ManStart( 10000 ); pFrames = Aig_ManStart( 10000 );
......
...@@ -20701,11 +20701,12 @@ int Abc_CommandCexMin( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -20701,11 +20701,12 @@ int Abc_CommandCexMin( Abc_Frame_t * pAbc, int argc, char ** argv )
else if ( iPoOld != pAbc->pCex->iPo ) else if ( iPoOld != pAbc->pCex->iPo )
Abc_Print( 0, "Main AIG: The cex refined PO %d instead of PO %d.\n", pAbc->pCex->iPo, iPoOld ); Abc_Print( 0, "Main AIG: The cex refined PO %d instead of PO %d.\n", pAbc->pCex->iPo, iPoOld );
// perform minimization // perform minimization
// vCexNew = Saig_ManCexMinPerform( pAig, pAbc->pCex ); vCexNew = Saig_ManCexMinPerform( pAig, pAbc->pCex );
Aig_ManStop( pAig ); Aig_ManStop( pAig );
Abc_CexFree( vCexNew );
// Abc_FrameReplaceCex( pAbc, &vCexNew ); // Abc_FrameReplaceCex( pAbc, &vCexNew );
printf( "Implementation of this command is not finished.\n" ); // printf( "Implementation of this command is not finished.\n" );
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment