1 /**CFile****************************************************************
2
3 FileName [dau.h]
4
5 SystemName [ABC: Logic synthesis and verification system.]
6
7 PackageName [DAG-aware unmapping.]
8
9 Synopsis [External declarations.]
10
11 Author [Alan Mishchenko]
12
13 Affiliation [UC Berkeley]
14
15 Date [Ver. 1.0. Started - June 20, 2005.]
16
17 Revision [$Id: dau.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18
19 ***********************************************************************/
20
21 #ifndef ABC__DAU___h
22 #define ABC__DAU___h
23
24
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <assert.h>
33 #include <time.h>
34 #include "misc/vec/vec.h"
35
36 ////////////////////////////////////////////////////////////////////////
37 /// PARAMETERS ///
38 ////////////////////////////////////////////////////////////////////////
39
40 ABC_NAMESPACE_HEADER_START
41
42 #define DAU_MAX_VAR 12 // should be 6 or more
43 #define DAU_MAX_STR 2000
44 #define DAU_MAX_WORD (1<<(DAU_MAX_VAR-6))
45
46 ////////////////////////////////////////////////////////////////////////
47 /// BASIC TYPES ///
48 ////////////////////////////////////////////////////////////////////////
49
50 // network types
51 typedef enum {
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
59 } Dau_DsdType_t;
60
61 typedef struct Dss_Man_t_ Dss_Man_t;
62 typedef struct Abc_TtHieMan_t_ Abc_TtHieMan_t;
63 typedef unsigned(*TtCanonicizeFunc)(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag);
64
65 ////////////////////////////////////////////////////////////////////////
66 /// MACRO DEFINITIONS ///
67 ////////////////////////////////////////////////////////////////////////
68
Dau_DsdIsConst(char * p)69 static inline int Dau_DsdIsConst( char * p ) { return (p[0] == '0' || p[0] == '1') && p[1] == 0; }
Dau_DsdIsConst0(char * p)70 static inline int Dau_DsdIsConst0( char * p ) { return p[0] == '0' && p[1] == 0; }
Dau_DsdIsConst1(char * p)71 static inline int Dau_DsdIsConst1( char * p ) { return p[0] == '1' && p[1] == 0; }
Dau_DsdIsVar(char * p)72 static inline int Dau_DsdIsVar( char * p ) { if ( *p == '!' ) p++; return *p >= 'a' && *p <= 'z'; }
Dau_DsdReadVar(char * p)73 static inline int Dau_DsdReadVar( char * p ) { if ( *p == '!' ) p++; return *p - 'a'; }
74
75 ////////////////////////////////////////////////////////////////////////
76 /// FUNCTION DECLARATIONS ///
77 ////////////////////////////////////////////////////////////////////////
78
79 /*=== dauCanon.c ==========================================================*/
80 extern unsigned Abc_TtCanonicize( word * pTruth, int nVars, char * pCanonPerm );
81 extern unsigned Abc_TtCanonicizePerm( word * pTruth, int nVars, char * pCanonPerm );
82 extern unsigned Abc_TtCanonicizePhase( word * pTruth, int nVars );
83 extern int Abc_TtCountOnesInCofsSimple( word * pTruth, int nVars, int * pStore );
84 extern unsigned Abc_TtCanonicizeHie(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int fExact );
85 extern Abc_TtHieMan_t * Abc_TtHieManStart( int nVars, int nLevels );
86 extern void Abc_TtHieManStop(Abc_TtHieMan_t * p );
87 extern unsigned Abc_TtCanonicizeWrap(TtCanonicizeFunc func, Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int flag);
88 extern unsigned Abc_TtCanonicizeAda(Abc_TtHieMan_t * p, word * pTruth, int nVars, char * pCanonPerm, int iThres);
89 extern unsigned Abc_TtCanonicizeHie(Abc_TtHieMan_t * p, word * pTruthInit, int nVars, char * pCanonPerm, int fExact);
90 /*=== dauCount.c ==========================================================*/
91 extern int Abc_TtCountOnesInCofsQuick( word * pTruth, int nVars, int * pStore );
92 /*=== dauDsd.c ==========================================================*/
93 extern int * Dau_DsdComputeMatches( char * p );
94 extern int Dau_DsdDecompose( word * pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char * pRes );
95 extern int Dau_DsdDecomposeLevel( word * pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char * pRes, int * pVarLevels );
96 extern void Dau_DsdPrintFromTruthFile( FILE * pFile, word * pTruth, int nVarsInit );
97 extern void Dau_DsdPrintFromTruth( word * pTruth, int nVarsInit );
98 extern word * Dau_DsdToTruth( char * p, int nVars );
99 extern word Dau_Dsd6ToTruth( char * p );
100 extern void Dau_DsdNormalize( char * p );
101 extern int Dau_DsdCountAnds( char * pDsd );
102 extern void Dau_DsdTruthCompose_rec( word * pFunc, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word * pRes, int nVars, int nWordsR );
103 extern int Dau_DsdCheck1Step( void * p, word * pTruth, int nVarsInit, int * pVarLevels );
104
105 /*=== dauGia.c ==========================================================*/
106 extern int Dsm_ManTruthToGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover );
107 extern void * Dsm_ManDeriveGia( void * p, int fUseMuxes );
108
109 /*=== dauMerge.c ==========================================================*/
110 extern void Dau_DsdRemoveBraces( char * pDsd, int * pMatches );
111 extern char * Dau_DsdMerge( char * pDsd0i, int * pPerm0, char * pDsd1i, int * pPerm1, int fCompl0, int fCompl1, int nVars );
112
113 /*=== dauNonDsd.c ==========================================================*/
114 extern Vec_Int_t * Dau_DecFindSets_int( word * pInit, int nVars, int * pSched[16] );
115 extern Vec_Int_t * Dau_DecFindSets( word * pInit, int nVars );
116 extern void Dau_DecSortSet( unsigned set, int nVars, int * pnUnique, int * pnShared, int * pnFree );
117 extern void Dau_DecPrintSets( Vec_Int_t * vSets, int nVars );
118 extern void Dau_DecPrintSet( unsigned set, int nVars, int fNewLine );
119
120 /*=== dauTree.c ==========================================================*/
121 extern Dss_Man_t * Dss_ManAlloc( int nVars, int nNonDecLimit );
122 extern void Dss_ManFree( Dss_Man_t * p );
123 extern int Dss_ManMerge( Dss_Man_t * p, int * iDsd, int * nFans, int ** pFans, unsigned uSharedMask, int nKLutSize, unsigned char * pPerm, word * pTruth );
124 extern void Dss_ManPrint( char * pFileName, Dss_Man_t * p );
125
126
127 ABC_NAMESPACE_HEADER_END
128
129
130
131 #endif
132
133 ////////////////////////////////////////////////////////////////////////
134 /// END OF FILE ///
135 ////////////////////////////////////////////////////////////////////////
136
137