Skip to content

Commit b60994e

Browse files
committed
Bug fix.
1 parent 8573cb9 commit b60994e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/aig/gia/giaAiger.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,15 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fGiaSi
693693
// read flop classes
694694
else if ( *pCur == 'f' )
695695
{
696+
int i, nRegs;
696697
pCur++;
697-
assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
698-
pNew->vFlopClasses = Vec_IntStart( Gia_ManRegNum(pNew) );
699-
memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, (size_t)4*Gia_ManRegNum(pNew) ); pCur += 4*Gia_ManRegNum(pNew);
698+
pCurTemp = pCur + Gia_AigerReadInt(pCur) + 4; pCur += 4;
699+
nRegs = Gia_AigerReadInt(pCur); pCur += 4;
700+
//nRegs = (pCurTemp - pCur)/4;
701+
pNew->vFlopClasses = Vec_IntAlloc( nRegs );
702+
for ( i = 0; i < nRegs; i++ )
703+
Vec_IntPush( pNew->vFlopClasses, Gia_AigerReadInt(pCur) ), pCur += 4;
704+
assert( pCur == pCurTemp );
700705
if ( fVerbose ) printf( "Finished reading extension \"f\".\n" );
701706
}
702707
// read gate classes
@@ -1577,10 +1582,13 @@ void Gia_AigerWriteS( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, in
15771582
// write flop classes
15781583
if ( p->vFlopClasses )
15791584
{
1585+
int i;
15801586
fprintf( pFile, "f" );
1581-
Gia_FileWriteBufferSize( pFile, 4*Gia_ManRegNum(p) );
1582-
assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
1583-
fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Gia_ManRegNum(p), pFile );
1587+
Gia_FileWriteBufferSize( pFile, 4*(Vec_IntSize(p->vFlopClasses)+1) );
1588+
Gia_FileWriteBufferSize( pFile, Vec_IntSize(p->vFlopClasses) );
1589+
for ( i = 0; i < Vec_IntSize(p->vFlopClasses); i++ )
1590+
Gia_FileWriteBufferSize( pFile, Vec_IntEntry(p->vFlopClasses, i) );
1591+
if ( fVerbose ) printf( "Finished writing extension \"f\".\n" );
15841592
}
15851593
// write gate classes
15861594
if ( p->vGateClasses )

0 commit comments

Comments
 (0)