abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abc_global.h File Reference
#include <time.h>
#include <stdarg.h>
#include <stdlib.h>

Go to the source code of this file.

Macros

#define ABC_DLLIMPORT
 INCLUDES ///. More...
 
#define ABC_DLL   ABC_DLLIMPORT
 
#define ___unused
 
#define ABC_NAMESPACE_HEADER_START
 NAMESPACES ///. More...
 
#define ABC_NAMESPACE_HEADER_END
 
#define ABC_NAMESPACE_IMPL_START
 
#define ABC_NAMESPACE_IMPL_END
 
#define ABC_NAMESPACE_PREFIX
 
#define ABC_CONST(number)   number
 PARAMETERS ///. More...
 
#define ABC_INFINITY   (100000000)
 MACRO DEFINITIONS ///. More...
 
#define ABC_SWAP(Type, a, b)   { Type t = a; a = b; b = t; }
 
#define ABC_PRT(a, t)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec\n", 1.0*(t)/(CLOCKS_PER_SEC)))
 
#define ABC_PRTr(a, t)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec\r", 1.0*(t)/(CLOCKS_PER_SEC)))
 
#define ABC_PRTn(a, t)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec ", 1.0*(t)/(CLOCKS_PER_SEC)))
 
#define ABC_PRTP(a, t, T)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec (%6.2f %%)\n", 1.0*(t)/(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0))
 
#define ABC_PRM(a, f)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB\n", 1.0*(f)/(1<<20)))
 
#define ABC_PRMr(a, f)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB\r", 1.0*(f)/(1<<20)))
 
#define ABC_PRMn(a, f)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB ", 1.0*(f)/(1<<20)))
 
#define ABC_PRMP(a, f, F)   (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB (%6.2f %%)\n", (1.0*(f)/(1<<20)), ((F)? 100.0*(f)/(F) : 0.0) ) )
 
#define ABC_ALLOC(type, num)   ((type *) malloc(sizeof(type) * (num)))
 
#define ABC_CALLOC(type, num)   ((type *) calloc((num), sizeof(type)))
 
#define ABC_FALLOC(type, num)   ((type *) memset(malloc(sizeof(type) * (num)), 0xff, sizeof(type) * (num)))
 
#define ABC_FREE(obj)   ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)
 
#define ABC_REALLOC(type, obj, num)
 
#define BRIDGE_NETLIST   106
 
#define BRIDGE_ABS_NETLIST   107
 

Typedefs

typedef ABC_UINT64_T word
 
typedef ABC_INT64_T iword
 
typedef ABC_INT64_T abctime
 

Enumerations

enum  Abc_VerbLevel {
  ABC_PROMPT = -2, ABC_ERROR = -1, ABC_WARNING = 0, ABC_STANDARD = 1,
  ABC_VERBOSE = 2
}
 

Functions

static int Abc_AbsInt (int a)
 
static int Abc_MaxInt (int a, int b)
 
static int Abc_MinInt (int a, int b)
 
static word Abc_MaxWord (word a, word b)
 
static word Abc_MinWord (word a, word b)
 
static float Abc_AbsFloat (float a)
 
static float Abc_MaxFloat (float a, float b)
 
static float Abc_MinFloat (float a, float b)
 
static double Abc_AbsDouble (double a)
 
static double Abc_MaxDouble (double a, double b)
 
static double Abc_MinDouble (double a, double b)
 
static int Abc_Float2Int (float Val)
 
static float Abc_Int2Float (int Num)
 
static int Abc_Base2Log (unsigned n)
 
static int Abc_Base10Log (unsigned n)
 
static int Abc_Base16Log (unsigned n)
 
static char * Abc_UtilStrsav (char *s)
 
static int Abc_BitWordNum (int nBits)
 
static int Abc_TruthWordNum (int nVars)
 
static int Abc_Truth6WordNum (int nVars)
 
static int Abc_InfoHasBit (unsigned *p, int i)
 
static void Abc_InfoSetBit (unsigned *p, int i)
 
static void Abc_InfoXorBit (unsigned *p, int i)
 
static unsigned Abc_InfoMask (int nVar)
 
static int Abc_Var2Lit (int Var, int fCompl)
 
static int Abc_Lit2Var (int Lit)
 
static int Abc_LitIsCompl (int Lit)
 
static int Abc_LitNot (int Lit)
 
static int Abc_LitNotCond (int Lit, int c)
 
static int Abc_LitRegular (int Lit)
 
static int Abc_Lit2LitV (int *pMap, int Lit)
 
static int Abc_Lit2LitL (int *pMap, int Lit)
 
static int Abc_Ptr2Int (void *p)
 
static void * Abc_Int2Ptr (int i)
 
static word Abc_Ptr2Wrd (void *p)
 
static void * Abc_Wrd2Ptr (word i)
 
static abctime Abc_Clock ()
 
int Gia_ManToBridgeText (FILE *pFile, int Size, unsigned char *pBuffer)
 
int Gia_ManToBridgeAbsNetlist (FILE *pFile, void *p, int pkg_type)
 
char * vnsprintf (const char *format, va_list args)
 
char * nsprintf (const char *format,...)
 
static void Abc_Print (int level, const char *format,...)
 
static void Abc_PrintInt (int i)
 
static void Abc_PrintTime (int level, const char *pStr, abctime time)
 
static void Abc_PrintTimeP (int level, const char *pStr, abctime time, abctime Time)
 
static void Abc_PrintMemoryP (int level, const char *pStr, int mem, int Mem)
 
static int Abc_PrimeCudd (unsigned int p)
 
void Abc_MergeSort (int *pInput, int nSize)
 
int * Abc_MergeSortCost (int *pCosts, int nSize)
 
void Abc_QuickSort1 (word *pData, int nSize, int fDecrease)
 
void Abc_QuickSort2 (word *pData, int nSize, int fDecrease)
 
void Abc_QuickSort3 (word *pData, int nSize, int fDecrease)
 
void Abc_QuickSortCostData (int *pCosts, int nSize, int fDecrease, word *pData, int *pResult)
 
int * Abc_QuickSortCost (int *pCosts, int nSize, int fDecrease)
 

Macro Definition Documentation

#define ___unused

Definition at line 68 of file abc_global.h.

#define ABC_ALLOC (   type,
  num 
)    ((type *) malloc(sizeof(type) * (num)))

Definition at line 229 of file abc_global.h.

#define ABC_CALLOC (   type,
  num 
)    ((type *) calloc((num), sizeof(type)))

Definition at line 230 of file abc_global.h.

#define ABC_CONST (   number)    number

PARAMETERS ///.

BASIC TYPES /// Pointer difference type; replacement for ptrdiff_t. This is a signed integral type that is the same size as a pointer. NOTE: This type may be different sizes on different platforms. Unsigned integral type that can contain a pointer. This is an unsigned integral type that is the same size as a pointer. NOTE: This type may be different sizes on different platforms. Signed integral type that can contain a pointer. This is a signed integral type that is the same size as a pointer. NOTE: This type may be different sizes on different platforms. 64-bit signed integral type. 64-bit unsigned integral type.

Definition at line 206 of file abc_global.h.

#define ABC_DLL   ABC_DLLIMPORT

Definition at line 53 of file abc_global.h.

#define ABC_DLLIMPORT

INCLUDES ///.

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

FileName [abc_global.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Global declarations.]

Synopsis [Global declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - Jan 30, 2009.]

Revision [

Id:
abc_global.h,v 1.00 2009/01/30 00:00:00 alanmi Exp

]

Definition at line 49 of file abc_global.h.

#define ABC_FALLOC (   type,
  num 
)    ((type *) memset(malloc(sizeof(type) * (num)), 0xff, sizeof(type) * (num)))

Definition at line 231 of file abc_global.h.

#define ABC_FREE (   obj)    ((obj) ? (free((char *) (obj)), (obj) = 0) : 0)

Definition at line 232 of file abc_global.h.

#define ABC_INFINITY   (100000000)

MACRO DEFINITIONS ///.

Definition at line 216 of file abc_global.h.

#define ABC_NAMESPACE_HEADER_END

Definition at line 106 of file abc_global.h.

#define ABC_NAMESPACE_HEADER_START

NAMESPACES ///.

Definition at line 105 of file abc_global.h.

#define ABC_NAMESPACE_IMPL_END

Definition at line 108 of file abc_global.h.

#define ABC_NAMESPACE_IMPL_START

Definition at line 107 of file abc_global.h.

#define ABC_NAMESPACE_PREFIX

Definition at line 109 of file abc_global.h.

#define ABC_PRM (   a,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB\n", 1.0*(f)/(1<<20)))

Definition at line 224 of file abc_global.h.

#define ABC_PRMn (   a,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB ", 1.0*(f)/(1<<20)))

Definition at line 226 of file abc_global.h.

#define ABC_PRMP (   a,
  f,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB (%6.2f %%)\n", (1.0*(f)/(1<<20)), ((F)? 100.0*(f)/(F) : 0.0) ) )

Definition at line 227 of file abc_global.h.

#define ABC_PRMr (   a,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%10.3f MB\r", 1.0*(f)/(1<<20)))

Definition at line 225 of file abc_global.h.

#define ABC_PRT (   a,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec\n", 1.0*(t)/(CLOCKS_PER_SEC)))

Definition at line 220 of file abc_global.h.

#define ABC_PRTn (   a,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec ", 1.0*(t)/(CLOCKS_PER_SEC)))

Definition at line 222 of file abc_global.h.

#define ABC_PRTP (   a,
  t,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec (%6.2f %%)\n", 1.0*(t)/(CLOCKS_PER_SEC), (T)? 100.0*(t)/(T) : 0.0))

Definition at line 223 of file abc_global.h.

#define ABC_PRTr (   a,
 
)    (Abc_Print(1, "%s =", (a)), Abc_Print(1, "%9.2f sec\r", 1.0*(t)/(CLOCKS_PER_SEC)))

Definition at line 221 of file abc_global.h.

#define ABC_REALLOC (   type,
  obj,
  num 
)
Value:
((obj) ? ((type *) realloc((char *)(obj), sizeof(type) * (num))) : \
((type *) malloc(sizeof(type) * (num))))
char * malloc()
char * realloc()

Definition at line 233 of file abc_global.h.

#define ABC_SWAP (   Type,
  a,
 
)    { Type t = a; a = b; b = t; }

Definition at line 218 of file abc_global.h.

#define BRIDGE_ABS_NETLIST   107

Definition at line 295 of file abc_global.h.

#define BRIDGE_NETLIST   106

Definition at line 294 of file abc_global.h.

Typedef Documentation

typedef ABC_INT64_T abctime

Definition at line 278 of file abc_global.h.

typedef ABC_INT64_T iword

Definition at line 210 of file abc_global.h.

typedef ABC_UINT64_T word

Definition at line 209 of file abc_global.h.

Enumeration Type Documentation

Enumerator
ABC_PROMPT 
ABC_ERROR 
ABC_WARNING 
ABC_STANDARD 
ABC_VERBOSE 

Definition at line 305 of file abc_global.h.

306 {
307  ABC_PROMPT = -2,
308  ABC_ERROR = -1,
309  ABC_WARNING = 0,
310  ABC_STANDARD = 1,
311  ABC_VERBOSE = 2
312 };

Function Documentation

static double Abc_AbsDouble ( double  a)
inlinestatic

Definition at line 245 of file abc_global.h.

245 { return a < 0 ? -a : a; }
static float Abc_AbsFloat ( float  a)
inlinestatic

Definition at line 242 of file abc_global.h.

242 { return a < 0 ? -a : a; }
static int Abc_AbsInt ( int  a)
inlinestatic

Definition at line 237 of file abc_global.h.

237 { return a < 0 ? -a : a; }
static int Abc_Base10Log ( unsigned  n)
inlinestatic

Definition at line 252 of file abc_global.h.

252 { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 10, r++ ) {}; return r; }
static int Abc_Base16Log ( unsigned  n)
inlinestatic

Definition at line 253 of file abc_global.h.

253 { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n /= 16, r++ ) {}; return r; }
static int Abc_Base2Log ( unsigned  n)
inlinestatic

Definition at line 251 of file abc_global.h.

251 { int r; if ( n < 2 ) return n; for ( r = 0, n--; n; n >>= 1, r++ ) {}; return r; }
static int Abc_BitWordNum ( int  nBits)
inlinestatic

Definition at line 255 of file abc_global.h.

255 { return (nBits>>5) + ((nBits&31) > 0); }
static abctime Abc_Clock ( )
inlinestatic

Definition at line 279 of file abc_global.h.

280 {
281 #if (defined(LIN) || defined(LIN64)) && !(__APPLE__ & __MACH__) && !defined(__MINGW32__)
282  struct timespec ts;
283  if ( clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) < 0 )
284  return (abctime)-1;
285  abctime res = ((abctime) ts.tv_sec) * CLOCKS_PER_SEC;
286  res += (((abctime) ts.tv_nsec) * CLOCKS_PER_SEC) / 1000000000;
287  return res;
288 #else
289  return (abctime) clock();
290 #endif
291 }
ABC_INT64_T abctime
Definition: abc_global.h:278
static int Abc_Float2Int ( float  Val)
inlinestatic

Definition at line 249 of file abc_global.h.

249 { union { int x; float y; } v; v.y = Val; return v.x; }
static int Abc_InfoHasBit ( unsigned *  p,
int  i 
)
inlinestatic

Definition at line 258 of file abc_global.h.

258 { return (p[(i)>>5] & (1<<((i) & 31))) > 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static unsigned Abc_InfoMask ( int  nVar)
inlinestatic

Definition at line 261 of file abc_global.h.

261 { return (~(unsigned)0) >> (32-nVar); }
static void Abc_InfoSetBit ( unsigned *  p,
int  i 
)
inlinestatic

Definition at line 259 of file abc_global.h.

259 { p[(i)>>5] |= (1<<((i) & 31)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_InfoXorBit ( unsigned *  p,
int  i 
)
inlinestatic

Definition at line 260 of file abc_global.h.

260 { p[(i)>>5] ^= (1<<((i) & 31)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static float Abc_Int2Float ( int  Num)
inlinestatic

Definition at line 250 of file abc_global.h.

250 { union { int x; float y; } v; v.x = Num; return v.y; }
static void* Abc_Int2Ptr ( int  i)
inlinestatic

Definition at line 273 of file abc_global.h.

273 { return (void *)(ABC_PTRINT_T)i; }
static int Abc_Lit2LitL ( int *  pMap,
int  Lit 
)
inlinestatic

Definition at line 270 of file abc_global.h.

270 { return Abc_LitNotCond( pMap[Abc_Lit2Var(Lit)], Abc_LitIsCompl(Lit) ); }
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_Lit2LitV ( int *  pMap,
int  Lit 
)
inlinestatic

Definition at line 269 of file abc_global.h.

269 { return Abc_Var2Lit( pMap[Abc_Lit2Var(Lit)], Abc_LitIsCompl(Lit) ); }
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
static int Abc_Lit2Var ( int  Lit)
inlinestatic

Definition at line 264 of file abc_global.h.

264 { return Lit >> 1; }
static int Abc_LitIsCompl ( int  Lit)
inlinestatic

Definition at line 265 of file abc_global.h.

265 { return Lit & 1; }
static int Abc_LitNot ( int  Lit)
inlinestatic

Definition at line 266 of file abc_global.h.

266 { return Lit ^ 1; }
static int Abc_LitNotCond ( int  Lit,
int  c 
)
inlinestatic

Definition at line 267 of file abc_global.h.

267 { return Lit ^ (int)(c > 0); }
static int Abc_LitRegular ( int  Lit)
inlinestatic

Definition at line 268 of file abc_global.h.

268 { return Lit & ~01; }
static double Abc_MaxDouble ( double  a,
double  b 
)
inlinestatic

Definition at line 246 of file abc_global.h.

246 { return a > b ? a : b; }
static float Abc_MaxFloat ( float  a,
float  b 
)
inlinestatic

Definition at line 243 of file abc_global.h.

243 { return a > b ? a : b; }
static int Abc_MaxInt ( int  a,
int  b 
)
inlinestatic

Definition at line 238 of file abc_global.h.

238 { return a > b ? a : b; }
static word Abc_MaxWord ( word  a,
word  b 
)
inlinestatic

Definition at line 240 of file abc_global.h.

240 { return a > b ? a : b; }
void Abc_MergeSort ( int *  pInput,
int  nSize 
)

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

Synopsis [Returns the sorted array of integers.]

Description [This procedure is about 10% faster than qsort().]

SideEffects []

SeeAlso []

Definition at line 129 of file utilSort.c.

130 {
131  int * pOutput;
132  if ( nSize < 2 )
133  return;
134  pOutput = (int *) malloc( sizeof(int) * nSize );
135  Abc_Sort_rec( pInput, pInput + nSize, pOutput );
136  free( pOutput );
137 }
char * malloc()
VOID_HACK free()
void Abc_Sort_rec(int *pInBeg, int *pInEnd, int *pOutBeg)
Definition: utilSort.c:80
int* Abc_MergeSortCost ( int *  pCosts,
int  nSize 
)

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

Synopsis [Sorting procedure.]

Description [Returns permutation for the non-decreasing order of costs.]

SideEffects []

SeeAlso []

Definition at line 238 of file utilSort.c.

239 {
240  int i, * pResult, * pInput, * pOutput;
241  pResult = (int *) calloc( sizeof(int), nSize );
242  if ( nSize < 2 )
243  return pResult;
244  pInput = (int *) malloc( sizeof(int) * 2 * nSize );
245  pOutput = (int *) malloc( sizeof(int) * 2 * nSize );
246  for ( i = 0; i < nSize; i++ )
247  pInput[2*i] = i, pInput[2*i+1] = pCosts[i];
248  Abc_MergeSortCost_rec( pInput, pInput + 2*nSize, pOutput );
249  for ( i = 0; i < nSize; i++ )
250  pResult[i] = pInput[2*i];
251  free( pOutput );
252  free( pInput );
253  return pResult;
254 }
char * malloc()
VOID_HACK free()
void Abc_MergeSortCost_rec(int *pInBeg, int *pInEnd, int *pOutBeg)
Definition: utilSort.c:183
char * calloc()
static double Abc_MinDouble ( double  a,
double  b 
)
inlinestatic

Definition at line 247 of file abc_global.h.

247 { return a < b ? a : b; }
static float Abc_MinFloat ( float  a,
float  b 
)
inlinestatic

Definition at line 244 of file abc_global.h.

244 { return a < b ? a : b; }
static int Abc_MinInt ( int  a,
int  b 
)
inlinestatic

Definition at line 239 of file abc_global.h.

239 { return a < b ? a : b; }
static word Abc_MinWord ( word  a,
word  b 
)
inlinestatic

Definition at line 241 of file abc_global.h.

241 { return a < b ? a : b; }
static int Abc_PrimeCudd ( unsigned int  p)
inlinestatic

Definition at line 383 of file abc_global.h.

384 {
385  int i,pn;
386  p--;
387  do {
388  p++;
389  if (p&1)
390  {
391  pn = 1;
392  i = 3;
393  while ((unsigned) (i * i) <= p)
394  {
395  if (p % i == 0) {
396  pn = 0;
397  break;
398  }
399  i += 2;
400  }
401  }
402  else
403  pn = 0;
404  } while (!pn);
405  return(p);
406 
407 } // end of Cudd_Prime
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_Print ( int  level,
const char *  format,
  ... 
)
inlinestatic

Definition at line 313 of file abc_global.h.

314 {
315  extern ABC_DLL int Abc_FrameIsBridgeMode();
316  va_list args;
317 
318  if ( ! Abc_FrameIsBridgeMode() ){
319  if ( level == ABC_ERROR )
320  printf( "Error: " );
321  else if ( level == ABC_WARNING )
322  printf( "Warning: " );
323  }else{
324  if ( level == ABC_ERROR )
325  Gia_ManToBridgeText( stdout, strlen("Error: "), (unsigned char*)"Error: " );
326  else if ( level == ABC_WARNING )
327  Gia_ManToBridgeText( stdout, strlen("Warning: "), (unsigned char*)"Warning: " );
328  }
329 
330  va_start( args, format );
331  if ( Abc_FrameIsBridgeMode() )
332  {
333  char * tmp = vnsprintf( format, args );
334  Gia_ManToBridgeText( stdout, strlen(tmp), (unsigned char*)tmp );
335  free( tmp );
336  }
337  else
338  vprintf( format, args );
339  va_end( args );
340 }
ABC_DLL int Abc_FrameIsBridgeMode()
Definition: mainFrame.c:94
VOID_HACK free()
int Gia_ManToBridgeText(FILE *pFile, int Size, unsigned char *pBuffer)
Definition: utilBridge.c:168
#define ABC_DLL
Definition: abc_global.h:53
char * vnsprintf(const char *format, va_list args)
Definition: utilFile.c:168
int strlen()
static void Abc_PrintInt ( int  i)
inlinestatic

Definition at line 342 of file abc_global.h.

343 {
344  double v3 = (double)i/1000;
345  double v6 = (double)i/1000000;
346 
347  Abc_Print( 1, " " );
348 
349  if ( i > -1000 && i < 1000 )
350  Abc_Print( 1, " %4d", i );
351 
352  else if ( v3 > -9.995 && v3 < 9.995 )
353  Abc_Print( 1, "%4.2fk", v3 );
354  else if ( v3 > -99.95 && v3 < 99.95 )
355  Abc_Print( 1, "%4.1fk", v3 );
356  else if ( v3 > -999.5 && v3 < 999.5 )
357  Abc_Print( 1, "%4.0fk", v3 );
358 
359  else if ( v6 > -9.995 && v6 < 9.995 )
360  Abc_Print( 1, "%4.2fm", v6 );
361  else if ( v6 > -99.95 && v6 < 99.95 )
362  Abc_Print( 1, "%4.1fm", v6 );
363  else if ( v6 > -999.5 && v6 < 999.5 )
364  Abc_Print( 1, "%4.0fm", v6 );
365 }
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
static void Abc_PrintMemoryP ( int  level,
const char *  pStr,
int  mem,
int  Mem 
)
inlinestatic

Definition at line 377 of file abc_global.h.

378 {
379  ABC_PRMP( pStr, mem, Mem );
380 }
#define ABC_PRMP(a, f, F)
Definition: abc_global.h:227
static void Abc_PrintTime ( int  level,
const char *  pStr,
abctime  time 
)
inlinestatic

Definition at line 367 of file abc_global.h.

368 {
369  ABC_PRT( pStr, time );
370 }
#define ABC_PRT(a, t)
Definition: abc_global.h:220
static void Abc_PrintTimeP ( int  level,
const char *  pStr,
abctime  time,
abctime  Time 
)
inlinestatic

Definition at line 372 of file abc_global.h.

373 {
374  ABC_PRTP( pStr, time, Time );
375 }
#define ABC_PRTP(a, t, T)
Definition: abc_global.h:223
static int Abc_Ptr2Int ( void *  p)
inlinestatic

Definition at line 272 of file abc_global.h.

272 { return (int)(ABC_PTRINT_T)p; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static word Abc_Ptr2Wrd ( void *  p)
inlinestatic

Definition at line 274 of file abc_global.h.

274 { return (word)(ABC_PTRUINT_T)p; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
void Abc_QuickSort1 ( word pData,
int  nSize,
int  fDecrease 
)

Definition at line 477 of file utilSort.c.

478 {
479  int i, fVerify = 0;
480  if ( fDecrease )
481  {
482  qsort( (void *)pData, nSize, sizeof(word), (int (*)(const void *, const void *))Abc_QuickSort1CompareDec );
483  if ( fVerify )
484  for ( i = 1; i < nSize; i++ )
485  assert( (unsigned)pData[i-1] >= (unsigned)pData[i] );
486  }
487  else
488  {
489  qsort( (void *)pData, nSize, sizeof(word), (int (*)(const void *, const void *))Abc_QuickSort1CompareInc );
490  if ( fVerify )
491  for ( i = 1; i < nSize; i++ )
492  assert( (unsigned)pData[i-1] <= (unsigned)pData[i] );
493  }
494 }
int Abc_QuickSort1CompareInc(word *p1, word *p2)
Definition: utilSort.c:461
int Abc_QuickSort1CompareDec(word *p1, word *p2)
Definition: utilSort.c:469
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define assert(ex)
Definition: util_old.h:213
void Abc_QuickSort2 ( word pData,
int  nSize,
int  fDecrease 
)

Definition at line 662 of file utilSort.c.

663 {
664  int i, fVerify = 0;
665  if ( fDecrease )
666  {
667  Abc_QuickSort2Dec_rec( pData, 0, nSize - 1 );
668  if ( fVerify )
669  for ( i = 1; i < nSize; i++ )
670  assert( (unsigned)pData[i-1] >= (unsigned)pData[i] );
671  }
672  else
673  {
674  Abc_QuickSort2Inc_rec( pData, 0, nSize - 1 );
675  if ( fVerify )
676  for ( i = 1; i < nSize; i++ )
677  assert( (unsigned)pData[i-1] <= (unsigned)pData[i] );
678  }
679 }
void Abc_QuickSort2Inc_rec(word *pData, int l, int r)
Definition: utilSort.c:538
void Abc_QuickSort2Dec_rec(word *pData, int l, int r)
Definition: utilSort.c:564
#define assert(ex)
Definition: util_old.h:213
void Abc_QuickSort3 ( word pData,
int  nSize,
int  fDecrease 
)

Definition at line 680 of file utilSort.c.

681 {
682  int i, fVerify = 1;
683  if ( fDecrease )
684  {
685  Abc_QuickSort2Dec_rec( pData, 0, nSize - 1 );
686  if ( fVerify )
687  for ( i = 1; i < nSize; i++ )
688  assert( (unsigned)pData[i-1] >= (unsigned)pData[i] );
689  }
690  else
691  {
692  Abc_QuickSort2Inc_rec( pData, 0, nSize - 1 );
693  if ( fVerify )
694  for ( i = 1; i < nSize; i++ )
695  assert( (unsigned)pData[i-1] <= (unsigned)pData[i] );
696  }
697 }
void Abc_QuickSort2Inc_rec(word *pData, int l, int r)
Definition: utilSort.c:538
void Abc_QuickSort2Dec_rec(word *pData, int l, int r)
Definition: utilSort.c:564
#define assert(ex)
Definition: util_old.h:213
int* Abc_QuickSortCost ( int *  pCosts,
int  nSize,
int  fDecrease 
)

Definition at line 719 of file utilSort.c.

720 {
721  word * pData = ABC_ALLOC( word, nSize );
722  int * pResult = ABC_ALLOC( int, nSize );
723  Abc_QuickSortCostData( pCosts, nSize, fDecrease, pData, pResult );
724  ABC_FREE( pData );
725  return pResult;
726 }
void Abc_QuickSortCostData(int *pCosts, int nSize, int fDecrease, word *pData, int *pResult)
Definition: utilSort.c:710
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Abc_QuickSortCostData ( int *  pCosts,
int  nSize,
int  fDecrease,
word pData,
int *  pResult 
)

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

Synopsis [Wrapper around QuickSort to sort entries based on cost.]

Description []

SideEffects []

SeeAlso []

Definition at line 710 of file utilSort.c.

711 {
712  int i;
713  for ( i = 0; i < nSize; i++ )
714  pData[i] = ((word)i << 32) | pCosts[i];
715  Abc_QuickSort3( pData, nSize, fDecrease );
716  for ( i = 0; i < nSize; i++ )
717  pResult[i] = (int)(pData[i] >> 32);
718 }
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
void Abc_QuickSort3(word *pData, int nSize, int fDecrease)
Definition: utilSort.c:680
static int Abc_Truth6WordNum ( int  nVars)
inlinestatic

Definition at line 257 of file abc_global.h.

257 { return nVars <= 6 ? 1 : (1 << (nVars - 6)); }
static int Abc_TruthWordNum ( int  nVars)
inlinestatic

Definition at line 256 of file abc_global.h.

256 { return nVars <= 5 ? 1 : (1 << (nVars - 5)); }
static char* Abc_UtilStrsav ( char *  s)
inlinestatic

Definition at line 254 of file abc_global.h.

254 { return s ? strcpy(ABC_ALLOC(char, strlen(s)+1), s) : NULL; }
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
char * strcpy()
int strlen()
static int Abc_Var2Lit ( int  Var,
int  fCompl 
)
inlinestatic

Definition at line 263 of file abc_global.h.

263 { return Var + Var + fCompl; }
int Var
Definition: SolverTypes.h:42
static void* Abc_Wrd2Ptr ( word  i)
inlinestatic

Definition at line 275 of file abc_global.h.

275 { return (void *)(ABC_PTRUINT_T)i; }
int Gia_ManToBridgeAbsNetlist ( FILE *  pFile,
void *  p,
int  pkg_type 
)

Definition at line 189 of file utilBridge.c.

190 {
191  Vec_Str_t * vBuffer;
192  vBuffer = Gia_ManToBridgeVec( (Gia_Man_t *)p );
193  Gia_CreateHeader( pFile, pkg_type, Vec_StrSize(vBuffer), (unsigned char *)Vec_StrArray(vBuffer) );
194  Vec_StrFree( vBuffer );
195  return 1;
196 }
void Gia_CreateHeader(FILE *pFile, int Type, int Size, unsigned char *pBuffer)
Definition: utilBridge.c:127
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
Vec_Str_t * Gia_ManToBridgeVec(Gia_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: utilBridge.c:66
Definition: gia.h:95
int Gia_ManToBridgeText ( FILE *  pFile,
int  Size,
unsigned char *  pBuffer 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file utilBridge.c.

169 {
170  Gia_CreateHeader( pFile, BRIDGE_TEXT_MESSAGE, Size, pBuffer );
171  return 1;
172 }
void Gia_CreateHeader(FILE *pFile, int Type, int Size, unsigned char *pBuffer)
Definition: utilBridge.c:127
#define BRIDGE_TEXT_MESSAGE
DECLARATIONS ///.
Definition: utilBridge.c:37
char* nsprintf ( const char *  format,
  ... 
)

Definition at line 205 of file utilFile.c.

206 {
207  char* ret;
208  va_list args;
209  va_start(args, format);
210  ret = vnsprintf(format, args);
211  va_end(args);
212  return ret;
213 }
char * vnsprintf(const char *format, va_list args)
Definition: utilFile.c:168
char* vnsprintf ( const char *  format,
va_list  args 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso [] Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 168 of file utilFile.c.

169 {
170  unsigned n;
171  char* ret;
172  va_list args_copy;
173 
174  static FILE* dummy_file = NULL;
175  if (!dummy_file)
176  {
177 #if !defined(_MSC_VER) && !defined(__MINGW32)
178  dummy_file = fopen("/dev/null", "wb");
179 #else
180  dummy_file = fopen("NUL", "wb");
181 #endif
182  }
183 
184 #if defined(__va_copy)
185  __va_copy(args_copy, args);
186 #else
187  #if defined(va_copy)
188  va_copy(args_copy, args);
189  #else
190  args_copy = args;
191  #endif
192 #endif
193  n = vfprintf(dummy_file, format, args);
194  ret = ABC_ALLOC( char, n + 1 );
195  ret[n] = (char)255;
196  args = args_copy;
197  vsprintf(ret, format, args);
198 #if !defined(__va_copy) && defined(va_copy)
199  va_end(args_copy);
200 #endif
201  assert(ret[n] == 0);
202  return ret;
203 }
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define assert(ex)
Definition: util_old.h:213