abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
extra.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [extra.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [extra]
8 
9  Synopsis [Various reusable software utilities.]
10 
11  Description [This library contains a number of operators and
12  traversal routines developed to extend the functionality of
13  CUDD v.2.3.x, by Fabio Somenzi (http://vlsi.colorado.edu/~fabio/)
14  To compile your code with the library, #include "extra.h"
15  in your source files and link your project to CUDD and this
16  library. Use the library at your own risk and with caution.
17  Note that debugging of some operators still continues.]
18 
19  Author [Alan Mishchenko]
20 
21  Affiliation [UC Berkeley]
22 
23  Date [Ver. 1.0. Started - June 20, 2005.]
24 
25  Revision [$Id: extra.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
26 
27 ***********************************************************************/
28 
29 #ifndef ABC__misc__extra__extra_h
30 #define ABC__misc__extra__extra_h
31 
32 
33 #ifdef _WIN32
34 #define inline __inline // compatible with MS VS 6.0
35 #endif
36 
37 /*---------------------------------------------------------------------------*/
38 /* Nested includes */
39 /*---------------------------------------------------------------------------*/
40 
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <string.h>
44 #include <assert.h>
45 
46 #include "misc/st/st.h"
47 
49 
50 
51 /*---------------------------------------------------------------------------*/
52 /* Constant declarations */
53 /*---------------------------------------------------------------------------*/
54 
55 /*---------------------------------------------------------------------------*/
56 /* Stucture declarations */
57 /*---------------------------------------------------------------------------*/
58 
59 /*---------------------------------------------------------------------------*/
60 /* Type declarations */
61 /*---------------------------------------------------------------------------*/
62 
63 /*---------------------------------------------------------------------------*/
64 /* Variable declarations */
65 /*---------------------------------------------------------------------------*/
66 
67 /*---------------------------------------------------------------------------*/
68 /* Macro declarations */
69 /*---------------------------------------------------------------------------*/
70 
71 typedef unsigned char uint8;
72 typedef unsigned short uint16;
73 typedef unsigned int uint32;
74 
75 /*===========================================================================*/
76 /* Various Utilities */
77 /*===========================================================================*/
78 
79 /*=== extraUtilBitMatrix.c ================================================================*/
80 
83 extern void Extra_BitMatrixClean( Extra_BitMat_t * p );
84 extern void Extra_BitMatrixStop( Extra_BitMat_t * p );
85 extern void Extra_BitMatrixPrint( Extra_BitMat_t * p );
87 extern void Extra_BitMatrixInsert1( Extra_BitMat_t * p, int i, int k );
88 extern int Extra_BitMatrixLookup1( Extra_BitMat_t * p, int i, int k );
89 extern void Extra_BitMatrixDelete1( Extra_BitMat_t * p, int i, int k );
90 extern void Extra_BitMatrixInsert2( Extra_BitMat_t * p, int i, int k );
91 extern int Extra_BitMatrixLookup2( Extra_BitMat_t * p, int i, int k );
92 extern void Extra_BitMatrixDelete2( Extra_BitMat_t * p, int i, int k );
93 extern void Extra_BitMatrixOr( Extra_BitMat_t * p, int i, unsigned * pInfo );
94 extern void Extra_BitMatrixOrTwo( Extra_BitMat_t * p, int i, int j );
98 
99 /*=== extraUtilFile.c ========================================================*/
100 
101 extern char * Extra_FileGetSimilarName( char * pFileNameWrong, char * pS1, char * pS2, char * pS3, char * pS4, char * pS5 );
102 extern char * Extra_FileNameExtension( char * FileName );
103 extern char * Extra_FileNameAppend( char * pBase, char * pSuffix );
104 extern char * Extra_FileNameGeneric( char * FileName );
105 extern char * Extra_FileNameGenericAppend( char * pBase, char * pSuffix );
106 extern void Extra_FileNameCorrectPath( char * FileName );
107 extern char * Extra_FileNameWithoutPath( char * FileName );
108 extern char * Extra_FilePathWithoutName( char * FileName );
109 extern char * Extra_FileDesignName( char * pFileName );
110 extern int Extra_FileCheck( char * pFileName );
111 extern int Extra_FileSize( char * pFileName );
112 extern char * Extra_FileRead( FILE * pFile );
113 extern char * Extra_FileRead2( FILE * pFile, FILE * pFile2 );
114 extern char * Extra_FileReadContents( char * pFileName );
115 extern char * Extra_FileReadContents2( char * pFileName, char * pFileName2 );
116 extern int Extra_FileIsType( char * pFileName, char * pS1, char * pS2, char * pS3 );
117 extern char * Extra_TimeStamp();
118 extern char * Extra_StringAppend( char * pStrGiven, char * pStrAdd );
119 extern void Extra_StringClean( char * pStrGiven, char * pCharKeep );
120 extern unsigned Extra_ReadBinary( char * Buffer );
121 extern void Extra_PrintBinary( FILE * pFile, unsigned Sign[], int nBits );
122 extern int Extra_ReadHex( unsigned Sign[], char * pString, int nDigits );
123 extern int Extra_ReadHexadecimal( unsigned Sign[], char * pString, int nVars );
124 extern void Extra_PrintHexadecimal( FILE * pFile, unsigned Sign[], int nVars );
125 extern void Extra_PrintHexadecimalString( char * pString, unsigned Sign[], int nVars );
126 extern void Extra_PrintHex( FILE * pFile, unsigned * pTruth, int nVars );
127 extern void Extra_PrintHexReverse( FILE * pFile, unsigned * pTruth, int nVars );
128 extern void Extra_PrintSymbols( FILE * pFile, char Char, int nTimes, int fPrintNewLine );
129 
130 /*=== extraUtilReader.c ========================================================*/
131 
134  char * pCharsComment, char * pCharsStop, char * pCharsClean );
135 extern void Extra_FileReaderFree( Extra_FileReader_t * p );
140 extern int Extra_FileReaderGetLineNumber( Extra_FileReader_t * p, int iToken );
141 
142 /*=== extraUtilMemory.c ========================================================*/
143 
147 
148 // fixed-size-block memory manager
149 extern Extra_MmFixed_t * Extra_MmFixedStart( int nEntrySize );
150 extern void Extra_MmFixedStop( Extra_MmFixed_t * p );
151 extern char * Extra_MmFixedEntryFetch( Extra_MmFixed_t * p );
152 extern void Extra_MmFixedEntryRecycle( Extra_MmFixed_t * p, char * pEntry );
153 extern void Extra_MmFixedRestart( Extra_MmFixed_t * p );
156 // flexible-size-block memory manager
158 extern void Extra_MmFlexStop( Extra_MmFlex_t * p );
159 extern void Extra_MmFlexPrint( Extra_MmFlex_t * p );
160 extern char * Extra_MmFlexEntryFetch( Extra_MmFlex_t * p, int nBytes );
162 // hierarchical memory manager
163 extern Extra_MmStep_t * Extra_MmStepStart( int nSteps );
164 extern void Extra_MmStepStop( Extra_MmStep_t * p );
165 extern char * Extra_MmStepEntryFetch( Extra_MmStep_t * p, int nBytes );
166 extern void Extra_MmStepEntryRecycle( Extra_MmStep_t * p, char * pEntry, int nBytes );
168 
169 /*=== extraUtilMisc.c ========================================================*/
170 
171 /* finds the smallest integer larger or equal than the logarithm */
172 extern int Extra_Base2LogDouble( double Num );
173 /* returns the power of two as a double */
174 extern double Extra_Power2( int Num );
175 extern int Extra_Power3( int Num );
176 /* the number of combinations of k elements out of n */
177 extern int Extra_NumCombinations( int k, int n );
178 extern int * Extra_DeriveRadixCode( int Number, int Radix, int nDigits );
179 /* counts the number of 1s in the bitstring */
180 extern int Extra_CountOnes( unsigned char * pBytes, int nBytes );
181 /* the factorial of number */
182 extern int Extra_Factorial( int n );
183 /* the permutation of the given number of elements */
184 extern char ** Extra_Permutations( int n );
185 /* permutation and complementation of a truth table */
186 unsigned Extra_TruthPermute( unsigned Truth, char * pPerms, int nVars, int fReverse );
187 unsigned Extra_TruthPolarize( unsigned uTruth, int Polarity, int nVars );
188 /* canonical forms of a truth table */
189 extern unsigned Extra_TruthCanonN( unsigned uTruth, int nVars );
190 extern unsigned Extra_TruthCanonNN( unsigned uTruth, int nVars );
191 extern unsigned Extra_TruthCanonP( unsigned uTruth, int nVars );
192 extern unsigned Extra_TruthCanonNP( unsigned uTruth, int nVars );
193 extern unsigned Extra_TruthCanonNPN( unsigned uTruth, int nVars );
194 /* canonical forms of 4-variable functions */
195 extern void Extra_Truth4VarNPN( unsigned short ** puCanons, char ** puPhases, char ** puPerms, unsigned char ** puMap );
196 extern void Extra_Truth4VarN( unsigned short ** puCanons, char *** puPhases, char ** ppCounters, int nPhasesMax );
197 /* permutation mapping */
198 extern unsigned short Extra_TruthPerm4One( unsigned uTruth, int Phase );
199 extern unsigned Extra_TruthPerm5One( unsigned uTruth, int Phase );
200 extern void Extra_TruthPerm6One( unsigned * uTruth, int Phase, unsigned * uTruthRes );
201 extern void Extra_TruthExpand( int nVars, int nWords, unsigned * puTruth, unsigned uPhase, unsigned * puTruthR );
202 /* precomputing tables for permutation mapping */
203 extern void ** Extra_ArrayAlloc( int nCols, int nRows, int Size );
204 extern unsigned short ** Extra_TruthPerm43();
205 extern unsigned ** Extra_TruthPerm53();
206 extern unsigned ** Extra_TruthPerm54();
207 /* bubble sort for small number of entries */
208 extern void Extra_BubbleSort( int Order[], int Costs[], int nSize, int fIncreasing );
209 /* complementation/permutation generation */
210 extern int * Extra_GreyCodeSchedule( int n );
211 extern int * Extra_PermSchedule( int n );
212 extern word Extra_Truth6MinimumExact( word t, int * pComp, int * pPerm );
214 
215 /*=== extraUtilCanon.c ========================================================*/
216 
217 /* fast computation of N-canoninical form up to 6 inputs */
218 extern int Extra_TruthCanonFastN( int nVarsMax, int nVarsReal, unsigned * pt, unsigned ** pptRes, char ** ppfRes );
219 
220 /*=== extraUtilDsd.c ========================================================*/
221 
222 typedef struct Sdm_Man_t_ Sdm_Man_t;
223 extern int Sdm_ManCanRead();
224 extern Sdm_Man_t * Sdm_ManRead();
225 extern void Sdm_ManQuit();
226 extern int Sdm_ManComputeFunc( Sdm_Man_t * p, int iDsdLit0, int iDsdLit1, int * pCut, int uMask, int fXor );
227 extern void Sdm_ManPrintDsdStats( Sdm_Man_t * p, int fVerbose );
228 extern int Sdm_ManReadDsdVarNum( Sdm_Man_t * p, int iDsd );
229 extern int Sdm_ManReadDsdAndNum( Sdm_Man_t * p, int iDsd );
230 extern int Sdm_ManReadDsdClauseNum( Sdm_Man_t * p, int iDsd );
231 extern word Sdm_ManReadDsdTruth( Sdm_Man_t * p, int iDsd );
232 extern char * Sdm_ManReadDsdStr( Sdm_Man_t * p, int iDsd );
233 extern void Sdm_ManReadCnfCosts( Sdm_Man_t * p, int * pCosts, int nCosts );
234 
235 /*=== extraUtilProgress.c ================================================================*/
236 
238 
239 extern ProgressBar * Extra_ProgressBarStart( FILE * pFile, int nItemsTotal );
240 extern void Extra_ProgressBarStop( ProgressBar * p );
241 extern void Extra_ProgressBarUpdate_int( ProgressBar * p, int nItemsCur, char * pString );
242 
243 static inline void Extra_ProgressBarUpdate( ProgressBar * p, int nItemsCur, char * pString )
244 { if ( p && nItemsCur < *((int*)p) ) return; Extra_ProgressBarUpdate_int(p, nItemsCur, pString); }
245 
246 /*=== extraUtilTruth.c ================================================================*/
247 
248 static inline int Extra_BitWordNum( int nBits ) { return nBits/(8*sizeof(unsigned)) + ((nBits%(8*sizeof(unsigned))) > 0); }
249 static inline int Extra_TruthWordNum( int nVars ) { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
250 
251 static inline void Extra_TruthSetBit( unsigned * p, int Bit ) { p[Bit>>5] |= (1<<(Bit & 31)); }
252 static inline void Extra_TruthXorBit( unsigned * p, int Bit ) { p[Bit>>5] ^= (1<<(Bit & 31)); }
253 static inline int Extra_TruthHasBit( unsigned * p, int Bit ) { return (p[Bit>>5] & (1<<(Bit & 31))) > 0; }
254 
255 static inline int Extra_WordCountOnes( unsigned uWord )
256 {
257  uWord = (uWord & 0x55555555) + ((uWord>>1) & 0x55555555);
258  uWord = (uWord & 0x33333333) + ((uWord>>2) & 0x33333333);
259  uWord = (uWord & 0x0F0F0F0F) + ((uWord>>4) & 0x0F0F0F0F);
260  uWord = (uWord & 0x00FF00FF) + ((uWord>>8) & 0x00FF00FF);
261  return (uWord & 0x0000FFFF) + (uWord>>16);
262 }
263 static inline int Extra_TruthCountOnes( unsigned * pIn, int nVars )
264 {
265  int w, Counter = 0;
266  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
267  Counter += Extra_WordCountOnes(pIn[w]);
268  return Counter;
269 }
270 static inline int Extra_TruthIsEqual( unsigned * pIn0, unsigned * pIn1, int nVars )
271 {
272  int w;
273  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
274  if ( pIn0[w] != pIn1[w] )
275  return 0;
276  return 1;
277 }
278 static inline int Extra_TruthIsConst0( unsigned * pIn, int nVars )
279 {
280  int w;
281  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
282  if ( pIn[w] )
283  return 0;
284  return 1;
285 }
286 static inline int Extra_TruthIsConst1( unsigned * pIn, int nVars )
287 {
288  int w;
289  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
290  if ( pIn[w] != ~(unsigned)0 )
291  return 0;
292  return 1;
293 }
294 static inline int Extra_TruthIsImply( unsigned * pIn1, unsigned * pIn2, int nVars )
295 {
296  int w;
297  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
298  if ( pIn1[w] & ~pIn2[w] )
299  return 0;
300  return 1;
301 }
302 static inline void Extra_TruthCopy( unsigned * pOut, unsigned * pIn, int nVars )
303 {
304  int w;
305  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
306  pOut[w] = pIn[w];
307 }
308 static inline void Extra_TruthClear( unsigned * pOut, int nVars )
309 {
310  int w;
311  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
312  pOut[w] = 0;
313 }
314 static inline void Extra_TruthFill( unsigned * pOut, int nVars )
315 {
316  int w;
317  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
318  pOut[w] = ~(unsigned)0;
319 }
320 static inline void Extra_TruthNot( unsigned * pOut, unsigned * pIn, int nVars )
321 {
322  int w;
323  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
324  pOut[w] = ~pIn[w];
325 }
326 static inline void Extra_TruthAnd( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars )
327 {
328  int w;
329  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
330  pOut[w] = pIn0[w] & pIn1[w];
331 }
332 static inline void Extra_TruthOr( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars )
333 {
334  int w;
335  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
336  pOut[w] = pIn0[w] | pIn1[w];
337 }
338 static inline void Extra_TruthSharp( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars )
339 {
340  int w;
341  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
342  pOut[w] = pIn0[w] & ~pIn1[w];
343 }
344 static inline void Extra_TruthNand( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars )
345 {
346  int w;
347  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
348  pOut[w] = ~(pIn0[w] & pIn1[w]);
349 }
350 static inline void Extra_TruthAndPhase( unsigned * pOut, unsigned * pIn0, unsigned * pIn1, int nVars, int fCompl0, int fCompl1 )
351 {
352  int w;
353  if ( fCompl0 && fCompl1 )
354  {
355  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
356  pOut[w] = ~(pIn0[w] | pIn1[w]);
357  }
358  else if ( fCompl0 && !fCompl1 )
359  {
360  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
361  pOut[w] = ~pIn0[w] & pIn1[w];
362  }
363  else if ( !fCompl0 && fCompl1 )
364  {
365  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
366  pOut[w] = pIn0[w] & ~pIn1[w];
367  }
368  else // if ( !fCompl0 && !fCompl1 )
369  {
370  for ( w = Extra_TruthWordNum(nVars)-1; w >= 0; w-- )
371  pOut[w] = pIn0[w] & pIn1[w];
372  }
373 }
374 
375 extern unsigned ** Extra_TruthElementary( int nVars );
376 extern void Extra_TruthSwapAdjacentVars( unsigned * pOut, unsigned * pIn, int nVars, int Start );
377 extern void Extra_TruthStretch( unsigned * pOut, unsigned * pIn, int nVars, int nVarsAll, unsigned Phase );
378 extern void Extra_TruthShrink( unsigned * pOut, unsigned * pIn, int nVars, int nVarsAll, unsigned Phase );
379 extern int Extra_TruthVarInSupport( unsigned * pTruth, int nVars, int iVar );
380 extern int Extra_TruthSupportSize( unsigned * pTruth, int nVars );
381 extern int Extra_TruthSupport( unsigned * pTruth, int nVars );
382 extern void Extra_TruthCofactor0( unsigned * pTruth, int nVars, int iVar );
383 extern void Extra_TruthCofactor1( unsigned * pTruth, int nVars, int iVar );
384 extern void Extra_TruthExist( unsigned * pTruth, int nVars, int iVar );
385 extern void Extra_TruthForall( unsigned * pTruth, int nVars, int iVar );
386 extern void Extra_TruthMux( unsigned * pOut, unsigned * pCof0, unsigned * pCof1, int nVars, int iVar );
387 extern void Extra_TruthChangePhase( unsigned * pTruth, int nVars, int iVar );
388 extern int Extra_TruthMinCofSuppOverlap( unsigned * pTruth, int nVars, int * pVarMin );
389 extern void Extra_TruthCountOnesInCofs( unsigned * pTruth, int nVars, short * pStore );
390 extern unsigned Extra_TruthHash( unsigned * pIn, int nWords );
391 extern unsigned Extra_TruthSemiCanonicize( unsigned * pInOut, unsigned * pAux, int nVars, char * pCanonPerm, short * pStore );
392 
393 /*=== extraUtilUtil.c ================================================================*/
394 
395 extern abctime Extra_CpuTime();
396 extern double Extra_CpuTimeDouble();
397 extern int Extra_GetSoftDataLimit();
398 extern ABC_DLL void Extra_UtilGetoptReset();
399 extern int Extra_UtilGetopt( int argc, char *argv[], const char *optstring );
400 extern char * Extra_UtilPrintTime( long t );
401 extern char * Extra_UtilStrsav( const char *s );
402 extern char * Extra_UtilTildeExpand( char *fname );
403 extern char * Extra_UtilFileSearch( char *file, char *path, char *mode );
404 extern void (*Extra_UtilMMoutOfMemory)( long size );
405 
406 extern const char * globalUtilOptarg;
407 extern int globalUtilOptind;
408 
409 /**AutomaticEnd***************************************************************/
410 
411 
412 
414 
415 
416 
417 #endif /* __EXTRA_H__ */
char * Extra_MmFlexEntryFetch(Extra_MmFlex_t *p, int nBytes)
void Extra_BitMatrixDelete1(Extra_BitMat_t *p, int i, int k)
static void Extra_TruthOr(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:332
char * Extra_FileNameWithoutPath(char *FileName)
void Extra_TruthMux(unsigned *pOut, unsigned *pCof0, unsigned *pCof1, int nVars, int iVar)
int Extra_MmStepReadMemUsage(Extra_MmStep_t *p)
static void Extra_TruthClear(unsigned *pOut, int nVars)
Definition: extra.h:308
int Extra_BitMatrixReadSize(Extra_BitMat_t *p)
void Sdm_ManPrintDsdStats(Sdm_Man_t *p, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: extraUtilDsd.c:676
void Extra_TruthCountOnesInCofs(unsigned *pTruth, int nVars, short *pStore)
int * Extra_GreyCodeSchedule(int n)
int * Extra_PermSchedule(int n)
static int Extra_TruthIsImply(unsigned *pIn1, unsigned *pIn2, int nVars)
Definition: extra.h:294
int Extra_TruthCanonFastN(int nVarsMax, int nVarsReal, unsigned *pt, unsigned **pptRes, char **ppfRes)
unsigned short Extra_TruthPerm4One(unsigned uTruth, int Phase)
Extra_MmStep_t * Extra_MmStepStart(int nSteps)
void Extra_BitMatrixDelete2(Extra_BitMat_t *p, int i, int k)
Sdm_Man_t * Sdm_ManRead()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * Extra_UtilFileSearch(char *file, char *path, char *mode)
char * Extra_StringAppend(char *pStrGiven, char *pStrAdd)
void Extra_ProgressBarUpdate_int(ProgressBar *p, int nItemsCur, char *pString)
void Extra_MmStepEntryRecycle(Extra_MmStep_t *p, char *pEntry, int nBytes)
static void Extra_TruthXorBit(unsigned *p, int Bit)
Definition: extra.h:252
int Sdm_ManReadDsdAndNum(Sdm_Man_t *p, int iDsd)
char * Sdm_ManReadDsdStr(Sdm_Man_t *p, int iDsd)
int Extra_BitMatrixLookup2(Extra_BitMat_t *p, int i, int k)
char * Extra_FileGetSimilarName(char *pFileNameWrong, char *pS1, char *pS2, char *pS3, char *pS4, char *pS5)
Definition: extraUtilFile.c:71
void Extra_BitMatrixInsert2(Extra_BitMat_t *p, int i, int k)
char * Extra_FileReaderGetFileName(Extra_FileReader_t *p)
void Extra_MmFlexPrint(Extra_MmFlex_t *p)
int Extra_FileReaderGetLineNumber(Extra_FileReader_t *p, int iToken)
void Extra_MmFixedStop(Extra_MmFixed_t *p)
char * Extra_UtilPrintTime(long t)
Extra_MmFlex_t * Extra_MmFlexStart()
unsigned short uint16
Definition: extra.h:72
void Extra_BubbleSort(int Order[], int Costs[], int nSize, int fIncreasing)
int Extra_BitMatrixIsDisjoint(Extra_BitMat_t *p1, Extra_BitMat_t *p2)
void ** Extra_ArrayAlloc(int nCols, int nRows, int Size)
void Extra_FileReaderFree(Extra_FileReader_t *p)
unsigned ** Extra_TruthPerm54()
unsigned Extra_TruthCanonNN(unsigned uTruth, int nVars)
ABC_NAMESPACE_HEADER_START typedef unsigned char uint8
Definition: extra.h:71
int Extra_BitMatrixLookup1(Extra_BitMat_t *p, int i, int k)
word Extra_Truth6MinimumExact(word t, int *pComp, int *pPerm)
double Extra_CpuTimeDouble()
unsigned Extra_TruthCanonP(unsigned uTruth, int nVars)
int Extra_MmFlexReadMemUsage(Extra_MmFlex_t *p)
int Extra_BitMatrixCountOnesUpper(Extra_BitMat_t *p)
int nWords
Definition: abcNpn.c:127
unsigned Extra_TruthPermute(unsigned Truth, char *pPerms, int nVars, int fReverse)
void Sdm_ManQuit()
word Sdm_ManReadDsdTruth(Sdm_Man_t *p, int iDsd)
double Extra_Power2(int Num)
Definition: extraUtilMisc.c:98
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
const char * globalUtilOptarg
Definition: extraUtilUtil.c:44
Extra_FileReader_t * Extra_FileReaderAlloc(char *pFileName, char *pCharsComment, char *pCharsStop, char *pCharsClean)
FUNCTION DEFINITIONS ///.
unsigned Extra_ReadBinary(char *Buffer)
int Extra_GetSoftDataLimit()
FUNCTION DEFINITIONS ///.
Definition: extraUtilUtil.c:64
#define ABC_DLL
Definition: abc_global.h:53
char * Extra_UtilStrsav(const char *s)
void Extra_TruthCofactor1(unsigned *pTruth, int nVars, int iVar)
void Extra_TruthPerm6One(unsigned *uTruth, int Phase, unsigned *uTruthRes)
char ** Extra_Permutations(int n)
unsigned short ** Extra_TruthPerm43()
static int Extra_TruthHasBit(unsigned *p, int Bit)
Definition: extra.h:253
void Extra_PrintHexReverse(FILE *pFile, unsigned *pTruth, int nVars)
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
void Extra_TruthExist(unsigned *pTruth, int nVars, int iVar)
void Extra_PrintSymbols(FILE *pFile, char Char, int nTimes, int fPrintNewLine)
int Extra_ReadHex(unsigned Sign[], char *pString, int nDigits)
ABC_DLL void Extra_UtilGetoptReset()
Definition: extraUtilUtil.c:80
DECLARATIONS ///.
unsigned Extra_TruthHash(unsigned *pIn, int nWords)
void Extra_TruthExpand(int nVars, int nWords, unsigned *puTruth, unsigned uPhase, unsigned *puTruthR)
unsigned Extra_TruthPolarize(unsigned uTruth, int Polarity, int nVars)
unsigned int uint32
Definition: extra.h:73
char Char
Definition: bzlib_private.h:43
int Extra_FileSize(char *pFileName)
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
unsigned Extra_TruthCanonN(unsigned uTruth, int nVars)
int Extra_TruthSupport(unsigned *pTruth, int nVars)
abctime Extra_CpuTime()
static int Extra_BitWordNum(int nBits)
Definition: extra.h:248
static void Extra_TruthSetBit(unsigned *p, int Bit)
Definition: extra.h:251
void Extra_BitMatrixStop(Extra_BitMat_t *p)
char * Extra_FileNameGeneric(char *FileName)
int Extra_TruthSupportSize(unsigned *pTruth, int nVars)
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
static void Extra_TruthFill(unsigned *pOut, int nVars)
Definition: extra.h:314
unsigned Extra_TruthPerm5One(unsigned uTruth, int Phase)
int Sdm_ManReadDsdClauseNum(Sdm_Man_t *p, int iDsd)
int globalUtilOptind
Definition: extraUtilUtil.c:45
static int Extra_TruthCountOnes(unsigned *pIn, int nVars)
Definition: extra.h:263
static int size
Definition: cuddSign.c:86
static void Extra_TruthAnd(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:326
static int Counter
void Extra_FileNameCorrectPath(char *FileName)
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
static void Extra_TruthSharp(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:338
void Extra_TruthStretch(unsigned *pOut, unsigned *pIn, int nVars, int nVarsAll, unsigned Phase)
int Extra_ReadHexadecimal(unsigned Sign[], char *pString, int nVars)
void Extra_ProgressBarStop(ProgressBar *p)
int Extra_Power3(int Num)
int Extra_BitMatrixIsClique(Extra_BitMat_t *p)
static int pPerm[13719]
Definition: rwrTemp.c:32
void Extra_MmFixedRestart(Extra_MmFixed_t *p)
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
void Extra_StringClean(char *pStrGiven, char *pCharKeep)
void Extra_TruthChangePhase(unsigned *pTruth, int nVars, int iVar)
void Sdm_ManReadCnfCosts(Sdm_Man_t *p, int *pCosts, int nCosts)
static int Extra_TruthWordNum(int nVars)
Definition: extra.h:249
int Extra_NumCombinations(int k, int n)
static int Extra_TruthIsEqual(unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:270
char * Extra_FileNameAppend(char *pBase, char *pSuffix)
void Extra_Truth4VarN(unsigned short **puCanons, char ***puPhases, char **ppCounters, int nPhasesMax)
void Extra_TruthForall(unsigned *pTruth, int nVars, int iVar)
unsigned ** Extra_TruthPerm53()
void Extra_BitMatrixPrint(Extra_BitMat_t *p)
void Extra_BitMatrixOrTwo(Extra_BitMat_t *p, int i, int j)
Extra_BitMat_t * Extra_BitMatrixStart(int nSize)
int Sdm_ManCanRead()
static int Extra_TruthIsConst1(unsigned *pIn, int nVars)
Definition: extra.h:286
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
word Extra_Truth6MinimumHeuristic(word t)
unsigned Extra_TruthCanonNPN(unsigned uTruth, int nVars)
int Extra_TruthVarInSupport(unsigned *pTruth, int nVars, int iVar)
void * Extra_FileReaderGetTokens(Extra_FileReader_t *p)
void Extra_MmStepStop(Extra_MmStep_t *p)
int Extra_FileCheck(char *pFileName)
int * Extra_DeriveRadixCode(int Number, int Radix, int nDigits)
int Extra_TruthMinCofSuppOverlap(unsigned *pTruth, int nVars, int *pVarMin)
void Extra_BitMatrixClean(Extra_BitMat_t *p)
int Extra_FileReaderGetFileSize(Extra_FileReader_t *p)
int Extra_CountOnes(unsigned char *pBytes, int nBytes)
char * Extra_FileRead2(FILE *pFile, FILE *pFile2)
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
Definition: extraUtilUtil.c:98
char * Extra_TimeStamp()
unsigned Extra_TruthCanonNP(unsigned uTruth, int nVars)
char * Extra_FileDesignName(char *pFileName)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
void Extra_TruthSwapAdjacentVars(unsigned *pOut, unsigned *pIn, int nVars, int Start)
unsigned Extra_TruthSemiCanonicize(unsigned *pInOut, unsigned *pAux, int nVars, char *pCanonPerm, short *pStore)
int Extra_Factorial(int n)
char * Extra_FileRead(FILE *pFile)
static int Extra_WordCountOnes(unsigned uWord)
Definition: extra.h:255
void Extra_BitMatrixOr(Extra_BitMat_t *p, int i, unsigned *pInfo)
static int Extra_TruthIsConst0(unsigned *pIn, int nVars)
Definition: extra.h:278
int Extra_MmFixedReadMaxEntriesUsed(Extra_MmFixed_t *p)
void Extra_Truth4VarNPN(unsigned short **puCanons, char **puPhases, char **puPerms, unsigned char **puMap)
void Extra_TruthCofactor0(unsigned *pTruth, int nVars, int iVar)
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int Extra_FileIsType(char *pFileName, char *pS1, char *pS2, char *pS3)
void Extra_MmFixedEntryRecycle(Extra_MmFixed_t *p, char *pEntry)
void Extra_PrintHexadecimal(FILE *pFile, unsigned Sign[], int nVars)
int Sdm_ManComputeFunc(Sdm_Man_t *p, int iDsdLit0, int iDsdLit1, int *pCut, int uMask, int fXor)
Definition: extraUtilDsd.c:920
char * Extra_FileNameExtension(char *FileName)
static void Extra_TruthAndPhase(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars, int fCompl0, int fCompl1)
Definition: extra.h:350
int Extra_Base2LogDouble(double Num)
Definition: extraUtilMisc.c:74
ABC_INT64_T abctime
Definition: abc_global.h:278
void Extra_TruthShrink(unsigned *pOut, unsigned *pIn, int nVars, int nVarsAll, unsigned Phase)
static void Extra_TruthNot(unsigned *pOut, unsigned *pIn, int nVars)
Definition: extra.h:320
int Extra_MmFixedReadMemUsage(Extra_MmFixed_t *p)
char * Extra_FilePathWithoutName(char *FileName)
char * Extra_MmStepEntryFetch(Extra_MmStep_t *p, int nBytes)
void Extra_MmFlexStop(Extra_MmFlex_t *p)
char * Extra_FileReadContents(char *pFileName)
void Extra_PrintHexadecimalString(char *pString, unsigned Sign[], int nVars)
char * Extra_UtilTildeExpand(char *fname)
static void Extra_TruthCopy(unsigned *pOut, unsigned *pIn, int nVars)
Definition: extra.h:302
void(* Extra_UtilMMoutOfMemory)(long size)
unsigned ** Extra_TruthElementary(int nVars)
char * Extra_FileReadContents2(char *pFileName, char *pFileName2)
void Extra_BitMatrixInsert1(Extra_BitMat_t *p, int i, int k)
int Sdm_ManReadDsdVarNum(Sdm_Man_t *p, int iDsd)
Definition: extraUtilDsd.c:997
int Extra_FileReaderGetCurPosition(Extra_FileReader_t *p)
static void Extra_TruthNand(unsigned *pOut, unsigned *pIn0, unsigned *pIn1, int nVars)
Definition: extra.h:344