Commit 2fca2b2b by Alan Mishchenko

Fix in reading flop classes.

parent 9e6d74bc
...@@ -571,10 +571,12 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -571,10 +571,12 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
// read flop classes // read flop classes
else if ( *pCur == 'f' ) else if ( *pCur == 'f' )
{ {
int nFlops;
pCur++; pCur++;
assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4; nFlops = Gia_AigerReadInt(pCur); pCur += 4;
pNew->vFlopClasses = Vec_IntStart( Gia_ManRegNum(pNew) ); //assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, 4*Gia_ManRegNum(pNew) ); pCur += 4*Gia_ManRegNum(pNew); pNew->vFlopClasses = Vec_IntStart( nFlops );
memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, 4*nFlops ); pCur += 4*nFlops;
if ( fVerbose ) printf( "Finished reading extension \"f\".\n" ); if ( fVerbose ) printf( "Finished reading extension \"f\".\n" );
} }
// read gate classes // read gate classes
...@@ -1186,9 +1188,9 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int ...@@ -1186,9 +1188,9 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
if ( p->vFlopClasses ) if ( p->vFlopClasses )
{ {
fprintf( pFile, "f" ); fprintf( pFile, "f" );
Gia_FileWriteBufferSize( pFile, 4*Gia_ManRegNum(p) ); Gia_FileWriteBufferSize( pFile, 4*Vec_IntSize(p->vFlopClasses) );
assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) ); //assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Gia_ManRegNum(p), pFile ); fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Vec_IntSize(p->vFlopClasses), pFile );
} }
// write gate classes // write gate classes
if ( p->vGateClasses ) if ( p->vGateClasses )
......
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