133{
134 FILE * pFile;
137 char Buffer[1000], * pToken, * RetValue;
138 int c, nRegs = -1, nFrames = -1, iPo = -1,
Status = -1, nFrames2 = -1;
139 pFile = fopen( pFileName, "r" );
140 if ( pFile == NULL )
141 {
142 printf( "Cannot open log file for reading \"%s\".\n" , pFileName );
143 return -1;
144 }
145 RetValue = fgets( Buffer, 1000, pFile );
147 {
149 nFrames = atoi( Buffer +
strlen(
"snl_UNSAT") );
150 }
152 {
154
156 nFrames = atoi( pToken );
157 pToken =
strtok( NULL,
" \t\n" );
158 pToken =
strtok( NULL,
" \t\n" );
159 if ( pToken != NULL )
160 {
161 iPo = atoi( pToken );
162 pToken =
strtok( NULL,
" \t\n" );
163 if ( pToken )
164 nFrames2 = atoi( pToken );
165 }
166
167
168 }
170 {
172 nFrames = atoi( Buffer +
strlen(
"snl_UNK") );
173 }
174 else
175 {
176 printf( "Unrecognized status.\n" );
177 }
178
179 vNums = Vec_IntAlloc( 100 );
180 while ( (c = fgetc(pFile)) != EOF )
181 {
182 if ( c == '\n' )
183 break;
184 if ( c == '0' || c == '1' )
185 Vec_IntPush( vNums, c - '0' );
186 }
187 nRegs = Vec_IntSize(vNums);
188
189 while ( (c = fgetc(pFile)) != EOF )
190 {
191 if ( c == '0' || c == '1' )
192 Vec_IntPush( vNums, c - '0' );
193 }
194 fclose( pFile );
195 if ( Vec_IntSize(vNums) )
196 {
197 int iFrameCex = (nFrames2 == -1) ? nFrames : nFrames2;
198 if ( nRegs < 0 )
199 {
200 printf( "Cannot read register number.\n" );
201 Vec_IntFree( vNums );
202 return -1;
203 }
204 if ( Vec_IntSize(vNums)-nRegs == 0 )
205 {
206 printf( "Cannot read counter example.\n" );
207 Vec_IntFree( vNums );
208 return -1;
209 }
210 if ( (Vec_IntSize(vNums)-nRegs) % (iFrameCex + 1) != 0 )
211 {
212 printf( "Incorrect number of bits.\n" );
213 Vec_IntFree( vNums );
214 return -1;
215 }
216 pCex =
Abc_CexAlloc( nRegs, (Vec_IntSize(vNums)-nRegs)/(iFrameCex + 1), iFrameCex + 1 );
217 pCex->iPo = iPo;
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 );
224 if ( ppCex )
225 *ppCex = pCex;
226 else
228 }
229 else
230 {
231
232 int iFrameCex = (nFrames2 == -1) ? nFrames : nFrames2;
234 pCex->iFrame = iFrameCex;
235 pCex->iPo = iPo;
236 if ( ppCex )
237 *ppCex = pCex;
238 Vec_IntFree( vNums );
239 }
240 if ( pnFrames )
241 *pnFrames = nFrames;
243}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
ABC_NAMESPACE_IMPL_START Abc_Cex_t * Abc_CexAlloc(int nRegs, int nRealPis, int nFrames)
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Abc_Cex_t_ Abc_Cex_t
INCLUDES ///.