ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
absOldCex.c File Reference
#include "abs.h"
#include "sat/bmc/bmc.h"
Include dependency graph for absOldCex.c:

Go to the source code of this file.

Classes

struct  Saig_ManCba_t_
 

Typedefs

typedef typedefABC_NAMESPACE_IMPL_START struct Saig_ManCba_t_ Saig_ManCba_t
 DECLARATIONS ///.
 

Functions

Vec_Int_tSaig_ManCbaFilterFlops (Aig_Man_t *pAig, Abc_Cex_t *pAbsCex, Vec_Int_t *vFlopClasses, Vec_Int_t *vAbsFfsToAdd, int nFfsToSelect)
 FUNCTION DEFINITIONS ///.
 
Aig_Man_tSaig_ManDupWithCubes (Aig_Man_t *pAig, Vec_Vec_t *vReg2Value)
 
Vec_Int_tSaig_ManCbaReason2Inputs (Saig_ManCba_t *p, Vec_Int_t *vReasons)
 
Abc_Cex_tSaig_ManCbaReason2Cex (Saig_ManCba_t *p, Vec_Int_t *vReasons)
 
void Saig_ManCbaFindReason_rec (Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Int_t *vPrios, Vec_Int_t *vReasons)
 
Vec_Int_tSaig_ManCbaFindReason (Saig_ManCba_t *p)
 
void Saig_ManCbaUnrollCollect_rec (Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vObjs, Vec_Int_t *vRoots)
 
Aig_Man_tSaig_ManCbaUnrollWithCex (Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, Vec_Int_t **pvMapPiF2A, Vec_Vec_t **pvReg2Frame)
 
Saig_ManCba_tSaig_ManCbaStart (Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
 
void Saig_ManCbaStop (Saig_ManCba_t *p)
 
void Saig_ManCbaShrink (Saig_ManCba_t *p)
 
int Saig_ManCexVerifyUsingTernary (Aig_Man_t *pAig, Abc_Cex_t *pCex, Abc_Cex_t *pCare)
 
Abc_Cex_tSaig_ManCbaFindCexCareBits (Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
 
Vec_Int_tSaig_ManCbaFilterInputs (Aig_Man_t *pAig, int iFirstFlopPi, Abc_Cex_t *pCex, int fVerbose)
 
Vec_Int_tSaig_ManCbaPerform (Aig_Man_t *pAbs, int nInputs, Saig_ParBmc_t *pPars)
 

Typedef Documentation

◆ Saig_ManCba_t

typedef typedefABC_NAMESPACE_IMPL_START struct Saig_ManCba_t_ Saig_ManCba_t

DECLARATIONS ///.

CFile****************************************************************

FileName [saigAbsCba.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Sequential AIG package.]

Synopsis [CEX-based abstraction.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
saigAbsCba.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 31 of file absOldCex.c.

Function Documentation

◆ Saig_ManCbaFilterFlops()

Vec_Int_t * Saig_ManCbaFilterFlops ( Aig_Man_t * pAig,
Abc_Cex_t * pAbsCex,
Vec_Int_t * vFlopClasses,
Vec_Int_t * vAbsFfsToAdd,
int nFfsToSelect )

FUNCTION DEFINITIONS ///.

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

Synopsis [Selects the best flops from the given array.]

Description [Selects the best 'nFfsToSelect' flops among the array 'vAbsFfsToAdd' of flops that should be added to the abstraction. To this end, this procedure simulates the original AIG (pAig) using the given CEX (pAbsCex), which was detected for the abstraction.]

SideEffects []

SeeAlso []

Definition at line 66 of file absOldCex.c.

67{
68 Aig_Obj_t * pObj, * pObjRi, * pObjRo;
69 Vec_Int_t * vMapEntries, * vFlopCosts, * vFlopAddCosts, * vFfsToAddBest;
70 int i, k, f, Entry, iBit, * pPerm;
71 assert( Aig_ManRegNum(pAig) == Vec_IntSize(vFlopClasses) );
72 assert( Vec_IntSize(vAbsFfsToAdd) > nFfsToSelect );
73 // map previously abstracted flops into their original numbers
74 vMapEntries = Vec_IntAlloc( Vec_IntSize(vFlopClasses) );
75 Vec_IntForEachEntry( vFlopClasses, Entry, i )
76 if ( Entry == 0 )
77 Vec_IntPush( vMapEntries, i );
78 // simulate one frame at a time
79 assert( Saig_ManPiNum(pAig) + Vec_IntSize(vMapEntries) == pAbsCex->nPis );
80 vFlopCosts = Vec_IntStart( Vec_IntSize(vMapEntries) );
81 // initialize the flops
83 Aig_ManConst1(pAig)->fMarkB = 1;
84 Saig_ManForEachLo( pAig, pObj, i )
85 pObj->fMarkB = 0;
86 for ( f = 0; f < pAbsCex->iFrame; f++ )
87 {
88 // override the flop values according to the cex
89 iBit = pAbsCex->nRegs + f * pAbsCex->nPis + Saig_ManPiNum(pAig);
90 Vec_IntForEachEntry( vMapEntries, Entry, k )
91 Saig_ManLo(pAig, Entry)->fMarkB = Abc_InfoHasBit(pAbsCex->pData, iBit + k);
92 // simulate
93 Aig_ManForEachNode( pAig, pObj, k )
94 pObj->fMarkB = (Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj)) &
95 (Aig_ObjFanin1(pObj)->fMarkB ^ Aig_ObjFaninC1(pObj));
96 Aig_ManForEachCo( pAig, pObj, k )
97 pObj->fMarkB = Aig_ObjFanin0(pObj)->fMarkB ^ Aig_ObjFaninC0(pObj);
98 // transfer
99 Saig_ManForEachLiLo( pAig, pObjRi, pObjRo, k )
100 pObjRo->fMarkB = pObjRi->fMarkB;
101 // compare
102 iBit = pAbsCex->nRegs + (f + 1) * pAbsCex->nPis + Saig_ManPiNum(pAig);
103 Vec_IntForEachEntry( vMapEntries, Entry, k )
104 if ( Saig_ManLi(pAig, Entry)->fMarkB != (unsigned)Abc_InfoHasBit(pAbsCex->pData, iBit + k) )
105 Vec_IntAddToEntry( vFlopCosts, k, 1 );
106 }
107// Vec_IntForEachEntry( vFlopCosts, Entry, i )
108// printf( "%d ", Entry );
109// printf( "\n" );
110 // remap the cost
111 vFlopAddCosts = Vec_IntAlloc( Vec_IntSize(vAbsFfsToAdd) );
112 Vec_IntForEachEntry( vAbsFfsToAdd, Entry, i )
113 Vec_IntPush( vFlopAddCosts, -Vec_IntEntry(vFlopCosts, Entry) );
114 // sort the flops
115 pPerm = Abc_MergeSortCost( Vec_IntArray(vFlopAddCosts), Vec_IntSize(vFlopAddCosts) );
116 // shrink the array
117 vFfsToAddBest = Vec_IntAlloc( nFfsToSelect );
118 for ( i = 0; i < nFfsToSelect; i++ )
119 {
120// printf( "%d ", Vec_IntEntry(vFlopAddCosts, pPerm[i]) );
121 Vec_IntPush( vFfsToAddBest, Vec_IntEntry(vAbsFfsToAdd, pPerm[i]) );
122 }
123// printf( "\n" );
124 // cleanup
125 ABC_FREE( pPerm );
126 Vec_IntFree( vMapEntries );
127 Vec_IntFree( vFlopCosts );
128 Vec_IntFree( vFlopAddCosts );
129 Aig_ManCleanMarkB(pAig);
130 // return the computed flops
131 return vFfsToAddBest;
132}
int * Abc_MergeSortCost(int *pCosts, int nSize)
Definition utilSort.c:442
#define ABC_FREE(obj)
Definition abc_global.h:267
void Aig_ManCleanMarkB(Aig_Man_t *p)
Definition aigUtil.c:167
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
#define Aig_ManForEachCo(p, pObj, i)
Definition aig.h:398
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define Saig_ManForEachLiLo(p, pObjLi, pObjLo, i)
Definition saig.h:101
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
unsigned int fMarkB
Definition aig.h:80
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaFilterInputs()

Vec_Int_t * Saig_ManCbaFilterInputs ( Aig_Man_t * pAig,
int iFirstFlopPi,
Abc_Cex_t * pCex,
int fVerbose )

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

Synopsis [Returns the array of PIs for flops that should not be absracted.]

Description []

SideEffects []

SeeAlso []

Definition at line 785 of file absOldCex.c.

786{
788 Vec_Int_t * vRes, * vReasons;
789 abctime clk;
790 if ( Saig_ManPiNum(pAig) != pCex->nPis )
791 {
792 printf( "Saig_ManCbaFilterInputs(): The PI count of AIG (%d) does not match that of cex (%d).\n",
793 Aig_ManCiNum(pAig), pCex->nPis );
794 return NULL;
795 }
796
797clk = Abc_Clock();
798 p = Saig_ManCbaStart( pAig, pCex, iFirstFlopPi, fVerbose );
799 p->pFrames = Saig_ManCbaUnrollWithCex( pAig, pCex, iFirstFlopPi, &p->vMapPiF2A, &p->vReg2Frame );
800 vReasons = Saig_ManCbaFindReason( p );
801 vRes = Saig_ManCbaReason2Inputs( p, vReasons );
802 if ( fVerbose )
803 {
804 printf( "Frame PIs = %4d (essential = %4d) AIG PIs = %4d (essential = %4d) ",
805 Aig_ManCiNum(p->pFrames), Vec_IntSize(vReasons),
806 Saig_ManPiNum(p->pAig) - p->nInputs, Vec_IntSize(vRes) );
807ABC_PRT( "Time", Abc_Clock() - clk );
808 }
809
810 Vec_IntFree( vReasons );
812 return vRes;
813}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
Aig_Man_t * Saig_ManCbaUnrollWithCex(Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, Vec_Int_t **pvMapPiF2A, Vec_Vec_t **pvReg2Frame)
Definition absOldCex.c:399
Vec_Int_t * Saig_ManCbaReason2Inputs(Saig_ManCba_t *p, Vec_Int_t *vReasons)
Definition absOldCex.c:195
void Saig_ManCbaStop(Saig_ManCba_t *p)
Definition absOldCex.c:535
Saig_ManCba_t * Saig_ManCbaStart(Aig_Man_t *pAig, Abc_Cex_t *pCex, int nInputs, int fVerbose)
Definition absOldCex.c:513
Vec_Int_t * Saig_ManCbaFindReason(Saig_ManCba_t *p)
Definition absOldCex.c:311
typedefABC_NAMESPACE_IMPL_START struct Saig_ManCba_t_ Saig_ManCba_t
DECLARATIONS ///.
Definition absOldCex.c:31
Cube * p
Definition exorList.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaFindCexCareBits()

Abc_Cex_t * Saig_ManCbaFindCexCareBits ( Aig_Man_t * pAig,
Abc_Cex_t * pCex,
int nInputs,
int fVerbose )

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

Synopsis [SAT-based refinement of the counter-example.]

Description [The first parameter (nInputs) indicates how many first primary inputs to skip without considering as care candidates.]

SideEffects []

SeeAlso []

Definition at line 718 of file absOldCex.c.

719{
721 Vec_Int_t * vReasons;
722 Abc_Cex_t * pCare;
723 abctime clk = Abc_Clock();
724
725 clk = Abc_Clock();
726 p = Saig_ManCbaStart( pAig, pCex, nInputs, fVerbose );
727
728// p->vReg2Frame = Vec_VecStart( pCex->iFrame );
729// p->vReg2Value = Vec_VecStart( pCex->iFrame );
730 p->pFrames = Saig_ManCbaUnrollWithCex( pAig, pCex, nInputs, &p->vMapPiF2A, &p->vReg2Frame );
731 vReasons = Saig_ManCbaFindReason( p );
732 if ( p->vReg2Frame )
734
735
736//if ( fVerbose )
737//Aig_ManPrintStats( p->pFrames );
738
739 if ( fVerbose )
740 {
741 Vec_Int_t * vRes = Saig_ManCbaReason2Inputs( p, vReasons );
742 printf( "Frame PIs = %4d (essential = %4d) AIG PIs = %4d (essential = %4d) ",
743 Aig_ManCiNum(p->pFrames), Vec_IntSize(vReasons),
744 Saig_ManPiNum(p->pAig) - p->nInputs, Vec_IntSize(vRes) );
745 Vec_IntFree( vRes );
746ABC_PRT( "Time", Abc_Clock() - clk );
747 }
748
749 pCare = Saig_ManCbaReason2Cex( p, vReasons );
750 Vec_IntFree( vReasons );
752
753if ( fVerbose )
754{
755printf( "Real " );
756Abc_CexPrintStats( pCex );
757}
758if ( fVerbose )
759{
760printf( "Care " );
761Abc_CexPrintStats( pCare );
762}
763/*
764 // verify the reduced counter-example using ternary simulation
765 if ( !Saig_ManCexVerifyUsingTernary( pAig, pCex, pCare ) )
766 printf( "Saig_ManCbaFindCexCareBits(): Minimized counter-example verification has failed!!!\n" );
767 else if ( fVerbose )
768 printf( "Saig_ManCbaFindCexCareBits(): Minimized counter-example verification is successful.\n" );
769*/
770 Aig_ManCleanMarkAB( pAig );
771 return pCare;
772}
Abc_Cex_t * Saig_ManCbaReason2Cex(Saig_ManCba_t *p, Vec_Int_t *vReasons)
Definition absOldCex.c:224
void Saig_ManCbaShrink(Saig_ManCba_t *p)
Definition absOldCex.c:555
void Aig_ManCleanMarkAB(Aig_Man_t *p)
Definition aigUtil.c:186
void Abc_CexPrintStats(Abc_Cex_t *p)
Definition utilCex.c:256
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition utilCex.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaFindReason()

Vec_Int_t * Saig_ManCbaFindReason ( Saig_ManCba_t * p)

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

Synopsis [Returns reasons for the property to fail.]

Description []

SideEffects []

SeeAlso []

Definition at line 311 of file absOldCex.c.

312{
313 Aig_Obj_t * pObj;
314 Vec_Int_t * vPrios, * vReasons;
315 int i;
316
317 // set PI values according to CEX
318 vPrios = Vec_IntStartFull( Aig_ManObjNumMax(p->pFrames) );
319 Aig_ManConst1(p->pFrames)->fPhase = 1;
320 Aig_ManForEachCi( p->pFrames, pObj, i )
321 {
322 int iInput = Vec_IntEntry( p->vMapPiF2A, 2*i );
323 int iFrame = Vec_IntEntry( p->vMapPiF2A, 2*i+1 );
324 pObj->fPhase = Abc_InfoHasBit( p->pCex->pData, p->pCex->nRegs + p->pCex->nPis * iFrame + iInput );
325 Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), i );
326 }
327
328 // traverse and set the priority
329 Aig_ManForEachNode( p->pFrames, pObj, i )
330 {
331 int fPhase0 = Aig_ObjFaninC0(pObj) ^ Aig_ObjFanin0(pObj)->fPhase;
332 int fPhase1 = Aig_ObjFaninC1(pObj) ^ Aig_ObjFanin1(pObj)->fPhase;
333 int iPrio0 = Vec_IntEntry( vPrios, Aig_ObjFaninId0(pObj) );
334 int iPrio1 = Vec_IntEntry( vPrios, Aig_ObjFaninId1(pObj) );
335 pObj->fPhase = fPhase0 && fPhase1;
336 if ( fPhase0 && fPhase1 ) // both are one
337 Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), Abc_MaxInt(iPrio0, iPrio1) );
338 else if ( !fPhase0 && fPhase1 )
339 Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), iPrio0 );
340 else if ( fPhase0 && !fPhase1 )
341 Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), iPrio1 );
342 else // both are zero
343 Vec_IntWriteEntry( vPrios, Aig_ObjId(pObj), Abc_MinInt(iPrio0, iPrio1) );
344 }
345 // check the property output
346 pObj = Aig_ManCo( p->pFrames, 0 );
347 pObj->fPhase = Aig_ObjFaninC0(pObj) ^ Aig_ObjFanin0(pObj)->fPhase;
348 assert( !pObj->fPhase );
349
350 // select the reason
351 vReasons = Vec_IntAlloc( 100 );
352 Aig_ManIncrementTravId( p->pFrames );
353 Saig_ManCbaFindReason_rec( p->pFrames, Aig_ObjFanin0(pObj), vPrios, vReasons );
354 Vec_IntFree( vPrios );
355// assert( !Aig_ObjIsTravIdCurrent(p->pFrames, Aig_ManConst1(p->pFrames)) );
356 return vReasons;
357}
void Saig_ManCbaFindReason_rec(Aig_Man_t *p, Aig_Obj_t *pObj, Vec_Int_t *vPrios, Vec_Int_t *vReasons)
Definition absOldCex.c:261
void Aig_ManIncrementTravId(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigUtil.c:44
#define Aig_ManForEachCi(p, pObj, i)
ITERATORS ///.
Definition aig.h:393
unsigned int fPhase
Definition aig.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaFindReason_rec()

void Saig_ManCbaFindReason_rec ( Aig_Man_t * p,
Aig_Obj_t * pObj,
Vec_Int_t * vPrios,
Vec_Int_t * vReasons )

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

Synopsis [Returns reasons for the property to fail.]

Description []

SideEffects []

SeeAlso []

Definition at line 261 of file absOldCex.c.

262{
263 if ( Aig_ObjIsTravIdCurrent(p, pObj) )
264 return;
265 Aig_ObjSetTravIdCurrent(p, pObj);
266 if ( Aig_ObjIsConst1(pObj) )
267 return;
268 if ( Aig_ObjIsCi(pObj) )
269 {
270 Vec_IntPush( vReasons, Aig_ObjCioId(pObj) );
271 return;
272 }
273 assert( Aig_ObjIsNode(pObj) );
274 if ( pObj->fPhase )
275 {
276 Saig_ManCbaFindReason_rec( p, Aig_ObjFanin0(pObj), vPrios, vReasons );
277 Saig_ManCbaFindReason_rec( p, Aig_ObjFanin1(pObj), vPrios, vReasons );
278 }
279 else
280 {
281 int fPhase0 = Aig_ObjFaninC0(pObj) ^ Aig_ObjFanin0(pObj)->fPhase;
282 int fPhase1 = Aig_ObjFaninC1(pObj) ^ Aig_ObjFanin1(pObj)->fPhase;
283 assert( !fPhase0 || !fPhase1 );
284 if ( !fPhase0 && fPhase1 )
285 Saig_ManCbaFindReason_rec( p, Aig_ObjFanin0(pObj), vPrios, vReasons );
286 else if ( fPhase0 && !fPhase1 )
287 Saig_ManCbaFindReason_rec( p, Aig_ObjFanin1(pObj), vPrios, vReasons );
288 else
289 {
290 int iPrio0 = Vec_IntEntry( vPrios, Aig_ObjFaninId0(pObj) );
291 int iPrio1 = Vec_IntEntry( vPrios, Aig_ObjFaninId1(pObj) );
292 if ( iPrio0 <= iPrio1 )
293 Saig_ManCbaFindReason_rec( p, Aig_ObjFanin0(pObj), vPrios, vReasons );
294 else
295 Saig_ManCbaFindReason_rec( p, Aig_ObjFanin1(pObj), vPrios, vReasons );
296 }
297 }
298}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaPerform()

Vec_Int_t * Saig_ManCbaPerform ( Aig_Man_t * pAbs,
int nInputs,
Saig_ParBmc_t * pPars )

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

Synopsis [Checks the abstracted model for a counter-example.]

Description [Returns the array of abstracted flops that should be added to the abstraction.]

SideEffects []

SeeAlso []

Definition at line 830 of file absOldCex.c.

831{
832 Vec_Int_t * vAbsFfsToAdd;
833 int RetValue;
834 abctime clk = Abc_Clock();
835// assert( pAbs->nRegs > 0 );
836 // perform BMC
837 RetValue = Saig_ManBmcScalable( pAbs, pPars );
838 if ( RetValue == -1 ) // time out - nothing to add
839 {
840 printf( "Resource limit is reached during BMC.\n" );
841 assert( pAbs->pSeqModel == NULL );
842 return Vec_IntAlloc( 0 );
843 }
844 if ( pAbs->pSeqModel == NULL )
845 {
846 printf( "BMC did not detect a CEX with the given depth.\n" );
847 return Vec_IntAlloc( 0 );
848 }
849 if ( pPars->fVerbose )
850 Abc_CexPrintStats( pAbs->pSeqModel );
851 // CEX is detected - refine the flops
852 vAbsFfsToAdd = Saig_ManCbaFilterInputs( pAbs, nInputs, pAbs->pSeqModel, pPars->fVerbose );
853 if ( Vec_IntSize(vAbsFfsToAdd) == 0 )
854 {
855 Vec_IntFree( vAbsFfsToAdd );
856 return NULL;
857 }
858 if ( pPars->fVerbose )
859 {
860 printf( "Adding %d registers to the abstraction (total = %d). ",
861 Vec_IntSize(vAbsFfsToAdd), Aig_ManRegNum(pAbs)+Vec_IntSize(vAbsFfsToAdd) );
862 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
863 }
864 return vAbsFfsToAdd;
865}
Vec_Int_t * Saig_ManCbaFilterInputs(Aig_Man_t *pAig, int iFirstFlopPi, Abc_Cex_t *pCex, int fVerbose)
Definition absOldCex.c:785
int Saig_ManBmcScalable(Aig_Man_t *pAig, Saig_ParBmc_t *pPars)
Definition bmcBmc3.c:1461
int fVerbose
Definition bmc.h:129
Here is the call graph for this function:

◆ Saig_ManCbaReason2Cex()

Abc_Cex_t * Saig_ManCbaReason2Cex ( Saig_ManCba_t * p,
Vec_Int_t * vReasons )

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

Synopsis [Creates the counter-example.]

Description []

SideEffects []

SeeAlso []

Definition at line 224 of file absOldCex.c.

225{
226 Abc_Cex_t * pCare;
227 int i, Entry, iInput, iFrame;
228 pCare = Abc_CexDup( p->pCex, p->pCex->nRegs );
229 memset( pCare->pData, 0, sizeof(unsigned) * Abc_BitWordNum(pCare->nBits) );
230 Vec_IntForEachEntry( vReasons, Entry, i )
231 {
232 assert( Entry >= 0 && Entry < Aig_ManCiNum(p->pFrames) );
233 iInput = Vec_IntEntry( p->vMapPiF2A, 2*Entry );
234 iFrame = Vec_IntEntry( p->vMapPiF2A, 2*Entry+1 );
235 Abc_InfoSetBit( pCare->pData, pCare->nRegs + pCare->nPis * iFrame + iInput );
236 }
237/*
238 for ( iFrame = 0; iFrame <= pCare->iFrame; iFrame++ )
239 {
240 int Count = 0;
241 for ( i = 0; i < pCare->nPis; i++ )
242 Count += Abc_InfoHasBit(pCare->pData, pCare->nRegs + pCare->nPis * iFrame + i);
243 printf( "%d ", Count );
244 }
245printf( "\n" );
246*/
247 return pCare;
248}
Abc_Cex_t * Abc_CexDup(Abc_Cex_t *p, int nRegsNew)
Definition utilCex.c:145
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaReason2Inputs()

Vec_Int_t * Saig_ManCbaReason2Inputs ( Saig_ManCba_t * p,
Vec_Int_t * vReasons )

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

Synopsis [Maps array of frame PI IDs into array of additional PI IDs.]

Description []

SideEffects []

SeeAlso []

Definition at line 195 of file absOldCex.c.

196{
197 Vec_Int_t * vOriginal, * vVisited;
198 int i, Entry;
199 vOriginal = Vec_IntAlloc( Saig_ManPiNum(p->pAig) );
200 vVisited = Vec_IntStart( Saig_ManPiNum(p->pAig) );
201 Vec_IntForEachEntry( vReasons, Entry, i )
202 {
203 int iInput = Vec_IntEntry( p->vMapPiF2A, 2*Entry );
204 assert( iInput >= p->nInputs && iInput < Aig_ManCiNum(p->pAig) );
205 if ( Vec_IntEntry(vVisited, iInput) == 0 )
206 Vec_IntPush( vOriginal, iInput - p->nInputs );
207 Vec_IntAddToEntry( vVisited, iInput, 1 );
208 }
209 Vec_IntFree( vVisited );
210 return vOriginal;
211}
Here is the caller graph for this function:

◆ Saig_ManCbaShrink()

void Saig_ManCbaShrink ( Saig_ManCba_t * p)

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

Synopsis [Destroys refinement manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 555 of file absOldCex.c.

556{
557 Aig_Man_t * pManNew;
558 Aig_Obj_t * pObjLi, * pObjFrame;
559 Vec_Int_t * vLevel, * vLevel2;
560 int f, k, ObjId, Lit;
561 // assuming that important objects are labeled in Saig_ManCbaFindReason()
562 Vec_VecForEachLevelInt( p->vReg2Frame, vLevel, f )
563 {
564 Vec_IntForEachEntryDouble( vLevel, ObjId, Lit, k )
565 {
566 pObjFrame = Aig_ManObj( p->pFrames, Abc_Lit2Var(Lit) );
567 if ( pObjFrame == NULL || (!Aig_ObjIsConst1(pObjFrame) && !Aig_ObjIsTravIdCurrent(p->pFrames, pObjFrame)) )
568 continue;
569 pObjLi = Aig_ManObj( p->pAig, ObjId );
570 assert( Saig_ObjIsLi(p->pAig, pObjLi) );
571 Vec_VecPushInt( p->vReg2Value, f, Abc_Var2Lit( Aig_ObjCioId(pObjLi) - Saig_ManPoNum(p->pAig), Abc_LitIsCompl(Lit) ^ !pObjFrame->fPhase ) );
572 }
573 }
574 // print statistics
575 Vec_VecForEachLevelInt( p->vReg2Frame, vLevel, k )
576 {
577 vLevel2 = Vec_VecEntryInt( p->vReg2Value, k );
578 printf( "Level = %4d StateBits = %4d (%6.2f %%) CareBits = %4d (%6.2f %%)\n", k,
579 Vec_IntSize(vLevel)/2, 100.0 * (Vec_IntSize(vLevel)/2) / Aig_ManRegNum(p->pAig),
580 Vec_IntSize(vLevel2), 100.0 * Vec_IntSize(vLevel2) / Aig_ManRegNum(p->pAig) );
581 }
582 // try reducing the frames
583 pManNew = Saig_ManDupWithCubes( p->pAig, p->vReg2Value );
584// Ioa_WriteAiger( pManNew, "aigcube.aig", 0, 0 );
585 Aig_ManStop( pManNew );
586}
Aig_Man_t * Saig_ManDupWithCubes(Aig_Man_t *pAig, Vec_Vec_t *vReg2Value)
Definition absOldCex.c:146
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
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
#define Vec_VecForEachLevelInt(vGlob, vVec, i)
Definition vecVec.h:71
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaStart()

Saig_ManCba_t * Saig_ManCbaStart ( Aig_Man_t * pAig,
Abc_Cex_t * pCex,
int nInputs,
int fVerbose )

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

Synopsis [Creates refinement manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 513 of file absOldCex.c.

514{
516 p = ABC_CALLOC( Saig_ManCba_t, 1 );
517 p->pAig = pAig;
518 p->pCex = pCex;
519 p->nInputs = nInputs;
520 p->fVerbose = fVerbose;
521 return p;
522}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
Here is the caller graph for this function:

◆ Saig_ManCbaStop()

void Saig_ManCbaStop ( Saig_ManCba_t * p)

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

Synopsis [Destroys refinement manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 535 of file absOldCex.c.

536{
537 Vec_VecFreeP( &p->vReg2Frame );
538 Vec_VecFreeP( &p->vReg2Value );
539 Aig_ManStopP( &p->pFrames );
540 Vec_IntFreeP( &p->vMapPiF2A );
541 ABC_FREE( p );
542}
void Aig_ManStopP(Aig_Man_t **p)
Definition aigMan.c:246
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaUnrollCollect_rec()

void Saig_ManCbaUnrollCollect_rec ( Aig_Man_t * pAig,
Aig_Obj_t * pObj,
Vec_Int_t * vObjs,
Vec_Int_t * vRoots )

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

Synopsis [Collect nodes in the unrolled timeframes.]

Description []

SideEffects []

SeeAlso []

Definition at line 371 of file absOldCex.c.

372{
373 if ( Aig_ObjIsTravIdCurrent(pAig, pObj) )
374 return;
375 Aig_ObjSetTravIdCurrent(pAig, pObj);
376 if ( Aig_ObjIsCo(pObj) )
377 Saig_ManCbaUnrollCollect_rec( pAig, Aig_ObjFanin0(pObj), vObjs, vRoots );
378 else if ( Aig_ObjIsNode(pObj) )
379 {
380 Saig_ManCbaUnrollCollect_rec( pAig, Aig_ObjFanin0(pObj), vObjs, vRoots );
381 Saig_ManCbaUnrollCollect_rec( pAig, Aig_ObjFanin1(pObj), vObjs, vRoots );
382 }
383 if ( vRoots && Saig_ObjIsLo( pAig, pObj ) )
384 Vec_IntPush( vRoots, Aig_ObjId( Saig_ObjLoToLi(pAig, pObj) ) );
385 Vec_IntPush( vObjs, Aig_ObjId(pObj) );
386}
void Saig_ManCbaUnrollCollect_rec(Aig_Man_t *pAig, Aig_Obj_t *pObj, Vec_Int_t *vObjs, Vec_Int_t *vRoots)
Definition absOldCex.c:371
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCbaUnrollWithCex()

Aig_Man_t * Saig_ManCbaUnrollWithCex ( Aig_Man_t * pAig,
Abc_Cex_t * pCex,
int nInputs,
Vec_Int_t ** pvMapPiF2A,
Vec_Vec_t ** pvReg2Frame )

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

Synopsis [Derive unrolled timeframes.]

Description []

SideEffects []

SeeAlso []

Definition at line 399 of file absOldCex.c.

400{
401 Aig_Man_t * pFrames; // unrolled timeframes
402 Vec_Vec_t * vFrameCos; // the list of COs per frame
403 Vec_Vec_t * vFrameObjs; // the list of objects per frame
404 Vec_Int_t * vRoots, * vObjs;
405 Aig_Obj_t * pObj;
406 int i, f;
407 // sanity checks
408 assert( Saig_ManPiNum(pAig) == pCex->nPis );
409// assert( Saig_ManRegNum(pAig) == pCex->nRegs );
410 assert( pCex->iPo >= 0 && pCex->iPo < Saig_ManPoNum(pAig) );
411
412 // map PIs of the unrolled frames into PIs of the original design
413 *pvMapPiF2A = Vec_IntAlloc( 1000 );
414
415 // collect COs and Objs visited in each frame
416 vFrameCos = Vec_VecStart( pCex->iFrame+1 );
417 vFrameObjs = Vec_VecStart( pCex->iFrame+1 );
418 // initialized the topmost frame
419 pObj = Aig_ManCo( pAig, pCex->iPo );
420 Vec_VecPushInt( vFrameCos, pCex->iFrame, Aig_ObjId(pObj) );
421 for ( f = pCex->iFrame; f >= 0; f-- )
422 {
423 // collect nodes starting from the roots
425 vRoots = Vec_VecEntryInt( vFrameCos, f );
426 Aig_ManForEachObjVec( vRoots, pAig, pObj, i )
427 Saig_ManCbaUnrollCollect_rec( pAig, pObj,
428 Vec_VecEntryInt(vFrameObjs, f),
429 (Vec_Int_t *)(f ? Vec_VecEntry(vFrameCos, f-1) : NULL) );
430 }
431
432 // derive unrolled timeframes
433 pFrames = Aig_ManStart( 10000 );
434 pFrames->pName = Abc_UtilStrsav( pAig->pName );
435 pFrames->pSpec = Abc_UtilStrsav( pAig->pSpec );
436 // initialize the flops
437 if ( Saig_ManRegNum(pAig) == pCex->nRegs )
438 {
439 Saig_ManForEachLo( pAig, pObj, i )
440 pObj->pData = Aig_NotCond( Aig_ManConst1(pFrames), !Abc_InfoHasBit(pCex->pData, i) );
441 }
442 else // this is the case when synthesis was applied, assume all-0 init state
443 {
444 Saig_ManForEachLo( pAig, pObj, i )
445 pObj->pData = Aig_NotCond( Aig_ManConst1(pFrames), 1 );
446 }
447 // iterate through the frames
448 for ( f = 0; f <= pCex->iFrame; f++ )
449 {
450 // construct
451 vObjs = Vec_VecEntryInt( vFrameObjs, f );
452 Aig_ManForEachObjVec( vObjs, pAig, pObj, i )
453 {
454 if ( Aig_ObjIsNode(pObj) )
455 pObj->pData = Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
456 else if ( Aig_ObjIsCo(pObj) )
457 pObj->pData = Aig_ObjChild0Copy(pObj);
458 else if ( Aig_ObjIsConst1(pObj) )
459 pObj->pData = Aig_ManConst1(pFrames);
460 else if ( Saig_ObjIsPi(pAig, pObj) )
461 {
462 if ( Aig_ObjCioId(pObj) < nInputs )
463 {
464 int iBit = pCex->nRegs + f * pCex->nPis + Aig_ObjCioId(pObj);
465 pObj->pData = Aig_NotCond( Aig_ManConst1(pFrames), !Abc_InfoHasBit(pCex->pData, iBit) );
466 }
467 else
468 {
469 pObj->pData = Aig_ObjCreateCi( pFrames );
470 Vec_IntPush( *pvMapPiF2A, Aig_ObjCioId(pObj) );
471 Vec_IntPush( *pvMapPiF2A, f );
472 }
473 }
474 }
475 if ( f == pCex->iFrame )
476 break;
477 // transfer
478 vRoots = Vec_VecEntryInt( vFrameCos, f );
479 Aig_ManForEachObjVec( vRoots, pAig, pObj, i )
480 {
481 Saig_ObjLiToLo( pAig, pObj )->pData = pObj->pData;
482 if ( *pvReg2Frame )
483 {
484 Vec_VecPushInt( *pvReg2Frame, f, Aig_ObjId(pObj) ); // record LO
485 Vec_VecPushInt( *pvReg2Frame, f, Aig_ObjToLit((Aig_Obj_t *)pObj->pData) ); // record its literal
486 }
487 }
488 }
489 // create output
490 pObj = Aig_ManCo( pAig, pCex->iPo );
491 Aig_ObjCreateCo( pFrames, Aig_Not((Aig_Obj_t *)pObj->pData) );
492 Aig_ManSetRegNum( pFrames, 0 );
493 // cleanup
494 Vec_VecFree( vFrameCos );
495 Vec_VecFree( vFrameObjs );
496 // finallize
497 Aig_ManCleanup( pFrames );
498 // return
499 return pFrames;
500}
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition aigObj.c:66
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
int Aig_ManCleanup(Aig_Man_t *p)
Definition aigMan.c:265
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition aigObj.c:45
#define Aig_ManForEachObjVec(vIds, p, pObj, i)
Definition aig.h:408
void * pData
Definition aig.h:87
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Saig_ManCexVerifyUsingTernary()

int Saig_ManCexVerifyUsingTernary ( Aig_Man_t * pAig,
Abc_Cex_t * pCex,
Abc_Cex_t * pCare )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 647 of file absOldCex.c.

648{
649 Aig_Obj_t * pObj, * pObjRi, * pObjRo;
650 int i, f, iBit = 0;
651 assert( pCex->iFrame == pCare->iFrame );
652 assert( pCex->nBits == pCare->nBits );
653 assert( pCex->iPo < Saig_ManPoNum(pAig) );
654 Saig_ObjCexMinSet1( Aig_ManConst1(pAig) );
655 // set flops to the init state
656 Saig_ManForEachLo( pAig, pObj, i )
657 {
658 assert( !Abc_InfoHasBit(pCex->pData, iBit) );
659 assert( !Abc_InfoHasBit(pCare->pData, iBit) );
660// if ( Abc_InfoHasBit(pCare->pData, iBit++) )
661 Saig_ObjCexMinSet0( pObj );
662// else
663// Saig_ObjCexMinSetX( pObj );
664 }
665 iBit = pCex->nRegs;
666 for ( f = 0; f <= pCex->iFrame; f++ )
667 {
668 // init inputs
669 Saig_ManForEachPi( pAig, pObj, i )
670 {
671 if ( Abc_InfoHasBit(pCare->pData, iBit++) )
672 {
673 if ( Abc_InfoHasBit(pCex->pData, iBit-1) )
674 Saig_ObjCexMinSet1( pObj );
675 else
676 Saig_ObjCexMinSet0( pObj );
677 }
678 else
679 Saig_ObjCexMinSetX( pObj );
680 }
681 // simulate internal nodes
682 Aig_ManForEachNode( pAig, pObj, i )
683 Saig_ObjCexMinSim( pObj );
684 // simulate COs
685 Aig_ManForEachCo( pAig, pObj, i )
686 Saig_ObjCexMinSim( pObj );
687/*
688 Aig_ManForEachObj( pAig, pObj, i )
689 {
690 Aig_ObjPrint(pAig, pObj);
691 printf( " Value = " );
692 Saig_ObjCexMinPrint( pObj );
693 printf( "\n" );
694 }
695*/
696 // transfer
697 Saig_ManForEachLiLo( pAig, pObjRi, pObjRo, i )
698 pObjRo->fMarkA = pObjRi->fMarkA,
699 pObjRo->fMarkB = pObjRi->fMarkB;
700 }
701 assert( iBit == pCex->nBits );
702 return Saig_ObjCexMinGet1( Aig_ManCo( pAig, pCex->iPo ) );
703}
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
unsigned int fMarkA
Definition aig.h:79

◆ Saig_ManDupWithCubes()

Aig_Man_t * Saig_ManDupWithCubes ( Aig_Man_t * pAig,
Vec_Vec_t * vReg2Value )

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

Synopsis [Duplicate with literals.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file absOldCex.c.

147{
148 Vec_Int_t * vLevel;
149 Aig_Man_t * pAigNew;
150 Aig_Obj_t * pObj, * pMiter;
151 int i, k, Lit;
152 assert( pAig->nConstrs == 0 );
153 // start the new manager
154 pAigNew = Aig_ManStart( Aig_ManNodeNum(pAig) + Vec_VecSizeSize(vReg2Value) );
155 pAigNew->pName = Abc_UtilStrsav( pAig->pName );
156 // map the constant node
157 Aig_ManConst1(pAig)->pData = Aig_ManConst1( pAigNew );
158 // create variables for PIs
159 Aig_ManForEachCi( pAig, pObj, i )
160 pObj->pData = Aig_ObjCreateCi( pAigNew );
161 // add internal nodes of this frame
162 Aig_ManForEachNode( pAig, pObj, i )
163 pObj->pData = Aig_And( pAigNew, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
164 // create POs for cubes
165 Vec_VecForEachLevelInt( vReg2Value, vLevel, i )
166 {
167 pMiter = Aig_ManConst1( pAigNew );
168 Vec_IntForEachEntry( vLevel, Lit, k )
169 {
170 pObj = Saig_ManLi( pAig, Abc_Lit2Var(Lit) );
171 pMiter = Aig_And( pAigNew, pMiter, Aig_NotCond(Aig_ObjChild0Copy(pObj), Abc_LitIsCompl(Lit)) );
172 }
173 Aig_ObjCreateCo( pAigNew, pMiter );
174 }
175 // transfer to register outputs
176 Saig_ManForEachLi( pAig, pObj, i )
177 Aig_ObjCreateCo( pAigNew, Aig_ObjChild0Copy(pObj) );
178 // finalize
179 Aig_ManCleanup( pAigNew );
180 Aig_ManSetRegNum( pAigNew, Aig_ManRegNum(pAig) );
181 return pAigNew;
182}
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
Here is the call graph for this function:
Here is the caller graph for this function: