abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
dauDivs.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [dauDivs.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [DAG-aware unmapping.]
8 
9  Synopsis [Divisor computation.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: dauDivs.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "dauInt.h"
22 #include "misc/util/utilTruth.h"
23 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 
31 ////////////////////////////////////////////////////////////////////////
32 /// FUNCTION DEFINITIONS ///
33 ////////////////////////////////////////////////////////////////////////
34 
35 /**Function*************************************************************
36 
37  Synopsis []
38 
39  Description []
40 
41  SideEffects []
42 
43  SeeAlso []
44 
45 ***********************************************************************/
46 Vec_Int_t * Dau_DsdDivisors( word * pTruth, int nVars )
47 {
48  word Copy[DAU_MAX_WORD];
49  int nWords = Abc_TtWordNum(nVars);
50  int nDigits = Abc_TtHexDigitNum(nVars);
51  int i, j, k, Digit, Counter[5];
52 
53  printf( " " );
54  printf( " !a *!b" );
55  printf( " !a * b" );
56  printf( " a *!b" );
57  printf( " a * b" );
58  printf( " a + b" );
59  printf( "\n" );
60 
61  for ( i = 0; i < nVars; i++ )
62  for ( j = i+1; j < nVars; j++ )
63  {
64  Abc_TtCopy( Copy, pTruth, nWords, 0 );
65  Abc_TtSwapVars( Copy, nVars, 0, i );
66  Abc_TtSwapVars( Copy, nVars, 1, j );
67  for ( k = 0; k < 5; k++ )
68  Counter[k] = 0;
69  for ( k = 0; k < nDigits; k++ )
70  {
71  Digit = Abc_TtGetHex( Copy, k );
72  if ( Digit == 1 || Digit == 14 )
73  Counter[0]++;
74  else if ( Digit == 2 || Digit == 13 )
75  Counter[1]++;
76  else if ( Digit == 4 || Digit == 11 )
77  Counter[2]++;
78  else if ( Digit == 8 || Digit == 7 )
79  Counter[3]++;
80  else if ( Digit == 6 || Digit == 9 )
81  Counter[4]++;
82  }
83  printf( "%c %c ", 'a'+i, 'a'+j );
84  for ( k = 0; k < 5; k++ )
85  printf( "%7d", Counter[k] );
86  printf( "\n" );
87  }
88  return NULL;
89 }
91 {
92 // char * pDsd = "!(!(abc)!(def))";
93 // char * pDsd = "[(abc)(def)]";
94  char * pDsd = "<<abc>d(ef)>";
95  word t = Dau_Dsd6ToTruth( pDsd );
96 // word t = 0xCA88CA88CA88CA88;
97 // word t = 0x9ef7a8d9c7193a0f;
98  int nVars = Abc_TtSupportSize( &t, 6 );
99  return;
100 // word t = 0xCACACACACACACACA;
101  Dau_DsdDivisors( &t, nVars );
102 }
103 
104 
105 ////////////////////////////////////////////////////////////////////////
106 /// END OF FILE ///
107 ////////////////////////////////////////////////////////////////////////
108 
109 
111 
ABC_NAMESPACE_IMPL_START Vec_Int_t * Dau_DsdDivisors(word *pTruth, int nVars)
DECLARATIONS ///.
Definition: dauDivs.c:46
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Abc_TtGetHex(word *p, int k)
Definition: utilTruth.h:154
int nWords
Definition: abcNpn.c:127
word Dau_Dsd6ToTruth(char *p)
Definition: dauDsd.c:445
void Dau_DsdTest000()
Definition: dauDivs.c:90
static int Abc_TtHexDigitNum(int nVars)
Definition: utilTruth.h:171
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 ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
static int Counter
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
#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
static void Abc_TtSwapVars(word *pTruth, int nVars, int iVar, int jVar)
Definition: utilTruth.h:1228