246{
247 Aig_Man_t * pAigTemp, * pInter, * pBase = NULL;
252 int nOuts = Aig_ManCoNum(pMan);
253 int ShiftP[2], ShiftCnf[2], ShiftOr[2], ShiftAssume;
254 int Cid, Lit, status, i, k, c;
255 clock_t clk = clock();
256 assert( Aig_ManRegNum(pMan) == 0 );
257
258
260
261
264
265 ShiftP[0] = nOuts;
266 ShiftP[1] = 2*pCnf->
nVars + 3*nOuts;
267 ShiftCnf[0] = ShiftP[0] + nOuts;
268 ShiftCnf[1] = ShiftP[1] + nOuts;
269 ShiftOr[0] = ShiftCnf[0] + 2*pCnf->
nVars;
270 ShiftOr[1] = ShiftCnf[1] + 2*pCnf->
nVars;
271 ShiftAssume = ShiftOr[1] + nOuts;
273
274
275 for ( i = ShiftCnf[0]; i < ShiftP[1]; i++ )
277
278
279 vVars = Vec_IntAlloc( 2*nOuts );
280 for ( k = 0; k < 2; k++ )
281 {
282
284 for ( i = 0; i < pCnf->
nClauses; i++ )
285 {
287 clause2_set_partA( pSat, Cid, k==0 );
288 }
289
291 Aig_ManInterAddBuffer( pSat, ShiftP[k] + i, pCnf->
pVarNums[pObj->
Id], k==1, k==0 );
292
294 for ( i = 0; i < pCnf->
nClauses; i++ )
295 {
297 clause2_set_partA( pSat, Cid, k==0 );
298 }
299
300 Vec_IntClear( vVars );
302 {
303 Aig_ManInterAddXor( pSat, ShiftP[k] + i, pCnf->
pVarNums[pObj->
Id], ShiftOr[k] + i, k==1, k==0 );
304 Vec_IntPush( vVars, toLitCond(ShiftOr[k] + i, 1) );
305 }
306 Cid =
sat_solver2_addclause( pSat, Vec_IntArray(vVars), Vec_IntArray(vVars) + Vec_IntSize(vVars), 0 );
307 clause2_set_partA( pSat, Cid, k==0 );
308
310 }
311
312 for ( k = 0; k < nOuts; k++ )
313 Aig_ManInterAddXor( pSat, ShiftP[0] + k, ShiftP[1] + k, ShiftAssume + k, 0, 0 );
314
315
317 pBase->pName = Abc_UtilStrsav( "repar" );
318 for ( k = 0; k < 2*nOuts; k++ )
320
321
322 Vec_IntClear( vVars );
323 for ( k = 0; k < 2*nOuts; k++ )
324 Vec_IntPush( vVars, k );
325
326
327
328 for ( k = 0; k < nOuts; k++ )
329 {
330
331 int Temp = Vec_IntEntry( vVars, k );
332 Vec_IntWriteEntry( vVars, k, Vec_IntEntry(vVars, nOuts+k) );
333 Vec_IntWriteEntry( vVars, nOuts+k, Temp );
334
335
336 Lit = toLitCond( ShiftAssume + k, 1 );
340
341
344
346 assert( i <= k || Aig_ObjRefs(pObj) == 0 );
347
348
351
352
356 for ( i = 0; i < pCnfInter->
nVars; i++ )
358 for ( c = 0; c < 2; c++ )
359 {
360 if ( c == 1 )
362
363 for ( i = 0; i < pCnfInter->
nClauses; i++ )
364 {
366 clause2_set_partA( pSat, Cid, c==0 );
367 }
368
370 if ( i <= k )
371 Aig_ManInterAddBuffer( pSat, i, pCnf->
pVarNums[pObj->
Id], 0, c==0 );
372
373 pObj = Aig_ManCo(pInter, 0);
374 Aig_ManInterAddBuffer( pSat, ShiftP[c] + k, pCnf->
pVarNums[pObj->
Id], 0, c==0 );
375 if ( c == 1 )
377 }
379
380
383
384
385 Temp = Vec_IntEntry( vVars, k );
386 Vec_IntWriteEntry( vVars, k, Vec_IntEntry(vVars, nOuts+k) );
387 Vec_IntWriteEntry( vVars, nOuts+k, Temp );
388 }
389
390 Vec_IntFree( vVars );
393 ABC_PRT(
"Reparameterization time", clock() - clk );
394 return pBase;
395}
ABC_NAMESPACE_IMPL_START Aig_Man_t * Dar_ManRwsat(Aig_Man_t *pAig, int fBalance, int fVerbose)
DECLARATIONS ///.
void Aig_ManAppend(Aig_Man_t *pBase, Aig_Man_t *pNew)
void Aig_ManStop(Aig_Man_t *p)
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
void Aig_ManPrintStats(Aig_Man_t *p)
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
#define Aig_ManForEachCo(p, pObj, i)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Cnf_Dat_t * Cnf_Derive(Aig_Man_t *pAig, int nOutputs)
struct Cnf_Dat_t_ Cnf_Dat_t
void Cnf_DataFree(Cnf_Dat_t *p)
void Cnf_DataLift(Cnf_Dat_t *p, int nVarsPlus)
void sat_solver2_delete(sat_solver2 *s)
sat_solver2 * sat_solver2_new(void)
int sat_solver2_solve(sat_solver2 *s, lit *begin, lit *end, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, ABC_INT64_T nConfLimitGlobal, ABC_INT64_T nInsLimitGlobal)
void sat_solver2_setnvars(sat_solver2 *s, int n)
void var_set_partA(sat_solver2 *s, int v, int partA)
int sat_solver2_addclause(sat_solver2 *s, lit *begin, lit *end, int Id)
void Sat_Solver2PrintStats(FILE *pFile, sat_solver2 *p)
struct sat_solver2_t sat_solver2
void * Sat_ProofInterpolant(sat_solver2 *s, void *pGloVars)