ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mapperSuper.c File Reference
#include "mapperInt.h"
Include dependency graph for mapperSuper.c:

Go to the source code of this file.

Functions

int Map_LibraryRead (Map_SuperLib_t *pLib, char *pFileName)
 FUNCTION DEFINITIONS ///.
 
char * Map_LibraryReadFormulaStep (char *pFormula, char *pStrings[], int *pnStrings)
 
void Map_LibraryPrintSupergate (Map_Super_t *pGate)
 

Function Documentation

◆ Map_LibraryPrintSupergate()

void Map_LibraryPrintSupergate ( Map_Super_t * pGate)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 403 of file mapperSuper.c.

404{
405 printf( "%5d : ", pGate->nUsed );
406 printf( "%5d ", pGate->Num );
407 printf( "A = %5.2f ", pGate->Area );
408 printf( "D = %5.2f/%5.2f/%5.2f ", pGate->tDelayMax.Rise, pGate->tDelayMax.Fall, pGate->tDelayMax.Worst );
409 printf( "%s", pGate->pFormula );
410 printf( "\n" );
411}
Map_Time_t tDelayMax
Definition mapperInt.h:296

◆ Map_LibraryRead()

int Map_LibraryRead ( Map_SuperLib_t * pLib,
char * pFileName )

FUNCTION DEFINITIONS ///.

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

Synopsis [Reads the supergate library from file.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file mapperSuper.c.

51{
52 FILE * pFile;
53 int Status;
54 // read the beginning of the file
55 assert( pLib->pGenlib == NULL );
56 pFile = fopen( pFileName, "r" );
57 if ( pFile == NULL )
58 {
59 printf( "Cannot open input file \"%s\".\n", pFileName );
60 return 0;
61 }
62 Status = Map_LibraryReadFile( pLib, pFile );
63 fclose( pFile );
64// Map_LibraryPrintClasses( pLib );
65 return Status;
66}
Mio_Library_t * pGenlib
Definition mapperInt.h:173
#define assert(ex)
Definition util_old.h:213
Here is the caller graph for this function:

◆ Map_LibraryReadFormulaStep()

char * Map_LibraryReadFormulaStep ( char * pFormula,
char * pStrings[],
int * pnStrings )

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

Synopsis [Performs one step of parsing the formula into parts.]

Description [This function will eventually be replaced when the tree-supergate library representation will become standard.]

SideEffects []

SeeAlso []

Definition at line 256 of file mapperSuper.c.

257{
258 char * pName, * pPar1, * pPar2, * pCur;
259 int nStrings, CountPars;
260
261 // skip leading spaces
262 for ( pName = pFormula; *pName && *pName == ' '; pName++ );
263 assert( *pName );
264 // find the first opening parenthesis
265 for ( pPar1 = pName; *pPar1 && *pPar1 != '('; pPar1++ );
266 if ( *pPar1 == 0 )
267 {
268 *pnStrings = 0;
269 return pName;
270 }
271 // overwrite it with space
272 assert( *pPar1 == '(' );
273 *pPar1 = 0;
274 // find the corresponding closing parenthesis
275 for ( CountPars = 1, pPar2 = pPar1 + 1; *pPar2 && CountPars; pPar2++ )
276 if ( *pPar2 == '(' )
277 CountPars++;
278 else if ( *pPar2 == ')' )
279 CountPars--;
280 pPar2--;
281 assert( CountPars == 0 );
282 // overwrite it with space
283 assert( *pPar2 == ')' );
284 *pPar2 = 0;
285 // save the intervals between the commas
286 nStrings = 0;
287 pCur = pPar1 + 1;
288 while ( 1 )
289 {
290 // save the current string
291 pStrings[ nStrings++ ] = pCur;
292 // find the beginning of the next string
293 for ( CountPars = 0; *pCur && (CountPars || *pCur != ','); pCur++ )
294 if ( *pCur == '(' )
295 CountPars++;
296 else if ( *pCur == ')' )
297 CountPars--;
298 if ( *pCur == 0 )
299 break;
300 assert( *pCur == ',' );
301 *pCur = 0;
302 pCur++;
303 }
304 // save the results and return
305 *pnStrings = nStrings;
306 return pName;
307}