1 /**CFile****************************************************************
2 
3   FileName    [fpga.h]
4 
5   PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]
6 
7   Synopsis    [Technology mapping for variable-size-LUT FPGAs.]
8 
9   Author      [MVSIS Group]
10 
11   Affiliation [UC Berkeley]
12 
13   Date        [Ver. 2.0. Started - August 18, 2004.]
14 
15   Revision    [$Id: fpga.h,v 1.7 2004/09/30 21:18:09 satrajit Exp $]
16 
17 ***********************************************************************/
18 
19 #ifndef ABC__map__fpga__fpga_h
20 #define ABC__map__fpga__fpga_h
21 
22 
23 ////////////////////////////////////////////////////////////////////////
24 ///                          INCLUDES                                ///
25 ////////////////////////////////////////////////////////////////////////
26 
27 ////////////////////////////////////////////////////////////////////////
28 ///                         PARAMETERS                               ///
29 ////////////////////////////////////////////////////////////////////////
30 
31 
32 
33 ABC_NAMESPACE_HEADER_START
34 
35 
36 // the maximum size of LUTs used for mapping
37 #define FPGA_MAX_LUTSIZE   32
38 
39 ////////////////////////////////////////////////////////////////////////
40 ///                    STRUCTURE DEFINITIONS                         ///
41 ////////////////////////////////////////////////////////////////////////
42 
43 typedef struct Fpga_ManStruct_t_         Fpga_Man_t;
44 typedef struct Fpga_NodeStruct_t_        Fpga_Node_t;
45 typedef struct Fpga_NodeVecStruct_t_     Fpga_NodeVec_t;
46 typedef struct Fpga_CutStruct_t_         Fpga_Cut_t;
47 typedef struct Fpga_LutLibStruct_t_      Fpga_LutLib_t;
48 
49 ////////////////////////////////////////////////////////////////////////
50 ///                       GLOBAL VARIABLES                           ///
51 ////////////////////////////////////////////////////////////////////////
52 
53 ////////////////////////////////////////////////////////////////////////
54 ///                       MACRO DEFINITIONS                          ///
55 ////////////////////////////////////////////////////////////////////////
56 
57 #define Fpga_IsComplement(p)    (((int)((ABC_PTRUINT_T) (p) & 01)))
58 #define Fpga_Regular(p)         ((Fpga_Node_t *)((ABC_PTRUINT_T)(p) & ~01))
59 #define Fpga_Not(p)             ((Fpga_Node_t *)((ABC_PTRUINT_T)(p) ^ 01))
60 #define Fpga_NotCond(p,c)       ((Fpga_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)))
61 
62 #define Fpga_Ref(p)
63 #define Fpga_Deref(p)
64 #define Fpga_RecursiveDeref(p,c)
65 
66 ////////////////////////////////////////////////////////////////////////
67 ///                     FUNCTION DEFINITIONS                         ///
68 ////////////////////////////////////////////////////////////////////////
69 
70 /*=== fpgaCreate.c =============================================================*/
71 extern Fpga_Man_t *    Fpga_ManCreate( int nInputs, int nOutputs, int fVerbose );
72 extern Fpga_Node_t *   Fpga_NodeCreate( Fpga_Man_t * p, Fpga_Node_t * p1, Fpga_Node_t * p2 );
73 extern void            Fpga_ManFree( Fpga_Man_t * pMan );
74 extern void            Fpga_ManPrintTimeStats( Fpga_Man_t * p );
75 
76 extern int             Fpga_ManReadInputNum( Fpga_Man_t * p );
77 extern int             Fpga_ManReadOutputNum( Fpga_Man_t * p );
78 extern Fpga_Node_t **  Fpga_ManReadInputs ( Fpga_Man_t * p );
79 extern Fpga_Node_t **  Fpga_ManReadOutputs( Fpga_Man_t * p );
80 extern Fpga_Node_t *   Fpga_ManReadConst1 ( Fpga_Man_t * p );
81 extern float *         Fpga_ManReadInputArrivals( Fpga_Man_t * p );
82 extern int             Fpga_ManReadVerbose( Fpga_Man_t * p );
83 extern int             Fpga_ManReadVarMax( Fpga_Man_t * p );
84 extern float *         Fpga_ManReadLutAreas( Fpga_Man_t * p );
85 extern Fpga_NodeVec_t* Fpga_ManReadMapping( Fpga_Man_t * p );
86 extern void            Fpga_ManSetOutputNames( Fpga_Man_t * p, char ** ppNames );
87 extern void            Fpga_ManSetInputArrivals( Fpga_Man_t * p, float * pArrivals );
88 extern void            Fpga_ManSetAreaRecovery( Fpga_Man_t * p, int fAreaRecovery );
89 extern void            Fpga_ManSetDelayLimit( Fpga_Man_t * p, float DelayLimit );
90 extern void            Fpga_ManSetAreaLimit( Fpga_Man_t * p, float AreaLimit );
91 extern void            Fpga_ManSetObeyFanoutLimits( Fpga_Man_t * p, int fObeyFanoutLimits );
92 extern void            Fpga_ManSetNumIterations( Fpga_Man_t * p, int nNumIterations );
93 extern int             Fpga_ManReadFanoutViolations( Fpga_Man_t * p );
94 extern void            Fpga_ManSetFanoutViolations( Fpga_Man_t * p, int nVio );
95 extern void            Fpga_ManSetChoiceNodeNum( Fpga_Man_t * p, int nChoiceNodes );
96 extern void            Fpga_ManSetChoiceNum( Fpga_Man_t * p, int nChoices );
97 extern void            Fpga_ManSetVerbose( Fpga_Man_t * p, int fVerbose );
98 extern void            Fpga_ManSetSwitching( Fpga_Man_t * p, int fSwitching );
99 extern void            Fpga_ManSetLatchPaths( Fpga_Man_t * p, int fLatchPaths );
100 extern void            Fpga_ManSetLatchNum( Fpga_Man_t * p, int nLatches );
101 extern void            Fpga_ManSetDelayTarget( Fpga_Man_t * p, float DelayTarget );
102 extern void            Fpga_ManSetName( Fpga_Man_t * p, char * pFileName );
103 
104 extern int             Fpga_LibReadLutMax( Fpga_LutLib_t * pLib );
105 
106 extern char *          Fpga_NodeReadData0( Fpga_Node_t * p );
107 extern Fpga_Node_t *   Fpga_NodeReadData1( Fpga_Node_t * p );
108 extern int             Fpga_NodeReadRefs( Fpga_Node_t * p );
109 extern int             Fpga_NodeReadNum( Fpga_Node_t * p );
110 extern int             Fpga_NodeReadLevel( Fpga_Node_t * p );
111 extern Fpga_Cut_t *    Fpga_NodeReadCuts( Fpga_Node_t * p );
112 extern Fpga_Cut_t *    Fpga_NodeReadCutBest( Fpga_Node_t * p );
113 extern Fpga_Node_t *   Fpga_NodeReadOne( Fpga_Node_t * p );
114 extern Fpga_Node_t *   Fpga_NodeReadTwo( Fpga_Node_t * p );
115 extern void            Fpga_NodeSetLevel( Fpga_Node_t * p, Fpga_Node_t * pNode );
116 extern void            Fpga_NodeSetData0( Fpga_Node_t * p, char * pData );
117 extern void            Fpga_NodeSetData1( Fpga_Node_t * p, Fpga_Node_t * pNode );
118 extern void            Fpga_NodeSetArrival( Fpga_Node_t * p, float Time );
119 extern void            Fpga_NodeSetNextE( Fpga_Node_t * p, Fpga_Node_t * pNextE );
120 extern void            Fpga_NodeSetRepr( Fpga_Node_t * p, Fpga_Node_t * pRepr );
121 extern void            Fpga_NodeSetSwitching( Fpga_Node_t * p, float Switching );
122 
123 extern int             Fpga_NodeIsConst( Fpga_Node_t * p );
124 extern int             Fpga_NodeIsVar( Fpga_Node_t * p );
125 extern int             Fpga_NodeIsAnd( Fpga_Node_t * p );
126 extern int             Fpga_NodeComparePhase( Fpga_Node_t * p1, Fpga_Node_t * p2 );
127 
128 extern int             Fpga_CutReadLeavesNum( Fpga_Cut_t * p );
129 extern Fpga_Node_t **  Fpga_CutReadLeaves( Fpga_Cut_t * p );
130 
131 extern Fpga_Node_t *   Fpga_NodeAnd( Fpga_Man_t * p, Fpga_Node_t * p1, Fpga_Node_t * p2 );
132 extern Fpga_Node_t *   Fpga_NodeOr( Fpga_Man_t * p, Fpga_Node_t * p1, Fpga_Node_t * p2 );
133 extern Fpga_Node_t *   Fpga_NodeExor( Fpga_Man_t * p, Fpga_Node_t * p1, Fpga_Node_t * p2 );
134 extern Fpga_Node_t *   Fpga_NodeMux( Fpga_Man_t * p, Fpga_Node_t * pNode, Fpga_Node_t * pNodeT, Fpga_Node_t * pNodeE );
135 extern void            Fpga_NodeSetChoice( Fpga_Man_t * pMan, Fpga_Node_t * pNodeOld, Fpga_Node_t * pNodeNew );
136 
137 extern void            Fpga_ManStats( Fpga_Man_t * p );
138 
139 /*=== fpgaCore.c =============================================================*/
140 extern int             Fpga_Mapping( Fpga_Man_t * p );
141 /*=== fpgaCut.c ===============================================================*/
142 extern void            Fpga_MappingCreatePiCuts( Fpga_Man_t * p );
143 extern void            Fpga_CutsCleanSign( Fpga_Man_t * pMan );
144 extern void            Fpga_CutsCleanRoot( Fpga_Man_t * pMan );
145 /*=== fpgaCutUtils.c =============================================================*/
146 extern void            Fpga_CutCreateFromNode( Fpga_Man_t * p, int iRoot, int * pLeaves, int nLeaves );
147 extern void            Fpga_MappingSetUsedCuts( Fpga_Man_t * p );
148 /*=== fpgaLib.c =============================================================*/
149 extern Fpga_LutLib_t * Fpga_LutLibDup( Fpga_LutLib_t * p );
150 extern int             Fpga_LutLibReadVarMax( Fpga_LutLib_t * p );
151 extern float *         Fpga_LutLibReadLutAreas( Fpga_LutLib_t * p );
152 extern float *         Fpga_LutLibReadLutDelays( Fpga_LutLib_t * p );
153 extern float           Fpga_LutLibReadLutArea( Fpga_LutLib_t * p, int Size );
154 extern float           Fpga_LutLibReadLutDelay( Fpga_LutLib_t * p, int Size );
155 /*=== fpgaTruth.c =============================================================*/
156 extern void *          Fpga_TruthsCutBdd( void * dd, Fpga_Cut_t * pCut );
157 extern int             Fpga_CutVolume( Fpga_Cut_t * pCut );
158 /*=== fpgaUtil.c =============================================================*/
159 extern int             Fpga_ManCheckConsistency( Fpga_Man_t * p );
160 extern void            Fpga_ManCleanData0( Fpga_Man_t * pMan );
161 extern Fpga_NodeVec_t * Fpga_CollectNodeTfo( Fpga_Man_t * pMan, Fpga_Node_t * pNode );
162 /*=== fpga.c =============================================================*/
163 extern void            Fpga_SetSimpleLutLib( int nLutSize );
164 
165 
166 
167 ABC_NAMESPACE_HEADER_END
168 
169 
170 
171 #endif
172 
173 ////////////////////////////////////////////////////////////////////////
174 ///                       END OF FILE                                ///
175 ////////////////////////////////////////////////////////////////////////
176