Commit 9cb52998 by Alan Mishchenko

Other improvements to &vta and &gla.

parent bd4b2521
......@@ -515,6 +515,66 @@ static inline int Gia_XsimAndCond( int Value0, int fCompl0, int Value1, int fCom
return GIA_ONE;
}
static inline void Gia_ObjTerSimSetC( Gia_Obj_t * pObj ) { pObj->fMark0 = 0; pObj->fMark1 = 0; }
static inline void Gia_ObjTerSimSet0( Gia_Obj_t * pObj ) { pObj->fMark0 = 1; pObj->fMark1 = 0; }
static inline void Gia_ObjTerSimSet1( Gia_Obj_t * pObj ) { pObj->fMark0 = 0; pObj->fMark1 = 1; }
static inline void Gia_ObjTerSimSetX( Gia_Obj_t * pObj ) { pObj->fMark0 = 1; pObj->fMark1 = 1; }
static inline int Gia_ObjTerSimGetC( Gia_Obj_t * pObj ) { return !pObj->fMark0 && !pObj->fMark1; }
static inline int Gia_ObjTerSimGet0( Gia_Obj_t * pObj ) { return pObj->fMark0 && !pObj->fMark1; }
static inline int Gia_ObjTerSimGet1( Gia_Obj_t * pObj ) { return !pObj->fMark0 && pObj->fMark1; }
static inline int Gia_ObjTerSimGetX( Gia_Obj_t * pObj ) { return pObj->fMark0 && pObj->fMark1; }
static inline int Gia_ObjTerSimGet0Fanin0( Gia_Obj_t * pObj ) { return (Gia_ObjTerSimGet1(Gia_ObjFanin0(pObj)) && Gia_ObjFaninC0(pObj)) || (Gia_ObjTerSimGet0(Gia_ObjFanin0(pObj)) && !Gia_ObjFaninC0(pObj)); }
static inline int Gia_ObjTerSimGet1Fanin0( Gia_Obj_t * pObj ) { return (Gia_ObjTerSimGet0(Gia_ObjFanin0(pObj)) && Gia_ObjFaninC0(pObj)) || (Gia_ObjTerSimGet1(Gia_ObjFanin0(pObj)) && !Gia_ObjFaninC0(pObj)); }
static inline int Gia_ObjTerSimGet0Fanin1( Gia_Obj_t * pObj ) { return (Gia_ObjTerSimGet1(Gia_ObjFanin1(pObj)) && Gia_ObjFaninC1(pObj)) || (Gia_ObjTerSimGet0(Gia_ObjFanin1(pObj)) && !Gia_ObjFaninC1(pObj)); }
static inline int Gia_ObjTerSimGet1Fanin1( Gia_Obj_t * pObj ) { return (Gia_ObjTerSimGet0(Gia_ObjFanin1(pObj)) && Gia_ObjFaninC1(pObj)) || (Gia_ObjTerSimGet1(Gia_ObjFanin1(pObj)) && !Gia_ObjFaninC1(pObj)); }
static inline void Gia_ObjTerSimAnd( Gia_Obj_t * pObj )
{
assert( Gia_ObjIsAnd(pObj) );
assert( !Gia_ObjTerSimGetC( Gia_ObjFanin0(pObj) ) );
assert( !Gia_ObjTerSimGetC( Gia_ObjFanin1(pObj) ) );
if ( Gia_ObjTerSimGet0Fanin0(pObj) || Gia_ObjTerSimGet0Fanin1(pObj) )
Gia_ObjTerSimSet0( pObj );
else if ( Gia_ObjTerSimGet1Fanin0(pObj) && Gia_ObjTerSimGet1Fanin1(pObj) )
Gia_ObjTerSimSet1( pObj );
else
Gia_ObjTerSimSetX( pObj );
}
static inline void Gia_ObjTerSimCo( Gia_Obj_t * pObj )
{
assert( Gia_ObjIsCo(pObj) );
assert( !Gia_ObjTerSimGetC( Gia_ObjFanin0(pObj) ) );
if ( Gia_ObjTerSimGet0Fanin0(pObj) )
Gia_ObjTerSimSet0( pObj );
else if ( Gia_ObjTerSimGet1Fanin0(pObj) )
Gia_ObjTerSimSet1( pObj );
else
Gia_ObjTerSimSetX( pObj );
}
static inline void Gia_ObjTerSimRo( Gia_Man_t * p, Gia_Obj_t * pObj )
{
Gia_Obj_t * pTemp = Gia_ObjRoToRi(p, pObj);
assert( Gia_ObjIsRo(p, pObj) );
assert( !Gia_ObjTerSimGetC( pTemp ) );
pObj->fMark0 = pTemp->fMark0;
pObj->fMark1 = pTemp->fMark1;
}
static inline void Gia_ObjTerSimPrint( Gia_Obj_t * pObj )
{
if ( Gia_ObjTerSimGet0(pObj) )
printf( "0" );
else if ( Gia_ObjTerSimGet1(pObj) )
printf( "1" );
else if ( Gia_ObjTerSimGetX(pObj) )
printf( "X" );
}
static inline Gia_Obj_t * Gia_ObjReprObj( Gia_Man_t * p, int Id ) { return p->pReprs[Id].iRepr == GIA_VOID ? NULL : Gia_ManObj( p, p->pReprs[Id].iRepr ); }
static inline int Gia_ObjRepr( Gia_Man_t * p, int Id ) { return p->pReprs[Id].iRepr; }
static inline void Gia_ObjSetRepr( Gia_Man_t * p, int Id, int Num ) { assert( Num == GIA_VOID || Num < Id ); p->pReprs[Id].iRepr = Num; }
......
......@@ -532,8 +532,8 @@ static inline void Vta_ObjPreds( Vta_Man_t * p, Vta_Obj_t * pThis, Gia_Obj_t * p
{
*ppThis0 = NULL;
*ppThis1 = NULL;
if ( !pThis->fAdded )
return;
// if ( !pThis->fAdded )
// return;
assert( !Gia_ObjIsPi(p->pGia, pObj) );
if ( Gia_ObjIsConst0(pObj) || (Gia_ObjIsCi(pObj) && pThis->iFrame == 0) )
return;
......@@ -541,13 +541,13 @@ static inline void Vta_ObjPreds( Vta_Man_t * p, Vta_Obj_t * pThis, Gia_Obj_t * p
{
*ppThis0 = Vga_ManFind( p, Gia_ObjFaninId0p(p->pGia, pObj), pThis->iFrame );
*ppThis1 = Vga_ManFind( p, Gia_ObjFaninId1p(p->pGia, pObj), pThis->iFrame );
assert( *ppThis0 && *ppThis1 );
// assert( *ppThis0 && *ppThis1 );
return;
}
assert( Gia_ObjIsRo(p->pGia, pObj) && pThis->iFrame > 0 );
pObj = Gia_ObjRoToRi( p->pGia, pObj );
*ppThis0 = Vga_ManFind( p, Gia_ObjFaninId0p(p->pGia, pObj), pThis->iFrame-1 );
assert( *ppThis0 );
// assert( *ppThis0 );
}
/**Function*************************************************************
......@@ -569,9 +569,12 @@ void Vta_ManCollectNodes_rec( Vta_Man_t * p, Vta_Obj_t * pThis, Vec_Int_t * vOrd
return;
pThis->fVisit = 1;
pObj = Gia_ManObj( p->pGia, pThis->iObj );
Vta_ObjPreds( p, pThis, pObj, &pThis0, &pThis1 );
if ( pThis0 ) Vta_ManCollectNodes_rec( p, pThis0, vOrder );
if ( pThis1 ) Vta_ManCollectNodes_rec( p, pThis1, vOrder );
if ( pThis->fAdded )
{
Vta_ObjPreds( p, pThis, pObj, &pThis0, &pThis1 );
if ( pThis0 ) Vta_ManCollectNodes_rec( p, pThis0, vOrder );
if ( pThis1 ) Vta_ManCollectNodes_rec( p, pThis1, vOrder );
}
Vec_IntPush( vOrder, Vta_ObjId(p, pThis) );
}
Vec_Int_t * Vta_ManCollectNodes( Vta_Man_t * p, int f )
......@@ -728,6 +731,41 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
if ( pThis1 )
pThis1->Prio = Abc_MinInt( pThis1->Prio, pThis->Prio + 1 );
}
/*
// update priorities according to reconvergest counters
Vec_PtrForEachEntry( Vta_Obj_t *, vTermsUsed, pThis, i )
{
Vta_Obj_t * pThis0, * pThis1;
Gia_Obj_t * pObj = Gia_ManObj( p->pGia, pThis->iObj );
Vta_ObjPreds( p, pThis, pObj, &pThis0, &pThis1 );
pThis->Prio += 10000000;
if ( pThis0 )
pThis->Prio -= 1000000 * pThis0->fAdded;
if ( pThis1 )
pThis->Prio -= 1000000 * pThis1->fAdded;
}
Vec_PtrForEachEntry( Vta_Obj_t *, vTermsUnused, pThis, i )
{
Vta_Obj_t * pThis0, * pThis1;
Gia_Obj_t * pObj = Gia_ManObj( p->pGia, pThis->iObj );
Vta_ObjPreds( p, pThis, pObj, &pThis0, &pThis1 );
pThis->Prio += 10000000;
if ( pThis0 )
pThis->Prio -= 1000000 * pThis0->fAdded;
if ( pThis1 )
pThis->Prio -= 1000000 * pThis1->fAdded;
}
*/
/*
// update priorities according to reconvergest counters
Vec_PtrForEachEntry( Vta_Obj_t *, vTermsUsed, pThis, i )
pThis->Prio = pThis->iObj;
Vec_PtrForEachEntry( Vta_Obj_t *, vTermsUnused, pThis, i )
pThis->Prio = pThis->iObj;
*/
// objects with equal distance should receive priority based on number
// those objects whose prototypes have been added in other timeframes
// should have higher priority than the current object
......@@ -747,9 +785,6 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
pThis->Prio = Counter++;
// Abc_Print( 1, "Used %d Unused %d\n", Vec_PtrSize(vTermsUsed), Vec_PtrSize(vTermsUnused) );
Vec_PtrFree( vTermsUsed );
Vec_PtrFree( vTermsUnused );
// propagate in the direct order
Vta_ManForEachObjObjVec( vOrder, p, pThis, pObj, i )
......@@ -885,6 +920,33 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
assert( 0 );
}
// mark those currently included
Vta_ManForEachObjVec( vTermsToAdd, p, pThis, i )
{
assert( pThis->fVisit == 0 );
pThis->fVisit = 1;
}
// add used terms, which have close relationship
Counter = Vec_IntSize(vTermsToAdd);
Vec_PtrForEachEntry( Vta_Obj_t *, vTermsUsed, pThis, i )
{
if ( pThis->fVisit )
continue;
// Vta_ObjPreds( p, pThis, Gia_ManObj(p->pGia, pThis->iObj), &pThis0, &pThis1 );
// if ( (pThis0 && (pThis0->fAdded || pThis0->fVisit)) || (pThis1 && (pThis1->fAdded || pThis1->fVisit)) )
Vec_IntPush( vTermsToAdd, Vta_ObjId(p, pThis) );
}
// remove those currenty included
Vta_ManForEachObjVec( vTermsToAdd, p, pThis, i )
pThis->fVisit = 0;
// printf( "\n%d -> %d\n", Counter, Vec_IntSize(vTermsToAdd) );
//Vec_IntReverseOrder( vTermsToAdd );
//Vec_IntSort( vTermsToAdd, 1 );
// cleanup
Vec_PtrFree( vTermsUsed );
Vec_PtrFree( vTermsUnused );
if ( fVerify )
{
......@@ -955,7 +1017,6 @@ Abc_Cex_t * Vta_ManRefineAbstraction( Vta_Man_t * p, int f )
pCex = Vga_ManDeriveCex( p );
else
{
// int nObjOld = p->nObjs;
Vta_ManForEachObjObjVec( vTermsToAdd, p, pThis, pObj, i )
if ( !Gia_ObjIsPi(p->pGia, pObj) )
Vga_ManAddClausesOne( p, pThis->iObj, pThis->iFrame );
......
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