Commit 6537f941 by Alan Mishchenko

Version abc80126

parent 6c68b76b
...@@ -23,8 +23,8 @@ MODULES := src/base/abc src/base/abci src/base/cmd \ ...@@ -23,8 +23,8 @@ MODULES := src/base/abc src/base/abci src/base/cmd \
default: $(PROG) default: $(PROG)
#OPTFLAGS := -DNDEBUG -O3 OPTFLAGS := -DNDEBUG -O3
OPTFLAGS := -g -O #OPTFLAGS := -g -O
CFLAGS += -Wall -Wno-unused-function $(OPTFLAGS) $(patsubst %, -I%, $(MODULES)) CFLAGS += -Wall -Wno-unused-function $(OPTFLAGS) $(patsubst %, -I%, $(MODULES))
CXXFLAGS += $(CFLAGS) CXXFLAGS += $(CFLAGS)
......
...@@ -1608,6 +1608,10 @@ SOURCE=.\src\opt\fret\fretInit.c ...@@ -1608,6 +1608,10 @@ SOURCE=.\src\opt\fret\fretInit.c
SOURCE=.\src\opt\fret\fretMain.c SOURCE=.\src\opt\fret\fretMain.c
# End Source File # End Source File
# Begin Source File
SOURCE=.\src\opt\fret\fretTime.c
# End Source File
# End Group # End Group
# End Group # End Group
# Begin Group "map" # Begin Group "map"
...@@ -2854,6 +2858,10 @@ SOURCE=.\src\aig\aig\aigCheck.c ...@@ -2854,6 +2858,10 @@ SOURCE=.\src\aig\aig\aigCheck.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\aig\aig\aigCuts.c
# End Source File
# Begin Source File
SOURCE=.\src\aig\aig\aigDfs.c SOURCE=.\src\aig\aig\aigDfs.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -137,6 +137,7 @@ struct Aig_Man_t_ ...@@ -137,6 +137,7 @@ struct Aig_Man_t_
void (*pImpFunc) (void*, void*); // implication checking precedure void (*pImpFunc) (void*, void*); // implication checking precedure
void * pImpData; // implication checking data void * pImpData; // implication checking data
void * pManTime; // the timing manager void * pManTime; // the timing manager
void * pManCuts;
Vec_Ptr_t * vMapped; Vec_Ptr_t * vMapped;
Vec_Int_t * vFlopNums; Vec_Int_t * vFlopNums;
void * pSeqModel; void * pSeqModel;
...@@ -146,6 +147,56 @@ struct Aig_Man_t_ ...@@ -146,6 +147,56 @@ struct Aig_Man_t_
int time2; int time2;
}; };
// cut computation
typedef struct Aig_ManCut_t_ Aig_ManCut_t;
typedef struct Aig_Cut_t_ Aig_Cut_t;
// the cut used to represent node in the AIG
struct Aig_Cut_t_
{
Aig_Cut_t * pNext; // the next cut in the table
int Cost; // the cost of the cut
unsigned uSign; // cut signature
int iNode; // the node, for which it is the cut
short nCutSize; // the number of bytes in the cut
char nLeafMax; // the maximum number of fanins
char nFanins; // the current number of fanins
int pFanins[0]; // the fanins (followed by the truth table)
};
// the CNF computation manager
struct Aig_ManCut_t_
{
// AIG manager
Aig_Man_t * pAig; // the input AIG manager
Aig_Cut_t ** pCuts; // the cuts for each node in the output manager
// parameters
int nCutsMax; // the max number of cuts at the node
int nLeafMax; // the max number of leaves of a cut
int fTruth; // enables truth table computation
int fVerbose; // enables verbose output
// internal variables
int nCutSize; // the number of bytes needed to store one cut
int nTruthWords; // the number of truth table words
Aig_MmFixed_t * pMemCuts; // memory manager for cuts
unsigned * puTemp[4]; // used for the truth table computation
};
static inline Aig_Cut_t * Aig_ObjCuts( Aig_ManCut_t * p, Aig_Obj_t * pObj ) { return p->pCuts[pObj->Id]; }
static inline void Aig_ObjSetCuts( Aig_ManCut_t * p, Aig_Obj_t * pObj, Aig_Cut_t * pCuts ) { p->pCuts[pObj->Id] = pCuts; }
static inline int Aig_CutLeaveNum( Aig_Cut_t * pCut ) { return pCut->nFanins; }
static inline int * Aig_CutLeaves( Aig_Cut_t * pCut ) { return pCut->pFanins; }
static inline unsigned * Aig_CutTruth( Aig_Cut_t * pCut ) { return (unsigned *)(pCut->pFanins + pCut->nLeafMax); }
static inline Aig_Cut_t * Aig_CutNext( Aig_Cut_t * pCut ) { return (Aig_Cut_t *)(((char *)pCut) + pCut->nCutSize); }
// iterator over cuts of the node
#define Aig_ObjForEachCut( p, pObj, pCut, i ) \
for ( i = 0, pCut = Aig_ObjCuts(p, pObj); i < p->nCutsMax; i++, pCut = Aig_CutNext(pCut) )
// iterator over leaves of the cut
#define Aig_CutForEachLeaf( p, pCut, pLeaf, i ) \
for ( i = 0; (i < (int)(pCut)->nFanins) && ((pLeaf) = Aig_ManObj(p, (pCut)->pFanins[i])); i++ )
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS /// /// MACRO DEFINITIONS ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
...@@ -386,6 +437,9 @@ static inline int Aig_ObjFanoutNext( Aig_Man_t * p, int iFan ) { assert(iF ...@@ -386,6 +437,9 @@ static inline int Aig_ObjFanoutNext( Aig_Man_t * p, int iFan ) { assert(iF
extern int Aig_ManCheck( Aig_Man_t * p ); extern int Aig_ManCheck( Aig_Man_t * p );
extern void Aig_ManCheckMarkA( Aig_Man_t * p ); extern void Aig_ManCheckMarkA( Aig_Man_t * p );
extern void Aig_ManCheckPhase( Aig_Man_t * p ); extern void Aig_ManCheckPhase( Aig_Man_t * p );
/*=== aigCuts.c ========================================================*/
extern Aig_ManCut_t * Aig_ComputeCuts( Aig_Man_t * pAig, int nCutsMax, int nLeafMax, int fTruth, int fVerbose );
extern void Aig_ManCutStop( Aig_ManCut_t * p );
/*=== aigDfs.c ==========================================================*/ /*=== aigDfs.c ==========================================================*/
extern Vec_Ptr_t * Aig_ManDfs( Aig_Man_t * p ); extern Vec_Ptr_t * Aig_ManDfs( Aig_Man_t * p );
extern Vec_Ptr_t * Aig_ManDfsPio( Aig_Man_t * p ); extern Vec_Ptr_t * Aig_ManDfsPio( Aig_Man_t * p );
......
...@@ -57,7 +57,7 @@ Cnf_Dat_t * Cnf_Derive( Aig_Man_t * pAig, int nOutputs ) ...@@ -57,7 +57,7 @@ Cnf_Dat_t * Cnf_Derive( Aig_Man_t * pAig, int nOutputs )
// generate cuts for all nodes, assign cost, and find best cuts // generate cuts for all nodes, assign cost, and find best cuts
clk = clock(); clk = clock();
pMemCuts = Dar_ManComputeCuts( pAig, 10 ); pMemCuts = Dar_ManComputeCuts( pAig, 10, 0 );
p->timeCuts = clock() - clk; p->timeCuts = clock() - clk;
// find the mapping // find the mapping
......
...@@ -83,7 +83,7 @@ extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * p, int fUpdateLevel ); ...@@ -83,7 +83,7 @@ extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * p, int fUpdateLevel );
/*=== darCore.c ========================================================*/ /*=== darCore.c ========================================================*/
extern void Dar_ManDefaultRwrParams( Dar_RwrPar_t * pPars ); extern void Dar_ManDefaultRwrParams( Dar_RwrPar_t * pPars );
extern int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars ); extern int Dar_ManRewrite( Aig_Man_t * pAig, Dar_RwrPar_t * pPars );
extern Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax ); extern Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax, int fVerbose );
/*=== darRefact.c ========================================================*/ /*=== darRefact.c ========================================================*/
extern void Dar_ManDefaultRefParams( Dar_RefPar_t * pPars ); extern void Dar_ManDefaultRefParams( Dar_RefPar_t * pPars );
extern int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars ); extern int Dar_ManRefactor( Aig_Man_t * pAig, Dar_RefPar_t * pPars );
......
...@@ -195,6 +195,34 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval; ...@@ -195,6 +195,34 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
/**Function************************************************************* /**Function*************************************************************
Synopsis [Computes the total number of cuts.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int Dar_ManCutCount( Aig_Man_t * pAig, int * pnCutsK )
{
Dar_Cut_t * pCut;
Aig_Obj_t * pObj;
int i, k, nCuts = 0, nCutsK = 0;
Aig_ManForEachNode( pAig, pObj, i )
Dar_ObjForEachCut( pObj, pCut, k )
{
nCuts++;
if ( pCut->nLeaves == 4 )
nCutsK++;
}
if ( pnCutsK )
*pnCutsK = nCutsK;
return nCuts;
}
/**Function*************************************************************
Synopsis [] Synopsis []
Description [] Description []
...@@ -204,13 +232,13 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval; ...@@ -204,13 +232,13 @@ p->timeOther = p->timeTotal - p->timeCuts - p->timeEval;
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax ) Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax, int fVerbose )
{ {
Dar_Man_t * p; Dar_Man_t * p;
Dar_RwrPar_t Pars, * pPars = &Pars; Dar_RwrPar_t Pars, * pPars = &Pars;
Aig_Obj_t * pObj; Aig_Obj_t * pObj;
Aig_MmFixed_t * pMemCuts; Aig_MmFixed_t * pMemCuts;
int i, nNodes; int i, nNodes, clk = clock();
// remove dangling nodes // remove dangling nodes
if ( (nNodes = Aig_ManCleanup( pAig )) ) if ( (nNodes = Aig_ManCleanup( pAig )) )
{ {
...@@ -226,6 +254,23 @@ Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax ) ...@@ -226,6 +254,23 @@ Aig_MmFixed_t * Dar_ManComputeCuts( Aig_Man_t * pAig, int nCutsMax )
// compute cuts for each nodes in the topological order // compute cuts for each nodes in the topological order
Aig_ManForEachNode( pAig, pObj, i ) Aig_ManForEachNode( pAig, pObj, i )
Dar_ObjComputeCuts( p, pObj ); Dar_ObjComputeCuts( p, pObj );
// print verbose stats
if ( fVerbose )
{
// Aig_Obj_t * pObj;
int nCuts, nCutsK;//, i;
nCuts = Dar_ManCutCount( pAig, &nCutsK );
printf( "Nodes = %6d. Total cuts = %6d. 4-input cuts = %6d.\n",
Aig_ManObjNum(pAig), nCuts, nCutsK );
printf( "Cut size = %2d. Truth size = %2d. Total mem = %5.2f Mb ",
sizeof(Dar_Cut_t), 4, 1.0*Aig_MmFixedReadMemUsage(p->pMemCuts)/(1<<20) );
PRT( "Runtime", clock() - clk );
/*
Aig_ManForEachNode( pAig, pObj, i )
if ( i % 300 == 0 )
Dar_ObjCutPrint( pAig, pObj );
*/
}
// free the cuts // free the cuts
pMemCuts = p->pMemCuts; pMemCuts = p->pMemCuts;
p->pMemCuts = NULL; p->pMemCuts = NULL;
......
...@@ -30,6 +30,47 @@ ...@@ -30,6 +30,47 @@
/**Function************************************************************* /**Function*************************************************************
Synopsis [Prints one cut.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Dar_CutPrint( Dar_Cut_t * pCut )
{
unsigned i;
printf( "{" );
for ( i = 0; i < pCut->nLeaves; i++ )
printf( " %d", pCut->pLeaves[i] );
printf( " }\n" );
}
/**Function*************************************************************
Synopsis [Prints one cut.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Dar_ObjCutPrint( Aig_Man_t * p, Aig_Obj_t * pObj )
{
Dar_Cut_t * pCut;
int i;
printf( "Cuts for node %d:\n", pObj->Id );
Dar_ObjForEachCut( pObj, pCut, i )
Dar_CutPrint( pCut );
// printf( "\n" );
}
/**Function*************************************************************
Synopsis [Returns the number of 1s in the machine word.] Synopsis [Returns the number of 1s in the machine word.]
Description [] Description []
......
...@@ -134,6 +134,7 @@ extern void Dar_ManCutsStart( Dar_Man_t * p ); ...@@ -134,6 +134,7 @@ extern void Dar_ManCutsStart( Dar_Man_t * p );
extern void Dar_ManCutsFree( Dar_Man_t * p ); extern void Dar_ManCutsFree( Dar_Man_t * p );
extern Dar_Cut_t * Dar_ObjComputeCuts_rec( Dar_Man_t * p, Aig_Obj_t * pObj ); extern Dar_Cut_t * Dar_ObjComputeCuts_rec( Dar_Man_t * p, Aig_Obj_t * pObj );
extern Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Aig_Obj_t * pObj ); extern Dar_Cut_t * Dar_ObjComputeCuts( Dar_Man_t * p, Aig_Obj_t * pObj );
extern void Dar_ObjCutPrint( Aig_Man_t * p, Aig_Obj_t * pObj );
/*=== darData.c ===========================================================*/ /*=== darData.c ===========================================================*/
extern Vec_Int_t * Dar_LibReadNodes(); extern Vec_Int_t * Dar_LibReadNodes();
extern Vec_Int_t * Dar_LibReadOuts(); extern Vec_Int_t * Dar_LibReadOuts();
......
Comparing files abcDfs.c and C:\_PROJECTS\AARON\FRETIME\SRC\BASE\ABC\ABCDFS.C
***** abcDfs.c
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) );
// if this node is already visited, return
***** C:\_PROJECTS\AARON\FRETIME\SRC\BASE\ABC\ABCDFS.C
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) || pNode->Type == ABC_OBJ_CONST1);
// if this node is already visited, return
*****
***** abcDfs.c
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) );
// if this node is already visited, return
***** C:\_PROJECTS\AARON\FRETIME\SRC\BASE\ABC\ABCDFS.C
return pNode->Level;
assert( Abc_ObjIsNode( pNode ) || pNode->Type == ABC_OBJ_CONST1);
// if this node is already visited, return
*****
...@@ -908,7 +908,7 @@ int Abc_NtkLevel_rec( Abc_Obj_t * pNode ) ...@@ -908,7 +908,7 @@ int Abc_NtkLevel_rec( Abc_Obj_t * pNode )
// skip the PI // skip the PI
if ( Abc_ObjIsCi(pNode) ) if ( Abc_ObjIsCi(pNode) )
return pNode->Level; return pNode->Level;
assert( Abc_ObjIsNode( pNode ) ); assert( Abc_ObjIsNode( pNode ) || pNode->Type == ABC_OBJ_CONST1);
// if this node is already visited, return // if this node is already visited, return
if ( Abc_NodeIsTravIdCurrent( pNode ) ) if ( Abc_NodeIsTravIdCurrent( pNode ) )
return pNode->Level; return pNode->Level;
...@@ -946,7 +946,7 @@ int Abc_NtkLevelReverse_rec( Abc_Obj_t * pNode ) ...@@ -946,7 +946,7 @@ int Abc_NtkLevelReverse_rec( Abc_Obj_t * pNode )
// skip the PI // skip the PI
if ( Abc_ObjIsCo(pNode) ) if ( Abc_ObjIsCo(pNode) )
return pNode->Level; return pNode->Level;
assert( Abc_ObjIsNode( pNode ) ); assert( Abc_ObjIsNode( pNode ) || pNode->Type == ABC_OBJ_CONST1);
// if this node is already visited, return // if this node is already visited, return
if ( Abc_NodeIsTravIdCurrent( pNode ) ) if ( Abc_NodeIsTravIdCurrent( pNode ) )
return pNode->Level; return pNode->Level;
......
...@@ -6392,8 +6392,8 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -6392,8 +6392,8 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv )
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
// printf( "This command is temporarily disabled.\n" ); printf( "This command is temporarily disabled.\n" );
// return 0; return 0;
// set defaults // set defaults
fVeryVerbose = 0; fVeryVerbose = 0;
...@@ -13402,27 +13402,37 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13402,27 +13402,37 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv )
int nFrames; int nFrames;
int nPref; int nPref;
int nClauses; int nClauses;
int nLutSize;
int nLevels;
int nCutsMax;
int nBatches;
int fStepUp;
int fBmc; int fBmc;
int fRegs; int fRegs;
int fVerbose; int fVerbose;
int fVeryVerbose; int fVeryVerbose;
int c; int c;
extern int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int fBmc, int fRegs, int fVerbose, int fVeryVerbose ); extern int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int nLutSize, int nLevels, int nCutsMax, int nBatches, int fStepUp, int fBmc, int fRegs, int fVerbose, int fVeryVerbose );
pNtk = Abc_FrameReadNtk(pAbc); pNtk = Abc_FrameReadNtk(pAbc);
pOut = Abc_FrameReadOut(pAbc); pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc); pErr = Abc_FrameReadErr(pAbc);
// set defaults // set defaults
nFrames = 1; nFrames = 1;
nPref = 0; nPref = 0;
nClauses = 5000; nClauses = 5000;
fBmc = 1; nLutSize = 4;
fRegs = 1; nLevels = 8;
fVerbose = 0; nCutsMax = 16;
fVeryVerbose = 0; nBatches = 1;
fStepUp = 0;
fBmc = 1;
fRegs = 1;
fVerbose = 0;
fVeryVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "FPCbrvwh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "FPCMLNBsbrvwh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -13459,6 +13469,53 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13459,6 +13469,53 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( nClauses < 0 ) if ( nClauses < 0 )
goto usage; goto usage;
break; break;
case 'M':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" );
goto usage;
}
nLutSize = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nLutSize < 0 )
goto usage;
break;
case 'L':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" );
goto usage;
}
nLevels = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nLevels < 0 )
goto usage;
break;
case 'N':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" );
goto usage;
}
nCutsMax = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nCutsMax < 0 )
goto usage;
break;
case 'B':
if ( globalUtilOptind >= argc )
{
fprintf( pErr, "Command line switch \"-B\" should be followed by an integer.\n" );
goto usage;
}
nBatches = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( nBatches < 0 )
goto usage;
break;
case 's':
fStepUp ^= 1;
break;
case 'b': case 'b':
fBmc ^= 1; fBmc ^= 1;
break; break;
...@@ -13492,14 +13549,24 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -13492,14 +13549,24 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv )
fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); fprintf( stdout, "Currently only works for structurally hashed circuits.\n" );
return 0; return 0;
} }
Abc_NtkDarClau( pNtk, nFrames, nPref, nClauses, fBmc, fRegs, fVerbose, fVeryVerbose ); if ( nLutSize > 12 )
{
fprintf( stdout, "The cut size should be not exceed 12.\n" );
return 0;
}
Abc_NtkDarClau( pNtk, nFrames, nPref, nClauses, nLutSize, nLevels, nCutsMax, nBatches, fStepUp, fBmc, fRegs, fVerbose, fVeryVerbose );
return 0; return 0;
usage: usage:
fprintf( pErr, "usage: indcut [-F num] [-P num] [-C num] [-bvh]\n" ); fprintf( pErr, "usage: indcut [-FPCMLNB num] [-bvh]\n" );
fprintf( pErr, "\t K-step induction strengthened with cut properties\n" ); fprintf( pErr, "\t K-step induction strengthened with cut properties\n" );
fprintf( pErr, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", nFrames ); fprintf( pErr, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", nFrames );
fprintf( pErr, "\t-P num : number of time frames in the prefix (0=no prefix) [default = %d]\n", nPref ); fprintf( pErr, "\t-P num : number of time frames in the prefix (0=no prefix) [default = %d]\n", nPref );
fprintf( pErr, "\t-C num : the max number of clauses to use for strengthening [default = %d]\n", nClauses ); fprintf( pErr, "\t-C num : the max number of clauses to use for strengthening [default = %d]\n", nClauses );
fprintf( pErr, "\t-M num : the cut size (2 <= M <= 12) [default = %d]\n", nLutSize );
fprintf( pErr, "\t-L num : the max number of levels for cut computation [default = %d]\n", nLevels );
fprintf( pErr, "\t-N num : the max number of cuts to compute at a node [default = %d]\n", nCutsMax );
fprintf( pErr, "\t-B num : the max number of invariant batches to try [default = %d]\n", nBatches );
fprintf( pErr, "\t-s : toggle increment cut size in each batch [default = %s]\n", fStepUp? "yes": "no" );
fprintf( pErr, "\t-b : toggle enabling BMC check [default = %s]\n", fBmc? "yes": "no" ); fprintf( pErr, "\t-b : toggle enabling BMC check [default = %s]\n", fBmc? "yes": "no" );
fprintf( pErr, "\t-r : toggle enabling register clauses [default = %s]\n", fRegs? "yes": "no" ); fprintf( pErr, "\t-r : toggle enabling register clauses [default = %s]\n", fRegs? "yes": "no" );
fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
......
...@@ -1433,10 +1433,10 @@ int Abc_NtkDarSeqSim( Abc_Ntk_t * pNtk, int nFrames, int nWords, int fVerbose ) ...@@ -1433,10 +1433,10 @@ int Abc_NtkDarSeqSim( Abc_Ntk_t * pNtk, int nFrames, int nWords, int fVerbose )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int fBmc, int fRefs, int fVerbose, int fVeryVerbose ) int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int nLutSize, int nLevels, int nCutsMax, int nBatches, int fStepUp, int fBmc, int fRefs, int fVerbose, int fVeryVerbose )
{ {
extern int Fra_Clau( Aig_Man_t * pMan, int nIters, int fVerbose, int fVeryVerbose ); extern int Fra_Clau( Aig_Man_t * pMan, int nIters, int fVerbose, int fVeryVerbose );
extern int Fra_Claus( Aig_Man_t * pAig, int nFrames, int nPref, int nClauses, int fBmc, int fRefs, int fVerbose, int fVeryVerbose ); extern int Fra_Claus( Aig_Man_t * pAig, int nFrames, int nPref, int nClauses, int nLutSize, int nLevels, int nCutsMax, int nBatches, int fStepUp, int fBmc, int fRefs, int fVerbose, int fVeryVerbose );
Aig_Man_t * pMan; Aig_Man_t * pMan;
if ( Abc_NtkPoNum(pNtk) != 1 ) if ( Abc_NtkPoNum(pNtk) != 1 )
{ {
...@@ -1452,7 +1452,7 @@ int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int ...@@ -1452,7 +1452,7 @@ int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int
pMan->vFlopNums = NULL; pMan->vFlopNums = NULL;
// Fra_Clau( pMan, nStepsMax, fVerbose, fVeryVerbose ); // Fra_Clau( pMan, nStepsMax, fVerbose, fVeryVerbose );
Fra_Claus( pMan, nFrames, nPref, nClauses, fBmc, fRefs, fVerbose, fVeryVerbose ); Fra_Claus( pMan, nFrames, nPref, nClauses, nLutSize, nLevels, nCutsMax, nBatches, fStepUp, fBmc, fRefs, fVerbose, fVeryVerbose );
Aig_ManStop( pMan ); Aig_ManStop( pMan );
return 1; return 1;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "abc.h" #include "abc.h"
#define IGNORE_TIMING // #define IGNORE_TIMING
// #define DEBUG_PRINT_FLOWS // #define DEBUG_PRINT_FLOWS
// #define DEBUG_VISITED // #define DEBUG_VISITED
// #define DEBUG_PREORDER // #define DEBUG_PREORDER
...@@ -45,49 +45,29 @@ ...@@ -45,49 +45,29 @@
#define INIT_0 0x20 #define INIT_0 0x20
#define INIT_1 0x40 #define INIT_1 0x40
#define INIT_CARE (INIT_0 | INIT_1) #define INIT_CARE (INIT_0 | INIT_1)
#define CONSERVATIVE 0x80
#define BLOCK_OR_CONS (BLOCK | CONSERVATIVE)
typedef struct Untimed_Flow_Data_t_ { typedef struct Flow_Data_t_ {
unsigned int mark : 8; unsigned int mark : 16;
union { union {
Abc_Obj_t *pred; Abc_Obj_t *pred;
/* unsigned int var; */ /* unsigned int var; */
Abc_Obj_t *pInitObj; Abc_Obj_t *pInitObj;
Vec_Ptr_t *vNodes;
}; };
unsigned int e_dist : 16; unsigned int e_dist : 16;
unsigned int r_dist : 16; unsigned int r_dist : 16;
} Untimed_Flow_Data_t; } Flow_Data_t;
typedef struct Timed_Flow_Data_t_ {
unsigned int mark : 8;
union {
Abc_Obj_t *pred;
Vec_Ptr_t *vTimeInEdges;
/* unsigned int var; */
Abc_Obj_t *pInitObj;
};
unsigned int e_dist : 16;
unsigned int r_dist : 16;
Vec_Ptr_t vTimeEdges;
} Timed_Flow_Data_t;
#if defined(IGNORE_TIMING)
typedef Untimed_Flow_Data_t Flow_Data_t;
#else
typedef Timed_Flow_Data_t Flow_Data_t;
#endif
// useful macros for manipulating Flow_Data structure... // useful macros for manipulating Flow_Data structure...
#define FDATA( x ) ((Flow_Data_t *)Abc_ObjCopy(x)) #define FDATA( x ) ((Flow_Data_t *)Abc_ObjCopy(x))
#define FSET( x, y ) ((Flow_Data_t *)Abc_ObjCopy(x))->mark |= y #define FSET( x, y ) ((Flow_Data_t *)Abc_ObjCopy(x))->mark |= y
#define FUNSET( x, y ) ((Flow_Data_t *)Abc_ObjCopy(x))->mark &= ~y #define FUNSET( x, y ) ((Flow_Data_t *)Abc_ObjCopy(x))->mark &= ~y
#define FTEST( x, y ) (((Flow_Data_t *)Abc_ObjCopy(x))->mark & y) #define FTEST( x, y ) (((Flow_Data_t *)Abc_ObjCopy(x))->mark & y)
#define FTIMEEDGES( x ) &(((Timed_Flow_Data_t *)Abc_ObjCopy(x))->vTimeEdges) #define FTIMEEDGES( x ) &(pManMR->vTimeEdges[Abc_ObjId( x )])
static inline void FSETPRED(Abc_Obj_t *pObj, Abc_Obj_t *pPred) { static inline void FSETPRED(Abc_Obj_t *pObj, Abc_Obj_t *pPred) {
assert(!Abc_ObjIsLatch(pObj)); // must preserve field to maintain init state linkage assert(!Abc_ObjIsLatch(pObj)); // must preserve field to maintain init state linkage
...@@ -97,21 +77,56 @@ static inline Abc_Obj_t * FGETPRED(Abc_Obj_t *pObj) { ...@@ -97,21 +77,56 @@ static inline Abc_Obj_t * FGETPRED(Abc_Obj_t *pObj) {
return FDATA(pObj)->pred; return FDATA(pObj)->pred;
} }
typedef struct MinRegMan_t_ {
// problem description:
int maxDelay;
bool fComputeInitState, fGuaranteeInitState;
int nNodes, nLatches;
bool fForwardOnly, fBackwardOnly;
bool fConservTimingOnly;
int nMaxIters;
bool fVerbose;
Abc_Ntk_t *pNtk;
int nPreRefine;
// problem state
bool fIsForward;
bool fSinkDistTerminate;
int nExactConstraints, nConservConstraints;
int fSolutionIsDc;
int constraintMask;
int iteration, subIteration;
// problem data
Vec_Int_t *vSinkDistHist;
Flow_Data_t *pDataArray;
Vec_Ptr_t *vTimeEdges;
Vec_Ptr_t *vExactNodes;
Abc_Ntk_t *pInitNtk;
Vec_Ptr_t *vNodes; // re-useable struct
} MinRegMan_t ;
#define vprintf if (pManMR->fVerbose) printf
/*=== fretMain.c ==========================================================*/ /*=== fretMain.c ==========================================================*/
extern MinRegMan_t *pManMR;
Abc_Ntk_t * Abc_FlowRetime_MinReg( Abc_Ntk_t * pNtk, int fVerbose, int fComputeInitState, Abc_Ntk_t * Abc_FlowRetime_MinReg( Abc_Ntk_t * pNtk, int fVerbose, int fComputeInitState,
int fForward, int fBackward, int nMaxIters, int fForward, int fBackward, int nMaxIters,
int maxDelay); int maxDelay, int fFastButConservative);
void print_node(Abc_Obj_t *pObj); void print_node(Abc_Obj_t *pObj);
void Abc_ObjBetterTransferFanout( Abc_Obj_t * pFrom, Abc_Obj_t * pTo, int compl ); void Abc_ObjBetterTransferFanout( Abc_Obj_t * pFrom, Abc_Obj_t * pTo, int compl );
extern int fIsForward; int Abc_FlowRetime_PushFlows( Abc_Ntk_t * pNtk, bool fVerbose );
extern int fSinkDistTerminate; bool Abc_FlowRetime_IsAcrossCut( Abc_Obj_t *pCur, Abc_Obj_t *pNext );
extern Vec_Int_t *vSinkDistHist; void Abc_FlowRetime_ClearFlows( bool fClearAll );
extern int maxDelayCon;
extern int fComputeInitState;
/*=== fretFlow.c ==========================================================*/ /*=== fretFlow.c ==========================================================*/
...@@ -132,9 +147,19 @@ void Abc_FlowRetime_UpdateForwardInit( Abc_Ntk_t * pNtk ); ...@@ -132,9 +147,19 @@ void Abc_FlowRetime_UpdateForwardInit( Abc_Ntk_t * pNtk );
void Abc_FlowRetime_UpdateBackwardInit( Abc_Ntk_t * pNtk ); void Abc_FlowRetime_UpdateBackwardInit( Abc_Ntk_t * pNtk );
void Abc_FlowRetime_SetupBackwardInit( Abc_Ntk_t * pNtk ); void Abc_FlowRetime_SetupBackwardInit( Abc_Ntk_t * pNtk );
void Abc_FlowRetime_SolveBackwardInit( Abc_Ntk_t * pNtk ); int Abc_FlowRetime_SolveBackwardInit( Abc_Ntk_t * pNtk );
void Abc_FlowRetime_ConstrainInit( );
/*=== fretTime.c ==========================================================*/
void Abc_FlowRetime_InitTiming( Abc_Ntk_t *pNtk );
void Abc_FlowRetime_FreeTiming( Abc_Ntk_t *pNtk );
bool Abc_FlowRetime_RefineConstraints( );
extern Abc_Ntk_t *pInitNtk; void Abc_FlowRetime_ConstrainConserv( Abc_Ntk_t * pNtk );
extern int fSolutionIsDc; void Abc_FlowRetime_ConstrainExact( Abc_Obj_t * pObj );
void Abc_FlowRetime_ConstrainExactAll( Abc_Ntk_t * pNtk );
#endif #endif
SRC += src/opt/fret/fretMain.c \ SRC += src/opt/fret/fretMain.c \
src/opt/fret/fretFlow.c \ src/opt/fret/fretFlow.c \
src/opt/fret/fretInit.c src/opt/fret/fretInit.c \
src/opt/fret/fretTime.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