Commit aa9fe1f2 by Alan Mishchenko

Updating LUT synthesis code.

parent 76bed205
......@@ -222,6 +222,8 @@ Vec_Wrd_t * Gia_ManSimulateWordsOut( Gia_Man_t * p, Vec_Wrd_t * vSimsIn )
// set output sim info
Gia_ManForEachCoId( p, Id, i )
memcpy( Vec_WrdEntryP(vSimsOut, i*nWords), Vec_WrdEntryP(p->vSims, Id*nWords), sizeof(word)*nWords );
Vec_WrdFreeP( &p->vSims );
p->nSimWords = -1;
return vSimsOut;
}
......
......@@ -78,18 +78,18 @@ void Vec_WrdReadText( char * pFileName, Vec_Wrd_t ** pvSimI, Vec_Wrd_t ** pvSimO
for ( iLine = 0; fgets( pLine, 1000, pFile ); iLine++ )
{
for ( i = 0; i < nIns; i++ )
if ( pLine[i] == '1' )
if ( pLine[nIns-1-i] == '1' )
Abc_TtXorBit( Vec_WrdArray(vSimI) + i*nWords, iLine );
else assert( pLine[i] == '0' );
else assert( pLine[nIns-1-i] == '0' );
for ( i = 0; i < nOuts; i++ )
if ( pLine[nIns+i] == '1' )
if ( pLine[nIns+nOuts-1-i] == '1' )
Abc_TtXorBit( Vec_WrdArray(vSimO) + i*nWords, iLine );
else assert( pLine[nIns+i] == '0' );
else assert( pLine[nIns+nOuts-1-i] == '0' );
}
fclose( pFile );
*pvSimI = vSimI;
*pvSimO = vSimO;
printf( "Read %d words of simulation data for %d inputs and %d outputs.\n", nWords, nIns, nOuts );
printf( "Read %d words of simulation data for %d inputs and %d outputs (padded %d zero-patterns).\n", nWords, nIns, nOuts, nWords*64-nLines );
}
void Gia_ManSimInfoTransform( int fSmall )
{
......@@ -115,43 +115,143 @@ void Gia_ManSimInfoTransform( int fSmall )
SeeAlso []
***********************************************************************/
int Gia_ManSimInfoTry( Gia_Man_t * p, Vec_Wrd_t * vSimI, Vec_Wrd_t * vSimO )
Vec_Wrd_t * Vec_WrdZoneExtract( int ZoneSize, Vec_Wrd_t * p, int iWord, int nWords )
{
int z, nZones = Vec_WrdSize(p)/ZoneSize;
int w, Limit = Abc_MinInt( nWords, ZoneSize-iWord );
Vec_Wrd_t * pNew = Vec_WrdStart( nZones*nWords );
for ( z = 0; z < nZones; z++ )
for ( w = 0; w < Limit; w++ )
Vec_WrdWriteEntry( pNew, z*nWords + w, Vec_WrdEntry(p, z*ZoneSize + iWord + w) );
return pNew;
}
void Vec_WrdZoneInsert( Vec_Wrd_t * pNew, int ZoneSize, Vec_Wrd_t * p, int iWord, int nWords )
{
int z, nZones = Vec_WrdSize(pNew)/ZoneSize;
int w, Limit = Abc_MinInt( nWords, ZoneSize-iWord );
for ( z = 0; z < nZones; z++ )
for ( w = 0; w < Limit; w++ )
Vec_WrdWriteEntry( pNew, z*ZoneSize + iWord + w, Vec_WrdEntry(p, z*nWords + w) );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Gia_ManSimInfoPrintOne( Gia_Man_t * p, Vec_Wrd_t * vSimsIn, Vec_Wrd_t * vSimsOut, int nWords, int nPats )
{
int Id, i, k;
for ( k = 0; k < nPats; k++ )
{
Gia_ManForEachCiId( p, Id, i )
// printf( "%d", Vec_WrdEntry(p->vSims, p->nSimWords*Id) & 1 );
printf( "%d", (Vec_WrdEntry(vSimsIn, nWords*i) >> k) & 1 );
printf( " " );
Gia_ManForEachCoId( p, Id, i )
// printf( "%d", Vec_WrdEntry(p->vSims, p->nSimWords*Id) & 1 );
printf( "%d", (Vec_WrdEntry(vSimsOut, nWords*i) >> k) & 1 );
printf( "\n" );
}
}
Vec_Wrd_t * Gia_ManSimInfoTryOne( Gia_Man_t * p, Vec_Wrd_t * vSimI, int fPrint )
{
extern Vec_Wrd_t * Gia_ManSimulateWordsOut( Gia_Man_t * p, Vec_Wrd_t * vSimsIn );
Vec_Wrd_t * vSimsOut = Gia_ManSimulateWordsOut( p, vSimI );
word * pSim0 = Vec_WrdArray(p->vSims);
int i, Count, nWords = Vec_WrdSize(vSimO) / Gia_ManCoNum(p);
Gia_Obj_t * pObj;
assert( Vec_WrdSize(vSimI) / Gia_ManCiNum(p) == nWords );
int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(p);
assert( Vec_WrdSize(vSimI) % Gia_ManCiNum(p) == 0 );
assert( Vec_WrdSize(vSimO) % Gia_ManCoNum(p) == 0 );
Abc_TtClear( pSim0, nWords );
Gia_ManForEachCo( p, pObj, i )
if ( fPrint )
Gia_ManSimInfoPrintOne( p, vSimI, vSimsOut, nWords, 6 );
return vSimsOut;
}
int Gia_ManSimEvalOne( Gia_Man_t * p, Vec_Wrd_t * vSimO, Vec_Wrd_t * vSimO_new )
{
int i, Count = 0, nWords = Vec_WrdSize(vSimO) / Gia_ManCoNum(p);
word * pSim0 = ABC_CALLOC( word, nWords );
assert( Vec_WrdSize(vSimO) == Vec_WrdSize(vSimO_new) );
for ( i = 0; i < Gia_ManCoNum(p); i++ )
{
word * pSimImpl = Vec_WrdEntryP( vSimsOut, i * nWords );
word * pSimGold = Vec_WrdEntryP( vSimO, i * nWords );
word * pSimGold = Vec_WrdEntryP( vSimO, i * nWords );
word * pSimImpl = Vec_WrdEntryP( vSimO_new, i * nWords );
Abc_TtOrXor( pSim0, pSimImpl, pSimGold, nWords );
}
Count = Abc_TtCountOnesVec( pSim0, nWords );
printf( "Number of failed patterns is %d (out of %d). The first one is %d\n",
printf( "Number of failed patterns is %d (out of %d). The first one is %d.\n",
Count, 64*nWords, Abc_TtFindFirstBit2(pSim0, nWords) );
Vec_WrdFreeP( &p->vSims );
Vec_WrdFreeP( &vSimsOut );
p->nSimWords = -1;
ABC_FREE( pSim0 );
return Count;
}
Vec_Wrd_t * Gia_ManSimInfoTry( Gia_Man_t * p, Vec_Wrd_t * vSimI )
{
int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(p);
int w, nWordsOne = 200, nWordBatches = (nWords + nWordsOne - 1)/nWordsOne;
Vec_Wrd_t * vSimO_new = Vec_WrdStart( nWords * Gia_ManCoNum(p) );
for ( w = 0; w < nWordBatches; w++ )
{
//int Value = printf( "%3d / %3d : ", w, nWordBatches );
Vec_Wrd_t * vSimI_ = Vec_WrdZoneExtract( nWords, vSimI, w*nWordsOne, nWordsOne );
Vec_Wrd_t * vSimO_ = Gia_ManSimInfoTryOne( p, vSimI_, 0 );
Vec_WrdZoneInsert( vSimO_new, nWords, vSimO_, w*nWordsOne, nWordsOne );
Vec_WrdFree( vSimI_ );
Vec_WrdFree( vSimO_ );
//Value = 0;
}
return vSimO_new;
}
int Gia_ManSimInfoEval( Gia_Man_t * p, Vec_Wrd_t * vSimO, Vec_Wrd_t * vSimO_new )
{
int nResult = Gia_ManSimEvalOne(p, vSimO, vSimO_new);
Vec_WrdDumpBin( "temp.simo", vSimO_new, 1 );
printf( "Total errors = %d. ", nResult );
printf( "Density of output patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSimO_new), Vec_WrdSize(vSimO_new))/(64*Vec_WrdSize(vSimO_new)) );
return nResult;
}
void Gia_ManSimInfoTryTest( Gia_Man_t * p, int fSmall )
{
abctime clk = Abc_Clock();
int nIns = fSmall ? 32 : 64;
int nOuts = fSmall ? 10 : 35;
char * pFileNameI = fSmall ? "s.simi" : "l.simi";
char * pFileNameO = fSmall ? "s.simo" : "l.simo";
char * pFileNameI = fSmall ? "io_s.simi" : "io_l.simi";
char * pFileNameO = fSmall ? "io_s.simo" : "io_l.simo";
Vec_Wrd_t * vSimI = Vec_WrdReadBin( pFileNameI, 1 );
Vec_Wrd_t * vSimO = Vec_WrdReadBin( pFileNameO, 1 );
Gia_ManSimInfoTry( p, vSimI, vSimO );
Vec_Wrd_t * vSimO_new;
printf( "Density of input patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSimI), Vec_WrdSize(vSimI))/(64*Vec_WrdSize(vSimI)) );
printf( "Density of output patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSimO), Vec_WrdSize(vSimO))/(64*Vec_WrdSize(vSimO)) );
vSimO_new = Gia_ManSimInfoTry( p, vSimI );
Gia_ManSimInfoEval( p, vSimO, vSimO_new );
Vec_WrdFree( vSimI );
Vec_WrdFree( vSimO );
Vec_WrdFree( vSimO_new );
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
}
void Gia_ManSimInfoPassTest( Gia_Man_t * p, char * pFileName, char * pFileName2, int fCompare )
{
abctime clk = Abc_Clock();
if ( fCompare )
{
Vec_Wrd_t * vSim1 = Vec_WrdReadBin( pFileName, 1 );
Vec_Wrd_t * vSim2 = Vec_WrdReadBin( pFileName2, 1 );
printf( "Density of input patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSim1), Vec_WrdSize(vSim1))/(64*Vec_WrdSize(vSim1)) );
printf( "Density of output patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSim2), Vec_WrdSize(vSim2))/(64*Vec_WrdSize(vSim2)) );
Gia_ManSimInfoEval( p, vSim1, vSim2 );
Vec_WrdFree( vSim1 );
Vec_WrdFree( vSim2 );
}
else
{
Vec_Wrd_t * vSimI = Vec_WrdReadBin( pFileName, 1 );
Vec_Wrd_t * vSimO = Gia_ManSimInfoTry( p, vSimI );
printf( "Density of input patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSimI), Vec_WrdSize(vSimI))/(64*Vec_WrdSize(vSimI)) );
printf( "Density of output patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSimO), Vec_WrdSize(vSimO))/(64*Vec_WrdSize(vSimO)) );
Vec_WrdDumpBin( pFileName2, vSimO, 1 );
Vec_WrdFree( vSimI );
Vec_WrdFree( vSimO );
}
Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
}
......@@ -166,8 +266,76 @@ void Gia_ManSimInfoTryTest( Gia_Man_t * p, int fSmall )
SeeAlso []
***********************************************************************/
void Gia_ManSimInfoPassTest( Gia_Man_t * p, int fSmall )
int Gia_ManCountFraction( Gia_Man_t * p, Vec_Wrd_t * vSimI, Vec_Int_t * vSupp, int Thresh )
{
int i, k, Id, nUsed = 0, nGood = 0;
int nWords = Vec_WrdSize(vSimI) / Gia_ManCiNum(p);
int nMints = 1 << Vec_IntSize(vSupp);
word ** pSims = ABC_ALLOC( word *, Vec_IntSize(vSupp) );
int * pCounts = ABC_CALLOC( int, nMints );
Vec_IntForEachEntry( vSupp, Id, i )
pSims[i] = Vec_WrdEntryP( vSimI, Id * nWords );
for ( k = 0; k < 64*nWords; k++ )
{
int iMint = 0;
for ( i = 0; i < Vec_IntSize(vSupp); i++ )
if ( Abc_TtGetBit(pSims[i], k) )
iMint |= 1 << i;
assert( iMint < nMints );
pCounts[iMint]++;
}
for ( k = 0; k < nMints; k++ )
{
nUsed += (pCounts[k] > 0);
nGood += (pCounts[k] > Thresh);
//printf( "%d ", pCounts[k] );
}
//printf( "\n" );
printf( "Total used %4d and good %4d (out of %4d).\n", nUsed, nGood, nMints );
ABC_FREE( pSims );
ABC_FREE( pCounts );
return nUsed;
}
void Gia_ManCollectSupp_rec( Gia_Man_t * p, int iObj, Vec_Int_t * vSupp )
{
Gia_Obj_t * pObj;
if ( !iObj || Gia_ObjIsTravIdCurrentId(p, iObj) )
return;
Gia_ObjSetTravIdCurrentId(p, iObj);
pObj = Gia_ManObj( p, iObj );
if ( Gia_ObjIsCi(pObj) )
{
Vec_IntPush( vSupp, Gia_ObjCioId(pObj) );
return;
}
assert( Gia_ObjIsAnd(pObj) );
Gia_ManCollectSupp_rec( p, Gia_ObjFaninId0(pObj, iObj), vSupp );
Gia_ManCollectSupp_rec( p, Gia_ObjFaninId1(pObj, iObj), vSupp );
}
Vec_Int_t * Gia_ManCollectSupp( Gia_Man_t * p, int iOut, int nOuts )
{
Vec_Int_t * vSupp = Vec_IntAlloc( 16 ); int i;
Gia_ManIncrementTravId( p );
for ( i = 0; i < nOuts; i++ )
Gia_ManCollectSupp_rec( p, Gia_ObjFaninId0p(p, Gia_ManCo(p, iOut+i)), vSupp );
return vSupp;
}
void Gia_ManSimInfoSynthOne( Gia_Man_t * p, Vec_Wrd_t * vSimI, int iOut, int nOuts, int Thresh )
{
Vec_Int_t * vSupp = Gia_ManCollectSupp( p, iOut, nOuts );
printf( "Group %3d / %3d / %3d : Supp = %3d ", iOut, nOuts, Gia_ManCoNum(p), Vec_IntSize(vSupp) );
Gia_ManCountFraction( p, vSimI, vSupp, Thresh );
Vec_IntFree( vSupp );
}
void Gia_ManSimInfoSynth( Gia_Man_t * p, char * pFileName, int GroupSize, int Thresh )
{
Vec_Wrd_t * vSimI = Vec_WrdReadBin( pFileName, 1 );
int g, nPats = 64*Vec_WrdSize(vSimI)/Gia_ManCiNum(p);
printf( "Density of input patterns %6.4f.\n", (float)Abc_TtCountOnesVec(Vec_WrdArray(vSimI), Vec_WrdSize(vSimI))/(64*Vec_WrdSize(vSimI)) );
printf( "The number of patterns %d with threshold %d (%6.2f %%).\n", nPats, Thresh, 100.0*Thresh/nPats );
for ( g = 0; g < Gia_ManCoNum(p); g += GroupSize )
Gia_ManSimInfoSynthOne( p, vSimI, g, GroupSize, Thresh );
Vec_WrdFree( vSimI );
}
/**Function*************************************************************
......
......@@ -486,6 +486,7 @@ static int Abc_CommandAbc9Pack ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9Edge ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9SatLut ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9MinLut ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9MinSim ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Unmap ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Struct ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Trace ( Abc_Frame_t * pAbc, int argc, char ** argv );
......@@ -1210,6 +1211,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&edge", Abc_CommandAbc9Edge, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&satlut", Abc_CommandAbc9SatLut, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&minlut", Abc_CommandAbc9MinLut, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&minsim", Abc_CommandAbc9MinSim, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&unmap", Abc_CommandAbc9Unmap, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&struct", Abc_CommandAbc9Struct, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&trace", Abc_CommandAbc9Trace, 0 );
......@@ -40825,11 +40827,13 @@ usage:
***********************************************************************/
int Abc_CommandAbc9MinLut( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern Gia_Man_t * Gia_ManPerformMinLut( Gia_Man_t * p, int GroupSize, int LutSize, int fVerbose );
Gia_Man_t * pTemp;
int c, LutSize = 6, GroupSize = 3, fVerbose = 0;
extern void Gia_ManSimInfoSynth( Gia_Man_t * p, char * pFileName, int GroupSize, int Thresh );
//extern Gia_Man_t * Gia_ManPerformMinLut( Gia_Man_t * p, int GroupSize, int LutSize, int fVerbose );
//Gia_Man_t * pTemp;
char * pFileName = NULL;
int c, LutSize = 6, GroupSize = 3, Limit = 0, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "KGvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "KGLvh" ) ) != EOF )
{
switch ( c )
{
......@@ -40851,6 +40855,15 @@ int Abc_CommandAbc9MinLut( Abc_Frame_t * pAbc, int argc, char ** argv )
GroupSize = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
break;
case 'L':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-L\" should be followed by a positive integer.\n" );
goto usage;
}
Limit = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
break;
case 'v':
fVerbose ^= 1;
break;
......@@ -40864,17 +40877,86 @@ int Abc_CommandAbc9MinLut( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Empty GIA network.\n" );
return 1;
}
pTemp = Gia_ManPerformMinLut( pAbc->pGia, GroupSize, LutSize, fVerbose );
if ( argc == globalUtilOptind + 1 )
{
FILE * pFile = fopen( argv[globalUtilOptind], "rb" );
if ( pFile == NULL )
{
Abc_Print( -1, "Abc_CommandAbc9BCore(): Cannot open file \"%s\" for writing the proof.\n", argv[globalUtilOptind] );
return 0;
}
fclose( pFile );
pFileName = argv[globalUtilOptind];
}
//pTemp = Gia_ManPerformMinLut( pAbc->pGia, GroupSize, LutSize, fVerbose );
//Abc_FrameUpdateGia( pAbc, pTemp );
Gia_ManSimInfoSynth( pAbc->pGia, pFileName, GroupSize, Limit );
return 0;
usage:
Abc_Print( -2, "usage: &minlut [-KG num] [-vh]\n" );
Abc_Print( -2, "usage: &minlut [-KGL num] [-vh] <file>\n" );
Abc_Print( -2, "\t performs specialized LUT mapping\n" );
Abc_Print( -2, "\t-K num : the LUT size for mapping [default = %d]\n", LutSize );
Abc_Print( -2, "\t-G num : the output group size [default = %d]\n", GroupSize );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-K num : the LUT size for mapping [default = %d]\n", LutSize );
Abc_Print( -2, "\t-G num : the output group size [default = %d]\n", GroupSize );
Abc_Print( -2, "\t-L num : the limit when patterns count [default = %d]\n", Limit );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : prints the command usage\n");
Abc_Print( -2, "\t<file> : file name with simulation information\n");
return 1;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandAbc9MinSim( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Gia_ManSimInfoPassTest( Gia_Man_t * p, char * pFileName, char * pFileName2, int fCompare );
int c, fCompare = 0, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "cvh" ) ) != EOF )
{
switch ( c )
{
case 'c':
fCompare ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
case 'h':
default:
goto usage;
}
}
if ( pAbc->pGia == NULL )
{
Abc_Print( -1, "Empty GIA network.\n" );
return 1;
}
if ( argc != globalUtilOptind + 2 )
{
Abc_Print( -1, "Expecting two file names on the command line.\n" );
return 1;
}
Gia_ManSimInfoPassTest( pAbc->pGia, argv[globalUtilOptind], argv[globalUtilOptind+1], fCompare );
return 0;
usage:
Abc_Print( -2, "usage: &minsim [-cvh] <file> <file2>\n" );
Abc_Print( -2, "\t performs specialized AIG simulation\n" );
Abc_Print( -2, "\t-c : toggles comparing simulation patterns [default = %s]\n", fCompare? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : prints the command usage\n");
Abc_Print( -2, "\t<file> : file name with simulation information\n");
Abc_Print( -2, "\t<file2> : file name with simulation information\n");
return 1;
}
......@@ -259,7 +259,7 @@ int Io_WriteBenchLutOneNode( FILE * pFile, Abc_Obj_t * pNode, Vec_Int_t * vTruth
int i, nFanins;
assert( Abc_ObjIsNode(pNode) );
nFanins = Abc_ObjFaninNum(pNode);
assert( nFanins <= 8 );
assert( nFanins <= 15 );
// compute the truth table
pTruth = Hop_ManConvertAigToTruth( (Hop_Man_t *)pNode->pNtk->pManFunc, Hop_Regular((Hop_Obj_t *)pNode->pData), nFanins, vTruth, 0 );
if ( Hop_IsComplement((Hop_Obj_t *)pNode->pData) )
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment