Commit f5069d66 by Alan Mishchenko

Code for profiling arithmetic circuits.

parent 5e4e815d
...@@ -5387,6 +5387,10 @@ SOURCE=.\src\proof\acec\acecRe.c ...@@ -5387,6 +5387,10 @@ SOURCE=.\src\proof\acec\acecRe.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\proof\acec\acecSt.c
# End Source File
# Begin Source File
SOURCE=.\src\proof\acec\acecUtil.c SOURCE=.\src\proof\acec\acecUtil.c
# End Source File # End Source File
# End Group # End Group
......
...@@ -109,13 +109,15 @@ void Gia_ObjComputeTruthTable6Lut_rec( Gia_Man_t * p, int iObj, Vec_Wrd_t * vTem ...@@ -109,13 +109,15 @@ void Gia_ObjComputeTruthTable6Lut_rec( Gia_Man_t * p, int iObj, Vec_Wrd_t * vTem
{ {
word uTruth0, uTruth1; word uTruth0, uTruth1;
Gia_Obj_t * pObj = Gia_ManObj( p, iObj ); Gia_Obj_t * pObj = Gia_ManObj( p, iObj );
if ( !Gia_ObjIsAnd(pObj) ) if ( Gia_ObjIsTravIdCurrentId(p, iObj) )
return; return;
Gia_ObjSetTravIdCurrentId(p, iObj);
assert( Gia_ObjIsAnd(pObj) );
Gia_ObjComputeTruthTable6Lut_rec( p, Gia_ObjFaninId0p(p, pObj), vTemp ); Gia_ObjComputeTruthTable6Lut_rec( p, Gia_ObjFaninId0p(p, pObj), vTemp );
Gia_ObjComputeTruthTable6Lut_rec( p, Gia_ObjFaninId1p(p, pObj), vTemp ); Gia_ObjComputeTruthTable6Lut_rec( p, Gia_ObjFaninId1p(p, pObj), vTemp );
uTruth0 = Vec_WrdEntry( vTemp, Gia_ObjFanin0(pObj)->Value ); uTruth0 = Vec_WrdEntry( vTemp, Gia_ObjFaninId0p(p, pObj) );
uTruth0 = Gia_ObjFaninC0(pObj) ? ~uTruth0 : uTruth0; uTruth0 = Gia_ObjFaninC0(pObj) ? ~uTruth0 : uTruth0;
uTruth1 = Vec_WrdEntry( vTemp, Gia_ObjFanin1(pObj)->Value ); uTruth1 = Vec_WrdEntry( vTemp, Gia_ObjFaninId1p(p, pObj) );
uTruth1 = Gia_ObjFaninC1(pObj) ? ~uTruth1 : uTruth1; uTruth1 = Gia_ObjFaninC1(pObj) ? ~uTruth1 : uTruth1;
Vec_WrdWriteEntry( vTemp, iObj, uTruth0 & uTruth1 ); Vec_WrdWriteEntry( vTemp, iObj, uTruth0 & uTruth1 );
} }
...@@ -124,8 +126,12 @@ word Gia_ObjComputeTruthTable6Lut( Gia_Man_t * p, int iObj, Vec_Wrd_t * vTemp ) ...@@ -124,8 +126,12 @@ word Gia_ObjComputeTruthTable6Lut( Gia_Man_t * p, int iObj, Vec_Wrd_t * vTemp )
int i, Fanin; int i, Fanin;
assert( Vec_WrdSize(vTemp) == Gia_ManObjNum(p) ); assert( Vec_WrdSize(vTemp) == Gia_ManObjNum(p) );
assert( Gia_ObjIsLut(p, iObj) ); assert( Gia_ObjIsLut(p, iObj) );
Gia_ManIncrementTravId( p );
Gia_LutForEachFanin( p, iObj, Fanin, i ) Gia_LutForEachFanin( p, iObj, Fanin, i )
{
Gia_ObjSetTravIdCurrentId( p, Fanin );
Vec_WrdWriteEntry( vTemp, Fanin, s_Truth6[i] ); Vec_WrdWriteEntry( vTemp, Fanin, s_Truth6[i] );
}
assert( i <= 6 ); assert( i <= 6 );
Gia_ObjComputeTruthTable6Lut_rec( p, iObj, vTemp ); Gia_ObjComputeTruthTable6Lut_rec( p, iObj, vTemp );
return Vec_WrdEntry( vTemp, iObj ); return Vec_WrdEntry( vTemp, iObj );
......
...@@ -28192,9 +28192,10 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28192,9 +28192,10 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
extern void Gia_ManMuxProfiling( Gia_Man_t * p ); extern void Gia_ManMuxProfiling( Gia_Man_t * p );
extern void Gia_ManProfileStructures( Gia_Man_t * p, int nLimit, int fVerbose ); extern void Gia_ManProfileStructures( Gia_Man_t * p, int nLimit, int fVerbose );
int c, fMuxes = 0, nLimit = 0, fVerbose = 0; extern void Acec_StatsCollect( Gia_Man_t * p, int fVerbose );
int c, fNpn = 0, fMuxes = 0, nLimit = 0, fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Nmvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "Nnmvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -28209,6 +28210,9 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28209,6 +28210,9 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( nLimit < 0 ) if ( nLimit < 0 )
goto usage; goto usage;
break; break;
case 'n':
fNpn ^= 1;
break;
case 'm': case 'm':
fMuxes ^= 1; fMuxes ^= 1;
break; break;
...@@ -28226,16 +28230,26 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -28226,16 +28230,26 @@ int Abc_CommandAbc9MuxProfile( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9MuxProfile(): There is no AIG.\n" ); Abc_Print( -1, "Abc_CommandAbc9MuxProfile(): There is no AIG.\n" );
return 1; return 1;
} }
if ( fMuxes ) if ( fNpn )
{
if ( !Gia_ManHasMapping(pAbc->pGia) || Gia_ManLutSizeMax(pAbc->pGia) >= 4 )
{
Abc_Print( -1, "Abc_CommandAbc9MuxProfile(): Expecting AIG mapped into 3-LUTs.\n" );
return 1;
}
Acec_StatsCollect( pAbc->pGia, fVerbose );
}
else if ( fMuxes )
Gia_ManMuxProfiling( pAbc->pGia ); Gia_ManMuxProfiling( pAbc->pGia );
else else
Gia_ManProfileStructures( pAbc->pGia, nLimit, fVerbose ); Gia_ManProfileStructures( pAbc->pGia, nLimit, fVerbose );
return 0; return 0;
usage: usage:
Abc_Print( -2, "usage: &profile [-N num] [-mvh]\n" ); Abc_Print( -2, "usage: &profile [-N num] [-nmvh]\n" );
Abc_Print( -2, "\t profile gate structures appearing in the AIG\n" ); Abc_Print( -2, "\t profile gate structures appearing in the AIG\n" );
Abc_Print( -2, "\t-N num : limit on class size to show [default = %d]\n", nLimit ); Abc_Print( -2, "\t-N num : limit on class size to show [default = %d]\n", nLimit );
Abc_Print( -2, "\t-n : toggle profiling NPN-classes (for 3-LUT mapped AIGs) [default = %s]\n", fNpn? "yes": "no" );
Abc_Print( -2, "\t-m : toggle profiling MUX structures [default = %s]\n", fMuxes? "yes": "no" ); Abc_Print( -2, "\t-m : toggle profiling MUX structures [default = %s]\n", fMuxes? "yes": "no" );
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
...@@ -6,4 +6,5 @@ SRC += src/proof/acec/acecCore.c \ ...@@ -6,4 +6,5 @@ SRC += src/proof/acec/acecCore.c \
src/proof/acec/acecFadds.c \ src/proof/acec/acecFadds.c \
src/proof/acec/acecOrder.c \ src/proof/acec/acecOrder.c \
src/proof/acec/acecPolyn.c \ src/proof/acec/acecPolyn.c \
src/proof/acec/acecSt.c \
src/proof/acec/acecUtil.c src/proof/acec/acecUtil.c
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