00001 
00019 #ifndef __MAPPER_H__
00020 #define __MAPPER_H__
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00029 
00030 
00034 
00038 
00039 typedef struct Map_ManStruct_t_         Map_Man_t;
00040 typedef struct Map_NodeStruct_t_        Map_Node_t;
00041 typedef struct Map_NodeVecStruct_t_     Map_NodeVec_t;
00042 typedef struct Map_CutStruct_t_         Map_Cut_t;
00043 typedef struct Map_MatchStruct_t_       Map_Match_t;
00044 typedef struct Map_SuperStruct_t_       Map_Super_t;
00045 typedef struct Map_SuperLibStruct_t_    Map_SuperLib_t;
00046 typedef struct Map_HashTableStruct_t_   Map_HashTable_t;
00047 typedef struct Map_HashEntryStruct_t_   Map_HashEntry_t;
00048 typedef struct Map_TimeStruct_t_        Map_Time_t;
00049 
00050 
00051 struct Map_TimeStruct_t_
00052 {
00053     float              Rise;
00054     float              Fall;
00055     float              Worst;
00056 };
00057 
00061 
00065  
00066 #define Map_IsComplement(p)    (((int)((unsigned long) (p) & 01)))
00067 #define Map_Regular(p)         ((Map_Node_t *)((unsigned long)(p) & ~01)) 
00068 #define Map_Not(p)             ((Map_Node_t *)((unsigned long)(p) ^ 01)) 
00069 #define Map_NotCond(p,c)       ((Map_Node_t *)((unsigned long)(p) ^ (c)))
00070 
00074 
00075 
00076 extern Map_Man_t *     Map_ManCreate( int nInputs, int nOutputs, int fVerbose );
00077 extern Map_Node_t *    Map_NodeCreate( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
00078 extern void            Map_ManFree( Map_Man_t * pMan );
00079 extern void            Map_ManPrintTimeStats( Map_Man_t * p );
00080 extern void            Map_ManPrintStatsToFile( char * pName, float Area, float Delay, int Time );
00081 extern int             Map_ManReadInputNum( Map_Man_t * p );
00082 extern int             Map_ManReadOutputNum( Map_Man_t * p );
00083 extern Map_Node_t **   Map_ManReadInputs ( Map_Man_t * p );
00084 extern Map_Node_t **   Map_ManReadOutputs( Map_Man_t * p );
00085 extern Map_Node_t *    Map_ManReadConst1 ( Map_Man_t * p );
00086 extern Map_Time_t *    Map_ManReadInputArrivals( Map_Man_t * p );
00087 extern Mio_Library_t * Map_ManReadGenLib ( Map_Man_t * p );
00088 extern bool            Map_ManReadVerbose( Map_Man_t * p );
00089 extern float           Map_ManReadAreaFinal( Map_Man_t * p );
00090 extern float           Map_ManReadRequiredGlo( Map_Man_t * p );
00091 extern void            Map_ManSetTimeToMap( Map_Man_t * p, int Time );
00092 extern void            Map_ManSetTimeToNet( Map_Man_t * p, int Time );
00093 extern void            Map_ManSetTimeSweep( Map_Man_t * p, int Time );
00094 extern void            Map_ManSetTimeTotal( Map_Man_t * p, int Time );
00095 extern void            Map_ManSetOutputNames( Map_Man_t * p, char ** ppNames );
00096 extern void            Map_ManSetAreaRecovery( Map_Man_t * p, int fAreaRecovery );
00097 extern void            Map_ManSetDelayTarget( Map_Man_t * p, float DelayTarget );
00098 extern void            Map_ManSetInputArrivals( Map_Man_t * p, Map_Time_t * pArrivals );
00099 extern void            Map_ManSetObeyFanoutLimits( Map_Man_t * p, bool fObeyFanoutLimits );              
00100 extern void            Map_ManSetNumIterations( Map_Man_t * p, int nNumIterations );
00101 extern int             Map_ManReadPass( Map_Man_t * p );
00102 extern void            Map_ManSetPass( Map_Man_t * p, int nPass );
00103 extern int             Map_ManReadFanoutViolations( Map_Man_t * p );
00104 extern void            Map_ManSetFanoutViolations( Map_Man_t * p, int nVio );
00105 extern void            Map_ManSetChoiceNodeNum( Map_Man_t * p, int nChoiceNodes );
00106 extern void            Map_ManSetChoiceNum( Map_Man_t * p, int nChoices );
00107 extern void            Map_ManSetVerbose( Map_Man_t * p, int fVerbose );
00108 extern void            Map_ManSetSwitching( Map_Man_t * p, int fSwitching );
00109 
00110 extern Map_Man_t *     Map_NodeReadMan( Map_Node_t * p );
00111 extern char *          Map_NodeReadData( Map_Node_t * p, int fPhase );
00112 extern int             Map_NodeReadNum( Map_Node_t * p );
00113 extern int             Map_NodeReadLevel( Map_Node_t * p );
00114 extern Map_Cut_t *     Map_NodeReadCuts( Map_Node_t * p );
00115 extern Map_Cut_t *     Map_NodeReadCutBest( Map_Node_t * p, int fPhase );
00116 extern Map_Node_t *    Map_NodeReadOne( Map_Node_t * p );
00117 extern Map_Node_t *    Map_NodeReadTwo( Map_Node_t * p );
00118 extern void            Map_NodeSetData( Map_Node_t * p, int fPhase, char * pData );
00119 extern void            Map_NodeSetNextE( Map_Node_t * p, Map_Node_t * pNextE );
00120 extern void            Map_NodeSetRepr( Map_Node_t * p, Map_Node_t * pRepr );
00121 extern void            Map_NodeSetSwitching( Map_Node_t * p, float Switching );
00122 
00123 extern int             Map_NodeIsConst( Map_Node_t * p );
00124 extern int             Map_NodeIsVar( Map_Node_t * p );
00125 extern int             Map_NodeIsAnd( Map_Node_t * p );
00126 extern int             Map_NodeComparePhase( Map_Node_t * p1, Map_Node_t * p2 );
00127 
00128 extern Map_Super_t *   Map_CutReadSuperBest( Map_Cut_t * p, int fPhase );
00129 extern Map_Super_t *   Map_CutReadSuper0( Map_Cut_t * p );
00130 extern Map_Super_t *   Map_CutReadSuper1( Map_Cut_t * p );
00131 extern int             Map_CutReadLeavesNum( Map_Cut_t * p );
00132 extern Map_Node_t **   Map_CutReadLeaves( Map_Cut_t * p );
00133 extern unsigned        Map_CutReadPhaseBest( Map_Cut_t * p, int fPhase );
00134 extern unsigned        Map_CutReadPhase0( Map_Cut_t * p );
00135 extern unsigned        Map_CutReadPhase1( Map_Cut_t * p );
00136 extern Map_Cut_t *     Map_CutReadNext( Map_Cut_t * p );
00137 
00138 extern char *          Map_SuperReadFormula( Map_Super_t * p );
00139 extern Mio_Gate_t *    Map_SuperReadRoot( Map_Super_t * p );
00140 extern int             Map_SuperReadNum( Map_Super_t * p );
00141 extern Map_Super_t **  Map_SuperReadFanins( Map_Super_t * p );
00142 extern int             Map_SuperReadFaninNum( Map_Super_t * p );
00143 extern Map_Super_t *   Map_SuperReadNext( Map_Super_t * p );
00144 extern int             Map_SuperReadNumPhases( Map_Super_t * p );
00145 extern unsigned char * Map_SuperReadPhases( Map_Super_t * p );
00146 extern int             Map_SuperReadFanoutLimit( Map_Super_t * p );
00147 
00148 extern Mio_Library_t * Map_SuperLibReadGenLib( Map_SuperLib_t * p );
00149 extern float           Map_SuperLibReadAreaInv( Map_SuperLib_t * p );
00150 extern Map_Time_t      Map_SuperLibReadDelayInv( Map_SuperLib_t * p );
00151 extern int             Map_SuperLibReadVarsMax( Map_SuperLib_t * p );
00152 
00153 extern Map_Node_t *    Map_NodeAnd( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
00154 extern Map_Node_t *    Map_NodeOr( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
00155 extern Map_Node_t *    Map_NodeExor( Map_Man_t * p, Map_Node_t * p1, Map_Node_t * p2 );
00156 extern Map_Node_t *    Map_NodeMux( Map_Man_t * p, Map_Node_t * pNode, Map_Node_t * pNodeT, Map_Node_t * pNodeE );
00157 extern void            Map_NodeSetChoice( Map_Man_t * pMan, Map_Node_t * pNodeOld, Map_Node_t * pNodeNew );
00158 
00159 
00160 extern int             Map_CanonComputeSlow( unsigned uTruths[][2], int nVarsMax, int nVarsReal, unsigned uTruth[], unsigned char * puPhases, unsigned uTruthRes[] );
00161 extern int             Map_CanonComputeFast( Map_Man_t * p, int nVarsMax, int nVarsReal, unsigned uTruth[], unsigned char * puPhases, unsigned uTruthRes[] );
00162 
00163 extern Map_Cut_t *     Map_CutAlloc( Map_Man_t * p );
00164 
00165 extern void            Map_CutCreateFromNode( Map_Man_t * p, Map_Super_t * pSuper, int iRoot, unsigned uPhaseRoot, 
00166                            int * pLeaves, int nLeaves, unsigned uPhaseLeaves );
00167 
00168 extern int             Map_Mapping( Map_Man_t * p );
00169 
00170 extern int             Map_SuperLibDeriveFromGenlib( Mio_Library_t * pLib );
00171 
00172 
00173 
00174 extern char *          Map_LibraryReadFormulaStep( char * pFormula, char * pStrings[], int * pnStrings );
00175 
00176 extern void            Map_NetworkSweep( Abc_Ntk_t * pNet );
00177 
00178 extern Map_Super_t *   Map_SuperTableLookupC( Map_SuperLib_t * pLib, unsigned uTruth[] );
00179 
00180 
00181 extern int             Map_ManCheckConsistency( Map_Man_t * p );
00182 extern st_table *      Map_CreateTableGate2Super( Map_Man_t * p );
00183 extern void            Map_ManCleanData( Map_Man_t * p );
00184 extern void            Map_MappingSetupTruthTables( unsigned uTruths[][2] );
00185 extern void            Map_MappingSetupTruthTablesLarge( unsigned uTruths[][32] );
00186 
00187 #ifdef __cplusplus
00188 }
00189 #endif
00190 
00191 #endif
00192