Commit e3e4a987 by Alan Mishchenko

Scalable gate-level abstraction.

parent dc56a655
...@@ -554,7 +554,7 @@ Vec_Int_t * Ga2_ManCnfCompute( unsigned uTruth, int nVars, Vec_Int_t * vCover ) ...@@ -554,7 +554,7 @@ Vec_Int_t * Ga2_ManCnfCompute( unsigned uTruth, int nVars, Vec_Int_t * vCover )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
static inline void Ga2_ManCnfAddDynamic( Ga2_Man_t * p, int uTruth, int Lits[], int iLitOut, int ProofId ) static inline void Ga2_ManCnfAddDynamic( Ga2_Man_t * p, int uTruth, int Lits[], int iLitOut )
{ {
int i, k, b, Cube, nClaLits, ClaLits[6]; int i, k, b, Cube, nClaLits, ClaLits[6];
assert( uTruth > 0 && uTruth < 0xffff ); assert( uTruth > 0 && uTruth < 0xffff );
...@@ -583,7 +583,7 @@ static inline void Ga2_ManCnfAddDynamic( Ga2_Man_t * p, int uTruth, int Lits[], ...@@ -583,7 +583,7 @@ static inline void Ga2_ManCnfAddDynamic( Ga2_Man_t * p, int uTruth, int Lits[],
} }
Cube = Cube / 3; Cube = Cube / 3;
} }
sat_solver2_addclause( p->pSat, ClaLits, ClaLits+nClaLits, ProofId ); sat_solver2_addclause( p->pSat, ClaLits, ClaLits+nClaLits, -1 );
} }
} }
} }
...@@ -702,19 +702,11 @@ void Ga2_ManAddAbsClauses( Ga2_Man_t * p, int f ) ...@@ -702,19 +702,11 @@ void Ga2_ManAddAbsClauses( Ga2_Man_t * p, int f )
int fSimple = 1; int fSimple = 1;
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int i, Lit; int i, Lit;
/*
Vec_Int_t * vMap = (f < Vec_PtrSize(p->vId2Lit) ? Ga2_MapFrameMap( p, f ) : NULL);
// Ga2_ObjAddLit( p, Gia_ManConst0(p->pGia), f, 0 );
if ( f == 5 )
{
int s = 0;
}
*/
if ( fSimple ) if ( fSimple )
{ {
Lit = Ga2_ObjFindOrAddLit( p, Gia_ManConst0(p->pGia), f ); Lit = Ga2_ObjFindOrAddLit( p, Gia_ManConst0(p->pGia), f );
Lit = Abc_LitNot( Lit ); Lit = Abc_LitNot( Lit );
sat_solver2_addclause( p->pSat, &Lit, &Lit + 1, 0 ); sat_solver2_addclause( p->pSat, &Lit, &Lit + 1, -1 );
} }
Gia_ManForEachObjVec( p->vAbs, p->pGia, pObj, i ) Gia_ManForEachObjVec( p->vAbs, p->pGia, pObj, i )
if ( i >= p->LimAbs ) if ( i >= p->LimAbs )
...@@ -822,11 +814,7 @@ Vec_Int_t * Ga2_ManAbsTranslate( Ga2_Man_t * p ) ...@@ -822,11 +814,7 @@ Vec_Int_t * Ga2_ManAbsTranslate( Ga2_Man_t * p )
if ( Gia_ObjIsAnd(pObj) ) if ( Gia_ObjIsAnd(pObj) )
Ga2_ManAbsTranslate_rec( p->pGia, pObj, vGateClasses, 1 ); Ga2_ManAbsTranslate_rec( p->pGia, pObj, vGateClasses, 1 );
else if ( Gia_ObjIsRo(p->pGia, pObj) ) else if ( Gia_ObjIsRo(p->pGia, pObj) )
{
Vec_IntWriteEntry( vGateClasses, Gia_ObjId(p->pGia, pObj), 1 ); Vec_IntWriteEntry( vGateClasses, Gia_ObjId(p->pGia, pObj), 1 );
pObj = Gia_ObjRoToRi( p->pGia, pObj );
Vec_IntWriteEntry( vGateClasses, Gia_ObjFaninId0p(p->pGia, pObj), 1 );
}
else if ( !Gia_ObjIsConst0(pObj) ) else if ( !Gia_ObjIsConst0(pObj) )
assert( 0 ); assert( 0 );
} }
...@@ -859,7 +847,7 @@ void Ga2_ManRestart( Ga2_Man_t * p ) ...@@ -859,7 +847,7 @@ void Ga2_ManRestart( Ga2_Man_t * p )
if ( p->pSat ) sat_solver2_delete( p->pSat ); if ( p->pSat ) sat_solver2_delete( p->pSat );
p->pSat = sat_solver2_new(); p->pSat = sat_solver2_new();
// add clause x0 = 0 (lit0 = 1; lit1 = 0) // add clause x0 = 0 (lit0 = 1; lit1 = 0)
sat_solver2_addclause( p->pSat, &Lit, &Lit + 1, 0 ); sat_solver2_addclause( p->pSat, &Lit, &Lit + 1, -1 );
// remove previous abstraction // remove previous abstraction
Ga2_ManShrinkAbs( p, 1, 1, 1 ); Ga2_ManShrinkAbs( p, 1, 1, 1 );
// start new abstraction // start new abstraction
...@@ -877,7 +865,7 @@ void Ga2_ManRestart( Ga2_Man_t * p ) ...@@ -877,7 +865,7 @@ void Ga2_ManRestart( Ga2_Man_t * p )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Unrolls one timeframe.] Synopsis [Unrolls one timeframe.]`
Description [] Description []
...@@ -901,8 +889,8 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f ) ...@@ -901,8 +889,8 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
Lit = Ga2_ObjFindOrAddLit( p, pObj, f ); Lit = Ga2_ObjFindOrAddLit( p, pObj, f );
Lit = Abc_LitNot(Lit); Lit = Abc_LitNot(Lit);
assert( Lit > 1 ); assert( Lit > 1 );
sat_solver2_addclause( p->pSat, &Lit, &Lit + 1, Gia_ObjId(p->pGia, pObj) ); sat_solver2_addclause( p->pSat, &Lit, &Lit + 1, -1 );
return Lit; return Abc_LitNot(Lit);
} }
return 0; return 0;
} }
...@@ -956,7 +944,10 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f ) ...@@ -956,7 +944,10 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
// minimize truth table // minimize truth table
uTruth = Ga2_ObjComputeTruthSpecial( p->pGia, pObj, Ga2_ObjLeaves(p->pGia, pObj), p->vLits ); uTruth = Ga2_ObjComputeTruthSpecial( p->pGia, pObj, Ga2_ObjLeaves(p->pGia, pObj), p->vLits );
if ( uTruth == 0 || uTruth == ~0 ) // const 0 / 1 if ( uTruth == 0 || uTruth == ~0 ) // const 0 / 1
{
Lit = (uTruth > 0); Lit = (uTruth > 0);
Ga2_ObjAddLit( p, pObj, f, Lit );
}
else if ( uTruth == 0xAAAAAAAA || uTruth == 0x55555555 ) // buffer / inverter else if ( uTruth == 0xAAAAAAAA || uTruth == 0x55555555 ) // buffer / inverter
{ {
Lit = Vec_IntEntry( p->vLits, 0 ); Lit = Vec_IntEntry( p->vLits, 0 );
...@@ -966,6 +957,7 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f ) ...@@ -966,6 +957,7 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
Lit = Ga2_ObjFindOrAddLit( p, pLeaf, f ); Lit = Ga2_ObjFindOrAddLit( p, pLeaf, f );
} }
Lit = Abc_LitNotCond( Lit, uTruth == 0x55555555 ); Lit = Abc_LitNotCond( Lit, uTruth == 0x55555555 );
Ga2_ObjAddLit( p, pObj, f, Lit );
} }
else else
{ {
...@@ -973,9 +965,8 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f ) ...@@ -973,9 +965,8 @@ int Ga2_ManUnroll_rec( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
// add new node // add new node
Lit = Ga2_ObjFindOrAddLit(p, pObj, f); Lit = Ga2_ObjFindOrAddLit(p, pObj, f);
Ga2_ManCnfAddDynamic( p, uTruth, Vec_IntArray(p->vLits), Lit, Gia_ObjId(p->pGia, pObj) ); Ga2_ManCnfAddDynamic( p, uTruth, Vec_IntArray(p->vLits), Lit );
} }
Ga2_ObjAddLit( p, pObj, f, Lit );
return Lit; return Lit;
} }
...@@ -1014,6 +1005,7 @@ int Vec_IntCheckUnique( Vec_Int_t * p ) ...@@ -1014,6 +1005,7 @@ int Vec_IntCheckUnique( Vec_Int_t * p )
static inline int Ga2_ObjSatValue( Ga2_Man_t * p, Gia_Obj_t * pObj, int f ) static inline int Ga2_ObjSatValue( Ga2_Man_t * p, Gia_Obj_t * pObj, int f )
{ {
int Lit = Ga2_ObjFindLit( p, pObj, f ); int Lit = Ga2_ObjFindLit( p, pObj, f );
assert( !Gia_ObjIsConst0(pObj) );
if ( Lit == -1 ) if ( Lit == -1 )
return 0; return 0;
return Abc_LitIsCompl(Lit) ^ sat_solver2_var_value( p->pSat, Abc_Lit2Var(Lit) ); return Abc_LitIsCompl(Lit) ^ sat_solver2_var_value( p->pSat, Abc_Lit2Var(Lit) );
...@@ -1024,6 +1016,11 @@ void Ga2_GlaPrepareCexAndMap( Ga2_Man_t * p, Abc_Cex_t ** ppCex, Vec_Int_t ** pv ...@@ -1024,6 +1016,11 @@ void Ga2_GlaPrepareCexAndMap( Ga2_Man_t * p, Abc_Cex_t ** ppCex, Vec_Int_t ** pv
Vec_Int_t * vMap; Vec_Int_t * vMap;
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int f, i, k, Id; int f, i, k, Id;
/*
Gia_ManForEachObj( p->pGia, pObj, i )
if ( Ga2_ObjId(p, pObj) >= 0 )
assert( Vec_IntEntry(p->vValues, Ga2_ObjId(p, pObj)) == i );
*/
// find PIs and PPIs // find PIs and PPIs
vMap = Vec_IntAlloc( 1000 ); vMap = Vec_IntAlloc( 1000 );
Gia_ManForEachObjVec( p->vValues, p->pGia, pObj, i ) Gia_ManForEachObjVec( p->vValues, p->pGia, pObj, i )
......
...@@ -518,6 +518,7 @@ Vec_Int_t * Rnm_ManRefine( Rnm_Man_t * p, Abc_Cex_t * pCex, Vec_Int_t * vMap, in ...@@ -518,6 +518,7 @@ Vec_Int_t * Rnm_ManRefine( Rnm_Man_t * p, Abc_Cex_t * pCex, Vec_Int_t * vMap, in
Vec_Int_t * vSelected = Vec_IntAlloc( 100 ); Vec_Int_t * vSelected = Vec_IntAlloc( 100 );
clock_t clk, clk2 = clock(); clock_t clk, clk2 = clock();
p->nCalls++; p->nCalls++;
// Gia_ManCleanValue( p->pGia );
// initialize // initialize
p->pCex = pCex; p->pCex = pCex;
p->vMap = vMap; p->vMap = vMap;
...@@ -542,7 +543,7 @@ Vec_Int_t * Rnm_ManRefine( Rnm_Man_t * p, Abc_Cex_t * pCex, Vec_Int_t * vMap, in ...@@ -542,7 +543,7 @@ Vec_Int_t * Rnm_ManRefine( Rnm_Man_t * p, Abc_Cex_t * pCex, Vec_Int_t * vMap, in
p->timeBwd += clock() - clk; p->timeBwd += clock() - clk;
} }
// clean values // clean values
Rnm_ManCleanValues( p ); // Rnm_ManCleanValues( p );
// verify (empty) refinement // verify (empty) refinement
clk = clock(); clk = clock();
Rnm_ManVerifyUsingTerSim( p->pGia, p->pCex, p->vMap, p->vObjs, vSelected ); Rnm_ManVerifyUsingTerSim( p->pGia, p->pCex, p->vMap, p->vObjs, vSelected );
......
...@@ -239,7 +239,7 @@ static inline void Prf_ManChainResolve( Prf_Man_t * p, clause * c ) ...@@ -239,7 +239,7 @@ static inline void Prf_ManChainResolve( Prf_Man_t * p, clause * c )
} }
else // problem clause else // problem clause
{ {
if ( clause_id(c) ) // has proof ID if ( clause_id(c) >= 0 ) // has proof ID
{ {
int Entry; int Entry;
if ( p->vId2Pr == NULL ) if ( p->vId2Pr == NULL )
......
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