abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcScorr.c File Reference
#include "base/abc/abc.h"
#include "base/io/ioAbc.h"
#include "aig/saig/saig.h"
#include "proof/ssw/ssw.h"
#include "aig/gia/gia.h"
#include "proof/cec/cec.h"
#include "aig/gia/giaAig.h"

Go to the source code of this file.

Data Structures

struct  Tst_Dat_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Tst_Dat_t_ 
Tst_Dat_t
 DECLARATIONS ///. More...
 

Functions

Vec_Int_tAbc_NtkMapGiaIntoNameId (Abc_Ntk_t *pNetlist, Aig_Man_t *pAig, Gia_Man_t *pGia)
 FUNCTION DEFINITIONS ///. More...
 
char * Abc_NtkTestScorrGetName (Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id)
 
int Abc_NtkTestScorrWriteEquivPair (Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id1, int Id2, FILE *pFile, int fPol)
 
int Abc_NtkTestScorrWriteEquivConst (Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id1, FILE *pFile, int fPol)
 
char * Abc_NtkBmcFileName (char *pName)
 
int Abc_NtkTestScorrWriteEquivGia (Tst_Dat_t *pData)
 
int Abc_NtkTestScorrWriteEquivAig (Tst_Dat_t *pData)
 
Abc_Ntk_tAbc_NtkTestScorr (char *pFileNameIn, char *pFileNameOut, int nStepsMax, int nBTLimit, int fNewAlgo, int fFlopOnly, int fFfNdOnly, int fVerbose)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Tst_Dat_t_ Tst_Dat_t

DECLARATIONS ///.

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

FileName [abcScorr.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Signal correspondence testing procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 36 of file abcScorr.c.

Function Documentation

char* Abc_NtkBmcFileName ( char *  pName)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file abcScorr.c.

195 {
196  static char Buffer[1000];
197  char * pNameGeneric = Extra_FileNameGeneric( pName );
198  sprintf( Buffer, "%s_bmc%s", pNameGeneric, pName + strlen(pNameGeneric) );
199  ABC_FREE( pNameGeneric );
200  return Buffer;
201 }
char * Extra_FileNameGeneric(char *FileName)
char * sprintf()
#define ABC_FREE(obj)
Definition: abc_global.h:232
int strlen()
Vec_Int_t* Abc_NtkMapGiaIntoNameId ( Abc_Ntk_t pNetlist,
Aig_Man_t pAig,
Gia_Man_t pGia 
)

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 64 of file abcScorr.c.

65 {
66  Vec_Int_t * vId2Name;
67  Abc_Obj_t * pNet, * pNode, * pAnd;
68  Aig_Obj_t * pObjAig;
69  int i;
70  vId2Name = Vec_IntAlloc( 0 );
71  Vec_IntFill( vId2Name, pGia ? Gia_ManObjNum(pGia) : Aig_ManObjNumMax(pAig), ~0 );
72  // copy all names
73  Abc_NtkForEachNet( pNetlist, pNet, i )
74  {
75  pNode = Abc_ObjFanin0(pNet)->pCopy;
76  if ( pNode && (pAnd = Abc_ObjRegular(pNode->pCopy)) &&
77  (pObjAig = (Aig_Obj_t *)Abc_ObjRegular(pAnd->pCopy)) &&
78  Aig_ObjType(pObjAig) != AIG_OBJ_NONE )
79  {
80  if ( pGia == NULL )
81  Vec_IntWriteEntry( vId2Name, Aig_ObjId(pObjAig), Abc_ObjId(pNet) );
82  else
83  Vec_IntWriteEntry( vId2Name, Abc_Lit2Var(pObjAig->iData), Abc_ObjId(pNet) );
84  }
85  }
86  // overwrite CO names
87  Abc_NtkForEachCo( pNetlist, pNode, i )
88  {
89  pNet = Abc_ObjFanin0(pNode);
90  pNode = pNode->pCopy;
91  if ( pNode && (pAnd = Abc_ObjRegular(pNode->pCopy)) &&
92  (pObjAig = (Aig_Obj_t *)Abc_ObjRegular(pAnd->pCopy)) &&
93  Aig_ObjType(pObjAig) != AIG_OBJ_NONE )
94  {
95  if ( pGia == NULL )
96  Vec_IntWriteEntry( vId2Name, Aig_ObjId(pObjAig), Abc_ObjId(pNet) );
97  else
98  Vec_IntWriteEntry( vId2Name, Abc_Lit2Var(pObjAig->iData), Abc_ObjId(pNet) );
99  }
100  }
101  // overwrite CI names
102  Abc_NtkForEachCi( pNetlist, pNode, i )
103  {
104  pNet = Abc_ObjFanout0(pNode);
105  pNode = pNode->pCopy;
106  if ( pNode && (pAnd = Abc_ObjRegular(pNode->pCopy)) &&
107  (pObjAig = (Aig_Obj_t *)Abc_ObjRegular(pAnd->pCopy)) &&
108  Aig_ObjType(pObjAig) != AIG_OBJ_NONE )
109  {
110  if ( pGia == NULL )
111  Vec_IntWriteEntry( vId2Name, Aig_ObjId(pObjAig), Abc_ObjId(pNet) );
112  else
113  Vec_IntWriteEntry( vId2Name, Abc_Lit2Var(pObjAig->iData), Abc_ObjId(pNet) );
114  }
115  }
116  return vId2Name;
117 }
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
static Aig_Type_t Aig_ObjType(Aig_Obj_t *pObj)
Definition: aig.h:272
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Abc_Obj_t * pCopy
Definition: abc.h:148
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
#define Abc_NtkForEachNet(pNtk, pNet, i)
Definition: abc.h:458
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
int iData
Definition: aig.h:88
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
Abc_Ntk_t* Abc_NtkTestScorr ( char *  pFileNameIn,
char *  pFileNameOut,
int  nStepsMax,
int  nBTLimit,
int  fNewAlgo,
int  fFlopOnly,
int  fFfNdOnly,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 318 of file abcScorr.c.

319 {
320  extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
321  extern Abc_Ntk_t * Abc_NtkFromDarSeqSweep( Abc_Ntk_t * pNtkOld, Aig_Man_t * pMan );
322 
323  FILE * pFile;
324  Tst_Dat_t Data, * pData = &Data;
325  Vec_Int_t * vId2Name;
326  Abc_Ntk_t * pNetlist, * pLogic, * pStrash, * pResult;
327  Aig_Man_t * pAig, * pTempAig;
328  Gia_Man_t * pGia, * pTempGia;
329 // int Counter = 0;
330  // check the files
331  pFile = fopen( pFileNameIn, "rb" );
332  if ( pFile == NULL )
333  {
334  printf( "Input file \"%s\" cannot be opened.\n", pFileNameIn );
335  return NULL;
336  }
337  fclose( pFile );
338  // check the files
339  pFile = fopen( pFileNameOut, "wb" );
340  if ( pFile == NULL )
341  {
342  printf( "Output file \"%s\" cannot be opened.\n", pFileNameOut );
343  return NULL;
344  }
345  fclose( pFile );
346  // derive AIG for signal correspondence
347  pNetlist = Io_ReadNetlist( pFileNameIn, Io_ReadFileType(pFileNameIn), 1 );
348  if ( pNetlist == NULL )
349  {
350  printf( "Reading input file \"%s\" has failed.\n", pFileNameIn );
351  return NULL;
352  }
353  pLogic = Abc_NtkToLogic( pNetlist );
354  if ( pLogic == NULL )
355  {
356  Abc_NtkDelete( pNetlist );
357  printf( "Deriving logic network from input file %s has failed.\n", pFileNameIn );
358  return NULL;
359  }
360  if ( Extra_FileIsType( pFileNameIn, ".bench", ".BENCH", NULL ) )
361  {
362  // get the init file name
363  char * pFileNameInit = Extra_FileNameGenericAppend( pLogic->pSpec, ".init" );
364  pFile = fopen( pFileNameInit, "rb" );
365  if ( pFile == NULL )
366  {
367  printf( "Init file \"%s\" cannot be opened.\n", pFileNameInit );
368  return NULL;
369  }
370  Io_ReadBenchInit( pLogic, pFileNameInit );
371  Abc_NtkConvertDcLatches( pLogic );
372  if ( fVerbose )
373  printf( "Initial state was derived from file \"%s\".\n", pFileNameInit );
374  }
375  pStrash = Abc_NtkStrash( pLogic, 0, 1, 0 );
376  if ( pStrash == NULL )
377  {
378  Abc_NtkDelete( pLogic );
379  Abc_NtkDelete( pNetlist );
380  printf( "Deriving strashed network from input file %s has failed.\n", pFileNameIn );
381  return NULL;
382  }
383  pAig = Abc_NtkToDar( pStrash, 0, 1 ); // performs "zero" internally
384  // the newer computation (&scorr)
385  if ( fNewAlgo )
386  {
387  Cec_ParCor_t CorPars, * pCorPars = &CorPars;
388  Cec_ManCorSetDefaultParams( pCorPars );
389  pCorPars->nBTLimit = nBTLimit;
390  pCorPars->nStepsMax = nStepsMax;
391  pCorPars->fVerbose = fVerbose;
392  pCorPars->fUseCSat = 1;
393  pGia = Gia_ManFromAig( pAig );
394  // prepare the data-structure
395  memset( pData, 0, sizeof(Tst_Dat_t) );
396  pData->pNetlist = pNetlist;
397  pData->pAig = NULL;
398  pData->pGia = pGia;
399  pData->vId2Name = vId2Name = Abc_NtkMapGiaIntoNameId( pNetlist, pAig, pGia );
400  pData->pFileNameOut = pFileNameOut;
401  pData->fFlopOnly = fFlopOnly;
402  pData->fFfNdOnly = fFfNdOnly;
403  pData->fDumpBmc = 1;
404  pCorPars->pData = pData;
405  pCorPars->pFunc = (void *)Abc_NtkTestScorrWriteEquivGia;
406  // call signal correspondence
407  pTempGia = Cec_ManLSCorrespondence( pGia, pCorPars );
408  pTempAig = Gia_ManToAigSimple( pTempGia );
409  Gia_ManStop( pTempGia );
410  Gia_ManStop( pGia );
411  }
412  // the older computation (scorr)
413  else
414  {
415  Ssw_Pars_t SswPars, * pSswPars = &SswPars;
416  Ssw_ManSetDefaultParams( pSswPars );
417  pSswPars->nBTLimit = nBTLimit;
418  pSswPars->nStepsMax = nStepsMax;
419  pSswPars->fVerbose = fVerbose;
420  // preSswPare the data-structure
421  memset( pData, 0, sizeof(Tst_Dat_t) );
422  pData->pNetlist = pNetlist;
423  pData->pAig = pAig;
424  pData->pGia = NULL;
425  pData->vId2Name = vId2Name = Abc_NtkMapGiaIntoNameId( pNetlist, pAig, NULL );
426  pData->pFileNameOut = pFileNameOut;
427  pData->fFlopOnly = fFlopOnly;
428  pData->fFfNdOnly = fFfNdOnly;
429  pData->fDumpBmc = 1;
430  pSswPars->pData = pData;
431  pSswPars->pFunc = (void *)Abc_NtkTestScorrWriteEquivAig;
432  // call signal correspondence
433  pTempAig = Ssw_SignalCorrespondence( pAig, pSswPars );
434  }
435  // create the resulting AIG
436  pResult = Abc_NtkFromDarSeqSweep( pStrash, pTempAig );
437  // cleanup
438  Vec_IntFree( vId2Name );
439  Aig_ManStop( pAig );
440  Aig_ManStop( pTempAig );
441  Abc_NtkDelete( pStrash );
442  Abc_NtkDelete( pLogic );
443  Abc_NtkDelete( pNetlist );
444  return pResult;
445 }
char * memset()
void Cec_ManCorSetDefaultParams(Cec_ParCor_t *p)
Definition: cecCore.c:181
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
Vec_Int_t * Abc_NtkMapGiaIntoNameId(Abc_Ntk_t *pNetlist, Aig_Man_t *pAig, Gia_Man_t *pGia)
FUNCTION DEFINITIONS ///.
Definition: abcScorr.c:64
Aig_Man_t * Gia_ManToAigSimple(Gia_Man_t *p)
Definition: giaAig.c:367
int fUseCSat
Definition: cec.h:146
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 Aig_ManStop(Aig_Man_t *p)
Definition: aigMan.c:187
typedefABC_NAMESPACE_HEADER_START struct Ssw_Pars_t_ Ssw_Pars_t
INCLUDES ///.
Definition: ssw.h:40
void * pData
Definition: cec.h:154
ABC_DLL Abc_Ntk_t * Abc_NtkStrash(Abc_Ntk_t *pNtk, int fAllNodes, int fCleanup, int fRecord)
Definition: abcStrash.c:265
typedefABC_NAMESPACE_IMPL_START struct Tst_Dat_t_ Tst_Dat_t
DECLARATIONS ///.
Definition: abcScorr.c:36
Abc_Ntk_t * Io_ReadNetlist(char *pFileName, Io_FileType_t FileType, int fCheck)
Definition: ioUtil.c:98
Aig_Man_t * Ssw_SignalCorrespondence(Aig_Man_t *pAig, Ssw_Pars_t *pPars)
Definition: sswCore.c:414
ABC_DLL void Abc_NtkConvertDcLatches(Abc_Ntk_t *pNtk)
Definition: abcLatch.c:314
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
int fVerbose
Definition: cec.h:152
int Abc_NtkTestScorrWriteEquivGia(Tst_Dat_t *pData)
Definition: abcScorr.c:214
ABC_DLL Abc_Ntk_t * Abc_NtkToLogic(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcNetlist.c:52
Gia_Man_t * Gia_ManFromAig(Aig_Man_t *p)
INCLUDES ///.
Definition: giaAig.c:73
Io_FileType_t Io_ReadFileType(char *pFileName)
DECLARATIONS ///.
Definition: ioUtil.c:46
Aig_Man_t * Abc_NtkToDar(Abc_Ntk_t *pNtk, int fExors, int fRegisters)
Definition: abcDar.c:233
void Ssw_ManSetDefaultParams(Ssw_Pars_t *p)
DECLARATIONS ///.
Definition: sswCore.c:45
int Abc_NtkTestScorrWriteEquivAig(Tst_Dat_t *pData)
Definition: abcScorr.c:267
Gia_Man_t * Cec_ManLSCorrespondence(Gia_Man_t *pAig, Cec_ParCor_t *pPars)
Definition: cecCorr.c:1147
char * pSpec
Definition: abc.h:159
void * pFunc
Definition: cec.h:155
Abc_Ntk_t * Abc_NtkFromDarSeqSweep(Abc_Ntk_t *pNtkOld, Aig_Man_t *pMan)
Definition: abcDar.c:468
int nBTLimit
Definition: cec.h:139
Definition: gia.h:95
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int Extra_FileIsType(char *pFileName, char *pS1, char *pS2, char *pS3)
void Io_ReadBenchInit(Abc_Ntk_t *pNtk, char *pFileName)
Definition: ioReadBench.c:311
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int nStepsMax
Definition: cec.h:141
char* Abc_NtkTestScorrGetName ( Abc_Ntk_t pNetlist,
Vec_Int_t vId2Name,
int  Id 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 130 of file abcScorr.c.

131 {
132 // Abc_Obj_t * pObj;
133 //printf( "trying to get name for %d\n", Id );
134  if ( Vec_IntEntry(vId2Name, Id) == ~0 )
135  return NULL;
136 // pObj = Abc_NtkObj( pNetlist, Vec_IntEntry(vId2Name, Id) );
137 // pObj = Abc_ObjFanin0(pObj);
138 // assert( Abc_ObjIsCi(pObj) );
139  return Nm_ManFindNameById( pNetlist->pManName, Vec_IntEntry(vId2Name, Id) );
140 }
Nm_Man_t * pManName
Definition: abc.h:160
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
char * Nm_ManFindNameById(Nm_Man_t *p, int ObjId)
Definition: nmApi.c:199
int Abc_NtkTestScorrWriteEquivAig ( Tst_Dat_t pData)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 267 of file abcScorr.c.

268 {
269  Abc_Ntk_t * pNetlist = pData->pNetlist;
270  Vec_Int_t * vId2Name = pData->vId2Name;
271  Aig_Man_t * pAig = pData->pAig;
272  char * pFileNameOut = pData->pFileNameOut;
273  FILE * pFile;
274  Aig_Obj_t * pObj, * pRepr;
275  int i, Counter = 0;
276  if ( pData->fDumpBmc )
277  {
278  pData->fDumpBmc = 0;
279  pFileNameOut = Abc_NtkBmcFileName( pFileNameOut );
280  }
281  pFile = fopen( pFileNameOut, "wb" );
282  Aig_ManForEachObj( pAig, pObj, i )
283  {
284  if ( (pRepr = Aig_ObjRepr(pAig, pObj)) == NULL )
285  continue;
286  if ( pData->fFlopOnly )
287  {
288  if ( !Saig_ObjIsLo(pAig, pObj) || !(Saig_ObjIsLo(pAig, pRepr)||pRepr==Aig_ManConst1(pAig)) )
289  continue;
290  }
291  else if ( pData->fFfNdOnly )
292  {
293  if ( !Saig_ObjIsLo(pAig, pObj) && !(Saig_ObjIsLo(pAig, pRepr)||pRepr==Aig_ManConst1(pAig)) )
294  continue;
295  }
296  if ( pRepr == Aig_ManConst1(pAig) )
297  Counter += Abc_NtkTestScorrWriteEquivConst( pNetlist, vId2Name, Aig_ObjId(pObj), pFile, Aig_ObjPhase(pObj) );
298  else
299  Counter += Abc_NtkTestScorrWriteEquivPair( pNetlist, vId2Name, Aig_ObjId(pRepr), Aig_ObjId(pObj), pFile,
300  Aig_ObjPhase(pRepr) ^ Aig_ObjPhase(pObj) );
301  }
302  fclose( pFile );
303  printf( "%d pairs of sequentially equivalent nodes are written into file \"%s\".\n", Counter, pFileNameOut );
304  return Counter;
305 }
static int Aig_ObjPhase(Aig_Obj_t *pObj)
Definition: aig.h:298
static Aig_Obj_t * Aig_ObjRepr(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: aig.h:330
static int Saig_ObjIsLo(Aig_Man_t *p, Aig_Obj_t *pObj)
Definition: saig.h:84
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
char * Abc_NtkBmcFileName(char *pName)
Definition: abcScorr.c:194
Definition: aig.h:69
static int Counter
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
#define Aig_ManForEachObj(p, pObj, i)
Definition: aig.h:403
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
int Abc_NtkTestScorrWriteEquivPair(Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id1, int Id2, FILE *pFile, int fPol)
Definition: abcScorr.c:153
int Abc_NtkTestScorrWriteEquivConst(Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id1, FILE *pFile, int fPol)
Definition: abcScorr.c:174
int Abc_NtkTestScorrWriteEquivConst ( Abc_Ntk_t pNetlist,
Vec_Int_t vId2Name,
int  Id1,
FILE *  pFile,
int  fPol 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 174 of file abcScorr.c.

175 {
176  char * pName1 = Abc_NtkTestScorrGetName( pNetlist, vId2Name, Id1 );
177  if ( pName1 == NULL )
178  return 0;
179  fprintf( pFile, "%s=%s%s\n", pName1, fPol? "~": "", "const0" );
180  return 1;
181 }
char * Abc_NtkTestScorrGetName(Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id)
Definition: abcScorr.c:130
int Abc_NtkTestScorrWriteEquivGia ( Tst_Dat_t pData)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file abcScorr.c.

215 {
216  Abc_Ntk_t * pNetlist = pData->pNetlist;
217  Vec_Int_t * vId2Name = pData->vId2Name;
218  Gia_Man_t * pGia = pData->pGia;
219  char * pFileNameOut = pData->pFileNameOut;
220  FILE * pFile;
221  Gia_Obj_t * pObj, * pRepr;
222  int i, Counter = 0;
223  if ( pData->fDumpBmc )
224  {
225  pData->fDumpBmc = 0;
226  pFileNameOut = Abc_NtkBmcFileName( pFileNameOut );
227  }
228  pFile = fopen( pFileNameOut, "wb" );
229  Gia_ManSetPhase( pGia );
230  Gia_ManForEachObj( pGia, pObj, i )
231  {
232  if ( !Gia_ObjHasRepr(pGia, i) )
233  continue;
234  pRepr = Gia_ManObj( pGia,Gia_ObjRepr(pGia, i) );
235  if ( pData->fFlopOnly )
236  {
237  if ( !Gia_ObjIsRo(pGia, pObj) || !(Gia_ObjIsRo(pGia, pRepr)||Gia_ObjIsConst0(pRepr)) )
238  continue;
239  }
240  else if ( pData->fFfNdOnly )
241  {
242  if ( !Gia_ObjIsRo(pGia, pObj) && !(Gia_ObjIsRo(pGia, pRepr)||Gia_ObjIsConst0(pRepr)) )
243  continue;
244  }
245  if ( Gia_ObjRepr(pGia, i) == 0 )
246  Counter += Abc_NtkTestScorrWriteEquivConst( pNetlist, vId2Name, i, pFile, Gia_ObjPhase(pObj) );
247  else
248  Counter += Abc_NtkTestScorrWriteEquivPair( pNetlist, vId2Name, Gia_ObjRepr(pGia, i), i, pFile,
249  Gia_ObjPhase(pRepr) ^ Gia_ObjPhase(pObj) );
250  }
251  fclose( pFile );
252  printf( "%d pairs of sequentially equivalent nodes are written into file \"%s\".\n", Counter, pFileNameOut );
253  return Counter;
254 }
static int Gia_ObjPhase(Gia_Obj_t *pObj)
Definition: gia.h:415
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Gia_ObjIsConst0(Gia_Obj_t *pObj)
Definition: gia.h:430
char * Abc_NtkBmcFileName(char *pName)
Definition: abcScorr.c:194
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
static int Gia_ObjIsRo(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:443
static int Counter
Definition: gia.h:95
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition: gia.h:984
void Gia_ManSetPhase(Gia_Man_t *p)
Definition: giaUtil.c:379
int Abc_NtkTestScorrWriteEquivPair(Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id1, int Id2, FILE *pFile, int fPol)
Definition: abcScorr.c:153
static int Gia_ObjRepr(Gia_Man_t *p, int Id)
Definition: gia.h:887
int Abc_NtkTestScorrWriteEquivConst(Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id1, FILE *pFile, int fPol)
Definition: abcScorr.c:174
static int Gia_ObjHasRepr(Gia_Man_t *p, int Id)
Definition: gia.h:891
int Abc_NtkTestScorrWriteEquivPair ( Abc_Ntk_t pNetlist,
Vec_Int_t vId2Name,
int  Id1,
int  Id2,
FILE *  pFile,
int  fPol 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 153 of file abcScorr.c.

154 {
155  char * pName1 = Abc_NtkTestScorrGetName( pNetlist, vId2Name, Id1 );
156  char * pName2 = Abc_NtkTestScorrGetName( pNetlist, vId2Name, Id2 );
157  if ( pName1 == NULL || pName2 == NULL )
158  return 0;
159  fprintf( pFile, "%s=%s%s\n", pName1, fPol? "~": "", pName2 );
160  return 1;
161 }
char * Abc_NtkTestScorrGetName(Abc_Ntk_t *pNetlist, Vec_Int_t *vId2Name, int Id)
Definition: abcScorr.c:130