summaryrefslogtreecommitdiffstats
path: root/src/map/mio
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-03-02 11:48:13 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2012-03-02 11:48:13 -0800
commit7e805e5c9ac3794b469f7bfe21bd933f49689afb (patch)
tree1e351b1ccaa3855c4c314a61d0b9b0df0f75ee08 /src/map/mio
parent7fa9de2da4fe215ddabe4a89d038263df9b9c30f (diff)
downloadabc-7e805e5c9ac3794b469f7bfe21bd933f49689afb.tar.gz
abc-7e805e5c9ac3794b469f7bfe21bd933f49689afb.tar.bz2
abc-7e805e5c9ac3794b469f7bfe21bd933f49689afb.zip
Making GENLIB parser skip LATCHes.
Diffstat (limited to 'src/map/mio')
-rw-r--r--src/map/mio/mio.c5
-rw-r--r--src/map/mio/mioInt.h1
-rw-r--r--src/map/mio/mioRead.c25
3 files changed, 30 insertions, 1 deletions
diff --git a/src/map/mio/mio.c b/src/map/mio/mio.c
index 30ad63e9..1f410705 100644
--- a/src/map/mio/mio.c
+++ b/src/map/mio/mio.c
@@ -446,6 +446,11 @@ int Mio_CommandPrintLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
goto usage;
}
}
+ if ( Abc_FrameReadLibGen() == NULL )
+ {
+ printf( "Library is not available.\n" );
+ return 1;
+ }
FileName = argv[globalUtilOptind];
if ( argc == globalUtilOptind + 1 )
{
diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h
index 02f081fa..59bd6ba6 100644
--- a/src/map/mio/mioInt.h
+++ b/src/map/mio/mioInt.h
@@ -41,6 +41,7 @@ ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
#define MIO_STRING_GATE "GATE"
+#define MIO_STRING_LATCH "LATCH"
#define MIO_STRING_PIN "PIN"
#define MIO_STRING_NONINV "NONINV"
#define MIO_STRING_INV "INV"
diff --git a/src/map/mio/mioRead.c b/src/map/mio/mioRead.c
index 283e2acf..d4e7fcd0 100644
--- a/src/map/mio/mioRead.c
+++ b/src/map/mio/mioRead.c
@@ -186,8 +186,25 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended
// read gates one by one
pToken = strtok( pBuffer, " \t\r\n" );
- while ( pToken && strcmp( pToken, MIO_STRING_GATE ) == 0 )
+ while ( pToken && (strcmp( pToken, MIO_STRING_GATE ) == 0 || strcmp( pToken, MIO_STRING_LATCH ) == 0) )
{
+ // skip latches
+ if ( strcmp( pToken, MIO_STRING_LATCH ) == 0 )
+ {
+ while ( pToken && strcmp( pToken, MIO_STRING_GATE ) != 0 && strcmp( pToken, ".end" ) != 0 )
+ {
+ if ( strcmp( pToken, MIO_STRING_LATCH ) == 0 )
+ {
+ pToken = strtok( NULL, " \t\r\n" );
+ printf( "Skipping latch \"%s\"...\n", pToken );
+ continue;
+ }
+ pToken = strtok( NULL, " \t\r\n" );
+ }
+ if ( !(pToken && strcmp( pToken, MIO_STRING_GATE ) == 0) )
+ break;
+ }
+
// derive the next gate
pGate = Mio_LibraryReadGate( &pToken, fExtendedFormat );
if ( pGate == NULL )
@@ -221,6 +238,12 @@ int Mio_LibraryReadInternal( Mio_Library_t * pLib, char * pBuffer, int fExtended
if ( fVerbose )
printf( "The number of gates read = %d.\n", nGates );
+ if ( nGates == 0 )
+ {
+ printf( "The library contains no gates.\n" );
+ return 1;
+ }
+
// check what is the last word read
if ( pToken && strcmp( pToken, ".end" ) != 0 )
return 1;