summaryrefslogtreecommitdiffstats
path: root/src/base/io
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-03-13 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2007-03-13 08:01:00 -0700
commit2696cf05e568f7a928f32b01534d106bf626ef8a (patch)
treec795e6a7c53151faa830a55bfdc082dc67d98e4e /src/base/io
parent93c05287f0d8b044e620b41608df906bbad39db5 (diff)
downloadabc-2696cf05e568f7a928f32b01534d106bf626ef8a.tar.gz
abc-2696cf05e568f7a928f32b01534d106bf626ef8a.tar.bz2
abc-2696cf05e568f7a928f32b01534d106bf626ef8a.zip
Version abc70313
Diffstat (limited to 'src/base/io')
-rw-r--r--src/base/io/io.c1
-rw-r--r--src/base/io/ioReadBench.c32
-rw-r--r--src/base/io/ioReadBlifMv.c2
3 files changed, 34 insertions, 1 deletions
diff --git a/src/base/io/io.c b/src/base/io/io.c
index 68b2dbd2..cc907eb2 100644
--- a/src/base/io/io.c
+++ b/src/base/io/io.c
@@ -877,6 +877,7 @@ int IoCommandReadVerLib( Abc_Frame_t * pAbc, int argc, char ** argv )
FILE * pFile;
int fCheck;
int c;
+ extern Abc_Lib_t * Ver_ParseFile( char * pFileName, Abc_Lib_t * pGateLib, int fCheck, int fUseMemMan );
fCheck = 1;
Extra_UtilGetoptReset();
diff --git a/src/base/io/ioReadBench.c b/src/base/io/ioReadBench.c
index bd01f914..2730ba69 100644
--- a/src/base/io/ioReadBench.c
+++ b/src/base/io/ioReadBench.c
@@ -86,7 +86,7 @@ Abc_Ntk_t * Io_ReadBenchNetwork( Extra_FileReader_t * p )
Vec_Str_t * vString;
unsigned uTruth[8];
char * pType, ** ppNames, * pString;
- int iLine, nNames;
+ int iLine, nNames, nDigits, fLutsPresent = 0;
// allocate the empty network
pNtk = Abc_NtkStartRead( Extra_FileReaderGetFileName(p) );
@@ -122,6 +122,7 @@ Abc_Ntk_t * Io_ReadBenchNetwork( Extra_FileReader_t * p )
}
else if ( strcmp(pType, "LUT") == 0 )
{
+ fLutsPresent = 1;
ppNames = (char **)vTokens->pArray + 3;
nNames = vTokens->nSize - 3;
// check the number of inputs
@@ -142,6 +143,18 @@ Abc_Ntk_t * Io_ReadBenchNetwork( Extra_FileReader_t * p )
return NULL;
}
pString += 2;
+ // pad the string with zero's if needed
+ nDigits = (1 << nNames) / 4;
+ if ( nDigits == 0 )
+ nDigits = 1;
+ if ( strlen(pString) < (unsigned)nDigits )
+ {
+ Vec_StrFill( vString, nDigits - strlen(pString), '0' );
+ Vec_StrPrintStr( vString, pString );
+ Vec_StrPush( vString, 0 );
+ pString = Vec_StrArray( vString );
+ }
+ // read the hex number from the string
if ( !Extra_ReadHexadecimal( uTruth, pString, nNames ) )
{
printf( "%s: Reading hexadecimal number (%s) has failed.\n", Extra_FileReaderGetFileName(p), pString );
@@ -229,6 +242,23 @@ Abc_Ntk_t * Io_ReadBenchNetwork( Extra_FileReader_t * p )
// Io_ReadCreateConst( pNtk, "gnd", 0 );
Abc_NtkFinalizeRead( pNtk );
+
+ // if LUTs are present, collapse the truth tables into cubes
+ if ( fLutsPresent )
+ {
+ if ( !Abc_NtkToBdd(pNtk) )
+ {
+ printf( "Io_ReadBenchNetwork(): Converting to BDD has failed.\n" );
+ Abc_NtkDelete( pNtk );
+ return NULL;
+ }
+ if ( !Abc_NtkToSop(pNtk, 0) )
+ {
+ printf( "Io_ReadBenchNetwork(): Converting to SOP has failed.\n" );
+ Abc_NtkDelete( pNtk );
+ return NULL;
+ }
+ }
return pNtk;
}
diff --git a/src/base/io/ioReadBlifMv.c b/src/base/io/ioReadBlifMv.c
index dc72c591..18578cbb 100644
--- a/src/base/io/ioReadBlifMv.c
+++ b/src/base/io/ioReadBlifMv.c
@@ -212,6 +212,8 @@ Abc_Ntk_t * Io_ReadBlifMv( char * pFileName, int fBlifMv, int fCheck )
Abc_NtkIsAcyclicHierarchy( pNtk );
//Io_WriteBlifMv( pNtk, "_temp_.mv" );
+ if ( pNtk->pSpec == NULL )
+ pNtk->pSpec = Extra_UtilStrsav( pFileName );
return pNtk;
}