19 #ifndef ABC__map__fpga__fpgaInt_h
20 #define ABC__map__fpga__fpgaInt_h
48 #define inline __inline // compatible with MS VS 6.0
52 #define FPGA_MAX_LEAVES 6
55 #define FPGA_MASK(n) ((~((unsigned)0)) >> (32-(n)))
56 #define FPGA_FULL (~((unsigned)0))
57 #define FPGA_NO_VAR (-9999.0)
58 #define FPGA_NUM_BYTES(n) (((n)/16 + (((n)%16) > 0))*16)
61 #define FPGA_MIN(a,b) (((a) < (b))? (a) : (b))
62 #define FPGA_MAX(a,b) (((a) > (b))? (a) : (b))
65 #define FPGA_FLOAT_LARGE ((float)1.0e+20)
66 #define FPGA_FLOAT_SMALL ((float)1.0e-20)
67 #define FPGA_INT_LARGE (10000000)
70 #define FPGA_SEQ_SIGN(p) (1 << (((ABC_PTRUINT_T)p)%31));
73 #define Fpga_CutIsComplement(p) (((int)((ABC_PTRUINT_T)(p) & 01)))
74 #define Fpga_CutRegular(p) ((Fpga_Cut_t *)((ABC_PTRUINT_T)(p) & ~01))
75 #define Fpga_CutNot(p) ((Fpga_Cut_t *)((ABC_PTRUINT_T)(p) ^ 01))
76 #define Fpga_CutNotCond(p,c) ((Fpga_Cut_t *)((ABC_PTRUINT_T)(p) ^ (c)))
79 #define Fpga_SeqIsComplement( p ) (((int)((ABC_PTRUINT_T) (p) & 01)))
80 #define Fpga_SeqRegular( p ) ((Fpga_Node_t *)((ABC_PTRUINT_T)(p) & ~015))
81 #define Fpga_SeqIndex( p ) ((((ABC_PTRUINT_T)(p)) >> 1) & 07)
82 #define Fpga_SeqIndexCreate( p, Ind ) (((ABC_PTRUINT_T)(p)) | (1 << (((ABC_PTRUINT_T)(Ind)) & 07)))
85 #define Fpga_NodeReadRef(p) ((Fpga_Regular(p))->nRefs)
86 #define Fpga_NodeRef(p) ((Fpga_Regular(p))->nRefs++)
89 #define Fpga_NodeIsSimComplement(p) (Fpga_IsComplement(p)? !(Fpga_Regular(p)->fInv) : (p)->fInv)
92 #define FPGA_RANDOM_UNSIGNED ((((unsigned)rand()) << 24) ^ (((unsigned)rand()) << 12) ^ ((unsigned)rand()))
205 #ifdef FPGA_ALLOCATE_FANOUT
258 #define Fpga_NodeReadNextFanout( pNode, pFanout ) \
259 ( ( pFanout == NULL )? NULL : \
260 ((Fpga_Regular((pFanout)->p1) == (pNode))? \
261 (pFanout)->pFanFanin1 : (pFanout)->pFanFanin2) )
264 #define Fpga_NodeReadNextFanoutPlace( pNode, pFanout ) \
265 ( (Fpga_Regular((pFanout)->p1) == (pNode))? \
266 &(pFanout)->pFanFanin1 : &(pFanout)->pFanFanin2 )
269 #define Fpga_NodeForEachFanout( pNode, pFanout ) \
270 for ( pFanout = (pNode)->pFanPivot; pFanout; \
271 pFanout = Fpga_NodeReadNextFanout(pNode, pFanout) )
274 #define Fpga_NodeForEachFanoutSafe( pNode, pFanout, pFanout2 ) \
275 for ( pFanout = (pNode)->pFanPivot, \
276 pFanout2 = Fpga_NodeReadNextFanout(pNode, pFanout); \
278 pFanout = pFanout2, \
279 pFanout2 = Fpga_NodeReadNextFanout(pNode, pFanout) )
Fpga_LutLib_t * Fpga_LutLibRead(char *FileName, int fVerbose)
int Fpga_MappingMatchesSwitch(Fpga_Man_t *p)
float Fpga_MappingSetRefsAndArea(Fpga_Man_t *pMan)
void Fpga_CutInsertFanouts(Fpga_Man_t *p, Fpga_Node_t *pNode, Fpga_Cut_t *pCut)
void Fpga_NodeVecUnion(Fpga_NodeVec_t *p, Fpga_NodeVec_t *p1, Fpga_NodeVec_t *p2)
float Fpga_MappingAreaTrav(Fpga_Man_t *pMan)
void Fpga_MappingSetupMask(unsigned uMask[], int nVarsMax)
void Fpga_TimeComputeRequiredGlobal(Fpga_Man_t *p, int fFirstTime)
static int Fpga_FloatLessThan(Fpga_Man_t *p, float Arg1, float Arg2)
void Fpga_LutLibPrint(Fpga_LutLib_t *pLutLib)
Fpga_NodeVec_t * Fpga_DfsLim(Fpga_Man_t *pMan, Fpga_Node_t *pNode, int nLevels)
#define FPGA_MAX_LEAVES
INCLUDES ///.
void Fpga_CutListRecycle(Fpga_Man_t *p, Fpga_Cut_t *pSetList, Fpga_Cut_t *pSave)
float pLutDelays[FPGA_MAX_LUTSIZE+1][FPGA_MAX_LUTSIZE+1]
void Fpga_MappingCreatePiCuts(Fpga_Man_t *p)
Fpga_Cut_t * Fpga_CutListAppend(Fpga_Cut_t *pSetAll, Fpga_Cut_t *pSets)
void Fpga_CutGetParameters(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
Fpga_Node_t ** Fpga_NodeVecReadArray(Fpga_NodeVec_t *p)
float Fpga_CutGetSwitchDerefed(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut)
DECLARATIONS ///.
void Fpga_NodeVecGrow(Fpga_NodeVec_t *p, int nCapMin)
int Fpga_MappingMatchesArea(Fpga_Man_t *p)
void Fpga_LutLibFree(Fpga_LutLib_t *p)
float Fpga_CutRefSwitch(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
Fpga_NodeVec_t * vMapping
float Fpga_CutGetAreaRefed(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
float pLutAreas[FPGA_MAX_LUTSIZE+1]
static int Fpga_FloatEqual(Fpga_Man_t *p, float Arg1, float Arg2)
void Fpga_CutRemoveFanouts(Fpga_Man_t *p, Fpga_Node_t *pNode, Fpga_Cut_t *pCut)
Fpga_Node_t * Fpga_NodeVecPop(Fpga_NodeVec_t *p)
int Fpga_CutCountAll(Fpga_Man_t *pMan)
void Fpga_MappingPrintOutputArrivals(Fpga_Man_t *p)
void Fpga_MappingSortByLevel(Fpga_Man_t *pMan, Fpga_NodeVec_t *vNodes, int fIncreasing)
Fpga_NodeVec_t * Fpga_MappingLevelize(Fpga_Man_t *pMan, Fpga_NodeVec_t *vNodes)
int Fpga_NodeVecPushUnique(Fpga_NodeVec_t *p, Fpga_Node_t *Entry)
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
void Fpga_NodeVecReverse(Fpga_NodeVec_t *vNodes)
void Fpga_TimePropagateRequired(Fpga_Man_t *p, Fpga_NodeVec_t *vNodes)
void Fpga_NodeAddFaninFanout(Fpga_Node_t *pFanin, Fpga_Node_t *pFanout)
int Fpga_MappingMatches(Fpga_Man_t *p, int fDelayOriented)
FUNCTION DEFINITIONS ///.
void Fpga_MappingSetChoiceLevels(Fpga_Man_t *pMan)
float Fpga_MappingArea(Fpga_Man_t *pMan)
Fpga_NodeVec_t * vNodesAll
void Fpga_NodeVecShrink(Fpga_NodeVec_t *p, int nSizeNew)
int Fpga_LutLibDelaysAreDiscrete(Fpga_LutLib_t *pLutLib)
int Fpga_CutListCount(Fpga_Cut_t *pSets)
Fpga_NodeVec_t * Fpga_MappingDfs(Fpga_Man_t *pMan, int fCollectEquiv)
FUNCTION DEFINITIONS ///.
Fpga_NodeVec_t * Fpga_NodeVecAlloc(int nCap)
FUNCTION DEFINITIONS ///.
void Fpga_NodeVecFree(Fpga_NodeVec_t *p)
void Fpga_TimeComputeRequired(Fpga_Man_t *p, float fRequired)
void Fpga_SortNodesByArrivalTimes(Fpga_NodeVec_t *p)
int Fpga_NodeVecReadSize(Fpga_NodeVec_t *p)
float Fpga_CutGetAreaDerefed(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
void Fpga_ManReportChoices(Fpga_Man_t *pMan)
void Fpga_MappingSetupTruthTables(unsigned uTruths[][2])
static int Fpga_FloatMoreThan(Fpga_Man_t *p, float Arg1, float Arg2)
void Fpga_TimePropagateArrival(Fpga_Man_t *p)
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
void Fpga_CutFree(Fpga_Man_t *p, Fpga_Cut_t *pCut)
void Fpga_NodeRemoveFaninFanout(Fpga_Node_t *pFanin, Fpga_Node_t *pFanoutToRemove)
float Fpga_CutDeref(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
#define ABC_NAMESPACE_HEADER_END
int Fpga_MappingMaxLevel(Fpga_Man_t *pMan)
#define FPGA_MAX_LUTSIZE
INCLUDES ///.
void Fpga_CutPrint(Fpga_Man_t *p, Fpga_Node_t *pRoot, Fpga_Cut_t *pCut)
float Fpga_TimeCutComputeArrival_rec(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
Fpga_Cut_t * Fpga_CutDup(Fpga_Man_t *p, Fpga_Cut_t *pCutOld)
void Fpga_NodeVecSortByLevel(Fpga_NodeVec_t *p)
Extra_MmFixed_t * mmNodes
STRUCTURE DEFINITIONS ///.
float Fpga_CutRef(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
Fpga_Cut_t * Fpga_CutCreateSimple(Fpga_Man_t *p, Fpga_Node_t *pNode)
float Fpga_TimeCutComputeArrival(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
DECLARATIONS ///.
Fpga_Node_t * Fpga_NodeVecReadEntry(Fpga_NodeVec_t *p, int i)
void Fpga_MappingShow(Fpga_Man_t *pMan, char *pFileName)
void Fpga_NodeVecWriteEntry(Fpga_NodeVec_t *p, int i, Fpga_Node_t *Entry)
Fpga_Cut_t * Fpga_CutAlloc(Fpga_Man_t *p)
DECLARATIONS ///.
void Fpga_MappingShowNodes(Fpga_Man_t *pMan, Fpga_Node_t **ppRoots, int nRoots, char *pFileName)
void Fpga_NodeVecClear(Fpga_NodeVec_t *p)
void Fpga_NodeVecPushOrder(Fpga_NodeVec_t *vNodes, Fpga_Node_t *pNode, int fIncreasing)
float Fpga_TimeComputeArrivalMax(Fpga_Man_t *p)
float Fpga_MappingGetAreaFlow(Fpga_Man_t *p)
void Fpga_MappingCuts(Fpga_Man_t *p)
GLOBAL VARIABLES ///.
float Fpga_CutDerefSwitch(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
void Fpga_NodeVecPush(Fpga_NodeVec_t *p, Fpga_Node_t *Entry)
int Fpga_NodeGetFanoutNum(Fpga_Node_t *pNode)
float Fpga_CutGetAreaFlow(Fpga_Man_t *pMan, Fpga_Cut_t *pCut)
float Fpga_CutGetRootArea(Fpga_Man_t *p, Fpga_Cut_t *pCut)
int Fpga_CountLevels(Fpga_Man_t *pMan)
float Fpga_MappingGetSwitching(Fpga_Man_t *pMan, Fpga_NodeVec_t *vMapping)
Fpga_NodeVec_t * Fpga_MappingDfsNodes(Fpga_Man_t *pMan, Fpga_Node_t **ppNodes, int nNodes, int fEquiv)