ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
wlcAbs2.c File Reference
#include "wlc.h"
#include "proof/pdr/pdr.h"
#include "aig/gia/giaAig.h"
#include "sat/bmc/bmc.h"
Include dependency graph for wlcAbs2.c:

Go to the source code of this file.

Functions

int Wlc_NtkAbsCore2 (Wlc_Ntk_t *p, Wlc_Par_t *pPars)
 

Function Documentation

◆ Wlc_NtkAbsCore2()

int Wlc_NtkAbsCore2 ( Wlc_Ntk_t * p,
Wlc_Par_t * pPars )

Function*************************************************************

Synopsis [Performs abstraction.]

Description [Derives initial abstraction based on user-specified parameter values, which tell what is the smallest bit-width of a primitive that is being abstracted away. Currently only add/sub, mul/div, mux, and flop are supported with individual parameters. The second step is to refine the initial abstraction until the point when the property is proved.]

SideEffects []

SeeAlso []

Definition at line 302 of file wlcAbs2.c.

303{
304 abctime clk = Abc_Clock();
305 int nIters, nNodes, nDcFlops, RetValue = -1;
306 // start the bitmap to mark objects that cannot be abstracted because of refinement
307 // currently, this bitmap is empty because abstraction begins without refinement
308 Vec_Bit_t * vUnmark = Vec_BitStart( Wlc_NtkObjNumMax(p) );
309 // set up parameters to run PDR
310 Pdr_Par_t PdrPars, * pPdrPars = &PdrPars;
311 Pdr_ManSetDefaultParams( pPdrPars );
312 pPdrPars->fUseAbs = 1; // use 'pdr -t' (on-the-fly abstraction)
313 pPdrPars->fCtgs = 1; // use 'pdr -nc' (improved generalization)
314 pPdrPars->fSkipDown = 0; // use 'pdr -nc' (improved generalization)
315 //pPdrPars->nRestLimit = 500; // reset queue or proof-obligations when it gets larger than this
316 pPdrPars->fVerbose = pPars->fPdrVerbose;
317 // perform refinement iterations
318 for ( nIters = 1; nIters < pPars->nIterMax; nIters++ )
319 {
320 Aig_Man_t * pAig;
321 Abc_Cex_t * pCex;
322 Vec_Int_t * vPisNew, * vRefine;
323 Gia_Man_t * pGia, * pTemp;
324 Wlc_Ntk_t * pAbs;
325
326 if ( pPars->fVerbose )
327 printf( "\nIteration %d:\n", nIters );
328
329 // get abstracted GIA and the set of pseudo-PIs (vPisNew)
330 pAbs = Wlc_NtkAbs( p, pPars, vUnmark, &vPisNew, pPars->fVerbose );
331 pGia = Wlc_NtkBitBlast( pAbs, NULL );
332
333 // if the abstraction has flops with DC-init state,
334 // new PIs were introduced by bit-blasting at the end of the PI list
335 // here we move these variables to be *before* PPIs, because
336 // PPIs are supposed to be at the end of the PI list for refinement
337 nDcFlops = Wlc_NtkDcFlopNum(pAbs);
338 if ( nDcFlops > 0 ) // DC-init flops are present
339 {
340 pGia = Gia_ManPermuteInputs( pTemp = pGia, Wlc_NtkCountObjBits(p, vPisNew), nDcFlops );
341 Gia_ManStop( pTemp );
342 }
343 // if the word-level outputs have to be XORs, this is a place to do it
344 if ( pPars->fXorOutput )
345 {
346 pGia = Gia_ManTransformMiter2( pTemp = pGia );
347 Gia_ManStop( pTemp );
348 }
349 if ( pPars->fVerbose )
350 {
351 printf( "Derived abstraction with %d objects and %d PPIs. Bit-blasted AIG stats are:\n", Wlc_NtkObjNum(pAbs), Vec_IntSize(vPisNew) );
352 Gia_ManPrintStats( pGia, NULL );
353 }
354 Wlc_NtkFree( pAbs );
355
356 // try to prove abstracted GIA by converting it to AIG and calling PDR
357 pAig = Gia_ManToAigSimple( pGia );
358 RetValue = Pdr_ManSolve( pAig, pPdrPars );
359 pCex = pAig->pSeqModel; pAig->pSeqModel = NULL;
360 Aig_ManStop( pAig );
361
362 // consider outcomes
363 if ( pCex == NULL )
364 {
365 assert( RetValue ); // proved or undecided
366 Gia_ManStop( pGia );
367 Vec_IntFree( vPisNew );
368 break;
369 }
370
371 // perform refinement
372 vRefine = Wlc_NtkAbsRefinement( p, pGia, pCex, vPisNew );
373 Gia_ManStop( pGia );
374 Vec_IntFree( vPisNew );
375 if ( vRefine == NULL ) // real CEX
376 {
377 Abc_CexFree( pCex ); // return CEX in the future
378 break;
379 }
380
381 // update the set of objects to be un-abstracted
382 nNodes = Wlc_NtkRemoveFromAbstraction( p, vRefine, vUnmark );
383 if ( pPars->fVerbose )
384 printf( "Refinement of CEX in frame %d came up with %d un-abstacted PPIs, whose MFFCs include %d objects.\n", pCex->iFrame, Vec_IntSize(vRefine), nNodes );
385 Vec_IntFree( vRefine );
386 Abc_CexFree( pCex );
387 }
388 Vec_BitFree( vUnmark );
389 // report the result
390 if ( pPars->fVerbose )
391 printf( "\n" );
392 printf( "Abstraction " );
393 if ( RetValue == 0 )
394 printf( "resulted in a real CEX" );
395 else if ( RetValue == 1 )
396 printf( "is successfully proved" );
397 else
398 printf( "timed out" );
399 printf( " after %d iterations. ", nIters );
400 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
401 return RetValue;
402}
ABC_INT64_T abctime
Definition abc_global.h:332
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition giaAig.c:408
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManPermuteInputs(Gia_Man_t *p, int nPpis, int nExtra)
Definition giaDup.c:2758
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Gia_Man_t * Gia_ManTransformMiter2(Gia_Man_t *p)
Definition giaDup.c:3409
void Gia_ManPrintStats(Gia_Man_t *p, Gps_Par_t *pPars)
Definition giaMan.c:495
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition pdrCore.c:50
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition pdr.h:40
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition pdrCore.c:1765
int fXorOutput
Definition wlc.h:187
int nIterMax
Definition wlc.h:185
int fPdrVerbose
Definition wlc.h:202
int fVerbose
Definition wlc.h:201
void Abc_CexFree(Abc_Cex_t *p)
Definition utilCex.c:382
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Bit_t_ Vec_Bit_t
INCLUDES ///.
Definition vecBit.h:42
Gia_Man_t * Wlc_NtkBitBlast(Wlc_Ntk_t *p, Wlc_BstPar_t *pPars)
Definition wlcBlast.c:1349
void Wlc_NtkFree(Wlc_Ntk_t *p)
Definition wlcNtk.c:253
struct Wlc_Ntk_t_ Wlc_Ntk_t
Definition wlc.h:135
int Wlc_NtkCountObjBits(Wlc_Ntk_t *p, Vec_Int_t *vPisNew)
Definition wlcNtk.c:1395
int Wlc_NtkDcFlopNum(Wlc_Ntk_t *p)
Definition wlcNtk.c:1351
Here is the call graph for this function: