ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
monotone.c File Reference
#include <stdio.h>
#include "base/main/main.h"
#include "aig/aig/aig.h"
#include "aig/saig/saig.h"
#include <string.h>
#include "base/main/mainInt.h"
#include "proof/pdr/pdr.h"
Include dependency graph for monotone.c:

Go to the source code of this file.

Classes

struct  aigPoIndices
 
struct  monotoneVectorsStruct
 

Functions

ABC_NAMESPACE_IMPL_START Aig_Man_tAbc_NtkToDar (Abc_Ntk_t *pNtk, int fExors, int fRegisters)
 DECLARATIONS ///.
 
struct aigPoIndicesallocAigPoIndices ()
 
void deallocAigPoIndices (struct aigPoIndices *toBeDeletedAigPoIndices)
 
struct monotoneVectorsStructallocPointersToMonotoneVectors ()
 
void deallocPointersToMonotoneVectors (struct monotoneVectorsStruct *toBeDeleted)
 
Vec_Int_tfindHintOutputs (Abc_Ntk_t *pNtk)
 
int findPendingSignal (Abc_Ntk_t *pNtk)
 
int checkSanityOfKnownMonotone (Vec_Int_t *vKnownMonotone, Vec_Int_t *vCandMonotone, Vec_Int_t *vHintMonotone)
 
Aig_Man_tcreateMonotoneTester (Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct monotoneVectorsStruct *monotoneVectorArg, int *startMonotonePropPo)
 
Vec_Int_tfindNewMonotone (Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct monotoneVectorsStruct *monotoneVectorArg)
 
Vec_Int_tfindRemainingMonotoneCandidates (Vec_Int_t *vKnownMonotone, Vec_Int_t *vHintMonotone)
 
Vec_Int_tfindMonotoneSignals (Abc_Ntk_t *pNtk)
 

Function Documentation

◆ Abc_NtkToDar()

ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar ( Abc_Ntk_t * pNtk,
int fExors,
int fRegisters )
extern

DECLARATIONS ///.

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

FileName [kLiveConstraints.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Liveness property checking.]

Synopsis [Constraint analysis module for the k-Liveness algorithm invented by Koen Classen, Niklas Sorensson.]

Author [Sayak Ray]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - October 31, 2012.]

Revision [

Id
liveness.c,v 1.00 2009/01/01 00:00:00 alanmi Exp

]

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

Synopsis [Converts the network from the AIG manager into ABC.]

Description [Assumes that registers are ordered after PIs/POs.]

SideEffects []

SeeAlso []

Definition at line 237 of file abcDar.c.

238{
239 Vec_Ptr_t * vNodes;
240 Aig_Man_t * pMan;
241 Aig_Obj_t * pObjNew;
242 Abc_Obj_t * pObj;
243 int i, nNodes, nDontCares;
244 // make sure the latches follow PIs/POs
245 if ( fRegisters )
246 {
247 assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
248 Abc_NtkForEachCi( pNtk, pObj, i )
249 if ( i < Abc_NtkPiNum(pNtk) )
250 {
251 assert( Abc_ObjIsPi(pObj) );
252 if ( !Abc_ObjIsPi(pObj) )
253 Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PI ordering is wrong!\n" );
254 }
255 else
256 assert( Abc_ObjIsBo(pObj) );
257 Abc_NtkForEachCo( pNtk, pObj, i )
258 if ( i < Abc_NtkPoNum(pNtk) )
259 {
260 assert( Abc_ObjIsPo(pObj) );
261 if ( !Abc_ObjIsPo(pObj) )
262 Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PO ordering is wrong!\n" );
263 }
264 else
265 assert( Abc_ObjIsBi(pObj) );
266 // print warning about initial values
267 nDontCares = 0;
268 Abc_NtkForEachLatch( pNtk, pObj, i )
269 if ( Abc_LatchIsInitDc(pObj) )
270 {
271 Abc_LatchSetInit0(pObj);
272 nDontCares++;
273 }
274 if ( nDontCares )
275 {
276 Abc_Print( 1, "Warning: %d registers in this network have don't-care init values.\n", nDontCares );
277 Abc_Print( 1, "The don't-care are assumed to be 0. The result may not verify.\n" );
278 Abc_Print( 1, "Use command \"print_latch\" to see the init values of registers.\n" );
279 Abc_Print( 1, "Use command \"zero\" to convert or \"init\" to change the values.\n" );
280 }
281 }
282 // create the manager
283 pMan = Aig_ManStart( Abc_NtkNodeNum(pNtk) + 100 );
284 pMan->fCatchExor = fExors;
285 pMan->nConstrs = pNtk->nConstrs;
286 pMan->nBarBufs = pNtk->nBarBufs;
287 pMan->pName = Extra_UtilStrsav( pNtk->pName );
288 pMan->pSpec = Extra_UtilStrsav( pNtk->pSpec );
289 // transfer the pointers to the basic nodes
290 Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Aig_ManConst1(pMan);
291 Abc_NtkForEachCi( pNtk, pObj, i )
292 {
293 pObj->pCopy = (Abc_Obj_t *)Aig_ObjCreateCi(pMan);
294 // initialize logic level of the CIs
295 ((Aig_Obj_t *)pObj->pCopy)->Level = pObj->Level;
296 }
297
298 // complement the 1-values registers
299 if ( fRegisters ) {
300 Abc_NtkForEachLatch( pNtk, pObj, i )
301 if ( Abc_LatchIsInit1(pObj) )
302 Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
303 }
304 // perform the conversion of the internal nodes (assumes DFS ordering)
305// pMan->fAddStrash = 1;
306 vNodes = Abc_NtkDfs( pNtk, 0 );
307 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
308// Abc_NtkForEachNode( pNtk, pObj, i )
309 {
310 pObj->pCopy = (Abc_Obj_t *)Aig_And( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj), (Aig_Obj_t *)Abc_ObjChild1Copy(pObj) );
311// Abc_Print( 1, "%d->%d ", pObj->Id, ((Aig_Obj_t *)pObj->pCopy)->Id );
312 }
313 Vec_PtrFree( vNodes );
314 pMan->fAddStrash = 0;
315 // create the POs
316 Abc_NtkForEachCo( pNtk, pObj, i )
317 Aig_ObjCreateCo( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj) );
318 // complement the 1-valued registers
319 Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
320 if ( fRegisters )
321 Aig_ManForEachLiSeq( pMan, pObjNew, i )
322 if ( Abc_LatchIsInit1(Abc_ObjFanout0(Abc_NtkCo(pNtk,i))) )
323 pObjNew->pFanin0 = Aig_Not(pObjNew->pFanin0);
324 // remove dangling nodes
325 nNodes = (Abc_NtkGetChoiceNum(pNtk) == 0)? Aig_ManCleanup( pMan ) : 0;
326 if ( !fExors && nNodes )
327 Abc_Print( 1, "Abc_NtkToDar(): Unexpected %d dangling nodes when converting to AIG!\n", nNodes );
328//Aig_ManDumpVerilog( pMan, "test.v" );
329 // save the number of registers
330 if ( fRegisters )
331 {
332 Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
333 pMan->vFlopNums = Vec_IntStartNatural( pMan->nRegs );
334// pMan->vFlopNums = NULL;
335// pMan->vOnehots = Abc_NtkConverLatchNamesIntoNumbers( pNtk );
336 if ( pNtk->vOnehots )
337 pMan->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
338 }
339 if ( !Aig_ManCheck( pMan ) )
340 {
341 Abc_Print( 1, "Abc_NtkToDar: AIG check has failed.\n" );
342 Aig_ManStop( pMan );
343 return NULL;
344 }
345 return pMan;
346}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition abc.h:500
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition aigMan.c:438
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition aig.h:447
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
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
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
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition aigCheck.c:45
char * Extra_UtilStrsav(const char *s)
char * pName
Definition abc.h:158
int nBarBufs
Definition abc.h:174
int nConstrs
Definition abc.h:173
Vec_Ptr_t * vOnehots
Definition abc.h:211
char * pSpec
Definition abc.h:159
Abc_Obj_t * pCopy
Definition abc.h:148
unsigned Level
Definition abc.h:142
Aig_Obj_t * pFanin0
Definition aig.h:75
unsigned Level
Definition aig.h:82
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the caller graph for this function:

◆ allocAigPoIndices()

struct aigPoIndices * allocAigPoIndices ( )

Definition at line 43 of file monotone.c.

44{
45 struct aigPoIndices *newAigPoIndices;
46
47 newAigPoIndices = (struct aigPoIndices *)malloc(sizeof (struct aigPoIndices));
48 newAigPoIndices->attrPendingSignalIndex = -1;
49 newAigPoIndices->attrHintSingalBeginningMarker = -1;
50 newAigPoIndices->attrHintSingalEndMarker = -1;
51 newAigPoIndices->attrSafetyInvarIndex = -1;
52
53 assert( newAigPoIndices != NULL );
54 return newAigPoIndices;
55}
char * malloc()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocPointersToMonotoneVectors()

struct monotoneVectorsStruct * allocPointersToMonotoneVectors ( )

Definition at line 70 of file monotone.c.

71{
72 struct monotoneVectorsStruct *newPointersToMonotoneVectors;
73
74 newPointersToMonotoneVectors = (struct monotoneVectorsStruct *)malloc(sizeof (struct monotoneVectorsStruct));
75
76 newPointersToMonotoneVectors->attrKnownMonotone = NULL;
77 newPointersToMonotoneVectors->attrCandMonotone = NULL;
78 newPointersToMonotoneVectors->attrHintMonotone = NULL;
79
80 assert( newPointersToMonotoneVectors != NULL );
81 return newPointersToMonotoneVectors;
82}
Vec_Int_t * attrHintMonotone
Definition monotone.c:67
Vec_Int_t * attrCandMonotone
Definition monotone.c:66
Vec_Int_t * attrKnownMonotone
Definition monotone.c:65
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkSanityOfKnownMonotone()

int checkSanityOfKnownMonotone ( Vec_Int_t * vKnownMonotone,
Vec_Int_t * vCandMonotone,
Vec_Int_t * vHintMonotone )

Definition at line 129 of file monotone.c.

130{
131 int iElem, i;
132
133 Vec_IntForEachEntry( vKnownMonotone, iElem, i )
134 printf("%d ", iElem);
135 printf("\n");
136 Vec_IntForEachEntry( vCandMonotone, iElem, i )
137 printf("%d ", iElem);
138 printf("\n");
139 Vec_IntForEachEntry( vHintMonotone, iElem, i )
140 printf("%d ", iElem);
141 printf("\n");
142 return 1;
143}
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ createMonotoneTester()

Aig_Man_t * createMonotoneTester ( Aig_Man_t * pAig,
struct aigPoIndices * aigPoIndicesArg,
struct monotoneVectorsStruct * monotoneVectorArg,
int * startMonotonePropPo )

Definition at line 145 of file monotone.c.

146{
147 Aig_Man_t *pNewAig;
148 int iElem, i, nRegCount, oldPoNum, poSerialNum, iElemHint;
149 int piCopied = 0, liCopied = 0, liCreated = 0, loCopied = 0, loCreated = 0;
150 int poCopied = 0, poCreated = 0;
151 Aig_Obj_t *pObj, *pObjPo, *pObjDriver, *pObjDriverNew, *pObjPendingDriverNew, *pObjPendingAndNextPending;
152 Aig_Obj_t *pPendingFlop, *pHintSignalLo, *pHintMonotoneFlop, *pObjTemp1, *pObjTemp2, *pObjKnownMonotoneAnd;
153 Vec_Ptr_t *vHintMonotoneLocalDriverNew;
154 Vec_Ptr_t *vHintMonotoneLocalFlopOutput;
155 Vec_Ptr_t *vHintMonotoneLocalProp;
156
157 int pendingSignalIndexLocal = aigPoIndicesArg->attrPendingSignalIndex;
158 int hintSingalBeginningMarkerLocal = aigPoIndicesArg->attrHintSingalBeginningMarker;
159 //int hintSingalEndMarkerLocal = aigPoIndicesArg->attrHintSingalEndMarker;
160
161 Vec_Int_t *vKnownMonotoneLocal = monotoneVectorArg->attrKnownMonotone;
162 Vec_Int_t *vCandMonotoneLocal = monotoneVectorArg->attrCandMonotone;
163 Vec_Int_t *vHintMonotoneLocal = monotoneVectorArg->attrHintMonotone;
164
165 //****************************************************************
166 // Step1: create the new manager
167 // Note: The new manager is created with "2 * Aig_ManObjNumMax(p)"
168 // nodes, but this selection is arbitrary - need to be justified
169 //****************************************************************
170 pNewAig = Aig_ManStart( Aig_ManObjNumMax(pAig) );
171 pNewAig->pName = (char *)malloc( strlen( pAig->pName ) + strlen("_monotone") + 1 );
172 sprintf(pNewAig->pName, "%s_%s", pAig->pName, "_monotone");
173 pNewAig->pSpec = NULL;
174
175 //****************************************************************
176 // Step 2: map constant nodes
177 //****************************************************************
178 pObj = Aig_ManConst1( pAig );
179 pObj->pData = Aig_ManConst1( pNewAig );
180
181 //****************************************************************
182 // Step 3: create true PIs
183 //****************************************************************
184 Saig_ManForEachPi( pAig, pObj, i )
185 {
186 piCopied++;
187 pObj->pData = Aig_ObjCreateCi(pNewAig);
188 }
189
190 //****************************************************************
191 // Step 5: create register outputs
192 //****************************************************************
193 Saig_ManForEachLo( pAig, pObj, i )
194 {
195 loCopied++;
196 pObj->pData = Aig_ObjCreateCi(pNewAig);
197 }
198
199 //****************************************************************
200 // Step 6: create "D" register output for PENDING flop
201 //****************************************************************
202 loCreated++;
203 pPendingFlop = Aig_ObjCreateCi( pNewAig );
204
205 //****************************************************************
206 // Step 6.a: create "D" register output for HINT_MONOTONE flop
207 //****************************************************************
208 vHintMonotoneLocalFlopOutput = Vec_PtrAlloc(Vec_IntSize(vHintMonotoneLocal));
209 Vec_IntForEachEntry( vHintMonotoneLocal, iElem, i )
210 {
211 loCreated++;
212 pHintMonotoneFlop = Aig_ObjCreateCi( pNewAig );
213 Vec_PtrPush( vHintMonotoneLocalFlopOutput, pHintMonotoneFlop );
214 }
215
216 nRegCount = loCreated + loCopied;
217 printf("\nnRegCount = %d\n", nRegCount);
218
219 //********************************************************************
220 // Step 7: create internal nodes
221 //********************************************************************
222 Aig_ManForEachNode( pAig, pObj, i )
223 {
224 pObj->pData = Aig_And( pNewAig, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
225 }
226
227 //********************************************************************
228 // Step 8: mapping appropriate new flop drivers
229 //********************************************************************
230
231 pObjPo = Aig_ManCo( pAig, pendingSignalIndexLocal );
232 pObjDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
233 pObjPendingDriverNew = !Aig_IsComplement(pObjDriver)?
234 (Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData) :
235 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData));
236
237 pObjPendingAndNextPending = Aig_And( pNewAig, pObjPendingDriverNew, pPendingFlop );
238
239 oldPoNum = Aig_ManCoNum(pAig) - Aig_ManRegNum(pAig);
240 pObjKnownMonotoneAnd = Aig_ManConst1( pNewAig );
241 #if 1
242 if( vKnownMonotoneLocal )
243 {
244 assert( checkSanityOfKnownMonotone( vKnownMonotoneLocal, vCandMonotoneLocal, vHintMonotoneLocal ) );
245
246 Vec_IntForEachEntry( vKnownMonotoneLocal, iElemHint, i )
247 {
248 iElem = (iElemHint - hintSingalBeginningMarkerLocal) + 1 + pendingSignalIndexLocal;
249 printf("\nProcessing knownMonotone = %d\n", iElem);
250 pObjPo = Aig_ManCo( pAig, iElem );
251 pObjDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
252 pObjDriverNew = !Aig_IsComplement(pObjDriver)?
253 (Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData) :
254 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData));
255 pHintSignalLo = (Aig_Obj_t *)Vec_PtrEntry(vHintMonotoneLocalFlopOutput, iElem - oldPoNum);
256 pObjTemp1 = Aig_Or( pNewAig, Aig_And(pNewAig, pObjDriverNew, pHintSignalLo),
257 Aig_And(pNewAig, Aig_Not(pObjDriverNew), Aig_Not(pHintSignalLo)) );
258
259 pObjKnownMonotoneAnd = Aig_And( pNewAig, pObjKnownMonotoneAnd, pObjTemp1 );
260 }
261 pObjPendingAndNextPending = Aig_And( pNewAig, pObjPendingAndNextPending, pObjKnownMonotoneAnd );
262 }
263 #endif
264
265 vHintMonotoneLocalDriverNew = Vec_PtrAlloc(Vec_IntSize(vHintMonotoneLocal));
266 vHintMonotoneLocalProp = Vec_PtrAlloc(Vec_IntSize(vHintMonotoneLocal));
267 Vec_IntForEachEntry( vHintMonotoneLocal, iElem, i )
268 {
269 pObjPo = Aig_ManCo( pAig, iElem );
270 pObjDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
271 pObjDriverNew = !Aig_IsComplement(pObjDriver)?
272 (Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData) :
273 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData));
274
275 if( vKnownMonotoneLocal != NULL && Vec_IntFind( vKnownMonotoneLocal, iElem ) != -1 )
276 {
277 Vec_PtrPush(vHintMonotoneLocalDriverNew, pObjDriverNew);
278 }
279 else
280 {
281 poSerialNum = Vec_IntFind( vHintMonotoneLocal, iElem );
282 pHintSignalLo = (Aig_Obj_t *)Vec_PtrEntry(vHintMonotoneLocalFlopOutput, poSerialNum );
283 pObjTemp1 = Aig_And( pNewAig, pObjPendingAndNextPending, pHintSignalLo);
284 pObjTemp2 = Aig_Or( pNewAig, Aig_Not(pObjTemp1), pObjDriverNew );
285 //pObjTemp2 = Aig_Or( pNewAig, Aig_Not(pObjTemp1), Aig_ManConst1( pNewAig ));
286 //pObjTemp2 = Aig_ManConst1( pNewAig );
287 Vec_PtrPush(vHintMonotoneLocalDriverNew, pObjDriverNew);
288 Vec_PtrPush(vHintMonotoneLocalProp, pObjTemp2);
289 }
290 }
291
292 //********************************************************************
293 // Step 9: create primary outputs
294 //********************************************************************
295 Saig_ManForEachPo( pAig, pObj, i )
296 {
297 poCopied++;
298 pObj->pData = Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
299 }
300
301 *startMonotonePropPo = i;
302 Vec_PtrForEachEntry( Aig_Obj_t *, vHintMonotoneLocalProp, pObj, i )
303 {
304 poCreated++;
305 pObjPo = Aig_ObjCreateCo( pNewAig, pObj );
306 }
307
308 //********************************************************************
309 // Step 9: create latch inputs
310 //********************************************************************
311
312 Saig_ManForEachLi( pAig, pObj, i )
313 {
314 liCopied++;
315 Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
316 }
317
318 //********************************************************************
319 // Step 9.a: create latch input for PENDING_FLOP
320 //********************************************************************
321
322 liCreated++;
323 Aig_ObjCreateCo( pNewAig, pObjPendingDriverNew );
324
325 //********************************************************************
326 // Step 9.b: create latch input for MONOTONE_FLOP
327 //********************************************************************
328
329 Vec_PtrForEachEntry( Aig_Obj_t *, vHintMonotoneLocalDriverNew, pObj, i )
330 {
331 liCreated++;
332 Aig_ObjCreateCo( pNewAig, pObj );
333 }
334
335 printf("\npoCopied = %d, poCreated = %d\n", poCopied, poCreated);
336 printf("\nliCreated++ = %d\n", liCreated );
337 Aig_ManSetRegNum( pNewAig, nRegCount );
338 Aig_ManCleanup( pNewAig );
339
340 assert( Aig_ManCheck( pNewAig ) );
341 assert( loCopied + loCreated == liCopied + liCreated );
342
343 printf("\nSaig_ManPoNum = %d\n", Saig_ManPoNum(pNewAig));
344 return pNewAig;
345}
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:259
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
int checkSanityOfKnownMonotone(Vec_Int_t *vKnownMonotone, Vec_Int_t *vCandMonotone, Vec_Int_t *vHintMonotone)
Definition monotone.c:129
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
#define Saig_ManForEachPo(p, pObj, i)
Definition saig.h:93
#define Saig_ManForEachLo(p, pObj, i)
Definition saig.h:96
#define Saig_ManForEachPi(p, pObj, i)
Definition saig.h:91
void * pData
Definition aig.h:87
int strlen()
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocAigPoIndices()

void deallocAigPoIndices ( struct aigPoIndices * toBeDeletedAigPoIndices)

Definition at line 57 of file monotone.c.

58{
59 assert(toBeDeletedAigPoIndices != NULL );
60 free(toBeDeletedAigPoIndices);
61}
VOID_HACK free()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocPointersToMonotoneVectors()

void deallocPointersToMonotoneVectors ( struct monotoneVectorsStruct * toBeDeleted)

Definition at line 84 of file monotone.c.

85{
86 assert( toBeDeleted != NULL );
87 free( toBeDeleted );
88}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findHintOutputs()

Vec_Int_t * findHintOutputs ( Abc_Ntk_t * pNtk)

Definition at line 90 of file monotone.c.

91{
92 int i, numElementPush = 0;
93 Abc_Obj_t *pNode;
94 Vec_Int_t *vHintPoIntdex;
95
96 vHintPoIntdex = Vec_IntAlloc(0);
97 Abc_NtkForEachPo( pNtk, pNode, i )
98 {
99 if( strstr( Abc_ObjName( pNode ), "hint_" ) != NULL )
100 {
101 Vec_IntPush( vHintPoIntdex, i );
102 numElementPush++;
103 }
104 }
105
106 if( numElementPush == 0 )
107 return NULL;
108 else
109 return vHintPoIntdex;
110}
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
char * strstr()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findMonotoneSignals()

Vec_Int_t * findMonotoneSignals ( Abc_Ntk_t * pNtk)

Definition at line 413 of file monotone.c.

414{
415 Aig_Man_t *pAig;
416 Vec_Int_t *vCandidateMonotoneSignals;
417 Vec_Int_t *vKnownMonotoneSignals;
418 //Vec_Int_t *vKnownMonotoneSignalsNew;
419 //Vec_Int_t *vRemainingCanMonotone;
420 int i, iElem;
421 int pendingSignalIndex;
422 Abc_Ntk_t *pNtkTemp;
423 int hintSingalBeginningMarker;
424 int hintSingalEndMarker;
425 struct aigPoIndices *aigPoIndicesInstance;
426 struct monotoneVectorsStruct *monotoneVectorsInstance;
427
428 /*******************************************/
429 //Finding the PO index of the pending signal
430 /*******************************************/
431 pendingSignalIndex = findPendingSignal(pNtk);
432 if( pendingSignalIndex == -1 )
433 {
434 printf("\nNo Pending Signal Found\n");
435 return NULL;
436 }
437 else
438 printf("Po[%d] = %s\n", pendingSignalIndex, Abc_ObjName( Abc_NtkPo(pNtk, pendingSignalIndex) ) );
439
440 /*******************************************/
441 //Finding the PO indices of all hint signals
442 /*******************************************/
443 vCandidateMonotoneSignals = findHintOutputs(pNtk);
444 if( vCandidateMonotoneSignals == NULL )
445 return NULL;
446 else
447 {
448 Vec_IntForEachEntry( vCandidateMonotoneSignals, iElem, i )
449 printf("Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
450 hintSingalBeginningMarker = Vec_IntEntry( vCandidateMonotoneSignals, 0 );
451 hintSingalEndMarker = Vec_IntEntry( vCandidateMonotoneSignals, Vec_IntSize(vCandidateMonotoneSignals) - 1 );
452 }
453
454 /**********************************************/
455 //Allocating "struct" with necessary parameters
456 /**********************************************/
457 aigPoIndicesInstance = allocAigPoIndices();
458 aigPoIndicesInstance->attrPendingSignalIndex = pendingSignalIndex;
459 aigPoIndicesInstance->attrHintSingalBeginningMarker = hintSingalBeginningMarker;
460 aigPoIndicesInstance->attrHintSingalEndMarker = hintSingalEndMarker;
461
462 /****************************************************/
463 //Allocating "struct" with necessary monotone vectors
464 /****************************************************/
465 monotoneVectorsInstance = allocPointersToMonotoneVectors();
466 monotoneVectorsInstance->attrCandMonotone = vCandidateMonotoneSignals;
467 monotoneVectorsInstance->attrHintMonotone = vCandidateMonotoneSignals;
468
469 /*******************************************/
470 //Generate AIG from Ntk
471 /*******************************************/
472 if( !Abc_NtkIsStrash( pNtk ) )
473 {
474 pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 );
475 pAig = Abc_NtkToDar( pNtkTemp, 0, 1 );
476 }
477 else
478 {
479 pAig = Abc_NtkToDar( pNtk, 0, 1 );
480 pNtkTemp = pNtk;
481 }
482
483 /*******************************************/
484 //finding LEVEL 1 monotone signals
485 /*******************************************/
486 vKnownMonotoneSignals = findNewMonotone( pAig, aigPoIndicesInstance, monotoneVectorsInstance );
487 monotoneVectorsInstance->attrKnownMonotone = vKnownMonotoneSignals;
488
489 /*******************************************/
490 //finding LEVEL >1 monotone signals
491 /*******************************************/
492 #if 0
493 if( vKnownMonotoneSignals )
494 {
495 printf("\nsize = %d\n", Vec_IntSize(vKnownMonotoneSignals) );
496 vRemainingCanMonotone = findRemainingMonotoneCandidates(vKnownMonotoneSignals, vCandidateMonotoneSignals);
497 monotoneVectorsInstance->attrCandMonotone = vRemainingCanMonotone;
498 vKnownMonotoneSignalsNew = findNewMonotone( pAig, aigPoIndicesInstance, monotoneVectorsInstance );
499 }
500 #endif
501
502 deallocAigPoIndices(aigPoIndicesInstance);
503 deallocPointersToMonotoneVectors(monotoneVectorsInstance);
504 return NULL;
505}
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition abcStrash.c:265
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition monotone.c:90
void deallocPointersToMonotoneVectors(struct monotoneVectorsStruct *toBeDeleted)
Definition monotone.c:84
ABC_NAMESPACE_IMPL_START Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition abcDar.c:237
struct aigPoIndices * allocAigPoIndices()
Definition monotone.c:43
int findPendingSignal(Abc_Ntk_t *pNtk)
Definition monotone.c:112
struct monotoneVectorsStruct * allocPointersToMonotoneVectors()
Definition monotone.c:70
Vec_Int_t * findRemainingMonotoneCandidates(Vec_Int_t *vKnownMonotone, Vec_Int_t *vHintMonotone)
Definition monotone.c:396
void deallocAigPoIndices(struct aigPoIndices *toBeDeletedAigPoIndices)
Definition monotone.c:57
Vec_Int_t * findNewMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct monotoneVectorsStruct *monotoneVectorArg)
Definition monotone.c:348
Here is the call graph for this function:

◆ findNewMonotone()

Vec_Int_t * findNewMonotone ( Aig_Man_t * pAig,
struct aigPoIndices * aigPoIndicesArg,
struct monotoneVectorsStruct * monotoneVectorArg )

Definition at line 348 of file monotone.c.

349{
350 Aig_Man_t *pAigNew;
351 Aig_Obj_t *pObjTargetPo;
352 int poMarker, oldPoNum;
353 int i, RetValue;
354 Pdr_Par_t Pars, * pPars = &Pars;
355 Abc_Cex_t * pCex = NULL;
356 Vec_Int_t *vMonotoneIndex;
357
358 int pendingSignalIndexLocal = aigPoIndicesArg->attrPendingSignalIndex;
359 int hintSingalBeginningMarkerLocal = aigPoIndicesArg->attrHintSingalBeginningMarker;
360 //int hintSingalEndMarkerLocal = aigPoIndicesArg->attrHintSingalEndMarker;
361
362 //Vec_Int_t *vKnownMonotoneLocal = monotoneVectorArg->attrKnownMonotone;
363 //Vec_Int_t *vCandMonotoneLocal = monotoneVectorArg->attrCandMonotone;
364 //Vec_Int_t *vHintMonotoneLocal = monotoneVectorArg->attrHintMonotone;
365
366 pAigNew = createMonotoneTester(pAig, aigPoIndicesArg, monotoneVectorArg, &poMarker );
367 oldPoNum = Aig_ManCoNum(pAig) - Aig_ManRegNum(pAig);
368
369 vMonotoneIndex = Vec_IntAlloc(0);
370 printf("\nSaig_ManPoNum(pAigNew) = %d, poMarker = %d\n", Saig_ManPoNum(pAigNew), poMarker);
371 for( i=poMarker; i<Saig_ManPoNum(pAigNew); i++ )
372 {
373 pObjTargetPo = Aig_ManCo( pAigNew, i );
374 Aig_ObjChild0Flip( pObjTargetPo );
375
377 pCex = NULL;
378 pPars->fVerbose = 0;
379 //pPars->iOutput = i;
380 //RetValue = Pdr_ManSolve( pAigNew, pPars, &pCex );
381 RetValue = Pdr_ManSolve( pAigNew, pPars );
382 if( RetValue == 1 )
383 {
384 printf("\ni = %d, RetValue = %d : %s (Frame %d)\n", i - oldPoNum + hintSingalBeginningMarkerLocal, RetValue, "Property Proved", pCex? (pCex)->iFrame : -1 );
385 Vec_IntPush( vMonotoneIndex, i - (pendingSignalIndexLocal + 1) + hintSingalBeginningMarkerLocal);
386 }
387 Aig_ObjChild0Flip( pObjTargetPo );
388 }
389
390 if( Vec_IntSize( vMonotoneIndex ) > 0 )
391 return vMonotoneIndex;
392 else
393 return NULL;
394}
Aig_Man_t * createMonotoneTester(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct monotoneVectorsStruct *monotoneVectorArg, int *startMonotonePropPo)
Definition monotone.c:145
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
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:

◆ findPendingSignal()

int findPendingSignal ( Abc_Ntk_t * pNtk)

Definition at line 112 of file monotone.c.

113{
114 int i, pendingSignalIndex = -1;
115 Abc_Obj_t *pNode;
116
117 Abc_NtkForEachPo( pNtk, pNode, i )
118 {
119 if( strstr( Abc_ObjName( pNode ), "pendingSignal" ) != NULL )
120 {
121 pendingSignalIndex = i;
122 break;
123 }
124 }
125
126 return pendingSignalIndex;
127}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findRemainingMonotoneCandidates()

Vec_Int_t * findRemainingMonotoneCandidates ( Vec_Int_t * vKnownMonotone,
Vec_Int_t * vHintMonotone )

Definition at line 396 of file monotone.c.

397{
398 Vec_Int_t *vCandMonotone;
399 int iElem, i;
400
401 if( vKnownMonotone == NULL || Vec_IntSize(vKnownMonotone) <= 0 )
402 return vHintMonotone;
403 vCandMonotone = Vec_IntAlloc(0);
404 Vec_IntForEachEntry( vHintMonotone, iElem, i )
405 {
406 if( Vec_IntFind( vKnownMonotone, iElem ) == -1 )
407 Vec_IntPush( vCandMonotone, iElem );
408 }
409
410 return vCandMonotone;
411}
Here is the caller graph for this function: