abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
extraUtilEnum.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "misc/vec/vecHsh.h"
#include "bool/kit/kit.h"

Go to the source code of this file.

Data Structures

struct  Abc_EnuMan_t_
 

Macros

#define ABC_ENUM_MAX   16
 

Typedefs

typedef struct Abc_EnuMan_t_ Abc_EnuMan_t
 

Functions

ABC_NAMESPACE_IMPL_START void Abc_GetFirst (int *pnVars, int *pnMints, int *pnFuncs, unsigned *pVars, unsigned *pMints, unsigned *pFuncs)
 DECLARATIONS ///. More...
 
void Abc_GetSecond (int *pnVars, int *pnMints, int *pnFuncs, unsigned *pVars, unsigned *pMints, unsigned *pFuncs)
 
void Abc_GetThird (int *pnVars, int *pnMints, int *pnFuncs, unsigned *pVars, unsigned *pMints, unsigned *pFuncs)
 
void Abc_EnumPrint_rec (Vec_Int_t *vGates, int i, int nVars)
 
void Abc_EnumPrint (Vec_Int_t *vGates, int i, int nVars)
 
static int Abc_DataHasBit (word *p, word i)
 
static void Abc_DataXorBit (word *p, word i)
 
void Abc_EnumerateFunctions (int nDecMax)
 
static void Abc_EnumRef (Abc_EnuMan_t *p, int i)
 
static void Abc_EnumDeref (Abc_EnuMan_t *p, int i)
 
static void Abc_EnumRefNode (Abc_EnuMan_t *p, int i)
 
static void Abc_EnumDerefNode (Abc_EnuMan_t *p, int i)
 
static void Abc_EnumPrintOne (Abc_EnuMan_t *p)
 
static int Abc_EnumEquiv (word a, word b)
 
static int Abc_EnumerateFilter (Abc_EnuMan_t *p)
 
void Abc_EnumerateFuncs_rec (Abc_EnuMan_t *p, int fNew, int iNode1st)
 
void Abc_EnumerateFuncs (int nVars, int nGates, int fVerbose)
 

Variables

static word s_Truths6 [6]
 

Macro Definition Documentation

#define ABC_ENUM_MAX   16

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 429 of file extraUtilEnum.c.

Typedef Documentation

typedef struct Abc_EnuMan_t_ Abc_EnuMan_t

Definition at line 438 of file extraUtilEnum.c.

Function Documentation

static int Abc_DataHasBit ( word p,
word  i 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 301 of file extraUtilEnum.c.

301 { return (p[(i)>>6] & (1<<((i) & 63))) > 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_DataXorBit ( word p,
word  i 
)
inlinestatic

Definition at line 302 of file extraUtilEnum.c.

302 { p[(i)>>6] ^= (1<<((i) & 63)); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_EnumDeref ( Abc_EnuMan_t p,
int  i 
)
inlinestatic

Definition at line 466 of file extraUtilEnum.c.

467 {
468  if ( --p->pRefs[i] == 0 )
469  p->nTops++;
470  assert( p->pRefs[i] >= 0 );
471 }
int pRefs[ABC_ENUM_MAX]
#define assert(ex)
Definition: util_old.h:213
static void Abc_EnumDerefNode ( Abc_EnuMan_t p,
int  i 
)
inlinestatic

Definition at line 480 of file extraUtilEnum.c.

481 {
482  assert( i < p->nNodes );
483  Abc_EnumDeref( p, p->pFans0[i] );
484  Abc_EnumDeref( p, p->pFans1[i] );
485  p->nTops--;
486  p->nNodes--;
487 }
int pFans1[ABC_ENUM_MAX]
int pFans0[ABC_ENUM_MAX]
static void Abc_EnumDeref(Abc_EnuMan_t *p, int i)
#define assert(ex)
Definition: util_old.h:213
static int Abc_EnumEquiv ( word  a,
word  b 
)
inlinestatic

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 511 of file extraUtilEnum.c.

512 {
513  return a == b || a == ~b;
514 }
static int Abc_EnumerateFilter ( Abc_EnuMan_t p)
inlinestatic

Definition at line 515 of file extraUtilEnum.c.

516 {
517  int fUseFull = 1;
518  int n = p->nNodes;
519  int i = p->pFans0[n];
520  int k = p->pFans1[n], t;
521  word * pTruths = p->pTruths;
522  word uTruth = pTruths[n];
523  assert( i < k );
524  // skip constants
525  if ( Abc_EnumEquiv(uTruth, 0) )
526  return 1;
527  // skip equal ones
528  for ( t = 0; t < n; t++ )
529  if ( Abc_EnumEquiv(uTruth, pTruths[t]) )
530  return 1;
531  if ( fUseFull )
532  {
533  // skip those that can be derived by any pair
534  int a, b;
535  for ( a = 0; a <= i; a++ )
536  for ( b = a + 1; b <= k; b++ )
537  {
538  if ( a == i && b == k )
539  continue;
540  if ( Abc_EnumEquiv(uTruth, pTruths[a] & pTruths[b]) )
541  return 1;
542  if ( Abc_EnumEquiv(uTruth, pTruths[a] & ~pTruths[b]) )
543  return 1;
544  if ( Abc_EnumEquiv(uTruth, ~pTruths[a] & pTruths[b]) )
545  return 1;
546  if ( Abc_EnumEquiv(uTruth, ~pTruths[a] & ~pTruths[b]) )
547  return 1;
548  if ( p->fUseXor && Abc_EnumEquiv(uTruth, pTruths[a] ^ pTruths[b]) )
549  return 1;
550  }
551  }
552  else
553  {
554  // skip those that can be derived by fanin and any other one in the cone
555  int uTruthI = p->fCompl0[n] ? ~pTruths[i] : pTruths[i];
556  int uTruthK = p->fCompl1[n] ? ~pTruths[k] : pTruths[k];
557  assert( p->fUseXor == 0 );
558  for ( t = 0; t < k; t++ )
559  if ( Abc_EnumEquiv(uTruth, pTruths[t] & uTruthI) || Abc_EnumEquiv(uTruth, ~pTruths[t] & uTruthI) )
560  return 1;
561  for ( t = 0; t < i; t++ )
562  if ( Abc_EnumEquiv(uTruth, pTruths[t] & uTruthK) || Abc_EnumEquiv(uTruth, ~pTruths[t] & uTruthK) )
563  return 1;
564  }
565  return 0;
566 }
static ABC_NAMESPACE_IMPL_START int pTruths[13719]
DECLARATIONS ///.
Definition: rwrTemp.c:30
word pTruths[ABC_ENUM_MAX]
int pFans1[ABC_ENUM_MAX]
int fCompl0[ABC_ENUM_MAX]
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
int fCompl1[ABC_ENUM_MAX]
static int Abc_EnumEquiv(word a, word b)
int pFans0[ABC_ENUM_MAX]
#define assert(ex)
Definition: util_old.h:213
void Abc_EnumerateFuncs ( int  nVars,
int  nGates,
int  fVerbose 
)

Definition at line 644 of file extraUtilEnum.c.

645 {
646  abctime clk = Abc_Clock();
647  Abc_EnuMan_t P, * p = &P;
648  int i;
649  if ( nVars > nGates + 1 )
650  {
651  printf( "The gate count %d is not enough to have functions with %d inputs.\n", nGates, nVars );
652  return;
653  }
654  assert( nVars >= 2 && nVars <= 6 );
655  assert( nGates > 0 && nVars + nGates < ABC_ENUM_MAX );
656  memset( p, 0, sizeof(Abc_EnuMan_t) );
657  p->fVerbose = fVerbose;
658  p->fUseXor = 0;
659  p->nVars = nVars;
660  p->nNodeMax = nVars + nGates;
661  p->nNodes = nVars;
662  p->nTops = nVars;
663  for ( i = 0; i < nVars; i++ )
664  p->pTruths[i] = s_Truths6[i];
665  Abc_EnumerateFuncs_rec( p, 1, 0 );
666  assert( p->nNodes == nVars );
667  assert( p->nTops == nVars );
668  // report statistics
669  printf( "Vars = %d. Gates = %d. Tries = %u. Builds = %u. Finished = %d. ",
670  nVars, nGates, (unsigned)p->nTries, (unsigned)p->nBuilds, (unsigned)p->nFinished );
671  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
672 }
char * memset()
word pTruths[ABC_ENUM_MAX]
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static byte P[256]
Definition: kitPerm.c:76
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
void Abc_EnumerateFuncs_rec(Abc_EnuMan_t *p, int fNew, int iNode1st)
static word s_Truths6[6]
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
#define ABC_ENUM_MAX
void Abc_EnumerateFuncs_rec ( Abc_EnuMan_t p,
int  fNew,
int  iNode1st 
)

Definition at line 567 of file extraUtilEnum.c.

568 {
569  if ( p->nNodes == p->nNodeMax )
570  {
571  assert( p->nTops == 1 );
572  if ( p->fVerbose )
573  Abc_EnumPrintOne( p );
574  p->nFinished++;
575  return;
576  }
577  {
578  int i, k, c, cLim = 4 + p->fUseXor, n = p->nNodes;
579  int nRefedFans = p->nNodeMax - n + 1 - p->nTops;
580  int high0 = fNew ? iNode1st : p->pFans1[n-1];
581  int high1 = fNew ? n : iNode1st;
582  int low0 = fNew ? 0 : p->pFans0[n-1];
583  int c0 = fNew ? 0 : p->Polar[n-1];
584  int Level = p->pLevel[high0];
585  assert( p->nTops > 0 && p->nTops <= p->nNodeMax - n + 1 );
586  // go through nodes
587  for ( k = high0; k < high1; k++ )
588  {
589  if ( nRefedFans == 0 && p->pRefs[k] > 0 )
590  continue;
591  if ( p->pRefs[k] > 0 )
592  nRefedFans--;
593  assert( nRefedFans >= 0 );
594  // try second fanin
595  for ( i = (k == high0) ? low0 : 0; i < k; i++ )
596  {
597  if ( nRefedFans == 0 && p->pRefs[i] > 0 )
598  continue;
599  if ( Level == 0 && p->pRefs[i] == 0 && p->pRefs[k] == 0 && (i+1 != k || (i > 0 && p->pRefs[i-1] == 0)) ) // NPN
600  continue;
601  if ( p->pLevel[k] == 0 && p->pRefs[k] == 0 && p->pRefs[i] != 0 && k > 0 && p->pRefs[k-1] == 0 ) // NPN
602  continue;
603 // if ( p->pLevel[i] == 0 && p->pRefs[i] == 0 && p->pRefs[k] != 0 && i > 0 && p->pRefs[i-1] == 0 ) // NPN
604 // continue;
605  // try four polarities
606  for ( c = (k == high0 && i == low0 && !fNew) ? c0 + 1 : 0; c < cLim; c++ )
607  {
608  if ( p->pLevel[i] == 0 && p->pRefs[i] == 0 && (c & 1) == 1 ) // NPN
609  continue;
610  if ( p->pLevel[k] == 0 && p->pRefs[k] == 0 && (c & 2) == 2 ) // NPN
611  continue;
612  p->nTries++;
613  // create node
614  assert( i < k );
615  p->pFans0[n] = i;
616  p->pFans1[n] = k;
617  p->fCompl0[n] = c & 1;
618  p->fCompl1[n] = (c >> 1) & 1;
619  p->Polar[n] = c;
620  if ( c == 4 )
621  p->pTruths[n] = p->pTruths[i] ^ p->pTruths[k];
622  else
623  p->pTruths[n] = ((c & 1) ? ~p->pTruths[i] : p->pTruths[i]) & ((c & 2) ? ~p->pTruths[k] : p->pTruths[k]);
624  if ( Abc_EnumerateFilter(p) )
625  continue;
626  p->nBuilds++;
627  assert( Level == Abc_MaxInt(p->pLevel[i], p->pLevel[k]) );
628  p->pLevel[n] = Level + 1;
629  Abc_EnumRefNode( p, n );
630  Abc_EnumerateFuncs_rec( p, 0, fNew ? n : iNode1st );
631  Abc_EnumDerefNode( p, n );
632  assert( n == p->nNodes );
633  }
634  }
635  if ( p->pRefs[k] > 0 )
636  nRefedFans++;
637  }
638  if ( fNew )
639  return;
640  // start a new level
641  Abc_EnumerateFuncs_rec( p, 1, iNode1st );
642  }
643 }
static int Abc_EnumerateFilter(Abc_EnuMan_t *p)
word pTruths[ABC_ENUM_MAX]
int pFans1[ABC_ENUM_MAX]
static void Abc_EnumRefNode(Abc_EnuMan_t *p, int i)
int Polar[ABC_ENUM_MAX]
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
int pLevel[ABC_ENUM_MAX]
void Abc_EnumerateFuncs_rec(Abc_EnuMan_t *p, int fNew, int iNode1st)
int fCompl0[ABC_ENUM_MAX]
int pRefs[ABC_ENUM_MAX]
int fCompl1[ABC_ENUM_MAX]
int pFans0[ABC_ENUM_MAX]
#define assert(ex)
Definition: util_old.h:213
static void Abc_EnumPrintOne(Abc_EnuMan_t *p)
static void Abc_EnumDerefNode(Abc_EnuMan_t *p, int i)
void Abc_EnumerateFunctions ( int  nDecMax)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 315 of file extraUtilEnum.c.

316 {
317  int nVars;
318  int nMints;
319  int nFuncs;
320  unsigned pVars[100] = {0};
321  unsigned pMints[100] = {0};
322  unsigned pFuncs[100] = {0};
323  unsigned Truth;
324  int FuncDone[100] = {0}, nFuncDone = 0;
325  int GateCount[100] = {0};
326  int i, k, n, a, b, v;
327  abctime clk = Abc_Clock();
328  Vec_Int_t * vGates = Vec_IntAlloc( 100000 );
329  Vec_Int_t * vTruths = Vec_IntAlloc( 100000 );
330 // Vec_Int_t * vHash = Vec_IntStartFull( 1 << 16 );
331  word * pHash;
332 
333  // extract data
334 // Abc_GetFirst( &nVars, &nMints, &nFuncs, pVars, pMints, pFuncs );
335  Abc_GetSecond( &nVars, &nMints, &nFuncs, pVars, pMints, pFuncs );
336 // Abc_GetThird( &nVars, &nMints, &nFuncs, pVars, pMints, pFuncs );
337 
338  // create hash table
339  assert( nMints == 16 || nMints == 32 );
340  pHash = (word *)ABC_CALLOC( char, 1 << (nMints-3) );
341 
342  // create elementary gates
343  for ( k = 0; k < nVars; k++ )
344  {
345 // Vec_IntWriteEntry( vHash, pVars[k], k );
346  Abc_DataXorBit( pHash, pVars[k] );
347  Vec_IntPush( vTruths, pVars[k] );
348  Vec_IntPush( vGates, -1 );
349  Vec_IntPush( vGates, -1 );
350  }
351 
352  // go through different number of variables
353  GateCount[0] = 0;
354  GateCount[1] = nVars;
355  assert( Vec_IntSize(vTruths) == nVars );
356  for ( n = 0; n < nDecMax && nFuncDone < nFuncs; n++ )
357  {
358  for ( a = 0; a <= n; a++ )
359  for ( b = a; b <= n; b++ )
360  if ( a + b == n )
361  {
362  printf( "Trying %d + %d + 1 = %d\n", a, b, n+1 );
363  for ( i = GateCount[a]; i < GateCount[a+1]; i++ )
364  for ( k = GateCount[b]; k < GateCount[b+1]; k++ )
365  if ( i < k )
366  {
367  Truth = Vec_IntEntry(vTruths, i) & Vec_IntEntry(vTruths, k);
368 // if ( Vec_IntEntry(vHash, Truth) == -1 )
369  if ( !Abc_DataHasBit(pHash, Truth) )
370  {
371 // Vec_IntWriteEntry( vHash, Truth, Vec_IntSize(vTruths) );
372  Abc_DataXorBit( pHash, Truth );
373  Vec_IntPush( vTruths, Truth );
374  Vec_IntPush( vGates, i );
375  Vec_IntPush( vGates, k );
376 
377  for ( v = 0; v < nFuncs; v++ )
378  if ( !FuncDone[v] && Truth == pFuncs[v] )
379  {
380  printf( "Found function %d with %d gates: ", v, n+1 );
381  Abc_EnumPrint( vGates, Vec_IntSize(vTruths)-1, nVars );
382  FuncDone[v] = 1;
383  nFuncDone++;
384  }
385  }
386  Truth = Vec_IntEntry(vTruths, i) | Vec_IntEntry(vTruths, k);
387 // if ( Vec_IntEntry(vHash, Truth) == -1 )
388  if ( !Abc_DataHasBit(pHash, Truth) )
389  {
390 // Vec_IntWriteEntry( vHash, Truth, Vec_IntSize(vTruths) );
391  Abc_DataXorBit( pHash, Truth );
392  Vec_IntPush( vTruths, Truth );
393  Vec_IntPush( vGates, k );
394  Vec_IntPush( vGates, i );
395 
396  for ( v = 0; v < nFuncs; v++ )
397  if ( !FuncDone[v] && Truth == pFuncs[v] )
398  {
399  printf( "Found function %d with %d gates: ", v, n+1 );
400  Abc_EnumPrint( vGates, Vec_IntSize(vTruths)-1, nVars );
401  FuncDone[v] = 1;
402  nFuncDone++;
403  }
404  }
405  }
406  }
407  GateCount[n+2] = Vec_IntSize(vTruths);
408  printf( "Finished %d gates. Truths = %10d. ", n+1, Vec_IntSize(vTruths) );
409  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
410  }
411  ABC_FREE( pHash );
412 // Vec_IntFree( vHash );
413  Vec_IntFree( vGates );
414  Vec_IntFree( vTruths );
415 }
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Abc_GetSecond(int *pnVars, int *pnMints, int *pnFuncs, unsigned *pVars, unsigned *pMints, unsigned *pFuncs)
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Abc_DataXorBit(word *p, word i)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static ABC_NAMESPACE_IMPL_START word Truth[8]
DECLARATIONS ///.
Definition: giaShrink6.c:32
void Abc_EnumPrint(Vec_Int_t *vGates, int i, int nVars)
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Abc_DataHasBit(word *p, word i)
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
ABC_INT64_T abctime
Definition: abc_global.h:278
void Abc_EnumPrint ( Vec_Int_t vGates,
int  i,
int  nVars 
)

Definition at line 283 of file extraUtilEnum.c.

284 {
285  assert( 2*i < Vec_IntSize(vGates) );
286  Abc_EnumPrint_rec( vGates, i, nVars );
287  printf( "\n" );
288 }
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define assert(ex)
Definition: util_old.h:213
void Abc_EnumPrint_rec(Vec_Int_t *vGates, int i, int nVars)
void Abc_EnumPrint_rec ( Vec_Int_t vGates,
int  i,
int  nVars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 258 of file extraUtilEnum.c.

259 {
260  int Fan0 = Vec_IntEntry(vGates, 2*i);
261  int Fan1 = Vec_IntEntry(vGates, 2*i+1);
262  char * pOper = Fan0 < Fan1 ? "" : "+";
263  if ( Fan0 > Fan1 )
264  ABC_SWAP( int, Fan0, Fan1 );
265  if ( Fan0 < nVars )
266  printf( "%c", 'a'+Fan0 );
267  else
268  {
269  printf( "(" );
270  Abc_EnumPrint_rec( vGates, Fan0, nVars );
271  printf( ")" );
272  }
273  printf( "%s", pOper );
274  if ( Fan1 < nVars )
275  printf( "%c", 'a'+Fan1 );
276  else
277  {
278  printf( "(" );
279  Abc_EnumPrint_rec( vGates, Fan1, nVars );
280  printf( ")" );
281  }
282 }
#define ABC_SWAP(Type, a, b)
Definition: abc_global.h:218
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
void Abc_EnumPrint_rec(Vec_Int_t *vGates, int i, int nVars)
static void Abc_EnumPrintOne ( Abc_EnuMan_t p)
inlinestatic

Definition at line 488 of file extraUtilEnum.c.

489 {
490  int i;
491  Kit_DsdPrintFromTruth( (unsigned *)(p->pTruths + p->nNodes - 1), p->nVars );
492  for ( i = p->nVars; i < p->nNodes; i++ )
493  if ( p->Polar[i] == 4 )
494  printf( " %c=%c+%c", 'a'+i, 'a'+p->pFans0[i], 'a'+p->pFans1[i] );
495  else
496  printf( " %c=%s%c%s%c", 'a'+i, p->fCompl0[i]?"!":"", 'a'+p->pFans0[i], p->fCompl1[i]?"!":"", 'a'+p->pFans1[i] );
497  printf( "\n" );
498 }
word pTruths[ABC_ENUM_MAX]
int pFans1[ABC_ENUM_MAX]
int Polar[ABC_ENUM_MAX]
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition: kitDsd.c:490
int fCompl0[ABC_ENUM_MAX]
int fCompl1[ABC_ENUM_MAX]
int pFans0[ABC_ENUM_MAX]
static void Abc_EnumRef ( Abc_EnuMan_t p,
int  i 
)
inlinestatic

Definition at line 460 of file extraUtilEnum.c.

461 {
462  assert( p->pRefs[i] >= 0 );
463  if ( p->pRefs[i]++ == 0 )
464  p->nTops--;
465 }
int pRefs[ABC_ENUM_MAX]
#define assert(ex)
Definition: util_old.h:213
static void Abc_EnumRefNode ( Abc_EnuMan_t p,
int  i 
)
inlinestatic

Definition at line 472 of file extraUtilEnum.c.

473 {
474  Abc_EnumRef( p, p->pFans0[i] );
475  Abc_EnumRef( p, p->pFans1[i] );
476  p->nTops++;
477  p->nNodes++;
478  assert( i < p->nNodes );
479 }
int pFans1[ABC_ENUM_MAX]
static void Abc_EnumRef(Abc_EnuMan_t *p, int i)
int pFans0[ABC_ENUM_MAX]
#define assert(ex)
Definition: util_old.h:213
ABC_NAMESPACE_IMPL_START void Abc_GetFirst ( int *  pnVars,
int *  pnMints,
int *  pnFuncs,
unsigned *  pVars,
unsigned *  pMints,
unsigned *  pFuncs 
)

DECLARATIONS ///.

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

FileName [extraUtilEnum.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [extra]

Synopsis [Function enumeration.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
extraUtilEnum.c,v 1.0 2003/02/01 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file extraUtilEnum.c.

51 {
52  int nVars = 8;
53  int nMints = 16;
54  int nFuncs = 8;
55  char * pMintStrs[16] = {
56  "1-1-1-1-",
57  "1-1--11-",
58  "1-1-1--1",
59  "1-1--1-1",
60 
61  "-11-1-1-",
62  "-11--11-",
63  "-11-1--1",
64  "-11--1-1",
65 
66  "1--11-1-",
67  "1--1-11-",
68  "1--11--1",
69  "1--1-1-1",
70 
71  "-1-11-1-",
72  "-1-1-11-",
73  "-1-11--1",
74  "-1-1-1-1"
75  };
76  char * pFuncStrs[8] = {
77  "1111101011111010",
78  "0000010100000101",
79  "1111110010101001",
80  "0000001101010110",
81  "1111111111001101",
82  "0000000000110010",
83  "1111111111111110",
84  "0000000000000001",
85  };
86  int i, k;
87  *pnVars = nVars;
88  *pnMints = nMints;
89  *pnFuncs = nFuncs;
90  // extract mints
91  for ( i = 0; i < nMints; i++ )
92  for ( k = 0; k < nVars; k++ )
93  if ( pMintStrs[i][k] == '1' )
94  pMints[i] |= (1 << k), pVars[k] |= (1 << i);
95  // extract funcs
96  for ( i = 0; i < nFuncs; i++ )
97  for ( k = 0; k < nMints; k++ )
98  if ( pFuncStrs[i][k] == '1' )
99  pFuncs[i] |= (1 << k);
100 }
void Abc_GetSecond ( int *  pnVars,
int *  pnMints,
int *  pnFuncs,
unsigned *  pVars,
unsigned *  pMints,
unsigned *  pFuncs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 113 of file extraUtilEnum.c.

114 {
115  int nVars = 10;
116  int nMints = 32;
117  int nFuncs = 7;
118  char * pMintStrs[32] = {
119  "1-1---1---",
120  "1-1----1--",
121  "1-1-----1-",
122  "1-1------1",
123 
124  "1--1--1---",
125  "1--1---1--",
126  "1--1----1-",
127  "1--1-----1",
128 
129  "1---1-1---",
130  "1---1--1--",
131  "1---1---1-",
132  "1---1----1",
133 
134  "1----11---",
135  "1----1-1--",
136  "1----1--1-",
137  "1----1---1",
138 
139 
140  "-11---1---",
141  "-11----1--",
142  "-11-----1-",
143  "-11------1",
144 
145  "-1-1--1---",
146  "-1-1---1--",
147  "-1-1----1-",
148  "-1-1-----1",
149 
150  "-1--1-1---",
151  "-1--1--1--",
152  "-1--1---1-",
153  "-1--1----1",
154 
155  "-1---11---",
156  "-1---1-1--",
157  "-1---1--1-",
158  "-1---1---1"
159  };
160  char * pFuncStrs[7] = {
161  "11111110110010001110110010000000",
162  "00000001001101110001001101111111",
163  "10000001001001000001001001001000",
164  "01001000000100101000000100100100",
165  "00100100100000010100100000010010",
166  "00010010010010000010010010000001",
167  "11111111111111111111000000000000"
168  };
169  int i, k;
170  *pnVars = nVars;
171  *pnMints = nMints;
172  *pnFuncs = nFuncs;
173  // extract mints
174  for ( i = 0; i < nMints; i++ )
175  for ( k = 0; k < nVars; k++ )
176  if ( pMintStrs[i][k] == '1' )
177  pMints[i] |= (1 << k), pVars[k] |= (1 << i);
178  // extract funcs
179  for ( i = 0; i < nFuncs; i++ )
180  for ( k = 0; k < nMints; k++ )
181  if ( pFuncStrs[i][k] == '1' )
182  pFuncs[i] |= (1 << k);
183 }
void Abc_GetThird ( int *  pnVars,
int *  pnMints,
int *  pnFuncs,
unsigned *  pVars,
unsigned *  pMints,
unsigned *  pFuncs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file extraUtilEnum.c.

197 {
198  int nVars = 8;
199  int nMints = 16;
200  int nFuncs = 7;
201  char * pMintStrs[16] = {
202  "1---1---",
203  "1----1--",
204  "1-----1-",
205  "1------1",
206 
207  "-1--1---",
208  "-1---1--",
209  "-1----1-",
210  "-1-----1",
211 
212  "--1-1---",
213  "--1--1--",
214  "--1---1-",
215  "--1----1",
216 
217  "---11---",
218  "---1-1--",
219  "---1--1-",
220  "---1---1"
221  };
222  char * pFuncStrs[7] = {
223  "1111111011001000",
224  "0000000100110111",
225  "1000000100100100",
226  "0100100000010010",
227  "0010010010000001",
228  "0001001001001000",
229  "1111111111111111"
230  };
231  int i, k;
232  *pnVars = nVars;
233  *pnMints = nMints;
234  *pnFuncs = nFuncs;
235  // extract mints
236  for ( i = 0; i < nMints; i++ )
237  for ( k = 0; k < nVars; k++ )
238  if ( pMintStrs[i][k] == '1' )
239  pMints[i] |= (1 << k), pVars[k] |= (1 << i);
240  // extract funcs
241  for ( i = 0; i < nFuncs; i++ )
242  for ( k = 0; k < nMints; k++ )
243  if ( pFuncStrs[i][k] == '1' )
244  pFuncs[i] |= (1 << k);
245 }

Variable Documentation

word s_Truths6[6]
static
Initial value:
= {
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
ABC_CONST(0xFF00FF00FF00FF00),
ABC_CONST(0xFFFF0000FFFF0000),
}
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206

Definition at line 430 of file extraUtilEnum.c.