Commit 2edf2a97 by Alan Mishchenko

Improvements to power-aware mapping.

parent f79d8e4b
......@@ -199,6 +199,7 @@ struct Gps_Par_t_
int fLutProf;
int fMuxXor;
int fMiter;
int fSkipMap;
char * pDumpFile;
};
......
......@@ -430,10 +430,14 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
printf( "\nXOR/MUX " ), Gia_ManPrintMuxStats( p );
if ( pPars && pPars->fSwitch )
{
// if ( p->pSwitching )
// Abc_Print( 1, " power =%7.2f", Gia_ManEvaluateSwitching(p) );
// else
Abc_Print( 1, " power =%7.2f", Gia_ManComputeSwitching(p, 48, 16, 0) );
static int nPiPo = 0;
static float PrevSwiTotal = 0;
float SwiTotal = Gia_ManComputeSwitching( p, 48, 16, 0 );
Abc_Print( 1, " power =%8.1f", SwiTotal );
if ( PrevSwiTotal > 0 && nPiPo == Gia_ManCiNum(p) + Gia_ManCoNum(p) )
Abc_Print( 1, " %6.2f %%", 100.0*(PrevSwiTotal-SwiTotal)/PrevSwiTotal );
else if ( PrevSwiTotal == 0 || nPiPo != Gia_ManCiNum(p) + Gia_ManCoNum(p) )
PrevSwiTotal = SwiTotal, nPiPo = Gia_ManCiNum(p) + Gia_ManCoNum(p);
}
// Abc_Print( 1, "obj =%5d ", Gia_ManObjNum(p) );
Abc_Print( 1, "\n" );
......@@ -443,7 +447,7 @@ void Gia_ManPrintStats( Gia_Man_t * p, Gps_Par_t * pPars )
Gia_ManEquivPrintClasses( p, 0, 0.0 );
if ( p->pSibls )
Gia_ManPrintChoiceStats( p );
if ( Gia_ManHasMapping(p) )
if ( Gia_ManHasMapping(p) && (pPars == NULL || !pPars->fSkipMap) )
Gia_ManPrintMappingStats( p, pPars ? pPars->pDumpFile : NULL );
if ( pPars && pPars->fNpn && Gia_ManHasMapping(p) && Gia_ManLutSizeMax(p) <= 4 )
Gia_ManPrintNpnClasses( p );
......
......@@ -562,7 +562,7 @@ void Gia_ManMuxProfiling( Gia_Man_t * p )
// short the first ones
printf( "The first %d structures: \n", 10 );
Vec_WecForEachLevelStartStop( pMan->vTops, vVec, i, 1, 10 )
Vec_WecForEachLevelStartStop( pMan->vTops, vVec, i, 1, Abc_MinInt(Vec_WecSize(pMan->vTops), 10) )
{
char * pTemp = Abc_NamStr(pMan->pNames, i);
printf( "%5d : ", i );
......
......@@ -80,7 +80,7 @@ void Gia_ManSetDefaultParamsSwi( Gia_ParSwi_t * p )
p->nWords = 10; // the number of machine words of simulatation data
p->nIters = 48; // the number of all timeframes to simulate
p->nPref = 16; // the number of first timeframes to skip when computing switching
p->nRandPiFactor = 2; // primary input transition probability (-1=3/8; 0=1/2; 1=1/4; 2=1/8, etc)
p->nRandPiFactor = 0; // primary input transition probability (-1=3/8; 0=1/2; 1=1/4; 2=1/8, etc)
p->fProbOne = 0; // compute probability of signal being one (if 0, compute probability of switching)
p->fProbTrans = 1; // compute signal transition probability (if 0, compute transition probability using probability of being one)
p->fVerbose = 0; // enables verbose output
......@@ -740,6 +740,7 @@ float Gia_ManEvaluateSwitching( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
/*
float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne )
{
Gia_Man_t * pDfs;
......@@ -776,6 +777,27 @@ float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbO
Gia_ManStop( pDfs );
return SwitchTotal;
}
*/
float Gia_ManComputeSwitching( Gia_Man_t * p, int nFrames, int nPref, int fProbOne )
{
Vec_Int_t * vSwitching = Gia_ManComputeSwitchProbs( p, nFrames, nPref, fProbOne );
float * pSwi = (float *)Vec_IntArray(vSwitching), SwiTotal = 0;
Gia_Obj_t * pObj;
int i, k, iFan;
if ( Gia_ManHasMapping(p) )
{
Gia_ManForEachLut( p, i )
Gia_LutForEachFanin( p, i, iFan, k )
SwiTotal += pSwi[iFan];
}
else
{
Gia_ManForEachAnd( p, pObj, i )
SwiTotal += pSwi[Gia_ObjFaninId0(pObj, i)] + pSwi[Gia_ObjFaninId1(pObj, i)];
}
Vec_IntFree( vSwitching );
return SwiTotal;
}
/**Function*************************************************************
......
......@@ -25431,7 +25431,7 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
int c;
memset( pPars, 0, sizeof(Gps_Par_t) );
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Dtpcnlmah" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "Dtpcnlmash" ) ) != EOF )
{
switch ( c )
{
......@@ -25456,6 +25456,9 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'a':
pPars->fMiter ^= 1;
break;
case 's':
pPars->fSkipMap ^= 1;
break;
case 'D':
if ( globalUtilOptind >= argc )
{
......@@ -25480,7 +25483,7 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: &ps [-tpcnlmah] [-D file]\n" );
Abc_Print( -2, "usage: &ps [-tpcnlmash] [-D file]\n" );
Abc_Print( -2, "\t prints stats of the current AIG\n" );
Abc_Print( -2, "\t-t : toggle printing BMC tents [default = %s]\n", pPars->fTents? "yes": "no" );
Abc_Print( -2, "\t-p : toggle printing switching activity [default = %s]\n", pPars->fSwitch? "yes": "no" );
......@@ -25489,6 +25492,7 @@ usage:
Abc_Print( -2, "\t-l : toggle printing LUT size profile [default = %s]\n", pPars->fLutProf? "yes": "no" );
Abc_Print( -2, "\t-m : toggle printing MUX/XOR statistics [default = %s]\n", pPars->fMuxXor? "yes": "no" );
Abc_Print( -2, "\t-a : toggle printing miter statistics [default = %s]\n", pPars->fMiter? "yes": "no" );
Abc_Print( -2, "\t-s : skip mapping statistics even if mapped [default = %s]\n", pPars->fSkipMap? "yes": "no" );
Abc_Print( -2, "\t-D file : file name to dump statistics [default = none]\n" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
......@@ -25778,7 +25782,8 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( Gia_ManHasMapping(pAbc->pGia) )
{
pTemp = (Gia_Man_t *)Dsm_ManDeriveGia( pAbc->pGia, fAddMuxes );
printf( "Performed delay-oriented unmapping.\n" );
if ( !Abc_FrameReadFlag("silentmode") )
printf( "Performed delay-oriented unmapping.\n" );
}
else if ( fAddMuxes )
{
......@@ -25788,7 +25793,8 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
pTemp = Gia_ManDupMuxes( pAbc->pGia, Limit );
printf( "Generated AND/XOR/MUX graph.\n" );
if ( !Abc_FrameReadFlag("silentmode") )
printf( "Generated AND/XOR/MUX graph.\n" );
}
else if ( fCollapse && pAbc->pGia->pAigExtra )
{
......@@ -25797,17 +25803,20 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
pTemp = Gia_ManDupCollapse( pNew, pAbc->pGia->pAigExtra, NULL );
pNew->pManTime = NULL;
Gia_ManStop( pNew );
printf( "Collapsed AIG with boxes with logic of the boxes.\n" );
if ( !Abc_FrameReadFlag("silentmode") )
printf( "Collapsed AIG with boxes with logic of the boxes.\n" );
}
else if ( pAbc->pGia->pMuxes )
{
pTemp = Gia_ManDupNoMuxes( pAbc->pGia );
printf( "Generated AIG from AND/XOR/MUX graph.\n" );
if ( !Abc_FrameReadFlag("silentmode") )
printf( "Generated AIG from AND/XOR/MUX graph.\n" );
}
else
{
pTemp = Gia_ManRehash( pAbc->pGia, fAddStrash );
printf( "Rehashed the current AIG.\n" );
if ( !Abc_FrameReadFlag("silentmode") )
printf( "Rehashed the current AIG.\n" );
}
Abc_FrameUpdateGia( pAbc, pTemp );
return 0;
......@@ -1914,7 +1914,7 @@ int IoCommandWriteCnf( Abc_Frame_t * pAbc, int argc, char **argv )
usage:
fprintf( pAbc->Err, "usage: write_cnf [-nfpcvh] <file>\n" );
fprintf( pAbc->Err, "\t generated CNF for the miter (see also \"&write_cnf\")\n" );
fprintf( pAbc->Err, "\t generates CNF for the miter (see also \"&write_cnf\")\n" );
fprintf( pAbc->Err, "\t-n : toggle using new algorithm [default = %s]\n", fNewAlgo? "yes" : "no" );
fprintf( pAbc->Err, "\t-f : toggle using fast algorithm [default = %s]\n", fFastAlgo? "yes" : "no" );
fprintf( pAbc->Err, "\t-p : toggle using all primes to enhance implicativity [default = %s]\n", fAllPrimes? "yes" : "no" );
......
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