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

Go to the source code of this file.

Macros

#define DAU_MAX_VAR   12
 INCLUDES ///. More...
 
#define DAU_MAX_STR   2000
 
#define DAU_MAX_WORD   (1<<(DAU_MAX_VAR-6))
 

Typedefs

typedef struct Dss_Man_t_ Dss_Man_t
 

Enumerations

enum  Dau_DsdType_t {
  DAU_DSD_NONE = 0, DAU_DSD_CONST0, DAU_DSD_VAR, DAU_DSD_AND,
  DAU_DSD_XOR, DAU_DSD_MUX, DAU_DSD_PRIME
}
 BASIC TYPES ///. More...
 

Functions

static int Dau_DsdIsConst (char *p)
 MACRO DEFINITIONS ///. More...
 
static int Dau_DsdIsConst0 (char *p)
 
static int Dau_DsdIsConst1 (char *p)
 
static int Dau_DsdIsVar (char *p)
 
static int Dau_DsdReadVar (char *p)
 
unsigned Abc_TtCanonicize (word *pTruth, int nVars, char *pCanonPerm)
 FUNCTION DECLARATIONS ///. More...
 
unsigned Abc_TtCanonicizePhase (word *pTruth, int nVars)
 
int * Dau_DsdComputeMatches (char *p)
 
int Dau_DsdDecompose (word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
 
int Dau_DsdDecomposeLevel (word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes, int *pVarLevels)
 
void Dau_DsdPrintFromTruthFile (FILE *pFile, word *pTruth, int nVarsInit)
 
void Dau_DsdPrintFromTruth (word *pTruth, int nVarsInit)
 
wordDau_DsdToTruth (char *p, int nVars)
 
word Dau_Dsd6ToTruth (char *p)
 
void Dau_DsdNormalize (char *p)
 
int Dau_DsdCountAnds (char *pDsd)
 
void Dau_DsdTruthCompose_rec (word *pFunc, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word *pRes, int nVars, int nWordsR)
 
int Dau_DsdCheck1Step (void *p, word *pTruth, int nVarsInit, int *pVarLevels)
 
int Dsm_ManTruthToGia (void *p, word *pTruth, Vec_Int_t *vLeaves, Vec_Int_t *vCover)
 
void * Dsm_ManDeriveGia (void *p, int fUseMuxes)
 
void Dau_DsdRemoveBraces (char *pDsd, int *pMatches)
 
char * Dau_DsdMerge (char *pDsd0i, int *pPerm0, char *pDsd1i, int *pPerm1, int fCompl0, int fCompl1, int nVars)
 DECLARATIONS ///. More...
 
Vec_Int_tDau_DecFindSets_int (word *pInit, int nVars, int *pSched[16])
 
Vec_Int_tDau_DecFindSets (word *pInit, int nVars)
 
void Dau_DecSortSet (unsigned set, int nVars, int *pnUnique, int *pnShared, int *pnFree)
 
void Dau_DecPrintSets (Vec_Int_t *vSets, int nVars)
 
void Dau_DecPrintSet (unsigned set, int nVars, int fNewLine)
 
Dss_Man_tDss_ManAlloc (int nVars, int nNonDecLimit)
 
void Dss_ManFree (Dss_Man_t *p)
 
int Dss_ManMerge (Dss_Man_t *p, int *iDsd, int *nFans, int **pFans, unsigned uSharedMask, int nKLutSize, unsigned char *pPerm, word *pTruth)
 
void Dss_ManPrint (char *pFileName, Dss_Man_t *p)
 

Macro Definition Documentation

#define DAU_MAX_STR   2000

Definition at line 43 of file dau.h.

#define DAU_MAX_VAR   12

INCLUDES ///.

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

FileName [dau.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [DAG-aware unmapping.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
dau.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///

Definition at line 42 of file dau.h.

#define DAU_MAX_WORD   (1<<(DAU_MAX_VAR-6))

Definition at line 44 of file dau.h.

Typedef Documentation

typedef struct Dss_Man_t_ Dss_Man_t

Definition at line 61 of file dau.h.

Enumeration Type Documentation

BASIC TYPES ///.

Enumerator
DAU_DSD_NONE 
DAU_DSD_CONST0 
DAU_DSD_VAR 
DAU_DSD_AND 
DAU_DSD_XOR 
DAU_DSD_MUX 
DAU_DSD_PRIME 

Definition at line 51 of file dau.h.

51  {
52  DAU_DSD_NONE = 0, // 0: unknown
53  DAU_DSD_CONST0, // 1: constant
54  DAU_DSD_VAR, // 2: variable
55  DAU_DSD_AND, // 3: AND
56  DAU_DSD_XOR, // 4: XOR
57  DAU_DSD_MUX, // 5: MUX
58  DAU_DSD_PRIME // 6: PRIME
Dau_DsdType_t
BASIC TYPES ///.
Definition: dau.h:51

Function Documentation

unsigned Abc_TtCanonicize ( word pTruth,
int  nVars,
char *  pCanonPerm 
)

FUNCTION DECLARATIONS ///.

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

Synopsis [Semi-canonical form computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 895 of file dauCanon.c.

896 {
897  int pStoreIn[17];
898  unsigned uCanonPhase;
899  int i, k, nWords = Abc_TtWordNum( nVars );
900  int fNaive = 1;
901 
902 #ifdef CANON_VERIFY
903  char pCanonPermCopy[16];
904  static word pCopy1[1024];
905  static word pCopy2[1024];
906  Abc_TtCopy( pCopy1, pTruth, nWords, 0 );
907 #endif
908 
909  uCanonPhase = Abc_TtSemiCanonicize( pTruth, nVars, pCanonPerm, pStoreIn );
910  for ( k = 0; k < 5; k++ )
911  {
912  int fChanges = 0;
913  for ( i = nVars - 2; i >= 0; i-- )
914  if ( pStoreIn[i] == pStoreIn[i+1] )
915  fChanges |= Abc_TtCofactorPerm( pTruth, i, nWords, pStoreIn[i] != pStoreIn[nVars]/2, pCanonPerm, &uCanonPhase, fNaive );
916  if ( !fChanges )
917  break;
918  fChanges = 0;
919  for ( i = 1; i < nVars - 1; i++ )
920  if ( pStoreIn[i] == pStoreIn[i+1] )
921  fChanges |= Abc_TtCofactorPerm( pTruth, i, nWords, pStoreIn[i] != pStoreIn[nVars]/2, pCanonPerm, &uCanonPhase, fNaive );
922  if ( !fChanges )
923  break;
924  }
925 
926 #ifdef CANON_VERIFY
927  Abc_TtCopy( pCopy2, pTruth, nWords, 0 );
928  memcpy( pCanonPermCopy, pCanonPerm, sizeof(char) * nVars );
929  Abc_TtImplementNpnConfig( pCopy2, nVars, pCanonPermCopy, uCanonPhase );
930  if ( !Abc_TtEqual( pCopy1, pCopy2, nWords ) )
931  printf( "Canonical form verification failed!\n" );
932 #endif
933 /*
934  if ( !Abc_TtEqual( pCopy1, pCopy2, nWords ) )
935  {
936  Kit_DsdPrintFromTruth( pCopy1, nVars ); printf( "\n" );
937  Kit_DsdPrintFromTruth( pCopy2, nVars ); printf( "\n" );
938  i = 0;
939  }
940 */
941  return uCanonPhase;
942 }
int Abc_TtCofactorPerm(word *pTruth, int i, int nWords, int fSwapOnly, char *pCanonPerm, unsigned *puCanonPhase, int fNaive)
Definition: dauCanon.c:837
char * memcpy()
int nWords
Definition: abcNpn.c:127
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Abc_TtImplementNpnConfig(word *pTruth, int nVars, char *pCanonPerm, unsigned uCanonPhase)
Definition: utilTruth.h:1428
static unsigned Abc_TtSemiCanonicize(word *pTruth, int nVars, char *pCanonPerm, int *pStoreOut)
Definition: dauCanon.c:475
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static int Abc_TtEqual(word *pIn1, word *pIn2, int nWords)
Definition: utilTruth.h:269
unsigned Abc_TtCanonicizePhase ( word pTruth,
int  nVars 
)

Definition at line 999 of file dauCanon.c.

1000 {
1001  unsigned uCanonPhase = 0;
1002  int v, nWords = Abc_TtWordNum( nVars );
1003 // static int Counter = 0;
1004 // Counter++;
1005 
1006 #ifdef CANON_VERIFY
1007  static word pCopy1[1024];
1008  static word pCopy2[1024];
1009  Abc_TtCopy( pCopy1, pTruth, nWords, 0 );
1010 #endif
1011 
1012  if ( (pTruth[nWords-1] >> 63) & 1 )
1013  {
1014  Abc_TtNot( pTruth, nWords );
1015  uCanonPhase ^= (1 << nVars);
1016  }
1017 
1018 // while ( 1 )
1019 // {
1020 // unsigned uCanonPhase2 = uCanonPhase;
1021  for ( v = nVars - 1; v >= 6; v-- )
1022  if ( Abc_TtCanonicizePhaseVar6( pTruth, nVars, v ) == 1 )
1023  uCanonPhase ^= 1 << v;
1024  for ( ; v >= 0; v-- )
1025  if ( Abc_TtCanonicizePhaseVar5( pTruth, nVars, v ) == 1 )
1026  uCanonPhase ^= 1 << v;
1027 // if ( uCanonPhase2 == uCanonPhase )
1028 // break;
1029 // }
1030 
1031 // for ( v = 5; v >= 0; v-- )
1032 // assert( Abc_TtCanonicizePhaseVar5( pTruth, nVars, v ) != 1 );
1033 
1034 #ifdef CANON_VERIFY
1035  Abc_TtCopy( pCopy2, pTruth, nWords, 0 );
1036  Abc_TtImplementNpnConfig( pCopy2, nVars, NULL, uCanonPhase );
1037  if ( !Abc_TtEqual( pCopy1, pCopy2, nWords ) )
1038  printf( "Canonical form verification failed!\n" );
1039 #endif
1040  return uCanonPhase;
1041 }
static int Abc_TtCanonicizePhaseVar5(word *pTruth, int nVars, int v)
Definition: dauCanon.c:979
static int Abc_TtCanonicizePhaseVar6(word *pTruth, int nVars, int v)
Definition: dauCanon.c:955
int nWords
Definition: abcNpn.c:127
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Abc_TtImplementNpnConfig(word *pTruth, int nVars, char *pCanonPerm, unsigned uCanonPhase)
Definition: utilTruth.h:1428
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static int Abc_TtEqual(word *pIn1, word *pIn2, int nWords)
Definition: utilTruth.h:269
static void Abc_TtNot(word *pOut, int nWords)
Definition: utilTruth.h:215
Vec_Int_t* Dau_DecFindSets ( word pInit,
int  nVars 
)

Definition at line 516 of file dauNonDsd.c.

517 {
518  Vec_Int_t * vSets;
519  int v, * pSched[16] = {NULL};
520  for ( v = 2; v < nVars; v++ )
521  pSched[v] = Extra_GreyCodeSchedule( v );
522  vSets = Dau_DecFindSets_int( pInit, nVars, pSched );
523  for ( v = 2; v < nVars; v++ )
524  ABC_FREE( pSched[v] );
525  return vSets;
526 }
int * Extra_GreyCodeSchedule(int n)
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Dau_DecFindSets_int(word *pInit, int nVars, int *pSched[16])
Definition: dauNonDsd.c:462
#define ABC_FREE(obj)
Definition: abc_global.h:232
Vec_Int_t* Dau_DecFindSets_int ( word pInit,
int  nVars,
int *  pSched[16] 
)

Definition at line 462 of file dauNonDsd.c.

463 {
464  Vec_Int_t * vSets = Vec_IntAlloc( 32 );
465  int V2P[16], P2V[16], pVarsB[16];
466  int Limit = (1 << nVars);
467  int c, v, sizeB, sizeS, maskB, maskS;
468  unsigned setMixed;
469  word p[1<<10];
470  memcpy( p, pInit, sizeof(word) * Abc_TtWordNum(nVars) );
471  for ( v = 0; v < nVars; v++ )
472  assert( Abc_TtHasVar( p, nVars, v ) );
473  // initialize permutation
474  for ( v = 0; v < nVars; v++ )
475  V2P[v] = P2V[v] = v;
476  // iterate through bound sets of each size in increasing order
477  for ( sizeB = 2; sizeB < nVars; sizeB++ ) // bound set size
478  for ( maskB = 0; maskB < Limit; maskB++ ) // bound set
479  if ( Abc_TtBitCount16(maskB) == sizeB )
480  {
481  // permute variables to have bound set on top
482  Dau_DecMoveFreeToLSB( p, nVars, V2P, P2V, maskB, sizeB );
483  // collect bound set vars on levels nVars-sizeB to nVars-1
484  for ( c = 0; c < sizeB; c++ )
485  pVarsB[c] = P2V[nVars-sizeB+c];
486  // check disjoint
487 // if ( Dau_DecCheckSetTopOld(p, nVars, nVars-sizeB, sizeB, 0, 0, NULL, NULL, NULL) )
488  if ( Dau_DecCheckSetTop(p, nVars, nVars-sizeB, sizeB, 0, 0, pSched[sizeB], NULL, NULL) )
489  {
490  Vec_IntPush( vSets, Dau_DecCreateSet(pVarsB, sizeB, 0) );
491  continue;
492  }
493  if ( sizeB == 2 )
494  continue;
495  // iterate through shared sets of each size in the increasing order
496  for ( sizeS = 1; sizeS <= sizeB - 2; sizeS++ ) // shared set size
497  if ( sizeS <= 3 )
498 // sizeS = 1;
499  for ( maskS = 0; maskS < (1 << sizeB); maskS++ ) // shared set
500  if ( Abc_TtBitCount16(maskS) == sizeS )
501  {
502  setMixed = Dau_DecCreateSet( pVarsB, sizeB, maskS );
503 // printf( "Considering %10d ", setMixed );
504 // Dau_DecPrintSet( setMixed, nVars );
505  // check if it exists
506  if ( Dau_DecSetIsContained(vSets, setMixed) )
507  continue;
508  // check if it can be added
509 // if ( Dau_DecCheckSetTopOld(p, nVars, nVars-sizeB, sizeB, sizeS, maskS, NULL, NULL, NULL) )
510  if ( Dau_DecCheckSetTop(p, nVars, nVars-sizeB, sizeB, sizeS, maskS, pSched[sizeB], NULL, NULL) )
511  Vec_IntPush( vSets, setMixed );
512  }
513  }
514  return vSets;
515 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
char * memcpy()
static int Abc_TtBitCount16(int i)
Definition: utilTruth.h:127
static unsigned Dau_DecCreateSet(int *pVarsB, int sizeB, int maskS)
Definition: dauNonDsd.c:342
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static int Abc_TtHasVar(word *t, int nVars, int iVar)
Definition: utilTruth.h:953
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static int Dau_DecSetIsContained(Vec_Int_t *vSets, unsigned New)
Definition: dauNonDsd.c:357
static int Dau_DecCheckSetTop(word *p, int nVars, int nVarsF, int nVarsB, int nVarsS, int uMaskS, int *pSched, word *pDec, word *pComp)
Definition: dauNonDsd.c:181
#define assert(ex)
Definition: util_old.h:213
void Dau_DecMoveFreeToLSB(word *p, int nVars, int *V2P, int *P2V, int maskB, int sizeB)
Definition: dauNonDsd.c:454
void Dau_DecPrintSet ( unsigned  set,
int  nVars,
int  fNewLine 
)

Definition at line 390 of file dauNonDsd.c.

391 {
392  int v, Counter = 0;
393  int nUnique = 0, nShared = 0, nFree = 0;
394  Dau_DecSortSet( set, nVars, &nUnique, &nShared, &nFree );
395  printf( "S =%2d D =%2d C =%2d ", nShared, nUnique+nShared, nShared+nFree+1 );
396 
397  printf( "x=" );
398  for ( v = 0; v < nVars; v++ )
399  {
400  int Value = ((set >> (v << 1)) & 3);
401  if ( Value == 1 )
402  printf( "%c", 'a' + v ), Counter++;
403  else if ( Value == 3 )
404  printf( "%c", 'A' + v ), Counter++;
405  else assert( Value == 0 );
406  }
407  printf( " y=x" );
408  for ( v = 0; v < nVars; v++ )
409  {
410  int Value = ((set >> (v << 1)) & 3);
411  if ( Value == 0 )
412  printf( "%c", 'a' + v ), Counter++;
413  else if ( Value == 3 )
414  printf( "%c", 'A' + v ), Counter++;
415  }
416  for ( ; Counter < 15; Counter++ )
417  printf( " " );
418  if ( fNewLine )
419  printf( "\n" );
420 }
void Dau_DecSortSet(unsigned set, int nVars, int *pnUnique, int *pnShared, int *pnFree)
Definition: dauNonDsd.c:371
static int Counter
#define assert(ex)
Definition: util_old.h:213
void Dau_DecPrintSets ( Vec_Int_t vSets,
int  nVars 
)

Definition at line 434 of file dauNonDsd.c.

435 {
436  int i, Entry;
437  printf( "The %d-variable set family contains %d sets:\n", nVars, Vec_IntSize(vSets) );
438  Vec_IntForEachEntry( vSets, Entry, i )
439  Dau_DecPrintSet( (unsigned)Entry, nVars, 1 );
440  printf( "\n" );
441 }
void Dau_DecPrintSet(unsigned set, int nVars, int fNewLine)
Definition: dauNonDsd.c:390
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
void Dau_DecSortSet ( unsigned  set,
int  nVars,
int *  pnUnique,
int *  pnShared,
int *  pnFree 
)

Definition at line 371 of file dauNonDsd.c.

372 {
373  int v;
374  int nUnique = 0, nShared = 0, nFree = 0;
375  for ( v = 0; v < nVars; v++ )
376  {
377  int Value = ((set >> (v << 1)) & 3);
378  if ( Value == 1 )
379  nUnique++;
380  else if ( Value == 3 )
381  nShared++;
382  else if ( Value == 0 )
383  nFree++;
384  else assert( 0 );
385  }
386  *pnUnique = nUnique;
387  *pnShared = nShared;
388  *pnFree = nFree;
389 }
#define assert(ex)
Definition: util_old.h:213
word Dau_Dsd6ToTruth ( char *  p)

Definition at line 445 of file dauDsd.c.

446 {
447  word Res;
448  if ( *p == '0' && *(p+1) == 0 )
449  Res = 0;
450  else if ( *p == '1' && *(p+1) == 0 )
451  Res = ~(word)0;
452  else
454  assert( *++p == 0 );
455  return Res;
456 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
word Dau_Dsd6ToTruth_rec(char *pStr, char **p, int *pMatches, word *pTruths)
Definition: dauDsd.c:353
static word s_Truths6[6]
#define assert(ex)
Definition: util_old.h:213
int * Dau_DsdComputeMatches(char *p)
Definition: dauDsd.c:80
int Dau_DsdCheck1Step ( void *  p,
word pTruth,
int  nVarsInit,
int *  pVarLevels 
)

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

Synopsis [Find the best cofactoring variable.]

Description [Return -2 if non-DSD; -1 if full DSD; otherwise, returns cofactoring variables i (i >= 0).]

SideEffects []

SeeAlso []

Definition at line 893 of file dauDsd.c.

894 {
895  word pCofTemp[DAU_MAX_WORD];
896  int pVarPrios[DAU_MAX_VAR];
897  int nWords = Abc_TtWordNum(nVarsInit);
898  int nSizeNonDec, nSizeNonDec0, nSizeNonDec1;
899  int i, vBest = -2, nSumCofsBest = ABC_INFINITY, nSumCofs;
900  nSizeNonDec = Dau_DsdDecompose( pTruth, nVarsInit, 0, 0, NULL );
901  if ( nSizeNonDec == 0 )
902  return -1;
903  assert( nSizeNonDec > 0 );
904  // find variable priority
905  for ( i = 0; i < nVarsInit; i++ )
906  pVarPrios[i] = i;
907  if ( pVarLevels )
908  {
909  extern int Dau_DsdLevelVar( void * pMan, int iVar );
910  int pVarLevels[DAU_MAX_VAR];
911  for ( i = 0; i < nVarsInit; i++ )
912  pVarLevels[i] = -Dau_DsdLevelVar( p, i );
913 // for ( i = 0; i < nVarsInit; i++ )
914 // printf( "%d ", -pVarLevels[i] );
915 // printf( "\n" );
916  Vec_IntSelectSortCost2( pVarPrios, nVarsInit, pVarLevels );
917 // for ( i = 0; i < nVarsInit; i++ )
918 // printf( "%d ", pVarPrios[i] );
919 // printf( "\n\n" );
920  }
921  for ( i = 0; i < nVarsInit; i++ )
922  {
923  assert( pVarPrios[i] >= 0 && pVarPrios[i] < nVarsInit );
924  // try first cofactor
925  Abc_TtCofactor0p( pCofTemp, pTruth, nWords, pVarPrios[i] );
926  nSumCofs = Abc_TtSupportSize( pCofTemp, nVarsInit );
927  nSizeNonDec0 = Dau_DsdDecompose( pCofTemp, nVarsInit, 0, 0, NULL );
928  // try second cofactor
929  Abc_TtCofactor1p( pCofTemp, pTruth, nWords, pVarPrios[i] );
930  nSumCofs += Abc_TtSupportSize( pCofTemp, nVarsInit );
931  nSizeNonDec1 = Dau_DsdDecompose( pCofTemp, nVarsInit, 0, 0, NULL );
932  // compare cofactors
933  if ( nSizeNonDec0 || nSizeNonDec1 )
934  continue;
935  if ( nSumCofsBest > nSumCofs )
936  {
937  vBest = pVarPrios[i];
938  nSumCofsBest = nSumCofs;
939  }
940  }
941  return vBest;
942 }
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition: dauDsd.c:1912
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Abc_TtCofactor1p(word *pOut, word *pIn, int nWords, int iVar)
Definition: utilTruth.h:403
int Dau_DsdLevelVar(void *pMan, int iVar)
Definition: dauDsd.c:1018
int nWords
Definition: abcNpn.c:127
static void Abc_TtCofactor0p(word *pOut, word *pIn, int nWords, int iVar)
Definition: utilTruth.h:381
#define DAU_MAX_VAR
INCLUDES ///.
Definition: dau.h:42
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static void Vec_IntSelectSortCost2(int *pArray, int nSize, int *pCosts)
Definition: vecInt.h:1778
#define DAU_MAX_WORD
Definition: dau.h:44
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static int Abc_TtSupportSize(word *t, int nVars)
Definition: utilTruth.h:986
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
#define assert(ex)
Definition: util_old.h:213
int* Dau_DsdComputeMatches ( char *  p)

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

Synopsis [DSD formula manipulation.]

Description []

SideEffects []

SeeAlso []

Definition at line 80 of file dauDsd.c.

81 {
82  static int pMatches[DAU_MAX_STR];
83  int pNested[DAU_MAX_VAR];
84  int v, nNested = 0;
85  for ( v = 0; p[v]; v++ )
86  {
87  pMatches[v] = 0;
88  if ( p[v] == '(' || p[v] == '[' || p[v] == '<' || p[v] == '{' )
89  pNested[nNested++] = v;
90  else if ( p[v] == ')' || p[v] == ']' || p[v] == '>' || p[v] == '}' )
91  pMatches[pNested[--nNested]] = v;
92  assert( nNested < DAU_MAX_VAR );
93  }
94  assert( nNested == 0 );
95  return pMatches;
96 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define DAU_MAX_STR
Definition: dau.h:43
#define DAU_MAX_VAR
INCLUDES ///.
Definition: dau.h:42
#define assert(ex)
Definition: util_old.h:213
int Dau_DsdCountAnds ( char *  pDsd)

Definition at line 316 of file dauDsd.c.

317 {
318  if ( pDsd[1] == 0 )
319  return 0;
320  return Dau_DsdCountAnds_rec( pDsd, &pDsd, Dau_DsdComputeMatches(pDsd) );
321 }
int * Dau_DsdComputeMatches(char *p)
Definition: dauDsd.c:80
int Dau_DsdCountAnds_rec(char *pStr, char **p, int *pMatches)
Definition: dauDsd.c:279
int Dau_DsdDecompose ( word pTruth,
int  nVarsInit,
int  fSplitPrime,
int  fWriteTruth,
char *  pRes 
)

Definition at line 1912 of file dauDsd.c.

1913 {
1914  Dau_Dsd_t P, * p = &P;
1915  p->fSplitPrime = fSplitPrime;
1916  p->fWriteTruth = fWriteTruth;
1917  p->pVarLevels = NULL;
1918  p->nSizeNonDec = 0;
1919  if ( (pTruth[0] & 1) == 0 && Abc_TtIsConst0(pTruth, Abc_TtWordNum(nVarsInit)) )
1920  { if ( pRes ) pRes[0] = '0', pRes[1] = 0; }
1921  else if ( (pTruth[0] & 1) && Abc_TtIsConst1(pTruth, Abc_TtWordNum(nVarsInit)) )
1922  { if ( pRes ) pRes[0] = '1', pRes[1] = 0; }
1923  else
1924  {
1925  int Status = Dau_DsdDecomposeInt( p, pTruth, nVarsInit );
1926  Dau_DsdRemoveBraces( p->pOutput, Dau_DsdComputeMatches(p->pOutput) );
1927  if ( pRes )
1928  strcpy( pRes, p->pOutput );
1929  assert( fSplitPrime || Status != 1 );
1930  if ( fSplitPrime && Status == 2 )
1931  return -1;
1932  }
1933 // assert( p->nSizeNonDec == 0 );
1934  return p->nSizeNonDec;
1935 }
typedefABC_NAMESPACE_IMPL_START struct Dau_Dsd_t_ Dau_Dsd_t
DECLARATIONS ///.
Definition: dauArray.c:29
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static byte P[256]
Definition: kitPerm.c:76
static int Abc_TtIsConst0(word *pIn1, int nWords)
Definition: utilTruth.h:293
void Dau_DsdRemoveBraces(char *pDsd, int *pMatches)
Definition: dauMerge.c:554
static int Abc_TtIsConst1(word *pIn1, int nWords)
Definition: utilTruth.h:301
char * strcpy()
int Dau_DsdDecomposeInt(Dau_Dsd_t *p, word *pTruth, int nVarsInit)
Definition: dauDsd.c:1897
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
#define assert(ex)
Definition: util_old.h:213
int * Dau_DsdComputeMatches(char *p)
Definition: dauDsd.c:80
int Dau_DsdDecomposeLevel ( word pTruth,
int  nVarsInit,
int  fSplitPrime,
int  fWriteTruth,
char *  pRes,
int *  pVarLevels 
)

Definition at line 1936 of file dauDsd.c.

1937 {
1938  Dau_Dsd_t P, * p = &P;
1939  p->fSplitPrime = fSplitPrime;
1940  p->fWriteTruth = fWriteTruth;
1941  p->pVarLevels = pVarLevels;
1942  p->nSizeNonDec = 0;
1943  if ( (pTruth[0] & 1) == 0 && Abc_TtIsConst0(pTruth, Abc_TtWordNum(nVarsInit)) )
1944  { if ( pRes ) pRes[0] = '0', pRes[1] = 0; }
1945  else if ( (pTruth[0] & 1) && Abc_TtIsConst1(pTruth, Abc_TtWordNum(nVarsInit)) )
1946  { if ( pRes ) pRes[0] = '1', pRes[1] = 0; }
1947  else
1948  {
1949  int Status = Dau_DsdDecomposeInt( p, pTruth, nVarsInit );
1950  Dau_DsdRemoveBraces( p->pOutput, Dau_DsdComputeMatches(p->pOutput) );
1951  if ( pRes )
1952  strcpy( pRes, p->pOutput );
1953  assert( fSplitPrime || Status != 1 );
1954  if ( fSplitPrime && Status == 2 )
1955  return -1;
1956  }
1957 // assert( p->nSizeNonDec == 0 );
1958  return p->nSizeNonDec;
1959 }
typedefABC_NAMESPACE_IMPL_START struct Dau_Dsd_t_ Dau_Dsd_t
DECLARATIONS ///.
Definition: dauArray.c:29
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static byte P[256]
Definition: kitPerm.c:76
static int Abc_TtIsConst0(word *pIn1, int nWords)
Definition: utilTruth.h:293
void Dau_DsdRemoveBraces(char *pDsd, int *pMatches)
Definition: dauMerge.c:554
static int Abc_TtIsConst1(word *pIn1, int nWords)
Definition: utilTruth.h:301
char * strcpy()
int Dau_DsdDecomposeInt(Dau_Dsd_t *p, word *pTruth, int nVarsInit)
Definition: dauDsd.c:1897
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
#define assert(ex)
Definition: util_old.h:213
int * Dau_DsdComputeMatches(char *p)
Definition: dauDsd.c:80
static int Dau_DsdIsConst ( char *  p)
inlinestatic

MACRO DEFINITIONS ///.

Definition at line 67 of file dau.h.

67 { return (p[0] == '0' || p[0] == '1') && p[1] == 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Dau_DsdIsConst0 ( char *  p)
inlinestatic

Definition at line 68 of file dau.h.

68 { return p[0] == '0' && p[1] == 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Dau_DsdIsConst1 ( char *  p)
inlinestatic

Definition at line 69 of file dau.h.

69 { return p[0] == '1' && p[1] == 0; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Dau_DsdIsVar ( char *  p)
inlinestatic

Definition at line 70 of file dau.h.

70 { if ( *p == '!' ) p++; return *p >= 'a' && *p <= 'z'; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char* Dau_DsdMerge ( char *  pDsd0i,
int *  pPerm0,
char *  pDsd1i,
int *  pPerm1,
int  fCompl0,
int  fCompl1,
int  nVars 
)

DECLARATIONS ///.

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

Synopsis [Performs merging of two DSD formulas.]

Description []

SideEffects []

SeeAlso []

Definition at line 587 of file dauMerge.c.

588 {
589  int fVerbose = 0;
590  int fCheck = 0;
591  static int Counter = 0;
592  static char pRes[DAU_MAX_STR];
593  char pDsd0[DAU_MAX_STR];
594  char pDsd1[DAU_MAX_STR];
595  int pMatches0[DAU_MAX_STR];
596  int pMatches1[DAU_MAX_STR];
597  int pVarPres[DAU_MAX_VAR];
598  int pOld2New[DAU_MAX_VAR];
599  int pNew2Old[DAU_MAX_VAR];
600  int pStatus0[DAU_MAX_STR];
601  int pStatus1[DAU_MAX_STR];
602  int pMatches[DAU_MAX_STR];
603  int nVarsShared, nVarsTotal;
604  Dau_Sto_t S, * pS = &S;
605  word * pTruth, * pt = NULL, * pt0 = NULL, * pt1 = NULL;
606  word pParts[3][DAU_MAX_WORD];
607  int Status;
608  abctime clk = Abc_Clock();
609  Counter++;
610  // create local copies
611  Dau_DsdMergeCopy( pDsd0i, fCompl0, pDsd0 );
612  Dau_DsdMergeCopy( pDsd1i, fCompl1, pDsd1 );
613 if ( fVerbose )
614 printf( "\nAfter copying:\n" );
615 if ( fVerbose )
616 printf( "%s\n", pDsd0 );
617 if ( fVerbose )
618 printf( "%s\n", pDsd1 );
619  // handle constants
620  if ( Dau_DsdIsConst(pDsd0) || Dau_DsdIsConst(pDsd1) )
621  {
622  if ( Dau_DsdIsConst0(pDsd0) )
623  strcpy( pRes, pDsd0 );
624  else if ( Dau_DsdIsConst1(pDsd0) )
625  strcpy( pRes, pDsd1 );
626  else if ( Dau_DsdIsConst0(pDsd1) )
627  strcpy( pRes, pDsd1 );
628  else if ( Dau_DsdIsConst1(pDsd1) )
629  strcpy( pRes, pDsd0 );
630  else assert( 0 );
631  return pRes;
632  }
633 
634  // compute matches
635  Dau_DsdMergeMatches( pDsd0, pMatches0 );
636  Dau_DsdMergeMatches( pDsd1, pMatches1 );
637  // implement permutation
638  Dau_DsdMergeReplace( pDsd0, pMatches0, pPerm0 );
639  Dau_DsdMergeReplace( pDsd1, pMatches1, pPerm1 );
640 if ( fVerbose )
641 printf( "After replacement:\n" );
642 if ( fVerbose )
643 printf( "%s\n", pDsd0 );
644 if ( fVerbose )
645 printf( "%s\n", pDsd1 );
646 
647 
648  if ( fCheck )
649  {
650  pt0 = Dau_DsdToTruth( pDsd0, nVars );
651  Abc_TtCopy( pParts[0], pt0, Abc_TtWordNum(nVars), 0 );
652  }
653  if ( fCheck )
654  {
655  pt1 = Dau_DsdToTruth( pDsd1, nVars );
656  Abc_TtCopy( pParts[1], pt1, Abc_TtWordNum(nVars), 0 );
657  Abc_TtAnd( pParts[2], pParts[0], pParts[1], Abc_TtWordNum(nVars), 0 );
658  }
659 
660  // find shared varaiables
661  nVarsShared = Dau_DsdMergeFindShared(pDsd0, pDsd1, pMatches0, pMatches1, pVarPres);
662  if ( nVarsShared == 0 )
663  {
664  sprintf( pRes, "(%s%s)", pDsd0, pDsd1 );
665 if ( fVerbose )
666 printf( "Disjoint:\n" );
667 if ( fVerbose )
668 printf( "%s\n", pRes );
669 
670  Dau_DsdMergeMatches( pRes, pMatches );
671  Dau_DsdRemoveBraces( pRes, pMatches );
672  Dau_DsdNormalize( pRes );
673 if ( fVerbose )
674 printf( "Normalized:\n" );
675 if ( fVerbose )
676 printf( "%s\n", pRes );
677 
678  s_TimeComp[0] += Abc_Clock() - clk;
679  return pRes;
680  }
681 s_TimeComp[3] += Abc_Clock() - clk;
682  // create variable mapping
683  nVarsTotal = Dau_DsdMergeCreateMaps( pVarPres, nVarsShared, pOld2New, pNew2Old );
684  // perform variable replacement
685  Dau_DsdMergeReplace( pDsd0, pMatches0, pOld2New );
686  Dau_DsdMergeReplace( pDsd1, pMatches1, pOld2New );
687  // find uniqueness status
688  Dau_DsdMergeStatus( pDsd0, pMatches0, nVarsShared, pStatus0 );
689  Dau_DsdMergeStatus( pDsd1, pMatches1, nVarsShared, pStatus1 );
690 if ( fVerbose )
691 printf( "Individual status:\n" );
692 if ( fVerbose )
693 Dau_DsdMergePrintWithStatus( pDsd0, pStatus0 );
694 if ( fVerbose )
695 Dau_DsdMergePrintWithStatus( pDsd1, pStatus1 );
696  // prepare storage
697  Dau_DsdMergeStoreClean( pS, nVarsShared );
698  // perform substitutions
700  Dau_DsdMergeSubstitute( pS, pDsd0, pMatches0, pStatus0 );
701  strcpy( pDsd0, pS->pOutput );
702 if ( fVerbose )
703 printf( "Substitutions:\n" );
704 if ( fVerbose )
705 printf( "%s\n", pDsd0 );
706 
707  // perform substitutions
709  Dau_DsdMergeSubstitute( pS, pDsd1, pMatches1, pStatus1 );
710  strcpy( pDsd1, pS->pOutput );
711 if ( fVerbose )
712 printf( "%s\n", pDsd1 );
713 if ( fVerbose )
715 
716  // create new function
717 // assert( nVarsTotal <= 6 );
718  sprintf( pS->pOutput, "(%s%s)", pDsd0, pDsd1 );
719  pTruth = Dau_DsdToTruth( pS->pOutput, nVarsTotal );
720  Status = Dau_DsdDecompose( pTruth, nVarsTotal, 0, 1, pS->pOutput );
721 //printf( "%d ", Status );
722  if ( Status == -1 ) // did not find 1-step DSD
723  return NULL;
724 // if ( Status > 6 ) // non-DSD part is too large
725 // return NULL;
726  if ( Dau_DsdIsConst(pS->pOutput) )
727  {
728  strcpy( pRes, pS->pOutput );
729  return pRes;
730  }
731 if ( fVerbose )
732 printf( "Decomposition:\n" );
733 if ( fVerbose )
734 printf( "%s\n", pS->pOutput );
735  // substitute definitions
736  Dau_DsdMergeMatches( pS->pOutput, pMatches );
737  Dau_DsdMergeInlineDefinitions( pS->pOutput, pMatches, pS, pRes, nVarsShared );
738 if ( fVerbose )
739 printf( "Inlining:\n" );
740 if ( fVerbose )
741 printf( "%s\n", pRes );
742  // perform variable replacement
743  Dau_DsdMergeMatches( pRes, pMatches );
744  Dau_DsdMergeReplace( pRes, pMatches, pNew2Old );
745  Dau_DsdRemoveBraces( pRes, pMatches );
746 if ( fVerbose )
747 printf( "Replaced:\n" );
748 if ( fVerbose )
749 printf( "%s\n", pRes );
750  Dau_DsdNormalize( pRes );
751 if ( fVerbose )
752 printf( "Normalized:\n" );
753 if ( fVerbose )
754 printf( "%s\n", pRes );
755 
756  if ( fCheck )
757  {
758  pt = Dau_DsdToTruth( pRes, nVars );
759  if ( !Abc_TtEqual( pParts[2], pt, Abc_TtWordNum(nVars) ) )
760  printf( "Dau_DsdMerge(): Verification failed!\n" );
761  }
762 
763  if ( Status == 0 )
764  s_TimeComp[1] += Abc_Clock() - clk;
765  else
766  s_TimeComp[2] += Abc_Clock() - clk;
767  return pRes;
768 }
static int Dau_DsdMergeFindShared(char *pDsd0, char *pDsd1, int *pMatches0, int *pMatches1, int *pVarPres)
Definition: dauMerge.c:204
static void Dau_DsdMergeStoreClean(Dau_Sto_t *pS, int nShared)
Definition: dauMerge.c:57
void Dau_DsdRemoveBraces(char *pDsd, int *pMatches)
Definition: dauMerge.c:554
static void Dau_DsdMergeSubstitute(Dau_Sto_t *pS, char *pDsd, int *pMatches, int *pStatus)
Definition: dauMerge.c:494
static void Dau_DsdMergePrintWithStatus(char *p, int *pStatus)
Definition: dauMerge.c:276
typedefABC_NAMESPACE_IMPL_START struct Dau_Sto_t_ Dau_Sto_t
DECLARATIONS ///.
Definition: dauMerge.c:47
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition: dauDsd.c:1912
word * Dau_DsdToTruth(char *p, int nVars)
Definition: dauDsd.c:609
static void Dau_DsdMergeStorePrintDefs(Dau_Sto_t *pS)
Definition: dauMerge.c:107
static int Dau_DsdIsConst(char *p)
MACRO DEFINITIONS ///.
Definition: dau.h:67
static abctime Abc_Clock()
Definition: abc_global.h:279
static void Dau_DsdMergeInlineDefinitions(char *pDsd, int *pMatches, Dau_Sto_t *pS, char *pRes, int nShared)
Definition: dauMerge.c:232
static void Dau_DsdMergeStoreCleanOutput(Dau_Sto_t *pS)
Definition: dauMerge.c:65
static int Dau_DsdMergeCreateMaps(int *pVarPres, int nShared, int *pOld2New, int *pNew2Old)
Definition: dauMerge.c:211
#define DAU_MAX_STR
Definition: dau.h:43
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
void Dau_DsdNormalize(char *p)
Definition: dauDsd.c:260
#define DAU_MAX_VAR
INCLUDES ///.
Definition: dau.h:42
static void Dau_DsdMergeReplace(char *pDsd, int *pMatches, int *pMap)
Definition: dauMerge.c:147
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
char * sprintf()
static int Counter
char * strcpy()
#define DAU_MAX_WORD
Definition: dau.h:44
static int Dau_DsdIsConst1(char *p)
Definition: dau.h:69
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static void Dau_DsdMergeMatches(char *pDsd, int *pMatches)
Definition: dauMerge.c:163
static int Abc_TtEqual(word *pIn1, word *pIn2, int nWords)
Definition: utilTruth.h:269
static void Dau_DsdMergeCopy(char *pDsd, int fCompl, char *pRes)
Definition: dauMerge.c:126
abctime s_TimeComp[4]
Definition: dauMerge.c:574
#define assert(ex)
Definition: util_old.h:213
static int Dau_DsdMergeStatus(char *pDsd, int *pMatches, int nShared, int *pStatus)
Definition: dauMerge.c:346
static int Dau_DsdIsConst0(char *p)
Definition: dau.h:68
static void Abc_TtAnd(word *pOut, word *pIn1, word *pIn2, int nWords, int fCompl)
Definition: utilTruth.h:231
ABC_INT64_T abctime
Definition: abc_global.h:278
static shot S[256]
Definition: kitPerm.c:40
void Dau_DsdNormalize ( char *  p)

Definition at line 260 of file dauDsd.c.

261 {
262  if ( pDsd[1] != 0 )
263  Dau_DsdNormalize_rec( pDsd, &pDsd, Dau_DsdComputeMatches(pDsd) );
264 }
void Dau_DsdNormalize_rec(char *pStr, char **p, int *pMatches)
Definition: dauDsd.c:205
int * Dau_DsdComputeMatches(char *p)
Definition: dauDsd.c:80
void Dau_DsdPrintFromTruth ( word pTruth,
int  nVarsInit 
)

Definition at line 1968 of file dauDsd.c.

1969 {
1970  char pRes[DAU_MAX_STR];
1971  word pTemp[DAU_MAX_WORD];
1972  Abc_TtCopy( pTemp, pTruth, Abc_TtWordNum(nVarsInit), 0 );
1973  Dau_DsdDecompose( pTemp, nVarsInit, 0, 1, pRes );
1974  fprintf( stdout, "%s\n", pRes );
1975 }
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition: dauDsd.c:1912
#define DAU_MAX_STR
Definition: dau.h:43
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define DAU_MAX_WORD
Definition: dau.h:44
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
void Dau_DsdPrintFromTruthFile ( FILE *  pFile,
word pTruth,
int  nVarsInit 
)

Definition at line 1960 of file dauDsd.c.

1961 {
1962  char pRes[DAU_MAX_STR];
1963  word pTemp[DAU_MAX_WORD];
1964  Abc_TtCopy( pTemp, pTruth, Abc_TtWordNum(nVarsInit), 0 );
1965  Dau_DsdDecompose( pTemp, nVarsInit, 0, 1, pRes );
1966  fprintf( pFile, "%s\n", pRes );
1967 }
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition: dauDsd.c:1912
#define DAU_MAX_STR
Definition: dau.h:43
static void Abc_TtCopy(word *pOut, word *pIn, int nWords, int fCompl)
Definition: utilTruth.h:221
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
#define DAU_MAX_WORD
Definition: dau.h:44
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static int Dau_DsdReadVar ( char *  p)
inlinestatic

Definition at line 71 of file dau.h.

71 { if ( *p == '!' ) p++; return *p - 'a'; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Dau_DsdRemoveBraces ( char *  pDsd,
int *  pMatches 
)

Definition at line 554 of file dauMerge.c.

555 {
556  char * q, * p = pDsd;
557  if ( pDsd[1] == 0 )
558  return;
559  Dau_DsdRemoveBraces_rec( pDsd, &pDsd, pMatches );
560  for ( q = p; *p; p++ )
561  if ( *p != ' ' )
562  {
563  if ( *p == '!' && *(q-1) == '!' && p != q )
564  {
565  q--;
566  continue;
567  }
568  *q++ = *p;
569  }
570  *q = 0;
571 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Dau_DsdRemoveBraces_rec(char *pStr, char **p, int *pMatches)
Definition: dauMerge.c:520
word* Dau_DsdToTruth ( char *  p,
int  nVars 
)

Definition at line 609 of file dauDsd.c.

610 {
611  int nWords = Abc_TtWordNum( nVars );
612  word ** pTtElems = Dau_DsdTtElems();
613  word * pRes = pTtElems[DAU_MAX_VAR];
614  assert( nVars <= DAU_MAX_VAR );
615  if ( Dau_DsdIsConst0(p) )
616  Abc_TtConst0( pRes, nWords );
617  else if ( Dau_DsdIsConst1(p) )
618  Abc_TtConst1( pRes, nWords );
619  else
620  Dau_DsdToTruth_rec( p, &p, Dau_DsdComputeMatches(p), pTtElems, pRes, nVars );
621  assert( *++p == 0 );
622  return pRes;
623 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nWords
Definition: abcNpn.c:127
static void Abc_TtConst1(word *pIn1, int nWords)
Definition: utilTruth.h:315
#define DAU_MAX_VAR
INCLUDES ///.
Definition: dau.h:42
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static ABC_NAMESPACE_IMPL_START word ** Dau_DsdTtElems()
DECLARATIONS ///.
Definition: dauDsd.c:56
static int Dau_DsdIsConst1(char *p)
Definition: dau.h:69
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static void Abc_TtConst0(word *pIn1, int nWords)
Definition: utilTruth.h:309
void Dau_DsdToTruth_rec(char *pStr, char **p, int *pMatches, word **pTtElems, word *pRes, int nVars)
Definition: dauDsd.c:535
#define assert(ex)
Definition: util_old.h:213
static int Dau_DsdIsConst0(char *p)
Definition: dau.h:68
int * Dau_DsdComputeMatches(char *p)
Definition: dauDsd.c:80
void Dau_DsdTruthCompose_rec ( word pFunc,
word  pFanins[DAU_MAX_VAR][DAU_MAX_WORD],
word pRes,
int  nVars,
int  nWordsR 
)

Definition at line 501 of file dauDsd.c.

502 {
503  int nWordsF;
504  if ( nVars <= 6 )
505  {
506  Dau_DsdTruth6Compose_rec( pFunc[0], pFanins, pRes, nVars, nWordsR );
507  return;
508  }
509  nWordsF = Abc_TtWordNum( nVars );
510  assert( nWordsF > 1 );
511  if ( Abc_TtIsConst0(pFunc, nWordsF) )
512  {
513  Abc_TtConst0( pRes, nWordsR );
514  return;
515  }
516  if ( Abc_TtIsConst1(pFunc, nWordsF) )
517  {
518  Abc_TtConst1( pRes, nWordsR );
519  return;
520  }
521  if ( !Abc_TtHasVar( pFunc, nVars, nVars-1 ) )
522  {
523  Dau_DsdTruthCompose_rec( pFunc, pFanins, pRes, nVars-1, nWordsR );
524  return;
525  }
526  {
527  word pTtTemp[2][DAU_MAX_WORD];
528  nVars--;
529  Dau_DsdTruthCompose_rec( pFunc, pFanins, pTtTemp[0], nVars, nWordsR );
530  Dau_DsdTruthCompose_rec( pFunc + nWordsF/2, pFanins, pTtTemp[1], nVars, nWordsR );
531  Abc_TtMux( pRes, pFanins[nVars], pTtTemp[1], pTtTemp[0], nWordsR );
532  return;
533  }
534 }
static int Abc_TtIsConst0(word *pIn1, int nWords)
Definition: utilTruth.h:293
void Dau_DsdTruth6Compose_rec(word Func, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word *pRes, int nVars, int nWordsR)
Definition: dauDsd.c:469
static void Abc_TtConst1(word *pIn1, int nWords)
Definition: utilTruth.h:315
static int Abc_TtIsConst1(word *pIn1, int nWords)
Definition: utilTruth.h:301
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Abc_TtHasVar(word *t, int nVars, int iVar)
Definition: utilTruth.h:953
#define DAU_MAX_WORD
Definition: dau.h:44
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static void Abc_TtMux(word *pOut, word *pCtrl, word *pIn1, word *pIn0, int nWords)
Definition: utilTruth.h:263
static void Abc_TtConst0(word *pIn1, int nWords)
Definition: utilTruth.h:309
void Dau_DsdTruthCompose_rec(word *pFunc, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word *pRes, int nVars, int nWordsR)
Definition: dauDsd.c:501
#define assert(ex)
Definition: util_old.h:213
void* Dsm_ManDeriveGia ( void *  pGia,
int  fUseMuxes 
)

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

Synopsis [Performs structural hashing on the LUT functions.]

Description []

SideEffects []

SeeAlso []

Definition at line 471 of file dauGia.c.

472 {
473  Gia_Man_t * p = (Gia_Man_t *)pGia;
474  Gia_Man_t * pNew, * pTemp;
475  Vec_Int_t * vCover, * vLeaves;
476  Gia_Obj_t * pObj;
477  int k, i, iLut, iVar;
478  word * pTruth;
479  assert( Gia_ManHasMapping(p) );
480  // create new manager
481  pNew = Gia_ManStart( 6*Gia_ManObjNum(p)/5 + 100 );
482  pNew->pName = Abc_UtilStrsav( p->pName );
483  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
484  pNew->vLevels = Vec_IntStart( 6*Gia_ManObjNum(p)/5 + 100 );
485  if ( fUseMuxes )
486  pNew->pMuxes = ABC_CALLOC( unsigned, pNew->nObjsAlloc );
487  // map primary inputs
488  Gia_ManFillValue(p);
489  Gia_ManConst0(p)->Value = 0;
490  Gia_ManForEachCi( p, pObj, i )
491  pObj->Value = Gia_ManAppendCi(pNew);
492  // iterate through nodes used in the mapping
493  vLeaves = Vec_IntAlloc( 16 );
494  vCover = Vec_IntAlloc( 1 << 16 );
495  Gia_ManHashStart( pNew );
497  Gia_ManForEachAnd( p, pObj, iLut )
498  {
499  if ( Gia_ObjIsBuf(pObj) )
500  {
501  pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
502  continue;
503  }
504  if ( !Gia_ObjIsLut(p, iLut) )
505  continue;
506  // collect leaves
507  Vec_IntClear( vLeaves );
508  Gia_LutForEachFanin( p, iLut, iVar, k )
509  Vec_IntPush( vLeaves, iVar );
510  pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, iLut), vLeaves );
511  // collect incoming literals
512  Vec_IntClear( vLeaves );
513  Gia_LutForEachFanin( p, iLut, iVar, k )
514  Vec_IntPush( vLeaves, Gia_ManObj(p, iVar)->Value );
515  Gia_ManObj(p, iLut)->Value = Dsm_ManTruthToGia( pNew, pTruth, vLeaves, vCover );
516  }
518  Gia_ManForEachCo( p, pObj, i )
519  pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
520  Gia_ManHashStop( pNew );
521  Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
522  Vec_IntFree( vLeaves );
523  Vec_IntFree( vCover );
524 /*
525  Gia_ManForEachAnd( pNew, pObj, i )
526  {
527  int iLev = Gia_ObjLevelId(pNew, i);
528  int iLev0 = Gia_ObjLevelId(pNew, Gia_ObjFaninId0(pObj, i));
529  int iLev1 = Gia_ObjLevelId(pNew, Gia_ObjFaninId1(pObj, i));
530  assert( iLev == 1 + Abc_MaxInt(iLev0, iLev1) );
531  }
532 */
533  // perform cleanup
534  pNew = Gia_ManCleanup( pTemp = pNew );
535  Gia_ManStop( pTemp );
536  return pNew;
537 }
int nObjsAlloc
Definition: gia.h:102
void Gia_ManStop(Gia_Man_t *p)
Definition: giaMan.c:77
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition: giaTruth.c:282
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition: giaTruth.c:351
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition: giaTruth.c:293
unsigned * pMuxes
Definition: gia.h:104
static int Gia_ObjIsBuf(Gia_Obj_t *pObj)
Definition: gia.h:427
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition: giaMan.c:628
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
int Dsm_ManTruthToGia(void *p, word *pTruth, Vec_Int_t *vLeaves, Vec_Int_t *vCover)
Definition: dauGia.c:415
#define Gia_ManForEachCi(p, pObj, i)
Definition: gia.h:1016
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ManAppendBuf(Gia_Man_t *p, int iLit)
Definition: gia.h:694
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
void Gia_ManHashStart(Gia_Man_t *p)
Definition: giaHash.c:117
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
#define Gia_ManForEachAnd(p, pObj, i)
Definition: gia.h:1002
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void Gia_ManFillValue(Gia_Man_t *p)
Definition: giaUtil.c:328
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static int Gia_ObjFanin0Copy(Gia_Obj_t *pObj)
Definition: gia.h:481
static int Gia_ManHasMapping(Gia_Man_t *p)
Definition: gia.h:951
Definition: gia.h:95
static Gia_Obj_t * Gia_ManConst0(Gia_Man_t *p)
Definition: gia.h:400
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: gia.h:87
Vec_Int_t * vLevels
Definition: gia.h:115
static int Gia_ObjIsLut(Gia_Man_t *p, int Id)
Definition: gia.h:952
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition: giaScl.c:84
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
void Gia_ManHashStop(Gia_Man_t *p)
Definition: giaHash.c:142
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387
int Dsm_ManTruthToGia ( void *  p,
word pTruth,
Vec_Int_t vLeaves,
Vec_Int_t vCover 
)

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

Synopsis [Convert TT to GIA via DSD.]

Description []

SideEffects []

SeeAlso []

Definition at line 415 of file dauGia.c.

416 {
417  int fUseMuxes = 0;
418  int fDelayBalance = 1;
419  Gia_Man_t * pGia = (Gia_Man_t *)p;
420  int nSizeNonDec;
421  char pDsd[1000];
422  m_Calls++;
423  assert( Vec_IntSize(vLeaves) <= DAU_DSD_MAX_VAR );
424  // collect delay information
425  if ( fDelayBalance && fUseMuxes )
426  {
427  int i, iLit, pVarLevels[DAU_DSD_MAX_VAR];
428  Vec_IntForEachEntry( vLeaves, iLit, i )
429  pVarLevels[i] = Gia_ObjLevelId( pGia, Abc_Lit2Var(iLit) );
430  nSizeNonDec = Dau_DsdDecomposeLevel( pTruth, Vec_IntSize(vLeaves), fUseMuxes, 1, pDsd, pVarLevels );
431  }
432  else
433  nSizeNonDec = Dau_DsdDecompose( pTruth, Vec_IntSize(vLeaves), fUseMuxes, 1, pDsd );
434  if ( nSizeNonDec )
435  m_NonDsd++;
436 // printf( "%s\n", pDsd );
437  if ( fDelayBalance )
438  return Dau_DsdToGia( pGia, pDsd, Vec_IntArray(vLeaves), vCover );
439  else
440  return Dau_DsdToGia2( pGia, pDsd, Vec_IntArray(vLeaves), vCover );
441 }
static int Gia_ObjLevelId(Gia_Man_t *p, int Id)
Definition: gia.h:500
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define DAU_DSD_MAX_VAR
Definition: dauGia.c:33
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition: dauDsd.c:1912
int Dau_DsdDecomposeLevel(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes, int *pVarLevels)
Definition: dauDsd.c:1936
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
static int m_NonDsd
Definition: dauGia.c:36
int Dau_DsdToGia(Gia_Man_t *pGia, char *p, int *pLits, Vec_Int_t *vCover)
Definition: dauGia.c:391
int Dau_DsdToGia2(Gia_Man_t *pGia, char *p, int *pLits, Vec_Int_t *vCover)
Definition: dauGia.c:195
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Definition: gia.h:95
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
#define assert(ex)
Definition: util_old.h:213
static int m_Calls
Definition: dauGia.c:35
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
Dss_Man_t* Dss_ManAlloc ( int  nVars,
int  nNonDecLimit 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 967 of file dauTree.c.

968 {
969  Dss_Man_t * p;
970  p = ABC_CALLOC( Dss_Man_t, 1 );
971  p->nVars = nVars;
972  p->nNonDecLimit = nNonDecLimit;
973  p->nBins = Abc_PrimeCudd( 1000000 );
974  p->pBins = ABC_CALLOC( unsigned, p->nBins );
975  p->pMem = Mem_FlexStart();
976  p->vObjs = Vec_PtrAlloc( 10000 );
977  p->vNexts = Vec_IntAlloc( 10000 );
978  Dss_ObjAlloc( p, DAU_DSD_CONST0, 0, 0 );
979  Dss_ObjAlloc( p, DAU_DSD_VAR, 0, 0 )->nSupp = 1;
980  p->vLeaves = Vec_IntAlloc( 32 );
981  p->vCopies = Vec_IntAlloc( 32 );
982  p->pTtElems = Dss_ManTtElems();
983  p->pMemEnts = Mem_FlexStart();
984 // Dss_ManCacheAlloc( p );
985  return p;
986 }
Vec_Int_t * vNexts
Definition: dauTree.c:84
static int Abc_PrimeCudd(unsigned int p)
Definition: abc_global.h:383
Vec_Int_t * vLeaves
Definition: dauTree.c:85
word ** pTtElems
Definition: dauTree.c:87
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nVars
Definition: dauTree.c:78
Dss_Obj_t * Dss_ObjAlloc(Dss_Man_t *p, int Type, int nFans, int nTruthVars)
Definition: dauTree.c:760
Vec_Ptr_t * vObjs
Definition: dauTree.c:83
Mem_Flex_t * pMem
Definition: dauTree.c:82
unsigned nSupp
Definition: dauTree.c:56
Mem_Flex_t * Mem_FlexStart()
Definition: mem.c:311
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int nBins
Definition: dauTree.c:80
int nNonDecLimit
Definition: dauTree.c:79
Vec_Int_t * vCopies
Definition: dauTree.c:86
static word ** Dss_ManTtElems()
FUNCTION DEFINITIONS ///.
Definition: dauTree.c:401
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
unsigned * pBins
Definition: dauTree.c:81
Mem_Flex_t * pMemEnts
Definition: dauTree.c:90
void Dss_ManFree ( Dss_Man_t p)

Definition at line 987 of file dauTree.c.

988 {
989  Abc_PrintTime( 1, "Time begin ", p->timeBeg );
990  Abc_PrintTime( 1, "Time decomp", p->timeDec );
991  Abc_PrintTime( 1, "Time lookup", p->timeLook );
992  Abc_PrintTime( 1, "Time end ", p->timeEnd );
993 
994 // Dss_ManCacheProfile( p );
995  Dss_ManCacheFree( p );
996  Mem_FlexStop( p->pMemEnts, 0 );
997  Vec_IntFreeP( &p->vCopies );
998  Vec_IntFreeP( &p->vLeaves );
999  Vec_IntFreeP( &p->vNexts );
1000  Vec_PtrFreeP( &p->vObjs );
1001  Mem_FlexStop( p->pMem, 0 );
1002  ABC_FREE( p->pBins );
1003  ABC_FREE( p );
1004 }
Vec_Int_t * vNexts
Definition: dauTree.c:84
Vec_Int_t * vLeaves
Definition: dauTree.c:85
abctime timeLook
Definition: dauTree.c:96
Vec_Ptr_t * vObjs
Definition: dauTree.c:83
abctime timeEnd
Definition: dauTree.c:97
Mem_Flex_t * pMem
Definition: dauTree.c:82
abctime timeDec
Definition: dauTree.c:95
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
Vec_Int_t * vCopies
Definition: dauTree.c:86
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition: mem.c:343
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Dss_ManCacheFree(Dss_Man_t *p)
Definition: dauTree.c:896
static void Vec_PtrFreeP(Vec_Ptr_t **p)
Definition: vecPtr.h:240
abctime timeBeg
Definition: dauTree.c:94
unsigned * pBins
Definition: dauTree.c:81
Mem_Flex_t * pMemEnts
Definition: dauTree.c:90
int Dss_ManMerge ( Dss_Man_t p,
int *  iDsd,
int *  nFans,
int **  pFans,
unsigned  uSharedMask,
int  nKLutSize,
unsigned char *  pPerm,
word pTruth 
)

Definition at line 1539 of file dauTree.c.

1540 {
1541  int fVerbose = 0;
1542  int fCheck = 0;
1543  static int Counter = 0;
1544 // word pTtTemp[DAU_MAX_WORD];
1545  word * pTruthOne;
1546  int pPermResInt[DAU_MAX_VAR];
1547  Dss_Ent_t * pEnt, ** ppSpot;
1548  Dss_Fun_t * pFun;
1549  int i;
1550  abctime clk;
1551  Counter++;
1552  if ( DAU_MAX_VAR < nKLutSize )
1553  {
1554  printf( "Paramater DAU_MAX_VAR (%d) smaller than LUT size (%d).\n", DAU_MAX_VAR, nKLutSize );
1555  return -1;
1556  }
1557  assert( iDsd[0] <= iDsd[1] );
1558 
1559 if ( fVerbose )
1560 {
1561 Dss_ManPrintOne( stdout, p, iDsd[0], pFans[0] );
1562 Dss_ManPrintOne( stdout, p, iDsd[1], pFans[1] );
1563 }
1564 
1565  // constant argument
1566  if ( iDsd[0] == 0 ) return 0;
1567  if ( iDsd[0] == 1 ) return iDsd[1];
1568  if ( iDsd[1] == 0 ) return 0;
1569  if ( iDsd[1] == 1 ) return iDsd[0];
1570 
1571  // no overlap
1572 clk = Abc_Clock();
1573  assert( nFans[0] == Dss_VecLitSuppSize(p->vObjs, iDsd[0]) );
1574  assert( nFans[1] == Dss_VecLitSuppSize(p->vObjs, iDsd[1]) );
1575  assert( nFans[0] + nFans[1] <= nKLutSize + Dss_WordCountOnes(uSharedMask) );
1576  // create map of shared variables
1577  pEnt = Dss_ManSharedMap( p, iDsd, nFans, pFans, uSharedMask );
1578 p->timeBeg += Abc_Clock() - clk;
1579  // check cache
1580  if ( p->pCache == NULL )
1581  {
1582 clk = Abc_Clock();
1583  if ( uSharedMask == 0 )
1584  pFun = Dss_ManOperationFun( p, iDsd, nFans[0] + nFans[1] );
1585  else
1586  pFun = Dss_ManBooleanAnd( p, pEnt, 0 );
1587  if ( pFun == NULL )
1588  return -1;
1589  assert( (int)pFun->nFans == Dss_VecLitSuppSize(p->vObjs, pFun->iDsd) );
1590  assert( (int)pFun->nFans <= nKLutSize );
1591 p->timeDec += Abc_Clock() - clk;
1592  }
1593  else
1594  {
1595 clk = Abc_Clock();
1596  ppSpot = Dss_ManCacheLookup( p, pEnt );
1597 p->timeLook += Abc_Clock() - clk;
1598 clk = Abc_Clock();
1599  if ( *ppSpot == NULL )
1600  {
1601  if ( uSharedMask == 0 )
1602  pFun = Dss_ManOperationFun( p, iDsd, nFans[0] + nFans[1] );
1603  else
1604  pFun = Dss_ManBooleanAnd( p, pEnt, 0 );
1605  if ( pFun == NULL )
1606  return -1;
1607  assert( (int)pFun->nFans == Dss_VecLitSuppSize(p->vObjs, pFun->iDsd) );
1608  assert( (int)pFun->nFans <= nKLutSize );
1609  // create cache entry
1610  *ppSpot = Dss_ManCacheCreate( p, pEnt, pFun );
1611  }
1612  pFun = (*ppSpot)->pFunc;
1613 p->timeDec += Abc_Clock() - clk;
1614  }
1615 
1616 clk = Abc_Clock();
1617  for ( i = 0; i < (int)pFun->nFans; i++ )
1618  if ( pFun->pFans[i] < 2 * nFans[0] ) // first dec
1619  pPermRes[i] = (unsigned char)Dss_Lit2Lit( pFans[0], pFun->pFans[i] );
1620  else
1621  pPermRes[i] = (unsigned char)Dss_Lit2Lit( pFans[1], pFun->pFans[i] - 2 * nFans[0] );
1622  // perform support minimization
1623  if ( uSharedMask && pFun->nFans > 1 )
1624  {
1625  int pVarPres[DAU_MAX_VAR];
1626  int nSupp = 0;
1627  for ( i = 0; i < p->nVars; i++ )
1628  pVarPres[i] = -1;
1629  for ( i = 0; i < (int)pFun->nFans; i++ )
1630  pVarPres[ Abc_Lit2Var(pPermRes[i]) ] = i;
1631  for ( i = 0; i < p->nVars; i++ )
1632  if ( pVarPres[i] >= 0 )
1633  pPermRes[pVarPres[i]] = Abc_Var2Lit( nSupp++, Abc_LitIsCompl(pPermRes[pVarPres[i]]) );
1634  assert( nSupp == (int)pFun->nFans );
1635  }
1636 
1637  for ( i = 0; i < (int)pFun->nFans; i++ )
1638  pPermResInt[i] = pPermRes[i];
1639 p->timeEnd += Abc_Clock() - clk;
1640 
1641 if ( fVerbose )
1642 {
1643 Dss_ManPrintOne( stdout, p, pFun->iDsd, pPermResInt );
1644 printf( "\n" );
1645 }
1646 
1647 if ( Counter == 43418 )
1648 {
1649 // int s = 0;
1650 // Dss_ManPrint( NULL, p );
1651 }
1652 
1653 
1654  if ( fCheck )
1655  {
1656  pTruthOne = Dss_ManComputeTruth( p, pFun->iDsd, p->nVars, pPermResInt );
1657  if ( !Abc_TtEqual( pTruthOne, pTruth, Abc_TtWordNum(p->nVars) ) )
1658  {
1659  int s;
1660  // Kit_DsdPrintFromTruth( pTruthOne, p->nVars ); printf( "\n" );
1661  // Kit_DsdPrintFromTruth( pTruth, p->nVars ); printf( "\n" );
1662  printf( "Verification failed.\n" );
1663  s = 0;
1664  }
1665  }
1666  return pFun->iDsd;
1667 }
Dss_Fun_t * Dss_ManBooleanAnd(Dss_Man_t *p, Dss_Ent_t *pEnt, int Counter)
Definition: dauTree.c:1433
word * Dss_ManComputeTruth(Dss_Man_t *p, int iDsd, int nVars, int *pPermLits)
Definition: dauTree.c:1192
abctime timeLook
Definition: dauTree.c:96
int nVars
Definition: dauTree.c:78
Vec_Ptr_t * vObjs
Definition: dauTree.c:83
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static abctime Abc_Clock()
Definition: abc_global.h:279
abctime timeEnd
Definition: dauTree.c:97
void Dss_ManPrintOne(FILE *pFile, Dss_Man_t *p, int iDsdLit, int *pPermLits)
Definition: dauTree.c:1030
abctime timeDec
Definition: dauTree.c:95
static int Dss_Lit2Lit(int *pMapLit, int Lit)
Definition: dauTree.c:148
Dss_Ent_t * Dss_ManSharedMap(Dss_Man_t *p, int *iDsd, int *nFans, int **pFans, unsigned uSharedMask)
Definition: dauTree.c:1510
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
#define DAU_MAX_VAR
INCLUDES ///.
Definition: dau.h:42
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Dss_Ent_t ** Dss_ManCacheLookup(Dss_Man_t *p, Dss_Ent_t *pEnt)
Definition: dauTree.c:927
Dss_Ent_t ** pCache
Definition: dauTree.c:88
static int Counter
Dss_Ent_t * Dss_ManCacheCreate(Dss_Man_t *p, Dss_Ent_t *pEnt0, Dss_Fun_t *pFun0)
Definition: dauTree.c:944
typedefABC_NAMESPACE_IMPL_START struct Dss_Fun_t_ Dss_Fun_t
DECLARATIONS ///.
Definition: dauTree.c:31
static int Dss_VecLitSuppSize(Vec_Ptr_t *p, int iLit)
Definition: dauTree.c:120
static int Dss_WordCountOnes(unsigned uWord)
Definition: dauTree.c:139
static int Abc_TtWordNum(int nVars)
Definition: utilTruth.h:169
static int Abc_TtEqual(word *pIn1, word *pIn2, int nWords)
Definition: utilTruth.h:269
Dss_Fun_t * Dss_ManOperationFun(Dss_Man_t *p, int *iDsd, int nFansTot)
Definition: dauTree.c:1389
static int Abc_Lit2Var(int Lit)
Definition: abc_global.h:264
abctime timeBeg
Definition: dauTree.c:94
#define assert(ex)
Definition: util_old.h:213
ABC_INT64_T abctime
Definition: abc_global.h:278
void Dss_ManPrint ( char *  pFileName,
Dss_Man_t p 
)

Definition at line 1086 of file dauTree.c.

1087 {
1088  Dss_Obj_t * pObj;
1089  int CountNonDsd = 0, CountNonDsdStr = 0;
1090  int i, clk = Abc_Clock();
1091  FILE * pFile;
1092  pFile = pFileName ? fopen( pFileName, "wb" ) : stdout;
1093  if ( pFileName && pFile == NULL )
1094  {
1095  printf( "cannot open output file\n" );
1096  return;
1097  }
1098  Dss_VecForEachObj( p->vObjs, pObj, i )
1099  {
1100  CountNonDsd += (pObj->Type == DAU_DSD_PRIME);
1101  CountNonDsdStr += Dss_ManCheckNonDec_rec( p, pObj );
1102  }
1103  fprintf( pFile, "Total number of objects = %8d\n", Vec_PtrSize(p->vObjs) );
1104  fprintf( pFile, "Non-DSD objects (max =%2d) = %8d\n", p->nNonDecLimit, CountNonDsd );
1105  fprintf( pFile, "Non-DSD structures = %8d\n", CountNonDsdStr );
1106  fprintf( pFile, "Memory used for objects = %6.2f MB.\n", 1.0*Mem_FlexReadMemUsage(p->pMem)/(1<<20) );
1107  fprintf( pFile, "Memory used for array = %6.2f MB.\n", 1.0*sizeof(void *)*Vec_PtrCap(p->vObjs)/(1<<20) );
1108  fprintf( pFile, "Memory used for hash table = %6.2f MB.\n", 1.0*sizeof(int)*p->nBins/(1<<20) );
1109  fprintf( pFile, "Memory used for cache = %6.2f MB.\n", 1.0*Mem_FlexReadMemUsage(p->pMemEnts)/(1<<20) );
1110  fprintf( pFile, "Cache hits = %8d %8d\n", p->nCacheHits[0], p->nCacheHits[1] );
1111  fprintf( pFile, "Cache misses = %8d %8d\n", p->nCacheMisses[0], p->nCacheMisses[1] );
1112  fprintf( pFile, "Cache entries = %8d %8d\n", p->nCacheEntries[0], p->nCacheEntries[1] );
1113  Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1114 // Dss_ManHashProfile( p );
1115 // Dss_ManDump( p );
1116 // return;
1117  Dss_VecForEachObj( p->vObjs, pObj, i )
1118  {
1119  if ( i == 50 )
1120  break;
1121  Dss_ManPrintOne( pFile, p, Dss_Obj2Lit(pObj), NULL );
1122  }
1123  fprintf( pFile, "\n" );
1124  if ( pFileName )
1125  fclose( pFile );
1126 }
int Dss_ManCheckNonDec_rec(Dss_Man_t *p, Dss_Obj_t *pObj)
Definition: dauTree.c:1040
Vec_Ptr_t * vObjs
Definition: dauTree.c:83
int nCacheEntries[2]
Definition: dauTree.c:93
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Dss_ManPrintOne(FILE *pFile, Dss_Man_t *p, int iDsdLit, int *pPermLits)
Definition: dauTree.c:1030
unsigned Type
Definition: dauTree.c:55
Mem_Flex_t * pMem
Definition: dauTree.c:82
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
int nBins
Definition: dauTree.c:80
int nNonDecLimit
Definition: dauTree.c:79
static int Vec_PtrCap(Vec_Ptr_t *p)
Definition: vecPtr.h:311
int nCacheHits[2]
Definition: dauTree.c:91
int Mem_FlexReadMemUsage(Mem_Flex_t *p)
Definition: mem.c:445
static int Dss_Obj2Lit(Dss_Obj_t *pObj)
Definition: dauTree.c:122
int nCacheMisses[2]
Definition: dauTree.c:92
#define Dss_VecForEachObj(vVec, pObj, i)
Definition: dauTree.c:127
Mem_Flex_t * pMemEnts
Definition: dauTree.c:90