abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ioReadAiger.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [ioReadAiger.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Command processing package.]
8 
9  Synopsis [Procedures to read binary AIGER format developed by
10  Armin Biere, Johannes Kepler University (http://fmv.jku.at/)]
11 
12  Author [Alan Mishchenko]
13 
14  Affiliation [UC Berkeley]
15 
16  Date [Ver. 1.0. Started - December 16, 2006.]
17 
18  Revision [$Id: ioReadAiger.c,v 1.00 2006/12/16 00:00:00 alanmi Exp $]
19 
20 ***********************************************************************/
21 
22 // The code in this file is developed in collaboration with Mark Jarvin of Toronto.
23 
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include <assert.h>
28 
29 #include "misc/bzlib/bzlib.h"
30 #include "misc/zlib/zlib.h"
31 #include "ioAbc.h"
32 
34 
35 
36 ////////////////////////////////////////////////////////////////////////
37 /// DECLARATIONS ///
38 ////////////////////////////////////////////////////////////////////////
39 
40 ////////////////////////////////////////////////////////////////////////
41 /// FUNCTION DEFINITIONS ///
42 ////////////////////////////////////////////////////////////////////////
43 
44 /**Function*************************************************************
45 
46  Synopsis [Extracts one unsigned AIG edge from the input buffer.]
47 
48  Description [This procedure is a slightly modified version of Armin Biere's
49  procedure "unsigned decode (FILE * file)". ]
50 
51  SideEffects [Updates the current reading position.]
52 
53  SeeAlso []
54 
55 ***********************************************************************/
56 static inline unsigned Io_ReadAigerDecode( char ** ppPos )
57 {
58  unsigned x = 0, i = 0;
59  unsigned char ch;
60 
61 // while ((ch = getnoneofch (file)) & 0x80)
62  while ((ch = *(*ppPos)++) & 0x80)
63  x |= (ch & 0x7f) << (7 * i++);
64 
65  return x | (ch << (7 * i));
66 }
67 
68 /**Function*************************************************************
69 
70  Synopsis [Decodes the encoded array of literals.]
71 
72  Description []
73 
74  SideEffects []
75 
76  SeeAlso []
77 
78 ***********************************************************************/
79 Vec_Int_t * Io_WriteDecodeLiterals( char ** ppPos, int nEntries )
80 {
81  Vec_Int_t * vLits;
82  int Lit, LitPrev, Diff, i;
83  vLits = Vec_IntAlloc( nEntries );
84  LitPrev = Io_ReadAigerDecode( ppPos );
85  Vec_IntPush( vLits, LitPrev );
86  for ( i = 1; i < nEntries; i++ )
87  {
88 // Diff = Lit - LitPrev;
89 // Diff = (Lit < LitPrev)? -Diff : Diff;
90 // Diff = ((2 * Diff) << 1) | (int)(Lit < LitPrev);
91  Diff = Io_ReadAigerDecode( ppPos );
92  Diff = (Diff & 1)? -(Diff >> 1) : Diff >> 1;
93  Lit = Diff + LitPrev;
94  Vec_IntPush( vLits, Lit );
95  LitPrev = Lit;
96  }
97  return vLits;
98 }
99 
100 
101 /**Function*************************************************************
102 
103  Synopsis [Reads the file into a character buffer.]
104 
105  Description []
106 
107  SideEffects []
108 
109  SeeAlso []
110 
111 ***********************************************************************/
112 typedef struct buflist {
113  char buf[1<<20];
114  int nBuf;
115  struct buflist * next;
116 } buflist;
117 
118 static char * Ioa_ReadLoadFileBz2Aig( char * pFileName, int * pFileSize )
119 {
120  FILE * pFile;
121  int nFileSize = 0;
122  char * pContents;
123  BZFILE * b;
124  int bzError;
125  struct buflist * pNext;
126  buflist * bufHead = NULL, * buf = NULL;
127  int RetValue;
128 
129  pFile = fopen( pFileName, "rb" );
130  if ( pFile == NULL )
131  {
132  printf( "Ioa_ReadLoadFileBz2(): The file is unavailable (absent or open).\n" );
133  return NULL;
134  }
135  b = BZ2_bzReadOpen(&bzError,pFile,0,0,NULL,0);
136  if (bzError != BZ_OK) {
137  printf( "Ioa_ReadLoadFileBz2(): BZ2_bzReadOpen() failed with error %d.\n",bzError );
138  return NULL;
139  }
140  do {
141  if (!bufHead)
142  buf = bufHead = ABC_ALLOC( buflist, 1 );
143  else
144  buf = buf->next = ABC_ALLOC( buflist, 1 );
145  nFileSize += buf->nBuf = BZ2_bzRead(&bzError,b,buf->buf,1<<20);
146  buf->next = NULL;
147  } while (bzError == BZ_OK);
148  if (bzError == BZ_STREAM_END) {
149  // we're okay
150  char * p;
151  int nBytes = 0;
152  BZ2_bzReadClose(&bzError,b);
153  p = pContents = ABC_ALLOC( char, nFileSize + 10 );
154  buf = bufHead;
155  do {
156  memcpy(p+nBytes,buf->buf,buf->nBuf);
157  nBytes += buf->nBuf;
158 // } while((buf = buf->next));
159  pNext = buf->next;
160  ABC_FREE( buf );
161  } while((buf = pNext));
162  } else if (bzError == BZ_DATA_ERROR_MAGIC) {
163  // not a BZIP2 file
164  BZ2_bzReadClose(&bzError,b);
165  fseek( pFile, 0, SEEK_END );
166  nFileSize = ftell( pFile );
167  if ( nFileSize == 0 )
168  {
169  printf( "Ioa_ReadLoadFileBz2(): The file is empty.\n" );
170  return NULL;
171  }
172  pContents = ABC_ALLOC( char, nFileSize + 10 );
173  rewind( pFile );
174  RetValue = fread( pContents, nFileSize, 1, pFile );
175  } else {
176  // Some other error.
177  printf( "Ioa_ReadLoadFileBz2(): Unable to read the compressed BLIF.\n" );
178  return NULL;
179  }
180  fclose( pFile );
181  // finish off the file with the spare .end line
182  // some benchmarks suddenly break off without this line
183 // strcpy( pContents + nFileSize, "\n.end\n" );
184  *pFileSize = nFileSize;
185  return pContents;
186 }
187 
188 /**Function*************************************************************
189 
190  Synopsis [Reads the file into a character buffer.]
191 
192  Description []
193 
194  SideEffects []
195 
196  SeeAlso []
197 
198 ***********************************************************************/
199 static char * Ioa_ReadLoadFileGzAig( char * pFileName, int * pFileSize )
200 {
201  const int READ_BLOCK_SIZE = 100000;
202  gzFile pFile;
203  char * pContents;
204  int amtRead, readBlock, nFileSize = READ_BLOCK_SIZE;
205  pFile = gzopen( pFileName, "rb" ); // if pFileName doesn't end in ".gz" then this acts as a passthrough to fopen
206  pContents = ABC_ALLOC( char, nFileSize );
207  readBlock = 0;
208  while ((amtRead = gzread(pFile, pContents + readBlock * READ_BLOCK_SIZE, READ_BLOCK_SIZE)) == READ_BLOCK_SIZE) {
209  //printf("%d: read %d bytes\n", readBlock, amtRead);
210  nFileSize += READ_BLOCK_SIZE;
211  pContents = ABC_REALLOC(char, pContents, nFileSize);
212  ++readBlock;
213  }
214  //printf("%d: read %d bytes\n", readBlock, amtRead);
215  assert( amtRead != -1 ); // indicates a zlib error
216  nFileSize -= (READ_BLOCK_SIZE - amtRead);
217  gzclose(pFile);
218  *pFileSize = nFileSize;
219  return pContents;
220 }
221 
222 
223 /**Function*************************************************************
224 
225  Synopsis [Reads the AIG in the binary AIGER format.]
226 
227  Description []
228 
229  SideEffects []
230 
231  SeeAlso []
232 
233 ***********************************************************************/
234 Abc_Ntk_t * Io_ReadAiger( char * pFileName, int fCheck )
235 {
236  ProgressBar * pProgress;
237  FILE * pFile;
238  Vec_Ptr_t * vNodes, * vTerms;
239  Vec_Int_t * vLits = NULL;
240  Abc_Obj_t * pObj, * pNode0, * pNode1;
241  Abc_Ntk_t * pNtkNew;
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;
247  int RetValue;
248 
249  // read the file into the buffer
250  if ( !strncmp(pFileName+strlen(pFileName)-4,".bz2",4) )
251  pContents = Ioa_ReadLoadFileBz2Aig( pFileName, &nFileSize );
252  else if ( !strncmp(pFileName+strlen(pFileName)-3,".gz",3) )
253  pContents = Ioa_ReadLoadFileGzAig( pFileName, &nFileSize );
254  else
255  {
256 // pContents = Ioa_ReadLoadFile( pFileName );
257  nFileSize = Extra_FileSize( pFileName );
258  pFile = fopen( pFileName, "rb" );
259  pContents = ABC_ALLOC( char, nFileSize );
260  RetValue = fread( pContents, nFileSize, 1, pFile );
261  fclose( pFile );
262  }
263 
264 
265  // check if the input file format is correct
266  if ( strncmp(pContents, "aig", 3) != 0 || (pContents[3] != ' ' && pContents[3] != '2') )
267  {
268  fprintf( stdout, "Wrong input file format.\n" );
269  ABC_FREE( pContents );
270  return NULL;
271  }
272 
273  // read the parameters (M I L O A + B C J F)
274  pCur = pContents; while ( *pCur != ' ' ) pCur++; pCur++;
275  // read the number of objects
276  nTotal = atoi( pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
277  // read the number of inputs
278  nInputs = atoi( pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
279  // read the number of latches
280  nLatches = atoi( pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
281  // read the number of outputs
282  nOutputs = atoi( pCur ); while ( *pCur != ' ' ) pCur++; pCur++;
283  // read the number of nodes
284  nAnds = atoi( pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
285  if ( *pCur == ' ' )
286  {
287 // assert( nOutputs == 0 );
288  // read the number of properties
289  pCur++;
290  nBad = atoi( pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
291  nOutputs += nBad;
292  }
293  if ( *pCur == ' ' )
294  {
295  // read the number of properties
296  pCur++;
297  nConstr = atoi( pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
298  nOutputs += nConstr;
299  }
300  if ( *pCur == ' ' )
301  {
302  // read the number of properties
303  pCur++;
304  nJust = atoi( pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
305  nOutputs += nJust;
306  }
307  if ( *pCur == ' ' )
308  {
309  // read the number of properties
310  pCur++;
311  nFair = atoi( pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
312  nOutputs += nFair;
313  }
314  if ( *pCur != '\n' )
315  {
316  fprintf( stdout, "The parameter line is in a wrong format.\n" );
317  ABC_FREE( pContents );
318  return NULL;
319  }
320  pCur++;
321 
322  // check the parameters
323  if ( nTotal != nInputs + nLatches + nAnds )
324  {
325  fprintf( stdout, "The number of objects does not match.\n" );
326  ABC_FREE( pContents );
327  return NULL;
328  }
329  if ( nJust || nFair )
330  {
331  fprintf( stdout, "Reading AIGER files with liveness properties is currently not supported.\n" );
332  ABC_FREE( pContents );
333  return NULL;
334  }
335 
336  if ( nConstr )
337  {
338  if ( nConstr == 1 )
339  fprintf( stdout, "Warning: The last output is interpreted as a constraint.\n" );
340  else
341  fprintf( stdout, "Warning: The last %d outputs are interpreted as constraints.\n", nConstr );
342  }
343 
344  // allocate the empty AIG
345  pNtkNew = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
346  pName = Extra_FileNameGeneric( pFileName );
347  pNtkNew->pName = Extra_UtilStrsav( pName );
348  pNtkNew->pSpec = Extra_UtilStrsav( pFileName );
349  ABC_FREE( pName );
350  pNtkNew->nConstrs = nConstr;
351 
352  // prepare the array of nodes
353  vNodes = Vec_PtrAlloc( 1 + nInputs + nLatches + nAnds );
354  Vec_PtrPush( vNodes, Abc_ObjNot( Abc_AigConst1(pNtkNew) ) );
355 
356  // create the PIs
357  for ( i = 0; i < nInputs; i++ )
358  {
359  pObj = Abc_NtkCreatePi(pNtkNew);
360  Vec_PtrPush( vNodes, pObj );
361  }
362  // create the POs
363  for ( i = 0; i < nOutputs; i++ )
364  {
365  pObj = Abc_NtkCreatePo(pNtkNew);
366  }
367  // create the latches
368  nDigits = Abc_Base10Log( nLatches );
369  for ( i = 0; i < nLatches; i++ )
370  {
371  pObj = Abc_NtkCreateLatch(pNtkNew);
372  Abc_LatchSetInit0( pObj );
373  pNode0 = Abc_NtkCreateBi(pNtkNew);
374  pNode1 = Abc_NtkCreateBo(pNtkNew);
375  Abc_ObjAddFanin( pObj, pNode0 );
376  Abc_ObjAddFanin( pNode1, pObj );
377  Vec_PtrPush( vNodes, pNode1 );
378  // assign names to latch and its input
379 // Abc_ObjAssignName( pObj, Abc_ObjNameDummy("_L", i, nDigits), NULL );
380 // printf( "Creating latch %s with input %d and output %d.\n", Abc_ObjName(pObj), pNode0->Id, pNode1->Id );
381  }
382 
383 
384  if ( pContents[3] == ' ' ) // standard AIGER
385  {
386  // remember the beginning of latch/PO literals
387  pDrivers = pCur;
388  // scroll to the beginning of the binary data
389  for ( i = 0; i < nLatches + nOutputs; )
390  if ( *pCur++ == '\n' )
391  i++;
392  }
393  else // modified AIGER
394  {
395  vLits = Io_WriteDecodeLiterals( &pCur, nLatches + nOutputs );
396  }
397 
398  // create the AND gates
399  pProgress = Extra_ProgressBarStart( stdout, nAnds );
400  for ( i = 0; i < nAnds; i++ )
401  {
402  Extra_ProgressBarUpdate( pProgress, i, NULL );
403  uLit = ((i + 1 + nInputs + nLatches) << 1);
404  uLit1 = uLit - Io_ReadAigerDecode( &pCur );
405  uLit0 = uLit1 - Io_ReadAigerDecode( &pCur );
406 // assert( uLit1 > uLit0 );
407  pNode0 = Abc_ObjNotCond( (Abc_Obj_t *)Vec_PtrEntry(vNodes, uLit0 >> 1), uLit0 & 1 );
408  pNode1 = Abc_ObjNotCond( (Abc_Obj_t *)Vec_PtrEntry(vNodes, uLit1 >> 1), uLit1 & 1 );
409  assert( Vec_PtrSize(vNodes) == i + 1 + nInputs + nLatches );
410  Vec_PtrPush( vNodes, Abc_AigAnd((Abc_Aig_t *)pNtkNew->pManFunc, pNode0, pNode1) );
411  }
412  Extra_ProgressBarStop( pProgress );
413 
414  // remember the place where symbols begin
415  pSymbols = pCur;
416 
417  // read the latch driver literals
418  pCur = pDrivers;
419  if ( pContents[3] == ' ' ) // standard AIGER
420  {
421  Abc_NtkForEachLatchInput( pNtkNew, pObj, i )
422  {
423  uLit0 = atoi( pCur ); while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
424  if ( *pCur == ' ' ) // read initial value
425  {
426  int Init;
427  pCur++;
428  Init = atoi( pCur );
429  if ( Init == 0 )
430  Abc_LatchSetInit0( Abc_NtkBox(pNtkNew, i) );
431  else if ( Init == 1 )
432  Abc_LatchSetInit1( Abc_NtkBox(pNtkNew, i) );
433  else
434  {
435  assert( Init == Abc_Var2Lit(1+Abc_NtkPiNum(pNtkNew)+i, 0) );
436  // unitialized value of the latch is the latch literal according to http://fmv.jku.at/hwmcc11/beyond1.pdf
437  Abc_LatchSetInitDc( Abc_NtkBox(pNtkNew, i) );
438  }
439  while ( *pCur != ' ' && *pCur != '\n' ) pCur++;
440  }
441  if ( *pCur != '\n' )
442  {
443  fprintf( stdout, "The initial value of latch number %d is not recongnized.\n", i );
444  return NULL;
445  }
446  pCur++;
447 
448  pNode0 = Abc_ObjNotCond( (Abc_Obj_t *)Vec_PtrEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );//^ (uLit0 < 2) );
449  Abc_ObjAddFanin( pObj, pNode0 );
450  }
451  // read the PO driver literals
452  Abc_NtkForEachPo( pNtkNew, pObj, i )
453  {
454  uLit0 = atoi( pCur ); while ( *pCur++ != '\n' );
455  pNode0 = Abc_ObjNotCond( (Abc_Obj_t *)Vec_PtrEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );//^ (uLit0 < 2) );
456  Abc_ObjAddFanin( pObj, pNode0 );
457  }
458  }
459  else
460  {
461  // read the latch driver literals
462  Abc_NtkForEachLatchInput( pNtkNew, pObj, i )
463  {
464  uLit0 = Vec_IntEntry( vLits, i );
465  pNode0 = Abc_ObjNotCond( (Abc_Obj_t *)Vec_PtrEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
466  Abc_ObjAddFanin( pObj, pNode0 );
467  }
468  // read the PO driver literals
469  Abc_NtkForEachPo( pNtkNew, pObj, i )
470  {
471  uLit0 = Vec_IntEntry( vLits, i+Abc_NtkLatchNum(pNtkNew) );
472  pNode0 = Abc_ObjNotCond( (Abc_Obj_t *)Vec_PtrEntry(vNodes, uLit0 >> 1), (uLit0 & 1) );
473  Abc_ObjAddFanin( pObj, pNode0 );
474  }
475  Vec_IntFree( vLits );
476  }
477 
478  // read the names if present
479  pCur = pSymbols;
480  if ( pCur < pContents + nFileSize && *pCur != 'c' )
481  {
482  int Counter = 0;
483  while ( pCur < pContents + nFileSize && *pCur != 'c' )
484  {
485  // get the terminal type
486  pType = pCur;
487  if ( *pCur == 'i' )
488  vTerms = pNtkNew->vPis;
489  else if ( *pCur == 'l' )
490  vTerms = pNtkNew->vBoxes;
491  else if ( *pCur == 'o' || *pCur == 'b' || *pCur == 'c' || *pCur == 'j' || *pCur == 'f' )
492  vTerms = pNtkNew->vPos;
493  else
494  {
495 // fprintf( stdout, "Wrong terminal type.\n" );
496  return NULL;
497  }
498  // get the terminal number
499  iTerm = atoi( ++pCur ); while ( *pCur++ != ' ' );
500  // get the node
501  if ( iTerm >= Vec_PtrSize(vTerms) )
502  {
503  fprintf( stdout, "The number of terminal is out of bound.\n" );
504  return NULL;
505  }
506  pObj = (Abc_Obj_t *)Vec_PtrEntry( vTerms, iTerm );
507  if ( *pType == 'l' )
508  pObj = Abc_ObjFanout0(pObj);
509  // assign the name
510  pName = pCur; while ( *pCur++ != '\n' );
511  // assign this name
512  *(pCur-1) = 0;
513  Abc_ObjAssignName( pObj, pName, NULL );
514  if ( *pType == 'l' )
515  {
516  Abc_ObjAssignName( Abc_ObjFanin0(pObj), Abc_ObjName(pObj), "L" );
518  }
519  // mark the node as named
520  pObj->pCopy = (Abc_Obj_t *)Abc_ObjName(pObj);
521  }
522 
523  // assign the remaining names
524  Abc_NtkForEachPi( pNtkNew, pObj, i )
525  {
526  if ( pObj->pCopy ) continue;
527  Abc_ObjAssignName( pObj, Abc_ObjName(pObj), NULL );
528  Counter++;
529  }
530  Abc_NtkForEachLatchOutput( pNtkNew, pObj, i )
531  {
532  if ( pObj->pCopy ) continue;
533  Abc_ObjAssignName( pObj, Abc_ObjName(pObj), NULL );
534  Abc_ObjAssignName( Abc_ObjFanin0(pObj), Abc_ObjName(pObj), "L" );
536  Counter++;
537  }
538  Abc_NtkForEachPo( pNtkNew, pObj, i )
539  {
540  if ( pObj->pCopy ) continue;
541  Abc_ObjAssignName( pObj, Abc_ObjName(pObj), NULL );
542  Counter++;
543  }
544 // if ( Counter )
545 // printf( "Io_ReadAiger(): Added %d default names for nameless I/O/register objects.\n", Counter );
546  }
547  else
548  {
549 // printf( "Io_ReadAiger(): I/O/register names are not given. Generating short names.\n" );
550  Abc_NtkShortNames( pNtkNew );
551  }
552 
553  // read the name of the model if given
554  pCur = pSymbols;
555  if ( pCur + 1 < pContents + nFileSize && *pCur == 'c' )
556  {
557  pCur++;
558  if ( *pCur == 'n' )
559  {
560  pCur++;
561  // read model name
562  if ( strlen(pCur) > 0 )
563  {
564  ABC_FREE( pNtkNew->pName );
565  pNtkNew->pName = Extra_UtilStrsav( pCur );
566  }
567  }
568  }
569 
570  // skipping the comments
571  ABC_FREE( pContents );
572  Vec_PtrFree( vNodes );
573 
574  // remove the extra nodes
575  Abc_AigCleanup( (Abc_Aig_t *)pNtkNew->pManFunc );
576 
577  // update polarity of the additional outputs
578  if ( nBad || nConstr || nJust || nFair )
579  Abc_NtkInvertConstraints( pNtkNew );
580 
581  // check the result
582  if ( fCheck && !Abc_NtkCheckRead( pNtkNew ) )
583  {
584  printf( "Io_ReadAiger: The network check has failed.\n" );
585  Abc_NtkDelete( pNtkNew );
586  return NULL;
587  }
588  return pNtkNew;
589 }
590 
591 
592 
593 ////////////////////////////////////////////////////////////////////////
594 /// END OF FILE ///
595 ////////////////////////////////////////////////////////////////////////
596 
597 
599 
static char * Ioa_ReadLoadFileBz2Aig(char *pFileName, int *pFileSize)
Definition: ioReadAiger.c:118
ABC_DLL void Abc_NtkInvertConstraints(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:2204
char buf[1<< 20]
Definition: ioReadAiger.c:113
Abc_Ntk_t * Io_ReadAiger(char *pFileName, int fCheck)
FUNCTION DECLARATIONS ///.
Definition: ioReadAiger.c:234
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
struct buflist buflist
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Ptr_t * vBoxes
Definition: abc.h:168
#define BZ_DATA_ERROR_MAGIC
Definition: bzlib.h:43
#define ABC_REALLOC(type, obj, num)
Definition: abc_global.h:233
#define Abc_NtkForEachLatchOutput(pNtk, pObj, i)
Definition: abc.h:503
#define SEEK_END
Definition: zconf.h:392
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
ABC_DLL void Abc_NtkShortNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:490
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
char * memcpy()
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
ABC_NAMESPACE_IMPL_START int ZEXPORT gzclose(gzFile file)
Definition: gzclose.c:18
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition: abcNames.c:68
Vec_Ptr_t * vPis
Definition: abc.h:163
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void Abc_LatchSetInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:420
voidp gzFile
Definition: zlib.h:1173
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
int nBuf
Definition: ioReadAiger.c:114
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
void BZ_API() BZ2_bzReadClose(int *bzerror, BZFILE *b)
Definition: bzlib.c:1154
static Abc_Obj_t * Abc_NtkCreateBo(Abc_Ntk_t *pNtk)
Definition: abc.h:306
void * pManFunc
Definition: abc.h:191
ABC_DLL Abc_Obj_t * Abc_AigAnd(Abc_Aig_t *pMan, Abc_Obj_t *p0, Abc_Obj_t *p1)
Definition: abcAig.c:700
DECLARATIONS ///.
Abc_Obj_t * pCopy
Definition: abc.h:148
Vec_Ptr_t * vPos
Definition: abc.h:164
#define BZ_OK
Definition: bzlib.h:34
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
int Extra_FileSize(char *pFileName)
struct buflist * next
Definition: ioReadAiger.c:115
ABC_DLL int Abc_NtkCheckRead(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:77
char * Extra_FileNameGeneric(char *FileName)
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
static int Abc_Base10Log(unsigned n)
Definition: abc_global.h:252
#define BZ_STREAM_END
Definition: bzlib.h:38
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
BZFILE *BZ_API() BZ2_bzReadOpen(int *bzerror, FILE *f, int verbosity, int small, void *unused, int nUnused)
Definition: bzlib.c:1099
int BZ_API() BZ2_bzRead(int *bzerror, BZFILE *b, void *buf, int len)
Definition: bzlib.c:1173
static Abc_Obj_t * Abc_NtkCreateLatch(Abc_Ntk_t *pNtk)
Definition: abc.h:309
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Counter
static ABC_NAMESPACE_IMPL_START unsigned Io_ReadAigerDecode(char **ppPos)
DECLARATIONS ///.
Definition: ioReadAiger.c:56
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
void Extra_ProgressBarStop(ProgressBar *p)
static Abc_Obj_t * Abc_NtkBox(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:319
static char * Ioa_ReadLoadFileGzAig(char *pFileName, int *pFileSize)
Definition: ioReadAiger.c:199
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static void Abc_LatchSetInit1(Abc_Obj_t *pLatch)
Definition: abc.h:419
char * pSpec
Definition: abc.h:159
gzFile ZEXPORT gzopen(const char *path, const char *mode)
Definition: gzlib.c:198
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Abc_NtkForEachLatchInput(pNtk, pObj, i)
Definition: abc.h:500
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
int strncmp()
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
int strlen()
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_NtkCreateBi(Abc_Ntk_t *pNtk)
Definition: abc.h:305
void BZFILE
Definition: bzlib.h:142
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
int ZEXPORT gzread(gzFile file, voidp buf, unsigned len)
Definition: gzread.c:357
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
VOID_HACK rewind()
char * pName
Definition: abc.h:158
Vec_Int_t * Io_WriteDecodeLiterals(char **ppPos, int nEntries)
Definition: ioReadAiger.c:79
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
int nConstrs
Definition: abc.h:173
int nTotal
DECLARATIONS ///.
Definition: cutTruth.c:37
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223