summaryrefslogtreecommitdiffstats
path: root/src/map/mio
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mio')
-rw-r--r--src/map/mio/mio.c16
-rw-r--r--src/map/mio/mio.h3
-rw-r--r--src/map/mio/mioRead.c12
-rw-r--r--src/map/mio/mioUtils.c15
4 files changed, 31 insertions, 15 deletions
diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c
index d99d267a..6dd6e93f 100644
--- a/src/map/mio/mio.c
+++ b/src/map/mio/mio.c
@@ -443,7 +443,7 @@ int Mio_CommandWriteGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
printf( "Error! Cannot open file \"%s\" for writing the library.\n", pFileName );
return 1;
}
- Mio_WriteLibrary( pFile, (Mio_Library_t *)Abc_FrameReadLibGen(), 0 );
+ Mio_WriteLibrary( pFile, (Mio_Library_t *)Abc_FrameReadLibGen(), 0, 0 );
fclose( pFile );
printf( "The current genlib library is written into file \"%s\".\n", pFileName );
return 0;
@@ -472,7 +472,8 @@ int Mio_CommandPrintGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
{
FILE * pOut, * pErr;
Abc_Ntk_t * pNet;
- int fVerbose;
+ int fShort = 0;
+ int fVerbose = 0;
int c;
pNet = Abc_FrameReadNtk(pAbc);
@@ -480,12 +481,14 @@ int Mio_CommandPrintGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
pErr = Abc_FrameReadErr(pAbc);
// set the defaults
- fVerbose = 1;
Extra_UtilGetoptReset();
- while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF )
+ while ( (c = Extra_UtilGetopt(argc, argv, "svh")) != EOF )
{
switch (c)
{
+ case 's':
+ fShort ^= 1;
+ break;
case 'v':
fVerbose ^= 1;
break;
@@ -501,12 +504,13 @@ int Mio_CommandPrintGenlib( Abc_Frame_t * pAbc, int argc, char **argv )
printf( "Library is not available.\n" );
return 1;
}
- Mio_WriteLibrary( stdout, (Mio_Library_t *)Abc_FrameReadLibGen(), 0 );
+ Mio_WriteLibrary( stdout, (Mio_Library_t *)Abc_FrameReadLibGen(), 0, fShort );
return 0;
usage:
- fprintf( pErr, "\nusage: print_genlib [-vh]\n");
+ fprintf( pErr, "\nusage: print_genlib [-svh]\n");
fprintf( pErr, "\t print the current genlib library\n" );
+ fprintf( pErr, "\t-s : toggles writing short form [default = %s]\n", fShort? "yes" : "no" );
fprintf( pErr, "\t-v : toggles enabling of verbose output [default = %s]\n", fVerbose? "yes" : "no" );
fprintf( pErr, "\t-h : print the command usage\n");
return 1;
diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h
index e7b1c05e..9dd72d93 100644
--- a/src/map/mio/mio.h
+++ b/src/map/mio/mio.h
@@ -58,6 +58,7 @@ typedef struct Mio_Cell2_t_ Mio_Cell2_t;
struct Mio_Cell2_t_
{
char * pName; // name
+ Vec_Int_t * vExpr; // expression
unsigned Id : 28; // gate ID
unsigned nFanins : 4; // gate fanins
word Area; // area
@@ -177,7 +178,7 @@ extern void Mio_LibraryDelete( Mio_Library_t * pLib );
extern void Mio_GateDelete( Mio_Gate_t * pGate );
extern void Mio_PinDelete( Mio_Pin_t * pPin );
extern Mio_Pin_t * Mio_PinDup( Mio_Pin_t * pPin );
-extern void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops );
+extern void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops, int fShort );
extern Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, int fSkipInv, int * pnGates, int fVerbose );
extern Mio_Cell_t * Mio_CollectRootsNew( Mio_Library_t * pLib, int nInputs, int * pnGates, int fVerbose );
extern Mio_Cell_t * Mio_CollectRootsNewDefault( int nInputs, int * pnGates, int fVerbose );
diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c
index 6e067fa7..0364d363 100644
--- a/src/map/mio/mioRead.c
+++ b/src/map/mio/mioRead.c
@@ -329,6 +329,16 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended
SeeAlso []
***********************************************************************/
+char * Mio_LibraryCleanStr( char * p )
+{
+ int i, k;
+ char * pRes = Abc_UtilStrsav( p );
+ for ( i = k = 0; pRes[i]; i++ )
+ if ( pRes[i] != ' ' && pRes[i] != '\t' && pRes[i] != '\r' && pRes[i] != '\n' )
+ pRes[k++] = pRes[i];
+ pRes[k] = 0;
+ return pRes;
+}
Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, int fExtendedFormat )
{
Mio_Gate_t * pGate;
@@ -354,7 +364,7 @@ Mio_Gate_t * Mio_LibraryReadGate( char ** ppToken, int fExtendedFormat )
// then rest of the expression
pToken = strtok( NULL, ";" );
- pGate->pForm = chomp( pToken );
+ pGate->pForm = Mio_LibraryCleanStr( pToken );
// read the pin info
// start the linked list of pins
diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c
index a67aa5a1..bb24c7c8 100644
--- a/src/map/mio/mioUtils.c
+++ b/src/map/mio/mioUtils.c
@@ -200,10 +200,10 @@ void Mio_WritePin( FILE * pFile, Mio_Pin_t * pPin, int NameLen, int fAllPins )
fprintf( pFile, "%7s ", pPhaseNames[pPin->Phase] );
fprintf( pFile, "%3d ", (int)pPin->dLoadInput );
fprintf( pFile, "%3d ", (int)pPin->dLoadMax );
- fprintf( pFile, "%6.2f ", pPin->dDelayBlockRise );
- fprintf( pFile, "%6.2f ", pPin->dDelayFanoutRise );
- fprintf( pFile, "%6.2f ", pPin->dDelayBlockFall );
- fprintf( pFile, "%6.2f", pPin->dDelayFanoutFall );
+ fprintf( pFile, "%8.2f ", pPin->dDelayBlockRise );
+ fprintf( pFile, "%8.2f ", pPin->dDelayFanoutRise );
+ fprintf( pFile, "%8.2f ", pPin->dDelayBlockFall );
+ fprintf( pFile, "%8.2f", pPin->dDelayFanoutFall );
}
/**Function*************************************************************
@@ -225,7 +225,7 @@ void Mio_WriteGate( FILE * pFile, Mio_Gate_t * pGate, int GateLen, int NameLen,
sprintf( Buffer, "%s=%s;", pGate->pOutName, pGate->pForm );
fprintf( pFile, "GATE %-*s ", GateLen, pGate->pName );
fprintf( pFile, "%8.2f ", pGate->dArea );
- fprintf( pFile, "%-*s ", Abc_MinInt(NameLen+FormLen+2, 30), Buffer );
+ fprintf( pFile, "%-*s ", Abc_MinInt(NameLen+FormLen+2, 60), Buffer );
// print the pins
if ( fPrintSops )
fprintf( pFile, "%s", pGate->pSop? pGate->pSop : "unspecified\n" );
@@ -248,12 +248,12 @@ void Mio_WriteGate( FILE * pFile, Mio_Gate_t * pGate, int GateLen, int NameLen,
SeeAlso []
***********************************************************************/
-void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops )
+void Mio_WriteLibrary( FILE * pFile, Mio_Library_t * pLib, int fPrintSops, int fShort )
{
Mio_Gate_t * pGate;
Mio_Pin_t * pPin;
int i, GateLen = 0, NameLen = 0, FormLen = 0;
- int fAllPins = Mio_CheckGates( pLib );
+ int fAllPins = fShort || Mio_CheckGates( pLib );
Mio_LibraryForEachGate( pLib, pGate )
{
GateLen = Abc_MaxInt( GateLen, strlen(pGate->pName) );
@@ -631,6 +631,7 @@ static inline void Mio_CollectCopy2( Mio_Cell2_t * pCell, Mio_Gate_t * pGate )
{
Mio_Pin_t * pPin; int k;
pCell->pName = pGate->pName;
+ pCell->vExpr = pGate->vExpr;
pCell->uTruth = pGate->uTruth;
pCell->Area = (word)(MIO_NUM * pGate->dArea);
pCell->nFanins = pGate->nInputs;