Commit 094bdc05 by Alan Mishchenko

New command 'testnpn' to compare semi-canonical forms.

parent c4b4ac70
...@@ -396,7 +396,7 @@ Ga2_Man_t * Ga2_ManStart( Gia_Man_t * pGia, Gia_ParVta_t * pPars ) ...@@ -396,7 +396,7 @@ Ga2_Man_t * Ga2_ManStart( Gia_Man_t * pGia, Gia_ParVta_t * pPars )
Vec_IntPush( p->vAbs, 0 ); Vec_IntPush( p->vAbs, 0 );
// refinement // refinement
p->pRnm = Rnm_ManStart( pGia ); p->pRnm = Rnm_ManStart( pGia );
// p->pRf2 = Rf2_ManStart( pGia ); p->pRf2 = Rf2_ManStart( pGia );
// SAT solver and variables // SAT solver and variables
p->vId2Lit = Vec_PtrAlloc( 1000 ); p->vId2Lit = Vec_PtrAlloc( 1000 );
// temporaries // temporaries
...@@ -459,7 +459,7 @@ void Ga2_ManStop( Ga2_Man_t * p ) ...@@ -459,7 +459,7 @@ void Ga2_ManStop( Ga2_Man_t * p )
Vec_IntFree( p->vLits ); Vec_IntFree( p->vLits );
Vec_IntFree( p->vIsopMem ); Vec_IntFree( p->vIsopMem );
Rnm_ManStop( p->pRnm, p->pPars->fVerbose ); Rnm_ManStop( p->pRnm, p->pPars->fVerbose );
// Rf2_ManStop( p->pRf2, p->pPars->fVerbose ); Rf2_ManStop( p->pRf2, p->pPars->fVerbose );
ABC_FREE( p->pTable ); ABC_FREE( p->pTable );
ABC_FREE( p->pSopSizes ); ABC_FREE( p->pSopSizes );
ABC_FREE( p->pSops[1] ); ABC_FREE( p->pSops[1] );
...@@ -1216,7 +1216,7 @@ Abc_Cex_t * Ga2_ManDeriveCex( Ga2_Man_t * p, Vec_Int_t * vPis ) ...@@ -1216,7 +1216,7 @@ Abc_Cex_t * Ga2_ManDeriveCex( Ga2_Man_t * p, Vec_Int_t * vPis )
Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Gia_ObjCioId(pObj) ); Abc_InfoSetBit( pCex->pData, pCex->nRegs + f * pCex->nPis + Gia_ObjCioId(pObj) );
} }
return pCex; return pCex;
} }
Vec_Int_t * Ga2_ManRefine( Ga2_Man_t * p ) Vec_Int_t * Ga2_ManRefine( Ga2_Man_t * p )
{ {
Abc_Cex_t * pCex; Abc_Cex_t * pCex;
...@@ -1224,8 +1224,11 @@ Vec_Int_t * Ga2_ManRefine( Ga2_Man_t * p ) ...@@ -1224,8 +1224,11 @@ Vec_Int_t * Ga2_ManRefine( Ga2_Man_t * p )
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int i; int i;
Ga2_GlaPrepareCexAndMap( p, &pCex, &vMap ); Ga2_GlaPrepareCexAndMap( p, &pCex, &vMap );
vVec = Rnm_ManRefine( p->pRnm, pCex, vMap, p->pPars->fPropFanout, 1 );
// Rf2_ManRefine( p->pRf2, pCex, vMap, p->pPars->fPropFanout, 1 ); // Rf2_ManRefine( p->pRf2, pCex, vMap, p->pPars->fPropFanout, 1 );
vVec = Rnm_ManRefine( p->pRnm, pCex, vMap, p->pPars->fPropFanout, 1 );
// printf( "Refinement %d\n", Vec_IntSize(vVec) );
Abc_CexFree( pCex ); Abc_CexFree( pCex );
if ( Vec_IntSize(vVec) == 0 ) if ( Vec_IntSize(vVec) == 0 )
{ {
......
...@@ -385,8 +385,9 @@ void Rf2_ManGatherFanins_rec( Rf2_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vFani ...@@ -385,8 +385,9 @@ void Rf2_ManGatherFanins_rec( Rf2_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vFani
return; return;
if ( Gia_ObjIsRo(p->pGia, pObj) ) if ( Gia_ObjIsRo(p->pGia, pObj) )
{ {
assert( pObj->fPhase );
pObj = Gia_ObjRoToRi(p->pGia, pObj); pObj = Gia_ObjRoToRi(p->pGia, pObj);
Rf2_ManGatherFanins_rec( p, Gia_ObjFanin0(pObj), vFanins, Depth, RootId, 0 ); Rf2_ManGatherFanins_rec( p, Gia_ObjFanin0(pObj), vFanins, Depth - 1, RootId, 0 );
} }
else if ( Gia_ObjIsAnd(pObj) ) else if ( Gia_ObjIsAnd(pObj) )
{ {
...@@ -397,9 +398,10 @@ void Rf2_ManGatherFanins_rec( Rf2_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vFani ...@@ -397,9 +398,10 @@ void Rf2_ManGatherFanins_rec( Rf2_Man_t * p, Gia_Obj_t * pObj, Vec_Int_t * vFani
} }
void Rf2_ManGatherFanins( Rf2_Man_t * p, int Depth ) void Rf2_ManGatherFanins( Rf2_Man_t * p, int Depth )
{ {
Vec_Int_t * vUsed;
Vec_Int_t * vVec; Vec_Int_t * vVec;
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int i; int i, k, Entry;
// mark PPIs // mark PPIs
Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i ) Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i )
{ {
...@@ -416,24 +418,40 @@ void Rf2_ManGatherFanins( Rf2_Man_t * p, int Depth ) ...@@ -416,24 +418,40 @@ void Rf2_ManGatherFanins( Rf2_Man_t * p, int Depth )
Gia_ManIncrementTravId( p->pGia ); Gia_ManIncrementTravId( p->pGia );
Rf2_ManGatherFanins_rec( p, pObj, p->vFanins, Depth, i, 1 ); Rf2_ManGatherFanins_rec( p, pObj, p->vFanins, Depth, i, 1 );
} }
vUsed = Vec_IntStart( Vec_IntSize(p->vMap) );
// evaluate collected // evaluate collected
printf( "\nMap: " ); printf( "\nMap (%d): ", Vec_IntSize(p->vMap) );
Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i ) Gia_ManForEachObjVec( p->vMap, p->pGia, pObj, i )
{ {
vVec = Rf2_ObjVec( p, pObj ); vVec = Rf2_ObjVec( p, pObj );
printf( "%d=%d ", i, Vec_IntSize(vVec) - 1 ); if ( Vec_IntSize(vVec) > 1 )
printf( "%d=%d ", i, Vec_IntSize(vVec) - 1 );
Vec_IntForEachEntryStart( vVec, Entry, k, 1 )
Vec_IntAddToEntry( vUsed, Entry, 1 );
Vec_IntClear( vVec ); Vec_IntClear( vVec );
} }
printf( "\n" ); printf( "\n" );
// evaluate internal // evaluate internal
printf( "Int: " ); printf( "Int (%d): ", Vec_IntSize(p->vFanins) );
Gia_ManForEachObjVec( p->vFanins, p->pGia, pObj, i ) Gia_ManForEachObjVec( p->vFanins, p->pGia, pObj, i )
{ {
vVec = Rf2_ObjVec( p, pObj ); vVec = Rf2_ObjVec( p, pObj );
printf( "%d=%d ", i, Vec_IntSize(vVec) ); if ( Vec_IntSize(vVec) > 1 )
printf( "%d=%d ", i, Vec_IntSize(vVec) );
if ( Vec_IntSize(vVec) > 1 )
Vec_IntForEachEntry( vVec, Entry, k )
Vec_IntAddToEntry( vUsed, Entry, 1 );
Vec_IntClear( vVec ); Vec_IntClear( vVec );
} }
printf( "\n" ); printf( "\n" );
// evaluate PPIs
Vec_IntForEachEntry( vUsed, Entry, k )
printf( "%d ", Entry );
printf( "\n" );
Vec_IntFree( vUsed );
} }
...@@ -461,7 +479,7 @@ Vec_Int_t * Rf2_ManRefine( Rf2_Man_t * p, Abc_Cex_t * pCex, Vec_Int_t * vMap, in ...@@ -461,7 +479,7 @@ Vec_Int_t * Rf2_ManRefine( Rf2_Man_t * p, Abc_Cex_t * pCex, Vec_Int_t * vMap, in
// collects used objects // collects used objects
Rf2_ManCollect( p ); Rf2_ManCollect( p );
// collect reconvergence points // collect reconvergence points
Rf2_ManGatherFanins( p, 1 ); Rf2_ManGatherFanins( p, 2 );
// propagate justification IDs // propagate justification IDs
// select the result // select the result
......
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