ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
Fxch.h
Go to the documentation of this file.
1
18
19#ifndef ABC__opt__fxch__fxch_h
20#define ABC__opt__fxch__fxch_h
21
22#include "base/abc/abc.h"
23
24#include "misc/vec/vecHsh.h"
25#include "misc/vec/vecQue.h"
26#include "misc/vec/vecVec.h"
27#include "misc/vec/vecWec.h"
28
30
31typedef unsigned char uint8_t;
32typedef unsigned int uint32_t;
33
37typedef struct Fxch_Man_t_ Fxch_Man_t;
44/* Sub-Cube Structure
45 *
46 * In the context of this program, a sub-cube is a cube derived from
47 * another cube by removing one or two literals. Since a cube is represented
48 * as a vector of literals, one might think that a sub-cube would also be
49 * represented in the same way. However, in order to same memory, we only
50 * store a sub-cube identifier and the data necessary to generate the sub-cube:
51 * - The index number of the orignal cube in the cover. (iCube)
52 * - Identifiers of which literal(s) was(were) removed. (iLit0, iLit1)
53 *
54 * The sub-cube identifier is generated by adding the unique identifiers of
55 * its literals.
56 *
57 */
58
66
67/* Sub-cube Hash Table
68 */
75
77{
79 /* Internal data */
81 unsigned int nEntries,
83
84 /* Temporary data */
87};
88
89struct Fxch_Man_t_
90{
91 /* user's data */
95
96 /* internal data */
98
99 Vec_Wec_t* vLits; /* lit -> cube */
100 Vec_Int_t* vLitCount; /* literal counts (currently not used) */
101 Vec_Int_t* vLitHashKeys; /* Literal hash keys used to generate subcube hash */
102
104 Vec_Flt_t* vDivWeights; /* divisor weights */
105 Vec_Que_t* vDivPrio; /* priority queue for divisors by weight */
106 Vec_Wec_t* vDivCubePairs; /* cube pairs for each div */
107
108 Vec_Int_t* vLevels; /* variable levels */
109
110 // Cube Grouping
115
116 // temporary data to update the data-structure when a divisor is extracted
117 Vec_Int_t* vCubesS; /* cubes for the given single cube divisor */
118 Vec_Int_t* vPairs; /* cube pairs for the given double cube divisor */
119 Vec_Int_t* vCubeFree; // cube-free divisor
120 Vec_Int_t* vDiv; // selected divisor
121
125
126 /* Statistics */
127 abctime timeInit; /* Initialization time */
128 abctime timeExt; /* Extraction time */
129 int nVars; // original problem variables
130 int nLits; // the number of SOP literals
131 int nPairsS; // number of lit pairs
132 int nPairsD; // number of cube pairs
133 int nExtDivs; /* Number of extracted divisor */
134};
135
139/* The following functions are from abcFx.c
140 * They are use in order to retrive SOP information for fast_extract
141 * Since I want an implementation that change only the core part of
142 * the algorithm I'm using this */
143extern Vec_Wec_t* Abc_NtkFxRetrieve( Abc_Ntk_t* pNtk );
144extern void Abc_NtkFxInsert( Abc_Ntk_t* pNtk, Vec_Wec_t* vCubes );
145extern int Abc_NtkFxCheck( Abc_Ntk_t* pNtk );
146
147static inline int Fxch_CountOnes( unsigned num )
148{
149 num = ( num & 0x55555555 ) + ( ( num >> 1) & 0x55555555 );
150 num = ( num & 0x33333333 ) + ( ( num >> 2) & 0x33333333 );
151 num = ( num & 0x0F0F0F0F ) + ( ( num >> 4) & 0x0F0F0F0F );
152 num = ( num & 0x00FF00FF ) + ( ( num >> 8) & 0x00FF00FF );
153 return ( num & 0x0000FFFF ) + ( num >> 16 );
154}
155
156/*===== Fxch.c =======================================================*/
157int Abc_NtkFxchPerform( Abc_Ntk_t* pNtk, int nMaxDivExt, int fVerbose, int fVeryVerbose );
158int Fxch_FastExtract( Vec_Wec_t* vCubes, int ObjIdMax, int nMaxDivExt, int fVerbose, int fVeryVerbose );
159
160/*===== FxchDiv.c ====================================================================================================*/
161int Fxch_DivCreate( Fxch_Man_t* pFxchMan, Fxch_SubCube_t* pSubCube0, Fxch_SubCube_t* pSubCube1 );
162int Fxch_DivAdd( Fxch_Man_t* pFxchMan, int fUpdate, int fSingleCube, int fBase );
163int Fxch_DivRemove( Fxch_Man_t* pFxchMan, int fUpdate, int fSingleCube, int fBase );
164void Fxch_DivSepareteCubes( Vec_Int_t* vDiv, Vec_Int_t* vCube0, Vec_Int_t* vCube1 );
165int Fxch_DivRemoveLits( Vec_Int_t* vCube0, Vec_Int_t* vCube1, Vec_Int_t* vDiv, int *fCompl );
166void Fxch_DivPrint( Fxch_Man_t* pFxchMan, int iDiv );
168
169/*===== FxchMan.c ====================================================================================================*/
171void Fxch_ManFree( Fxch_Man_t* pFxchMan );
172void Fxch_ManMapLiteralsIntoCubes( Fxch_Man_t* pFxchMan, int nVars );
174void Fxch_ManSCHashTablesInit( Fxch_Man_t* pFxchMan );
175void Fxch_ManSCHashTablesFree( Fxch_Man_t* pFxchMan );
176void Fxch_ManDivCreate( Fxch_Man_t* pFxchMan );
177int Fxch_ManComputeLevelDiv( Fxch_Man_t* pFxchMan, Vec_Int_t* vCubeFree );
178int Fxch_ManComputeLevelCube( Fxch_Man_t* pFxchMan, Vec_Int_t* vCube );
179void Fxch_ManComputeLevel( Fxch_Man_t* pFxchMan );
180void Fxch_ManUpdate( Fxch_Man_t* pFxchMan, int iDiv );
181void Fxch_ManPrintDivs( Fxch_Man_t* pFxchMan );
182void Fxch_ManPrintStats( Fxch_Man_t* pFxchMan );
183
184static inline Vec_Int_t* Fxch_ManGetCube( Fxch_Man_t* pFxchMan,
185 int iCube )
186{
187 return Vec_WecEntry( pFxchMan->vCubes, iCube );
188}
189
190static inline int Fxch_ManGetLit( Fxch_Man_t* pFxchMan,
191 int iCube,
192 int iLit )
193{
194 return Vec_IntEntry( Vec_WecEntry(pFxchMan->vCubes, iCube), iLit );
195}
196
197/*===== FxchSCHashTable.c ============================================*/
198Fxch_SCHashTable_t* Fxch_SCHashTableCreate( Fxch_Man_t* pFxchMan, int nEntries );
199
201
203 Vec_Wec_t* vCubes,
204 uint32_t SubCubeID,
205 uint32_t iCube,
206 uint32_t iLit0,
207 uint32_t iLit1,
208 char fUpdate );
209
210
212 Vec_Wec_t* vCubes,
213 uint32_t SubCubeID,
214 uint32_t iCube,
215 uint32_t iLit0,
216 uint32_t iLit1,
217 char fUpdate );
218
221
223
224#endif
225
229
struct Fxch_SCHashTable_t_ Fxch_SCHashTable_t
Definition Fxch.h:39
int Abc_NtkFxchPerform(Abc_Ntk_t *pNtk, int nMaxDivExt, int fVerbose, int fVeryVerbose)
Definition Fxch.c:229
void Fxch_ManSCHashTablesFree(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:283
int Fxch_DivAdd(Fxch_Man_t *pFxchMan, int fUpdate, int fSingleCube, int fBase)
Definition FxchDiv.c:228
void Fxch_ManMapLiteralsIntoCubes(Fxch_Man_t *pFxchMan, int nVars)
Definition FxchMan.c:215
int Fxch_ManComputeLevelDiv(Fxch_Man_t *pFxchMan, Vec_Int_t *vCubeFree)
Definition FxchMan.c:312
Fxch_SCHashTable_t * Fxch_SCHashTableCreate(Fxch_Man_t *pFxchMan, int nEntries)
struct Fxch_SubCube_t_ Fxch_SubCube_t
Definition Fxch.h:38
int Fxch_DivRemoveLits(Vec_Int_t *vCube0, Vec_Int_t *vCube1, Vec_Int_t *vDiv, int *fCompl)
Definition FxchDiv.c:380
unsigned int uint32_t
Definition Fxch.h:32
void Fxch_ManUpdate(Fxch_Man_t *pFxchMan, int iDiv)
Definition plaFxch.c:617
int Fxch_ManComputeLevelCube(Fxch_Man_t *pFxchMan, Vec_Int_t *vCube)
Definition FxchMan.c:325
void Fxch_ManDivCreate(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:288
Vec_Wec_t * Abc_NtkFxRetrieve(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcFx.c:140
int Fxch_DivIsNotConstant1(Vec_Int_t *vDiv)
Definition FxchDiv.c:470
int Fxch_SCHashTableRemove(Fxch_SCHashTable_t *pSCHashTable, Vec_Wec_t *vCubes, uint32_t SubCubeID, uint32_t iCube, uint32_t iLit0, uint32_t iLit1, char fUpdate)
int Fxch_DivCreate(Fxch_Man_t *pFxchMan, Fxch_SubCube_t *pSubCube0, Fxch_SubCube_t *pSubCube1)
Definition FxchDiv.c:112
void Fxch_DivSepareteCubes(Vec_Int_t *vDiv, Vec_Int_t *vCube0, Vec_Int_t *vCube1)
Definition FxchDiv.c:339
Fxch_Man_t * Fxch_ManAlloc(Vec_Wec_t *vCubes)
PUBLIC INTERFACE ///.
Definition FxchMan.c:169
int Fxch_FastExtract(Vec_Wec_t *vCubes, int ObjIdMax, int nMaxDivExt, int fVerbose, int fVeryVerbose)
Definition Fxch.c:160
void Fxch_ManPrintStats(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:772
void Fxch_ManFree(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:192
void Abc_NtkFxInsert(Abc_Ntk_t *pNtk, Vec_Wec_t *vCubes)
Definition abcFx.c:183
void Fxch_ManComputeLevel(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:338
void Fxch_SCHashTablePrint(Fxch_SCHashTable_t *)
unsigned int Fxch_SCHashTableMemory(Fxch_SCHashTable_t *)
ABC_NAMESPACE_HEADER_START typedef unsigned char uint8_t
Definition Fxch.h:31
void Fxch_ManPrintDivs(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:764
void Fxch_DivPrint(Fxch_Man_t *pFxchMan, int iDiv)
Definition FxchDiv.c:446
struct Fxch_SCHashTable_Entry_t_ Fxch_SCHashTable_Entry_t
Definition Fxch.h:40
void Fxch_ManSCHashTablesInit(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:265
int Fxch_DivRemove(Fxch_Man_t *pFxchMan, int fUpdate, int fSingleCube, int fBase)
Definition FxchDiv.c:291
void Fxch_ManGenerateLitHashKeys(Fxch_Man_t *pFxchMan)
Definition FxchMan.c:255
int Abc_NtkFxCheck(Abc_Ntk_t *pNtk)
Definition abcFx.c:283
void Fxch_SCHashTableDelete(Fxch_SCHashTable_t *)
int Fxch_SCHashTableInsert(Fxch_SCHashTable_t *pSCHashTable, Vec_Wec_t *vCubes, uint32_t SubCubeID, uint32_t iCube, uint32_t iLit0, uint32_t iLit1, char fUpdate)
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Fxch_Man_t_ Fxch_Man_t
TYPEDEF DECLARATIONS ///.
Definition plaFxch.c:42
Vec_Int_t * vSCC
Definition Fxch.h:124
int nVars
Definition plaFxch.c:65
Vec_Int_t * vTranslation
Definition Fxch.h:111
int nExtDivs
Definition Fxch.h:133
Vec_Flt_t * vDivWeights
Definition Fxch.h:104
Hsh_VecMan_t * pDivHash
Definition Fxch.h:103
abctime timeExt
Definition Fxch.h:128
Vec_Wec_t vLits
Definition plaFxch.c:48
Vec_Wec_t vCubes
Definition plaFxch.c:46
int LitCountMax
Definition Fxch.h:94
Vec_Wec_t vPairs
Definition plaFxch.c:55
int nLits
Definition plaFxch.c:66
abctime timeInit
Definition Fxch.h:127
Vec_Int_t * vLitHashKeys
Definition Fxch.h:101
Vec_Int_t * vLitCount
Definition Fxch.h:100
Vec_Int_t * vCubeFree
Definition Fxch.h:119
Vec_Que_t * vDivPrio
Definition Fxch.h:105
Vec_Int_t vCubesS
Definition plaFxch.c:58
Vec_Int_t * vOutputID
Definition Fxch.h:112
int nCubesInit
Definition Fxch.h:93
Vec_Int_t * vDiv
Definition Fxch.h:120
int * pTempOutputID
Definition Fxch.h:113
Vec_Int_t * vCubesToUpdate
Definition Fxch.h:123
Vec_Int_t * vLevels
Definition Fxch.h:108
int nPairsS
Definition plaFxch.c:68
Vec_Int_t * vCubesToRemove
Definition Fxch.h:122
int nPairsD
Definition plaFxch.c:69
Fxch_SCHashTable_t * pSCHashTable
Definition Fxch.h:97
int nSizeOutputID
Definition Fxch.h:114
Vec_Wec_t * vDivCubePairs
Definition Fxch.h:106
Definition Fxch.h:70
uint32_t Cap
Definition Fxch.h:73
Fxch_SubCube_t * vSCData
Definition Fxch.h:71
uint32_t Size
Definition Fxch.h:72
Fxch_SCHashTable_Entry_t * pBins
Definition Fxch.h:80
Vec_Int_t vSubCube1
Definition Fxch.h:86
unsigned int SizeMask
Definition Fxch.h:82
Fxch_Man_t * pFxchMan
Definition Fxch.h:78
unsigned int nEntries
Definition Fxch.h:81
Vec_Int_t vSubCube0
Definition Fxch.h:85
STRUCTURES DEFINITIONS ///.
Definition Fxch.h:60
uint32_t iLit1
Definition Fxch.h:64
uint32_t Id
Definition Fxch.h:61
uint32_t iLit0
Definition Fxch.h:63
uint32_t iCube
Definition Fxch.h:62
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition vecFlt.h:42
struct Hsh_VecMan_t_ Hsh_VecMan_t
Definition vecHsh.h:85
typedefABC_NAMESPACE_HEADER_START struct Vec_Que_t_ Vec_Que_t
INCLUDES ///.
Definition vecQue.h:40
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition vecWec.h:42