72 pFile = fopen( pFileName,
"w" );
75 printf(
"Cannot open log file for writing \"%s\".\n" , pFileName );
80 fprintf( pFile,
"snl_UNSAT" );
81 else if ( Status == 0 )
82 fprintf( pFile,
"snl_SAT" );
83 else if ( Status == -1 )
84 fprintf( pFile,
"snl_UNK" );
86 printf(
"Abc_NtkWriteLogFile(): Cannot recognize solving status.\n" );
87 fprintf( pFile,
" " );
89 fprintf( pFile,
"%d", nFrames );
90 fprintf( pFile,
" " );
92 fprintf( pFile,
"%s", pCommand ? pCommand :
"unknown" );
93 if ( pCex && Status == 0 )
94 fprintf( pFile,
" %d", pCex->iPo );
96 if ( pCex && pCex->iFrame != nFrames )
97 fprintf( pFile,
" %d", pCex->iFrame );
98 fprintf( pFile,
"\n" );
101 fprintf( pFile,
"NULL" );
104 for ( i = 0; i < pCex->nRegs; i++ )
105 fprintf( pFile,
"%d", Abc_InfoHasBit(pCex->pData,i) );
107 fprintf( pFile,
"\n" );
110 fprintf( pFile,
"NULL" );
113 assert( pCex->nBits - pCex->nRegs == pCex->nPis * (pCex->iFrame + 1) );
114 for ( i = pCex->nRegs; i < pCex->nBits; i++ )
115 fprintf( pFile,
"%d", Abc_InfoHasBit(pCex->pData,i) );
117 fprintf( pFile,
"\n" );
137 char Buffer[1000], * pToken, * RetValue;
138 int c, nRegs = -1, nFrames = -1, iPo = -1, Status = -1, nFrames2 = -1;
139 pFile = fopen( pFileName,
"r" );
142 printf(
"Cannot open log file for reading \"%s\".\n" , pFileName );
145 RetValue = fgets( Buffer, 1000, pFile );
149 nFrames = atoi( Buffer +
strlen(
"snl_UNSAT") );
156 nFrames = atoi( pToken );
157 pToken =
strtok( NULL,
" \t\n" );
158 pToken =
strtok( NULL,
" \t\n" );
159 if ( pToken != NULL )
161 iPo = atoi( pToken );
162 pToken =
strtok( NULL,
" \t\n" );
164 nFrames2 = atoi( pToken );
172 nFrames = atoi( Buffer +
strlen(
"snl_UNK") );
176 printf(
"Unrecognized status.\n" );
179 vNums = Vec_IntAlloc( 100 );
180 while ( (c = fgetc(pFile)) != EOF )
184 if ( c ==
'0' || c ==
'1' )
185 Vec_IntPush( vNums, c -
'0' );
187 nRegs = Vec_IntSize(vNums);
189 while ( (c = fgetc(pFile)) != EOF )
191 if ( c ==
'0' || c ==
'1' )
192 Vec_IntPush( vNums, c -
'0' );
195 if ( Vec_IntSize(vNums) )
197 int iFrameCex = (nFrames2 == -1) ? nFrames : nFrames2;
200 printf(
"Cannot read register number.\n" );
201 Vec_IntFree( vNums );
204 if ( Vec_IntSize(vNums)-nRegs == 0 )
206 printf(
"Cannot read counter example.\n" );
207 Vec_IntFree( vNums );
210 if ( (Vec_IntSize(vNums)-nRegs) % (iFrameCex + 1) != 0 )
212 printf(
"Incorrect number of bits.\n" );
213 Vec_IntFree( vNums );
216 pCex =
Abc_CexAlloc( nRegs, (Vec_IntSize(vNums)-nRegs)/(iFrameCex + 1), iFrameCex + 1 );
218 pCex->iFrame = iFrameCex;
219 assert( Vec_IntSize(vNums) == pCex->nBits );
220 for ( c = 0; c < pCex->nBits; c++ )
221 if ( Vec_IntEntry(vNums, c) )
222 Abc_InfoSetBit( pCex->pData, c );
223 Vec_IntFree( vNums );
232 int iFrameCex = (nFrames2 == -1) ? nFrames : nFrames2;
234 pCex->iFrame = iFrameCex;
238 Vec_IntFree( vNums );
ABC_NAMESPACE_IMPL_START void Abc_NtkWriteLogFile(char *pFileName, Abc_Cex_t *pCex, int Status, int nFrames, char *pCommand)
DECLARATIONS ///.