00001
00021 #ifndef __RWR_H__
00022 #define __RWR_H__
00023
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027
00031
00032 #include "abc.h"
00033 #include "cut.h"
00034
00038
00042
00043 #define RWR_LIMIT 1048576/4 // ((1 << 20)
00044
00045 typedef struct Rwr_Man_t_ Rwr_Man_t;
00046 typedef struct Rwr_Node_t_ Rwr_Node_t;
00047
00048 struct Rwr_Man_t_
00049 {
00050
00051 int nFuncs;
00052 unsigned short * puCanons;
00053 char * pPhases;
00054 char * pPerms;
00055 unsigned char * pMap;
00056 unsigned short * pMapInv;
00057 char * pPractical;
00058 char ** pPerms4;
00059
00060 Vec_Ptr_t * vForest;
00061 Rwr_Node_t ** pTable;
00062 Vec_Vec_t * vClasses;
00063 Extra_MmFixed_t * pMmNode;
00064
00065 int nTravIds;
00066 int nConsidered;
00067 int nAdded;
00068 int nClasses;
00069
00070 int fCompl;
00071 void * pGraph;
00072 Vec_Ptr_t * vFanins;
00073 Vec_Ptr_t * vFaninsCur;
00074 Vec_Int_t * vLevNums;
00075 Vec_Ptr_t * vNodesTemp;
00076
00077 int nNodesConsidered;
00078 int nNodesRewritten;
00079 int nNodesGained;
00080 int nNodesBeg;
00081 int nNodesEnd;
00082 int nScores[222];
00083 int nCutsGood;
00084 int nCutsBad;
00085 int nSubgraphs;
00086
00087 int timeStart;
00088 int timeCut;
00089 int timeRes;
00090 int timeEval;
00091 int timeMffc;
00092 int timeUpdate;
00093 int timeTotal;
00094 };
00095
00096 struct Rwr_Node_t_
00097 {
00098 int Id;
00099 int TravId;
00100 short nScore;
00101 short nGain;
00102 short nAdded;
00103 unsigned uTruth : 16;
00104 unsigned Volume : 8;
00105 unsigned Level : 6;
00106 unsigned fUsed : 1;
00107 unsigned fExor : 1;
00108 Rwr_Node_t * p0;
00109 Rwr_Node_t * p1;
00110 Rwr_Node_t * pNext;
00111 };
00112
00113
00114 static inline bool Rwr_IsComplement( Rwr_Node_t * p ) { return (bool)(((unsigned long)p) & 01); }
00115 static inline Rwr_Node_t * Rwr_Regular( Rwr_Node_t * p ) { return (Rwr_Node_t *)((unsigned long)(p) & ~01); }
00116 static inline Rwr_Node_t * Rwr_Not( Rwr_Node_t * p ) { return (Rwr_Node_t *)((unsigned long)(p) ^ 01); }
00117 static inline Rwr_Node_t * Rwr_NotCond( Rwr_Node_t * p, int c ) { return (Rwr_Node_t *)((unsigned long)(p) ^ (c)); }
00118
00122
00126
00127
00128 extern void Rwr_ManPreprocess( Rwr_Man_t * p );
00129
00130 extern int Rwr_NodeRewrite( Rwr_Man_t * p, Cut_Man_t * pManCut, Abc_Obj_t * pNode, int fUpdateLevel, int fUseZeros, int fPlaceEnable );
00131 extern void Rwr_ScoresClean( Rwr_Man_t * p );
00132 extern void Rwr_ScoresReport( Rwr_Man_t * p );
00133
00134 extern void Rwr_ManPrecompute( Rwr_Man_t * p );
00135 extern Rwr_Node_t * Rwr_ManAddVar( Rwr_Man_t * p, unsigned uTruth, int fPrecompute );
00136 extern Rwr_Node_t * Rwr_ManAddNode( Rwr_Man_t * p, Rwr_Node_t * p0, Rwr_Node_t * p1, int fExor, int Level, int Volume );
00137 extern int Rwr_ManNodeVolume( Rwr_Man_t * p, Rwr_Node_t * p0, Rwr_Node_t * p1 );
00138 extern void Rwr_ManIncTravId( Rwr_Man_t * p );
00139
00140 extern Rwr_Man_t * Rwr_ManStart( bool fPrecompute );
00141 extern void Rwr_ManStop( Rwr_Man_t * p );
00142 extern void Rwr_ManPrintStats( Rwr_Man_t * p );
00143 extern void Rwr_ManPrintStatsFile( Rwr_Man_t * p );
00144 extern void * Rwr_ManReadDecs( Rwr_Man_t * p );
00145 extern Vec_Ptr_t * Rwr_ManReadLeaves( Rwr_Man_t * p );
00146 extern int Rwr_ManReadCompl( Rwr_Man_t * p );
00147 extern void Rwr_ManAddTimeCuts( Rwr_Man_t * p, int Time );
00148 extern void Rwr_ManAddTimeUpdate( Rwr_Man_t * p, int Time );
00149 extern void Rwr_ManAddTimeTotal( Rwr_Man_t * p, int Time );
00150
00151 extern void Rwr_ManPrint( Rwr_Man_t * p );
00152
00153 extern void Rwr_ManWriteToArray( Rwr_Man_t * p );
00154 extern void Rwr_ManLoadFromArray( Rwr_Man_t * p, int fVerbose );
00155 extern void Rwr_ManWriteToFile( Rwr_Man_t * p, char * pFileName );
00156 extern void Rwr_ManLoadFromFile( Rwr_Man_t * p, char * pFileName );
00157 extern void Rwr_ListAddToTail( Rwr_Node_t ** ppList, Rwr_Node_t * pNode );
00158 extern char * Rwr_ManGetPractical( Rwr_Man_t * p );
00159
00160 #ifdef __cplusplus
00161 }
00162 #endif
00163
00164 #endif
00165
00169