diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2021-05-11 15:04:15 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2021-05-11 15:04:15 -0700 |
commit | aa9fe1f24094d0423cc32cbd6e9682ea2a3935cb (patch) | |
tree | 33a773bf2a80f88d071719b2f3232d0cc3a4b885 /src/misc/vec/vecWrd.h | |
parent | 76bed2055cc171109a86bf56c6da00aa4d251a30 (diff) | |
download | abc-aa9fe1f24094d0423cc32cbd6e9682ea2a3935cb.tar.gz abc-aa9fe1f24094d0423cc32cbd6e9682ea2a3935cb.tar.bz2 abc-aa9fe1f24094d0423cc32cbd6e9682ea2a3935cb.zip |
Updating LUT synthesis code.
Diffstat (limited to 'src/misc/vec/vecWrd.h')
-rw-r--r-- | src/misc/vec/vecWrd.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h index 9fa82f2d..b0123453 100644 --- a/src/misc/vec/vecWrd.h +++ b/src/misc/vec/vecWrd.h @@ -1368,24 +1368,27 @@ static inline Vec_Wrd_t * Vec_WrdReadBin( char * pFileName, int fVerbose ) } fseek( pFile, 0, SEEK_END ); nSize = ftell( pFile ); - if ( nSize % 8 > 0 ) + if ( nSize == 0 ) { - printf( "Cannot read file with simulation data that is not aligned at 8 bytes (remainder = %d).\n", nSize % 8 ); + printf( "The input file is empty.\n" ); fclose( pFile ); return NULL; } - else + if ( nSize % 8 > 0 ) { - rewind( pFile ); - p = Vec_WrdStart( nSize/8 ); - RetValue = fread( Vec_WrdArray(p), 1, nSize, pFile ); + printf( "Cannot read file with simulation data that is not aligned at 8 bytes (remainder = %d).\n", nSize % 8 ); fclose( pFile ); - if ( RetValue != nSize ) - printf( "Error reading data from file.\n" ); - if ( fVerbose ) - printf( "Read %d words of simulation data from file \"%s\".\n", nSize/8, pFileName ); - return p; + return NULL; } + rewind( pFile ); + p = Vec_WrdStart( nSize/8 ); + RetValue = fread( Vec_WrdArray(p), 1, nSize, pFile ); + fclose( pFile ); + if ( RetValue != nSize ) + printf( "Error reading data from file.\n" ); + if ( fVerbose ) + printf( "Read %d words of simulation data from file \"%s\".\n", nSize/8, pFileName ); + return p; } ABC_NAMESPACE_HEADER_END |