ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
disjunctiveMonotone.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 <time.h>
Include dependency graph for disjunctiveMonotone.c:

Go to the source code of this file.

Classes

struct  aigPoIndices
 
struct  antecedentConsequentVectorsStruct
 

Functions

struct aigPoIndicesallocAigPoIndices ()
 
void deallocAigPoIndices (struct aigPoIndices *toBeDeletedAigPoIndices)
 
int collectSafetyInvariantPOIndex (Abc_Ntk_t *pNtk)
 
struct antecedentConsequentVectorsStructallocAntecedentConsequentVectorsStruct ()
 
void deallocAntecedentConsequentVectorsStruct (struct antecedentConsequentVectorsStruct *toBeDeleted)
 
Aig_Man_tcreateDisjunctiveMonotoneTester (Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct antecedentConsequentVectorsStruct *anteConseVectors, int *startMonotonePropPo)
 
Vec_Int_tfindNewDisjunctiveMonotone (Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct antecedentConsequentVectorsStruct *anteConseVectors)
 
Vec_Int_tupdateAnteConseVectors (struct antecedentConsequentVectorsStruct *anteConse)
 
Vec_Int_tvectorDifference (Vec_Int_t *A, Vec_Int_t *B)
 
Vec_Int_tcreateSingletonIntVector (int iElem)
 
int Vec_IntPushUniqueLocal (Vec_Int_t *p, int Entry)
 
Vec_Ptr_tfindNextLevelDisjunctiveMonotone (Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesInstance, struct antecedentConsequentVectorsStruct *anteConsecInstance, Vec_Ptr_t *previousMonotoneVectors)
 
void printAllIntVectors (Vec_Ptr_t *vDisjunctions, Abc_Ntk_t *pNtk, char *fileName)
 
void printAllIntVectorsStabil (Vec_Ptr_t *vDisjunctions, Abc_Ntk_t *pNtk, char *fileName)
 
void appendVecToMasterVecInt (Vec_Ptr_t *masterVec, Vec_Ptr_t *candVec)
 
void deallocateVecOfIntVec (Vec_Ptr_t *vecOfIntVec)
 
Vec_Ptr_tfindDisjunctiveMonotoneSignals (Abc_Ntk_t *pNtk)
 

Function Documentation

◆ allocAigPoIndices()

struct aigPoIndices * allocAigPoIndices ( )
extern

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}
#define assert(ex)
Definition util_old.h:213
char * malloc()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allocAntecedentConsequentVectorsStruct()

struct antecedentConsequentVectorsStruct * allocAntecedentConsequentVectorsStruct ( )

Definition at line 49 of file disjunctiveMonotone.c.

50{
51 struct antecedentConsequentVectorsStruct *newStructure;
52
53 newStructure = (struct antecedentConsequentVectorsStruct *)malloc(sizeof (struct antecedentConsequentVectorsStruct));
54
55 newStructure->attrAntecedents = NULL;
56 newStructure->attrConsequentCandidates = NULL;
57
58 assert( newStructure != NULL );
59 return newStructure;
60}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ appendVecToMasterVecInt()

void appendVecToMasterVecInt ( Vec_Ptr_t * masterVec,
Vec_Ptr_t * candVec )

Definition at line 566 of file disjunctiveMonotone.c.

567{
568 int i;
569 Vec_Int_t *vCand;
570 Vec_Int_t *vNewIntVec;
571
572 assert(masterVec != NULL);
573 assert(candVec != NULL);
574 Vec_PtrForEachEntry( Vec_Int_t *, candVec, vCand, i )
575 {
576 vNewIntVec = Vec_IntDup(vCand);
577 Vec_PtrPush(masterVec, vNewIntVec);
578 }
579}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the caller graph for this function:

◆ collectSafetyInvariantPOIndex()

int collectSafetyInvariantPOIndex ( Abc_Ntk_t * pNtk)
extern

Definition at line 425 of file kliveness.c.

426{
427 Abc_Obj_t *pObj;
428 int i;
429
430 Abc_NtkForEachPo( pNtk, pObj, i )
431 {
432 if( strstr( Abc_ObjName( pObj ), "csSafetyInvar_" ) != NULL )
433 return i;
434 }
435
436 return -1;
437}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#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:

◆ createDisjunctiveMonotoneTester()

Aig_Man_t * createDisjunctiveMonotoneTester ( Aig_Man_t * pAig,
struct aigPoIndices * aigPoIndicesArg,
struct antecedentConsequentVectorsStruct * anteConseVectors,
int * startMonotonePropPo )

Definition at line 72 of file disjunctiveMonotone.c.

74{
75 Aig_Man_t *pNewAig;
76 int iElem, i, nRegCount;
77 int piCopied = 0, liCopied = 0, liCreated = 0, loCopied = 0, loCreated = 0;
78 int poCopied = 0, poCreated = 0;
79 Aig_Obj_t *pObj, *pObjPo, *pObjDriver, *pObjDriverNew, *pObjPendingDriverNew, *pObjPendingAndNextPending;
80 Aig_Obj_t *pPendingFlop, *pObjConseCandFlop, *pObjSafetyInvariantPoDriver;
81 //Vec_Ptr_t *vHintMonotoneLocalDriverNew;
82 Vec_Ptr_t *vConseCandFlopOutput;
83 //Vec_Ptr_t *vHintMonotoneLocalProp;
84
85 Aig_Obj_t *pObjAnteDisjunction, *pObjConsecDriver, *pObjConsecDriverNew, *pObjCandMonotone, *pObjPrevCandMonotone, *pObjMonotonePropDriver;
86 Vec_Ptr_t *vCandMonotoneProp;
87 Vec_Ptr_t *vCandMonotoneFlopInput;
88
89 int pendingSignalIndexLocal = aigPoIndicesArg->attrPendingSignalIndex;
90
91 Vec_Int_t *vAntecedentsLocal = anteConseVectors->attrAntecedents;
92 Vec_Int_t *vConsequentCandidatesLocal = anteConseVectors->attrConsequentCandidates;
93
94 if( vConsequentCandidatesLocal == NULL )
95 return NULL; //no candidates for consequent is provided, hence no need to generate a new AIG
96
97
98 //****************************************************************
99 // Step1: create the new manager
100 // Note: The new manager is created with "2 * Aig_ManObjNumMax(p)"
101 // nodes, but this selection is arbitrary - need to be justified
102 //****************************************************************
103 pNewAig = Aig_ManStart( Aig_ManObjNumMax(pAig) );
104 pNewAig->pName = (char *)malloc( strlen( pAig->pName ) + strlen("_monotone") + 2 );
105 sprintf(pNewAig->pName, "%s_%s", pAig->pName, "monotone");
106 pNewAig->pSpec = NULL;
107
108 //****************************************************************
109 // Step 2: map constant nodes
110 //****************************************************************
111 pObj = Aig_ManConst1( pAig );
112 pObj->pData = Aig_ManConst1( pNewAig );
113
114 //****************************************************************
115 // Step 3: create true PIs
116 //****************************************************************
117 Saig_ManForEachPi( pAig, pObj, i )
118 {
119 piCopied++;
120 pObj->pData = Aig_ObjCreateCi(pNewAig);
121 }
122
123 //****************************************************************
124 // Step 5: create register outputs
125 //****************************************************************
126 Saig_ManForEachLo( pAig, pObj, i )
127 {
128 loCopied++;
129 pObj->pData = Aig_ObjCreateCi(pNewAig);
130 }
131
132 //****************************************************************
133 // Step 6: create "D" register output for PENDING flop
134 //****************************************************************
135 loCreated++;
136 pPendingFlop = Aig_ObjCreateCi( pNewAig );
137
138 //****************************************************************
139 // Step 6.a: create "D" register output for HINT_MONOTONE flop
140 //****************************************************************
141 vConseCandFlopOutput = Vec_PtrAlloc(Vec_IntSize(vConsequentCandidatesLocal));
142 Vec_IntForEachEntry( vConsequentCandidatesLocal, iElem, i )
143 {
144 loCreated++;
145 pObjConseCandFlop = Aig_ObjCreateCi( pNewAig );
146 Vec_PtrPush( vConseCandFlopOutput, pObjConseCandFlop );
147 }
148
149 nRegCount = loCreated + loCopied;
150
151 //********************************************************************
152 // Step 7: create internal nodes
153 //********************************************************************
154 Aig_ManForEachNode( pAig, pObj, i )
155 {
156 pObj->pData = Aig_And( pNewAig, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
157 }
158
159 //********************************************************************
160 // Step 8: mapping appropriate new flop drivers
161 //********************************************************************
162
163 if( aigPoIndicesArg->attrSafetyInvarIndex != -1 )
164 {
165 pObjPo = Aig_ManCo( pAig, aigPoIndicesArg->attrSafetyInvarIndex );
166 pObjDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
167 pObjDriverNew = !Aig_IsComplement(pObjDriver)?
168 (Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData) :
169 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData));
170 pObjSafetyInvariantPoDriver = pObjDriverNew;
171 }
172 else
173 pObjSafetyInvariantPoDriver = Aig_ManConst1(pNewAig);
174
175 pObjPo = Aig_ManCo( pAig, pendingSignalIndexLocal );
176 pObjDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
177 pObjPendingDriverNew = !Aig_IsComplement(pObjDriver)?
178 (Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData) :
179 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData));
180
181 pObjPendingAndNextPending = Aig_And( pNewAig, pObjPendingDriverNew, pPendingFlop );
182
183 pObjAnteDisjunction = Aig_Not(Aig_ManConst1( pNewAig ));
184 if( vAntecedentsLocal )
185 {
186 Vec_IntForEachEntry( vAntecedentsLocal, iElem, i )
187 {
188 pObjPo = Aig_ManCo( pAig, iElem );
189 pObjDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
190 pObjDriverNew = !Aig_IsComplement(pObjDriver)?
191 (Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData) :
192 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjDriver)->pData));
193
194 pObjAnteDisjunction = Aig_Or( pNewAig, pObjDriverNew, pObjAnteDisjunction );
195 }
196 }
197
198 vCandMonotoneProp = Vec_PtrAlloc( Vec_IntSize(vConsequentCandidatesLocal) );
199 vCandMonotoneFlopInput = Vec_PtrAlloc( Vec_IntSize(vConsequentCandidatesLocal) );
200 Vec_IntForEachEntry( vConsequentCandidatesLocal, iElem, i )
201 {
202 pObjPo = Aig_ManCo( pAig, iElem );
203 pObjConsecDriver = Aig_NotCond((Aig_Obj_t *)Aig_ObjFanin0(pObjPo), Aig_ObjFaninC0(pObjPo));
204 pObjConsecDriverNew = !Aig_IsComplement(pObjConsecDriver)?
205 (Aig_Obj_t *)(Aig_Regular(pObjConsecDriver)->pData) :
206 Aig_Not((Aig_Obj_t *)(Aig_Regular(pObjConsecDriver)->pData));
207
208 pObjCandMonotone = Aig_Or( pNewAig, pObjConsecDriverNew, pObjAnteDisjunction );
209 pObjPrevCandMonotone = (Aig_Obj_t *)(Vec_PtrEntry( vConseCandFlopOutput, i ));
210 pObjMonotonePropDriver = Aig_Or( pNewAig, Aig_Not( Aig_And( pNewAig, pObjPendingAndNextPending, pObjPrevCandMonotone ) ),
211 pObjCandMonotone );
212
213 //Conjunting safety invar
214 pObjMonotonePropDriver = Aig_And( pNewAig, pObjMonotonePropDriver, pObjSafetyInvariantPoDriver );
215
216 Vec_PtrPush( vCandMonotoneFlopInput, pObjCandMonotone );
217 Vec_PtrPush( vCandMonotoneProp, pObjMonotonePropDriver );
218 }
219
220 //********************************************************************
221 // Step 9: create primary outputs
222 //********************************************************************
223 Saig_ManForEachPo( pAig, pObj, i )
224 {
225 poCopied++;
226 pObj->pData = Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
227 }
228
229 *startMonotonePropPo = i;
230 Vec_PtrForEachEntry( Aig_Obj_t *, vCandMonotoneProp, pObj, i )
231 {
232 poCreated++;
233 pObjPo = Aig_ObjCreateCo( pNewAig, pObj );
234 }
235
236 //********************************************************************
237 // Step 9: create latch inputs
238 //********************************************************************
239
240 Saig_ManForEachLi( pAig, pObj, i )
241 {
242 liCopied++;
243 Aig_ObjCreateCo( pNewAig, Aig_ObjChild0Copy(pObj) );
244 }
245
246 //********************************************************************
247 // Step 9.a: create latch input for PENDING_FLOP
248 //********************************************************************
249
250 liCreated++;
251 Aig_ObjCreateCo( pNewAig, pObjPendingDriverNew );
252
253 //********************************************************************
254 // Step 9.b: create latch input for MONOTONE_FLOP
255 //********************************************************************
256
257 Vec_PtrForEachEntry( Aig_Obj_t *, vCandMonotoneFlopInput, pObj, i )
258 {
259 liCreated++;
260 Aig_ObjCreateCo( pNewAig, pObj );
261 }
262
263 Aig_ManSetRegNum( pNewAig, nRegCount );
264 Aig_ManCleanup( pNewAig );
265
266 assert( Aig_ManCheck( pNewAig ) );
267 assert( loCopied + loCreated == liCopied + liCreated );
268
269 Vec_PtrFree(vConseCandFlopOutput);
270 Vec_PtrFree(vCandMonotoneProp);
271 Vec_PtrFree(vCandMonotoneFlopInput);
272 return pNewAig;
273}
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
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition aigMan.c:47
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
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
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:259
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition aigCheck.c:45
#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()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createSingletonIntVector()

Vec_Int_t * createSingletonIntVector ( int iElem)

Definition at line 380 of file disjunctiveMonotone.c.

381{
382 Vec_Int_t *myVec = Vec_IntAlloc(1);
383
384 Vec_IntPush(myVec, iElem);
385 return myVec;
386}
Here is the caller graph for this function:

◆ deallocAigPoIndices()

void deallocAigPoIndices ( struct aigPoIndices * toBeDeletedAigPoIndices)
extern

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:

◆ deallocAntecedentConsequentVectorsStruct()

void deallocAntecedentConsequentVectorsStruct ( struct antecedentConsequentVectorsStruct * toBeDeleted)

Definition at line 62 of file disjunctiveMonotone.c.

63{
64 assert( toBeDeleted != NULL );
65 if(toBeDeleted->attrAntecedents)
66 Vec_IntFree( toBeDeleted->attrAntecedents );
67 if(toBeDeleted->attrConsequentCandidates)
68 Vec_IntFree( toBeDeleted->attrConsequentCandidates );
69 free( toBeDeleted );
70}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deallocateVecOfIntVec()

void deallocateVecOfIntVec ( Vec_Ptr_t * vecOfIntVec)

Definition at line 581 of file disjunctiveMonotone.c.

582{
583 Vec_Int_t *vInt;
584 int i;
585
586 if( vecOfIntVec )
587 {
588 Vec_PtrForEachEntry( Vec_Int_t *, vecOfIntVec, vInt, i )
589 {
590 Vec_IntFree( vInt );
591 }
592 Vec_PtrFree(vecOfIntVec);
593 }
594}
Here is the caller graph for this function:

◆ findDisjunctiveMonotoneSignals()

Vec_Ptr_t * findDisjunctiveMonotoneSignals ( Abc_Ntk_t * pNtk)

Definition at line 596 of file disjunctiveMonotone.c.

597{
598 Aig_Man_t *pAig;
599 Vec_Int_t *vCandidateMonotoneSignals;
600 Vec_Int_t *vKnownMonotoneSignals;
601 //Vec_Int_t *vKnownMonotoneSignalsRoundTwo;
602 //Vec_Int_t *vOldConsequentVector;
603 //Vec_Int_t *vRemainingConsecVector;
604 int i;
605 int iElem;
606 int pendingSignalIndex;
607 Abc_Ntk_t *pNtkTemp;
608 int hintSingalBeginningMarker;
609 int hintSingalEndMarker;
610 struct aigPoIndices *aigPoIndicesInstance;
611 //struct monotoneVectorsStruct *monotoneVectorsInstance;
612 struct antecedentConsequentVectorsStruct *anteConsecInstance;
613 //Aig_Obj_t *safetyDriverNew;
614 Vec_Int_t *newIntVec;
615 Vec_Ptr_t *levelOneMonotne, *levelTwoMonotne;
616 //Vec_Ptr_t *levelThreeMonotne;
617
618 Vec_Ptr_t *vMasterDisjunctions;
619
620 extern int findPendingSignal(Abc_Ntk_t *pNtk);
621 extern Vec_Int_t *findHintOutputs(Abc_Ntk_t *pNtk);
622 extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
623
624 //system("rm monotone.dat");
625
626 /*******************************************/
627 //Finding the PO index of the pending signal
628 /*******************************************/
629 pendingSignalIndex = findPendingSignal(pNtk);
630 if( pendingSignalIndex == -1 )
631 {
632 printf("\nNo Pending Signal Found\n");
633 return NULL;
634 }
635 //else
636 //printf("Po[%d] = %s\n", pendingSignalIndex, Abc_ObjName( Abc_NtkPo(pNtk, pendingSignalIndex) ) );
637
638 /*******************************************/
639 //Finding the PO indices of all hint signals
640 /*******************************************/
641 vCandidateMonotoneSignals = findHintOutputs(pNtk);
642 if( vCandidateMonotoneSignals == NULL )
643 return NULL;
644 else
645 {
646 //Vec_IntForEachEntry( vCandidateMonotoneSignals, iElem, i )
647 // printf("Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
648 hintSingalBeginningMarker = Vec_IntEntry( vCandidateMonotoneSignals, 0 );
649 hintSingalEndMarker = Vec_IntEntry( vCandidateMonotoneSignals, Vec_IntSize(vCandidateMonotoneSignals) - 1 );
650 }
651
652 /**********************************************/
653 //Allocating "struct" with necessary parameters
654 /**********************************************/
655 aigPoIndicesInstance = allocAigPoIndices();
656 aigPoIndicesInstance->attrPendingSignalIndex = pendingSignalIndex;
657 aigPoIndicesInstance->attrHintSingalBeginningMarker = hintSingalBeginningMarker;
658 aigPoIndicesInstance->attrHintSingalEndMarker = hintSingalEndMarker;
659 aigPoIndicesInstance->attrSafetyInvarIndex = collectSafetyInvariantPOIndex(pNtk);
660
661 /****************************************************/
662 //Allocating "struct" with necessary monotone vectors
663 /****************************************************/
664 anteConsecInstance = allocAntecedentConsequentVectorsStruct();
665 anteConsecInstance->attrAntecedents = NULL;
666 anteConsecInstance->attrConsequentCandidates = vCandidateMonotoneSignals;
667
668 /*******************************************/
669 //Generate AIG from Ntk
670 /*******************************************/
671 if( !Abc_NtkIsStrash( pNtk ) )
672 {
673 pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 );
674 pAig = Abc_NtkToDar( pNtkTemp, 0, 1 );
675 }
676 else
677 {
678 pAig = Abc_NtkToDar( pNtk, 0, 1 );
679 pNtkTemp = pNtk;
680 }
681
682 /*******************************************/
683 //finding LEVEL 1 monotone signals
684 /*******************************************/
685 //printf("Calling target function outside loop\n");
686 vKnownMonotoneSignals = findNewDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance );
687 levelOneMonotne = Vec_PtrAlloc(0);
688 Vec_IntForEachEntry( vKnownMonotoneSignals, iElem, i )
689 {
690 newIntVec = createSingletonIntVector( iElem );
691 Vec_PtrPush( levelOneMonotne, newIntVec );
692 //printf("Monotone Po[%d] = %s\n", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ) );
693 }
694 //printAllIntVectors( levelOneMonotne, pNtk, "monotone.dat" );
695
696 vMasterDisjunctions = Vec_PtrAlloc( Vec_PtrSize( levelOneMonotne ));
697 appendVecToMasterVecInt(vMasterDisjunctions, levelOneMonotne );
698
699 /*******************************************/
700 //finding LEVEL >1 monotone signals
701 /*******************************************/
702 #if 0
703 if( vKnownMonotoneSignals )
704 {
705 Vec_IntForEachEntry( vKnownMonotoneSignals, iElem, i )
706 {
707 printf("\n**************************************************************\n");
708 printf("Exploring Second Layer : Reference Po[%d] = %s", iElem, Abc_ObjName( Abc_NtkPo(pNtk, iElem) ));
709 printf("\n**************************************************************\n");
710 anteConsecInstance->attrAntecedents = createSingletonIntVector( iElem );
711 vOldConsequentVector = anteConsecInstance->attrConsequentCandidates;
712 vRemainingConsecVector = updateAnteConseVectors(anteConsecInstance);
713 if( anteConsecInstance->attrConsequentCandidates != vRemainingConsecVector )
714 {
715 anteConsecInstance->attrConsequentCandidates = vRemainingConsecVector;
716 }
717 vKnownMonotoneSignalsRoundTwo = findNewDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance );
718 Vec_IntForEachEntry( vKnownMonotoneSignalsRoundTwo, iElemTwo, iTwo )
719 {
720 printf("Monotone Po[%d] = %s, (%d, %d)\n", iElemTwo, Abc_ObjName( Abc_NtkPo(pNtk, iElemTwo) ), iElem, iElemTwo );
721 }
722 Vec_IntFree(vKnownMonotoneSignalsRoundTwo);
723 Vec_IntFree(anteConsecInstance->attrAntecedents);
724 if(anteConsecInstance->attrConsequentCandidates != vOldConsequentVector)
725 {
726 Vec_IntFree(anteConsecInstance->attrConsequentCandidates);
727 anteConsecInstance->attrConsequentCandidates = vOldConsequentVector;
728 }
729 }
730 }
731 #endif
732
733#if 1
734 levelTwoMonotne = findNextLevelDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance, levelOneMonotne );
735 //printAllIntVectors( levelTwoMonotne, pNtk, "monotone.dat" );
736 appendVecToMasterVecInt(vMasterDisjunctions, levelTwoMonotne );
737#endif
738
739 //levelThreeMonotne = findNextLevelDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstance, levelTwoMonotne );
740 //printAllIntVectors( levelThreeMonotne );
741 //printAllIntVectors( levelTwoMonotne, pNtk, "monotone.dat" );
742 //appendVecToMasterVecInt(vMasterDisjunctions, levelThreeMonotne );
743
744 deallocAigPoIndices(aigPoIndicesInstance);
746 //deallocPointersToMonotoneVectors(monotoneVectorsInstance);
747
748 deallocateVecOfIntVec( levelOneMonotne );
749 deallocateVecOfIntVec( levelTwoMonotne );
750
751 Aig_ManStop(pAig);
752 Vec_IntFree(vKnownMonotoneSignals);
753
754 return vMasterDisjunctions;
755}
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
void Aig_ManStop(Aig_Man_t *p)
Definition aigMan.c:187
Vec_Int_t * createSingletonIntVector(int iElem)
int collectSafetyInvariantPOIndex(Abc_Ntk_t *pNtk)
Definition kliveness.c:425
struct aigPoIndices * allocAigPoIndices()
Definition monotone.c:43
Vec_Int_t * updateAnteConseVectors(struct antecedentConsequentVectorsStruct *anteConse)
void deallocAigPoIndices(struct aigPoIndices *toBeDeletedAigPoIndices)
Definition monotone.c:57
void appendVecToMasterVecInt(Vec_Ptr_t *masterVec, Vec_Ptr_t *candVec)
void deallocateVecOfIntVec(Vec_Ptr_t *vecOfIntVec)
Vec_Ptr_t * findNextLevelDisjunctiveMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesInstance, struct antecedentConsequentVectorsStruct *anteConsecInstance, Vec_Ptr_t *previousMonotoneVectors)
void deallocAntecedentConsequentVectorsStruct(struct antecedentConsequentVectorsStruct *toBeDeleted)
Vec_Int_t * findNewDisjunctiveMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct antecedentConsequentVectorsStruct *anteConseVectors)
struct antecedentConsequentVectorsStruct * allocAntecedentConsequentVectorsStruct()
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition abcDar.c:237
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition monotone.c:90
int findPendingSignal(Abc_Ntk_t *pNtk)
Definition monotone.c:112
Here is the call graph for this function:
Here is the caller graph for this function:

◆ findNewDisjunctiveMonotone()

Vec_Int_t * findNewDisjunctiveMonotone ( Aig_Man_t * pAig,
struct aigPoIndices * aigPoIndicesArg,
struct antecedentConsequentVectorsStruct * anteConseVectors )

Definition at line 275 of file disjunctiveMonotone.c.

276{
277 Aig_Man_t *pAigNew;
278 Aig_Obj_t *pObjTargetPo;
279 int poMarker;
280 //int i, RetValue, poSerialNum;
281 int i, poSerialNum;
282 Pdr_Par_t Pars, * pPars = &Pars;
283 //Abc_Cex_t * pCex = NULL;
284 Vec_Int_t *vMonotoneIndex;
285 //char fileName[20];
286 Abc_Cex_t * cexElem;
287
288 int pendingSignalIndexLocal = aigPoIndicesArg->attrPendingSignalIndex;
289
290 pAigNew = createDisjunctiveMonotoneTester(pAig, aigPoIndicesArg, anteConseVectors, &poMarker );
291
292 //printf("enter an integer : ");
293 //waitForInteger = getchar();
294 //putchar(waitForInteger);
295
296 vMonotoneIndex = Vec_IntAlloc(0);
297
298 for( i=0; i<Saig_ManPoNum(pAigNew); i++ )
299 {
300 pObjTargetPo = Aig_ManCo( pAigNew, i );
301 Aig_ObjChild0Flip( pObjTargetPo );
302 }
303
305 pPars->fVerbose = 0;
306 pPars->fNotVerbose = 1;
307 pPars->fSolveAll = 1;
308 pAigNew->vSeqModelVec = NULL;
309 Pdr_ManSolve( pAigNew, pPars );
310
311 if( pAigNew->vSeqModelVec )
312 {
313 Vec_PtrForEachEntry( Abc_Cex_t *, pAigNew->vSeqModelVec, cexElem, i )
314 {
315 if( cexElem == NULL && i >= pendingSignalIndexLocal + 1)
316 {
317 poSerialNum = i - (pendingSignalIndexLocal + 1);
318 Vec_IntPush( vMonotoneIndex, Vec_IntEntry( anteConseVectors->attrConsequentCandidates, poSerialNum ));
319 }
320 }
321 }
322 for( i=0; i<Saig_ManPoNum(pAigNew); i++ )
323 {
324 pObjTargetPo = Aig_ManCo( pAigNew, i );
325 Aig_ObjChild0Flip( pObjTargetPo );
326 }
327
328 //if(pAigNew->vSeqModelVec)
329 // Vec_PtrFree(pAigNew->vSeqModelVec);
330
331 Aig_ManStop(pAigNew);
332
333 if( Vec_IntSize( vMonotoneIndex ) > 0 )
334 {
335 return vMonotoneIndex;
336 }
337 else
338 {
339 Vec_IntFree(vMonotoneIndex);
340 return NULL;
341 }
342}
Aig_Man_t * createDisjunctiveMonotoneTester(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct antecedentConsequentVectorsStruct *anteConseVectors, int *startMonotonePropPo)
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:

◆ findNextLevelDisjunctiveMonotone()

Vec_Ptr_t * findNextLevelDisjunctiveMonotone ( Aig_Man_t * pAig,
struct aigPoIndices * aigPoIndicesInstance,
struct antecedentConsequentVectorsStruct * anteConsecInstance,
Vec_Ptr_t * previousMonotoneVectors )

Definition at line 450 of file disjunctiveMonotone.c.

455{
456 Vec_Ptr_t *newLevelPtrVec;
457 Vec_Int_t *vElem, *vNewDisjunctVector, *newDisjunction;
458 int i, j, iElem;
459 struct antecedentConsequentVectorsStruct *anteConsecInstanceLocal;
460 Vec_Int_t *vUnionPrevMonotoneVector, *vDiffVector;
461
462 newLevelPtrVec = Vec_PtrAlloc(0);
463 vUnionPrevMonotoneVector = Vec_IntAlloc(0);
464 Vec_PtrForEachEntry(Vec_Int_t *, previousMonotoneVectors, vElem, i)
465 Vec_IntForEachEntry( vElem, iElem, j )
466 Vec_IntPushUniqueLocal( vUnionPrevMonotoneVector, iElem );
467
468 Vec_PtrForEachEntry(Vec_Int_t *, previousMonotoneVectors, vElem, i)
469 {
470 anteConsecInstanceLocal = allocAntecedentConsequentVectorsStruct();
471
472 anteConsecInstanceLocal->attrAntecedents = Vec_IntDup(vElem);
473 vDiffVector = vectorDifference( anteConsecInstance->attrConsequentCandidates, vUnionPrevMonotoneVector);
474 anteConsecInstanceLocal->attrConsequentCandidates = vDiffVector;
475 assert( vDiffVector );
476
477 //printf("Calling target function %d\n", i);
478 vNewDisjunctVector = findNewDisjunctiveMonotone( pAig, aigPoIndicesInstance, anteConsecInstanceLocal );
479
480 if( vNewDisjunctVector )
481 {
482 Vec_IntForEachEntry(vNewDisjunctVector, iElem, j)
483 {
484 newDisjunction = Vec_IntDup(vElem);
485 Vec_IntPush( newDisjunction, iElem );
486 Vec_PtrPush( newLevelPtrVec, newDisjunction );
487 }
488 Vec_IntFree(vNewDisjunctVector);
489 }
490 deallocAntecedentConsequentVectorsStruct( anteConsecInstanceLocal );
491 }
492
493 Vec_IntFree(vUnionPrevMonotoneVector);
494
495 return newLevelPtrVec;
496}
Vec_Int_t * vectorDifference(Vec_Int_t *A, Vec_Int_t *B)
int Vec_IntPushUniqueLocal(Vec_Int_t *p, int Entry)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printAllIntVectors()

void printAllIntVectors ( Vec_Ptr_t * vDisjunctions,
Abc_Ntk_t * pNtk,
char * fileName )

Definition at line 498 of file disjunctiveMonotone.c.

499{
500 Vec_Int_t *vElem;
501 int i, j, iElem;
502 char *name, *hintSubStr;
503 FILE *fp;
504
505 fp = fopen( fileName, "a" );
506
507 Vec_PtrForEachEntry(Vec_Int_t *, vDisjunctions, vElem, i)
508 {
509 fprintf(fp, "( ");
510 Vec_IntForEachEntry( vElem, iElem, j )
511 {
512 name = Abc_ObjName( Abc_NtkPo(pNtk, iElem));
513 hintSubStr = strstr( name, "hint");
514 assert( hintSubStr );
515 fprintf(fp, "%s", hintSubStr);
516 if( j < Vec_IntSize(vElem) - 1 )
517 {
518 fprintf(fp, " || ");
519 }
520 else
521 {
522 fprintf(fp, " )\n");
523 }
524 }
525 }
526 fclose(fp);
527}
char * name
Definition main.h:24
Here is the call graph for this function:

◆ printAllIntVectorsStabil()

void printAllIntVectorsStabil ( Vec_Ptr_t * vDisjunctions,
Abc_Ntk_t * pNtk,
char * fileName )

Definition at line 529 of file disjunctiveMonotone.c.

530{
531 Vec_Int_t *vElem;
532 int i, j, iElem;
533 char *name, *hintSubStr;
534 FILE *fp;
535
536 fp = fopen( fileName, "a" );
537
538 Vec_PtrForEachEntry(Vec_Int_t *, vDisjunctions, vElem, i)
539 {
540 printf("INT[%d] : ( ", i);
541 fprintf(fp, "( ");
542 Vec_IntForEachEntry( vElem, iElem, j )
543 {
544 name = Abc_ObjName( Abc_NtkPo(pNtk, iElem));
545 hintSubStr = strstr( name, "csLevel1Stabil");
546 assert( hintSubStr );
547 printf("%s", hintSubStr);
548 fprintf(fp, "%s", hintSubStr);
549 if( j < Vec_IntSize(vElem) - 1 )
550 {
551 printf(" || ");
552 fprintf(fp, " || ");
553 }
554 else
555 {
556 printf(" )\n");
557 fprintf(fp, " )\n");
558 }
559 }
560 //printf(")\n");
561 }
562 fclose(fp);
563}
Here is the call graph for this function:

◆ updateAnteConseVectors()

Vec_Int_t * updateAnteConseVectors ( struct antecedentConsequentVectorsStruct * anteConse)

Definition at line 344 of file disjunctiveMonotone.c.

345{
346 Vec_Int_t *vCandMonotone;
347 int iElem, i;
348
349 //if( vKnownMonotone == NULL || Vec_IntSize(vKnownMonotone) <= 0 )
350 // return vHintMonotone;
351 if( anteConse->attrAntecedents == NULL || Vec_IntSize(anteConse->attrAntecedents) <= 0 )
352 return anteConse->attrConsequentCandidates;
353 vCandMonotone = Vec_IntAlloc(0);
354 Vec_IntForEachEntry( anteConse->attrConsequentCandidates, iElem, i )
355 {
356 if( Vec_IntFind( anteConse->attrAntecedents, iElem ) == -1 )
357 Vec_IntPush( vCandMonotone, iElem );
358 }
359
360 return vCandMonotone;
361}
Here is the caller graph for this function:

◆ Vec_IntPushUniqueLocal()

int Vec_IntPushUniqueLocal ( Vec_Int_t * p,
int Entry )

Definition at line 440 of file disjunctiveMonotone.c.

441{
442 int i;
443 for ( i = 0; i < p->nSize; i++ )
444 if ( p->pArray[i] == Entry )
445 return 1;
446 Vec_IntPush( p, Entry );
447 return 0;
448}
Cube * p
Definition exorList.c:222
Here is the caller graph for this function:

◆ vectorDifference()

Vec_Int_t * vectorDifference ( Vec_Int_t * A,
Vec_Int_t * B )

Definition at line 363 of file disjunctiveMonotone.c.

364{
365 Vec_Int_t *C;
366 int iElem, i;
367
368 C = Vec_IntAlloc(0);
369 Vec_IntForEachEntry( A, iElem, i )
370 {
371 if( Vec_IntFind( B, iElem ) == -1 )
372 {
373 Vec_IntPush( C, iElem );
374 }
375 }
376
377 return C;
378}
Here is the caller graph for this function: