mapper.h 10.8 KB
Newer Older
Alan Mishchenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/**CFile****************************************************************

  FileName    [mapper.h]
 
  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

  Synopsis    [Generic technology mapping engine.]

  Author      [MVSIS Group]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 2.0. Started - June 1, 2004.]

  Revision    [$Id: mapper.h,v 1.11 2005/02/28 05:34:26 alanmi Exp $]

***********************************************************************/

19 20
#ifndef ABC__map__mapper__mapper_h
#define ABC__map__mapper__mapper_h
Alan Mishchenko committed
21

22

Alan Mishchenko committed
23 24 25 26 27 28 29 30
////////////////////////////////////////////////////////////////////////
///                          INCLUDES                                ///
////////////////////////////////////////////////////////////////////////

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

31 32 33 34


ABC_NAMESPACE_HEADER_START

Alan Mishchenko committed
35

Alan Mishchenko committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
////////////////////////////////////////////////////////////////////////
///                    STRUCTURE DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

typedef struct Map_ManStruct_t_         Map_Man_t;
typedef struct Map_NodeStruct_t_        Map_Node_t;
typedef struct Map_NodeVecStruct_t_     Map_NodeVec_t;
typedef struct Map_CutStruct_t_         Map_Cut_t;
typedef struct Map_MatchStruct_t_       Map_Match_t;
typedef struct Map_SuperStruct_t_       Map_Super_t;
typedef struct Map_SuperLibStruct_t_    Map_SuperLib_t;
typedef struct Map_HashTableStruct_t_   Map_HashTable_t;
typedef struct Map_HashEntryStruct_t_   Map_HashEntry_t;
typedef struct Map_TimeStruct_t_        Map_Time_t;

// the pair of rise/fall time parameters
struct Map_TimeStruct_t_
{
    float              Rise;
    float              Fall;
    float              Worst;
};

////////////////////////////////////////////////////////////////////////
///                       GLOBAL VARIABLES                           ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
Alan Mishchenko committed
64
///                       MACRO DEFINITIONS                          ///
Alan Mishchenko committed
65 66
////////////////////////////////////////////////////////////////////////
 
Alan Mishchenko committed
67 68 69 70
#define Map_IsComplement(p)    (((int)((ABC_PTRUINT_T) (p) & 01)))
#define Map_Regular(p)         ((Map_Node_t *)((ABC_PTRUINT_T)(p) & ~01)) 
#define Map_Not(p)             ((Map_Node_t *)((ABC_PTRUINT_T)(p) ^ 01)) 
#define Map_NotCond(p,c)       ((Map_Node_t *)((ABC_PTRUINT_T)(p) ^ (c)))
Alan Mishchenko committed
71 72

////////////////////////////////////////////////////////////////////////
Alan Mishchenko committed
73
///                     FUNCTION DEFINITIONS                         ///
Alan Mishchenko committed
74 75 76 77 78
////////////////////////////////////////////////////////////////////////

/*=== mapperCreate.c =============================================================*/
extern Map_Man_t *     Map_ManCreate( int nInputs, int nOutputs, int fVerbose );
extern Map_Node_t *    Map_NodeCreate( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
79
extern void            Map_ManCreateNodeDelays( Map_Man_t * p, int LogFan );
Alan Mishchenko committed
80 81
extern void            Map_ManFree( Map_Man_t * pMan );
extern void            Map_ManPrintTimeStats( Map_Man_t * p );
82
extern void            Map_ManPrintStatsToFile( char * pName, float Area, float Delay, abctime Time );
Alan Mishchenko committed
83 84
extern int             Map_ManReadInputNum( Map_Man_t * p );
extern int             Map_ManReadOutputNum( Map_Man_t * p );
85
extern int             Map_ManReadBufNum( Map_Man_t * p );
Alan Mishchenko committed
86 87
extern Map_Node_t **   Map_ManReadInputs ( Map_Man_t * p );
extern Map_Node_t **   Map_ManReadOutputs( Map_Man_t * p );
88 89
extern Map_Node_t **   Map_ManReadBufs( Map_Man_t * p );
extern Map_Node_t *    Map_ManReadBufDriver( Map_Man_t * p, int i );
Alan Mishchenko committed
90 91 92
extern Map_Node_t *    Map_ManReadConst1 ( Map_Man_t * p );
extern Map_Time_t *    Map_ManReadInputArrivals( Map_Man_t * p );
extern Mio_Library_t * Map_ManReadGenLib ( Map_Man_t * p );
93
extern int             Map_ManReadVerbose( Map_Man_t * p );
Alan Mishchenko committed
94 95
extern float           Map_ManReadAreaFinal( Map_Man_t * p );
extern float           Map_ManReadRequiredGlo( Map_Man_t * p );
Alan Mishchenko committed
96 97 98 99
extern void            Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames );
extern void            Map_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery );
extern void            Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget );
extern void            Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals );
100
extern void            Map_ManSetOutputRequireds( Map_Man_t * p, Map_Time_t * pArrivals );
101
extern void            Map_ManSetObeyFanoutLimits( Map_Man_t * p, int  fObeyFanoutLimits );              
Alan Mishchenko committed
102 103 104 105 106 107 108 109
extern void            Map_ManSetNumIterations( Map_Man_t * p, int nNumIterations );
extern int             Map_ManReadPass( Map_Man_t * p );
extern void            Map_ManSetPass( Map_Man_t * p, int nPass );
extern int             Map_ManReadFanoutViolations( Map_Man_t * p );
extern void            Map_ManSetFanoutViolations( Map_Man_t * p, int nVio );
extern void            Map_ManSetChoiceNodeNum( Map_Man_t * p, int nChoiceNodes );
extern void            Map_ManSetChoiceNum( Map_Man_t * p, int nChoices );
extern void            Map_ManSetVerbose( Map_Man_t * p, int fVerbose );
Alan Mishchenko committed
110
extern void            Map_ManSetSwitching( Map_Man_t * p, int fSwitching );
111
extern void            Map_ManSetSkipFanout( Map_Man_t * p, int fSkipFanout );
112
extern void            Map_ManSetUseProfile( Map_Man_t * p );
Alan Mishchenko committed
113 114 115 116 117 118 119 120 121 122 123 124

extern Map_Man_t *     Map_NodeReadMan( Map_Node_t * p );
extern char *          Map_NodeReadData( Map_Node_t * p, int fPhase );
extern int             Map_NodeReadNum( Map_Node_t * p );
extern int             Map_NodeReadLevel( Map_Node_t * p );
extern Map_Cut_t *     Map_NodeReadCuts( Map_Node_t * p );
extern Map_Cut_t *     Map_NodeReadCutBest( Map_Node_t * p, int fPhase );
extern Map_Node_t *    Map_NodeReadOne( Map_Node_t * p );
extern Map_Node_t *    Map_NodeReadTwo( Map_Node_t * p );
extern void            Map_NodeSetData( Map_Node_t * p, int fPhase, char * pData );
extern void            Map_NodeSetNextE( Map_Node_t * p, Map_Node_t * pNextE );
extern void            Map_NodeSetRepr( Map_Node_t * p, Map_Node_t * pRepr );
Alan Mishchenko committed
125
extern void            Map_NodeSetSwitching( Map_Node_t * p, float Switching );
Alan Mishchenko committed
126 127 128

extern int             Map_NodeIsConst( Map_Node_t * p );
extern int             Map_NodeIsVar( Map_Node_t * p );
129
extern int             Map_NodeIsBuf( Map_Node_t * p );
Alan Mishchenko committed
130 131 132 133 134 135 136 137 138 139 140
extern int             Map_NodeIsAnd( Map_Node_t * p );
extern int             Map_NodeComparePhase( Map_Node_t * p1, Map_Node_t * p2 );

extern Map_Super_t *   Map_CutReadSuperBest( Map_Cut_t * p, int fPhase );
extern Map_Super_t *   Map_CutReadSuper0( Map_Cut_t * p );
extern Map_Super_t *   Map_CutReadSuper1( Map_Cut_t * p );
extern int             Map_CutReadLeavesNum( Map_Cut_t * p );
extern Map_Node_t **   Map_CutReadLeaves( Map_Cut_t * p );
extern unsigned        Map_CutReadPhaseBest( Map_Cut_t * p, int fPhase );
extern unsigned        Map_CutReadPhase0( Map_Cut_t * p );
extern unsigned        Map_CutReadPhase1( Map_Cut_t * p );
Alan Mishchenko committed
141
extern Map_Cut_t *     Map_CutReadNext( Map_Cut_t * p );
Alan Mishchenko committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158

extern char *          Map_SuperReadFormula( Map_Super_t * p );
extern Mio_Gate_t *    Map_SuperReadRoot( Map_Super_t * p );
extern int             Map_SuperReadNum( Map_Super_t * p );
extern Map_Super_t **  Map_SuperReadFanins( Map_Super_t * p );
extern int             Map_SuperReadFaninNum( Map_Super_t * p );
extern Map_Super_t *   Map_SuperReadNext( Map_Super_t * p );
extern int             Map_SuperReadNumPhases( Map_Super_t * p );
extern unsigned char * Map_SuperReadPhases( Map_Super_t * p );
extern int             Map_SuperReadFanoutLimit( Map_Super_t * p );

extern Mio_Library_t * Map_SuperLibReadGenLib( Map_SuperLib_t * p );
extern float           Map_SuperLibReadAreaInv( Map_SuperLib_t * p );
extern Map_Time_t      Map_SuperLibReadDelayInv( Map_SuperLib_t * p );
extern int             Map_SuperLibReadVarsMax( Map_SuperLib_t * p );

extern Map_Node_t *    Map_NodeAnd( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
159
extern Map_Node_t *    Map_NodeBuf( Map_Man_t * p, Map_Node_t * p1 );
Alan Mishchenko committed
160 161 162 163
extern void            Map_NodeSetChoice( Map_Man_t * pMan, Map_Node_t * pNodeOld, Map_Node_t * pNodeNew );

/*=== resmCanon.c =============================================================*/
extern int             Map_CanonComputeSlow( unsigned uTruths[][2], int nVarsMax, int nVarsReal, unsigned uTruth[], unsigned char * puPhases, unsigned uTruthRes[] );
Alan Mishchenko committed
164
extern int             Map_CanonComputeFast( Map_Man_t * p, int nVarsMax, int nVarsReal, unsigned uTruth[], unsigned char * puPhases, unsigned uTruthRes[] );
Alan Mishchenko committed
165 166 167 168 169 170 171 172
/*=== mapperCut.c =============================================================*/
extern Map_Cut_t *     Map_CutAlloc( Map_Man_t * p );
/*=== mapperCutUtils.c =============================================================*/
extern void            Map_CutCreateFromNode( Map_Man_t * p, Map_Super_t * pSuper, int iRoot, unsigned uPhaseRoot, 
                           int * pLeaves, int nLeaves, unsigned uPhaseLeaves );
/*=== mapperCore.c =============================================================*/
extern int             Map_Mapping( Map_Man_t * p );
/*=== mapperLib.c =============================================================*/
173
extern int             Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib, int fVerbose );
174
extern void            Map_SuperLibFree( Map_SuperLib_t * p );
Alan Mishchenko committed
175 176 177 178 179 180 181 182 183 184 185
/*=== mapperMntk.c =============================================================*/
//extern Mntk_Man_t *    Map_ConvertMappingToMntk( Map_Man_t * pMan );
/*=== mapperSuper.c =============================================================*/
extern char *          Map_LibraryReadFormulaStep( char * pFormula, char * pStrings[], int * pnStrings );
/*=== mapperSweep.c =============================================================*/
extern void            Map_NetworkSweep( Abc_Ntk_t * pNet );
/*=== mapperTable.c =============================================================*/
extern Map_Super_t *   Map_SuperTableLookupC( Map_SuperLib_t * pLib, unsigned uTruth[] );
/*=== mapperTime.c =============================================================*/
/*=== mapperUtil.c =============================================================*/
extern int             Map_ManCheckConsistency( Map_Man_t * p );
186
extern st__table *      Map_CreateTableGate2Super( Map_Man_t * p );
Alan Mishchenko committed
187 188 189 190
extern void            Map_ManCleanData( Map_Man_t * p );
extern void            Map_MappingSetupTruthTables( unsigned uTruths[][2] );
extern void            Map_MappingSetupTruthTablesLarge( unsigned uTruths[][32] );

191 192 193 194 195


ABC_NAMESPACE_HEADER_END


Alan Mishchenko committed
196 197 198

#endif

Alan Mishchenko committed
199 200 201
////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////