Commit ace34099 by Alan Mishchenko

Experiments with mapping.

parent c86a13f0
......@@ -3763,6 +3763,10 @@ SOURCE=.\src\aig\gia\giaJf.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaKf.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\gia\giaMan.c
# End Source File
# Begin Source File
......
......@@ -262,6 +262,7 @@ struct Jf_Par_t_
int fVeryVerbose;
int nLutSizeMax;
int nCutNumMax;
int nProcNumMax;
word Delay;
word Area;
word Edge;
......
......@@ -31,6 +31,7 @@ SRC += src/aig/gia/giaAig.c \
src/aig/gia/giaIso.c \
src/aig/gia/giaIso2.c \
src/aig/gia/giaJf.c \
src/aig/gia/giaKf.c \
src/aig/gia/giaMan.c \
src/aig/gia/giaMem.c \
src/aig/gia/giaMfs.c \
......
......@@ -374,6 +374,7 @@ static int Abc_CommandAbc9If ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandAbc9Iff ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9If2 ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Jf ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Kf ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Struct ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Trace ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAbc9Speedup ( Abc_Frame_t * pAbc, int argc, char ** argv );
......@@ -940,6 +941,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "ABC9", "&iff", Abc_CommandAbc9Iff, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&if2", Abc_CommandAbc9If2, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&jf", Abc_CommandAbc9Jf, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&kf", Abc_CommandAbc9Kf, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&struct", Abc_CommandAbc9Struct, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&trace", Abc_CommandAbc9Trace, 0 );
Cmd_CommandAdd( pAbc, "ABC9", "&speedup", Abc_CommandAbc9Speedup, 0 );
......@@ -30347,6 +30349,176 @@ usage:
return 1;
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Abc_CommandAbc9Kf( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern void Kf_ManSetDefaultPars( Jf_Par_t * pPars );
extern Gia_Man_t * Kf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars );
char Buffer[200];
Jf_Par_t Pars, * pPars = &Pars;
Gia_Man_t * pNew; int c;
Kf_ManSetDefaultPars( pPars );
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "KCRDWPaekmdcgvwh" ) ) != EOF )
{
switch ( c )
{
case 'K':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" );
goto usage;
}
pPars->nLutSize = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nLutSize < 2 || pPars->nLutSize > pPars->nLutSizeMax )
{
Abc_Print( -1, "LUT size %d is not supported.\n", pPars->nLutSize );
goto usage;
}
break;
case 'C':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-C\" should be followed by a positive integer.\n" );
goto usage;
}
pPars->nCutNum = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nCutNum < 1 || pPars->nCutNum > pPars->nCutNumMax )
{
Abc_Print( -1, "This number of cuts (%d) is not supported.\n", pPars->nCutNum );
goto usage;
}
break;
case 'R':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
goto usage;
}
pPars->nRounds = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nRounds < 0 )
goto usage;
break;
case 'D':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" );
goto usage;
}
pPars->DelayTarget = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->DelayTarget <= 0.0 )
goto usage;
break;
case 'W':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" );
goto usage;
}
pPars->nVerbLimit = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nVerbLimit < 0 )
goto usage;
break;
case 'P':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-P\" should be followed by a positive integer.\n" );
goto usage;
}
pPars->nProcNumMax = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( pPars->nProcNumMax < 0 )
goto usage;
break;
case 'a':
pPars->fAreaOnly ^= 1;
break;
case 'e':
pPars->fOptEdge ^= 1;
break;
case 'k':
pPars->fCoarsen ^= 1;
break;
case 'm':
pPars->fCutMin ^= 1;
break;
case 'd':
pPars->fFuncDsd ^= 1;
break;
case 'c':
pPars->fGenCnf ^= 1;
break;
case 'g':
pPars->fPureAig ^= 1;
break;
case 'v':
pPars->fVerbose ^= 1;
break;
case 'w':
pPars->fVeryVerbose ^= 1;
break;
case 'h':
default:
goto usage;
}
}
if ( pAbc->pGia == NULL )
{
Abc_Print( -1, "Empty GIA network.\n" );
return 1;
}
pNew = Kf_ManPerformMapping( pAbc->pGia, pPars );
if ( pNew == NULL )
{
Abc_Print( -1, "Abc_CommandAbc9Kf(): Mapping into LUTs has failed.\n" );
return 1;
}
Abc_FrameUpdateGia( pAbc, pNew );
return 0;
usage:
if ( pPars->DelayTarget == -1 )
sprintf(Buffer, "best possible" );
else
sprintf(Buffer, "%d", pPars->DelayTarget );
Abc_Print( -2, "usage: &kf [-KCRDWP num] [-akmdcgvwh]\n" );
Abc_Print( -2, "\t performs technology mapping of the network\n" );
Abc_Print( -2, "\t-K num : LUT size for the mapping (2 <= K <= %d) [default = %d]\n", pPars->nLutSizeMax, pPars->nLutSize );
Abc_Print( -2, "\t-C num : the max number of priority cuts (1 <= C <= %d) [default = %d]\n", pPars->nCutNumMax, pPars->nCutNum );
Abc_Print( -2, "\t-R num : the number of mapping rounds [default = %d]\n", pPars->nRounds );
Abc_Print( -2, "\t-D num : sets the delay constraint for the mapping [default = %s]\n", Buffer );
Abc_Print( -2, "\t-W num : min frequency when printing functions with \"-w\" [default = %d]\n", pPars->nVerbLimit );
Abc_Print( -2, "\t-P num : the number of cut computation processes [default = %d]\n", pPars->nProcNumMax );
Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fAreaOnly? "yes": "no" );
Abc_Print( -2, "\t-e : toggles edge vs node minimization [default = %s]\n", pPars->fOptEdge? "yes": "no" );
Abc_Print( -2, "\t-k : toggles coarsening the subject graph [default = %s]\n", pPars->fCoarsen? "yes": "no" );
Abc_Print( -2, "\t-m : toggles cut minimization [default = %s]\n", pPars->fCutMin? "yes": "no" );
Abc_Print( -2, "\t-d : toggles using DSD to represent cut functions [default = %s]\n", pPars->fFuncDsd? "yes": "no" );
Abc_Print( -2, "\t-c : toggles mapping for CNF generation [default = %s]\n", pPars->fGenCnf? "yes": "no" );
Abc_Print( -2, "\t-g : toggles generating AIG without mapping [default = %s]\n", pPars->fPureAig? "yes": "no" );
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : toggles very verbose output [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : prints the command usage\n");
return 1;
}
/**Function*************************************************************
......@@ -54,28 +54,6 @@ void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDs
Vec_IntPush( p->vCutData, iDsd );
// printf( "%6d %6d %6d %6d\n", iDsd0, iDsd1, nShared, iDsd );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline int Vec_IntCountUnique( Vec_Int_t * p )
{
int i, Count = 0, Max = Vec_IntFindMax(p);
unsigned char * pPres = ABC_CALLOC( unsigned char, Max+1 );
for ( i = 0; i < p->nSize; i++ )
if ( pPres[p->pArray[i]] == 0 )
pPres[p->pArray[i]] = 1, Count++;
ABC_FREE( pPres );
return Count;
}
/**Function*************************************************************
......
......@@ -395,6 +395,23 @@ static inline void Vec_FltAddToEntry( Vec_Flt_t * p, int i, float Addition )
SeeAlso []
***********************************************************************/
static inline void Vec_FltUpdateEntry( Vec_Flt_t * p, int i, float Value )
{
if ( Vec_FltEntry( p, i ) < Value )
Vec_FltWriteEntry( p, i, Value );
}
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
static inline float Vec_FltEntryLast( Vec_Flt_t * p )
{
return p->pArray[p->nSize-1];
......
......@@ -695,6 +695,12 @@ static inline void Vec_IntPush( Vec_Int_t * p, int Entry )
}
p->pArray[p->nSize++] = Entry;
}
static inline void Vec_IntPushArray( Vec_Int_t * p, int * pEntries, int nEntries )
{
int i;
for ( i = 0; i < nEntries; i++ )
Vec_IntPush( p, pEntries[i] );
}
/**Function*************************************************************
......@@ -1293,6 +1299,16 @@ static inline int Vec_IntCheckUniqueSmall( Vec_Int_t * p )
return 0;
return 1;
}
static inline int Vec_IntCountUnique( Vec_Int_t * p )
{
int i, Count = 0, Max = Vec_IntFindMax(p);
unsigned char * pPres = ABC_CALLOC( unsigned char, Max+1 );
for ( i = 0; i < p->nSize; i++ )
if ( pPres[p->pArray[i]] == 0 )
pPres[p->pArray[i]] = 1, Count++;
ABC_FREE( pPres );
return Count;
}
/**Function*************************************************************
......
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