68 pTemp =
strtok( pBuffer,
" " );
69 if ( pTemp[0] ==
'*' )
72 pTemp =
strtok( NULL,
" " );
77 if ( pGate->
pRoot == NULL )
79 printf(
"Cannot read the root gate names %s.\n", pTemp );
86 for ( i = 0; ( pTemp =
strtok( NULL,
" \n\0" ) ); i++ )
88 if ( pTemp[0] ==
'#' )
92 printf(
"There are too many entries on the line.\n" );
98 printf(
"The number of a child supergate is negative.\n" );
103 printf(
"The number of a child supergate (%d) exceeded the number of lines (%d).\n",
112 printf(
"The number of fanins of a root gate is wrong.\n" );
117 if ( pTemp && pTemp[0] ==
'#' )
120 pTemp =
strtok( NULL,
" \n\0" );
122 for ( pTemp++; *pTemp ==
' '; pTemp++ );
128 pTemp =
strtok( NULL,
" \n\0" );
130 printf(
"The following trailing symbols found \"%s\".\n", pTemp );
321 assert( nBufferSize > 1 );
328 for ( pCur = pBeg; pCur < pEnd; pCur++ )
333 *pPos += pCur - pBeg;
338 *pPos += pCur - pBeg + 1;
342 if ( pCur - pBeg == nBufferSize-1 )
344 *pPos += pCur - pBeg + 1;
368 for ( i = 0; p1[i]; i++ )
369 if ( p1[i] ==
'>' || p1[i] ==
'\\' || p1[i] ==
'/' )
371 for ( i = 0; p2[i]; i++ )
372 if ( p2[i] ==
'>' || p2[i] ==
'\\' || p2[i] ==
'/' )
374 RetValue =
strcmp( p1, p2 );
396 char * pTemp = 0, * pLibName;
398 int RetValue, nPos = 0;
404 RetValue =
Vec_StrGets( pBuffer, 5000, vStr, &nPos );
408 for ( pTemp = pBuffer; *pTemp ==
' ' || *pTemp ==
'\r' || *pTemp ==
'\n'; pTemp++ );
410 if ( *pTemp != 0 && *pTemp !=
'#' )
414 pLibName =
strtok( pTemp,
" \t\r\n" );
420 printf(
"Supergate library \"%s\" requires the use of genlib library \"%s\".\n", pFileName, pLibName );
425 RetValue =
Vec_StrGets( pBuffer, 5000, vStr, &nPos );
428 RetValue = sscanf( pBuffer,
"%d\n", &pLib->
nVarsMax );
431 printf(
"Suspicious number of variables (%d).\n", pLib->
nVarsMax );
436 RetValue =
Vec_StrGets( pBuffer, 5000, vStr, &nPos );
439 RetValue = sscanf( pBuffer,
"%d\n", &pLib->
nSupersReal );
442 printf(
"Suspicious number of gates (%d).\n", pLib->
nSupersReal );
447 RetValue =
Vec_StrGets( pBuffer, 5000, vStr, &nPos );
450 RetValue = sscanf( pBuffer,
"%d\n", &pLib->
nLines );
453 printf(
"Suspicious number of lines (%d).\n", pLib->
nLines );
461 for ( i = 0; i < pLib->
nVarsMax; i++ )
472 for ( k = 0; k < pLib->
nVarsMax; k++ )
488 while (
Vec_StrGets( pBuffer, 5000, vStr, &nPos ) )
490 for ( pTemp = pBuffer; *pTemp ==
' ' || *pTemp ==
'\r' || *pTemp ==
'\n'; pTemp++ );
491 if ( pTemp[0] ==
'\0' )
513 if ( nCounter != pLib->
nLines )
514 printf(
"The number of lines read (%d) is different from what the file says (%d).\n", nCounter, pLib->
nLines );
518 for ( k = 0; k < pLib->
nLines; k++ )
521 printf(
"The number of gates read (%d) is different what the file says (%d).\n", nCounter, pLib->
nSupersReal );
537 if ( pBuffer == NULL )
539 printf(
"Cannot open input file \"%s\".\n", pFileName );
557 fprintf (
Abc_FrameReadOut( pAbc ),
"Read %d gates from exclude file\n", num );
591 unsigned uTruths[6][2];
603 for ( k = 0; k < (int)pGate->
nFanins; k++ )
615 for ( k = 0; k < (int)pGate->
nFanins; k++ )
618 uTruths[k][0] = pFanin->
uTruth[0];
619 uTruths[k][1] = pFanin->
uTruth[1];
625 for ( k = 0; k < pLib->
nVarsMax; k++ )
638 printf(
"There are less pins than gate inputs.\n" );
647 printf(
"There are more pins than gate inputs.\n" );
652 for ( k = 0; k < pLib->
nVarsMax; k++ )
672 for ( k = 0; k < (int)pGate->
nFanins; k++ )
687 assert( nRealVars > 0 && nRealVars <= pLib->nVarsMax );
728 int i, VarCur, VarMax = 0;
729 if ( pGate->
pRoot == NULL )
731 for ( i = 0; i < (int)pGate->
nFanins; i++ )
734 if ( VarMax < VarCur )
755 if ( pGate->
pRoot == NULL )
756 return (
unsigned)(1 << (pGate->
Num));
758 for ( i = 0; i < (int)pGate->
nFanins; i++ )
777 float tDelayBlockRise, tDelayBlockFall, tDelayPin;
784 float tDelayBlockMax;
788 for ( i = 0; i < pLib->
nVarsMax; i++ )
797 for ( i = 0; i < pLib->
nVarsMax; i++ )
818 for ( i = 0; i < pLib->
nVarsMax; i++ )
863 for ( i = 0; i < pLib->
nVarsMax; i++ )
921 for ( v = 0, Shift = 1; v < nVars; v++, Shift <<= 1 )
922 if ( uPhase & Shift )
923 uTruth = (((uTruth & ~uTruths[v][0]) << Shift) | ((uTruth & uTruths[v][0]) >> Shift));
938 void Map_CalculatePhase6(
unsigned uTruths[][2],
int nVars,
unsigned uTruth[],
unsigned uPhase,
unsigned uTruthRes[] )
944 uTruthRes[0] = uTruth[0];
945 uTruthRes[1] = uTruth[1];
949 for ( v = 0, Shift = 1; v < nVars; v++, Shift <<= 1 )
950 if ( uPhase & Shift )
954 uTruthRes[0] = (((uTruthRes[0] & ~uTruths[v][0]) << Shift) | ((uTruthRes[0] & uTruths[v][0]) >> Shift));
955 uTruthRes[1] = (((uTruthRes[1] & ~uTruths[v][1]) << Shift) | ((uTruthRes[1] & uTruths[v][1]) >> Shift));
959 uTemp = uTruthRes[0];
960 uTruthRes[0] = uTruthRes[1];
961 uTruthRes[1] = uTemp;
986 for ( i = pLib->
nVarsMax; i < 20; i++ )
991 printf(
"%6d ", pGate->
Num );
992 printf(
"%c ", pGate->
fSuper?
'*' :
' ' );
994 for ( k = 0; k < (int)pGate->
nFanins; k++ )
1001 printf(
" %3d", pGate->
nGates );
1002 printf(
" %6.2f", pGate->
Area );
1005 for ( k = 0; k < pLib->
nVarsMax; k++ )
1011 printf(
" (----, ----)" );
1023 printf(
" (----, ----)" );
void Map_LibraryPrintTree(Map_SuperLib_t *pLib)
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
void st__free_table(st__table *table)
void Map_SuperTableSortSupergatesByDelay(Map_HashTable_t *p, int nSupersMax)
int Map_LibraryDeriveGateInfo(Map_SuperLib_t *pLib, st__table *tExcludeGate)
int Vec_StrGets(char *pBuffer, int nBufferSize, Vec_Str_t *vStr, int *pPos)
static char * Vec_StrArray(Vec_Str_t *p)
Mio_Pin_t * Mio_GateReadPins(Mio_Gate_t *pGate)
double Mio_PinReadDelayBlockFall(Mio_Pin_t *pPin)
Mio_PinPhase_t
INCLUDES ///.
#define ABC_ALLOC(type, num)
int Map_LibraryReadTree(Map_SuperLib_t *pLib, Mio_Library_t *pGenlib, char *pFileName, char *pExcludeFile)
#define st__is_member(table, key)
Mio_Pin_t * Mio_PinReadNext(Mio_Pin_t *pPin)
int Map_LibraryCompareLibNames(char *pName1, char *pName2)
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
int Mio_GateReadPinNum(Mio_Gate_t *pGate)
int st__strhash(const char *string, int modulus)
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
int Map_LibraryReadFileTreeStr(Map_SuperLib_t *pLib, Mio_Library_t *pGenlib, Vec_Str_t *vStr, char *pFileName)
static void Vec_StrFree(Vec_Str_t *p)
#define ABC_NAMESPACE_IMPL_END
Extra_MmFixed_t * mmSupers
void * Abc_FrameGetGlobalFrame()
static const int s_MapFanoutLimits[10]
static unsigned Map_LibraryGetGateSupp_rec(Map_Super_t *pGate)
STRUCTURE DEFINITIONS ///.
void Mio_DeriveTruthTable(Mio_Gate_t *pGate, unsigned uTruthsIn[][2], int nSigns, int nInputs, unsigned uTruthRes[])
#define ABC_NAMESPACE_IMPL_START
double Mio_GateReadArea(Mio_Gate_t *pGate)
static int Vec_StrSize(Vec_Str_t *p)
unsigned Map_CalculatePhase(unsigned uTruths[][2], int nVars, unsigned uTruth, unsigned uPhase)
void Map_CalculatePhase6(unsigned uTruths[][2], int nVars, unsigned uTruth[], unsigned uPhase, unsigned uTruthRes[])
Map_Super_t * Map_LibraryReadGateTree(Map_SuperLib_t *pLib, char *pBuffer, int Number, int nVarsMax)
FUNCTION DEFINITIONS ///.
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
int Map_CanonComputeSlow(unsigned uTruths[][2], int nVarsMax, int nVarsReal, unsigned uTruth[], unsigned char *puPhases, unsigned uTruthRes[])
FUNCTION DEFINITIONS ///.
char * Mio_ReadFile(char *FileName, int fAddEnd)
double Mio_PinReadDelayBlockMax(Mio_Pin_t *pPin)
Mio_PinPhase_t Mio_PinReadPhase(Mio_Pin_t *pPin)
double Mio_PinReadDelayBlockRise(Mio_Pin_t *pPin)
static ABC_NAMESPACE_IMPL_START void Map_LibraryAddFaninDelays(Map_SuperLib_t *pLib, Map_Super_t *pGate, Map_Super_t *pFanin, Mio_Pin_t *pPin)
DECLARATIONS ///.
int Mio_LibraryReadExclude(char *ExcludeFile, st__table *tExcludeGate)
int Map_SuperTableInsertC(Map_HashTable_t *pLib, unsigned uTruthC[], Map_Super_t *pGate)
Map_HashTable_t * tTableC
static int Map_LibraryGetMaxSuperPi_rec(Map_Super_t *pGate)
ABC_DLL FILE * Abc_FrameReadOut(Abc_Frame_t *p)
char * Abc_UtilStrsav(char *s)
char * Mio_GateReadName(Mio_Gate_t *pGate)
static Vec_Str_t * Vec_StrAllocArray(char *pArray, int nSize)