Commit 1b550cb8 by Alan Mishchenko

Improved algo for edge computation.

parent 813b0e58
...@@ -4363,6 +4363,10 @@ SOURCE=.\src\aig\gia\giaRex.c ...@@ -4363,6 +4363,10 @@ SOURCE=.\src\aig\gia\giaRex.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\gia\giaSatEdge.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaSatLut.c SOURCE=.\src\aig\gia\giaSatLut.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -1299,7 +1299,7 @@ extern void Gia_ManPrintLutStats( Gia_Man_t * p ); ...@@ -1299,7 +1299,7 @@ extern void Gia_ManPrintLutStats( Gia_Man_t * p );
extern int Gia_ManLutFaninCount( Gia_Man_t * p ); extern int Gia_ManLutFaninCount( Gia_Man_t * p );
extern int Gia_ManLutSizeMax( Gia_Man_t * p ); extern int Gia_ManLutSizeMax( Gia_Man_t * p );
extern int Gia_ManLutNum( Gia_Man_t * p ); extern int Gia_ManLutNum( Gia_Man_t * p );
extern int Gia_ManLutLevel( Gia_Man_t * p ); extern int Gia_ManLutLevel( Gia_Man_t * p, int ** ppLevels );
extern void Gia_ManLutParams( Gia_Man_t * p, int * pnCurLuts, int * pnCurEdges, int * pnCurLevels ); extern void Gia_ManLutParams( Gia_Man_t * p, int * pnCurLuts, int * pnCurEdges, int * pnCurLevels );
extern void Gia_ManSetRefsMapped( Gia_Man_t * p ); extern void Gia_ManSetRefsMapped( Gia_Man_t * p );
extern void Gia_ManSetLutRefs( Gia_Man_t * p ); extern void Gia_ManSetLutRefs( Gia_Man_t * p );
......
...@@ -71,7 +71,7 @@ static inline void Gia_ObjEdgeClean( int iObj, Vec_Int_t * vEdge1, Vec_Int_t * v ...@@ -71,7 +71,7 @@ static inline void Gia_ObjEdgeClean( int iObj, Vec_Int_t * vEdge1, Vec_Int_t * v
***********************************************************************/ ***********************************************************************/
void Gia_ManEdgeFromArray( Gia_Man_t * p, Vec_Int_t * vArray ) void Gia_ManEdgeFromArray( Gia_Man_t * p, Vec_Int_t * vArray )
{ {
int i, iObj1, iObj2; int i, iObj1, iObj2, Count = 0;
Vec_IntFreeP( &p->vEdge1 ); Vec_IntFreeP( &p->vEdge1 );
Vec_IntFreeP( &p->vEdge2 ); Vec_IntFreeP( &p->vEdge2 );
p->vEdge1 = Vec_IntStart( Gia_ManObjNum(p) ); p->vEdge1 = Vec_IntStart( Gia_ManObjNum(p) );
...@@ -79,9 +79,11 @@ void Gia_ManEdgeFromArray( Gia_Man_t * p, Vec_Int_t * vArray ) ...@@ -79,9 +79,11 @@ void Gia_ManEdgeFromArray( Gia_Man_t * p, Vec_Int_t * vArray )
Vec_IntForEachEntryDouble( vArray, iObj1, iObj2, i ) Vec_IntForEachEntryDouble( vArray, iObj1, iObj2, i )
{ {
assert( iObj1 < iObj2 ); assert( iObj1 < iObj2 );
Gia_ObjEdgeAdd( iObj1, iObj2, p->vEdge1, p->vEdge2 ); Count += Gia_ObjEdgeAdd( iObj1, iObj2, p->vEdge1, p->vEdge2 );
Gia_ObjEdgeAdd( iObj2, iObj1, p->vEdge1, p->vEdge2 ); Count += Gia_ObjEdgeAdd( iObj2, iObj1, p->vEdge1, p->vEdge2 );
} }
if ( Count )
printf( "Found %d violations during edge conversion.\n", Count );
} }
Vec_Int_t * Gia_ManEdgeToArray( Gia_Man_t * p ) Vec_Int_t * Gia_ManEdgeToArray( Gia_Man_t * p )
{ {
......
...@@ -160,7 +160,7 @@ int Gia_ManLutNum( Gia_Man_t * p ) ...@@ -160,7 +160,7 @@ int Gia_ManLutNum( Gia_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Gia_ManLutLevel( Gia_Man_t * p ) int Gia_ManLutLevel( Gia_Man_t * p, int ** ppLevels )
{ {
Gia_Obj_t * pObj; Gia_Obj_t * pObj;
int i, k, iFan, Level; int i, k, iFan, Level;
...@@ -177,7 +177,10 @@ int Gia_ManLutLevel( Gia_Man_t * p ) ...@@ -177,7 +177,10 @@ int Gia_ManLutLevel( Gia_Man_t * p )
Gia_ManForEachCo( p, pObj, k ) Gia_ManForEachCo( p, pObj, k )
if ( Level < pLevels[Gia_ObjFaninId0p(p, pObj)] ) if ( Level < pLevels[Gia_ObjFaninId0p(p, pObj)] )
Level = pLevels[Gia_ObjFaninId0p(p, pObj)]; Level = pLevels[Gia_ObjFaninId0p(p, pObj)];
ABC_FREE( pLevels ); if ( ppLevels )
*ppLevels = pLevels;
else
ABC_FREE( pLevels );
return Level; return Level;
} }
......
...@@ -453,7 +453,7 @@ float Gia_ManDelayTraceLutPrint( Gia_Man_t * p, int fVerbose ) ...@@ -453,7 +453,7 @@ float Gia_ManDelayTraceLutPrint( Gia_Man_t * p, int fVerbose )
return -ABC_INFINITY; return -ABC_INFINITY;
} }
// decide how many steps // decide how many steps
nSteps = pLutLib ? 20 : Gia_ManLutLevel(p); nSteps = pLutLib ? 20 : Gia_ManLutLevel(p, NULL);
pCounters = ABC_ALLOC( int, nSteps + 1 ); pCounters = ABC_ALLOC( int, nSteps + 1 );
memset( pCounters, 0, sizeof(int)*(nSteps + 1) ); memset( pCounters, 0, sizeof(int)*(nSteps + 1) );
// perform delay trace // perform delay trace
......
...@@ -56,6 +56,7 @@ SRC += src/aig/gia/giaAig.c \ ...@@ -56,6 +56,7 @@ SRC += src/aig/gia/giaAig.c \
src/aig/gia/giaResub.c \ src/aig/gia/giaResub.c \
src/aig/gia/giaRetime.c \ src/aig/gia/giaRetime.c \
src/aig/gia/giaRex.c \ src/aig/gia/giaRex.c \
src/aig/gia/giaSatEdge.c \
src/aig/gia/giaSatLut.c \ src/aig/gia/giaSatLut.c \
src/aig/gia/giaSatMap.c \ src/aig/gia/giaSatMap.c \
src/aig/gia/giaScl.c \ src/aig/gia/giaScl.c \
......
...@@ -34850,12 +34850,23 @@ usage: ...@@ -34850,12 +34850,23 @@ usage:
int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv ) int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern int Edg_ManAssignEdgeNew( Gia_Man_t * p, int nEdges, int fVerbose ); extern int Edg_ManAssignEdgeNew( Gia_Man_t * p, int nEdges, int fVerbose );
extern void Seg_ManComputeDelay( Gia_Man_t * pGia, int Delay, int fTwo, int fVerbose );
int c, DelayMax = 0, nEdges = 1, fReverse = 0, fUsePack = 0, fUseOld = 0, fVerbose = 0; int c, DelayMax = 0, nEdges = 1, fReverse = 0, fUsePack = 0, fUseOld = 0, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Erpovh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "DErpovh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
case 'D':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" );
goto usage;
}
DelayMax = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
break;
case 'E': case 'E':
if ( globalUtilOptind >= argc ) if ( globalUtilOptind >= argc )
{ {
...@@ -34912,6 +34923,11 @@ int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -34912,6 +34923,11 @@ int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_ManConvertPackingToEdges( pAbc->pGia ); Gia_ManConvertPackingToEdges( pAbc->pGia );
return 0; return 0;
} }
if ( DelayMax )
{
Seg_ManComputeDelay( pAbc->pGia, DelayMax, nEdges==2, fVerbose );
return 0;
}
if ( !fUseOld ) if ( !fUseOld )
{ {
if ( pAbc->pGia->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t*)pAbc->pGia->pManTime) ) if ( pAbc->pGia->pManTime != NULL && Tim_ManBoxNum((Tim_Man_t*)pAbc->pGia->pManTime) )
...@@ -34935,8 +34951,9 @@ int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -34935,8 +34951,9 @@ int Abc_CommandAbc9Edge( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: &edge [-E num] [-rpovh]\n" ); Abc_Print( -2, "usage: &edge [-DE num] [-rpovh]\n" );
Abc_Print( -2, "\t find edge assignment of the LUT-mapped network\n" ); Abc_Print( -2, "\t find edge assignment of the LUT-mapped network\n" );
Abc_Print( -2, "\t-D num : the upper bound on delay [default = %d]\n", DelayMax );
Abc_Print( -2, "\t-E num : the limit on the number of edges (1 <= num <= 2) [default = %d]\n", nEdges ); Abc_Print( -2, "\t-E num : the limit on the number of edges (1 <= num <= 2) [default = %d]\n", nEdges );
Abc_Print( -2, "\t-r : toggles using reverse order [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-r : toggles using reverse order [default = %s]\n", fReverse? "yes": "no" );
Abc_Print( -2, "\t-p : toggles deriving edges from packing [default = %s]\n", fUsePack? "yes": "no" ); Abc_Print( -2, "\t-p : toggles deriving edges from packing [default = %s]\n", fUsePack? "yes": "no" );
...@@ -40922,6 +40939,7 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -40922,6 +40939,7 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
// Gia_ManCheckFalseTest( pAbc->pGia, nFrames ); // Gia_ManCheckFalseTest( pAbc->pGia, nFrames );
// Gia_ParTest( pAbc->pGia, nWords, nProcs ); // Gia_ParTest( pAbc->pGia, nWords, nProcs );
Gia_Iso3Test( pAbc->pGia ); Gia_Iso3Test( pAbc->pGia );
// printf( "\nThis command is currently disabled.\n\n" ); // printf( "\nThis command is currently disabled.\n\n" );
return 0; return 0;
usage: usage:
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