Commit 8f485489 by Alan Mishchenko

Changes to LUT mappers.

parent 3d6eac52
...@@ -87,7 +87,7 @@ void Abc_FrameSetFlag( char * pFlag, char * pValue ) { Cmd_FlagUpdateVal ...@@ -87,7 +87,7 @@ void Abc_FrameSetFlag( char * pFlag, char * pValue ) { Cmd_FlagUpdateVal
void Abc_FrameSetCex( Abc_Cex_t * pCex ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->pCex = pCex; } void Abc_FrameSetCex( Abc_Cex_t * pCex ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->pCex = pCex; }
void Abc_FrameSetNFrames( int nFrames ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->nFrames = nFrames; } void Abc_FrameSetNFrames( int nFrames ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->nFrames = nFrames; }
void Abc_FrameSetStatus( int Status ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->Status = Status; } void Abc_FrameSetStatus( int Status ) { ABC_FREE( s_GlobalFrame->pCex ); s_GlobalFrame->Status = Status; }
void Abc_FrameSetManDsd( void * pMan ) { if (s_GlobalFrame->pManDsd) If_DsdManFree((If_DsdMan_t *)s_GlobalFrame->pManDsd, 0); s_GlobalFrame->pManDsd = pMan; } void Abc_FrameSetManDsd( void * pMan ) { if (s_GlobalFrame->pManDsd && s_GlobalFrame->pManDsd != pMan) If_DsdManFree((If_DsdMan_t *)s_GlobalFrame->pManDsd, 0); s_GlobalFrame->pManDsd = pMan; }
int Abc_FrameIsBatchMode() { return s_GlobalFrame ? s_GlobalFrame->fBatchMode : 0; } int Abc_FrameIsBatchMode() { return s_GlobalFrame ? s_GlobalFrame->fBatchMode : 0; }
......
...@@ -386,6 +386,61 @@ void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int fVerbose ) ...@@ -386,6 +386,61 @@ void If_DsdManPrint( If_DsdMan_t * p, char * pFileName, int fVerbose )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Sorting DSD literals.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int If_DsdObjCompare( Vec_Ptr_t * p, int iLit0, int iLit1 )
{
If_DsdObj_t * p0 = If_DsdVecObj(p, Abc_Lit2Var(iLit0));
If_DsdObj_t * p1 = If_DsdVecObj(p, Abc_Lit2Var(iLit1));
int i, Res;
if ( If_DsdObjType(p0) < If_DsdObjType(p1) )
return -1;
if ( If_DsdObjType(p0) > If_DsdObjType(p1) )
return 1;
if ( If_DsdObjType(p0) < IF_DSD_AND )
return 0;
if ( If_DsdObjFaninNum(p0) < If_DsdObjFaninNum(p1) )
return -1;
if ( If_DsdObjFaninNum(p0) > If_DsdObjFaninNum(p1) )
return 1;
for ( i = 0; i < If_DsdObjFaninNum(p0); i++ )
{
Res = If_DsdObjCompare( p, If_DsdObjFaninLit(p0, i), If_DsdObjFaninLit(p1, i) );
if ( Res != 0 )
return Res;
}
if ( Abc_LitIsCompl(iLit0) < Abc_LitIsCompl(iLit1) )
return -1;
if ( Abc_LitIsCompl(iLit0) > Abc_LitIsCompl(iLit1) )
return 1;
return 0;
}
void If_DsdObjSort( Vec_Ptr_t * p, int * pLits, int nLits, int * pPerm )
{
int i, j, best_i;
for ( i = 0; i < nLits-1; i++ )
{
best_i = i;
for ( j = i+1; j < nLits; j++ )
if ( If_DsdObjCompare(p, pLits[best_i], pLits[j]) == 1 )
best_i = j;
if ( i == best_i )
continue;
ABC_SWAP( int, pLits[i], pLits[best_i] );
if ( pPerm )
ABC_SWAP( int, pPerm[i], pPerm[best_i] );
}
}
/**Function*************************************************************
Synopsis [] Synopsis []
Description [] Description []
...@@ -470,7 +525,7 @@ int If_DsdObjFindOrAdd( If_DsdMan_t * p, int Type, int * pLits, int nLits, word ...@@ -470,7 +525,7 @@ int If_DsdObjFindOrAdd( If_DsdMan_t * p, int Type, int * pLits, int nLits, word
unsigned * pSpot = If_DsdObjHashLookup( p, Type, pLits, nLits, truthId ); unsigned * pSpot = If_DsdObjHashLookup( p, Type, pLits, nLits, truthId );
abctime clk; abctime clk;
if ( *pSpot ) if ( *pSpot )
return *pSpot; return (int)*pSpot;
clk = Abc_Clock(); clk = Abc_Clock();
if ( truthId >= 0 && truthId == Vec_PtrSize(p->vTtDecs) ) if ( truthId >= 0 && truthId == Vec_PtrSize(p->vTtDecs) )
{ {
...@@ -712,61 +767,6 @@ word * If_DsdManComputeTruth( If_DsdMan_t * p, int iDsd, unsigned char * pPermLi ...@@ -712,61 +767,6 @@ word * If_DsdManComputeTruth( If_DsdMan_t * p, int iDsd, unsigned char * pPermLi
/**Function************************************************************* /**Function*************************************************************
Synopsis [Sorting DSD literals.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int If_DsdObjCompare( Vec_Ptr_t * p, int iLit0, int iLit1 )
{
If_DsdObj_t * p0 = If_DsdVecObj(p, Abc_Lit2Var(iLit0));
If_DsdObj_t * p1 = If_DsdVecObj(p, Abc_Lit2Var(iLit1));
int i, Res;
if ( If_DsdObjType(p0) < If_DsdObjType(p1) )
return -1;
if ( If_DsdObjType(p0) > If_DsdObjType(p1) )
return 1;
if ( If_DsdObjType(p0) < IF_DSD_AND )
return 0;
if ( If_DsdObjFaninNum(p0) < If_DsdObjFaninNum(p1) )
return -1;
if ( If_DsdObjFaninNum(p0) > If_DsdObjFaninNum(p1) )
return 1;
for ( i = 0; i < If_DsdObjFaninNum(p0); i++ )
{
Res = If_DsdObjCompare( p, If_DsdObjFaninLit(p0, i), If_DsdObjFaninLit(p1, i) );
if ( Res != 0 )
return Res;
}
if ( Abc_LitIsCompl(iLit0) < Abc_LitIsCompl(iLit1) )
return -1;
if ( Abc_LitIsCompl(iLit0) > Abc_LitIsCompl(iLit1) )
return 1;
return 0;
}
void If_DsdObjSort( Vec_Ptr_t * p, int * pLits, int nLits, int * pPerm )
{
int i, j, best_i;
for ( i = 0; i < nLits-1; i++ )
{
best_i = i;
for ( j = i+1; j < nLits; j++ )
if ( If_DsdObjCompare(p, pLits[best_i], pLits[j]) == 1 )
best_i = j;
if ( i == best_i )
continue;
ABC_SWAP( int, pLits[i], pLits[best_i] );
if ( pPerm )
ABC_SWAP( int, pPerm[i], pPerm[best_i] );
}
}
/**Function*************************************************************
Synopsis [Performs DSD operation.] Synopsis [Performs DSD operation.]
Description [] Description []
......
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