Commit c42aeb81 by Alan Mishchenko

Handling constant and buffer cut in exact synthesis.

parent 64010095
......@@ -645,7 +645,7 @@ extern ABC_DLL Vec_Ptr_t * Abc_AigGetLevelizedOrder( Abc_Ntk_t * pNtk, in
/*=== abcExact.c ==========================================================*/
extern ABC_DLL int Abc_ExactInputNum();
extern ABC_DLL int Abc_ExactIsRunning();
extern ABC_DLL Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile, Abc_Obj_t ** pFanins );
extern ABC_DLL Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile, Abc_Obj_t ** pFanins, Abc_Ntk_t * pNtk );
extern ABC_DLL Abc_Ntk_t * Abc_NtkFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth, int * pArrivalTimes, int fVerbose );
/*=== abcFanio.c ==========================================================*/
extern ABC_DLL void Abc_ObjAddFanin( Abc_Obj_t * pObj, Abc_Obj_t * pFanin );
......
......@@ -1500,12 +1500,25 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
abctime timeStart;
/* some checks */
if ( nVars < 2 || nVars > 8 )
if ( nVars < 0 || nVars > 8 )
{
printf( "invalid truth table size %d\n", nVars );
assert( 0 );
}
if ( nVars == 0 )
{
*Cost = 0;
return 0;
}
if ( nVars == 1 )
{
*Cost = 0;
pPerm[0] = (char)0;
return pArrTimeProfile[0];
}
/* statistics */
s_pSesStore->nCutCount++;
s_pSesStore->pCutCount[nVars]++;
......@@ -1566,7 +1579,7 @@ int Abc_ExactDelayCost( word * pTruth, int nVars, int * pArrTimeProfile, char *
}
// this procedure returns a new node whose output in terms of the given fanins
// has the smallest possible arrival time (in agreement with the above Abc_ExactDelayCost)
Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile, Abc_Obj_t ** pFanins )
Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile, Abc_Obj_t ** pFanins, Abc_Ntk_t * pNtk )
{
char * pSol;
int i, j;
......@@ -1576,7 +1589,10 @@ Abc_Obj_t * Abc_ExactBuildNode( word * pTruth, int nVars, int * pArrTimeProfile,
char pGateTruth[5];
char * pSopCover;
Abc_Ntk_t * pNtk = Abc_ObjNtk( pFanins[0] );
if ( nVars == 0 )
return (pTruth[0] & 1) ? Abc_NtkCreateNodeConst1(pNtk) : Abc_NtkCreateNodeConst0(pNtk);
if ( nVars == 1 )
return (pTruth[0] & 1) ? Abc_NtkCreateNodeInv(pNtk, pFanins[0]) : Abc_NtkCreateNodeBuf(pNtk, pFanins[0]);
pSol = Ses_StoreGetEntry( s_pSesStore, pTruth, nVars, pArrTimeProfile );
if ( !pSol )
......@@ -1656,14 +1672,14 @@ void Abc_ExactStoreTest( int fVerbose )
Abc_ExactStart( 10000, 1, fVerbose, NULL );
assert( !Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins ) );
assert( !Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins, pNtk ) );
assert( Abc_ExactDelayCost( pTruth, 4, pArrTimeProfile, pPerm, &Cost, 12 ) == 1 );
assert( Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins ) );
assert( Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins, pNtk ) );
(*pArrTimeProfile)++;
assert( !Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins ) );
assert( !Abc_ExactBuildNode( pTruth, 4, pArrTimeProfile, pFanins, pNtk ) );
(*pArrTimeProfile)--;
Abc_ExactStop( NULL );
......
......@@ -452,7 +452,7 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
Abc_Obj_t * pFanins[IF_MAX_FUNC_LUTSIZE];
If_CutForEachLeaf( pIfMan, pCutBest, pIfLeaf, i )
pFanins[i] = Abc_NodeFromIf_rec(pNtkNew, pIfMan, pIfLeaf, vCover);
pNodeNew = Abc_ExactBuildNode( If_CutTruthW(pIfMan, pCutBest), If_CutLeaveNum(pCutBest), If_CutArrTimeProfile(pIfMan, pCutBest), pFanins );
pNodeNew = Abc_ExactBuildNode( If_CutTruthW(pIfMan, pCutBest), If_CutLeaveNum(pCutBest), If_CutArrTimeProfile(pIfMan, pCutBest), pFanins, pNtkNew );
If_ObjSetCopy( pIfObj, pNodeNew );
return pNodeNew;
}
......
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