summaryrefslogtreecommitdiffstats
path: root/src/aig
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-11-21 11:11:12 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2014-11-21 11:11:12 -0800
commitcf2f9364c52110bf0c2132f1c3d68fde55abf081 (patch)
treecf7e14466748f1f366d0c96ca6ad5d57dd0fcd37 /src/aig
parentc339e5b98521fd1199d54d9c7dee02fc1f1968b9 (diff)
downloadabc-cf2f9364c52110bf0c2132f1c3d68fde55abf081.tar.gz
abc-cf2f9364c52110bf0c2132f1c3d68fde55abf081.tar.bz2
abc-cf2f9364c52110bf0c2132f1c3d68fde55abf081.zip
Fix in reading flop classes.
Diffstat (limited to 'src/aig')
-rw-r--r--src/aig/gia/gia.h1
-rw-r--r--src/aig/gia/giaAiger.c31
-rw-r--r--src/aig/gia/giaMan.c15
3 files changed, 31 insertions, 16 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index 3c5d3569..a8750afa 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -141,6 +141,7 @@ struct Gia_Man_t_
Vec_Int_t * vGateClasses; // classes of gates 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 * vRegClasses; // classes of registers for sequential synthesis
Vec_Int_t * vDoms; // dominators
Vec_Int_t * vBarBufs; // barrier buffers
unsigned char* pSwitching; // switching activity for each object
diff --git a/src/aig/gia/giaAiger.c b/src/aig/gia/giaAiger.c
index adaecb0f..645f0585 100644
--- a/src/aig/gia/giaAiger.c
+++ b/src/aig/gia/giaAiger.c
@@ -571,12 +571,10 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
// read flop classes
else if ( *pCur == 'f' )
{
- int nFlops;
pCur++;
- nFlops = Gia_AigerReadInt(pCur); pCur += 4;
- //assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
- pNew->vFlopClasses = Vec_IntStart( nFlops );
- memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, 4*nFlops ); pCur += 4*nFlops;
+ assert( Gia_AigerReadInt(pCur) == 4*Gia_ManRegNum(pNew) ); pCur += 4;
+ pNew->vFlopClasses = Vec_IntStart( Gia_ManRegNum(pNew) );
+ memcpy( Vec_IntArray(pNew->vFlopClasses), pCur, 4*Gia_ManRegNum(pNew) ); pCur += 4*Gia_ManRegNum(pNew);
if ( fVerbose ) printf( "Finished reading extension \"f\".\n" );
}
// read gate classes
@@ -654,6 +652,16 @@ Gia_Man_t * Gia_AigerReadFromMemory( char * pContents, int nFileSize, int fSkipS
pNew->pPlacement = pPlacement;
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
else if ( *pCur == 'q' )
{
@@ -1188,9 +1196,9 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
if ( p->vFlopClasses )
{
fprintf( pFile, "f" );
- Gia_FileWriteBufferSize( pFile, 4*Vec_IntSize(p->vFlopClasses) );
- //assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
- fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Vec_IntSize(p->vFlopClasses), pFile );
+ Gia_FileWriteBufferSize( pFile, 4*Gia_ManRegNum(p) );
+ assert( Vec_IntSize(p->vFlopClasses) == Gia_ManRegNum(p) );
+ fwrite( Vec_IntArray(p->vFlopClasses), 1, 4*Gia_ManRegNum(p), pFile );
}
// write gate classes
if ( p->vGateClasses )
@@ -1241,6 +1249,13 @@ void Gia_AigerWrite( Gia_Man_t * pInit, char * pFileName, int fWriteSymbols, int
Gia_FileWriteBufferSize( pFile, 4*Gia_ManObjNum(p) );
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
if ( Gia_ManHasChoices(p) )
{
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index 2a969432..c9836b96 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -101,6 +101,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP( &p->vGateClasses );
Vec_IntFreeP( &p->vObjClasses );
Vec_IntFreeP( &p->vInitClasses );
+ Vec_IntFreeP( &p->vRegClasses );
Vec_IntFreeP( &p->vDoms );
Vec_IntFreeP( &p->vBarBufs );
Vec_IntFreeP( &p->vLevels );
@@ -462,16 +463,14 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Gia_ManPrintPlacement( p );
// if ( p->pManTime )
// 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_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 )
Gia_ManPrintInitClasses( p->vInitClasses );
if ( pPars && pPars->fTents )