FUNCTION DECLARATIONS ///.
242 int nTotal, nInputs, nOutputs, nLatches, nAnds;
243 int nBad = 0, nConstr = 0, nJust = 0, nFair = 0;
244 int nFileSize = -1, iTerm, nDigits, i;
245 char * pContents, * pDrivers = NULL, * pSymbols, * pCur, * pName, * pType;
246 unsigned uLit0, uLit1, uLit;
258 pFile = fopen( pFileName,
"rb" );
259 pContents =
ABC_ALLOC(
char, nFileSize );
260 RetValue = fread( pContents, nFileSize, 1, pFile );
266 if (
strncmp(pContents,
"aig", 3) != 0 || (pContents[3] !=
' ' && pContents[3] !=
'2') )
268 fprintf( stdout,
"Wrong input file format.\n" );
274 pCur = pContents;
while ( *pCur !=
' ' ) pCur++; pCur++;
276 nTotal = atoi( pCur );
while ( *pCur !=
' ' ) pCur++; pCur++;
278 nInputs = atoi( pCur );
while ( *pCur !=
' ' ) pCur++; pCur++;
280 nLatches = atoi( pCur );
while ( *pCur !=
' ' ) pCur++; pCur++;
282 nOutputs = atoi( pCur );
while ( *pCur !=
' ' ) pCur++; pCur++;
284 nAnds = atoi( pCur );
while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
290 nBad = atoi( pCur );
while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
297 nConstr = atoi( pCur );
while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
304 nJust = atoi( pCur );
while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
311 nFair = atoi( pCur );
while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
316 fprintf( stdout,
"The parameter line is in a wrong format.\n" );
323 if ( nTotal != nInputs + nLatches + nAnds )
325 fprintf( stdout,
"The number of objects does not match.\n" );
329 if ( nJust || nFair )
331 fprintf( stdout,
"Reading AIGER files with liveness properties is currently not supported.\n" );
339 fprintf( stdout,
"Warning: The last output is interpreted as a constraint.\n" );
341 fprintf( stdout,
"Warning: The last %d outputs are interpreted as constraints.\n", nConstr );
353 vNodes =
Vec_PtrAlloc( 1 + nInputs + nLatches + nAnds );
357 for ( i = 0; i < nInputs; i++ )
363 for ( i = 0; i < nOutputs; i++ )
369 for ( i = 0; i < nLatches; i++ )
384 if ( pContents[3] ==
' ' )
389 for ( i = 0; i < nLatches + nOutputs; )
390 if ( *pCur++ ==
'\n' )
400 for ( i = 0; i < nAnds; i++ )
403 uLit = ((i + 1 + nInputs + nLatches) << 1);
419 if ( pContents[3] ==
' ' )
423 uLit0 = atoi( pCur );
while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
431 else if ( Init == 1 )
439 while ( *pCur !=
' ' && *pCur !=
'\n' ) pCur++;
443 fprintf( stdout,
"The initial value of latch number %d is not recongnized.\n", i );
454 uLit0 = atoi( pCur );
while ( *pCur++ !=
'\n' );
480 if ( pCur < pContents + nFileSize && *pCur !=
'c' )
483 while ( pCur < pContents + nFileSize && *pCur !=
'c' )
488 vTerms = pNtkNew->
vPis;
489 else if ( *pCur ==
'l' )
491 else if ( *pCur ==
'o' || *pCur ==
'b' || *pCur ==
'c' || *pCur ==
'j' || *pCur ==
'f' )
492 vTerms = pNtkNew->
vPos;
499 iTerm = atoi( ++pCur );
while ( *pCur++ !=
' ' );
503 fprintf( stdout,
"The number of terminal is out of bound.\n" );
510 pName = pCur;
while ( *pCur++ !=
'\n' );
526 if ( pObj->
pCopy )
continue;
532 if ( pObj->
pCopy )
continue;
540 if ( pObj->
pCopy )
continue;
555 if ( pCur + 1 < pContents + nFileSize && *pCur ==
'c' )
578 if ( nBad || nConstr || nJust || nFair )
584 printf(
"Io_ReadAiger: The network check has failed.\n" );
static char * Ioa_ReadLoadFileBz2Aig(char *pFileName, int *pFileSize)
ABC_DLL void Abc_NtkInvertConstraints(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
static int Abc_Var2Lit(int Var, int fCompl)
ABC_DLL void Abc_NtkShortNames(Abc_Ntk_t *pNtk)
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
#define ABC_ALLOC(type, num)
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
static int Vec_PtrSize(Vec_Ptr_t *p)
static void Abc_LatchSetInitDc(Abc_Obj_t *pLatch)
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
ABC_DLL int Abc_NtkCheckRead(Abc_Ntk_t *pNtk)
static int Vec_IntEntry(Vec_Int_t *p, int i)
static int Abc_Base10Log(unsigned n)
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
static ABC_NAMESPACE_IMPL_START unsigned Io_ReadAigerDecode(char **ppPos)
DECLARATIONS ///.
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
static char * Ioa_ReadLoadFileGzAig(char *pFileName, int *pFileSize)
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
static void Abc_LatchSetInit1(Abc_Obj_t *pLatch)
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
#define Abc_NtkForEachPo(pNtk, pPo, i)
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
static void Vec_IntFree(Vec_Int_t *p)
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Vec_Int_t * Io_WriteDecodeLiterals(char **ppPos, int nEntries)
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
int nTotal
DECLARATIONS ///.
#define Abc_NtkForEachPi(pNtk, pPi, i)
static void Vec_PtrFree(Vec_Ptr_t *p)