Commit cf2f9364 by Alan Mishchenko

Fix in reading flop classes.

parent c339e5b9
...@@ -141,6 +141,7 @@ struct Gia_Man_t_ ...@@ -141,6 +141,7 @@ struct Gia_Man_t_
Vec_Int_t * vGateClasses; // classes of gates for abstraction Vec_Int_t * vGateClasses; // classes of gates for abstraction
Vec_Int_t * vObjClasses; // classes of objects for abstraction Vec_Int_t * vObjClasses; // classes of objects for abstraction
Vec_Int_t * vInitClasses; // classes of flops for retiming/merging/etc Vec_Int_t * vInitClasses; // classes of flops for retiming/merging/etc
Vec_Int_t * vRegClasses; // classes of registers for sequential synthesis
Vec_Int_t * vDoms; // dominators Vec_Int_t * vDoms; // dominators
Vec_Int_t * vBarBufs; // barrier buffers Vec_Int_t * vBarBufs; // barrier buffers
unsigned char* pSwitching; // switching activity for each object unsigned char* pSwitching; // switching activity for each object
......
...@@ -571,12 +571,10 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -571,12 +571,10 @@ 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++;
nFlops = Gia_AigerReadInt(pCur); pCur += 4; assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
//assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4; pNew->vFlopClasses = Vec_IntStart( Gia_ManRegNum(pNew) );
pNew->vFlopClasses = Vec_IntStart( nFlops ); memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, 4*Gia_ManRegNum(pNew) ); pCur += 4*Gia_ManRegNum(pNew);
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
...@@ -654,6 +652,16 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS ...@@ -654,6 +652,16 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
pNew->pPlacement = pPlacement; pNew->pPlacement = pPlacement;
if ( fVerbose ) printf( "Finished reading extension \"p\".\n" ); if ( fVerbose ) printf( "Finished reading extension \"p\".\n" );
} }
// read register classes
else if ( *pCur == 'r' )
{
int nRegs;
pCur++;
nRegs = Gia_AigerReadInt(pCur); pCur += 4;
pNew->vRegClasses = Vec_IntStart( nRegs );
memcpy(Vec_IntArray(pNew->vRegClasses), pCur, 4*nRegs); pCur += 4*nRegs;
if ( fVerbose ) printf( "Finished reading extension \"r\".\n" );
}
// read choices // read choices
else if ( *pCur == 'q' ) else if ( *pCur == 'q' )
{ {
...@@ -1188,9 +1196,9 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int ...@@ -1188,9 +1196,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*Vec_IntSize(p->vFlopClasses) ); Gia_FileWriteBufferSize( pFile, 4*Gia_ManRegNum(p) );
//assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) ); assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Vec_IntSize(p->vFlopClasses), pFile ); fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Gia_ManRegNum(p), pFile );
} }
// write gate classes // write gate classes
if ( p->vGateClasses ) if ( p->vGateClasses )
...@@ -1241,6 +1249,13 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int ...@@ -1241,6 +1249,13 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) ); Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
fwrite( p->pPlacement, 1, 4*Gia_ManObjNum(p), pFile ); fwrite( p->pPlacement, 1, 4*Gia_ManObjNum(p), pFile );
} }
// write register classes
if ( p->vRegClasses )
{
fprintf( pFile, "r" );
Gia_FileWriteBufferSize( pFile, Vec_IntSize(p->vRegClasses) );
fwrite( Vec_IntArray(p->vRegClasses), 1, 4*Vec_IntSize(p->vRegClasses), pFile );
}
// write choices // write choices
if ( Gia_ManHasChoices(p) ) if ( Gia_ManHasChoices(p) )
{ {
......
...@@ -101,6 +101,7 @@ void Gia_ManStop( Gia_Man_t * p ) ...@@ -101,6 +101,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP( &p->vGateClasses ); Vec_IntFreeP( &p->vGateClasses );
Vec_IntFreeP( &p->vObjClasses ); Vec_IntFreeP( &p->vObjClasses );
Vec_IntFreeP( &p->vInitClasses ); Vec_IntFreeP( &p->vInitClasses );
Vec_IntFreeP( &p->vRegClasses );
Vec_IntFreeP( &p->vDoms ); Vec_IntFreeP( &p->vDoms );
Vec_IntFreeP( &p->vBarBufs ); Vec_IntFreeP( &p->vBarBufs );
Vec_IntFreeP( &p->vLevels ); Vec_IntFreeP( &p->vLevels );
...@@ -462,16 +463,14 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars ) ...@@ -462,16 +463,14 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Gia_ManPrintPlacement( p ); Gia_ManPrintPlacement( p );
// if ( p->pManTime ) // if ( p->pManTime )
// Tim_ManPrintStats( (Tim_Man_t *)p->pManTime, p->nAnd2Delay ); // Tim_ManPrintStats( (Tim_Man_t *)p->pManTime, p->nAnd2Delay );
// print register classes
if ( p->vFlopClasses && Gia_ManRegNum(p) == 0 )
{
printf( "The design has %d flops with the following class info: ", Vec_IntSize(p->vFlopClasses) );
Vec_IntPrint( p->vFlopClasses );
}
else
Gia_ManPrintFlopClasses( p ); Gia_ManPrintFlopClasses( p );
Gia_ManPrintGateClasses( p ); Gia_ManPrintGateClasses( p );
Gia_ManPrintObjClasses( p ); Gia_ManPrintObjClasses( p );
if ( p->vRegClasses )
{
printf( "The design has %d flops with the following class info: ", Vec_IntSize(p->vRegClasses) );
Vec_IntPrint( p->vRegClasses );
}
if ( p->vInitClasses ) if ( p->vInitClasses )
Gia_ManPrintInitClasses( p->vInitClasses ); Gia_ManPrintInitClasses( p->vInitClasses );
if ( pPars && pPars->fTents ) if ( pPars && pPars->fTents )
......
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