abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ioReadBlif.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [ioReadBlif.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Command processing package.]
8 
9  Synopsis [Procedures to read BLIF files.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: ioReadBlif.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "ioAbc.h"
22 #include "base/main/main.h"
23 #include "map/mio/mio.h"
24 
26 
27 
28 ////////////////////////////////////////////////////////////////////////
29 /// DECLARATIONS ///
30 ////////////////////////////////////////////////////////////////////////
31 
32 typedef struct Io_ReadBlif_t_ Io_ReadBlif_t; // all reading info
34 {
35  // general info about file
36  char * pFileName; // the name of the file
37  Extra_FileReader_t * pReader; // the input file reader
38  // current processing info
39  Abc_Ntk_t * pNtkMaster; // the primary network
40  Abc_Ntk_t * pNtkCur; // the primary network
41  int LineCur; // the line currently parsed
42  // temporary storage for tokens
43  Vec_Ptr_t * vTokens; // the current tokens
44  Vec_Ptr_t * vNewTokens; // the temporary storage for the tokens
45  Vec_Str_t * vCubes; // the temporary storage for the tokens
46  // the error message
47  FILE * Output; // the output stream
48  char sError[1000]; // the error string generated during parsing
49  int fError; // set to 1 when error occurs
50 };
51 
52 static Io_ReadBlif_t * Io_ReadBlifFile( char * pFileName );
53 static void Io_ReadBlifFree( Io_ReadBlif_t * p );
56 static char * Io_ReadBlifCleanName( char * pName );
57 
60 static int Io_ReadBlifNetworkInputs( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
61 static int Io_ReadBlifNetworkOutputs( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
62 static int Io_ReadBlifNetworkLatch( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
63 static int Io_ReadBlifNetworkNames( Io_ReadBlif_t * p, Vec_Ptr_t ** pvTokens );
64 static int Io_ReadBlifNetworkGate( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
65 static int Io_ReadBlifNetworkSubcircuit( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
66 static int Io_ReadBlifNetworkInputArrival( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
70 static int Io_ReadBlifNetworkInputDrive( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
71 static int Io_ReadBlifNetworkOutputLoad( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
74 static int Io_ReadBlifNetworkAndGateDelay( Io_ReadBlif_t * p, Vec_Ptr_t * vTokens );
75 static int Io_ReadBlifNetworkConnectBoxes( Io_ReadBlif_t * p, Abc_Ntk_t * pNtkMaster );
76 
77 ////////////////////////////////////////////////////////////////////////
78 /// FUNCTION DEFINITIONS ///
79 ////////////////////////////////////////////////////////////////////////
80 
81 /**Function*************************************************************
82 
83  Synopsis [Reads the (hierarchical) network from the BLIF file.]
84 
85  Description []
86 
87  SideEffects []
88 
89  SeeAlso []
90 
91 ***********************************************************************/
92 Abc_Ntk_t * Io_ReadBlif( char * pFileName, int fCheck )
93 {
94  Io_ReadBlif_t * p;
95  Abc_Ntk_t * pNtk;
96 
97  // start the file
98  p = Io_ReadBlifFile( pFileName );
99  if ( p == NULL )
100  return NULL;
101 
102  // read the hierarchical network
103  pNtk = Io_ReadBlifNetwork( p );
104  if ( pNtk == NULL )
105  {
106  Io_ReadBlifFree( p );
107  return NULL;
108  }
109  pNtk->pSpec = Extra_UtilStrsav( pFileName );
110  Abc_NtkTimeInitialize( pNtk, NULL );
111  Io_ReadBlifFree( p );
112 
113  // make sure that everything is okay with the network structure
114  if ( fCheck && !Abc_NtkCheckRead( pNtk ) )
115  {
116  printf( "Io_ReadBlif: The network check has failed.\n" );
117  Abc_NtkDelete( pNtk );
118  return NULL;
119  }
120  return pNtk;
121 }
122 
123 /**Function*************************************************************
124 
125  Synopsis [Iteratively reads several networks in the hierarchical design.]
126 
127  Description []
128 
129  SideEffects []
130 
131  SeeAlso []
132 
133 ***********************************************************************/
135 {
136  Abc_Ntk_t * pNtk, * pNtkMaster;
137 
138  // read the name of the master network
139  p->vTokens = Io_ReadBlifGetTokens(p);
140  if ( p->vTokens == NULL || strcmp( (char *)p->vTokens->pArray[0], ".model" ) )
141  {
142  p->LineCur = 0;
143  sprintf( p->sError, "Wrong input file format." );
145  return NULL;
146  }
147 
148  // read networks (with EXDC)
149  pNtkMaster = NULL;
150  while ( p->vTokens )
151  {
152  // read the network and its EXDC if present
153  pNtk = Io_ReadBlifNetworkOne( p );
154  if ( pNtk == NULL )
155  break;
156  if ( p->vTokens && strcmp((char *)p->vTokens->pArray[0], ".exdc") == 0 )
157  {
158  pNtk->pExdc = Io_ReadBlifNetworkOne( p );
159  if ( pNtk->pExdc == NULL )
160  break;
161  Abc_NtkFinalizeRead( pNtk->pExdc );
162  }
163  // add this network as part of the hierarchy
164  if ( pNtkMaster == NULL ) // no master network so far
165  {
166  p->pNtkMaster = pNtkMaster = pNtk;
167  continue;
168  }
169 /*
170  // make sure hierarchy does not have the network with this name
171  if ( pNtkMaster->tName2Model && stmm_is_member( pNtkMaster->tName2Model, pNtk->pName ) )
172  {
173  p->LineCur = 0;
174  sprintf( p->sError, "Model %s is multiply defined in the file.", pNtk->pName );
175  Io_ReadBlifPrintErrorMessage( p );
176  Abc_NtkDelete( pNtk );
177  Abc_NtkDelete( pNtkMaster );
178  pNtkMaster = NULL;
179  return NULL;
180  }
181  // add the network to the hierarchy
182  if ( pNtkMaster->tName2Model == NULL )
183  pNtkMaster->tName2Model = stmm_init_table((int (*)(void))strcmp, (int (*)(void))stmm_strhash);
184  stmm_insert( pNtkMaster->tName2Model, pNtk->pName, (char *)pNtk );
185 */
186  }
187 /*
188  // if there is a hierarchy, connect the boxes
189  if ( pNtkMaster && pNtkMaster->tName2Model )
190  {
191  if ( Io_ReadBlifNetworkConnectBoxes( p, pNtkMaster ) )
192  {
193  Abc_NtkDelete( pNtkMaster );
194  return NULL;
195  }
196  }
197  else
198 */
199  if ( !p->fError )
200  Abc_NtkFinalizeRead( pNtkMaster );
201  // return the master network
202  return pNtkMaster;
203 }
204 
205 /**Function*************************************************************
206 
207  Synopsis [Reads one (main or exdc) network from the BLIF file.]
208 
209  Description []
210 
211  SideEffects []
212 
213  SeeAlso []
214 
215 ***********************************************************************/
217 {
218  ProgressBar * pProgress = NULL;
219  Abc_Ntk_t * pNtk;
220  char * pDirective;
221  int iLine, fTokensReady, fStatus;
222 
223  // make sure the tokens are present
224  assert( p->vTokens != NULL );
225 
226  // create the new network
227  p->pNtkCur = pNtk = Abc_NtkAlloc( ABC_NTK_NETLIST, ABC_FUNC_SOP, 1 );
228  // read the model name
229  if ( strcmp( (char *)p->vTokens->pArray[0], ".model" ) == 0 )
230  {
231  char * pToken, * pPivot;
232  if ( Vec_PtrSize(p->vTokens) != 2 )
233  {
234  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
235  sprintf( p->sError, "The .model line does not have exactly two entries." );
237  return NULL;
238  }
239  for ( pPivot = pToken = (char *)Vec_PtrEntry(p->vTokens, 1); *pToken; pToken++ )
240  if ( *pToken == '/' || *pToken == '\\' )
241  pPivot = pToken+1;
242  pNtk->pName = Extra_UtilStrsav( pPivot );
243  }
244  else if ( strcmp( (char *)p->vTokens->pArray[0], ".exdc" ) != 0 )
245  {
246  printf( "%s: File parsing skipped after line %d (\"%s\").\n", p->pFileName,
247  Extra_FileReaderGetLineNumber(p->pReader, 0), (char*)p->vTokens->pArray[0] );
248  Abc_NtkDelete(pNtk);
249  p->pNtkCur = NULL;
250  return NULL;
251  }
252 
253  // read the inputs/outputs
254  if ( p->pNtkMaster == NULL )
255  pProgress = Extra_ProgressBarStart( stdout, Extra_FileReaderGetFileSize(p->pReader) );
256  fTokensReady = fStatus = 0;
257  for ( iLine = 0; fTokensReady || (p->vTokens = Io_ReadBlifGetTokens(p)); iLine++ )
258  {
259  if ( p->pNtkMaster == NULL && iLine % 1000 == 0 )
260  Extra_ProgressBarUpdate( pProgress, Extra_FileReaderGetCurPosition(p->pReader), NULL );
261 
262  // consider different line types
263  fTokensReady = 0;
264  pDirective = (char *)p->vTokens->pArray[0];
265  if ( !strcmp( pDirective, ".names" ) )
266  { fStatus = Io_ReadBlifNetworkNames( p, &p->vTokens ); fTokensReady = 1; }
267  else if ( !strcmp( pDirective, ".gate" ) )
268  fStatus = Io_ReadBlifNetworkGate( p, p->vTokens );
269  else if ( !strcmp( pDirective, ".latch" ) )
270  fStatus = Io_ReadBlifNetworkLatch( p, p->vTokens );
271  else if ( !strcmp( pDirective, ".inputs" ) )
272  fStatus = Io_ReadBlifNetworkInputs( p, p->vTokens );
273  else if ( !strcmp( pDirective, ".outputs" ) )
274  fStatus = Io_ReadBlifNetworkOutputs( p, p->vTokens );
275  else if ( !strcmp( pDirective, ".input_arrival" ) )
276  fStatus = Io_ReadBlifNetworkInputArrival( p, p->vTokens );
277  else if ( !strcmp( pDirective, ".output_required" ) )
278  fStatus = Io_ReadBlifNetworkOutputRequired( p, p->vTokens );
279  else if ( !strcmp( pDirective, ".default_input_arrival" ) )
280  fStatus = Io_ReadBlifNetworkDefaultInputArrival( p, p->vTokens );
281  else if ( !strcmp( pDirective, ".default_output_required" ) )
282  fStatus = Io_ReadBlifNetworkDefaultOutputRequired( p, p->vTokens );
283  else if ( !strcmp( pDirective, ".input_drive" ) )
284  fStatus = Io_ReadBlifNetworkInputDrive( p, p->vTokens );
285  else if ( !strcmp( pDirective, ".output_load" ) )
286  fStatus = Io_ReadBlifNetworkOutputLoad( p, p->vTokens );
287  else if ( !strcmp( pDirective, ".default_input_drive" ) )
288  fStatus = Io_ReadBlifNetworkDefaultInputDrive( p, p->vTokens );
289  else if ( !strcmp( pDirective, ".default_output_load" ) )
290  fStatus = Io_ReadBlifNetworkDefaultOutputLoad( p, p->vTokens );
291  else if ( !strcmp( pDirective, ".and_gate_delay" ) )
292  fStatus = Io_ReadBlifNetworkAndGateDelay( p, p->vTokens );
293 // else if ( !strcmp( pDirective, ".subckt" ) )
294 // fStatus = Io_ReadBlifNetworkSubcircuit( p, p->vTokens );
295  else if ( !strcmp( pDirective, ".exdc" ) )
296  break;
297  else if ( !strcmp( pDirective, ".end" ) )
298  {
299  p->vTokens = Io_ReadBlifGetTokens(p);
300  break;
301  }
302  else if ( !strcmp( pDirective, ".blackbox" ) )
303  {
304  pNtk->ntkType = ABC_NTK_NETLIST;
305  pNtk->ntkFunc = ABC_FUNC_BLACKBOX;
306  Mem_FlexStop( (Mem_Flex_t *)pNtk->pManFunc, 0 );
307  pNtk->pManFunc = NULL;
308  }
309  else
310  printf( "%s (line %d): Skipping directive \"%s\".\n", p->pFileName,
311  Extra_FileReaderGetLineNumber(p->pReader, 0), pDirective );
312  if ( p->vTokens == NULL ) // some files do not have ".end" in the end
313  break;
314  if ( fStatus == 1 )
315  {
316  Extra_ProgressBarStop( pProgress );
317  Abc_NtkDelete( pNtk );
318  return NULL;
319  }
320  }
321  if ( p->pNtkMaster == NULL )
322  Extra_ProgressBarStop( pProgress );
323  return pNtk;
324 }
325 
326 /**Function*************************************************************
327 
328  Synopsis []
329 
330  Description []
331 
332  SideEffects []
333 
334  SeeAlso []
335 
336 ***********************************************************************/
338 {
339  int i;
340  for ( i = 1; i < vTokens->nSize; i++ )
341  Io_ReadCreatePi( p->pNtkCur, (char *)vTokens->pArray[i] );
342  return 0;
343 }
344 
345 /**Function*************************************************************
346 
347  Synopsis []
348 
349  Description []
350 
351  SideEffects []
352 
353  SeeAlso []
354 
355 ***********************************************************************/
357 {
358  int i;
359  for ( i = 1; i < vTokens->nSize; i++ )
360  Io_ReadCreatePo( p->pNtkCur, (char *)vTokens->pArray[i] );
361  return 0;
362 }
363 
364 /**Function*************************************************************
365 
366  Synopsis []
367 
368  Description []
369 
370  SideEffects []
371 
372  SeeAlso []
373 
374 ***********************************************************************/
376 {
377  Abc_Ntk_t * pNtk = p->pNtkCur;
378  Abc_Obj_t * pLatch;
379  int ResetValue;
380  if ( vTokens->nSize < 3 )
381  {
382  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
383  sprintf( p->sError, "The .latch line does not have enough tokens." );
385  return 1;
386  }
387  // create the latch
388  pLatch = Io_ReadCreateLatch( pNtk, (char *)vTokens->pArray[1], (char *)vTokens->pArray[2] );
389  // get the latch reset value
390  if ( vTokens->nSize == 3 )
391  Abc_LatchSetInitDc( pLatch );
392  else
393  {
394  ResetValue = atoi((char *)vTokens->pArray[vTokens->nSize-1]);
395  if ( ResetValue != 0 && ResetValue != 1 && ResetValue != 2 )
396  {
397  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
398  sprintf( p->sError, "The .latch line has an unknown reset value (%s).", (char*)vTokens->pArray[3] );
400  return 1;
401  }
402  if ( ResetValue == 0 )
403  Abc_LatchSetInit0( pLatch );
404  else if ( ResetValue == 1 )
405  Abc_LatchSetInit1( pLatch );
406  else if ( ResetValue == 2 )
407  Abc_LatchSetInitDc( pLatch );
408  }
409  return 0;
410 }
411 
412 /**Function*************************************************************
413 
414  Synopsis []
415 
416  Description []
417 
418  SideEffects []
419 
420  SeeAlso []
421 
422 ***********************************************************************/
424 {
425  Vec_Ptr_t * vTokens = *pvTokens;
426  Abc_Ntk_t * pNtk = p->pNtkCur;
427  Abc_Obj_t * pNode;
428  char * pToken, Char, ** ppNames;
429  int nFanins, nNames;
430 
431  // create a new node and add it to the network
432  if ( vTokens->nSize < 2 )
433  {
434  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
435  sprintf( p->sError, "The .names line has less than two tokens." );
437  return 1;
438  }
439 
440  // create the node
441  ppNames = (char **)vTokens->pArray + 1;
442  nNames = vTokens->nSize - 2;
443  pNode = Io_ReadCreateNode( pNtk, ppNames[nNames], ppNames, nNames );
444 
445  // derive the functionality of the node
446  p->vCubes->nSize = 0;
447  nFanins = vTokens->nSize - 2;
448  if ( nFanins == 0 )
449  {
450  while ( (vTokens = Io_ReadBlifGetTokens(p)) )
451  {
452  pToken = (char *)vTokens->pArray[0];
453  if ( pToken[0] == '.' )
454  break;
455  // read the cube
456  if ( vTokens->nSize != 1 )
457  {
458  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
459  sprintf( p->sError, "The number of tokens in the constant cube is wrong." );
461  return 1;
462  }
463  // create the cube
464  Char = ((char *)vTokens->pArray[0])[0];
465  Vec_StrPush( p->vCubes, ' ' );
466  Vec_StrPush( p->vCubes, Char );
467  Vec_StrPush( p->vCubes, '\n' );
468  }
469  }
470  else
471  {
472  while ( (vTokens = Io_ReadBlifGetTokens(p)) )
473  {
474  pToken = (char *)vTokens->pArray[0];
475  if ( pToken[0] == '.' )
476  break;
477  // read the cube
478  if ( vTokens->nSize != 2 )
479  {
480  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
481  sprintf( p->sError, "The number of tokens in the cube is wrong." );
483  return 1;
484  }
485  // create the cube
486  Vec_StrPrintStr( p->vCubes, (char *)vTokens->pArray[0] );
487  // check the char
488  Char = ((char *)vTokens->pArray[1])[0];
489  if ( Char != '0' && Char != '1' && Char != 'x' && Char != 'n' )
490  {
491  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
492  sprintf( p->sError, "The output character in the constant cube is wrong." );
494  return 1;
495  }
496  Vec_StrPush( p->vCubes, ' ' );
497  Vec_StrPush( p->vCubes, Char );
498  Vec_StrPush( p->vCubes, '\n' );
499  }
500  }
501  // if there is nothing there
502  if ( p->vCubes->nSize == 0 )
503  {
504  // create an empty cube
505  Vec_StrPush( p->vCubes, ' ' );
506  Vec_StrPush( p->vCubes, '0' );
507  Vec_StrPush( p->vCubes, '\n' );
508  }
509  Vec_StrPush( p->vCubes, 0 );
510 
511  // set the pointer to the functionality of the node
512  Abc_ObjSetData( pNode, Abc_SopRegister((Mem_Flex_t *)pNtk->pManFunc, p->vCubes->pArray) );
513 
514  // check the size
515  if ( Abc_ObjFaninNum(pNode) != Abc_SopGetVarNum((char *)Abc_ObjData(pNode)) )
516  {
517  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
518  sprintf( p->sError, "The number of fanins (%d) of node %s is different from SOP size (%d).",
519  Abc_ObjFaninNum(pNode), Abc_ObjName(Abc_ObjFanout(pNode,0)), Abc_SopGetVarNum((char *)Abc_ObjData(pNode)) );
521  return 1;
522  }
523 
524  // return the last array of tokens
525  *pvTokens = vTokens;
526  return 0;
527 }
528 
529 /**Function*************************************************************
530 
531  Synopsis []
532 
533  Description []
534 
535  SideEffects []
536 
537  SeeAlso []
538 
539 ***********************************************************************/
541 {
542  Mio_Pin_t * pGatePin;
543  char * pName, * pNamePin;
544  int i, k, nSize, Length;
545  nSize = Vec_PtrSize(vTokens);
546  if ( pTwin == NULL )
547  {
548  if ( nSize - 3 != Mio_GateReadPinNum(pGate) )
549  return 0;
550  }
551  else
552  {
553  if ( nSize - 3 != Mio_GateReadPinNum(pGate) && nSize - 4 != Mio_GateReadPinNum(pGate) )
554  return 0;
555  }
556  // check if the names are in order
557  for ( pGatePin = Mio_GateReadPins(pGate), i = 0; pGatePin; pGatePin = Mio_PinReadNext(pGatePin), i++ )
558  {
559  pNamePin = Mio_PinReadName(pGatePin);
560  Length = strlen(pNamePin);
561  pName = (char *)Vec_PtrEntry(vTokens, i+2);
562  if ( !strncmp( pNamePin, pName, Length ) && pName[Length] == '=' )
563  continue;
564  break;
565  }
566  if ( pTwin == NULL )
567  {
568  if ( i == Mio_GateReadPinNum(pGate) )
569  return 1;
570  // reorder the pins
571  for ( pGatePin = Mio_GateReadPins(pGate), i = 0; pGatePin; pGatePin = Mio_PinReadNext(pGatePin), i++ )
572  {
573  pNamePin = Mio_PinReadName(pGatePin);
574  Length = strlen(pNamePin);
575  for ( k = 2; k < nSize; k++ )
576  {
577  pName = (char *)Vec_PtrEntry(vTokens, k);
578  if ( !strncmp( pNamePin, pName, Length ) && pName[Length] == '=' )
579  {
580  Vec_PtrPush( vTokens, pName );
581  break;
582  }
583  }
584  }
585  pNamePin = Mio_GateReadOutName(pGate);
586  Length = strlen(pNamePin);
587  for ( k = 2; k < nSize; k++ )
588  {
589  pName = (char *)Vec_PtrEntry(vTokens, k);
590  if ( !strncmp( pNamePin, pName, Length ) && pName[Length] == '=' )
591  {
592  Vec_PtrPush( vTokens, pName );
593  break;
594  }
595  }
596  if ( Vec_PtrSize(vTokens) - nSize != nSize - 2 )
597  return 0;
598  Vec_PtrForEachEntryStart( char *, vTokens, pName, k, nSize )
599  Vec_PtrWriteEntry( vTokens, k - nSize + 2, pName );
600  Vec_PtrShrink( vTokens, nSize );
601  }
602  else
603  {
604  if ( i != Mio_GateReadPinNum(pGate) ) // expect the correct order of input pins in the network with twin gates
605  return 0;
606  // check the last two entries
607  if ( nSize - 3 == Mio_GateReadPinNum(pGate) ) // only one output is available
608  {
609  pNamePin = Mio_GateReadOutName(pGate);
610  Length = strlen(pNamePin);
611  pName = (char *)Vec_PtrEntry(vTokens, nSize - 1);
612  if ( !strncmp( pNamePin, pName, Length ) && pName[Length] == '=' ) // the last entry is pGate
613  {
614  Vec_PtrPush( vTokens, NULL );
615  return 1;
616  }
617  pNamePin = Mio_GateReadOutName(pTwin);
618  Length = strlen(pNamePin);
619  pName = (char *)Vec_PtrEntry(vTokens, nSize - 1);
620  if ( !strncmp( pNamePin, pName, Length ) && pName[Length] == '=' ) // the last entry is pTwin
621  {
622  pName = (char *)Vec_PtrPop( vTokens );
623  Vec_PtrPush( vTokens, NULL );
624  Vec_PtrPush( vTokens, pName );
625  return 1;
626  }
627  return 0;
628  }
629  if ( nSize - 4 == Mio_GateReadPinNum(pGate) ) // two outputs are available
630  {
631  pNamePin = Mio_GateReadOutName(pGate);
632  Length = strlen(pNamePin);
633  pName = (char *)Vec_PtrEntry(vTokens, nSize - 2);
634  if ( !(!strncmp( pNamePin, pName, Length ) && pName[Length] == '=') )
635  return 0;
636  pNamePin = Mio_GateReadOutName(pTwin);
637  Length = strlen(pNamePin);
638  pName = (char *)Vec_PtrEntry(vTokens, nSize - 1);
639  if ( !(!strncmp( pNamePin, pName, Length ) && pName[Length] == '=') )
640  return 0;
641  return 1;
642  }
643  assert( 0 );
644  }
645  return 1;
646 }
647 
648 /**Function*************************************************************
649 
650  Synopsis []
651 
652  Description []
653 
654  SideEffects []
655 
656  SeeAlso []
657 
658 ***********************************************************************/
660 {
661  Mio_Library_t * pGenlib;
662  Mio_Gate_t * pGate;
663  Abc_Obj_t * pNode;
664  char ** ppNames;
665  int i, nNames;
666 
667  // check that the library is available
668  pGenlib = (Mio_Library_t *)Abc_FrameReadLibGen();
669  if ( pGenlib == NULL )
670  {
671  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
672  sprintf( p->sError, "The current library is not available." );
674  return 1;
675  }
676 
677  // create a new node and add it to the network
678  if ( vTokens->nSize < 2 )
679  {
680  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
681  sprintf( p->sError, "The .gate line has less than two tokens." );
683  return 1;
684  }
685 
686  // get the gate
687  pGate = Mio_LibraryReadGateByName( pGenlib, (char *)vTokens->pArray[1], NULL );
688  if ( pGate == NULL )
689  {
690  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
691  sprintf( p->sError, "Cannot find gate \"%s\" in the library.", (char*)vTokens->pArray[1] );
693  return 1;
694  }
695 
696  // if this is the first line with gate, update the network type
697  if ( Abc_NtkNodeNum(p->pNtkCur) == 0 )
698  {
699  assert( p->pNtkCur->ntkFunc == ABC_FUNC_SOP );
700  p->pNtkCur->ntkFunc = ABC_FUNC_MAP;
701  Mem_FlexStop( (Mem_Flex_t *)p->pNtkCur->pManFunc, 0 );
702  p->pNtkCur->pManFunc = pGenlib;
703  }
704 
705  // reorder the formal inputs to be in the same order as in the gate
706  if ( !Io_ReadBlifReorderFormalNames( vTokens, pGate, Mio_GateReadTwin(pGate) ) )
707  {
708  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
709  sprintf( p->sError, "Mismatch in the fanins of gate \"%s\".", (char*)vTokens->pArray[1] );
711  return 1;
712  }
713 
714 
715  // remove the formal parameter names
716  for ( i = 2; i < vTokens->nSize; i++ )
717  {
718  vTokens->pArray[i] = Io_ReadBlifCleanName( (char *)vTokens->pArray[i] );
719  if ( vTokens->pArray[i] == NULL )
720  {
721  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
722  sprintf( p->sError, "Invalid gate input assignment." );
724  return 1;
725  }
726  }
727 
728  // create the node
729  if ( Mio_GateReadTwin(pGate) == NULL )
730  {
731  nNames = vTokens->nSize - 3;
732  ppNames = (char **)vTokens->pArray + 2;
733  pNode = Io_ReadCreateNode( p->pNtkCur, ppNames[nNames], ppNames, nNames );
734  Abc_ObjSetData( pNode, pGate );
735  }
736  else
737  {
738  nNames = vTokens->nSize - 4;
739  ppNames = (char **)vTokens->pArray + 2;
740  assert( ppNames[nNames] != NULL || ppNames[nNames+1] != NULL );
741  if ( ppNames[nNames] )
742  {
743  pNode = Io_ReadCreateNode( p->pNtkCur, ppNames[nNames], ppNames, nNames );
744  Abc_ObjSetData( pNode, pGate );
745  }
746  if ( ppNames[nNames+1] )
747  {
748  pNode = Io_ReadCreateNode( p->pNtkCur, ppNames[nNames+1], ppNames, nNames );
749  Abc_ObjSetData( pNode, Mio_GateReadTwin(pGate) );
750  }
751  }
752  return 0;
753 }
754 
755 /**Function*************************************************************
756 
757  Synopsis [Creates a multi-input multi-output box in the hierarchical design.]
758 
759  Description []
760 
761  SideEffects []
762 
763  SeeAlso []
764 
765 ***********************************************************************/
767 {
768  Abc_Obj_t * pBox;
769  Vec_Ptr_t * vNames;
770  char * pName;
771  int i;
772 
773  // create a new node and add it to the network
774  if ( vTokens->nSize < 3 )
775  {
776  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
777  sprintf( p->sError, "The .subcircuit line has less than three tokens." );
779  return 1;
780  }
781 
782  // store the names of formal/actual inputs/outputs of the box
783  vNames = Vec_PtrAlloc( 10 );
784  Vec_PtrForEachEntryStart( char *, vTokens, pName, i, 1 )
785 // Vec_PtrPush( vNames, Abc_NtkRegisterName(p->pNtkCur, pName) );
786  Vec_PtrPush( vNames, Extra_UtilStrsav(pName) ); // memory leak!!!
787 
788  // create a new box and add it to the network
789  pBox = Abc_NtkCreateBlackbox( p->pNtkCur );
790  // set the pointer to the node names
791  Abc_ObjSetData( pBox, vNames );
792  // remember the line of the file
793  pBox->pCopy = (Abc_Obj_t *)(ABC_PTRINT_T)Extra_FileReaderGetLineNumber(p->pReader, 0);
794  return 0;
795 }
796 
797 /**Function*************************************************************
798 
799  Synopsis []
800 
801  Description []
802 
803  SideEffects []
804 
805  SeeAlso []
806 
807 ***********************************************************************/
808 char * Io_ReadBlifCleanName( char * pName )
809 {
810  int i, Length;
811  Length = strlen(pName);
812  for ( i = 0; i < Length; i++ )
813  if ( pName[i] == '=' )
814  return pName + i + 1;
815  return NULL;
816 }
817 
818 /**Function*************************************************************
819 
820  Synopsis []
821 
822  Description []
823 
824  SideEffects []
825 
826  SeeAlso []
827 
828 ***********************************************************************/
830 {
831  Abc_Obj_t * pNet;
832  char * pFoo1, * pFoo2;
833  double TimeRise, TimeFall;
834 
835  // make sure this is indeed the .inputs line
836  assert( strncmp( (char *)vTokens->pArray[0], ".input_arrival", 14 ) == 0 );
837  if ( vTokens->nSize != 4 )
838  {
839  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
840  sprintf( p->sError, "Wrong number of arguments on .input_arrival line." );
842  return 1;
843  }
844  pNet = Abc_NtkFindNet( p->pNtkCur, (char *)vTokens->pArray[1] );
845  if ( pNet == NULL )
846  {
847  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
848  sprintf( p->sError, "Cannot find object corresponding to %s on .input_arrival line.", (char*)vTokens->pArray[1] );
850  return 1;
851  }
852  TimeRise = strtod( (char *)vTokens->pArray[2], &pFoo1 );
853  TimeFall = strtod( (char *)vTokens->pArray[3], &pFoo2 );
854  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
855  {
856  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
857  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .input_arrival line.", (char*)vTokens->pArray[2], (char*)vTokens->pArray[3] );
859  return 1;
860  }
861  // set the arrival time
862  Abc_NtkTimeSetArrival( p->pNtkCur, Abc_ObjFanin0(pNet)->Id, (float)TimeRise, (float)TimeFall );
863  return 0;
864 }
865 
866 /**Function*************************************************************
867 
868  Synopsis []
869 
870  Description []
871 
872  SideEffects []
873 
874  SeeAlso []
875 
876 ***********************************************************************/
878 {
879  Abc_Obj_t * pNet;
880  char * pFoo1, * pFoo2;
881  double TimeRise, TimeFall;
882 
883  // make sure this is indeed the .inputs line
884  assert( strncmp( (char *)vTokens->pArray[0], ".output_required", 16 ) == 0 );
885  if ( vTokens->nSize != 4 )
886  {
887  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
888  sprintf( p->sError, "Wrong number of arguments on .output_required line." );
890  return 1;
891  }
892  pNet = Abc_NtkFindNet( p->pNtkCur, (char *)vTokens->pArray[1] );
893  if ( pNet == NULL )
894  {
895  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
896  sprintf( p->sError, "Cannot find object corresponding to %s on .output_required line.", (char*)vTokens->pArray[1] );
898  return 1;
899  }
900  TimeRise = strtod( (char *)vTokens->pArray[2], &pFoo1 );
901  TimeFall = strtod( (char *)vTokens->pArray[3], &pFoo2 );
902  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
903  {
904  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
905  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .output_required line.", (char*)vTokens->pArray[2], (char*)vTokens->pArray[3] );
907  return 1;
908  }
909  // set the arrival time
910  Abc_NtkTimeSetRequired( p->pNtkCur, Abc_ObjFanout0(pNet)->Id, (float)TimeRise, (float)TimeFall );
911  return 0;
912 }
913 
914 /**Function*************************************************************
915 
916  Synopsis []
917 
918  Description []
919 
920  SideEffects []
921 
922  SeeAlso []
923 
924 ***********************************************************************/
926 {
927  char * pFoo1, * pFoo2;
928  double TimeRise, TimeFall;
929 
930  // make sure this is indeed the .inputs line
931  assert( strncmp( (char *)vTokens->pArray[0], ".default_input_arrival", 23 ) == 0 );
932  if ( vTokens->nSize != 3 )
933  {
934  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
935  sprintf( p->sError, "Wrong number of arguments on .default_input_arrival line." );
937  return 1;
938  }
939  TimeRise = strtod( (char *)vTokens->pArray[1], &pFoo1 );
940  TimeFall = strtod( (char *)vTokens->pArray[2], &pFoo2 );
941  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
942  {
943  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
944  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .default_input_arrival line.", (char*)vTokens->pArray[1], (char*)vTokens->pArray[2] );
946  return 1;
947  }
948  // set the arrival time
949  Abc_NtkTimeSetDefaultArrival( p->pNtkCur, (float)TimeRise, (float)TimeFall );
950  return 0;
951 }
952 
953 /**Function*************************************************************
954 
955  Synopsis []
956 
957  Description []
958 
959  SideEffects []
960 
961  SeeAlso []
962 
963 ***********************************************************************/
965 {
966  char * pFoo1, * pFoo2;
967  double TimeRise, TimeFall;
968 
969  // make sure this is indeed the .inputs line
970  assert( strncmp( (char *)vTokens->pArray[0], ".default_output_required", 25 ) == 0 );
971  if ( vTokens->nSize != 3 )
972  {
973  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
974  sprintf( p->sError, "Wrong number of arguments on .default_output_required line." );
976  return 1;
977  }
978  TimeRise = strtod( (char *)vTokens->pArray[1], &pFoo1 );
979  TimeFall = strtod( (char *)vTokens->pArray[2], &pFoo2 );
980  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
981  {
982  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
983  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .default_output_required line.", (char*)vTokens->pArray[1], (char*)vTokens->pArray[2] );
985  return 1;
986  }
987  // set the arrival time
988  Abc_NtkTimeSetDefaultRequired( p->pNtkCur, (float)TimeRise, (float)TimeFall );
989  return 0;
990 }
991 
992 
993 /**Function*************************************************************
994 
995  Synopsis []
996 
997  Description []
998 
999  SideEffects []
1000 
1001  SeeAlso []
1002 
1003 ***********************************************************************/
1004 int Io_ReadFindCiId( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj )
1005 {
1006  Abc_Obj_t * pTemp;
1007  int i;
1008  Abc_NtkForEachCi( pNtk, pTemp, i )
1009  if ( pTemp == pObj )
1010  return i;
1011  return -1;
1012 }
1014 {
1015  Abc_Obj_t * pNet;
1016  char * pFoo1, * pFoo2;
1017  double TimeRise, TimeFall;
1018 
1019  // make sure this is indeed the .inputs line
1020  assert( strncmp( (char *)vTokens->pArray[0], ".input_drive", 12 ) == 0 );
1021  if ( vTokens->nSize != 4 )
1022  {
1023  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1024  sprintf( p->sError, "Wrong number of arguments on .input_drive line." );
1026  return 1;
1027  }
1028  pNet = Abc_NtkFindNet( p->pNtkCur, (char *)vTokens->pArray[1] );
1029  if ( pNet == NULL )
1030  {
1031  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1032  sprintf( p->sError, "Cannot find object corresponding to %s on .input_drive line.", (char*)vTokens->pArray[1] );
1034  return 1;
1035  }
1036  TimeRise = strtod( (char *)vTokens->pArray[2], &pFoo1 );
1037  TimeFall = strtod( (char *)vTokens->pArray[3], &pFoo2 );
1038  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
1039  {
1040  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1041  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .input_drive line.", (char*)vTokens->pArray[2], (char*)vTokens->pArray[3] );
1043  return 1;
1044  }
1045  // set the arrival time
1046  Abc_NtkTimeSetInputDrive( p->pNtkCur, Io_ReadFindCiId(p->pNtkCur, Abc_NtkObj(p->pNtkCur, Abc_ObjFanin0(pNet)->Id)), (float)TimeRise, (float)TimeFall );
1047  return 0;
1048 }
1049 
1050 /**Function*************************************************************
1051 
1052  Synopsis []
1053 
1054  Description []
1055 
1056  SideEffects []
1057 
1058  SeeAlso []
1059 
1060 ***********************************************************************/
1061 int Io_ReadFindCoId( Abc_Ntk_t * pNtk, Abc_Obj_t * pObj )
1062 {
1063  Abc_Obj_t * pTemp;
1064  int i;
1065  Abc_NtkForEachPo( pNtk, pTemp, i )
1066  if ( pTemp == pObj )
1067  return i;
1068  return -1;
1069 }
1071 {
1072  Abc_Obj_t * pNet;
1073  char * pFoo1, * pFoo2;
1074  double TimeRise, TimeFall;
1075 
1076  // make sure this is indeed the .inputs line
1077  assert( strncmp( (char *)vTokens->pArray[0], ".output_load", 12 ) == 0 );
1078  if ( vTokens->nSize != 4 )
1079  {
1080  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1081  sprintf( p->sError, "Wrong number of arguments on .output_load line." );
1083  return 1;
1084  }
1085  pNet = Abc_NtkFindNet( p->pNtkCur, (char *)vTokens->pArray[1] );
1086  if ( pNet == NULL )
1087  {
1088  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1089  sprintf( p->sError, "Cannot find object corresponding to %s on .output_load line.", (char*)vTokens->pArray[1] );
1091  return 1;
1092  }
1093  TimeRise = strtod( (char *)vTokens->pArray[2], &pFoo1 );
1094  TimeFall = strtod( (char *)vTokens->pArray[3], &pFoo2 );
1095  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
1096  {
1097  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1098  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .output_load line.", (char*)vTokens->pArray[2], (char*)vTokens->pArray[3] );
1100  return 1;
1101  }
1102  // set the arrival time
1103  Abc_NtkTimeSetOutputLoad( p->pNtkCur, Io_ReadFindCoId(p->pNtkCur, Abc_NtkObj(p->pNtkCur, Abc_ObjFanout0(pNet)->Id)), (float)TimeRise, (float)TimeFall );
1104  return 0;
1105 }
1106 
1107 /**Function*************************************************************
1108 
1109  Synopsis []
1110 
1111  Description []
1112 
1113  SideEffects []
1114 
1115  SeeAlso []
1116 
1117 ***********************************************************************/
1119 {
1120  char * pFoo1, * pFoo2;
1121  double TimeRise, TimeFall;
1122 
1123  // make sure this is indeed the .inputs line
1124  assert( strncmp( (char *)vTokens->pArray[0], ".default_input_drive", 21 ) == 0 );
1125  if ( vTokens->nSize != 3 )
1126  {
1127  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1128  sprintf( p->sError, "Wrong number of arguments on .default_input_drive line." );
1130  return 1;
1131  }
1132  TimeRise = strtod( (char *)vTokens->pArray[1], &pFoo1 );
1133  TimeFall = strtod( (char *)vTokens->pArray[2], &pFoo2 );
1134  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
1135  {
1136  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1137  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .default_input_drive line.", (char*)vTokens->pArray[1], (char*)vTokens->pArray[2] );
1139  return 1;
1140  }
1141  // set the arrival time
1142  Abc_NtkTimeSetDefaultInputDrive( p->pNtkCur, (float)TimeRise, (float)TimeFall );
1143  return 0;
1144 }
1145 
1146 /**Function*************************************************************
1147 
1148  Synopsis []
1149 
1150  Description []
1151 
1152  SideEffects []
1153 
1154  SeeAlso []
1155 
1156 ***********************************************************************/
1158 {
1159  char * pFoo1, * pFoo2;
1160  double TimeRise, TimeFall;
1161 
1162  // make sure this is indeed the .inputs line
1163  assert( strncmp( (char *)vTokens->pArray[0], ".default_output_load", 21 ) == 0 );
1164  if ( vTokens->nSize != 3 )
1165  {
1166  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1167  sprintf( p->sError, "Wrong number of arguments on .default_output_load line." );
1169  return 1;
1170  }
1171  TimeRise = strtod( (char *)vTokens->pArray[1], &pFoo1 );
1172  TimeFall = strtod( (char *)vTokens->pArray[2], &pFoo2 );
1173  if ( *pFoo1 != '\0' || *pFoo2 != '\0' )
1174  {
1175  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1176  sprintf( p->sError, "Bad value (%s %s) for rise or fall time on .default_output_load line.", (char*)vTokens->pArray[1], (char*)vTokens->pArray[2] );
1178  return 1;
1179  }
1180  // set the arrival time
1181  Abc_NtkTimeSetDefaultOutputLoad( p->pNtkCur, (float)TimeRise, (float)TimeFall );
1182  return 0;
1183 }
1184 
1185 /**Function*************************************************************
1186 
1187  Synopsis []
1188 
1189  Description []
1190 
1191  SideEffects []
1192 
1193  SeeAlso []
1194 
1195 ***********************************************************************/
1197 {
1198  char * pFoo1;
1199  double AndGateDelay;
1200 
1201  // make sure this is indeed the .inputs line
1202  assert( strncmp( (char *)vTokens->pArray[0], ".and_gate_delay", 25 ) == 0 );
1203  if ( vTokens->nSize != 2 )
1204  {
1205  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1206  sprintf( p->sError, "Wrong number of arguments (%d) on .and_gate_delay line (should be 1).", vTokens->nSize-1 );
1208  return 1;
1209  }
1210  AndGateDelay = strtod( (char *)vTokens->pArray[1], &pFoo1 );
1211  if ( *pFoo1 != '\0' )
1212  {
1213  p->LineCur = Extra_FileReaderGetLineNumber(p->pReader, 0);
1214  sprintf( p->sError, "Bad value (%s) for AND gate delay in on .and_gate_delay line line.", (char*)vTokens->pArray[1] );
1216  return 1;
1217  }
1218  // set the arrival time
1219  p->pNtkCur->AndGateDelay = (float)AndGateDelay;
1220  return 0;
1221 }
1222 
1223 /**Function*************************************************************
1224 
1225  Synopsis [Prints the error message including the file name and line number.]
1226 
1227  Description []
1228 
1229  SideEffects []
1230 
1231  SeeAlso []
1232 
1233 ***********************************************************************/
1235 {
1236  p->fError = 1;
1237  if ( p->LineCur == 0 ) // the line number is not given
1238  fprintf( p->Output, "%s: %s\n", p->pFileName, p->sError );
1239  else // print the error message with the line number
1240  fprintf( p->Output, "%s (line %d): %s\n", p->pFileName, p->LineCur, p->sError );
1241 }
1242 
1243 /**Function*************************************************************
1244 
1245  Synopsis [Gets the tokens taking into account the line breaks.]
1246 
1247  Description []
1248 
1249  SideEffects []
1250 
1251  SeeAlso []
1252 
1253 ***********************************************************************/
1255 {
1256  Vec_Ptr_t * vTokens;
1257  char * pLastToken;
1258  int i;
1259 
1260  // get rid of the old tokens
1261  if ( p->vNewTokens->nSize > 0 )
1262  {
1263  for ( i = 0; i < p->vNewTokens->nSize; i++ )
1264  ABC_FREE( p->vNewTokens->pArray[i] );
1265  p->vNewTokens->nSize = 0;
1266  }
1267 
1268  // get the new tokens
1269  vTokens = (Vec_Ptr_t *)Extra_FileReaderGetTokens(p->pReader);
1270  if ( vTokens == NULL )
1271  return vTokens;
1272 
1273  // check if there is a transfer to another line
1274  pLastToken = (char *)vTokens->pArray[vTokens->nSize - 1];
1275  if ( pLastToken[ strlen(pLastToken)-1 ] != '\\' )
1276  return vTokens;
1277 
1278  // remove the slash
1279  pLastToken[ strlen(pLastToken)-1 ] = 0;
1280  if ( pLastToken[0] == 0 )
1281  vTokens->nSize--;
1282  // load them into the new array
1283  for ( i = 0; i < vTokens->nSize; i++ )
1284  Vec_PtrPush( p->vNewTokens, Extra_UtilStrsav((char *)vTokens->pArray[i]) );
1285 
1286  // load as long as there is the line break
1287  while ( 1 )
1288  {
1289  // get the new tokens
1290  vTokens = (Vec_Ptr_t *)Extra_FileReaderGetTokens(p->pReader);
1291  if ( vTokens->nSize == 0 )
1292  return p->vNewTokens;
1293  // check if there is a transfer to another line
1294  pLastToken = (char *)vTokens->pArray[vTokens->nSize - 1];
1295  if ( pLastToken[ strlen(pLastToken)-1 ] == '\\' )
1296  {
1297  // remove the slash
1298  pLastToken[ strlen(pLastToken)-1 ] = 0;
1299  if ( pLastToken[0] == 0 )
1300  vTokens->nSize--;
1301  // load them into the new array
1302  for ( i = 0; i < vTokens->nSize; i++ )
1303  Vec_PtrPush( p->vNewTokens, Extra_UtilStrsav((char *)vTokens->pArray[i]) );
1304  continue;
1305  }
1306  // otherwise, load them and break
1307  for ( i = 0; i < vTokens->nSize; i++ )
1308  Vec_PtrPush( p->vNewTokens, Extra_UtilStrsav((char *)vTokens->pArray[i]) );
1309  break;
1310  }
1311  return p->vNewTokens;
1312 }
1313 
1314 /**Function*************************************************************
1315 
1316  Synopsis [Starts the reading data structure.]
1317 
1318  Description []
1319 
1320  SideEffects []
1321 
1322  SeeAlso []
1323 
1324 ***********************************************************************/
1325 Io_ReadBlif_t * Io_ReadBlifFile( char * pFileName )
1326 {
1327  Extra_FileReader_t * pReader;
1328  Io_ReadBlif_t * p;
1329 
1330  // start the reader
1331  pReader = Extra_FileReaderAlloc( pFileName, "#", "\n\r", " \t" );
1332 
1333  if ( pReader == NULL )
1334  return NULL;
1335 
1336  // start the reading data structure
1337  p = ABC_ALLOC( Io_ReadBlif_t, 1 );
1338  memset( p, 0, sizeof(Io_ReadBlif_t) );
1339  p->pFileName = pFileName;
1340  p->pReader = pReader;
1341  p->Output = stdout;
1342  p->vNewTokens = Vec_PtrAlloc( 100 );
1343  p->vCubes = Vec_StrAlloc( 100 );
1344  return p;
1345 }
1346 
1347 /**Function*************************************************************
1348 
1349  Synopsis [Frees the data structure.]
1350 
1351  Description []
1352 
1353  SideEffects []
1354 
1355  SeeAlso []
1356 
1357 ***********************************************************************/
1359 {
1360  Extra_FileReaderFree( p->pReader );
1361  Vec_PtrFree( p->vNewTokens );
1362  Vec_StrFree( p->vCubes );
1363  ABC_FREE( p );
1364 }
1365 
1366 
1367 /**Function*************************************************************
1368 
1369  Synopsis [Connect one box.]
1370 
1371  Description []
1372 
1373  SideEffects []
1374 
1375  SeeAlso []
1376 
1377 ***********************************************************************/
1379 {
1380  Vec_Ptr_t * pNames;
1381  Abc_Ntk_t * pNtkModel;
1382  Abc_Obj_t * pObj, * pNet;
1383  char * pName = NULL, * pActual;
1384  int i, Length, Start = -1;
1385 
1386  // get the model for this box
1387  pNames = (Vec_Ptr_t *)pBox->pData;
1388  if ( !stmm_lookup( tName2Model, (char *)Vec_PtrEntry(pNames, 0), (char **)&pNtkModel ) )
1389  {
1390  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1391  sprintf( p->sError, "Cannot find the model for subcircuit %s.", (char*)Vec_PtrEntry(pNames, 0) );
1393  return 1;
1394  }
1395 
1396  // create the fanins of the box
1397  Abc_NtkForEachPi( pNtkModel, pObj, i )
1398  pObj->pCopy = NULL;
1399  if ( Abc_NtkPiNum(pNtkModel) == 0 )
1400  Start = 1;
1401  else
1402  {
1403  Vec_PtrForEachEntryStart( char *, pNames, pName, i, 1 )
1404  {
1405  pActual = Io_ReadBlifCleanName(pName);
1406  if ( pActual == NULL )
1407  {
1408  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1409  sprintf( p->sError, "Cannot parse formal/actual name pair \"%s\".", pName );
1411  return 1;
1412  }
1413  Length = pActual - pName - 1;
1414  pName[Length] = 0;
1415  // find the PI net with this name
1416  pObj = Abc_NtkFindNet( pNtkModel, pName );
1417  if ( pObj == NULL )
1418  {
1419  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1420  sprintf( p->sError, "Cannot find formal input \"%s\" as an PI of model \"%s\".", pName, (char*)Vec_PtrEntry(pNames, 0) );
1422  return 1;
1423  }
1424  // get the PI
1425  pObj = Abc_ObjFanin0(pObj);
1426  // quit if this is not a PI net
1427  if ( !Abc_ObjIsPi(pObj) )
1428  {
1429  pName[Length] = '=';
1430  Start = i;
1431  break;
1432  }
1433  // remember the actual name in the net
1434  if ( pObj->pCopy != NULL )
1435  {
1436  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1437  sprintf( p->sError, "Formal input \"%s\" is used more than once.", pName );
1439  return 1;
1440  }
1441  pObj->pCopy = (Abc_Obj_t *)pActual;
1442  // quit if we processed all PIs
1443  if ( i == Abc_NtkPiNum(pNtkModel) )
1444  {
1445  Start = i+1;
1446  break;
1447  }
1448  }
1449  }
1450  // create the fanins of the box
1451  Abc_NtkForEachPi( pNtkModel, pObj, i )
1452  {
1453  pActual = (char *)pObj->pCopy;
1454  if ( pActual == NULL )
1455  {
1456  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1457  sprintf( p->sError, "Formal input \"%s\" of model %s is not driven.", pName, (char*)Vec_PtrEntry(pNames, 0) );
1459  return 1;
1460  }
1461  pNet = Abc_NtkFindOrCreateNet( pBox->pNtk, pActual );
1462  Abc_ObjAddFanin( pBox, pNet );
1463  }
1464  Abc_NtkForEachPi( pNtkModel, pObj, i )
1465  pObj->pCopy = NULL;
1466 
1467  // create the fanouts of the box
1468  Abc_NtkForEachPo( pNtkModel, pObj, i )
1469  pObj->pCopy = NULL;
1470  Vec_PtrForEachEntryStart( char *, pNames, pName, i, Start )
1471  {
1472  pActual = Io_ReadBlifCleanName(pName);
1473  if ( pActual == NULL )
1474  {
1475  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1476  sprintf( p->sError, "Cannot parse formal/actual name pair \"%s\".", pName );
1478  return 1;
1479  }
1480  Length = pActual - pName - 1;
1481  pName[Length] = 0;
1482  // find the PO net with this name
1483  pObj = Abc_NtkFindNet( pNtkModel, pName );
1484  if ( pObj == NULL )
1485  {
1486  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1487  sprintf( p->sError, "Cannot find formal output \"%s\" as an PO of model \"%s\".", pName, (char*)Vec_PtrEntry(pNames, 0) );
1489  return 1;
1490  }
1491  // get the PO
1492  pObj = Abc_ObjFanout0(pObj);
1493  if ( pObj->pCopy != NULL )
1494  {
1495  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1496  sprintf( p->sError, "Formal output \"%s\" is used more than once.", pName );
1498  return 1;
1499  }
1500  pObj->pCopy = (Abc_Obj_t *)pActual;
1501  }
1502  // create the fanouts of the box
1503  Abc_NtkForEachPo( pNtkModel, pObj, i )
1504  {
1505  pActual = (char *)pObj->pCopy;
1506  if ( pActual == NULL )
1507  {
1508  p->LineCur = (int)(ABC_PTRINT_T)pBox->pCopy;
1509  sprintf( p->sError, "Formal output \"%s\" of model %s is not driven.", pName, (char*)Vec_PtrEntry(pNames, 0) );
1511  return 1;
1512  }
1513  pNet = Abc_NtkFindOrCreateNet( pBox->pNtk, pActual );
1514  Abc_ObjAddFanin( pNet, pBox );
1515  }
1516  Abc_NtkForEachPo( pNtkModel, pObj, i )
1517  pObj->pCopy = NULL;
1518 
1519  // remove the array of names, assign the pointer to the model
1520  Vec_PtrForEachEntry( char *, (Vec_Ptr_t *)pBox->pData, pName, i )
1521  ABC_FREE( pName );
1522  Vec_PtrFree( (Vec_Ptr_t *)pBox->pData );
1523  pBox->pData = pNtkModel;
1524  return 0;
1525 }
1526 
1527 /**Function*************************************************************
1528 
1529  Synopsis [Connect the boxes in the hierarchy of networks.]
1530 
1531  Description []
1532 
1533  SideEffects []
1534 
1535  SeeAlso []
1536 
1537 ***********************************************************************/
1539 {
1540  Abc_Obj_t * pBox;
1541  int i;
1542  // go through the boxes
1543  Abc_NtkForEachBlackbox( pNtk, pBox, i )
1544  if ( Io_ReadBlifNetworkConnectBoxesOneBox( p, pBox, tName2Model ) )
1545  return 1;
1546  Abc_NtkFinalizeRead( pNtk );
1547  return 0;
1548 }
1549 
1550 #if 0
1551 
1552 /**Function*************************************************************
1553 
1554  Synopsis [Connect the boxes in the hierarchy of networks.]
1555 
1556  Description []
1557 
1558  SideEffects []
1559 
1560  SeeAlso []
1561 
1562 ***********************************************************************/
1564 {
1565  stmm_generator * gen;
1566  Abc_Ntk_t * pNtk;
1567  char * pName;
1568  // connect the master network
1569  if ( Io_ReadBlifNetworkConnectBoxesOne( p, pNtkMaster, pNtkMaster->tName2Model ) )
1570  return 1;
1571  // connect other networks
1572  stmm_foreach_item( pNtkMaster->tName2Model, gen, &pName, (char **)&pNtk )
1573  if ( Io_ReadBlifNetworkConnectBoxesOne( p, pNtk, pNtkMaster->tName2Model ) )
1574  return 1;
1575  return 0;
1576 }
1577 
1578 #endif
1579 
1580 ////////////////////////////////////////////////////////////////////////
1581 /// END OF FILE ///
1582 ////////////////////////////////////////////////////////////////////////
1583 
1584 
1586 
char * memset()
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition: mioApi.c:99
static Io_ReadBlif_t * Io_ReadBlifFile(char *pFileName)
Definition: ioReadBlif.c:1325
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
FILE * Output
Definition: ioReadBlif.c:47
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
static int Io_ReadBlifNetworkOutputLoad(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:1070
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Abc_Ntk_t * pExdc
Definition: abc.h:201
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
Definition: mioApi.c:147
int Extra_FileReaderGetLineNumber(Extra_FileReader_t *p, int iToken)
ABC_DLL void Abc_NtkTimeSetArrival(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition: abcTiming.c:185
int Io_ReadFindCoId(Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
Definition: ioReadBlif.c:1061
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static Vec_Ptr_t * Io_ReadBlifGetTokens(Io_ReadBlif_t *p)
Definition: ioReadBlif.c:1254
char * Mio_GateReadOutName(Mio_Gate_t *pGate)
Definition: mioApi.c:144
ABC_DLL void Abc_NtkTimeSetDefaultArrival(Abc_Ntk_t *pNtk, float Rise, float Fall)
Definition: abcTiming.c:155
char * Mio_PinReadName(Mio_Pin_t *pPin)
Definition: mioApi.c:170
static int Abc_ObjIsPi(Abc_Obj_t *pObj)
Definition: abc.h:347
int Io_ReadFindCiId(Abc_Ntk_t *pNtk, Abc_Obj_t *pObj)
Definition: ioReadBlif.c:1004
void Extra_FileReaderFree(Extra_FileReader_t *p)
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
Vec_Ptr_t * vTokens
Definition: ioReadBlif.c:43
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static int Io_ReadBlifNetworkAndGateDelay(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:1196
ABC_DLL void Abc_NtkFinalizeRead(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:360
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
Definition: mioApi.c:179
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
static void Abc_LatchSetInitDc(Abc_Obj_t *pLatch)
Definition: abc.h:420
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
Extra_FileReader_t * Extra_FileReaderAlloc(char *pFileName, char *pCharsComment, char *pCharsStop, char *pCharsClean)
FUNCTION DEFINITIONS ///.
char sError[1000]
Definition: ioReadBlif.c:48
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static void Abc_ObjSetData(Abc_Obj_t *pObj, void *pData)
Definition: abc.h:343
static int Io_ReadBlifNetworkDefaultOutputLoad(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:1157
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
int strcmp()
static int Io_ReadBlifNetworkLatch(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:375
Abc_Ntk_t * Io_ReadBlif(char *pFileName, int fCheck)
FUNCTION DEFINITIONS ///.
Definition: ioReadBlif.c:92
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
Definition: mioApi.c:151
static char * Io_ReadBlifCleanName(char *pName)
Definition: ioReadBlif.c:808
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
static void Io_ReadBlifFree(Io_ReadBlif_t *p)
Definition: ioReadBlif.c:1358
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
static int Io_ReadBlifNetworkNames(Io_ReadBlif_t *p, Vec_Ptr_t **pvTokens)
Definition: ioReadBlif.c:423
DECLARATIONS ///.
Vec_Str_t * vCubes
Definition: ioReadBlif.c:45
Abc_Obj_t * Io_ReadCreatePi(Abc_Ntk_t *pNtk, char *pName)
Definition: ioUtil.c:610
Abc_Obj_t * pCopy
Definition: abc.h:148
char Char
Definition: bzlib_private.h:43
static int Io_ReadBlifNetworkOutputRequired(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:877
int stmm_lookup(stmm_table *table, char *key, char **value)
Definition: stmm.c:134
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static void Io_ReadBlifPrintErrorMessage(Io_ReadBlif_t *p)
Definition: ioReadBlif.c:1234
ABC_DLL int Abc_NtkCheckRead(Abc_Ntk_t *pNtk)
Definition: abcCheck.c:77
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
Definition: abc.h:509
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
ABC_DLL Abc_Obj_t * Abc_NtkFindNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:507
if(last==0)
Definition: sparse_int.h:34
static int Io_ReadBlifNetworkInputs(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:337
ABC_DLL void Abc_NtkTimeInitialize(Abc_Ntk_t *pNtk, Abc_Ntk_t *pNtkOld)
Definition: abcTiming.c:321
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
char * sprintf()
static int Io_ReadBlifNetworkSubcircuit(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:766
static Abc_Obj_t * Abc_NtkCreateBlackbox(Abc_Ntk_t *pNtk)
Definition: abc.h:311
ABC_DLL void Abc_NtkTimeSetDefaultRequired(Abc_Ntk_t *pNtk, float Rise, float Fall)
Definition: abcTiming.c:164
static Abc_Ntk_t * Io_ReadBlifNetwork(Io_ReadBlif_t *p)
Definition: ioReadBlif.c:134
void Extra_ProgressBarStop(ProgressBar *p)
char * pFileName
Definition: ioReadBlif.c:36
ABC_DLL Abc_Obj_t * Abc_NtkFindOrCreateNet(Abc_Ntk_t *pNtk, char *pName)
Definition: abcObj.c:579
int Io_ReadBlifNetworkConnectBoxesOneBox(Io_ReadBlif_t *p, Abc_Obj_t *pBox, stmm_table *tName2Model)
Definition: ioReadBlif.c:1378
typedefABC_NAMESPACE_IMPL_START struct Io_ReadBlif_t_ Io_ReadBlif_t
DECLARATIONS ///.
Definition: ioReadBlif.c:32
Abc_Obj_t * Io_ReadCreateLatch(Abc_Ntk_t *pNtk, char *pNetLI, char *pNetLO)
Definition: ioUtil.c:660
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
Extra_FileReader_t * pReader
Definition: ioReadBlif.c:37
#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
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
Definition: mioApi.c:150
int Io_ReadBlifReorderFormalNames(Vec_Ptr_t *vTokens, Mio_Gate_t *pGate, Mio_Gate_t *pTwin)
Definition: ioReadBlif.c:540
Abc_Ntk_t * pNtk
Definition: abc.h:130
void * Extra_FileReaderGetTokens(Extra_FileReader_t *p)
static int Io_ReadBlifNetworkDefaultInputDrive(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:1118
static int Io_ReadBlifNetworkInputDrive(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:1013
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
ABC_DLL void Abc_NtkTimeSetRequired(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition: abcTiming.c:200
Abc_NtkFunc_t ntkFunc
Definition: abc.h:157
Vec_Ptr_t * vNewTokens
Definition: ioReadBlif.c:44
int Extra_FileReaderGetFileSize(Extra_FileReader_t *p)
static int Io_ReadBlifNetworkGate(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:659
#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
Abc_Ntk_t * pNtkCur
Definition: ioReadBlif.c:40
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
static int Io_ReadBlifNetworkConnectBoxes(Io_ReadBlif_t *p, Abc_Ntk_t *pNtkMaster)
int strncmp()
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition: abcSop.c:536
static int Io_ReadBlifNetworkDefaultOutputRequired(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:964
Abc_Obj_t * Io_ReadCreateNode(Abc_Ntk_t *pNtk, char *pNameOut, char *pNamesIn[], int nInputs)
Definition: ioUtil.c:725
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
static void * Abc_ObjData(Abc_Obj_t *pObj)
Definition: abc.h:336
int strlen()
ABC_DLL void Abc_NtkTimeSetDefaultOutputLoad(Abc_Ntk_t *pNtk, float Rise, float Fall)
Definition: abcTiming.c:243
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
Abc_Ntk_t * pNtkMaster
Definition: ioReadBlif.c:39
void * pData
Definition: abc.h:145
static Abc_Ntk_t * Io_ReadBlifNetworkOne(Io_ReadBlif_t *p)
Definition: ioReadBlif.c:216
#define stmm_foreach_item(table, gen, key, value)
Definition: stmm.h:121
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static Abc_Obj_t * Abc_ObjFanout(Abc_Obj_t *pObj, int i)
Definition: abc.h:370
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Abc_Obj_t * Io_ReadCreatePo(Abc_Ntk_t *pNtk, char *pName)
Definition: ioUtil.c:635
static void Vec_PtrShrink(Vec_Ptr_t *p, int nSizeNew)
Definition: vecPtr.h:528
static int Io_ReadBlifNetworkDefaultInputArrival(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:925
int Io_ReadBlifNetworkConnectBoxesOne(Io_ReadBlif_t *p, Abc_Ntk_t *pNtk, stmm_table *tName2Model)
Definition: ioReadBlif.c:1538
static void Abc_LatchSetInit0(Abc_Obj_t *pLatch)
Definition: abc.h:418
ABC_DLL void Abc_NtkTimeSetInputDrive(Abc_Ntk_t *pNtk, int PiNum, float Rise, float Fall)
Definition: abcTiming.c:271
ABC_DLL void Abc_NtkTimeSetOutputLoad(Abc_Ntk_t *pNtk, int PoNum, float Rise, float Fall)
Definition: abcTiming.c:290
char * pName
Definition: abc.h:158
static int Io_ReadBlifNetworkOutputs(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:356
static int Io_ReadBlifNetworkInputArrival(Io_ReadBlif_t *p, Vec_Ptr_t *vTokens)
Definition: ioReadBlif.c:829
Abc_NtkType_t ntkType
Definition: abc.h:156
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
ABC_DLL void Abc_NtkTimeSetDefaultInputDrive(Abc_Ntk_t *pNtk, float Rise, float Fall)
Definition: abcTiming.c:227
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition: abc.h:513
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
int Extra_FileReaderGetCurPosition(Extra_FileReader_t *p)