Commit 14aae240 by Alan Mishchenko

Changes to LUT mappers.

parent 3048be2c
...@@ -596,53 +596,53 @@ If_DsdMan_t * If_DsdManLoad( char * pFileName ) ...@@ -596,53 +596,53 @@ If_DsdMan_t * If_DsdManLoad( char * pFileName )
char pBuffer[10]; char pBuffer[10];
unsigned * pSpot; unsigned * pSpot;
word * pTruth; word * pTruth;
int i, Num; int i, Num, RetValue;
FILE * pFile = fopen( pFileName, "rb" ); FILE * pFile = fopen( pFileName, "rb" );
if ( pFile == NULL ) if ( pFile == NULL )
{ {
printf( "Reading DSD manager file \"%s\" has failed.\n", pFileName ); printf( "Reading DSD manager file \"%s\" has failed.\n", pFileName );
return NULL; return NULL;
} }
fread( pBuffer, 4, 1, pFile ); RetValue = fread( pBuffer, 4, 1, pFile );
if ( pBuffer[0] != 'd' && pBuffer[1] != 's' && pBuffer[2] != 'd' && pBuffer[3] != '0' ) if ( pBuffer[0] != 'd' && pBuffer[1] != 's' && pBuffer[2] != 'd' && pBuffer[3] != '0' )
{ {
printf( "Unrecognized format of file \"%s\".\n", pFileName ); printf( "Unrecognized format of file \"%s\".\n", pFileName );
return NULL; return NULL;
} }
fread( &Num, 4, 1, pFile ); RetValue = fread( &Num, 4, 1, pFile );
p = If_DsdManAlloc( Num, 0 ); p = If_DsdManAlloc( Num, 0 );
ABC_FREE( p->pStore ); ABC_FREE( p->pStore );
p->pStore = Abc_UtilStrsav( pFileName ); p->pStore = Abc_UtilStrsav( pFileName );
fread( &Num, 4, 1, pFile ); RetValue = fread( &Num, 4, 1, pFile );
p->LutSize = Num; p->LutSize = Num;
fread( &Num, 4, 1, pFile ); RetValue = fread( &Num, 4, 1, pFile );
assert( Num >= 2 ); assert( Num >= 2 );
Vec_PtrFillExtra( p->vObjs, Num, NULL ); Vec_PtrFillExtra( p->vObjs, Num, NULL );
Vec_IntFill( p->vNexts, Num, 0 ); Vec_IntFill( p->vNexts, Num, 0 );
for ( i = 2; i < Vec_PtrSize(p->vObjs); i++ ) for ( i = 2; i < Vec_PtrSize(p->vObjs); i++ )
{ {
fread( &Num, 4, 1, pFile ); RetValue = fread( &Num, 4, 1, pFile );
pObj = (If_DsdObj_t *)Mem_FlexEntryFetch( p->pMem, sizeof(word) * Num ); pObj = (If_DsdObj_t *)Mem_FlexEntryFetch( p->pMem, sizeof(word) * Num );
fread( pObj, sizeof(word)*Num, 1, pFile ); RetValue = fread( pObj, sizeof(word)*Num, 1, pFile );
Vec_PtrWriteEntry( p->vObjs, i, pObj ); Vec_PtrWriteEntry( p->vObjs, i, pObj );
pSpot = If_DsdObjHashLookup( p, pObj->Type, (int *)pObj->pFans, pObj->nFans, If_DsdObjTruthId(p, pObj) ); pSpot = If_DsdObjHashLookup( p, pObj->Type, (int *)pObj->pFans, pObj->nFans, If_DsdObjTruthId(p, pObj) );
assert( *pSpot == 0 ); assert( *pSpot == 0 );
*pSpot = pObj->Id; *pSpot = pObj->Id;
} }
fread( &Num, 4, 1, pFile ); RetValue = fread( &Num, 4, 1, pFile );
pTruth = ABC_ALLOC( word, p->nWords ); pTruth = ABC_ALLOC( word, p->nWords );
for ( i = 0; i < Num; i++ ) for ( i = 0; i < Num; i++ )
{ {
fread( pTruth, sizeof(word)*p->nWords, 1, pFile ); RetValue = fread( pTruth, sizeof(word)*p->nWords, 1, pFile );
Vec_MemHashInsert( p->vTtMem, pTruth ); Vec_MemHashInsert( p->vTtMem, pTruth );
} }
ABC_FREE( pTruth ); ABC_FREE( pTruth );
assert( Num == Vec_MemEntryNum(p->vTtMem) ); assert( Num == Vec_MemEntryNum(p->vTtMem) );
for ( i = 0; i < Vec_MemEntryNum(p->vTtMem); i++ ) for ( i = 0; i < Vec_MemEntryNum(p->vTtMem); i++ )
{ {
fread( &Num, 4, 1, pFile ); RetValue = fread( &Num, 4, 1, pFile );
vSets = Vec_IntAlloc( Num ); vSets = Vec_IntAlloc( Num );
fread( Vec_IntArray(vSets), sizeof(int)*Num, 1, pFile ); RetValue = fread( Vec_IntArray(vSets), sizeof(int)*Num, 1, pFile );
vSets->nSize = Num; vSets->nSize = Num;
Vec_PtrPush( p->vTtDecs, vSets ); Vec_PtrPush( p->vTtDecs, vSets );
} }
......
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