From aa9fe1f24094d0423cc32cbd6e9682ea2a3935cb Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 11 May 2021 15:04:15 -0700 Subject: Updating LUT synthesis code. --- src/misc/vec/vecWrd.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/misc/vec') 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 -- cgit v1.2.3