abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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"

Go to the source code of this file.

Data Structures

struct  aigPoIndices
 
struct  monotoneVectorsStruct
 

Functions

ABC_NAMESPACE_IMPL_START
Aig_Man_t
Abc_NtkToDar (Abc_Ntk_t *pNtk, int fExors, int fRegisters)
 DECLARATIONS ///. More...
 
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_NAMESPACE_IMPL_START Aig_Man_t* Abc_NtkToDar ( Abc_Ntk_t pNtk,
int  fExors,
int  fRegisters 
)

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 233 of file abcDar.c.

234 {
235  Vec_Ptr_t * vNodes;
236  Aig_Man_t * pMan;
237  Aig_Obj_t * pObjNew;
238  Abc_Obj_t * pObj;
239  int i, nNodes, nDontCares;
240  // make sure the latches follow PIs/POs
241  if ( fRegisters )
242  {
243  assert( Abc_NtkBoxNum(pNtk) == Abc_NtkLatchNum(pNtk) );
244  Abc_NtkForEachCi( pNtk, pObj, i )
245  if ( i < Abc_NtkPiNum(pNtk) )
246  {
247  assert( Abc_ObjIsPi(pObj) );
248  if ( !Abc_ObjIsPi(pObj) )
249  Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PI ordering is wrong!\n" );
250  }
251  else
252  assert( Abc_ObjIsBo(pObj) );
253  Abc_NtkForEachCo( pNtk, pObj, i )
254  if ( i < Abc_NtkPoNum(pNtk) )
255  {
256  assert( Abc_ObjIsPo(pObj) );
257  if ( !Abc_ObjIsPo(pObj) )
258  Abc_Print( 1, "Abc_NtkToDar(): Temporary bug: The PO ordering is wrong!\n" );
259  }
260  else
261  assert( Abc_ObjIsBi(pObj) );
262  // print warning about initial values
263  nDontCares = 0;
264  Abc_NtkForEachLatch( pNtk, pObj, i )
265  if ( Abc_LatchIsInitDc(pObj) )
266  {
267  Abc_LatchSetInit0(pObj);
268  nDontCares++;
269  }
270  if ( nDontCares )
271  {
272  Abc_Print( 1, "Warning: %d registers in this network have don't-care init values.\n", nDontCares );
273  Abc_Print( 1, "The don't-care are assumed to be 0. The result may not verify.\n" );
274  Abc_Print( 1, "Use command \"print_latch\" to see the init values of registers.\n" );
275  Abc_Print( 1, "Use command \"zero\" to convert or \"init\" to change the values.\n" );
276  }
277  }
278  // create the manager
279  pMan = Aig_ManStart( Abc_NtkNodeNum(pNtk) + 100 );
280  pMan->fCatchExor = fExors;
281  pMan->nConstrs = pNtk->nConstrs;
282  pMan->nBarBufs = pNtk->nBarBufs;
283  pMan->pName = Extra_UtilStrsav( pNtk->pName );
284  pMan->pSpec = Extra_UtilStrsav( pNtk->pSpec );
285  // transfer the pointers to the basic nodes
286  Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Aig_ManConst1(pMan);
287  Abc_NtkForEachCi( pNtk, pObj, i )
288  {
289  pObj->pCopy = (Abc_Obj_t *)Aig_ObjCreateCi(pMan);
290  // initialize logic level of the CIs
291  ((Aig_Obj_t *)pObj->pCopy)->Level = pObj->Level;
292  }
293  // complement the 1-values registers
294  if ( fRegisters ) {
295  Abc_NtkForEachLatch( pNtk, pObj, i )
296  if ( Abc_LatchIsInit1(pObj) )
297  Abc_ObjFanout0(pObj)->pCopy = Abc_ObjNot(Abc_ObjFanout0(pObj)->pCopy);
298  }
299  // perform the conversion of the internal nodes (assumes DFS ordering)
300 // pMan->fAddStrash = 1;
301  vNodes = Abc_NtkDfs( pNtk, 0 );
302  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
303 // Abc_NtkForEachNode( pNtk, pObj, i )
304  {
305  pObj->pCopy = (Abc_Obj_t *)Aig_And( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj), (Aig_Obj_t *)Abc_ObjChild1Copy(pObj) );
306 // Abc_Print( 1, "%d->%d ", pObj->Id, ((Aig_Obj_t *)pObj->pCopy)->Id );
307  }
308  Vec_PtrFree( vNodes );
309  pMan->fAddStrash = 0;
310  // create the POs
311  Abc_NtkForEachCo( pNtk, pObj, i )
312  Aig_ObjCreateCo( pMan, (Aig_Obj_t *)Abc_ObjChild0Copy(pObj) );
313  // complement the 1-valued registers
314  Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
315  if ( fRegisters )
316  Aig_ManForEachLiSeq( pMan, pObjNew, i )
318  pObjNew->pFanin0 = Aig_Not(pObjNew->pFanin0);
319  // remove dangling nodes
320  nNodes = (Abc_NtkGetChoiceNum(pNtk) == 0)? Aig_ManCleanup( pMan ) : 0;
321  if ( !fExors && nNodes )
322  Abc_Print( 1, "Abc_NtkToDar(): Unexpected %d dangling nodes when converting to AIG!\n", nNodes );
323 //Aig_ManDumpVerilog( pMan, "test.v" );
324  // save the number of registers
325  if ( fRegisters )
326  {
327  Aig_ManSetRegNum( pMan, Abc_NtkLatchNum(pNtk) );
328  pMan->vFlopNums = Vec_IntStartNatural( pMan->nRegs );
329 // pMan->vFlopNums = NULL;
330 // pMan->vOnehots = Abc_NtkConverLatchNamesIntoNumbers( pNtk );
331  if ( pNtk->vOnehots )
332  pMan->vOnehots = (Vec_Ptr_t *)Vec_VecDupInt( (Vec_Vec_t *)pNtk->vOnehots );
333  }
334  if ( !Aig_ManCheck( pMan ) )
335  {
336  Abc_Print( 1, "Abc_NtkToDar: AIG check has failed.\n" );
337  Aig_ManStop( pMan );
338  return NULL;
339  }
340  return pMan;
341 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
unsigned Level
Definition: aig.h:82
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static int Abc_ObjIsBo(Abc_Obj_t *pObj)
Definition: abc.h:350
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
void Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
static int Abc_NtkBoxNum(Abc_Ntk_t *pNtk)
Definition: abc.h:289
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static Abc_Obj_t * Abc_ObjChild1Copy(Abc_Obj_t *pObj)
Definition: abc.h:387
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static Vec_Int_t * Vec_IntStartNatural(int nSize)
Definition: bblif.c:192
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
unsigned Level
Definition: abc.h:142
char * Extra_UtilStrsav(const char *s)
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
static Vec_Vec_t * Vec_VecDupInt(Vec_Vec_t *p)
Definition: vecVec.h:395
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static Abc_Obj_t * Abc_ObjChild0Copy(Abc_Obj_t *pObj)
Definition: abc.h:386
Abc_Obj_t * pCopy
Definition: abc.h:148
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
static int Abc_LatchIsInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:424
if(last==0)
Definition: sparse_int.h:34
Definition: aig.h:69
#define Abc_NtkForEachLatch(pNtk, pObj, i)
Definition: abc.h:497
static int Abc_LatchIsInit1(Abc_Obj_t *pLatch)
Definition: abc.h:423
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static int Abc_ObjIsBi(Abc_Obj_t *pObj)
Definition: abc.h:349
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
static int Abc_ObjIsPo(Abc_Obj_t *pObj)
Definition: abc.h:348
#define assert(ex)
Definition: util_old.h:213
#define Aig_ManForEachLiSeq(p, pObj, i)
Definition: aig.h:447
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
DECLARATIONS ///.
Definition: abcDar.c:233
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
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()
int attrHintSingalBeginningMarker
#define assert(ex)
Definition: util_old.h:213
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 }
char * malloc()
Vec_Int_t * attrKnownMonotone
Definition: monotone.c:65
Vec_Int_t * attrHintMonotone
Definition: monotone.c:67
Vec_Int_t * attrCandMonotone
Definition: monotone.c:66
#define assert(ex)
Definition: util_old.h:213
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
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 }
Aig_Obj_t * Aig_ObjCreateCo(Aig_Man_t *p, Aig_Obj_t *pDriver)
Definition: aigObj.c:66
char * malloc()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ABC_DLL int Aig_ManCheck(Aig_Man_t *p)
FUNCTION DECLARATIONS ///.
Definition: aigCheck.c:45
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
Aig_Man_t * Aig_ManStart(int nNodesMax)
DECLARATIONS ///.
Definition: aigMan.c:47
static int Aig_IsComplement(Aig_Obj_t *p)
Definition: aig.h:249
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
Aig_Obj_t * Aig_ObjCreateCi(Aig_Man_t *p)
DECLARATIONS ///.
Definition: aigObj.c:45
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Aig_Obj_t * Aig_Not(Aig_Obj_t *p)
Definition: aig.h:247
int attrHintSingalBeginningMarker
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
void Aig_ManSetRegNum(Aig_Man_t *p, int nRegs)
Definition: aigMan.c:438
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Vec_Int_t * attrKnownMonotone
Definition: monotone.c:65
static Aig_Obj_t * Aig_ObjChild1Copy(Aig_Obj_t *pObj)
Definition: aig.h:313
Aig_Obj_t * Aig_Or(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:259
Definition: aig.h:69
char * sprintf()
#define Saig_ManForEachLo(p, pObj, i)
Definition: saig.h:96
Vec_Int_t * attrHintMonotone
Definition: monotone.c:67
static Aig_Obj_t * Aig_ObjChild0Copy(Aig_Obj_t *pObj)
Definition: aig.h:312
static int Aig_ObjFaninC0(Aig_Obj_t *pObj)
Definition: aig.h:306
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
Vec_Int_t * attrCandMonotone
Definition: monotone.c:66
int checkSanityOfKnownMonotone(Vec_Int_t *vKnownMonotone, Vec_Int_t *vCandMonotone, Vec_Int_t *vHintMonotone)
Definition: monotone.c:129
#define Saig_ManForEachPo(p, pObj, i)
Definition: saig.h:93
#define assert(ex)
Definition: util_old.h:213
int strlen()
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
int Aig_ManCleanup(Aig_Man_t *p)
Definition: aigMan.c:265
#define Saig_ManForEachPi(p, pObj, i)
Definition: saig.h:91
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()
#define assert(ex)
Definition: util_old.h:213
void deallocPointersToMonotoneVectors ( struct monotoneVectorsStruct toBeDeleted)

Definition at line 84 of file monotone.c.

85 {
86  assert( toBeDeleted != NULL );
87  free( toBeDeleted );
88 }
VOID_HACK free()
#define assert(ex)
Definition: util_old.h:213
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 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
char * strstr()
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
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 }
int findPendingSignal(Abc_Ntk_t *pNtk)
Definition: monotone.c:112
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
void deallocAigPoIndices(struct aigPoIndices *toBeDeletedAigPoIndices)
Definition: monotone.c:57
Vec_Int_t * findRemainingMonotoneCandidates(Vec_Int_t *vKnownMonotone, Vec_Int_t *vHintMonotone)
Definition: monotone.c:396
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
struct monotoneVectorsStruct * allocPointersToMonotoneVectors()
Definition: monotone.c:70
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
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:233
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
if(last==0)
Definition: sparse_int.h:34
Vec_Int_t * attrKnownMonotone
Definition: monotone.c:65
Vec_Int_t * attrHintMonotone
Definition: monotone.c:67
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Abc_Obj_t * Abc_NtkPo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:316
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
Vec_Int_t * attrCandMonotone
Definition: monotone.c:66
Vec_Int_t * findNewMonotone(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct monotoneVectorsStruct *monotoneVectorArg)
Definition: monotone.c:348
Vec_Int_t * findHintOutputs(Abc_Ntk_t *pNtk)
Definition: monotone.c:90
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
struct aigPoIndices * allocAigPoIndices()
Definition: monotone.c:43
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 
376  Pdr_ManSetDefaultParams( pPars );
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 }
static int Saig_ManPoNum(Aig_Man_t *p)
Definition: saig.h:74
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
void Pdr_ManSetDefaultParams(Pdr_Par_t *pPars)
MACRO DEFINITIONS ///.
Definition: pdrCore.c:48
typedefABC_NAMESPACE_HEADER_START struct Pdr_Par_t_ Pdr_Par_t
INCLUDES ///.
Definition: pdr.h:40
int attrHintSingalBeginningMarker
static int Aig_ManCoNum(Aig_Man_t *p)
Definition: aig.h:252
Aig_Man_t * createMonotoneTester(Aig_Man_t *pAig, struct aigPoIndices *aigPoIndicesArg, struct monotoneVectorsStruct *monotoneVectorArg, int *startMonotonePropPo)
Definition: monotone.c:145
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Aig_ObjChild0Flip(Aig_Obj_t *pObj)
Definition: aig.h:316
static Aig_Obj_t * Aig_ManCo(Aig_Man_t *p, int i)
Definition: aig.h:267
static int Aig_ManRegNum(Aig_Man_t *p)
Definition: aig.h:260
int Pdr_ManSolve(Aig_Man_t *p, Pdr_Par_t *pPars)
Definition: pdrCore.c:886
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.
Definition: utilCex.h:39
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 }
char * strstr()
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
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 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54