Trasferring equivalence in the special-case usage of &scorr.

This commit is contained in:
Alan Mishchenko 2024-09-12 18:11:59 -07:00
parent 0d10253bd0
commit 9c152b71e9
2 changed files with 50 additions and 0 deletions

View File

@ -2732,6 +2732,54 @@ void Gia_ManTransferTest( Gia_Man_t * p )
Gia_ManStop( pNew );
}
/**Function*************************************************************
Synopsis [Transfer from new to old.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManTransferEquivs2( Gia_Man_t * p, Gia_Man_t * pOld )
{
Gia_Obj_t * pObj;
Vec_Int_t * vClass;
int i, k, iNode, iRepr;
assert( p->pReprs != NULL );
assert( p->pNexts != NULL );
assert( pOld->pReprs == NULL );
assert( pOld->pNexts == NULL );
// create map
Gia_ManFillValue( p );
Gia_ManForEachObj( pOld, pObj, i )
if ( ~pObj->Value )
Gia_ManObj(p, Abc_Lit2Var(pObj->Value))->Value = Abc_Var2Lit(i, 0);
// start representatives
pOld->pReprs = ABC_CALLOC( Gia_Rpr_t, Gia_ManObjNum(pOld) );
for ( i = 0; i < Gia_ManObjNum(pOld); i++ )
Gia_ObjSetRepr( pOld, i, GIA_VOID );
// iterate over constant candidates
Gia_ManForEachConst( p, i )
Gia_ObjSetRepr( pOld, Abc_Lit2Var(Gia_ManObj(p, i)->Value), 0 );
// iterate over class candidates
vClass = Vec_IntAlloc( 100 );
Gia_ManForEachClass( p, i )
{
Vec_IntClear( vClass );
Gia_ClassForEachObj( p, i, k )
Vec_IntPushUnique( vClass, Abc_Lit2Var(Gia_ManObj(p, k)->Value) );
assert( Vec_IntSize( vClass ) > 1 );
Vec_IntSort( vClass, 0 );
iRepr = Vec_IntEntry( vClass, 0 );
Vec_IntForEachEntryStart( vClass, iNode, k, 1 )
Gia_ObjSetRepr( pOld, iNode, iRepr );
}
Vec_IntFree( vClass );
pOld->pNexts = Gia_ManDeriveNexts( pOld );
}
/**Function*************************************************************

View File

@ -38616,6 +38616,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
Vec_Int_t * vStops = Gia_ManFindStopFlops( pAbc->pGia, nFlopIncFreq, pPars->fVerbose );
if ( vStops )
{
extern void Gia_ManTransferEquivs2( Gia_Man_t * p, Gia_Man_t * pNew );
Gia_Man_t * pUsed = Gia_ManDupStopsAdd( pAbc->pGia, vStops );
if ( pPars->nPartSize > 0 )
pTemp = Gia_SignalCorrespondencePart( pUsed, pPars );
@ -38625,6 +38626,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
pTemp = Gia_ManScorrDivideTest( pUsed, pPars );
else
pTemp = Cec_ManLSCorrespondence( pUsed, pPars );
Gia_ManTransferEquivs2( pUsed, pAbc->pGia );
Gia_ManStop( pUsed );
pTemp = Gia_ManDupStopsRem( pUsed = pTemp, vStops );
Gia_ManStop( pUsed );