abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
amapParse.c File Reference
#include "amapInt.h"
#include "aig/hop/hop.h"
#include "bool/kit/kit.h"

Go to the source code of this file.

Macros

#define AMAP_EQN_SYM_OPEN   '('
 DECLARATIONS ///. More...
 
#define AMAP_EQN_SYM_CLOSE   ')'
 
#define AMAP_EQN_SYM_CONST0   '0'
 
#define AMAP_EQN_SYM_CONST1   '1'
 
#define AMAP_EQN_SYM_NEG   '!'
 
#define AMAP_EQN_SYM_NEGAFT   '\''
 
#define AMAP_EQN_SYM_AND   '*'
 
#define AMAP_EQN_SYM_AND2   '&'
 
#define AMAP_EQN_SYM_XOR   '^'
 
#define AMAP_EQN_SYM_OR   '+'
 
#define AMAP_EQN_SYM_OR2   '|'
 
#define AMAP_EQN_OPER_NEG   10
 
#define AMAP_EQN_OPER_AND   9
 
#define AMAP_EQN_OPER_XOR   8
 
#define AMAP_EQN_OPER_OR   7
 
#define AMAP_EQN_OPER_MARK   1
 
#define AMAP_EQN_FLAG_START   1
 
#define AMAP_EQN_FLAG_VAR   2
 
#define AMAP_EQN_FLAG_OPER   3
 
#define AMAP_EQN_FLAG_ERROR   4
 

Functions

Hop_Obj_tAmap_ParseFormulaOper (Hop_Man_t *pMan, Vec_Ptr_t *pStackFn, int Oper)
 FUNCTION DEFINITIONS ///. More...
 
Hop_Obj_tAmap_ParseFormula (FILE *pOutput, char *pFormInit, Vec_Ptr_t *vVarNames, Hop_Man_t *pMan)
 
int Amap_LibParseEquations (Amap_Lib_t *p, int fVerbose)
 
void Amap_LibParseTest (char *pFileName)
 

Macro Definition Documentation

#define AMAP_EQN_FLAG_ERROR   4

Definition at line 56 of file amapParse.c.

#define AMAP_EQN_FLAG_OPER   3

Definition at line 55 of file amapParse.c.

#define AMAP_EQN_FLAG_START   1

Definition at line 53 of file amapParse.c.

#define AMAP_EQN_FLAG_VAR   2

Definition at line 54 of file amapParse.c.

#define AMAP_EQN_OPER_AND   9

Definition at line 47 of file amapParse.c.

#define AMAP_EQN_OPER_MARK   1

Definition at line 50 of file amapParse.c.

#define AMAP_EQN_OPER_NEG   10

Definition at line 46 of file amapParse.c.

#define AMAP_EQN_OPER_OR   7

Definition at line 49 of file amapParse.c.

#define AMAP_EQN_OPER_XOR   8

Definition at line 48 of file amapParse.c.

#define AMAP_EQN_SYM_AND   '*'

Definition at line 39 of file amapParse.c.

#define AMAP_EQN_SYM_AND2   '&'

Definition at line 40 of file amapParse.c.

#define AMAP_EQN_SYM_CLOSE   ')'

Definition at line 34 of file amapParse.c.

#define AMAP_EQN_SYM_CONST0   '0'

Definition at line 35 of file amapParse.c.

#define AMAP_EQN_SYM_CONST1   '1'

Definition at line 36 of file amapParse.c.

#define AMAP_EQN_SYM_NEG   '!'

Definition at line 37 of file amapParse.c.

#define AMAP_EQN_SYM_NEGAFT   '\''

Definition at line 38 of file amapParse.c.

#define AMAP_EQN_SYM_OPEN   '('

DECLARATIONS ///.

CFile****************************************************************

FileName [amapParse.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Technology mapper for standard cells.]

Synopsis [Parses representations of gates.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
amapParse.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 33 of file amapParse.c.

#define AMAP_EQN_SYM_OR   '+'

Definition at line 42 of file amapParse.c.

#define AMAP_EQN_SYM_OR2   '|'

Definition at line 43 of file amapParse.c.

#define AMAP_EQN_SYM_XOR   '^'

Definition at line 41 of file amapParse.c.

Function Documentation

int Amap_LibParseEquations ( Amap_Lib_t p,
int  fVerbose 
)

Function*************************************************************

Synopsis [Parses equations for the gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 392 of file amapParse.c.

393 {
394 // extern int Kit_TruthSupportSize( unsigned * pTruth, int nVars );
395  Hop_Man_t * pMan;
396  Hop_Obj_t * pObj;
397  Vec_Ptr_t * vNames;
398  Vec_Int_t * vTruth;
399  Amap_Gat_t * pGate;
400  Amap_Pin_t * pPin;
401  unsigned * pTruth;
402  int i, nPinMax;
403  nPinMax = Amap_LibNumPinsMax(p);
404  if ( nPinMax > AMAP_MAXINS )
405  printf( "Gates with more than %d inputs will be ignored.\n", AMAP_MAXINS );
406  vTruth = Vec_IntAlloc( 1 << 16 );
407  vNames = Vec_PtrAlloc( 100 );
408  pMan = Hop_ManStart();
409  Hop_IthVar( pMan, nPinMax - 1 );
410  Vec_PtrForEachEntry( Amap_Gat_t *, p->vGates, pGate, i )
411  {
412  if ( pGate->nPins == 0 )
413  {
414  pGate->pFunc = (unsigned *)Aig_MmFlexEntryFetch( p->pMemGates, 4 );
415  if ( strcmp( pGate->pForm, AMAP_STRING_CONST0 ) == 0 )
416  pGate->pFunc[0] = 0;
417  else if ( strcmp( pGate->pForm, AMAP_STRING_CONST1 ) == 0 )
418  pGate->pFunc[0] = ~0;
419  else
420  {
421  printf( "Cannot parse formula \"%s\" of gate \"%s\" with no pins.\n", pGate->pForm, pGate->pName );
422  break;
423  }
424  continue;
425  }
426  if ( pGate->nPins > AMAP_MAXINS )
427  continue;
428  Vec_PtrClear( vNames );
429  Amap_GateForEachPin( pGate, pPin )
430  Vec_PtrPush( vNames, pPin->pName );
431  pObj = Amap_ParseFormula( stdout, pGate->pForm, vNames, pMan );
432  if ( pObj == NULL )
433  break;
434  pTruth = Hop_ManConvertAigToTruth( pMan, pObj, pGate->nPins, vTruth, 0 );
435  if ( Kit_TruthSupportSize(pTruth, pGate->nPins) < (int)pGate->nPins )
436  {
437  if ( fVerbose )
438  printf( "Skipping gate \"%s\" because its output \"%s\" does not depend on all input variables.\n", pGate->pName, pGate->pForm );
439  continue;
440  }
441  pGate->pFunc = (unsigned *)Aig_MmFlexEntryFetch( p->pMemGates, sizeof(unsigned)*Abc_TruthWordNum(pGate->nPins) );
442  memcpy( pGate->pFunc, pTruth, sizeof(unsigned)*Abc_TruthWordNum(pGate->nPins) );
443  }
444  Vec_PtrFree( vNames );
445  Vec_IntFree( vTruth );
446  Hop_ManStop( pMan );
447  return i == Vec_PtrSize(p->vGates);
448 }
int Amap_LibNumPinsMax(Amap_Lib_t *p)
Definition: amapLib.c:103
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
char * pForm
Definition: amapInt.h:157
#define Amap_GateForEachPin(pGate, pPin)
Definition: amapInt.h:296
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
char * Aig_MmFlexEntryFetch(Aig_MmFlex_t *p, int nBytes)
Definition: aigMem.c:366
char * memcpy()
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Abc_TruthWordNum(int nVars)
Definition: abc_global.h:256
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Definition: hop.h:65
void Hop_ManStop(Hop_Man_t *p)
Definition: hopMan.c:84
#define AMAP_STRING_CONST0
Definition: amapInt.h:46
int strcmp()
Hop_Obj_t * Amap_ParseFormula(FILE *pOutput, char *pFormInit, Vec_Ptr_t *vVarNames, Hop_Man_t *pMan)
Definition: amapParse.c:106
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define AMAP_STRING_CONST1
Definition: amapInt.h:47
#define AMAP_MAXINS
INCLUDES ///.
Definition: amapInt.h:44
if(last==0)
Definition: sparse_int.h:34
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition: hopMan.c:45
unsigned * pFunc
Definition: amapInt.h:158
unsigned nPins
Definition: amapInt.h:161
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
unsigned * Hop_ManConvertAigToTruth(Hop_Man_t *p, Hop_Obj_t *pRoot, int nVars, Vec_Int_t *vTruth, int fMsbFirst)
Definition: hopTruth.c:143
static void Vec_PtrClear(Vec_Ptr_t *p)
Definition: vecPtr.h:545
char * pName
Definition: amapInt.h:154
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
int Kit_TruthSupportSize(unsigned *pTruth, int nVars)
Definition: kitTruth.c:327
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Amap_LibParseTest ( char *  pFileName)

Function*************************************************************

Synopsis [Parses equations for the gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 461 of file amapParse.c.

462 {
463  int fVerbose = 0;
464  Amap_Lib_t * p;
465  abctime clk = Abc_Clock();
466  p = Amap_LibReadFile( pFileName, fVerbose );
467  if ( p == NULL )
468  return;
469  Amap_LibParseEquations( p, fVerbose );
470  Amap_LibFree( p );
471  ABC_PRT( "Total time", Abc_Clock() - clk );
472 }
Amap_Lib_t * Amap_LibReadFile(char *pFileName, int fVerbose)
Definition: amapRead.c:473
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static abctime Abc_Clock()
Definition: abc_global.h:279
void Amap_LibFree(Amap_Lib_t *p)
Definition: amapLib.c:67
typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t
INCLUDES ///.
Definition: amap.h:42
#define ABC_PRT(a, t)
Definition: abc_global.h:220
int Amap_LibParseEquations(Amap_Lib_t *p, int fVerbose)
Definition: amapParse.c:392
ABC_INT64_T abctime
Definition: abc_global.h:278
Hop_Obj_t* Amap_ParseFormula ( FILE *  pOutput,
char *  pFormInit,
Vec_Ptr_t vVarNames,
Hop_Man_t pMan 
)

Function*************************************************************

Synopsis [Derives the AIG corresponding to the equation.]

Description [Takes the stream to output messages, the formula, the vector of variable names and the AIG manager.]

SideEffects []

SeeAlso []

Definition at line 106 of file amapParse.c.

107 {
108  char * pFormula;
109  Vec_Ptr_t * pStackFn;
110  Vec_Int_t * pStackOp;
111  Hop_Obj_t * gFunc;
112  char * pTemp, * pName;
113  int nParans, fFound, Flag;
114  int Oper, Oper1, Oper2;
115  int i, v;
116 
117  // make sure that the number of opening and closing parantheses is the same
118  nParans = 0;
119  for ( pTemp = pFormInit; *pTemp; pTemp++ )
120  if ( *pTemp == '(' )
121  nParans++;
122  else if ( *pTemp == ')' )
123  nParans--;
124  if ( nParans != 0 )
125  {
126  fprintf( pOutput, "Amap_ParseFormula(): Different number of opening and closing parantheses ().\n" );
127  return NULL;
128  }
129 
130  // copy the formula
131  pFormula = ABC_ALLOC( char, strlen(pFormInit) + 3 );
132  sprintf( pFormula, "(%s)", pFormInit );
133 
134  // start the stacks
135  pStackFn = Vec_PtrAlloc( 100 );
136  pStackOp = Vec_IntAlloc( 100 );
137 
138  Flag = AMAP_EQN_FLAG_START;
139  for ( pTemp = pFormula; *pTemp; pTemp++ )
140  {
141  switch ( *pTemp )
142  {
143  // skip all spaces, tabs, and end-of-lines
144  case ' ':
145  case '\t':
146  case '\r':
147  case '\n':
148  continue;
149  case AMAP_EQN_SYM_CONST0:
150  Vec_PtrPush( pStackFn, Hop_ManConst0(pMan) ); // Cudd_Ref( b0 );
151  if ( Flag == AMAP_EQN_FLAG_VAR )
152  {
153  fprintf( pOutput, "Amap_ParseFormula(): No operation symbol before constant 0.\n" );
154  Flag = AMAP_EQN_FLAG_ERROR;
155  break;
156  }
157  Flag = AMAP_EQN_FLAG_VAR;
158  break;
159  case AMAP_EQN_SYM_CONST1:
160  Vec_PtrPush( pStackFn, Hop_ManConst1(pMan) ); // Cudd_Ref( b1 );
161  if ( Flag == AMAP_EQN_FLAG_VAR )
162  {
163  fprintf( pOutput, "Amap_ParseFormula(): No operation symbol before constant 1.\n" );
164  Flag = AMAP_EQN_FLAG_ERROR;
165  break;
166  }
167  Flag = AMAP_EQN_FLAG_VAR;
168  break;
169  case AMAP_EQN_SYM_NEG:
170  if ( Flag == AMAP_EQN_FLAG_VAR )
171  {// if NEGBEF follows a variable, AND is assumed
172  Vec_IntPush( pStackOp, AMAP_EQN_OPER_AND );
173  Flag = AMAP_EQN_FLAG_OPER;
174  }
175  Vec_IntPush( pStackOp, AMAP_EQN_OPER_NEG );
176  break;
177  case AMAP_EQN_SYM_NEGAFT:
178  if ( Flag != AMAP_EQN_FLAG_VAR )
179  {// if there is no variable before NEGAFT, it is an error
180  fprintf( pOutput, "Amap_ParseFormula(): No variable is specified before the negation suffix.\n" );
181  Flag = AMAP_EQN_FLAG_ERROR;
182  break;
183  }
184  else // if ( Flag == PARSE_FLAG_VAR )
185  Vec_PtrPush( pStackFn, Hop_Not( (Hop_Obj_t *)Vec_PtrPop(pStackFn) ) );
186  break;
187  case AMAP_EQN_SYM_AND:
188  case AMAP_EQN_SYM_AND2:
189  case AMAP_EQN_SYM_OR:
190  case AMAP_EQN_SYM_OR2:
191  case AMAP_EQN_SYM_XOR:
192  if ( Flag != AMAP_EQN_FLAG_VAR )
193  {
194  fprintf( pOutput, "Amap_ParseFormula(): There is no variable before AND, EXOR, or OR.\n" );
195  Flag = AMAP_EQN_FLAG_ERROR;
196  break;
197  }
198  if ( *pTemp == AMAP_EQN_SYM_AND || *pTemp == AMAP_EQN_SYM_AND2 )
199  Vec_IntPush( pStackOp, AMAP_EQN_OPER_AND );
200  else if ( *pTemp == AMAP_EQN_SYM_OR || *pTemp == AMAP_EQN_SYM_OR2 )
201  Vec_IntPush( pStackOp, AMAP_EQN_OPER_OR );
202  else //if ( *pTemp == AMAP_EQN_SYM_XOR )
203  Vec_IntPush( pStackOp, AMAP_EQN_OPER_XOR );
204  Flag = AMAP_EQN_FLAG_OPER;
205  break;
206  case AMAP_EQN_SYM_OPEN:
207  if ( Flag == AMAP_EQN_FLAG_VAR )
208  {
209  Vec_IntPush( pStackOp, AMAP_EQN_OPER_AND );
210 // fprintf( pOutput, "Amap_ParseFormula(): An opening paranthesis follows a var without operation sign.\n" );
211 // Flag = AMAP_EQN_FLAG_ERROR;
212 // break;
213  }
214  Vec_IntPush( pStackOp, AMAP_EQN_OPER_MARK );
215  // after an opening bracket, it feels like starting over again
216  Flag = AMAP_EQN_FLAG_START;
217  break;
218  case AMAP_EQN_SYM_CLOSE:
219  if ( Vec_IntSize( pStackOp ) != 0 )
220  {
221  while ( 1 )
222  {
223  if ( Vec_IntSize( pStackOp ) == 0 )
224  {
225  fprintf( pOutput, "Amap_ParseFormula(): There is no opening paranthesis\n" );
226  Flag = AMAP_EQN_FLAG_ERROR;
227  break;
228  }
229  Oper = Vec_IntPop( pStackOp );
230  if ( Oper == AMAP_EQN_OPER_MARK )
231  break;
232 
233  // perform the given operation
234  if ( Amap_ParseFormulaOper( pMan, pStackFn, Oper ) == NULL )
235  {
236  fprintf( pOutput, "Amap_ParseFormula(): Unknown operation\n" );
237  ABC_FREE( pFormula );
238  Vec_PtrFreeP( &pStackFn );
239  Vec_IntFreeP( &pStackOp );
240  return NULL;
241  }
242  }
243  }
244  else
245  {
246  fprintf( pOutput, "Amap_ParseFormula(): There is no opening paranthesis\n" );
247  Flag = AMAP_EQN_FLAG_ERROR;
248  break;
249  }
250  if ( Flag != AMAP_EQN_FLAG_ERROR )
251  Flag = AMAP_EQN_FLAG_VAR;
252  break;
253 
254 
255  default:
256  // scan the next name
257  for ( i = 0; pTemp[i] &&
258  pTemp[i] != ' ' && pTemp[i] != '\t' && pTemp[i] != '\r' && pTemp[i] != '\n' &&
259  pTemp[i] != AMAP_EQN_SYM_AND && pTemp[i] != AMAP_EQN_SYM_AND2 && pTemp[i] != AMAP_EQN_SYM_OR && pTemp[i] != AMAP_EQN_SYM_OR2 &&
260  pTemp[i] != AMAP_EQN_SYM_XOR && pTemp[i] != AMAP_EQN_SYM_NEGAFT && pTemp[i] != AMAP_EQN_SYM_CLOSE;
261  i++ )
262  {
263  if ( pTemp[i] == AMAP_EQN_SYM_NEG || pTemp[i] == AMAP_EQN_SYM_OPEN )
264  {
265  fprintf( pOutput, "Amap_ParseFormula(): The negation sign or an opening paranthesis inside the variable name.\n" );
266  Flag = AMAP_EQN_FLAG_ERROR;
267  break;
268  }
269  }
270  // variable name is found
271  fFound = 0;
272  Vec_PtrForEachEntry( char *, vVarNames, pName, v )
273  if ( strncmp(pTemp, pName, i) == 0 && strlen(pName) == (unsigned)i )
274  {
275  pTemp += i-1;
276  fFound = 1;
277  break;
278  }
279  if ( !fFound )
280  {
281  fprintf( pOutput, "Amap_ParseFormula(): The parser cannot find var \"%s\" in the input var list.\n", pTemp );
282  Flag = AMAP_EQN_FLAG_ERROR;
283  break;
284  }
285 /*
286  if ( Flag == AMAP_EQN_FLAG_VAR )
287  {
288  fprintf( pOutput, "Amap_ParseFormula(): The variable name \"%s\" follows another var without operation sign.\n", pTemp );
289  Flag = AMAP_EQN_FLAG_ERROR;
290  break;
291  }
292 */
293  if ( Flag == AMAP_EQN_FLAG_VAR )
294  Vec_IntPush( pStackOp, AMAP_EQN_OPER_AND );
295 
296  Vec_PtrPush( pStackFn, Hop_IthVar( pMan, v ) ); // Cudd_Ref( pbVars[v] );
297  Flag = AMAP_EQN_FLAG_VAR;
298  break;
299  }
300 
301  if ( Flag == AMAP_EQN_FLAG_ERROR )
302  break; // error exit
303  else if ( Flag == AMAP_EQN_FLAG_START )
304  continue; // go on parsing
305  else if ( Flag == AMAP_EQN_FLAG_VAR )
306  while ( 1 )
307  { // check if there are negations in the OpStack
308  if ( Vec_IntSize( pStackOp ) == 0 )
309  break;
310  Oper = Vec_IntPop( pStackOp );
311  if ( Oper != AMAP_EQN_OPER_NEG )
312  {
313  Vec_IntPush( pStackOp, Oper );
314  break;
315  }
316  else
317  {
318  Vec_PtrPush( pStackFn, Hop_Not((Hop_Obj_t *)Vec_PtrPop(pStackFn)) );
319  }
320  }
321  else // if ( Flag == AMAP_EQN_FLAG_OPER )
322  while ( 1 )
323  { // execute all the operations in the OpStack
324  // with precedence higher or equal than the last one
325  Oper1 = Vec_IntPop( pStackOp ); // the last operation
326  if ( Vec_IntSize( pStackOp ) == 0 )
327  { // if it is the only operation, push it back
328  Vec_IntPush( pStackOp, Oper1 );
329  break;
330  }
331  Oper2 = Vec_IntPop( pStackOp ); // the operation before the last one
332  if ( Oper2 >= Oper1 )
333  { // if Oper2 precedence is higher or equal, execute it
334  if ( Amap_ParseFormulaOper( pMan, pStackFn, Oper2 ) == NULL )
335  {
336  fprintf( pOutput, "Amap_ParseFormula(): Unknown operation\n" );
337  ABC_FREE( pFormula );
338  Vec_PtrFreeP( &pStackFn );
339  Vec_IntFreeP( &pStackOp );
340  return NULL;
341  }
342  Vec_IntPush( pStackOp, Oper1 ); // push the last operation back
343  }
344  else
345  { // if Oper2 precedence is lower, push them back and done
346  Vec_IntPush( pStackOp, Oper2 );
347  Vec_IntPush( pStackOp, Oper1 );
348  break;
349  }
350  }
351  }
352 
353  if ( Flag != AMAP_EQN_FLAG_ERROR )
354  {
355  if ( Vec_PtrSize(pStackFn) != 0 )
356  {
357  gFunc = (Hop_Obj_t *)Vec_PtrPop(pStackFn);
358  if ( Vec_PtrSize(pStackFn) == 0 )
359  if ( Vec_IntSize( pStackOp ) == 0 )
360  {
361 // Cudd_Deref( gFunc );
362  ABC_FREE( pFormula );
363  Vec_PtrFreeP( &pStackFn );
364  Vec_IntFreeP( &pStackOp );
365  return gFunc;
366  }
367  else
368  fprintf( pOutput, "Amap_ParseFormula(): Something is left in the operation stack\n" );
369  else
370  fprintf( pOutput, "Amap_ParseFormula(): Something is left in the function stack\n" );
371  }
372  else
373  fprintf( pOutput, "Amap_ParseFormula(): The input string is empty\n" );
374  }
375  ABC_FREE( pFormula );
376  Vec_PtrFreeP( &pStackFn );
377  Vec_IntFreeP( &pStackOp );
378  return NULL;
379 }
#define AMAP_EQN_SYM_OPEN
DECLARATIONS ///.
Definition: amapParse.c:33
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define AMAP_EQN_FLAG_VAR
Definition: amapParse.c:54
#define AMAP_EQN_SYM_NEG
Definition: amapParse.c:37
#define AMAP_EQN_SYM_AND2
Definition: amapParse.c:40
static Hop_Obj_t * Hop_ManConst1(Hop_Man_t *p)
Definition: hop.h:132
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
#define AMAP_EQN_OPER_OR
Definition: amapParse.c:49
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 int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
static Hop_Obj_t * Hop_Not(Hop_Obj_t *p)
Definition: hop.h:127
Definition: hop.h:65
Hop_Obj_t * Amap_ParseFormulaOper(Hop_Man_t *pMan, Vec_Ptr_t *pStackFn, int Oper)
FUNCTION DEFINITIONS ///.
Definition: amapParse.c:73
#define AMAP_EQN_FLAG_ERROR
Definition: amapParse.c:56
#define AMAP_EQN_SYM_OR
Definition: amapParse.c:42
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
#define AMAP_EQN_OPER_NEG
Definition: amapParse.c:46
#define AMAP_EQN_FLAG_OPER
Definition: amapParse.c:55
#define AMAP_EQN_SYM_CONST1
Definition: amapParse.c:36
#define AMAP_EQN_SYM_AND
Definition: amapParse.c:39
#define AMAP_EQN_OPER_MARK
Definition: amapParse.c:50
if(last==0)
Definition: sparse_int.h:34
#define AMAP_EQN_FLAG_START
Definition: amapParse.c:53
static int Vec_IntPop(Vec_Int_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
char * sprintf()
#define AMAP_EQN_SYM_NEGAFT
Definition: amapParse.c:38
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define AMAP_EQN_SYM_XOR
Definition: amapParse.c:41
#define AMAP_EQN_OPER_AND
Definition: amapParse.c:47
#define AMAP_EQN_SYM_OR2
Definition: amapParse.c:43
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define AMAP_EQN_SYM_CONST0
Definition: amapParse.c:35
#define ABC_FREE(obj)
Definition: abc_global.h:232
int strncmp()
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
int strlen()
static Hop_Obj_t * Hop_ManConst0(Hop_Man_t *p)
Definition: hop.h:131
#define AMAP_EQN_SYM_CLOSE
Definition: amapParse.c:34
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
#define AMAP_EQN_OPER_XOR
Definition: amapParse.c:48
Hop_Obj_t * Hop_IthVar(Hop_Man_t *p, int i)
FUNCTION DEFINITIONS ///.
Definition: hopOper.c:63
Hop_Obj_t* Amap_ParseFormulaOper ( Hop_Man_t pMan,
Vec_Ptr_t pStackFn,
int  Oper 
)

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Performs the operation on the top entries in the stack.]

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file amapParse.c.

74 {
75  Hop_Obj_t * gArg1, * gArg2, * gFunc;
76  // perform the given operation
77  gArg2 = (Hop_Obj_t *)Vec_PtrPop( pStackFn );
78  gArg1 = (Hop_Obj_t *)Vec_PtrPop( pStackFn );
79  if ( Oper == AMAP_EQN_OPER_AND )
80  gFunc = Hop_And( pMan, gArg1, gArg2 );
81  else if ( Oper == AMAP_EQN_OPER_OR )
82  gFunc = Hop_Or( pMan, gArg1, gArg2 );
83  else if ( Oper == AMAP_EQN_OPER_XOR )
84  gFunc = Hop_Exor( pMan, gArg1, gArg2 );
85  else
86  return NULL;
87 // Cudd_Ref( gFunc );
88 // Cudd_RecursiveDeref( dd, gArg1 );
89 // Cudd_RecursiveDeref( dd, gArg2 );
90  Vec_PtrPush( pStackFn, gFunc );
91  return gFunc;
92 }
Hop_Obj_t * Hop_Or(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:171
Hop_Obj_t * Hop_And(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:104
#define AMAP_EQN_OPER_OR
Definition: amapParse.c:49
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static void * Vec_PtrPop(Vec_Ptr_t *p)
Definition: vecPtr.h:677
Definition: hop.h:65
Hop_Obj_t * Hop_Exor(Hop_Man_t *p, Hop_Obj_t *p0, Hop_Obj_t *p1)
Definition: hopOper.c:138
#define AMAP_EQN_OPER_AND
Definition: amapParse.c:47
#define AMAP_EQN_OPER_XOR
Definition: amapParse.c:48