1 /**CFile**************************************************************** 2 3 FileName [dsd.h] 4 5 PackageName [DSD: Disjoint-support decomposition package.] 6 7 Synopsis [External declarations of the package. 8 This fast BDD-based recursive algorithm for simple 9 (single-output) DSD is based on the following papers: 10 (1) V. Bertacco and M. Damiani, "Disjunctive decomposition of 11 logic functions," Proc. ICCAD '97, pp. 78-82. 12 (2) Y. Matsunaga, "An exact and efficient algorithm for disjunctive 13 decomposition", Proc. SASIMI '98, pp. 44-50. 14 The scope of detected decompositions is the same as in the paper: 15 T. Sasao and M. Matsuura, "DECOMPOS: An integrated system for 16 functional decomposition," Proc. IWLS '98, pp. 471-477.] 17 18 Author [Alan Mishchenko] 19 20 Affiliation [UC Berkeley] 21 22 Date [Ver. 8.0. Started - September 22, 2003.] 23 24 Revision [$Id: dsd.h,v 1.0 2002/22/09 00:00:00 alanmi Exp $] 25 26 ***********************************************************************/ 27 28 #ifndef ABC__bdd__dsd__dsd_h 29 #define ABC__bdd__dsd__dsd_h 30 31 32 //////////////////////////////////////////////////////////////////////// 33 /// STRUCTURE DEFINITIONS /// 34 //////////////////////////////////////////////////////////////////////// 35 36 //////////////////////////////////////////////////////////////////////// 37 /// PARAMETERS /// 38 //////////////////////////////////////////////////////////////////////// 39 40 41 42 ABC_NAMESPACE_HEADER_START 43 44 45 // types of DSD nodes 46 enum Dsd_Type_t_ { 47 DSD_NODE_NONE = 0, 48 DSD_NODE_CONST1 = 1, 49 DSD_NODE_BUF = 2, 50 DSD_NODE_OR = 3, 51 DSD_NODE_EXOR = 4, 52 DSD_NODE_PRIME = 5, 53 }; 54 55 //////////////////////////////////////////////////////////////////////// 56 /// TYPEDEF DEFINITIONS /// 57 //////////////////////////////////////////////////////////////////////// 58 59 typedef struct Dsd_Manager_t_ Dsd_Manager_t; 60 typedef struct Dsd_Node_t_ Dsd_Node_t; 61 typedef enum Dsd_Type_t_ Dsd_Type_t; 62 63 //////////////////////////////////////////////////////////////////////// 64 /// MACRO DEFINITIONS /// 65 //////////////////////////////////////////////////////////////////////// 66 67 // complementation and testing for pointers for decomposition entries 68 #define Dsd_IsComplement(p) (((int)((ABC_PTRUINT_T) (p) & 01))) 69 #define Dsd_Regular(p) ((Dsd_Node_t *)((ABC_PTRUINT_T)(p) & ~01)) 70 #define Dsd_Not(p) ((Dsd_Node_t *)((ABC_PTRUINT_T)(p) ^ 01)) 71 #define Dsd_NotCond(p,c) ((Dsd_Node_t *)((ABC_PTRUINT_T)(p) ^ (c))) 72 73 //////////////////////////////////////////////////////////////////////// 74 /// ITERATORS /// 75 //////////////////////////////////////////////////////////////////////// 76 77 // iterator through the transitions 78 #define Dsd_NodeForEachChild( Node, Index, Child ) \ 79 for ( Index = 0; \ 80 Index < Dsd_NodeReadDecsNum(Node) && \ 81 ((Child = Dsd_NodeReadDec(Node,Index))!=0); \ 82 Index++ ) 83 84 //////////////////////////////////////////////////////////////////////// 85 /// FUNCTION DEFINITIONS /// 86 //////////////////////////////////////////////////////////////////////// 87 88 /*=== dsdApi.c =======================================================*/ 89 extern Dsd_Type_t Dsd_NodeReadType( Dsd_Node_t * p ); 90 extern DdNode * Dsd_NodeReadFunc( Dsd_Node_t * p ); 91 extern DdNode * Dsd_NodeReadSupp( Dsd_Node_t * p ); 92 extern Dsd_Node_t ** Dsd_NodeReadDecs( Dsd_Node_t * p ); 93 extern Dsd_Node_t * Dsd_NodeReadDec ( Dsd_Node_t * p, int i ); 94 extern int Dsd_NodeReadDecsNum( Dsd_Node_t * p ); 95 extern int Dsd_NodeReadMark( Dsd_Node_t * p ); 96 extern void Dsd_NodeSetMark( Dsd_Node_t * p, int Mark ); 97 extern DdManager * Dsd_ManagerReadDd( Dsd_Manager_t * pMan ); 98 extern Dsd_Node_t * Dsd_ManagerReadRoot( Dsd_Manager_t * pMan, int i ); 99 extern Dsd_Node_t * Dsd_ManagerReadInput( Dsd_Manager_t * pMan, int i ); 100 extern Dsd_Node_t * Dsd_ManagerReadConst1( Dsd_Manager_t * pMan ); 101 /*=== dsdMan.c =======================================================*/ 102 extern Dsd_Manager_t * Dsd_ManagerStart( DdManager * dd, int nSuppMax, int fVerbose ); 103 extern void Dsd_ManagerStop( Dsd_Manager_t * dMan ); 104 /*=== dsdProc.c =======================================================*/ 105 extern void Dsd_Decompose( Dsd_Manager_t * dMan, DdNode ** pbFuncs, int nFuncs ); 106 extern Dsd_Node_t * Dsd_DecomposeOne( Dsd_Manager_t * pDsdMan, DdNode * bFunc ); 107 /*=== dsdTree.c =======================================================*/ 108 extern void Dsd_TreeNodeGetInfo( Dsd_Manager_t * dMan, int * DepthMax, int * GateSizeMax ); 109 extern void Dsd_TreeNodeGetInfoOne( Dsd_Node_t * pNode, int * DepthMax, int * GateSizeMax ); 110 extern int Dsd_TreeGetAigCost( Dsd_Node_t * pNode ); 111 extern int Dsd_TreeCountNonTerminalNodes( Dsd_Manager_t * dMan ); 112 extern int Dsd_TreeCountNonTerminalNodesOne( Dsd_Node_t * pRoot ); 113 extern int Dsd_TreeCountPrimeNodes( Dsd_Manager_t * pDsdMan ); 114 extern int Dsd_TreeCountPrimeNodesOne( Dsd_Node_t * pRoot ); 115 extern int Dsd_TreeCollectDecomposableVars( Dsd_Manager_t * dMan, int * pVars ); 116 extern Dsd_Node_t ** Dsd_TreeCollectNodesDfs( Dsd_Manager_t * dMan, int * pnNodes ); 117 extern Dsd_Node_t ** Dsd_TreeCollectNodesDfsOne( Dsd_Manager_t * pDsdMan, Dsd_Node_t * pNode, int * pnNodes ); 118 extern void Dsd_TreePrint( FILE * pFile, Dsd_Manager_t * dMan, char * pInputNames[], char * pOutputNames[], int fShortNames, int Output ); 119 extern void Dsd_TreePrint2( FILE * pFile, Dsd_Manager_t * dMan, char * pInputNames[], char * pOutputNames[], int Output ); 120 extern void Dsd_NodePrint( FILE * pFile, Dsd_Node_t * pNode ); 121 /*=== dsdLocal.c =======================================================*/ 122 extern DdNode * Dsd_TreeGetPrimeFunction( DdManager * dd, Dsd_Node_t * pNode ); 123 124 125 126 ABC_NAMESPACE_HEADER_END 127 128 129 130 #endif 131 132 //////////////////////////////////////////////////////////////////////// 133 /// END OF FILE /// 134 //////////////////////////////////////////////////////////////////////// 135