Commit a02b0203 by Alan Mishchenko

Updating DSD balance to handle XOR gate as having the same delay as AND gate.

parent f989aea2
......@@ -85,7 +85,7 @@ static inline int If_LogCreateAndXorMulti( Vec_Int_t * vAig, int * pFaninLits, i
pFaninLits[i-1] = If_LogCreateAndXor( vAig, pFaninLits[i], pFaninLits[i-1], nSuppAll, fXor );
return pFaninLits[0];
}
static inline int If_LogCounterAddAig( int * pTimes, int * pnTimes, int * pFaninLits, int Num, int iLit, Vec_Int_t * vAig, int nSuppAll, int fXor )
static inline int If_LogCounterAddAig( int * pTimes, int * pnTimes, int * pFaninLits, int Num, int iLit, Vec_Int_t * vAig, int nSuppAll, int fXor, int fXorFunc )
{
int nTimes = *pnTimes;
if ( vAig )
......@@ -107,7 +107,7 @@ static inline int If_LogCounterAddAig( int * pTimes, int * pnTimes, int * pFanin
}
pTimes[k-1] += 1 + fXor;
if ( vAig )
pFaninLits[k-1] = If_LogCreateAndXor( vAig, pFaninLits[k], pFaninLits[k-1], nSuppAll, fXor );
pFaninLits[k-1] = If_LogCreateAndXor( vAig, pFaninLits[k], pFaninLits[k-1], nSuppAll, fXorFunc );
for ( nTimes--, i = k; i < nTimes; i++ )
{
pTimes[i] = pTimes[i+1];
......
......@@ -204,9 +204,9 @@ int If_CutSopBalanceEvalInt( Vec_Int_t * vCover, int * pTimes, int * pFaninLits,
{
Literal = 3 & (Entry >> (k << 1));
if ( Literal == 1 ) // neg literal
nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], Abc_LitNot(pFaninLits[k]), vAig, nSuppAll, 0 );
nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], Abc_LitNot(pFaninLits[k]), vAig, nSuppAll, 0, 0 );
else if ( Literal == 2 ) // pos literal
nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], pFaninLits[k], vAig, nSuppAll, 0 );
nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], pFaninLits[k], vAig, nSuppAll, 0, 0 );
else if ( Literal != 0 )
assert( 0 );
}
......@@ -216,7 +216,7 @@ int If_CutSopBalanceEvalInt( Vec_Int_t * vCover, int * pTimes, int * pFaninLits,
iRes = If_LogCreateAndXorMulti( vAig, pFaninLitsAnd, nCounterAnd, nSuppAll, 0 );
else
*pArea += nLits == 1 ? 0 : nLits - 1;
Delay = If_LogCounterAddAig( pCounterOr, &nCounterOr, pFaninLitsOr, Delay, Abc_LitNot(iRes), vAig, nSuppAll, 0 );
Delay = If_LogCounterAddAig( pCounterOr, &nCounterOr, pFaninLitsOr, Delay, Abc_LitNot(iRes), vAig, nSuppAll, 0, 0 );
}
assert( nCounterOr > 0 );
if ( vAig )
......
......@@ -2073,7 +2073,7 @@ int If_CutDsdBalancePinDelays_rec( If_DsdMan_t * p, int Id, int * pTimes, word *
{
word pFaninRes[IF_MAX_FUNC_LUTSIZE];
int i, iFanin, Delay, Result = 0;
int fXor = (If_DsdObjType(pObj) == IF_DSD_XOR);
int fXor = 0;//(If_DsdObjType(pObj) == IF_DSD_XOR);
int nCounter = 0, pCounter[IF_MAX_FUNC_LUTSIZE];
If_DsdObjForEachFaninLit( &p->vObjs, pObj, iFanin, i )
{
......@@ -2188,7 +2188,8 @@ int If_CutDsdBalanceEval_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSup
assert( If_DsdObjType(pObj) == IF_DSD_AND || If_DsdObjType(pObj) == IF_DSD_XOR );
{
int i, iFanin, Delay, Result = 0;
int fXor = (If_DsdObjType(pObj) == IF_DSD_XOR);
int fXor = 0;//(If_DsdObjType(pObj) == IF_DSD_XOR);
int fXorFunc = (If_DsdObjType(pObj) == IF_DSD_XOR);
int nCounter = 0, pCounter[IF_MAX_FUNC_LUTSIZE], pFaninLits[IF_MAX_FUNC_LUTSIZE];
If_DsdObjForEachFaninLit( &p->vObjs, pObj, iFanin, i )
{
......@@ -2196,13 +2197,13 @@ int If_CutDsdBalanceEval_rec( If_DsdMan_t * p, int Id, int * pTimes, int * pnSup
if ( Delay == -1 )
return -1;
pFaninLits[i] = Abc_LitNotCond( pFaninLits[i], Abc_LitIsCompl(iFanin) );
Result = If_LogCounterAddAig( pCounter, &nCounter, pFaninLits, Delay, pFaninLits[i], vAig, nSuppAll, fXor );
Result = If_LogCounterAddAig( pCounter, &nCounter, pFaninLits, Delay, pFaninLits[i], vAig, nSuppAll, fXor, fXorFunc );
}
assert( nCounter > 0 );
if ( fXor )
Result = If_LogCounterDelayXor( pCounter, nCounter ); // estimation
if ( vAig )
*piLit = If_LogCreateAndXorMulti( vAig, pFaninLits, nCounter, nSuppAll, fXor );
*piLit = If_LogCreateAndXorMulti( vAig, pFaninLits, nCounter, nSuppAll, fXorFunc );
else
*pArea += (pObj->nFans - 1) * (1 + 2 * fXor);
return Result;
......
......@@ -207,7 +207,7 @@ int Inf_ManOpenSymb( char * pStr )
}
int Ifn_ManStrCheck( char * pStr, int * pnInps, int * pnObjs )
{
int i, nNodes = 0, Marks[32] = {0}, MaxVar = -1, RetValue = 1;
int i, nNodes = 0, Marks[32] = {0}, MaxVar = -1;
for ( i = 0; pStr[i]; i++ )
{
if ( Inf_ManOpenSymb(pStr+i) )
......
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