ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
Fxch.c File Reference
#include "Fxch.h"
Include dependency graph for Fxch.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Fxch_CubesGruping (Fxch_Man_t *pFxchMan)
 FUNCTION DEFINITIONS ///.
 
void Fxch_CubesUnGruping (Fxch_Man_t *pFxchMan)
 
int Fxch_FastExtract (Vec_Wec_t *vCubes, int ObjIdMax, int nMaxDivExt, int fVerbose, int fVeryVerbose)
 
int Abc_NtkFxchPerform (Abc_Ntk_t *pNtk, int nMaxDivExt, int fVerbose, int fVeryVerbose)
 

Function Documentation

◆ Abc_NtkFxchPerform()

int Abc_NtkFxchPerform ( Abc_Ntk_t * pNtk,
int nMaxDivExt,
int fVerbose,
int fVeryVerbose )

Function*************************************************************

Synopsis [ Retrives the necessary information for the fast extract with cube hashing. ]

Description []

SideEffects []

SeeAlso []

Definition at line 229 of file Fxch.c.

233{
234 Vec_Wec_t* vCubes;
235
236 assert( Abc_NtkIsSopLogic( pNtk ) );
237
238 if ( !Abc_NtkFxCheck( pNtk ) )
239 {
240 printf( "Abc_NtkFxchPerform(): Nodes have duplicated fanins. FXCH is not performed.\n" );
241 return 0;
242 }
243
244 vCubes = Abc_NtkFxRetrieve( pNtk );
245 if ( Fxch_FastExtract( vCubes, Abc_NtkObjNumMax( pNtk ), nMaxDivExt, fVerbose, fVeryVerbose ) > 0 )
246 {
247 Abc_NtkFxInsert( pNtk, vCubes );
248 Vec_WecFree( vCubes );
249
250 if ( !Abc_NtkCheck( pNtk ) )
251 printf( "Abc_NtkFxchPerform(): The network check has failed.\n" );
252
253 return 1;
254 }
255 else
256 printf( "Warning: The network has not been changed by \"fxch\".\n" );
257
258 Vec_WecFree( vCubes );
259
260 return 0;
261}
int Fxch_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nMaxDivExt, int fVerbose, int fVeryVerbose)
Definition Fxch.c:160
Vec_Wec_t * Abc_NtkFxRetrieve(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcFx.c:140
void Abc_NtkFxInsert(Abc_Ntk_t *pNtk, Vec_Wec_t *vCubes)
Definition abcFx.c:183
int Abc_NtkFxCheck(Abc_Ntk_t *pNtk)
Definition abcFx.c:283
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
#define assert(ex)
Definition util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42
Here is the call graph for this function:

◆ Fxch_CubesGruping()

ABC_NAMESPACE_IMPL_START void Fxch_CubesGruping ( Fxch_Man_t * pFxchMan)

FUNCTION DEFINITIONS ///.

CFile****************************************************************

FileName [ Fxch.c ]

PackageName [ Fast eXtract with Cube Hashing (FXCH) ]

Synopsis [ The entrance into the fast extract module. ]

Author [ Bruno Schmitt - boschmitt at inf.ufrgs.br ]

Affiliation [ UFRGS ]

Date [ Ver. 1.0. Started - March 6, 2016. ]

Revision [] Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 37 of file Fxch.c.

38{
39 Vec_Int_t* vCube;
40 int iCube, nOutputs, SizeOutputID;
41 Hsh_VecMan_t* pCubeHash;
42
43 /* Identify the number of Outputs and create the translation table */
44 pFxchMan->vTranslation = Vec_IntAlloc( 32 );
45 Vec_WecForEachLevel( pFxchMan->vCubes, vCube, iCube )
46 {
47 int Id = Vec_IntEntry( vCube, 0 );
48 int iTranslation = Vec_IntFind( pFxchMan->vTranslation, Id );
49
50 if ( iTranslation == -1 )
51 Vec_IntPush( pFxchMan->vTranslation, Id );
52 }
53 nOutputs = Vec_IntSize( pFxchMan->vTranslation );
54
55 /* Size of the OutputID in number o ints */
56 SizeOutputID = ( nOutputs >> 5 ) + ( ( nOutputs & 31 ) > 0 );
57
58 /* Initialize needed structures */
59 pFxchMan->vOutputID = Vec_IntAlloc( 4096 );
60 pFxchMan->pTempOutputID = ABC_CALLOC( int, SizeOutputID );
61 pFxchMan->nSizeOutputID = SizeOutputID;
62
63 pCubeHash = Hsh_VecManStart( 1024 );
64
65 /* Identify equal cubes */
66 Vec_WecForEachLevel( pFxchMan->vCubes, vCube, iCube )
67 {
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 ); // Clear ID, Outputs will be identified by it later
72
73 iCubeNoID = Hsh_VecManAdd( pCubeHash, vCube );
74 Temp = ( 1 << ( iTranslation & 31 ) );
75 if ( iCubeNoID == Vec_IntSize( pFxchMan->vOutputID ) / SizeOutputID )
76 {
77 for ( i = 0; i < SizeOutputID; i++ )
78 pFxchMan->pTempOutputID[i] = 0;
79
80 pFxchMan->pTempOutputID[ iTranslation >> 5 ] = Temp;
81 Vec_IntPushArray( pFxchMan->vOutputID, pFxchMan->pTempOutputID, SizeOutputID );
82 }
83 else
84 {
85 Vec_IntClear( vCube );
86 pEntry = Vec_IntEntryP( pFxchMan->vOutputID, ( iCubeNoID * SizeOutputID ) + ( iTranslation >> 5 ) );
87 *pEntry |= Temp;
88 }
89 }
90
91 Hsh_VecManStop( pCubeHash );
92 Vec_WecRemoveEmpty( pFxchMan->vCubes );
93}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Vec_Int_t * vTranslation
Definition Fxch.h:111
Vec_Wec_t vCubes
Definition plaFxch.c:46
Vec_Int_t * vOutputID
Definition Fxch.h:112
int * pTempOutputID
Definition Fxch.h:113
int nSizeOutputID
Definition Fxch.h:114
struct Hsh_VecMan_t_ Hsh_VecMan_t
Definition vecHsh.h:85
#define Vec_WecForEachLevel(vGlob, vVec, i)
MACRO DEFINITIONS ///.
Definition vecWec.h:55
Here is the caller graph for this function:

◆ Fxch_CubesUnGruping()

void Fxch_CubesUnGruping ( Fxch_Man_t * pFxchMan)

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file Fxch.c.

107{
108 int iCube;
109 int i, j;
110 Vec_Int_t* vCube;
111 Vec_Int_t* vNewCube;
112
113 assert( Vec_WecSize( pFxchMan->vCubes ) == ( Vec_IntSize( pFxchMan->vOutputID ) / pFxchMan->nSizeOutputID ) );
114 Vec_WecForEachLevel( pFxchMan->vCubes, vCube, iCube )
115 {
116 int * pOutputID, nOnes;
117 if ( Vec_IntSize( vCube ) == 0 || Vec_IntEntry( vCube, 0 ) != 0 )
118 continue;
119
120 pOutputID = Vec_IntEntryP( pFxchMan->vOutputID, iCube * pFxchMan->nSizeOutputID );
121 nOnes = 0;
122
123 for ( i = 0; i < pFxchMan->nSizeOutputID; i++ )
124 nOnes += Fxch_CountOnes( (unsigned int) pOutputID[i] );
125
126 for ( i = 0; i < pFxchMan->nSizeOutputID && nOnes; i++ )
127 for ( j = 0; j < 32 && nOnes; j++ )
128 if ( pOutputID[i] & ( 1 << j ) )
129 {
130 if ( nOnes == 1 )
131 Vec_IntWriteEntry( vCube, 0, Vec_IntEntry( pFxchMan->vTranslation, ( i << 5 ) | j ) );
132 else
133 {
134 vNewCube = Vec_WecPushLevel( pFxchMan->vCubes );
135 Vec_IntAppend( vNewCube, vCube );
136 Vec_IntWriteEntry( vNewCube, 0, Vec_IntEntry( pFxchMan->vTranslation, (i << 5 ) | j ) );
137 }
138 nOnes -= 1;
139 }
140 }
141
142 Vec_IntFree( pFxchMan->vTranslation );
143 Vec_IntFree( pFxchMan->vOutputID );
144 ABC_FREE( pFxchMan->pTempOutputID );
145 return;
146}
#define ABC_FREE(obj)
Definition abc_global.h:267
Here is the caller graph for this function:

◆ Fxch_FastExtract()

int Fxch_FastExtract ( Vec_Wec_t * vCubes,
int ObjIdMax,
int nMaxDivExt,
int fVerbose,
int fVeryVerbose )

Function*************************************************************

Synopsis [ Performs fast extract with cube hashing on a set of covers. ]

Description []

SideEffects []

SeeAlso []

Definition at line 160 of file Fxch.c.

165{
166 abctime TempTime;
167 Fxch_Man_t* pFxchMan = Fxch_ManAlloc( vCubes );
168 int i;
169
170 TempTime = Abc_Clock();
171 Fxch_CubesGruping( pFxchMan );
172 Fxch_ManMapLiteralsIntoCubes( pFxchMan, ObjIdMax );
173 Fxch_ManGenerateLitHashKeys( pFxchMan );
174 Fxch_ManComputeLevel( pFxchMan );
175 Fxch_ManSCHashTablesInit( pFxchMan );
176 Fxch_ManDivCreate( pFxchMan );
177 pFxchMan->timeInit = Abc_Clock() - TempTime;
178
179 if ( fVeryVerbose )
180 Fxch_ManPrintDivs( pFxchMan );
181
182 if ( fVerbose )
183 Fxch_ManPrintStats( pFxchMan );
184
185 TempTime = Abc_Clock();
186
187 for ( i = 0; (!nMaxDivExt || i < nMaxDivExt) && Vec_QueTopPriority( pFxchMan->vDivPrio ) > 0.0; i++ )
188 {
189 int iDiv = Vec_QuePop( pFxchMan->vDivPrio );
190
191 if ( fVeryVerbose )
192 Fxch_DivPrint( pFxchMan, iDiv );
193
194 Fxch_ManUpdate( pFxchMan, iDiv );
195 }
196
197 pFxchMan->timeExt = Abc_Clock() - TempTime;
198
199 if ( fVerbose )
200 {
201 Fxch_ManPrintStats( pFxchMan );
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 );
205 }
206
207 Fxch_CubesUnGruping( pFxchMan );
208 Fxch_ManSCHashTablesFree( pFxchMan );
209 Fxch_ManFree( pFxchMan );
210
211 Vec_WecRemoveEmpty( vCubes );
212 Vec_WecSortByFirstInt( vCubes, 0 );
213
214 return 1;
215}
ABC_NAMESPACE_IMPL_START void Fxch_CubesGruping(Fxch_Man_t *pFxchMan)
FUNCTION DEFINITIONS ///.
Definition Fxch.c:37
void Fxch_CubesUnGruping(Fxch_Man_t *pFxchMan)
Definition Fxch.c:106
void Fxch_ManSCHashTablesFree(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:283
void Fxch_ManMapLiteralsIntoCubes(Fxch_Man_t *pFxchMan, int nVars)
Definition FxchMan.c:215
void Fxch_ManDivCreate(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:288
Fxch_Man_t * Fxch_ManAlloc(Vec_Wec_t *vCubes)
PUBLIC INTERFACE ///.
Definition FxchMan.c:169
void Fxch_ManPrintStats(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:772
void Fxch_ManFree(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:192
void Fxch_ManComputeLevel(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:338
void Fxch_ManPrintDivs(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:764
void Fxch_DivPrint(Fxch_Man_t *pFxchMan, int iDiv)
Definition FxchDiv.c:446
void Fxch_ManSCHashTablesInit(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:265
void Fxch_ManGenerateLitHashKeys(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:255
ABC_INT64_T abctime
Definition abc_global.h:332
struct Fxch_Man_t_ Fxch_Man_t
TYPEDEF DECLARATIONS ///.
Definition plaFxch.c:42
void Fxch_ManUpdate(Fxch_Man_t *p, int iDiv)
Definition plaFxch.c:617
abctime timeExt
Definition Fxch.h:128
abctime timeInit
Definition Fxch.h:127
Vec_Que_t * vDivPrio
Definition Fxch.h:105
Here is the call graph for this function:
Here is the caller graph for this function: