76 p->timeOther =
p->timeTotal -
p->timeWin -
p->timeDiv -
p->timeCnf -
p->timeSat;
77 printf(
"Nodes = %d. Try = %d. Resub = %d. Div = %d (ave = %d). SAT calls = %d. Timeouts = %d. MaxDivs = %d.\n",
78 Sfm_NtkNodeNum(
p),
p->nNodesTried,
p->nRemoves +
p->nResubs,
p->nTotalDivs,
p->nTotalDivs/Abc_MaxInt(1,
p->nNodesTried),
p->nSatCalls,
p->nTimeOuts,
p->nMaxDivs );
80 printf(
"Attempts : " );
81 printf(
"Remove %6d out of %6d (%6.2f %%) ",
p->nRemoves,
p->nTryRemoves, 100.0*
p->nRemoves/Abc_MaxInt(1,
p->nTryRemoves) );
82 printf(
"Resub %6d out of %6d (%6.2f %%) ",
p->nResubs,
p->nTryResubs, 100.0*
p->nResubs /Abc_MaxInt(1,
p->nTryResubs) );
83 if (
p->pPars->fUseDcs )
84 printf(
"Improves %6d out of %6d (%6.2f %%) ",
p->nImproves,
p->nTryImproves,100.0*
p->nImproves/Abc_MaxInt(1,
p->nTryImproves));
87 printf(
"Reduction: " );
88 printf(
"Nodes %6d out of %6d (%6.2f %%) ",
p->nTotalNodesBeg-
p->nTotalNodesEnd,
p->nTotalNodesBeg, 100.0*(
p->nTotalNodesBeg-
p->nTotalNodesEnd)/Abc_MaxInt(1,
p->nTotalNodesBeg) );
89 printf(
"Edges %6d out of %6d (%6.2f %%) ",
p->nTotalEdgesBeg-
p->nTotalEdgesEnd,
p->nTotalEdgesBeg, 100.0*(
p->nTotalEdgesBeg-
p->nTotalEdgesEnd)/Abc_MaxInt(1,
p->nTotalEdgesBeg) );
115 int fVeryVerbose = 0;
116 int i, iFanin, iVar = -1;
117 int iFaninRem = -1, iFaninSkip = -1;
118 int nFanins = Sfm_ObjFaninNum(
p, iNode);
119 word uTruth, uSign, uMask;
121 assert( Sfm_ObjIsNode(
p, iNode) );
122 assert( f >= 0 && f < Sfm_ObjFaninNum(
p, iNode) );
125 if (
p->pPars->fVeryVerbose )
126 printf(
"%5d : Lev =%3d. Leaf =%3d. Node =%3d. Div=%3d. Fanin =%4d (%d/%d). MFFC = %d\n",
127 iNode, Sfm_ObjLevel(
p, iNode), 0, Vec_IntSize(
p->vNodes), Vec_IntSize(
p->vDivs),
128 Sfm_ObjFanin(
p, iNode, f), f, Sfm_ObjFaninNum(
p, iNode),
Sfm_ObjMffcSize(
p, Sfm_ObjFanin(
p, iNode, f)) );
131 Vec_WrdFill(
p->vDivCexes, Vec_IntSize(
p->vDivs), 0 );
133 Vec_IntClear(
p->vDivIds );
136 Vec_IntPush(
p->vDivIds, Sfm_ObjSatVar(
p, iFanin) );
139 assert( iFaninRem != -1 );
141 if ( Sfm_ObjIsFixed(
p, iFaninRem) && Sfm_ObjFaninNum(
p, iFaninRem) == 1 )
142 iFaninSkip = Sfm_ObjFanin(
p, iFaninRem, 0);
145p->timeSat += Abc_Clock() - clk;
154 if ( fRemoveOnly ||
p->pPars->fRrOnly || Vec_IntSize(
p->vDivs) == 0 )
160 for ( i = 0; i < 9; i++ )
162 for ( i = 0; i < Vec_IntSize(
p->vDivs); i++ )
163 printf(
"%d", i % 10 );
170 printf(
"%3d: %3d ",
p->nCexes, iVar );
172 printf(
"%d", Abc_TtGetBit(&uSign,
p->nCexes-1) );
176 uMask = (~(
word)0) >> (64 -
p->nCexes);
178 if ( uSign == uMask && Vec_IntEntry(
p->vDivs, iVar) != iFaninSkip )
180 if ( iVar == Vec_IntSize(
p->vDivs) )
182 assert( Vec_IntEntry(
p->vDivs, iVar) != iFaninSkip );
184 Vec_IntPush(
p->vDivIds, Sfm_ObjSatVar(
p, Vec_IntEntry(
p->vDivs, iVar)) );
187p->timeSat += Abc_Clock() - clk;
196 if (
p->nCexes == 64 )
199 Vec_IntPop(
p->vDivIds );
202 if (
p->pPars->fVeryVerbose )
205 printf(
"Node %d: Fanin %d (%d) can be removed. ", iNode, f, Sfm_ObjFanin(
p, iNode, f) );
207 printf(
"Node %d: Fanin %d (%d) can be replaced by divisor %d (%d). ",
208 iNode, f, Sfm_ObjFanin(
p, iNode, f), iVar, Vec_IntEntry(
p->vDivs, iVar) );
218 Sfm_NtkUpdate(
p, iNode, f, (iVar == -1 ? iVar : Vec_IntEntry(
p->vDivs, iVar)), uTruth,
p->pTruth );
220 assert( nFanins >= Sfm_ObjFaninNum(
p, iNode) );
244 assert( Sfm_ObjIsNode(
p, iNode) );
247 if (
p->pPars->fVeryVerbose )
248 printf(
"%5d : Lev =%3d. Leaf =%3d. Node =%3d. Div=%3d. Fanins = %d. MFFC = %d\n",
249 iNode, Sfm_ObjLevel(
p, iNode), 0, Vec_IntSize(
p->vNodes), Vec_IntSize(
p->vDivs),
252 Vec_IntClear(
p->vDivIds );
254 Vec_IntPush(
p->vDivIds, Sfm_ObjSatVar(
p, iFanin) );
257p->timeSat += Abc_Clock() - clk;
265 if ( uTruth == Vec_WrdEntry(
p->vTruths, iNode) )
269 word uTruth0 = Vec_WrdEntry(
p->vTruths, iNode);
272 int Old =
Kit_TruthLitNum((
unsigned*)&uTruth0, Sfm_ObjFaninNum(
p, iNode),
p->vCover);
274 int New =
Kit_TruthLitNum((
unsigned*)&uTruth, Sfm_ObjFaninNum(
p, iNode),
p->vCover);
284 Vec_WrdWriteEntry(
p->vTruths, iNode, uTruth );
299 if ( Sfm_ObjIsNode(
p, iFanin) && Sfm_ObjFanoutNum(
p, iFanin) == 1 )
305 if ( !
p->pPars->fArea )
307 if ( !(Sfm_ObjIsNode(
p, iFanin) && Sfm_ObjFanoutNum(
p, iFanin) == 1) )
313 if (
p->pPars->fUseDcs && Sfm_ObjFaninNum(
p, iNode) <= 6 )
343 for ( i = 0; i <
p->nObjs; i++ )
345 Vec_Int_t * vArray = Vec_WecEntry( &
p->vFanins, i );
346 printf(
"Obj %3d : ", i );
347 printf(
"Fixed %d ", Vec_StrEntry(
p->vFixed, i) );
348 printf(
"Empty %d ", Vec_StrEntry(
p->vEmpty, i) );
350 Extra_PrintHex( stdout, (
unsigned *)Vec_WrdEntryP(
p->vTruths, i), Vec_IntSize(vArray) );
352 Vec_IntPrint( vArray );
369 int i, k, Counter = 0, CounterLarge = 0;
371 p->timeTotal = Abc_Clock();
374 int nFixed =
p->vFixed ? Vec_StrSum(
p->vFixed) : 0;
375 int nEmpty =
p->vEmpty ? Vec_StrSum(
p->vEmpty) : 0;
376 printf(
"Performing MFS with %d PIs, %d POs, %d nodes (%d flexible, %d fixed, %d empty).\n",
377 p->nPis,
p->nPos,
p->nNodes,
p->nNodes-nFixed, nFixed, nEmpty );
383 p->nTotalNodesBeg = Vec_WecSizeUsedLimits( &
p->vFanins, Sfm_NtkPiNum(
p), Vec_WecSize(&
p->vFanins) - Sfm_NtkPoNum(
p) );
384 p->nTotalEdgesBeg = Vec_WecSizeSize(&
p->vFanins) - Sfm_NtkPoNum(
p);
387 if ( Sfm_ObjIsFixed(
p, i ) )
389 if (
p->pPars->nDepthMax && Sfm_ObjLevel(
p, i) >
p->pPars->nDepthMax )
407 p->nTotalNodesEnd = Vec_WecSizeUsedLimits( &
p->vFanins, Sfm_NtkPiNum(
p), Vec_WecSize(&
p->vFanins) - Sfm_NtkPoNum(
p) );
408 p->nTotalEdgesEnd = Vec_WecSizeSize(&
p->vFanins) - Sfm_NtkPoNum(
p);
409 p->timeTotal = Abc_Clock() -
p->timeTotal;
410 if ( pPars->
fVerbose && CounterLarge )
411 printf(
"MFS skipped %d (out of %d) nodes with more than %d fanins.\n", CounterLarge,
p->nNodes,
SFM_SUPP_MAX );
#define ABC_PRTP(a, t, T)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Vec_Str_t_ Vec_Str_t
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
unsigned __int64 word
DECLARATIONS ///.
int Kit_TruthLitNum(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
int Sfm_TruthToCnf(word Truth, word *pTruth, int nVars, Vec_Int_t *vCover, Vec_Str_t *vCnf)
int Sfm_NodeResub(Sfm_Ntk_t *p, int iNode)
int Sfm_NtkPerform(Sfm_Ntk_t *p, Sfm_Par_t *pPars)
void Sfm_NtkPrint(Sfm_Ntk_t *p)
int Sfm_NodeResubSolve(Sfm_Ntk_t *p, int iNode, int f, int fRemoveOnly)
int Sfm_NodeResubOne(Sfm_Ntk_t *p, int iNode)
void Sfm_NtkPrintStats(Sfm_Ntk_t *p)
ABC_NAMESPACE_IMPL_START void Sfm_ParSetDefault(Sfm_Par_t *pPars)
DECLARATIONS ///.
int Sfm_NtkCreateWindow(Sfm_Ntk_t *p, int iNode, int fVerbose)
#define Sfm_ObjForEachFanin(p, Node, Fan, i)
void Sfm_NtkUpdate(Sfm_Ntk_t *p, int iNode, int f, int iFaninNew, word uTruth, word *pTruth)
#define Sfm_NtkForEachNode(p, i)
int Sfm_NtkWindowToSolver(Sfm_Ntk_t *p)
DECLARATIONS ///.
void Sfm_NtkPrepare(Sfm_Ntk_t *p)
word Sfm_ComputeInterpolant(Sfm_Ntk_t *p)
word Sfm_ComputeInterpolant2(Sfm_Ntk_t *p)
int Sfm_ObjMffcSize(Sfm_Ntk_t *p, int iObj)
struct Sfm_Par_t_ Sfm_Par_t
typedefABC_NAMESPACE_HEADER_START struct Sfm_Ntk_t_ Sfm_Ntk_t
INCLUDES ///.
#define Vec_WrdForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.