dau.h 5.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
/**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 $]

***********************************************************************/
 
#ifndef ABC__DAU___h
#define ABC__DAU___h


////////////////////////////////////////////////////////////////////////
///                          INCLUDES                                ///
////////////////////////////////////////////////////////////////////////

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include "misc/vec/vec.h"

////////////////////////////////////////////////////////////////////////
///                         PARAMETERS                               ///
////////////////////////////////////////////////////////////////////////

ABC_NAMESPACE_HEADER_START

42
#define DAU_MAX_VAR    12 // should be 6 or more
43
#define DAU_MAX_STR  2000
Alan Mishchenko committed
44
#define DAU_MAX_WORD  (1<<(DAU_MAX_VAR-6))
45 46 47 48 49

////////////////////////////////////////////////////////////////////////
///                         BASIC TYPES                              ///
////////////////////////////////////////////////////////////////////////

Alan Mishchenko committed
50 51 52 53 54 55 56 57 58 59 60 61 62
// network types
typedef enum { 
    DAU_DSD_NONE = 0,      // 0:  unknown
    DAU_DSD_CONST0,        // 1:  constant
    DAU_DSD_VAR,           // 2:  variable
    DAU_DSD_AND,           // 3:  AND
    DAU_DSD_XOR,           // 4:  XOR
    DAU_DSD_MUX,           // 5:  MUX
    DAU_DSD_PRIME          // 6:  PRIME
} Dau_DsdType_t;

typedef struct Dss_Man_t_ Dss_Man_t;

63 64 65 66
////////////////////////////////////////////////////////////////////////
///                      MACRO DEFINITIONS                           ///
////////////////////////////////////////////////////////////////////////

Alan Mishchenko committed
67 68 69 70 71
static inline int Dau_DsdIsConst( char * p )  { return (p[0] == '0' || p[0] == '1') && p[1] == 0;    }
static inline int Dau_DsdIsConst0( char * p ) { return  p[0] == '0' && p[1] == 0;                    }
static inline int Dau_DsdIsConst1( char * p ) { return  p[0] == '1' && p[1] == 0;                    }
static inline int Dau_DsdIsVar( char * p )    { if ( *p == '!' ) p++; return *p >= 'a' && *p <= 'z'; }
static inline int Dau_DsdReadVar( char * p )  { if ( *p == '!' ) p++; return *p - 'a';               }
Alan Mishchenko committed
72

73 74 75 76 77 78
////////////////////////////////////////////////////////////////////////
///                    FUNCTION DECLARATIONS                         ///
////////////////////////////////////////////////////////////////////////

/*=== dauCanon.c ==========================================================*/
extern unsigned      Abc_TtCanonicize( word * pTruth, int nVars, char * pCanonPerm );
79
extern unsigned      Abc_TtCanonicizePhase( word * pTruth, int nVars );
Alan Mishchenko committed
80
/*=== dauDsd.c  ==========================================================*/
81
extern int *         Dau_DsdComputeMatches( char * p );
Alan Mishchenko committed
82
extern int           Dau_DsdDecompose( word * pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char * pRes );
Alan Mishchenko committed
83 84
extern void          Dau_DsdPrintFromTruthFile( FILE * pFile, word * pTruth, int nVarsInit );
extern void          Dau_DsdPrintFromTruth( word * pTruth, int nVarsInit );
Alan Mishchenko committed
85
extern word *        Dau_DsdToTruth( char * p, int nVars );
Alan Mishchenko committed
86 87
extern word          Dau_Dsd6ToTruth( char * p );
extern void          Dau_DsdNormalize( char * p );
Alan Mishchenko committed
88
extern int           Dau_DsdCountAnds( char * pDsd );
Alan Mishchenko committed
89
extern void          Dau_DsdTruthCompose_rec( word * pFunc, word pFanins[DAU_MAX_VAR][DAU_MAX_WORD], word * pRes, int nVars, int nWordsR );
90
extern int           Dau_DsdCheck1Step( word * pTruth, int nVarsInit );
Alan Mishchenko committed
91

92
/*=== dauGia.c  ==========================================================*/
93
extern int           Dsm_ManTruthToGia( void * p, word * pTruth, Vec_Int_t * vLeaves, Vec_Int_t * vCover );
94
extern void *        Dsm_ManDeriveGia( void * p, int fUseMuxes );
95

Alan Mishchenko committed
96 97
/*=== dauMerge.c  ==========================================================*/
extern void          Dau_DsdRemoveBraces( char * pDsd, int * pMatches );
Alan Mishchenko committed
98
extern char *        Dau_DsdMerge( char * pDsd0i, int * pPerm0, char * pDsd1i, int * pPerm1, int fCompl0, int fCompl1, int nVars );
99

100
/*=== dauNonDsd.c  ==========================================================*/
101
extern Vec_Int_t *   Dau_DecFindSets_int( word * pInit, int nVars, int * pSched[16] );
102
extern Vec_Int_t *   Dau_DecFindSets( word * pInit, int nVars );
103
extern void          Dau_DecSortSet( unsigned set, int nVars, int * pnUnique, int * pnShared, int * pnFree );
104 105 106
extern void          Dau_DecPrintSets( Vec_Int_t * vSets, int nVars );
extern void          Dau_DecPrintSet( unsigned set, int nVars, int fNewLine );

Alan Mishchenko committed
107 108
/*=== dauTree.c  ==========================================================*/
extern Dss_Man_t *   Dss_ManAlloc( int nVars, int nNonDecLimit );
Alan Mishchenko committed
109
extern void          Dss_ManFree( Dss_Man_t * p );
Alan Mishchenko committed
110
extern int           Dss_ManMerge( Dss_Man_t * p, int * iDsd, int * nFans, int ** pFans, unsigned uSharedMask, int nKLutSize, unsigned char * pPerm, word * pTruth );
111
extern void          Dss_ManPrint( char * pFileName, Dss_Man_t * p );
Alan Mishchenko committed
112 113


114 115 116 117 118 119 120 121 122 123
ABC_NAMESPACE_HEADER_END



#endif

////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////