40 int iCube, nOutputs, SizeOutputID;
47 int Id = Vec_IntEntry( vCube, 0 );
48 int iTranslation = Vec_IntFind( pFxchMan->
vTranslation, Id );
50 if ( iTranslation == -1 )
56 SizeOutputID = ( nOutputs >> 5 ) + ( ( nOutputs & 31 ) > 0 );
59 pFxchMan->
vOutputID = Vec_IntAlloc( 4096 );
63 pCubeHash = Hsh_VecManStart( 1024 );
68 int Id = Vec_IntEntry( vCube, 0 );
69 int iTranslation = Vec_IntFind( pFxchMan->
vTranslation, Id );
70 int i, iCubeNoID, Temp, * pEntry;
71 Vec_IntWriteEntry( vCube, 0, 0 );
73 iCubeNoID = Hsh_VecManAdd( pCubeHash, vCube );
74 Temp = ( 1 << ( iTranslation & 31 ) );
75 if ( iCubeNoID == Vec_IntSize( pFxchMan->
vOutputID ) / SizeOutputID )
77 for ( i = 0; i < SizeOutputID; i++ )
85 Vec_IntClear( vCube );
86 pEntry = Vec_IntEntryP( pFxchMan->
vOutputID, ( iCubeNoID * SizeOutputID ) + ( iTranslation >> 5 ) );
91 Hsh_VecManStop( pCubeHash );
92 Vec_WecRemoveEmpty( pFxchMan->
vCubes );
116 int * pOutputID, nOnes;
117 if ( Vec_IntSize( vCube ) == 0 || Vec_IntEntry( vCube, 0 ) != 0 )
124 nOnes += Fxch_CountOnes( (
unsigned int) pOutputID[i] );
127 for ( j = 0; j < 32 && nOnes; j++ )
128 if ( pOutputID[i] & ( 1 << j ) )
131 Vec_IntWriteEntry( vCube, 0, Vec_IntEntry( pFxchMan->
vTranslation, ( i << 5 ) | j ) );
134 vNewCube = Vec_WecPushLevel( pFxchMan->
vCubes );
135 Vec_IntAppend( vNewCube, vCube );
136 Vec_IntWriteEntry( vNewCube, 0, Vec_IntEntry( pFxchMan->
vTranslation, (i << 5 ) | j ) );
170 TempTime = Abc_Clock();
177 pFxchMan->
timeInit = Abc_Clock() - TempTime;
185 TempTime = Abc_Clock();
187 for ( i = 0; (!nMaxDivExt || i < nMaxDivExt) && Vec_QueTopPriority( pFxchMan->
vDivPrio ) > 0.0; i++ )
189 int iDiv = Vec_QuePop( pFxchMan->
vDivPrio );
197 pFxchMan->
timeExt = Abc_Clock() - TempTime;
202 Abc_PrintTime( 1,
"\n[FXCH] Elapsed Time", pFxchMan->
timeInit + pFxchMan->
timeExt );
203 Abc_PrintTime( 1,
"[FXCH] +-> Init", pFxchMan->
timeInit );
204 Abc_PrintTime( 1,
"[FXCH] +-> Extr", pFxchMan->
timeExt );
211 Vec_WecRemoveEmpty( vCubes );
212 Vec_WecSortByFirstInt( vCubes, 0 );
236 assert( Abc_NtkIsSopLogic( pNtk ) );
240 printf(
"Abc_NtkFxchPerform(): Nodes have duplicated fanins. FXCH is not performed.\n" );
245 if (
Fxch_FastExtract( vCubes, Abc_NtkObjNumMax( pNtk ), nMaxDivExt, fVerbose, fVeryVerbose ) > 0 )
248 Vec_WecFree( vCubes );
251 printf(
"Abc_NtkFxchPerform(): The network check has failed.\n" );
256 printf(
"Warning: The network has not been changed by \"fxch\".\n" );
258 Vec_WecFree( vCubes );
int Abc_NtkFxchPerform(Abc_Ntk_t *pNtk, int nMaxDivExt, int fVerbose, int fVeryVerbose)
ABC_NAMESPACE_IMPL_START void Fxch_CubesGruping(Fxch_Man_t *pFxchMan)
FUNCTION DEFINITIONS ///.
int Fxch_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nMaxDivExt, int fVerbose, int fVeryVerbose)
void Fxch_CubesUnGruping(Fxch_Man_t *pFxchMan)
void Fxch_ManSCHashTablesFree(Fxch_Man_t *pFxchMan)
void Fxch_ManMapLiteralsIntoCubes(Fxch_Man_t *pFxchMan, int nVars)
void Fxch_ManDivCreate(Fxch_Man_t *pFxchMan)
Fxch_Man_t * Fxch_ManAlloc(Vec_Wec_t *vCubes)
PUBLIC INTERFACE ///.
void Fxch_ManPrintStats(Fxch_Man_t *pFxchMan)
void Fxch_ManFree(Fxch_Man_t *pFxchMan)
void Fxch_ManComputeLevel(Fxch_Man_t *pFxchMan)
void Fxch_ManPrintDivs(Fxch_Man_t *pFxchMan)
void Fxch_DivPrint(Fxch_Man_t *pFxchMan, int iDiv)
void Fxch_ManSCHashTablesInit(Fxch_Man_t *pFxchMan)
void Fxch_ManGenerateLitHashKeys(Fxch_Man_t *pFxchMan)
Vec_Wec_t * Abc_NtkFxRetrieve(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
void Abc_NtkFxInsert(Abc_Ntk_t *pNtk, Vec_Wec_t *vCubes)
int Abc_NtkFxCheck(Abc_Ntk_t *pNtk)
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
struct Abc_Ntk_t_ Abc_Ntk_t
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Fxch_Man_t_ Fxch_Man_t
TYPEDEF DECLARATIONS ///.
void Fxch_ManUpdate(Fxch_Man_t *p, int iDiv)
struct Hsh_VecMan_t_ Hsh_VecMan_t
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.