ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
if.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "misc/vec/vec.h"
#include "misc/mem/mem.h"
#include "misc/tim/tim.h"
#include "misc/util/utilNam.h"
#include "misc/vec/vecMem.h"
#include "misc/util/utilTruth.h"
#include "opt/dau/dau.h"
#include "misc/vec/vecHash.h"
#include "misc/vec/vecWec.h"
#include "map/if/acd/ac_wrapper.h"
Include dependency graph for if.h:

Go to the source code of this file.

Classes

struct  Ifif_Par_t_
 
struct  If_Par_t_
 
struct  If_LibLut_t_
 
struct  If_Man_t_
 
struct  If_Cut_t_
 
struct  If_Set_t_
 
struct  If_Obj_t_
 
struct  If_Box_t_
 
struct  If_LibBox_t_
 

Macros

#define IF_MAX_LUTSIZE   32
 INCLUDES ///.
 
#define IF_MAX_FUNC_LUTSIZE   15
 
#define IF_INFINITY   100000000
 
#define IF_COST_MAX   4095
 
#define IF_BIG_CHAR   ((char)120)
 
#define IF_MIN(a, b)
 MACRO DEFINITIONS ///.
 
#define IF_MAX(a, b)
 
#define IF_FLOAT_LARGE   ((float)1.0e+20)
 
#define IF_FLOAT_SMALL   ((float)1.0e-20)
 
#define IF_INT_LARGE   (10000000)
 
#define If_ManForEachCi(p, pObj, i)
 
#define If_ManForEachCo(p, pObj, i)
 
#define If_ManForEachPi(p, pObj, i)
 
#define If_ManForEachPo(p, pObj, i)
 
#define If_ManForEachLatchInput(p, pObj, i)
 
#define If_ManForEachLatchOutput(p, pObj, i)
 
#define If_ManForEachObj(p, pObj, i)
 
#define If_ManForEachObjReverse(p, pObj, i)
 
#define If_ManForEachNode(p, pObj, i)
 
#define If_ObjForEachCut(pObj, pCut, i)
 
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
 
#define If_CutForEachLeafReverse(p, pCut, pLeaf, i)
 
#define If_CutForEachLeafSeq(p, pCut, pLeaf, Shift, i)
 

Typedefs

typedef struct If_Man_t_ If_Man_t
 BASIC TYPES ///.
 
typedef struct If_Par_t_ If_Par_t
 
typedef struct If_Obj_t_ If_Obj_t
 
typedef struct If_Cut_t_ If_Cut_t
 
typedef struct If_Set_t_ If_Set_t
 
typedef struct If_LibLut_t_ If_LibLut_t
 
typedef struct If_LibBox_t_ If_LibBox_t
 
typedef struct If_DsdMan_t_ If_DsdMan_t
 
typedef struct Ifn_Ntk_t_ Ifn_Ntk_t
 
typedef struct Ifif_Par_t_ Ifif_Par_t
 
typedef struct If_Box_t_ If_Box_t
 

Enumerations

enum  If_Type_t {
  IF_NONE , IF_CONST1 , IF_CI , IF_CO ,
  IF_AND , IF_VOID
}
 

Functions

void If_ManSetDefaultPars (If_Par_t *pPars)
 FUNCTION DECLARATIONS ///.
 
int If_ManPerformMapping (If_Man_t *p)
 
int If_ManPerformMappingComb (If_Man_t *p)
 
void If_ManComputeSwitching (If_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
int If_CutVerifyCuts (If_Set_t *pCutSet, int fOrdered)
 
int If_CutFilter (If_Set_t *pCutSet, If_Cut_t *pCut, int fSaveCut0)
 
void If_CutSort (If_Man_t *p, If_Set_t *pCutSet, If_Cut_t *pCut)
 
void If_CutOrder (If_Cut_t *pCut)
 
int If_CutMergeOrdered (If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
 
int If_CutMerge (If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
 
int If_CutCheck (If_Cut_t *pCut)
 
void If_CutPrint (If_Cut_t *pCut)
 
void If_CutPrintTiming (If_Man_t *p, If_Cut_t *pCut)
 
void If_CutLift (If_Cut_t *pCut)
 
float If_CutAreaFlow (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutEdgeFlow (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutPowerFlow (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
 
float If_CutAverageRefs (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutAreaDeref (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutAreaRef (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutAreaDerefed (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutAreaRefed (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutEdgeDeref (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutEdgeRef (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutEdgeDerefed (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutEdgeRefed (If_Man_t *p, If_Cut_t *pCut)
 
float If_CutPowerDeref (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
 
float If_CutPowerRef (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
 
float If_CutPowerDerefed (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
 
float If_CutPowerRefed (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
 
word If_CutPerformDerive07 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck07 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck08 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck10 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck16 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheckXX (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck45 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck54 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutPerformCheck75 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
float If_CutDelayLutStruct (If_Man_t *p, If_Cut_t *pCut, char *pStr, float WireDelay)
 
int If_CluCheckExt (void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
 
int If_CluCheckExt3 (void *p, word *pTruth, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot, char *pLut0, char *pLut1, char *pLut2, word *pFunc0, word *pFunc1, word *pFunc2)
 
int If_CluCheckXXExt (void *p, word *pTruth, int nVars, int nLutLeaf, int nLutRoot, char *pLut0, char *pLut1, word *pFunc0, word *pFunc1)
 
int If_MatchCheck1 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_MatchCheck2 (If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
 
int If_CutDelaySop (If_Man_t *p, If_Cut_t *pCut)
 
int If_CutSopBalanceEvalInt (Vec_Int_t *vCover, int *pTimes, int *pFaninLits, Vec_Int_t *vAig, int *piRes, int nSuppAll, int *pArea)
 
int If_CutSopBalanceEval (If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
 
int If_CutSopBalancePinDelaysInt (Vec_Int_t *vCover, int *pTimes, word *pFaninRes, int nSuppAll, word *pRes)
 
int If_CutSopBalancePinDelays (If_Man_t *p, If_Cut_t *pCut, char *pPerm)
 
int If_CutLutBalanceEval (If_Man_t *p, If_Cut_t *pCut)
 
int If_CutLutBalancePinDelays (If_Man_t *p, If_Cut_t *pCut, char *pPerm)
 
int If_LutDecEval (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
 
int If_Lut2DecEval (If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
 
int If_LutDecReEval (If_Man_t *p, If_Cut_t *pCut)
 
float If_LutDecPinRequired (If_Man_t *p, If_Cut_t *pCut, int i, float required)
 
If_DsdMan_tIf_DsdManAlloc (int nVars, int nLutSize)
 
void If_DsdManAllocIsops (If_DsdMan_t *p, int nLutSize)
 
void If_DsdManPrint (If_DsdMan_t *p, char *pFileName, int Number, int Support, int fOccurs, int fTtDump, int fVerbose)
 
void If_DsdManTune (If_DsdMan_t *p, int LutSize, int fFast, int fAdd, int fSpec, int fVerbose)
 
void Id_DsdManTuneStr (If_DsdMan_t *p, char *pStruct, int nConfls, int nProcs, int nInputs, int fVerbose)
 
void If_DsdManFree (If_DsdMan_t *p, int fVerbose)
 
void If_DsdManSave (If_DsdMan_t *p, char *pFileName)
 
If_DsdMan_tIf_DsdManLoad (char *pFileName)
 
void If_DsdManMerge (If_DsdMan_t *p, If_DsdMan_t *pNew)
 
void If_DsdManCleanOccur (If_DsdMan_t *p, int fVerbose)
 
void If_DsdManCleanMarks (If_DsdMan_t *p, int fVerbose)
 
void If_DsdManInvertMarks (If_DsdMan_t *p, int fVerbose)
 
If_DsdMan_tIf_DsdManFilter (If_DsdMan_t *p, int Limit)
 
int If_DsdManCompute (If_DsdMan_t *p, word *pTruth, int nLeaves, unsigned char *pPerm, char *pLutStruct)
 
char * If_DsdManFileName (If_DsdMan_t *p)
 FUNCTION DEFINITIONS ///.
 
int If_DsdManVarNum (If_DsdMan_t *p)
 
int If_DsdManObjNum (If_DsdMan_t *p)
 
int If_DsdManLutSize (If_DsdMan_t *p)
 
int If_DsdManTtBitNum (If_DsdMan_t *p)
 
int If_DsdManPermBitNum (If_DsdMan_t *p)
 
void If_DsdManSetLutSize (If_DsdMan_t *p, int nLutSize)
 
int If_DsdManSuppSize (If_DsdMan_t *p, int iDsd)
 
int If_DsdManCheckDec (If_DsdMan_t *p, int iDsd)
 
int If_DsdManReadMark (If_DsdMan_t *p, int iDsd)
 
void If_DsdManSetNewAsUseless (If_DsdMan_t *p)
 
wordIf_DsdManGetFuncConfig (If_DsdMan_t *p, int iDsd)
 
char * If_DsdManGetCellStr (If_DsdMan_t *p)
 
unsigned If_DsdManCheckXY (If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
 
int If_CutDsdBalanceEval (If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
 
int If_CutDsdBalancePinDelays (If_Man_t *p, If_Cut_t *pCut, char *pPerm)
 
void Id_DsdManTuneThresh (If_DsdMan_t *p, int fUnate, int fThresh, int fThreshHeuristic, int fVerbose)
 
If_LibLut_tIf_LibLutRead (char *FileName)
 
If_LibLut_tIf_LibLutDup (If_LibLut_t *p)
 
void If_LibLutFree (If_LibLut_t *pLutLib)
 
void If_LibLutPrint (If_LibLut_t *pLutLib)
 
int If_LibLutDelaysAreDiscrete (If_LibLut_t *pLutLib)
 
int If_LibLutDelaysAreDifferent (If_LibLut_t *pLutLib)
 
If_LibLut_tIf_LibLutSetSimple (int nLutSize)
 
float If_LibLutFastestPinDelay (If_LibLut_t *p)
 
float If_LibLutSlowestPinDelay (If_LibLut_t *p)
 
If_LibBox_tIf_LibBoxStart ()
 
void If_LibBoxFree (If_LibBox_t *p)
 
int If_LibBoxNum (If_LibBox_t *p)
 
If_Box_tIf_LibBoxReadBox (If_LibBox_t *p, int Id)
 
If_Box_tIf_LibBoxFindBox (If_LibBox_t *p, char *pName)
 
void If_LibBoxAdd (If_LibBox_t *p, If_Box_t *pBox)
 
If_LibBox_tIf_LibBoxRead (char *pFileName)
 
If_LibBox_tIf_LibBoxRead2 (char *pFileName)
 
void If_LibBoxPrint (FILE *pFile, If_LibBox_t *p)
 
void If_LibBoxWrite (char *pFileName, If_LibBox_t *p)
 
int If_LibBoxLoad (char *pFileName)
 
If_Box_tIf_BoxStart (char *pName, int Id, int nPis, int nPos, int fSeq, int fBlack, int fOuter)
 FUNCTION DEFINITIONS ///.
 
If_Man_tIf_ManStart (If_Par_t *pPars)
 FUNCTION DEFINITIONS ///.
 
void If_ManRestart (If_Man_t *p)
 
void If_ManStop (If_Man_t *p)
 
If_Obj_tIf_ManCreateCi (If_Man_t *p)
 
If_Obj_tIf_ManCreateCo (If_Man_t *p, If_Obj_t *pDriver)
 
If_Obj_tIf_ManCreateAnd (If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
 
If_Obj_tIf_ManCreateXor (If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
 
If_Obj_tIf_ManCreateMux (If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1, If_Obj_t *pCtrl)
 
void If_ManCreateChoice (If_Man_t *p, If_Obj_t *pRepr)
 
void If_ManSetupCutTriv (If_Man_t *p, If_Cut_t *pCut, int ObjId)
 
void If_ManSetupCiCutSets (If_Man_t *p)
 
If_Set_tIf_ManSetupNodeCutSet (If_Man_t *p, If_Obj_t *pObj)
 
void If_ManDerefNodeCutSet (If_Man_t *p, If_Obj_t *pObj)
 
void If_ManDerefChoiceCutSet (If_Man_t *p, If_Obj_t *pObj)
 
void If_ManSetupSetAll (If_Man_t *p, int nCrossCut)
 
int * If_CutArrTimeProfile (If_Man_t *p, If_Cut_t *pCut)
 
void If_ObjPerformMappingAnd (If_Man_t *p, If_Obj_t *pObj, int Mode, int fPreprocess, int fFirst)
 
void If_ObjPerformMappingChoice (If_Man_t *p, If_Obj_t *pObj, int Mode, int fPreprocess)
 
int If_ManPerformMappingRound (If_Man_t *p, int nCutsUsed, int Mode, int fPreprocess, int fFirst, char *pLabel)
 
void If_ManImproveMapping (If_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void * If_ManSatBuildXY (int nLutSize)
 DECLARATIONS ///.
 
void * If_ManSatBuildXYZ (int nLutSize)
 
void If_ManSatUnbuild (void *p)
 
int If_ManSatCheckXY (void *pSat, int nLutSize, word *pTruth, int nVars, unsigned uSet, word *pTBound, word *pTFree, Vec_Int_t *vLits)
 
unsigned If_ManSatCheckXYall (void *pSat, int nLutSize, word *pTruth, int nVars, Vec_Int_t *vLits)
 
int If_ManPerformMappingSeq (If_Man_t *p)
 
float If_CutDelay (If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
 
void If_CutPropagateRequired (If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut, float Required)
 
float If_ManDelayMax (If_Man_t *p, int fSeq)
 
void If_ManComputeRequired (If_Man_t *p)
 
void If_CutRotatePins (If_Man_t *p, If_Cut_t *pCut)
 
int If_CutComputeTruth (If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
 
int If_CutComputeTruthPerm (If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
 
Vec_Mem_tIf_DeriveHashTable6 (int nVars, word Truth)
 
int If_CutCheckTruth6 (If_Man_t *p, If_Cut_t *pCut)
 
Ifn_Ntk_tIfn_NtkParse (char *pStr)
 
int Ifn_NtkTtBits (char *pStr)
 
int Ifn_NtkMatch (Ifn_Ntk_t *p, word *pTruth, int nVars, int nConfls, int fVerbose, int fVeryVerbose, word *pConfig)
 
void Ifn_NtkPrint (Ifn_Ntk_t *p)
 
int Ifn_NtkLutSizeMax (Ifn_Ntk_t *p)
 
int Ifn_NtkInputNum (Ifn_Ntk_t *p)
 
void * If_ManSatBuildFromCell (char *pStr, Vec_Int_t **pvPiVars, Vec_Int_t **pvPoVars, Ifn_Ntk_t **ppNtk)
 
int If_ManSatFindCofigBits (void *pSat, Vec_Int_t *vPiVars, Vec_Int_t *vPoVars, word *pTruth, int nVars, word Perm, int nInps, Vec_Int_t *vValues)
 
int If_ManSatDeriveGiaFromBits (void *pNew, Ifn_Ntk_t *p, word *pTtData, Vec_Int_t *vLeaves, Vec_Int_t *vValues)
 
void * If_ManDeriveGiaFromCells (void *p)
 
void If_ManCleanNodeCopy (If_Man_t *p)
 DECLARATIONS ///.
 
void If_ManCleanCutData (If_Man_t *p)
 
void If_ManCleanMarkV (If_Man_t *p)
 
float If_ManScanMapping (If_Man_t *p)
 
float If_ManScanMappingDirect (If_Man_t *p)
 
float If_ManScanMappingSeq (If_Man_t *p)
 
void If_ManResetOriginalRefs (If_Man_t *p)
 
int If_ManCrossCut (If_Man_t *p)
 
Vec_Ptr_tIf_ManReverseOrder (If_Man_t *p)
 
void If_ManMarkMapping (If_Man_t *p)
 
Vec_Ptr_tIf_ManCollectMappingDirect (If_Man_t *p)
 
Vec_Int_tIf_ManCollectMappingInt (If_Man_t *p)
 
int If_ManCountSpecialPos (If_Man_t *p)
 
void If_CutTraverse (If_Man_t *p, If_Obj_t *pRoot, If_Cut_t *pCut, Vec_Ptr_t *vNodes)
 
void If_ObjPrint (If_Obj_t *pObj)
 
int acd_evaluate (word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned *cost, int try_no_late_arrival)
 
int acd_decompose (word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned char *decomposition)
 
int acd2_evaluate (word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned *cost, int try_no_late_arrival)
 
int acd2_decompose (word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned char *decomposition)
 

Macro Definition Documentation

◆ IF_BIG_CHAR

#define IF_BIG_CHAR   ((char)120)

Definition at line 61 of file if.h.

◆ IF_COST_MAX

#define IF_COST_MAX   4095

Definition at line 59 of file if.h.

◆ If_CutForEachLeaf

#define If_CutForEachLeaf ( p,
pCut,
pLeaf,
i )
Value:
for ( i = 0; (i < (int)(pCut)->nLeaves) && ((pLeaf) = If_ManObj(p, (pCut)->pLeaves[i])); i++ )
Cube * p
Definition exorList.c:222

Definition at line 503 of file if.h.

503#define If_CutForEachLeaf( p, pCut, pLeaf, i ) \
504 for ( i = 0; (i < (int)(pCut)->nLeaves) && ((pLeaf) = If_ManObj(p, (pCut)->pLeaves[i])); i++ )

◆ If_CutForEachLeafReverse

#define If_CutForEachLeafReverse ( p,
pCut,
pLeaf,
i )
Value:
for ( i = (int)(pCut)->nLeaves - 1; (i >= 0) && ((pLeaf) = If_ManObj(p, (pCut)->pLeaves[i])); i-- )

Definition at line 505 of file if.h.

505#define If_CutForEachLeafReverse( p, pCut, pLeaf, i ) \
506 for ( i = (int)(pCut)->nLeaves - 1; (i >= 0) && ((pLeaf) = If_ManObj(p, (pCut)->pLeaves[i])); i-- )

◆ If_CutForEachLeafSeq

#define If_CutForEachLeafSeq ( p,
pCut,
pLeaf,
Shift,
i )
Value:
for ( i = 0; (i < (int)(pCut)->nLeaves) && ((pLeaf) = If_ManObj(p, (pCut)->pLeaves[i] >> 8)) && (((Shift) = ((pCut)->pLeaves[i] & 255)) >= 0); i++ )

Definition at line 510 of file if.h.

510#define If_CutForEachLeafSeq( p, pCut, pLeaf, Shift, i ) \
511 for ( i = 0; (i < (int)(pCut)->nLeaves) && ((pLeaf) = If_ManObj(p, (pCut)->pLeaves[i] >> 8)) && (((Shift) = ((pCut)->pLeaves[i] & 255)) >= 0); i++ )

◆ IF_FLOAT_LARGE

#define IF_FLOAT_LARGE   ((float)1.0e+20)

Definition at line 469 of file if.h.

◆ IF_FLOAT_SMALL

#define IF_FLOAT_SMALL   ((float)1.0e-20)

Definition at line 470 of file if.h.

◆ IF_INFINITY

#define IF_INFINITY   100000000

Definition at line 57 of file if.h.

◆ IF_INT_LARGE

#define IF_INT_LARGE   (10000000)

Definition at line 471 of file if.h.

◆ If_ManForEachCi

#define If_ManForEachCi ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( If_Obj_t *, p->vCis, pObj, i )
struct If_Obj_t_ If_Obj_t
Definition if.h:79
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

Definition at line 474 of file if.h.

474#define If_ManForEachCi( p, pObj, i ) \
475 Vec_PtrForEachEntry( If_Obj_t *, p->vCis, pObj, i )

◆ If_ManForEachCo

#define If_ManForEachCo ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( If_Obj_t *, p->vCos, pObj, i )

Definition at line 477 of file if.h.

477#define If_ManForEachCo( p, pObj, i ) \
478 Vec_PtrForEachEntry( If_Obj_t *, p->vCos, pObj, i )

◆ If_ManForEachLatchInput

#define If_ManForEachLatchInput ( p,
pObj,
i )
Value:
Vec_PtrForEachEntryStart( If_Obj_t *, p->vCos, pObj, i, If_ManCoNum(p) - p->pPars->nLatchesCo )
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition vecPtr.h:57

Definition at line 486 of file if.h.

486#define If_ManForEachLatchInput( p, pObj, i ) \
487 Vec_PtrForEachEntryStart( If_Obj_t *, p->vCos, pObj, i, If_ManCoNum(p) - p->pPars->nLatchesCo )

◆ If_ManForEachLatchOutput

#define If_ManForEachLatchOutput ( p,
pObj,
i )
Value:
Vec_PtrForEachEntryStartStop( If_Obj_t *, p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatchesCi - p->pPars->nLatchesCiBox, If_ManCiNum(p) - p->pPars->nLatchesCiBox )
#define Vec_PtrForEachEntryStartStop(Type, vVec, pEntry, i, Start, Stop)
Definition vecPtr.h:61

Definition at line 488 of file if.h.

488#define If_ManForEachLatchOutput( p, pObj, i ) \
489 Vec_PtrForEachEntryStartStop( If_Obj_t *, p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatchesCi - p->pPars->nLatchesCiBox, If_ManCiNum(p) - p->pPars->nLatchesCiBox )

◆ If_ManForEachNode

#define If_ManForEachNode ( p,
pObj,
i )
Value:
If_ManForEachObj( p, pObj, i ) if ( pObj->Type != IF_AND ) {} else
#define If_ManForEachObj(p, pObj, i)
Definition if.h:491
@ IF_AND
Definition if.h:69

Definition at line 497 of file if.h.

497#define If_ManForEachNode( p, pObj, i ) \
498 If_ManForEachObj( p, pObj, i ) if ( pObj->Type != IF_AND ) {} else

◆ If_ManForEachObj

#define If_ManForEachObj ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( If_Obj_t *, p->vObjs, pObj, i )

Definition at line 491 of file if.h.

491#define If_ManForEachObj( p, pObj, i ) \
492 Vec_PtrForEachEntry( If_Obj_t *, p->vObjs, pObj, i )

◆ If_ManForEachObjReverse

#define If_ManForEachObjReverse ( p,
pObj,
i )
Value:
Vec_PtrForEachEntry( If_Obj_t *, p->vObjsRev, pObj, i )

Definition at line 494 of file if.h.

494#define If_ManForEachObjReverse( p, pObj, i ) \
495 Vec_PtrForEachEntry( If_Obj_t *, p->vObjsRev, pObj, i )

◆ If_ManForEachPi

#define If_ManForEachPi ( p,
pObj,
i )
Value:
Vec_PtrForEachEntryStop( If_Obj_t *, p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatchesCi - p->pPars->nLatchesCiBox )
#define Vec_PtrForEachEntryStop(Type, vVec, pEntry, i, Stop)
Definition vecPtr.h:59

Definition at line 480 of file if.h.

480#define If_ManForEachPi( p, pObj, i ) \
481 Vec_PtrForEachEntryStop( If_Obj_t *, p->vCis, pObj, i, If_ManCiNum(p) - p->pPars->nLatchesCi - p->pPars->nLatchesCiBox )

◆ If_ManForEachPo

#define If_ManForEachPo ( p,
pObj,
i )
Value:
Vec_PtrForEachEntryStartStop( If_Obj_t *, p->vCos, pObj, i, p->pPars->nLatchesCoBox, If_ManCoNum(p) - p->pPars->nLatchesCo )

Definition at line 483 of file if.h.

483#define If_ManForEachPo( p, pObj, i ) \
484 Vec_PtrForEachEntryStartStop( If_Obj_t *, p->vCos, pObj, i, p->pPars->nLatchesCoBox, If_ManCoNum(p) - p->pPars->nLatchesCo )

◆ IF_MAX

#define IF_MAX ( a,
b )
Value:
(((a) > (b))? (a) : (b))

Definition at line 466 of file if.h.

◆ IF_MAX_FUNC_LUTSIZE

#define IF_MAX_FUNC_LUTSIZE   15

Definition at line 55 of file if.h.

◆ IF_MAX_LUTSIZE

#define IF_MAX_LUTSIZE   32

INCLUDES ///.

CFile****************************************************************

FileName [if.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [FPGA mapping based on priority cuts.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 21, 2006.]

Revision [

Id
if.h,v 1.00 2006/11/21 00:00:00 alanmi Exp

] PARAMETERS ///

Definition at line 53 of file if.h.

◆ IF_MIN

#define IF_MIN ( a,
b )
Value:
(((a) < (b))? (a) : (b))

MACRO DEFINITIONS ///.

Definition at line 465 of file if.h.

◆ If_ObjForEachCut

#define If_ObjForEachCut ( pObj,
pCut,
i )
Value:
for ( i = 0; (i < (pObj)->pCutSet->nCuts) && ((pCut) = (pObj)->pCutSet->ppCuts[i]); i++ )

Definition at line 500 of file if.h.

500#define If_ObjForEachCut( pObj, pCut, i ) \
501 for ( i = 0; (i < (pObj)->pCutSet->nCuts) && ((pCut) = (pObj)->pCutSet->ppCuts[i]); i++ )

Typedef Documentation

◆ If_Box_t

typedef struct If_Box_t_ If_Box_t

Definition at line 364 of file if.h.

◆ If_Cut_t

typedef struct If_Cut_t_ If_Cut_t

Definition at line 80 of file if.h.

◆ If_DsdMan_t

typedef struct If_DsdMan_t_ If_DsdMan_t

Definition at line 84 of file if.h.

◆ If_LibBox_t

typedef struct If_LibBox_t_ If_LibBox_t

Definition at line 83 of file if.h.

◆ If_LibLut_t

typedef struct If_LibLut_t_ If_LibLut_t

Definition at line 82 of file if.h.

◆ If_Man_t

typedef struct If_Man_t_ If_Man_t

BASIC TYPES ///.

Definition at line 77 of file if.h.

◆ If_Obj_t

typedef struct If_Obj_t_ If_Obj_t

Definition at line 79 of file if.h.

◆ If_Par_t

typedef struct If_Par_t_ If_Par_t

Definition at line 78 of file if.h.

◆ If_Set_t

typedef struct If_Set_t_ If_Set_t

Definition at line 81 of file if.h.

◆ Ifif_Par_t

typedef struct Ifif_Par_t_ Ifif_Par_t

Definition at line 87 of file if.h.

◆ Ifn_Ntk_t

typedef struct Ifn_Ntk_t_ Ifn_Ntk_t

Definition at line 85 of file if.h.

Enumeration Type Documentation

◆ If_Type_t

enum If_Type_t
Enumerator
IF_NONE 
IF_CONST1 
IF_CI 
IF_CO 
IF_AND 
IF_VOID 

Definition at line 64 of file if.h.

64 {
65 IF_NONE, // 0: non-existent object
66 IF_CONST1, // 1: constant 1
67 IF_CI, // 2: combinational input
68 IF_CO, // 3: combinational output
69 IF_AND, // 4: AND node
70 IF_VOID // 5: unused object
71} If_Type_t;
If_Type_t
Definition if.h:64
@ IF_CO
Definition if.h:68
@ IF_VOID
Definition if.h:70
@ IF_NONE
Definition if.h:65
@ IF_CONST1
Definition if.h:66
@ IF_CI
Definition if.h:67

Function Documentation

◆ acd2_decompose()

int acd2_decompose ( word * pTruth,
unsigned nVars,
int lutSize,
unsigned * pdelay,
unsigned char * decomposition )
extern

Definition at line 98 of file ac_wrapper.cpp.

99{
100 using namespace acd;
101
102 acdXX_params ps;
103 ps.lut_size = lutSize;
104 ps.max_shared_vars = lutSize - 2;
105 acdXX_impl acd( nVars, ps );
106 acd.run( pTruth, *pdelay );
107 int val = acd.compute_decomposition();
108
109 if ( val != 0 )
110 {
111 *pdelay = 0;
112 return -1;
113 }
114
115 *pdelay = acd.get_profile();
116
117 acd.get_decomposition( decomposition );
118 return 0;
119}
uint32_t lut_size
Definition acdXX.hpp:55
uint32_t max_shared_vars
Definition acdXX.hpp:58
Here is the caller graph for this function:

◆ acd2_evaluate()

int acd2_evaluate ( word * pTruth,
unsigned nVars,
int lutSize,
unsigned * pdelay,
unsigned * cost,
int try_no_late_arrival )
extern

Definition at line 75 of file ac_wrapper.cpp.

76{
77 using namespace acd;
78
79 acdXX_params ps;
80 ps.lut_size = lutSize;
81 ps.max_shared_vars = lutSize - 2;
82 acdXX_impl acd( nVars, ps );
83 int val = acd.run( pTruth, *pdelay );
84
85 if ( val == 0 )
86 {
87 *pdelay = 0;
88 return -1;
89 }
90
91 acd.compute_decomposition();
92 *pdelay = acd.get_profile();
93 *cost = 2;
94
95 return val;
96}
Here is the caller graph for this function:

◆ acd_decompose()

int acd_decompose ( word * pTruth,
unsigned nVars,
int lutSize,
unsigned * pdelay,
unsigned char * decomposition )
extern

Definition at line 51 of file ac_wrapper.cpp.

52{
53 using namespace acd;
54
56 ps.lut_size = lutSize;
57 ps.use_first = true;
59
60 ac_decomposition_impl acd( nVars, ps, &st );
61 acd.run( pTruth, *pdelay );
62 int val = acd.compute_decomposition();
63
64 if ( val < 0 )
65 {
66 *pdelay = 0;
67 return -1;
68 }
69
70 *pdelay = acd.get_profile();
71 acd.get_decomposition( decomposition );
72 return 0;
73}
Parameters for ac_decomposition.
bool use_first
Use the first feasible decomposition found.
uint32_t lut_size
LUT size for decomposition (3 < num < 7).
Statistics for ac_decomposition.
Here is the caller graph for this function:

◆ acd_evaluate()

int acd_evaluate ( word * pTruth,
unsigned nVars,
int lutSize,
unsigned * pdelay,
unsigned * cost,
int try_no_late_arrival )
extern

C++File**************************************************************

FileName [ac_wrapper.cpp]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Ashenhurst-Curtis decomposition.]

Synopsis [Interface with the FPGA mapping package.]

Author [Alessandro Tempia Calvino]

Affiliation [EPFL]

Date [Ver. 1.0. Started - November 20, 2023.]

Definition at line 26 of file ac_wrapper.cpp.

27{
28 using namespace acd;
29
31 ps.lut_size = lutSize;
32 ps.use_first = false;
33 ps.try_no_late_arrival = static_cast<bool>( try_no_late_arrival );
35
36 ac_decomposition_impl acd( nVars, ps, &st );
37 int val = acd.run( pTruth, *pdelay );
38
39 if ( val < 0 )
40 {
41 *pdelay = 0;
42 return -1;
43 }
44
45 *pdelay = acd.get_profile();
46 *cost = st.num_luts;
47
48 return val;
49}
bool try_no_late_arrival
If decomposition with delay profile fails, try without.
Here is the caller graph for this function:

◆ Id_DsdManTuneStr()

void Id_DsdManTuneStr ( If_DsdMan_t * p,
char * pStruct,
int nConfls,
int nProcs,
int nInputs,
int fVerbose )
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2557 of file ifDsd.c.

2558{
2559 Id_DsdManTuneStr1( p, pStruct, nConfls, fVerbose );
2560}
void Id_DsdManTuneStr1(If_DsdMan_t *p, char *pStruct, int nConfls, int fVerbose)
Definition ifDsd.c:2469
Here is the call graph for this function:

◆ Id_DsdManTuneThresh()

void Id_DsdManTuneThresh ( If_DsdMan_t * p,
int fUnate,
int fThresh,
int fThreshHeuristic,
int fVerbose )
extern

◆ If_BoxStart()

If_Box_t * If_BoxStart ( char * pName,
int Id,
int nPis,
int nPos,
int fSeq,
int fBlack,
int fOuter )
extern

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file ifLibBox.c.

50{
51 If_Box_t * p;
52 p = ABC_CALLOC( If_Box_t, 1 );
53 p->pName = pName; // consumes memory
54 p->Id = Id;
55 p->fSeq = (char)fSeq;
56 p->fBlack = (char)fBlack;
57 p->fOuter = (char)fOuter;
58 p->nPis = nPis;
59 p->nPos = nPos;
60 p->pDelays = ABC_CALLOC( int, nPis * nPos );
61 return p;
62}
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
struct If_Box_t_ If_Box_t
Definition if.h:364
Here is the caller graph for this function:

◆ If_CluCheckExt()

int If_CluCheckExt ( void * p,
word * pTruth,
int nVars,
int nLutLeaf,
int nLutRoot,
char * pLut0,
char * pLut1,
word * pFunc0,
word * pFunc1 )
extern

Definition at line 2066 of file ifDec16.c.

2068{
2069 If_Man_t * p = (If_Man_t *)pMan;
2070 If_Grp_t G, R;
2071 G = If_CluCheck( p, pTruth, nVars, 0, 0, nLutLeaf, nLutRoot, &R, pFunc0, pFunc1, NULL, 0 );
2072 memcpy( pLut0, &R, sizeof(If_Grp_t) );
2073 memcpy( pLut1, &G, sizeof(If_Grp_t) );
2074// memcpy( pLut2, &G2, sizeof(If_Grp_t) );
2075 return (G.nVars > 0);
2076}
If_Grp_t If_CluCheck(If_Man_t *p, word *pTruth0, int nVars, int iVarStart, int iVarStop, int nLutLeaf, int nLutRoot, If_Grp_t *pR, word *pFunc0, word *pFunc1, word *pLeftOver, int fHashing)
Definition ifDec16.c:1553
struct If_Grp_t_ If_Grp_t
DECLARATIONS ///.
Definition ifDec16.c:37
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
Definition if.h:77
char nVars
Definition ifDec16.c:40
char * memcpy()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CluCheckExt3()

int If_CluCheckExt3 ( void * p,
word * pTruth,
int nVars,
int nLutLeaf,
int nLutLeaf2,
int nLutRoot,
char * pLut0,
char * pLut1,
char * pLut2,
word * pFunc0,
word * pFunc1,
word * pFunc2 )
extern

Definition at line 2079 of file ifDec16.c.

2081{
2082 If_Man_t * p = (If_Man_t *)pMan;
2083 If_Grp_t G, G2, R;
2084 G = If_CluCheck3( p, pTruth, nVars, nLutLeaf, nLutLeaf2, nLutRoot, &R, &G2, pFunc0, pFunc1, pFunc2 );
2085 memcpy( pLut0, &R, sizeof(If_Grp_t) );
2086 memcpy( pLut1, &G, sizeof(If_Grp_t) );
2087 memcpy( pLut2, &G2, sizeof(If_Grp_t) );
2088 return (G.nVars > 0);
2089}
If_Grp_t If_CluCheck3(If_Man_t *p, word *pTruth0, int nVars, int nLutLeaf, int nLutLeaf2, int nLutRoot, If_Grp_t *pR, If_Grp_t *pG2, word *pFunc0, word *pFunc1, word *pFunc2)
Definition ifDec16.c:1909
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CluCheckXXExt()

int If_CluCheckXXExt ( void * p,
word * pTruth,
int nVars,
int nLutLeaf,
int nLutRoot,
char * pLut0,
char * pLut1,
word * pFunc0,
word * pFunc1 )
extern

Definition at line 301 of file ifDec66.c.

303{
304 (void)pMan;
305 assert( nLutLeaf == nLutRoot );
306 unsigned char result[32];
307 int i;
308
309 if ( acdXX_decompose( pTruth, nLutRoot, nVars, result ) )
310 {
311 /* decomposition failed */
312 return 0;
313 }
314
315 /* copy LUT bound set */
316 unsigned char * pResult = result + 2;
317 int Lut1Size = (int) (*pResult++);
318 pLut1[0] = Lut1Size;
319 pLut1[1] = 0; /* not used */
320 for (i = 0; i < Lut1Size; ++i)
321 {
322 pLut1[2+i] = *pResult++;
323 }
324 int func_num_bytes = ( Lut1Size <= 3 ) ? 1 : ( 1 << ( Lut1Size - 3 ) );
325 *pFunc1 = 0;
326 for (i = 0; i < func_num_bytes; ++i)
327 {
328 *pFunc1 |= ( ( (word) *pResult++ ) & 0xFF ) << 8*i;
329 }
330
331 /* copy LUT composition */
332 int Lut0Size = (int) (*pResult++);
333 pLut0[0] = Lut0Size;
334 pLut0[1] = 0; /* not used */
335 for (i = 0; i < Lut0Size; ++i)
336 {
337 pLut0[2+i] = *pResult++;
338 }
339 func_num_bytes = ( Lut0Size <= 3 ) ? 1 : ( 1 << ( Lut0Size - 3 ) );
340 *pFunc0 = 0;
341 for (i = 0; i < func_num_bytes; ++i)
342 {
343 *pFunc0 |= ( ( (word) *pResult++ ) & 0xFF ) << 8*i;
344 }
345
346 *pFunc1 = If_CluAdjust2( *pFunc1, Lut1Size );
347 *pFunc0 = If_CluAdjust2( *pFunc0, Lut0Size );
348
349 return 1;
350}
int acdXX_decompose(word *pTruth, unsigned lutSize, unsigned nVars, unsigned char *decomposition)
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutAreaDeref()

float If_CutAreaDeref ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1056 of file ifCut.c.

1057{
1058 If_Obj_t * pLeaf;
1059 float Area;
1060 int i;
1061 Area = If_CutLutArea(p, pCut);
1062 If_CutForEachLeaf( p, pCut, pLeaf, i )
1063 {
1064 assert( pLeaf->nRefs > 0 );
1065 if ( --pLeaf->nRefs > 0 || !If_ObjIsAnd(pLeaf) )
1066 continue;
1067 Area += If_CutAreaDeref( p, If_ObjCutBest(pLeaf) );
1068 }
1069 return Area;
1070}
float If_CutAreaDeref(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1056
#define If_CutForEachLeaf(p, pCut, pLeaf, i)
Definition if.h:503
int nRefs
Definition if.h:346
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutAreaDerefed()

float If_CutAreaDerefed ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1110 of file ifCut.c.

1111{
1112 float aResult, aResult2;
1113 if ( pCut->nLeaves < 2 )
1114 return 0;
1115 aResult2 = If_CutAreaRef( p, pCut );
1116 aResult = If_CutAreaDeref( p, pCut );
1117 assert( aResult > aResult2 - 3*p->fEpsilon );
1118 assert( aResult < aResult2 + 3*p->fEpsilon );
1119 return aResult;
1120}
float If_CutAreaRef(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1083
unsigned nLeaves
Definition if.h:316
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutAreaFlow()

float If_CutAreaFlow ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area flow.]

Description []

SideEffects []

SeeAlso []

Definition at line 927 of file ifCut.c.

928{
929 If_Obj_t * pLeaf;
930 float Flow, AddOn;
931 int i;
932 Flow = If_CutLutArea(p, pCut);
933 If_CutForEachLeaf( p, pCut, pLeaf, i )
934 {
935 if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) )
936 AddOn = If_ObjCutBest(pLeaf)->Area;
937 else
938 {
939 assert( pLeaf->EstRefs > p->fEpsilon );
940 AddOn = If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
941 }
942 if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
943 Flow = (float)1e32;
944 else
945 {
946 Flow += AddOn;
947 if ( Flow > (float)1e32 )
948 Flow = (float)1e32;
949 }
950 }
951 return Flow;
952}
float EstRefs
Definition if.h:352
Here is the caller graph for this function:

◆ If_CutAreaRef()

float If_CutAreaRef ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1083 of file ifCut.c.

1084{
1085 If_Obj_t * pLeaf;
1086 float Area;
1087 int i;
1088 Area = If_CutLutArea(p, pCut);
1089 If_CutForEachLeaf( p, pCut, pLeaf, i )
1090 {
1091 assert( pLeaf->nRefs >= 0 );
1092 if ( pLeaf->nRefs++ > 0 || !If_ObjIsAnd(pLeaf) )
1093 continue;
1094 Area += If_CutAreaRef( p, If_ObjCutBest(pLeaf) );
1095 }
1096 return Area;
1097}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutAreaRefed()

float If_CutAreaRefed ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1133 of file ifCut.c.

1134{
1135 float aResult, aResult2;
1136 if ( pCut->nLeaves < 2 )
1137 return 0;
1138 aResult2 = If_CutAreaDeref( p, pCut );
1139 aResult = If_CutAreaRef( p, pCut );
1140// assert( aResult > aResult2 - p->fEpsilon );
1141// assert( aResult < aResult2 + p->fEpsilon );
1142 return aResult;
1143}
Here is the call graph for this function:

◆ If_CutArrTimeProfile()

int * If_CutArrTimeProfile ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Returns arrival time profile of the cut.]

Description [The procedure returns static storage, which should not be deallocated and is only valid until before the procedure is called again.]

SideEffects []

SeeAlso []

Definition at line 143 of file ifMap.c.

144{
145 int i;
146 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
147 p->pArrTimeProfile[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
148 return p->pArrTimeProfile;
149}
Here is the caller graph for this function:

◆ If_CutAverageRefs()

float If_CutAverageRefs ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Average number of references of the leaves.]

Description []

SideEffects []

SeeAlso []

Definition at line 1034 of file ifCut.c.

1035{
1036 If_Obj_t * pLeaf;
1037 int nRefsTotal, i;
1038 nRefsTotal = 0;
1039 If_CutForEachLeaf( p, pCut, pLeaf, i )
1040 nRefsTotal += pLeaf->nRefs;
1041 return ((float)nRefsTotal)/pCut->nLeaves;
1042}

◆ If_CutCheck()

int If_CutCheck ( If_Cut_t * pCut)
extern

Function*************************************************************

Synopsis [Checks correctness of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 834 of file ifCut.c.

835{
836 int i;
837 assert( pCut->nLeaves <= pCut->nLimit );
838 if ( pCut->nLeaves < 2 )
839 return 1;
840 for ( i = 1; i < (int)pCut->nLeaves; i++ )
841 {
842 if ( pCut->pLeaves[i-1] >= pCut->pLeaves[i] )
843 {
844 Abc_Print( -1, "If_CutCheck(): Cut has wrong ordering of inputs.\n" );
845 return 0;
846 }
847 assert( pCut->pLeaves[i-1] < pCut->pLeaves[i] );
848 }
849 return 1;
850}
int pLeaves[0]
Definition if.h:318
unsigned nLimit
Definition if.h:315

◆ If_CutCheckTruth6()

int If_CutCheckTruth6 ( If_Man_t * p,
If_Cut_t * pCut )
extern

Definition at line 396 of file ifTruth.c.

397{
398 if ( pCut->nLeaves != 6 )
399 return 0;
400 if ( p->vTtMem6 == NULL )
401 p->vTtMem6 = If_DeriveHashTable6( 6, ABC_CONST(0xfedcba9876543210) );
402 if ( *Vec_MemHashLookup( p->vTtMem6, If_CutTruthWR(p, pCut) ) == -1 )
403 return 0;
404 return 1;
405}
#define ABC_CONST(number)
PARAMETERS ///.
Definition abc_global.h:240
Vec_Mem_t * If_DeriveHashTable6(int nVars, word uTruth)
Definition ifTruth.c:345
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutComputeTruth()

int If_CutComputeTruth ( If_Man_t * p,
If_Cut_t * pCut,
If_Cut_t * pCut0,
If_Cut_t * pCut1,
int fCompl0,
int fCompl1 )
extern

Function*************************************************************

Synopsis [Truth table computation.]

Description []

SideEffects []

SeeAlso []

Definition at line 99 of file ifTruth.c.

100{
101 int fCompl, truthId, nLeavesNew, PrevSize, RetValue = 0;
102 word * pTruth0s = Vec_MemReadEntry( p->vTtMem[pCut0->nLeaves], Abc_Lit2Var(pCut0->iCutFunc) );
103 word * pTruth1s = Vec_MemReadEntry( p->vTtMem[pCut1->nLeaves], Abc_Lit2Var(pCut1->iCutFunc) );
104 word * pTruth0 = (word *)p->puTemp[0];
105 word * pTruth1 = (word *)p->puTemp[1];
106 word * pTruth = (word *)p->puTemp[2];
107 Abc_TtCopy( pTruth0, pTruth0s, p->nTruth6Words[pCut0->nLeaves], fCompl0 ^ pCut0->fCompl ^ Abc_LitIsCompl(pCut0->iCutFunc) );
108 Abc_TtCopy( pTruth1, pTruth1s, p->nTruth6Words[pCut1->nLeaves], fCompl1 ^ pCut1->fCompl ^ Abc_LitIsCompl(pCut1->iCutFunc) );
109 Abc_TtStretch6( pTruth0, pCut0->nLeaves, pCut->nLeaves );
110 Abc_TtStretch6( pTruth1, pCut1->nLeaves, pCut->nLeaves );
111 Abc_TtExpand( pTruth0, pCut->nLeaves, pCut0->pLeaves, pCut0->nLeaves, pCut->pLeaves, pCut->nLeaves );
112 Abc_TtExpand( pTruth1, pCut->nLeaves, pCut1->pLeaves, pCut1->nLeaves, pCut->pLeaves, pCut->nLeaves );
113 fCompl = (pTruth0[0] & pTruth1[0] & 1);
114 Abc_TtAnd( pTruth, pTruth0, pTruth1, p->nTruth6Words[pCut->nLeaves], fCompl );
115 if ( p->pPars->fCutMin && (pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || pCut0->nLeaves == 0 || pCut1->nLeaves == 0) )
116 {
117 nLeavesNew = Abc_TtMinBase( pTruth, pCut->pLeaves, pCut->nLeaves, pCut->nLeaves );
118 if ( nLeavesNew < If_CutLeaveNum(pCut) )
119 {
120 pCut->nLeaves = nLeavesNew;
121 pCut->uSign = If_ObjCutSignCompute( pCut );
122 RetValue = 1;
123 }
124 }
125 PrevSize = Vec_MemEntryNum( p->vTtMem[pCut->nLeaves] );
126 truthId = Vec_MemHashInsert( p->vTtMem[pCut->nLeaves], pTruth );
127 pCut->iCutFunc = Abc_Var2Lit( truthId, fCompl );
128 assert( (pTruth[0] & 1) == 0 );
129#ifdef IF_TRY_NEW
130 {
131 word pCopy[1024];
132 char pCanonPerm[16];
133 memcpy( pCopy, If_CutTruthW(pCut), sizeof(word) * p->nTruth6Words[pCut->nLeaves] );
134 Abc_TtCanonicize( pCopy, pCut->nLeaves, pCanonPerm );
135 }
136#endif
137 if ( p->vTtIsops[pCut->nLeaves] && PrevSize != Vec_MemEntryNum(p->vTtMem[pCut->nLeaves]) )
138 {
139 Vec_Int_t * vLevel = Vec_WecPushLevel( p->vTtIsops[pCut->nLeaves] );
140 fCompl = Kit_TruthIsop( (unsigned *)pTruth, pCut->nLeaves, p->vCover, 1 );
141 if ( fCompl >= 0 )
142 {
143 Vec_IntGrow( vLevel, Vec_IntSize(p->vCover) );
144 Vec_IntAppend( vLevel, p->vCover );
145 if ( fCompl )
146 vLevel->nCap ^= (1<<16); // hack to remember complemented attribute
147 }
148 assert( Vec_WecSize(p->vTtIsops[pCut->nLeaves]) == Vec_MemEntryNum(p->vTtMem[pCut->nLeaves]) );
149 }
150 return RetValue;
151}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
unsigned Abc_TtCanonicize(word *pTruth, int nVars, char *pCanonPerm)
FUNCTION DECLARATIONS ///.
Definition dauCanon.c:1036
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
Definition kitIsop.c:134
unsigned fCompl
Definition if.h:311
unsigned uSign
Definition if.h:309
int iCutFunc
Definition if.h:307
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutComputeTruthPerm()

int If_CutComputeTruthPerm ( If_Man_t * p,
If_Cut_t * pCut,
If_Cut_t * pCut0,
If_Cut_t * pCut1,
int fCompl0,
int fCompl1 )
extern

Definition at line 269 of file ifTruth.c.

270{
271 abctime clk = 0;
272 int i, Num, nEntriesOld, RetValue;
273 if ( pCut0->nLeaves + pCut1->nLeaves > pCut->nLeaves || iCutFunc0 < 2 || iCutFunc1 < 2 )
274 {
275if ( p->pPars->fVerbose )
276clk = Abc_Clock();
277 RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 );
278if ( p->pPars->fVerbose )
279p->timeCache[0] += Abc_Clock() - clk;
280 return RetValue;
281 }
282 assert( pCut0->nLeaves + pCut1->nLeaves == pCut->nLeaves );
283 nEntriesOld = Hash_IntManEntryNum(p->vPairHash);
284 Num = Hash_Int2ManInsert( p->vPairHash, (iCutFunc0 << 5)|pCut0->nLeaves, (iCutFunc1 << 5)|pCut1->nLeaves, -1 );
285 assert( Num > 0 );
286 if ( nEntriesOld == Hash_IntManEntryNum(p->vPairHash) )
287 {
288 char * pCanonPerm;
289 int v, pPerm[IF_MAX_LUTSIZE];
290 pCut->iCutFunc = Vec_IntEntry( p->vPairRes, Num );
291 // move complements from the fanin cuts
292 for ( v = 0; v < (int)pCut->nLeaves; v++ )
293 if ( v < (int)pCut0->nLeaves )
294 pCut->pLeaves[v] = Abc_Var2Lit( pCut->pLeaves[v], If_CutLeafBit(pCut0, v) );
295 else
296 pCut->pLeaves[v] = Abc_Var2Lit( pCut->pLeaves[v], If_CutLeafBit(pCut1, v-(int)pCut0->nLeaves) );
297 // reorder the cut
298 pCanonPerm = Vec_StrEntryP( p->vPairPerms, Num * pCut->nLimit );
299 for ( v = 0; v < (int)pCut->nLeaves; v++ )
300 pPerm[v] = Abc_LitNotCond( pCut->pLeaves[Abc_Lit2Var((int)pCanonPerm[v])], Abc_LitIsCompl((int)pCanonPerm[v]) );
301 // generate the result
302 pCut->uMaskFunc = 0;
303 for ( v = 0; v < (int)pCut->nLeaves; v++ )
304 {
305 pCut->pLeaves[v] = Abc_Lit2Var(pPerm[v]);
306 if ( Abc_LitIsCompl(pPerm[v]) )
307 pCut->uMaskFunc |= (1 << v);
308 }
309// printf( "Found: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves );
310 p->nCacheHits++;
311//p->timeCache[1] += Abc_Clock() - clk;
312 return 0;
313 }
314if ( p->pPars->fVerbose )
315clk = Abc_Clock();
316 p->nCacheMisses++;
317 RetValue = If_CutComputeTruthPerm_int( p, pCut, pCut0, pCut1, iCutFunc0, iCutFunc1 );
318 assert( RetValue == 0 );
319// printf( "Added: %d(%d) %d(%d) -> %d(%d)\n", iCutFunc0, pCut0->nLeaves, iCutFunc1, pCut0->nLeaves, pCut->iCutFunc, pCut->nLeaves );
320 // save the result
321 assert( Num == Vec_IntSize(p->vPairRes) );
322 Vec_IntPush( p->vPairRes, pCut->iCutFunc );
323 // save the permutation
324 assert( Num * (int)pCut->nLimit == Vec_StrSize(p->vPairPerms) );
325 for ( i = 0; i < (int)pCut->nLeaves; i++ )
326 Vec_StrPush( p->vPairPerms, (char)Abc_Var2Lit((int)p->pCanonPerm[i], ((p->uCanonPhase>>i)&1)) );
327 for ( i = (int)pCut0->nLeaves + (int)pCut1->nLeaves; i < (int)pCut->nLimit; i++ )
328 Vec_StrPush( p->vPairPerms, (char)-1 );
329if ( p->pPars->fVerbose )
330p->timeCache[2] += Abc_Clock() - clk;
331 return 0;
332}
ABC_INT64_T abctime
Definition abc_global.h:332
int If_CutComputeTruthPerm_int(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int iCutFunc0, int iCutFunc1)
Definition ifTruth.c:164
#define IF_MAX_LUTSIZE
INCLUDES ///.
Definition if.h:53
int uMaskFunc
Definition if.h:308
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutDelay()

float If_CutDelay ( If_Man_t * p,
If_Obj_t * pObj,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes delay.]

Description []

SideEffects []

SeeAlso []

Definition at line 91 of file ifTime.c.

92{
93 static int pPinPerm[IF_MAX_LUTSIZE];
94 static float pPinDelays[IF_MAX_LUTSIZE];
95 char * pPerm = If_CutPerm( pCut );
96 If_Obj_t * pLeaf;
97 float Delay, DelayCur;
98 float * pLutDelays;
99 int i, Shift, Pin2PinDelay;//, iLeaf;
100 Delay = -IF_FLOAT_LARGE;
101 if ( pCut->fAndCut )
102 {
103 If_CutForEachLeaf( p, pCut, pLeaf, i )
104 {
105 DelayCur = If_ObjCutBest(pLeaf)->Delay + p->pPars->nAndDelay;
106 Delay = IF_MAX( Delay, DelayCur );
107 }
108 }
109 else if ( p->pPars->pLutLib )
110 {
111 assert( !p->pPars->fLiftLeaves );
112 pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
113 if ( p->pPars->pLutLib->fVarPinDelays )
114 {
115 // compute the delay using sorted pins
116 If_CutSortInputPins( p, pCut, pPinPerm, pPinDelays );
117 for ( i = 0; i < (int)pCut->nLeaves; i++ )
118 {
119 DelayCur = pPinDelays[pPinPerm[i]] + pLutDelays[i];
120 Delay = IF_MAX( Delay, DelayCur );
121 }
122 }
123 else
124 {
125 If_CutForEachLeaf( p, pCut, pLeaf, i )
126 {
127 DelayCur = If_ObjCutBest(pLeaf)->Delay + pLutDelays[0];
128 Delay = IF_MAX( Delay, DelayCur );
129 }
130 }
131 }
132 else
133 {
134 if ( pCut->fUser )
135 {
136 assert( !p->pPars->fLiftLeaves );
137 If_CutForEachLeaf( p, pCut, pLeaf, i )
138 {
139 Pin2PinDelay = pPerm ? (pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pPerm[i]) : 1;
140 DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)Pin2PinDelay;
141 Delay = IF_MAX( Delay, DelayCur );
142 }
143 }
144 else
145 {
146 if ( p->pPars->fLiftLeaves )
147 {
148 If_CutForEachLeafSeq( p, pCut, pLeaf, Shift, i )
149 {
150 DelayCur = If_ObjCutBest(pLeaf)->Delay - Shift * p->Period;
151 Delay = IF_MAX( Delay, DelayCur + 1.0 );
152 }
153 }
154 else
155 {
156 If_CutForEachLeaf( p, pCut, pLeaf, i )
157 {
158 DelayCur = If_ObjCutBest(pLeaf)->Delay + 1.0;
159 Delay = IF_MAX( Delay, DelayCur );
160 }
161 }
162 }
163 }
164 return Delay;
165}
ABC_NAMESPACE_IMPL_START void If_CutSortInputPins(If_Man_t *p, If_Cut_t *pCut, int *pPinPerm, float *pPinDelays)
DECLARATIONS ///.
Definition ifTime.c:44
#define IF_BIG_CHAR
Definition if.h:61
#define IF_FLOAT_LARGE
Definition if.h:469
#define If_CutForEachLeafSeq(p, pCut, pLeaf, Shift, i)
Definition if.h:510
#define IF_MAX(a, b)
Definition if.h:466
unsigned fAndCut
Definition if.h:314
unsigned fUser
Definition if.h:312
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutDelayLutStruct()

float If_CutDelayLutStruct ( If_Man_t * p,
If_Cut_t * pCut,
char * pStr,
float WireDelay )
extern

Definition at line 2103 of file ifDec16.c.

2104{
2105 float Delays[CLU_VAR_MAX+2];
2106 int fUsed[CLU_VAR_MAX+2] = {0};
2107 If_Obj_t * pLeaf;
2108 If_Grp_t G1 = {0}, G2 = {0}, G3 = {0};
2109 int nLeaves = If_CutLeaveNum(pCut);
2110 int i, nLutLeaf, nLutRoot;
2111 // mark the cut as user cut
2112// pCut->fUser = 1;
2113 // quit if parameters are wrong
2114 if ( strlen(pStr) != 2 )
2115 {
2116 printf( "Wrong LUT struct (%s)\n", pStr );
2117 return ABC_INFINITY;
2118 }
2119 nLutLeaf = pStr[0] - '0';
2120 if ( nLutLeaf < 3 || nLutLeaf > 6 )
2121 {
2122 printf( "Leaf size (%d) should belong to {3,4,5,6}.\n", nLutLeaf );
2123 return ABC_INFINITY;
2124 }
2125 nLutRoot = pStr[1] - '0';
2126 if ( nLutRoot < 3 || nLutRoot > 6 )
2127 {
2128 printf( "Root size (%d) should belong to {3,4,5,6}.\n", nLutRoot );
2129 return ABC_INFINITY;
2130 }
2131 if ( nLeaves > nLutLeaf + nLutRoot - 1 )
2132 {
2133 printf( "The cut size (%d) is too large for the LUT structure %d%d.\n", If_CutLeaveNum(pCut), nLutLeaf, nLutRoot );
2134 return ABC_INFINITY;
2135 }
2136
2137 // remember the delays
2138 If_CutForEachLeaf( p, pCut, pLeaf, i )
2139 Delays[i] = If_ObjCutBest(pLeaf)->Delay;
2140
2141 // consider easy case
2142 if ( nLeaves <= Abc_MaxInt( nLutLeaf, nLutRoot ) )
2143 {
2144 char * pPerm = If_CutPerm( pCut );
2145 assert( nLeaves <= 6 );
2146 for ( i = 0; i < nLeaves; i++ )
2147 {
2148 pPerm[i] = 1;
2149 G1.pVars[i] = i;
2150 }
2151 G1.nVars = nLeaves;
2152 return 1.0 + If_CluDelayMax( &G1, Delays );
2153 }
2154
2155 // derive the first group
2156 G1 = If_CluCheck( p, If_CutTruthW(p, pCut), nLeaves, 0, 0, nLutLeaf, nLutRoot, NULL, NULL, NULL, NULL, 1 );
2157 if ( G1.nVars == 0 )
2158 return ABC_INFINITY;
2159
2160 // compute the delay
2161 Delays[nLeaves] = If_CluDelayMax( &G1, Delays ) + ((WireDelay == 0.0)?1.0:WireDelay);
2162 if ( G2.nVars )
2163 Delays[nLeaves+1] = If_CluDelayMax( &G2, Delays ) + ((WireDelay == 0.0)?1.0:WireDelay);
2164
2165 // mark used groups
2166 for ( i = 0; i < G1.nVars; i++ )
2167 fUsed[(int)G1.pVars[i]] = 1;
2168 for ( i = 0; i < G2.nVars; i++ )
2169 fUsed[(int)G2.pVars[i]] = 1;
2170 // mark unused groups
2171 assert( G1.nMyu >= 2 && G1.nMyu <= 4 );
2172 if ( G1.nMyu > 2 )
2173 fUsed[(int)G1.pVars[G1.nVars-1]] = 0;
2174 assert( !G2.nVars || (G2.nMyu >= 2 && G2.nMyu <= 4) );
2175 if ( G2.nMyu > 2 )
2176 fUsed[(int)G2.pVars[G2.nVars-1]] = 0;
2177
2178 // create remaining group
2179 assert( G3.nVars == 0 );
2180 for ( i = 0; i < nLeaves; i++ )
2181 if ( !fUsed[i] )
2182 G3.pVars[(int)G3.nVars++] = i;
2183 G3.pVars[(int)G3.nVars++] = nLeaves;
2184 if ( G2.nVars )
2185 G3.pVars[(int)G3.nVars++] = nLeaves+1;
2186 assert( G1.nVars + G2.nVars + G3.nVars == nLeaves +
2187 (G1.nVars > 0) + (G2.nVars > 0) + (G1.nMyu > 2) + (G2.nMyu > 2) );
2188 // what if both non-disjoint vars are the same???
2189
2190 pCut->Cost = 2 + (G2.nVars > 0);
2191 return 1.0 + If_CluDelayMax( &G3, Delays );
2192}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
float If_CluDelayMax(If_Grp_t *g, float *pDelays)
Definition ifDec16.c:2093
#define CLU_VAR_MAX
DECLARATIONS ///.
Definition ifDec16.c:31
unsigned Cost
Definition if.h:310
char pVars[CLU_VAR_MAX]
Definition ifDec16.c:42
char nMyu
Definition ifDec16.c:41
int strlen()
Here is the call graph for this function:

◆ If_CutDelaySop()

int If_CutDelaySop ( If_Man_t * p,
If_Cut_t * pCut )
extern

Definition at line 64 of file ifDelay.c.

65{
66 char * pPerm = If_CutPerm( pCut );
67 // delay is calculated using 1+log2(NumFanins)
68 static double GateDelays[20] = { 1.00, 1.00, 2.00, 2.58, 3.00, 3.32, 3.58, 3.81, 4.00, 4.17, 4.32, 4.46, 4.58, 4.70, 4.81, 4.91, 5.00, 5.09, 5.17, 5.25 };
69 Vec_Int_t * vCover;
70 If_Obj_t * pLeaf;
71 int i, nLitMax, Delay, DelayMax;
72 // mark cut as a user cut
73 pCut->fUser = 1;
74 if ( pCut->nLeaves == 0 )
75 return 0;
76 if ( pCut->nLeaves == 1 )
77 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
78 vCover = Vec_WecEntry( p->vTtIsops[pCut->nLeaves], Abc_Lit2Var(If_CutTruthLit(pCut)) );
79 if ( Vec_IntSize(vCover) == 0 )
80 return -1;
81 // mark the output as complemented
82// vAnds = If_CutDelaySopAnds( p, pCut, vCover, RetValue ^ pCut->fCompl );
83 if ( Vec_IntSize(vCover) > p->pPars->nGateSize )
84 return -1;
85 // set the area cost
86 assert( If_CutLeaveNum(pCut) >= 0 && If_CutLeaveNum(pCut) <= 16 );
87 // compute the gate delay
88 nLitMax = If_CutMaxCubeSize( vCover, If_CutLeaveNum(pCut) );
89 if ( Vec_IntSize(vCover) < 2 )
90 {
91 pCut->Cost = Vec_IntSize(vCover);
92 Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + 0.5);
93 DelayMax = 0;
94 If_CutForEachLeaf( p, pCut, pLeaf, i )
95 DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pPerm[i] = (char)Delay) );
96 }
97 else
98 {
99 pCut->Cost = Vec_IntSize(vCover) + 1;
100 Delay = (int)(GateDelays[If_CutLeaveNum(pCut)] + GateDelays[nLitMax] + 0.5);
101 DelayMax = 0;
102 If_CutForEachLeaf( p, pCut, pLeaf, i )
103 DelayMax = Abc_MaxInt( DelayMax, If_ObjCutBest(pLeaf)->Delay + (pPerm[i] = (char)Delay) );
104 }
105 return DelayMax;
106}
Here is the caller graph for this function:

◆ If_CutDsdBalanceEval()

int If_CutDsdBalanceEval ( If_Man_t * p,
If_Cut_t * pCut,
Vec_Int_t * vAig )
extern

Definition at line 2322 of file ifDsd.c.

2323{
2324 int fUseCofs = 0;
2325 pCut->fUser = 1;
2326 if ( vAig )
2327 Vec_IntClear( vAig );
2328 if ( pCut->nLeaves == 0 ) // const
2329 {
2330 assert( Abc_Lit2Var(If_CutDsdLit(p, pCut)) == 0 );
2331 if ( vAig )
2332 Vec_IntPush( vAig, Abc_LitIsCompl(If_CutDsdLit(p, pCut)) );
2333 pCut->Cost = 0;
2334 return 0;
2335 }
2336 if ( pCut->nLeaves == 1 ) // variable
2337 {
2338 assert( Abc_Lit2Var(If_CutDsdLit(p, pCut)) == 1 );
2339 if ( vAig )
2340 Vec_IntPush( vAig, 0 );
2341 if ( vAig )
2342 Vec_IntPush( vAig, Abc_LitIsCompl(If_CutDsdLit(p, pCut)) );
2343 pCut->Cost = 0;
2344 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
2345 }
2346 else
2347 {
2348 int fVerbose = 0;
2349 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
2350 int Delay, Area = 0;
2351 char * pPermLits = If_CutDsdPerm(p, pCut);
2352 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
2353 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
2354 Delay = If_CutDsdBalanceEvalInt( p->pIfDsdMan, Abc_LitNotCond(If_CutDsdLit(p, pCut), pCut->fCompl), pTimes, vAig, &Area, If_CutDsdPerm(p, pCut) );
2355 pCut->Cost = Area;
2356 // try cofactoring
2357 if ( fUseCofs )
2358 {
2359 // count how many times the max one appears
2360 int iMax = 0, nCountMax = 1;
2361 for ( i = 1; i < If_CutLeaveNum(pCut); i++ )
2362 if ( pTimes[i] > pTimes[iMax] )
2363 iMax = i, nCountMax = 1;
2364 else if ( pTimes[i] == pTimes[iMax] )
2365 nCountMax++;
2366 // decide when to try the decomposition
2367 if ( nCountMax == 1 && pTimes[iMax] + 2 < Delay && If_DsdManCheckNonTriv( p->pIfDsdMan, Abc_Lit2Var(If_CutDsdLit(p, pCut)),
2368 If_CutLeaveNum(pCut), If_CutDsdPermLitMax(pPermLits, If_CutLeaveNum(pCut), iMax)) )
2369 {
2370// fVerbose = 1;
2371 Delay = pTimes[iMax] + 2;
2372 }
2373 }
2374 // report the result
2375 if ( fVerbose )
2376 {
2377/*
2378 int Max = 0, Two = 0;
2379 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
2380 Max = Abc_MaxInt( Max, pTimes[i] );
2381 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
2382 if ( pTimes[i] != Max )
2383 Two = Abc_MaxInt( Two, pTimes[i] );
2384 if ( Two + 2 < Max && Max + 3 < Delay )
2385*/
2386 {
2387 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
2388 printf( "%3d ", pTimes[Abc_Lit2Var(pPermLits[i])] );
2389 for ( ; i < p->pPars->nLutSize; i++ )
2390 printf( " " );
2391 printf( "-> %3d ", Delay );
2392 If_DsdManPrintOne( stdout, p->pIfDsdMan, Abc_Lit2Var(If_CutDsdLit(p, pCut)), NULL, 0 );
2393 printf( "\n" );
2394 }
2395 }
2396 return Delay;
2397 }
2398}
void If_DsdManPrintOne(FILE *pFile, If_DsdMan_t *p, int iObjId, unsigned char *pPermLits, int fNewLine)
Definition ifDsd.c:509
int If_DsdManCheckNonTriv(If_DsdMan_t *p, int Id, int nVars, int iVarMax)
Definition ifDsd.c:819
int If_CutDsdBalanceEvalInt(If_DsdMan_t *p, int iDsd, int *pTimes, Vec_Int_t *vAig, int *pArea, char *pPermLits)
Definition ifDsd.c:2308
int If_CutDsdPermLitMax(char *pPermLits, int nVars, int iVar)
Definition ifDsd.c:2217
#define IF_MAX_FUNC_LUTSIZE
Definition if.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutDsdBalancePinDelays()

int If_CutDsdBalancePinDelays ( If_Man_t * p,
If_Cut_t * pCut,
char * pPerm )
extern

Definition at line 2183 of file ifDsd.c.

2184{
2185 if ( pCut->nLeaves == 0 ) // const
2186 return 0;
2187 if ( pCut->nLeaves == 1 ) // variable
2188 {
2189 pPerm[0] = 0;
2190 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
2191 }
2192 else
2193 {
2194 word Result = 0;
2195 int i, Delay, nSupp = 0, pTimes[IF_MAX_FUNC_LUTSIZE];
2196 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
2197 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
2198 Delay = If_CutDsdBalancePinDelays_rec( p->pIfDsdMan, Abc_Lit2Var(If_CutDsdLit(p, pCut)), pTimes, &Result, &nSupp, If_CutLeaveNum(pCut), If_CutDsdPerm(p, pCut) );
2199 assert( nSupp == If_CutLeaveNum(pCut) );
2200 If_CutPinDelayTranslate( Result, If_CutLeaveNum(pCut), pPerm );
2201 return Delay;
2202 }
2203}
int If_CutDsdBalancePinDelays_rec(If_DsdMan_t *p, int Id, int *pTimes, word *pRes, int *pnSupp, int nSuppAll, char *pPermLits)
Definition ifDsd.c:2135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutEdgeDeref()

float If_CutEdgeDeref ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1157 of file ifCut.c.

1158{
1159 If_Obj_t * pLeaf;
1160 float Edge;
1161 int i;
1162 Edge = pCut->nLeaves;
1163 If_CutForEachLeaf( p, pCut, pLeaf, i )
1164 {
1165 assert( pLeaf->nRefs > 0 );
1166 if ( --pLeaf->nRefs > 0 || !If_ObjIsAnd(pLeaf) )
1167 continue;
1168 Edge += If_CutEdgeDeref( p, If_ObjCutBest(pLeaf) );
1169 }
1170 return Edge;
1171}
float If_CutEdgeDeref(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutEdgeDerefed()

float If_CutEdgeDerefed ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes edge of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1211 of file ifCut.c.

1212{
1213 float aResult, aResult2;
1214 if ( pCut->nLeaves < 2 )
1215 return pCut->nLeaves;
1216 aResult2 = If_CutEdgeRef( p, pCut );
1217 aResult = If_CutEdgeDeref( p, pCut );
1218// assert( aResult > aResult2 - 3*p->fEpsilon );
1219// assert( aResult < aResult2 + 3*p->fEpsilon );
1220 return aResult;
1221}
float If_CutEdgeRef(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1184
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutEdgeFlow()

float If_CutEdgeFlow ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area flow.]

Description []

SideEffects []

SeeAlso []

Definition at line 965 of file ifCut.c.

966{
967 If_Obj_t * pLeaf;
968 float Flow, AddOn;
969 int i;
970 Flow = pCut->nLeaves;
971 If_CutForEachLeaf( p, pCut, pLeaf, i )
972 {
973 if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) )
974 AddOn = If_ObjCutBest(pLeaf)->Edge;
975 else
976 {
977 assert( pLeaf->EstRefs > p->fEpsilon );
978 AddOn = If_ObjCutBest(pLeaf)->Edge / pLeaf->EstRefs;
979 }
980 if ( Flow >= (float)1e32 || AddOn >= (float)1e32 )
981 Flow = (float)1e32;
982 else
983 {
984 Flow += AddOn;
985 if ( Flow > (float)1e32 )
986 Flow = (float)1e32;
987 }
988 }
989 return Flow;
990}
Here is the caller graph for this function:

◆ If_CutEdgeRef()

float If_CutEdgeRef ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1184 of file ifCut.c.

1185{
1186 If_Obj_t * pLeaf;
1187 float Edge;
1188 int i;
1189 Edge = pCut->nLeaves;
1190 If_CutForEachLeaf( p, pCut, pLeaf, i )
1191 {
1192 assert( pLeaf->nRefs >= 0 );
1193 if ( pLeaf->nRefs++ > 0 || !If_ObjIsAnd(pLeaf) )
1194 continue;
1195 Edge += If_CutEdgeRef( p, If_ObjCutBest(pLeaf) );
1196 }
1197 return Edge;
1198}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutEdgeRefed()

float If_CutEdgeRefed ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1234 of file ifCut.c.

1235{
1236 float aResult, aResult2;
1237 if ( pCut->nLeaves < 2 )
1238 return pCut->nLeaves;
1239 aResult2 = If_CutEdgeDeref( p, pCut );
1240 aResult = If_CutEdgeRef( p, pCut );
1241// assert( aResult > aResult2 - p->fEpsilon );
1242// assert( aResult < aResult2 + p->fEpsilon );
1243 return aResult;
1244}
Here is the call graph for this function:

◆ If_CutFilter()

int If_CutFilter ( If_Set_t * pCutSet,
If_Cut_t * pCut,
int fSaveCut0 )
extern

Function*************************************************************

Synopsis [Returns 1 if the cut is contained.]

Description []

SideEffects []

SeeAlso []

Definition at line 146 of file ifCut.c.

147{
148 If_Cut_t * pTemp;
149 int i, k;
150 assert( pCutSet->ppCuts[pCutSet->nCuts] == pCut );
151 for ( i = 0; i < pCutSet->nCuts; i++ )
152 {
153 pTemp = pCutSet->ppCuts[i];
154 if ( pTemp->nLeaves > pCut->nLeaves )
155 {
156 // do not fiter the first cut
157 if ( i == 0 && ((pCutSet->nCuts > 1 && pCutSet->ppCuts[1]->fUseless) || (fSaveCut0 && pCutSet->nCuts == 1)) )
158 continue;
159 // skip the non-contained cuts
160 if ( (pTemp->uSign & pCut->uSign) != pCut->uSign )
161 continue;
162 // check containment seriously
163 if ( If_CutCheckDominance( pCut, pTemp ) )
164 {
165// p->ppCuts[i] = p->ppCuts[p->nCuts-1];
166// p->ppCuts[p->nCuts-1] = pTemp;
167// p->nCuts--;
168// i--;
169 // remove contained cut
170 for ( k = i; k < pCutSet->nCuts; k++ )
171 pCutSet->ppCuts[k] = pCutSet->ppCuts[k+1];
172 pCutSet->ppCuts[pCutSet->nCuts] = pTemp;
173 pCutSet->nCuts--;
174 i--;
175 }
176 }
177 else
178 {
179 // skip the non-contained cuts
180 if ( (pTemp->uSign & pCut->uSign) != pTemp->uSign )
181 continue;
182 // check containment seriously
183 if ( If_CutCheckDominance( pTemp, pCut ) )
184 return 1;
185 }
186 }
187 return 0;
188}
struct If_Cut_t_ If_Cut_t
Definition if.h:80
unsigned fUseless
Definition if.h:313
If_Cut_t ** ppCuts
Definition if.h:327
short nCuts
Definition if.h:325
Here is the caller graph for this function:

◆ If_CutLift()

void If_CutLift ( If_Cut_t * pCut)
extern

Function*************************************************************

Synopsis [Moves the cut over the latch.]

Description []

SideEffects []

SeeAlso []

Definition at line 905 of file ifCut.c.

906{
907 unsigned i;
908 for ( i = 0; i < pCut->nLeaves; i++ )
909 {
910 assert( (pCut->pLeaves[i] & 255) < 255 );
911 pCut->pLeaves[i]++;
912 }
913}

◆ If_CutLutBalanceEval()

int If_CutLutBalanceEval ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Evaluate delay using SOP balancing.]

Description []

SideEffects []

SeeAlso []

Definition at line 369 of file ifDelay.c.

370{
371 pCut->fUser = 1;
372 pCut->Cost = pCut->nLeaves > 1 ? 1 : 0;
373 pCut->uMaskFunc = 0;
374 if ( pCut->nLeaves == 0 ) // const
375 {
376 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
377 return 0;
378 }
379 if ( pCut->nLeaves == 1 ) // variable
380 {
381 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
382 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
383 }
384 else
385 {
386 char * pCutPerm = If_CutDsdPerm( p, pCut );
387 int LutSize = p->pPars->pLutStruct[0] - '0';
388 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
389 int DelayMax = -1, nLeafMax = 0;
390 unsigned uLeafMask = 0;
391 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
392 {
393 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, Abc_Lit2Var((int)pCutPerm[i])))->Delay;
394 if ( DelayMax < pTimes[i] )
395 DelayMax = pTimes[i], nLeafMax = 1, uLeafMask = (1 << (i << 1));
396 else if ( DelayMax == pTimes[i] )
397 nLeafMax++, uLeafMask |= (1 << (i << 1));
398 }
399 if ( If_CutLeaveNum(pCut) <= LutSize )
400 return DelayMax + 1;
401 pCut->Cost = 2;
402 if ( nLeafMax <= LutSize - 1 )
403 {
404 pCut->uMaskFunc = If_DsdManCheckXY( p->pIfDsdMan, If_CutDsdLit(p, pCut), LutSize, 1, uLeafMask, 0, 0 );
405 if ( pCut->uMaskFunc > 0 )
406 return DelayMax + 1;
407 }
408 pCut->uMaskFunc = If_DsdManCheckXY( p->pIfDsdMan, If_CutDsdLit(p, pCut), LutSize, 1, 0, 0, 0 );
409 if ( pCut->uMaskFunc == 0 )
410 return -1;
411 return DelayMax + 2;
412 }
413}
unsigned If_DsdManCheckXY(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
Definition ifDsd.c:2017
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutLutBalancePinDelays()

int If_CutLutBalancePinDelays ( If_Man_t * p,
If_Cut_t * pCut,
char * pPerm )
extern

Function*************************************************************

Synopsis [Evaluate delay using SOP balancing.]

Description []

SideEffects []

SeeAlso []

Definition at line 327 of file ifDelay.c.

328{
329 if ( pCut->nLeaves == 0 ) // const
330 return 0;
331 if ( pCut->nLeaves == 1 ) // variable
332 {
333 pPerm[0] = 0;
334 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
335 }
336 else
337 {
338 char * pCutPerm = If_CutDsdPerm( p, pCut );
339 int LutSize = p->pPars->pLutStruct[0] - '0';
340 int i, Delay, DelayMax = -1;
341 assert( (If_CutLeaveNum(pCut) > LutSize) == (pCut->uMaskFunc > 0) );
342 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
343 {
344 if ( If_CutLeaveNum(pCut) > LutSize && ((pCut->uMaskFunc >> (i << 1)) & 1) )
345 pPerm[Abc_Lit2Var((int)pCutPerm[i])] = 2;
346 else
347 pPerm[Abc_Lit2Var((int)pCutPerm[i])] = 1;
348 }
349 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
350 {
351 Delay = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
352 DelayMax = Abc_MaxInt( DelayMax, Delay + (int)pPerm[i] );
353 }
354 return DelayMax;
355 }
356}
Here is the caller graph for this function:

◆ If_CutMerge()

int If_CutMerge ( If_Man_t * p,
If_Cut_t * pCut0,
If_Cut_t * pCut1,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Prepares the object for FPGA mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 364 of file ifCut.c.

365{
366 int nLutSize = pCut0->nLimit;
367 int nSize0 = pCut0->nLeaves;
368 int nSize1 = pCut1->nLeaves;
369 int * pC0 = pCut0->pLeaves;
370 int * pC1 = pCut1->pLeaves;
371 int * pC = pCut->pLeaves;
372 int i, k, c;
373 // compare two cuts with different numbers
374 c = nSize0;
375 for ( i = 0; i < nSize1; i++ )
376 {
377 for ( k = 0; k < nSize0; k++ )
378 if ( pC1[i] == pC0[k] )
379 break;
380 if ( k < nSize0 )
381 {
382 p->pPerm[1][i] = k;
383 continue;
384 }
385 if ( c == nLutSize )
386 return 0;
387 p->pPerm[1][i] = c;
388 pC[c++] = pC1[i];
389 }
390 for ( i = 0; i < nSize0; i++ )
391 pC[i] = pC0[i];
392 pCut->nLeaves = c;
393 pCut->uSign = pCut0->uSign | pCut1->uSign;
394 return 1;
395}
Here is the caller graph for this function:

◆ If_CutMergeOrdered()

int If_CutMergeOrdered ( If_Man_t * p,
If_Cut_t * pC0,
If_Cut_t * pC1,
If_Cut_t * pC )
extern

Function*************************************************************

Synopsis [Prepares the object for FPGA mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 290 of file ifCut.c.

291{
292 int nSizeC0 = pC0->nLeaves;
293 int nSizeC1 = pC1->nLeaves;
294 int nLimit = pC0->nLimit;
295 int i, k, c, s;
296
297 // both cuts are the largest
298 if ( nSizeC0 == nLimit && nSizeC1 == nLimit )
299 {
300 for ( i = 0; i < nSizeC0; i++ )
301 {
302 if ( pC0->pLeaves[i] != pC1->pLeaves[i] )
303 return 0;
304 pC->pLeaves[i] = pC0->pLeaves[i];
305 }
306 pC->nLeaves = nLimit;
307 pC->uSign = pC0->uSign | pC1->uSign;
308 return 1;
309 }
310
311 // compare two cuts with different numbers
312 i = k = c = s = 0;
313 if ( nSizeC0 == 0 ) goto FlushCut1;
314 if ( nSizeC1 == 0 ) goto FlushCut0;
315 while ( 1 )
316 {
317 if ( c == nLimit ) return 0;
318 if ( pC0->pLeaves[i] < pC1->pLeaves[k] )
319 {
320 pC->pLeaves[c++] = pC0->pLeaves[i++];
321 if ( i == nSizeC0 ) goto FlushCut1;
322 }
323 else if ( pC0->pLeaves[i] > pC1->pLeaves[k] )
324 {
325 pC->pLeaves[c++] = pC1->pLeaves[k++];
326 if ( k == nSizeC1 ) goto FlushCut0;
327 }
328 else
329 {
330 pC->pLeaves[c++] = pC0->pLeaves[i++]; k++;
331 if ( i == nSizeC0 ) goto FlushCut1;
332 if ( k == nSizeC1 ) goto FlushCut0;
333 }
334 }
335
336FlushCut0:
337 if ( c + nSizeC0 > nLimit + i ) return 0;
338 while ( i < nSizeC0 )
339 pC->pLeaves[c++] = pC0->pLeaves[i++];
340 pC->nLeaves = c;
341 pC->uSign = pC0->uSign | pC1->uSign;
342 return 1;
343
344FlushCut1:
345 if ( c + nSizeC1 > nLimit + k ) return 0;
346 while ( k < nSizeC1 )
347 pC->pLeaves[c++] = pC1->pLeaves[k++];
348 pC->nLeaves = c;
349 pC->uSign = pC0->uSign | pC1->uSign;
350 return 1;
351}
Here is the caller graph for this function:

◆ If_CutOrder()

void If_CutOrder ( If_Cut_t * pCut)
extern

Function*************************************************************

Synopsis [Orders the leaves of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 805 of file ifCut.c.

806{
807 int i, Temp, fChanges;
808 do {
809 fChanges = 0;
810 for ( i = 0; i < (int)pCut->nLeaves - 1; i++ )
811 {
812 assert( pCut->pLeaves[i] != pCut->pLeaves[i+1] );
813 if ( pCut->pLeaves[i] <= pCut->pLeaves[i+1] )
814 continue;
815 Temp = pCut->pLeaves[i];
816 pCut->pLeaves[i] = pCut->pLeaves[i+1];
817 pCut->pLeaves[i+1] = Temp;
818 fChanges = 1;
819 }
820 } while ( fChanges );
821}

◆ If_CutPerformCheck07()

int If_CutPerformCheck07 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 1060 of file ifDec07.c.

1061{
1062 int fDerive = 0;
1063 int v;
1064 // skip non-support minimal
1065 for ( v = 0; v < nLeaves; v++ )
1066 if ( !Abc_TtHasVar( (word *)pTruth, nVars, v ) )
1067 return 0;
1068 // check
1069 if ( nLeaves < 5 )
1070 return 1;
1071 if ( nLeaves == 5 )
1072 {
1073 word z, t = ((word)pTruth[0] << 32) | (word)pTruth[0];
1074 z = If_Dec5Perform( t, fDerive );
1075 if ( fDerive && z )
1076 If_Dec6Verify( t, z );
1077 return z != 0;
1078 }
1079 if ( nLeaves == 6 )
1080 {
1081 word z, t = ((word *)pTruth)[0];
1082 z = If_Dec6Perform( t, fDerive );
1083 if ( fDerive && z )
1084 {
1085// If_DecPrintConfig( z );
1086 If_Dec6Verify( t, z );
1087 }
1088// if ( z == 0 )
1089// Extra_PrintHex(stdout, (unsigned *)&t, 6), printf( " " ), Kit_DsdPrintFromTruth( (unsigned *)&t, 6 ), printf( "\n" );
1090 return z != 0;
1091 }
1092 if ( nLeaves == 7 )
1093 {
1094 word z, t[2];
1095 t[0] = ((word *)pTruth)[0];
1096 t[1] = ((word *)pTruth)[1];
1097// if ( If_Dec7CheckMux(t) >= 0 )
1098// return 1;
1099 z = If_Dec7Perform( t, fDerive );
1100 if ( fDerive && z )
1101 If_Dec7Verify( t, z );
1102 return z != 0;
1103 }
1104 assert( 0 );
1105 return 0;
1106}
void If_Dec7Verify(word t[2], word z)
Definition ifDec07.c:163
word If_Dec6Perform(word t, int fDerive)
Definition ifDec07.c:409
void If_Dec6Verify(word t, word z)
Definition ifDec07.c:131
word If_Dec7Perform(word t0[2], int fDerive)
Definition ifDec07.c:449
word If_Dec5Perform(word t, int fDerive)
Definition ifDec07.c:857
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPerformCheck08()

int If_CutPerformCheck08 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 475 of file ifDec08.c.

476{
477 int nSupp, fDerive = 0;
478 word pF[16];
479 if ( nLeaves <= 5 )
480 return 1;
481 If_Dec08Copy( pF, (word *)pTruth, nVars );
482 nSupp = If_Dec08Support( pF, nLeaves );
483 if ( !nSupp || !If_DecSuppIsMinBase(nSupp) )
484 return 0;
485 if ( If_Dec08Perform( pF, nLeaves, fDerive ) )
486 {
487// printf( "1" );
488 return 1;
489// If_Dec08Verify( t, nLeaves, NULL );
490 }
491// printf( "0" );
492 return 0;
493}
int If_Dec08Perform(word *pF, int nVars, int fDerive)
Definition ifDec08.c:379
Here is the call graph for this function:

◆ If_CutPerformCheck10()

int If_CutPerformCheck10 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 474 of file ifDec10.c.

475{
476 int nSupp, fDerive = 0;
477 word pF[16];
478 if ( nLeaves <= 6 )
479 return 1;
480 If_Dec10Copy( pF, (word *)pTruth, nVars );
481 nSupp = If_Dec10Support( pF, nLeaves );
482 if ( !nSupp || !If_DecSuppIsMinBase(nSupp) )
483 return 0;
484 if ( If_Dec10Perform( pF, nLeaves, fDerive ) )
485 {
486// printf( "1" );
487 return 1;
488// If_Dec10Verify( t, nLeaves, NULL );
489 }
490// printf( "0" );
491 return 0;
492}
int If_Dec10Perform(word *pF, int nVars, int fDerive)
Definition ifDec10.c:376
Here is the call graph for this function:

◆ If_CutPerformCheck16()

int If_CutPerformCheck16 ( If_Man_t * p,
unsigned * pTruth0,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 2216 of file ifDec16.c.

2217{
2218 unsigned pTruth[IF_MAX_FUNC_LUTSIZE > 5 ? 1 << (IF_MAX_FUNC_LUTSIZE - 5) : 1];
2219 If_Grp_t G1 = {0};//, G3 = {0};
2220 int i, nLutLeaf, nLutLeaf2, nLutRoot, Length;
2221 // stretch the truth table
2222 assert( nVars >= 6 );
2223 memcpy( pTruth, pTruth0, sizeof(word) * Abc_TtWordNum(nVars) );
2224 Abc_TtStretch6( (word *)pTruth, nLeaves, p->pPars->nLutSize );
2225
2226#ifdef IF_TRY_NEW
2227 {
2228 word pCopy[1024];
2229 int nWords = Abc_TruthWordNum(nVars);
2230 int iNum;
2231 if ( s_vTtMem == NULL )
2232 {
2233 s_vTtMem = Vec_MemAlloc( Abc_Truth6WordNum(nVars), 12 ); // 32 KB/page for 6-var functions
2234 Vec_MemHashAlloc( s_vTtMem, 10000 );
2235 }
2236 if ( s_vTtMem2 == NULL )
2237 {
2238 s_vTtMem2 = Vec_MemAlloc( Abc_Truth6WordNum(nVars), 12 ); // 32 KB/page for 6-var functions
2239 Vec_MemHashAlloc( s_vTtMem2, 10000 );
2240 }
2241 memcpy( pCopy, pTruth, sizeof(word) * Abc_Truth6WordNum(nVars) );
2242 if ( pCopy[0] & 1 )
2243 for ( i = 0; i < nWords; i++ )
2244 pCopy[i] = ~pCopy[i];
2245 iNum = Vec_MemHashInsert( s_vTtMem, pCopy );
2246 if ( iNum == Vec_MemEntryNum(s_vTtMem) - 1 )
2247 {
2248 int pCanonPerm[16];
2249 char pCanonPermC[16];
2250 Abc_TtCanonicize( pCopy, nVars, pCanonPermC );
2251// If_CluSemiCanonicize( pCopy, nVars, pCanonPerm );
2252 Vec_MemHashInsert( s_vTtMem2, pCopy );
2253 }
2254 }
2255#endif
2256
2257 // if cutmin is disabled, minimize the function
2258 if ( !p->pPars->fCutMin )
2259 nLeaves = Abc_TtMinBase( (word *)pTruth, NULL, nLeaves, nVars );
2260
2261 // quit if parameters are wrong
2262 Length = strlen(pStr);
2263 if ( Length != 2 && Length != 3 )
2264 {
2265 printf( "Wrong LUT struct (%s)\n", pStr );
2266 return 0;
2267 }
2268 for ( i = 0; i < Length; i++ )
2269 if ( pStr[i] - '0' < 3 || pStr[i] - '0' > 6 )
2270 {
2271 printf( "The LUT size (%d) should belong to {3,4,5,6}.\n", pStr[i] - '0' );
2272 return 0;
2273 }
2274
2275 nLutLeaf = pStr[0] - '0';
2276 nLutLeaf2 = ( Length == 3 ) ? pStr[1] - '0' : 0;
2277 nLutRoot = pStr[Length-1] - '0';
2278 if ( nLeaves > nLutLeaf - 1 + (nLutLeaf2 ? nLutLeaf2 - 1 : 0) + nLutRoot )
2279 {
2280 printf( "The cut size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
2281 return 0;
2282 }
2283 // consider easy case
2284 if ( nLeaves <= Abc_MaxInt( nLutLeaf2, Abc_MaxInt(nLutLeaf, nLutRoot) ) )
2285 return 1;
2286
2287 // derive the first group
2288 if ( Length == 2 )
2289 G1 = If_CluCheck( p, (word *)pTruth, nLeaves, 0, 0, nLutLeaf, nLutRoot, NULL, NULL, NULL, NULL, 1 );
2290 else
2291 G1 = If_CluCheck3( p, (word *)pTruth, nLeaves, nLutLeaf, nLutLeaf2, nLutRoot, NULL, NULL, NULL, NULL, NULL );
2292
2293// if ( G1.nVars > 0 )
2294// If_CluPrintGroup( &G1 );
2295
2296 return (int)(G1.nVars > 0);
2297}
int nWords
Definition abcNpn.c:127
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPerformCheck45()

int If_CutPerformCheck45 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Definition at line 1865 of file ifDec16.c.

1866{
1867 // 5LUT -> 4LUT
1868 If_Grp_t G, R;
1869 word Func0, Func1;
1870 G = If_CluCheck( p, (word *)pTruth, nLeaves, 0, 0, 5, 4, &R, &Func0, &Func1, NULL, 0 );
1871 if ( G.nVars == 0 )
1872 return 0;
1873 Func0 = If_CluAdjust( Func0, R.nVars );
1874 Func1 = If_CluAdjust( Func1, G.nVars );
1875#if 0
1876 Kit_DsdPrintFromTruth( pTruth, nVars ); printf( "\n" );
1877 Kit_DsdPrintFromTruth( (unsigned*)&Func0, R.nVars ); printf( "\n" );
1878 Kit_DsdPrintFromTruth( (unsigned*)&Func1, G.nVars ); printf( "\n" );
1879 If_CluPrintGroup( &R );
1880 If_CluPrintGroup( &G );
1881#endif
1882 if ( G.nVars < 5 || (p->pPars->fEnableCheck75 && If_CluCheckDecOut(Func1, 5)) || (p->pPars->fEnableCheck75u && If_CluCheckDecOutU(Func1, 5)) )
1883 return 1;
1884 return 0;
1885}
void If_CluPrintGroup(If_Grp_t *g)
Definition ifDec16.c:580
int If_CluCheckDecOut(word t, int nVars)
Definition ifDec16.c:1840
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition kitDsd.c:491
int If_CluCheckDecOutU(word t, int nVars)
Definition ifDec16.c:1853
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPerformCheck54()

int If_CutPerformCheck54 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Definition at line 1886 of file ifDec16.c.

1887{
1888 // 4LUT -> 5LUT
1889 If_Grp_t G, R;
1890 word Func0, Func1;
1891 G = If_CluCheck( p, (word *)pTruth, nLeaves, 0, 0, 4, 5, &R, &Func0, &Func1, NULL, 0 );
1892 if ( G.nVars == 0 )
1893 return 0;
1894 Func0 = If_CluAdjust( Func0, R.nVars );
1895 Func1 = If_CluAdjust( Func1, G.nVars );
1896#if 0
1897 Kit_DsdPrintFromTruth( pTruth, nVars ); printf( "\n" );
1898 Kit_DsdPrintFromTruth( (unsigned*)&Func0, R.nVars ); printf( "\n" );
1899 Kit_DsdPrintFromTruth( (unsigned*)&Func1, G.nVars ); printf( "\n" );
1900 If_CluPrintGroup( &R );
1901 If_CluPrintGroup( &G );
1902#endif
1903 if ( R.nVars < 5 || (p->pPars->fEnableCheck75 && If_CluCheckDecIn(Func0, 5)) || (p->pPars->fEnableCheck75u && If_CluCheckDecInU(Func0, 5)) )
1904 return 1;
1905 return 0;
1906}
int If_CluCheckDecIn(word t, int nVars)
Definition ifDec16.c:1792
int If_CluCheckDecInU(word t, int nVars)
Definition ifDec16.c:1818
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPerformCheck75()

int If_CutPerformCheck75 ( If_Man_t * p,
unsigned * pTruth0,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 303 of file ifDec75.c.

304{
305 word * pTruthW = (word *)pTruth0;
306 word pTruth[4] = { pTruthW[0], pTruthW[1], pTruthW[2], pTruthW[3] };
307 assert( nLeaves <= 8 );
308 if ( !p->pPars->fCutMin )
309 Abc_TtMinimumBase( pTruth, NULL, nLeaves, &nLeaves );
310 if ( nLeaves < 6 )
311 return 1;
312// if ( nLeaves < 8 && If_CutPerformCheck07( p, (unsigned *)pTruth, nVars, nLeaves, "44" ) )
313 if ( nLeaves < 8 && If_CutPerformCheck16( p, (unsigned *)pTruth, nVars, nLeaves, "44" ) )
314 return 1;
315 // this is faster but not compatible with -z
316 if ( !p->pPars->fDeriveLuts && p->pPars->fEnableCheck75 && nLeaves == 8 )
317 {
318// char pDsdStr[1000] = "(!(abd)!(c!([fe][gh])))";
319 char pDsdStr[1000];
320 int nSizeNonDec = Dau_DsdDecompose( (word *)pTruth, nLeaves, 0, 0, pDsdStr );
321 if ( nSizeNonDec >= 5 )
322 return 0;
323 if ( Dau_DsdCheckDecAndExist(pDsdStr) & 0x10 ) // bit 4
324 return 1;
325 return 0;
326 }
327 if ( If_CutPerformCheck45( p, (unsigned *)pTruth, nVars, nLeaves, pStr ) )
328 return 1;
329 if ( If_CutPerformCheck54( p, (unsigned *)pTruth, nVars, nLeaves, pStr ) )
330 return 1;
331 return 0;
332}
int Dau_DsdDecompose(word *pTruth, int nVarsInit, int fSplitPrime, int fWriteTruth, char *pRes)
Definition dauDsd.c:1912
int Dau_DsdCheckDecAndExist(char *pDsd)
Definition ifDec75.c:185
int If_CutPerformCheck54(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
Definition ifDec16.c:1886
int If_CutPerformCheck16(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
Definition ifDec16.c:2216
int If_CutPerformCheck45(If_Man_t *p, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
Definition ifDec16.c:1865
Here is the call graph for this function:

◆ If_CutPerformCheckXX()

int If_CutPerformCheckXX ( If_Man_t * p,
unsigned * pTruth0,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs ACD into 66 cascade.]

Description []

SideEffects []

SeeAlso []

Definition at line 363 of file ifDec66.c.

364{
365 unsigned pTruth[IF_MAX_FUNC_LUTSIZE > 5 ? 1 << (IF_MAX_FUNC_LUTSIZE - 5) : 1];
366 int Length;
367 // stretch the truth table
368 memcpy( pTruth, pTruth0, sizeof(word) * Abc_TtWordNum(nVars) );
369 Abc_TtStretch6( (word *)pTruth, nLeaves, p->pPars->nLutSize );
370
371 // if cutmin is disabled, minimize the function
372 if ( !p->pPars->fCutMin )
373 nLeaves = Abc_TtMinBase( (word *)pTruth, NULL, nLeaves, nVars );
374
375 // quit if parameters are wrong
376 Length = strlen(pStr);
377 if ( Length != 2 )
378 {
379 printf( "Wrong LUT struct (%s)\n", pStr );
380 return 0;
381 }
382
383 int lutSize = pStr[0] - '0';
384 if ( lutSize < 3 || lutSize > 6 )
385 {
386 printf( "The LUT size (%d) should belong to {3,4,5,6}.\n", lutSize );
387 return 0;
388 }
389
390 if ( nLeaves >= 2 * lutSize )
391 {
392 printf( "The cut size (%d) is too large for the LUT structure %s.\n", nLeaves, pStr );
393 return 0;
394 }
395
396 // consider trivial case
397 if ( nLeaves <= lutSize )
398 return 1;
399
400 return If_CluCheckXX(p, (word*)pTruth, lutSize, nVars, 1);
401}
int If_CluCheckXX(If_Man_t *p, word *pTruth0, int lutSize, int nVars, int fHashing)
Definition ifDec66.c:276
Here is the call graph for this function:

◆ If_CutPerformDerive07()

word If_CutPerformDerive07 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis [Performs additional check.]

Description []

SideEffects []

SeeAlso []

Definition at line 1018 of file ifDec07.c.

1019{
1020 if ( nLeaves < 5 )
1021 return 1;
1022 if ( nLeaves == 5 )
1023 {
1024 word z, t = ((word)pTruth[0] << 32) | (word)pTruth[0];
1025 z = If_Dec5Perform( t, 1 );
1026 If_Dec6Verify( t, z );
1027 return z;
1028 }
1029 if ( nLeaves == 6 )
1030 {
1031 word z, t = ((word *)pTruth)[0];
1032 z = If_Dec6Perform( t, 1 );
1033 If_Dec6Verify( t, z );
1034 return z;
1035 }
1036 if ( nLeaves == 7 )
1037 {
1038 word z, t[2];
1039 t[0] = ((word *)pTruth)[0];
1040 t[1] = ((word *)pTruth)[1];
1041 z = If_Dec7Perform( t, 1 );
1042 If_Dec7Verify( t, z );
1043 return z;
1044 }
1045 assert( 0 );
1046 return 0;
1047}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPowerDeref()

float If_CutPowerDeref ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pRoot )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1258 of file ifCut.c.

1259{
1260 If_Obj_t * pLeaf;
1261 float * pSwitching = (float *)p->vSwitching->pArray;
1262 float Power = 0;
1263 int i;
1264 If_CutForEachLeaf( p, pCut, pLeaf, i )
1265 {
1266 Power += pSwitching[pLeaf->Id];
1267 assert( pLeaf->nRefs > 0 );
1268 if ( --pLeaf->nRefs > 0 || !If_ObjIsAnd(pLeaf) )
1269 continue;
1270 Power += If_CutPowerDeref( p, If_ObjCutBest(pLeaf), pRoot );
1271 }
1272 return Power;
1273}
float If_CutPowerDeref(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
Definition ifCut.c:1258
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPowerDerefed()

float If_CutPowerDerefed ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pRoot )
extern

Function*************************************************************

Synopsis [Computes Power of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1314 of file ifCut.c.

1315{
1316 float aResult, aResult2;
1317 if ( pCut->nLeaves < 2 )
1318 return 0;
1319 aResult2 = If_CutPowerRef( p, pCut, pRoot );
1320 aResult = If_CutPowerDeref( p, pCut, pRoot );
1321 assert( aResult > aResult2 - p->fEpsilon );
1322 assert( aResult < aResult2 + p->fEpsilon );
1323 return aResult;
1324}
float If_CutPowerRef(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
Definition ifCut.c:1286
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPowerFlow()

float If_CutPowerFlow ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pRoot )
extern

Function*************************************************************

Synopsis [Computes area flow.]

Description []

SideEffects []

SeeAlso []

Definition at line 1003 of file ifCut.c.

1004{
1005 If_Obj_t * pLeaf;
1006 float * pSwitching = (float *)p->vSwitching->pArray;
1007 float Power = 0;
1008 int i;
1009 If_CutForEachLeaf( p, pCut, pLeaf, i )
1010 {
1011 Power += pSwitching[pLeaf->Id];
1012 if ( pLeaf->nRefs == 0 || If_ObjIsConst1(pLeaf) )
1013 Power += If_ObjCutBest(pLeaf)->Power;
1014 else
1015 {
1016 assert( pLeaf->EstRefs > p->fEpsilon );
1017 Power += If_ObjCutBest(pLeaf)->Power / pLeaf->EstRefs;
1018 }
1019 }
1020 return Power;
1021}
Here is the caller graph for this function:

◆ If_CutPowerRef()

float If_CutPowerRef ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pRoot )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1286 of file ifCut.c.

1287{
1288 If_Obj_t * pLeaf;
1289 float * pSwitching = (float *)p->vSwitching->pArray;
1290 float Power = 0;
1291 int i;
1292 If_CutForEachLeaf( p, pCut, pLeaf, i )
1293 {
1294 Power += pSwitching[pLeaf->Id];
1295 assert( pLeaf->nRefs >= 0 );
1296 if ( pLeaf->nRefs++ > 0 || !If_ObjIsAnd(pLeaf) )
1297 continue;
1298 Power += If_CutPowerRef( p, If_ObjCutBest(pLeaf), pRoot );
1299 }
1300 return Power;
1301}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutPowerRefed()

float If_CutPowerRefed ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pRoot )
extern

Function*************************************************************

Synopsis [Computes area of the first level.]

Description [The cut need to be derefed.]

SideEffects []

SeeAlso []

Definition at line 1337 of file ifCut.c.

1338{
1339 float aResult, aResult2;
1340 if ( pCut->nLeaves < 2 )
1341 return 0;
1342 aResult2 = If_CutPowerDeref( p, pCut, pRoot );
1343 aResult = If_CutPowerRef( p, pCut, pRoot );
1344 assert( aResult > aResult2 - p->fEpsilon );
1345 assert( aResult < aResult2 + p->fEpsilon );
1346 return aResult;
1347}
Here is the call graph for this function:

◆ If_CutPrint()

void If_CutPrint ( If_Cut_t * pCut)
extern

Function*************************************************************

Synopsis [Prints one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 864 of file ifCut.c.

865{
866 unsigned i;
867 Abc_Print( 1, "{" );
868 for ( i = 0; i < pCut->nLeaves; i++ )
869 Abc_Print( 1, " %s%d", If_CutLeafBit(pCut, i) ? "!":"", pCut->pLeaves[i] );
870 Abc_Print( 1, " }\n" );
871}
Here is the caller graph for this function:

◆ If_CutPrintTiming()

void If_CutPrintTiming ( If_Man_t * p,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Prints one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 884 of file ifCut.c.

885{
886 If_Obj_t * pLeaf;
887 unsigned i;
888 Abc_Print( 1, "{" );
889 If_CutForEachLeaf( p, pCut, pLeaf, i )
890 Abc_Print( 1, " %d(%.2f/%.2f)", pLeaf->Id, If_ObjCutBest(pLeaf)->Delay, pLeaf->Required );
891 Abc_Print( 1, " }\n" );
892}
float Required
Definition if.h:353
int Id
Definition if.h:344

◆ If_CutPropagateRequired()

void If_CutPropagateRequired ( If_Man_t * p,
If_Obj_t * pObj,
If_Cut_t * pCut,
float ObjRequired )
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 178 of file ifTime.c.

179{
180 static int pPinPerm[IF_MAX_LUTSIZE];
181 static float pPinDelays[IF_MAX_LUTSIZE];
182 If_Obj_t * pLeaf;
183 float * pLutDelays;
184 float Required;
185 int i, Pin2PinDelay;//, iLeaf;
186 assert( !p->pPars->fLiftLeaves );
187 // compute the pins
188 if ( pCut->fAndCut )
189 {
190 If_CutForEachLeaf( p, pCut, pLeaf, i )
191 pLeaf->Required = IF_MIN( pLeaf->Required, ObjRequired - p->pPars->nAndDelay );
192 }
193 else if ( p->pPars->pLutLib )
194 {
195 pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
196 if ( p->pPars->pLutLib->fVarPinDelays )
197 {
198 // compute the delay using sorted pins
199 If_CutSortInputPins( p, pCut, pPinPerm, pPinDelays );
200 for ( i = 0; i < (int)pCut->nLeaves; i++ )
201 {
202 Required = ObjRequired - pLutDelays[i];
203 pLeaf = If_ManObj( p, pCut->pLeaves[pPinPerm[i]] );
204 pLeaf->Required = IF_MIN( pLeaf->Required, Required );
205 }
206 }
207 else
208 {
209 Required = ObjRequired;
210 If_CutForEachLeaf( p, pCut, pLeaf, i )
211 pLeaf->Required = IF_MIN( pLeaf->Required, Required - pLutDelays[0] );
212 }
213 }
214 else if ( p->pPars->fUserLutDec || p->pPars->fUserLut2D )
215 {
216 Required = ObjRequired;
217 If_CutForEachLeaf( p, pCut, pLeaf, i )
218 pLeaf->Required = IF_MIN( pLeaf->Required, Required - If_LutDecPinRequired( p, pCut, i, ObjRequired ) );
219 }
220 else
221 {
222 if ( pCut->fUser )
223 {
224 char Perm[IF_MAX_FUNC_LUTSIZE], * pPerm = Perm;
225 if ( p->pPars->fDelayOpt )
226 {
227 int Delay = If_CutSopBalancePinDelays( p, pCut, pPerm );
228 assert( Delay == (int)pCut->Delay );
229 }
230 else if ( p->pPars->fDelayOptLut )
231 {
232 int Delay = If_CutLutBalancePinDelays( p, pCut, pPerm );
233 assert( Delay == (int)pCut->Delay );
234 }
235 else if ( p->pPars->fDsdBalance )
236 {
237 int Delay = If_CutDsdBalancePinDelays( p, pCut, pPerm );
238 assert( Delay == (int)pCut->Delay );
239 }
240 else
241 pPerm = If_CutPerm(pCut);
242 If_CutForEachLeaf( p, pCut, pLeaf, i )
243 {
244 Pin2PinDelay = pPerm ? (pPerm[i] == IF_BIG_CHAR ? -IF_BIG_CHAR : pPerm[i]) : 1;
245 Required = ObjRequired - (float)Pin2PinDelay;
246 pLeaf->Required = IF_MIN( pLeaf->Required, Required );
247 }
248 }
249 else
250 {
251 Required = ObjRequired;
252 If_CutForEachLeaf( p, pCut, pLeaf, i )
253 pLeaf->Required = IF_MIN( pLeaf->Required, Required - (float)1.0 );
254 }
255 }
256}
float If_LutDecPinRequired(If_Man_t *p, If_Cut_t *pCut, int i, float required)
Definition ifDelay.c:625
int If_CutLutBalancePinDelays(If_Man_t *p, If_Cut_t *pCut, char *pPerm)
Definition ifDelay.c:327
#define IF_MIN(a, b)
MACRO DEFINITIONS ///.
Definition if.h:465
int If_CutSopBalancePinDelays(If_Man_t *p, If_Cut_t *pCut, char *pPerm)
Definition ifDelay.c:159
int If_CutDsdBalancePinDelays(If_Man_t *p, If_Cut_t *pCut, char *pPerm)
Definition ifDsd.c:2183
float Delay
Definition if.h:306
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutRotatePins()

void If_CutRotatePins ( If_Man_t * p,
If_Cut_t * pCut )
extern

Definition at line 68 of file ifTruth.c.

69{
70 If_Obj_t * pLeaf;
71 float PinDelays[IF_MAX_LUTSIZE];
72 int i, truthId;
73 assert( !p->pPars->fUseTtPerm );
74 If_CutForEachLeaf( p, pCut, pLeaf, i )
75 PinDelays[i] = If_ObjCutBest(pLeaf)->Delay;
76 if ( p->vTtMem[pCut->nLeaves] == NULL )
77 {
78 If_CutTruthPermute( NULL, If_CutLeaveNum(pCut), pCut->nLeaves, p->nTruth6Words[pCut->nLeaves], PinDelays, If_CutLeaves(pCut) );
79 return;
80 }
81 Abc_TtCopy( p->puTempW, If_CutTruthWR(p, pCut), p->nTruth6Words[pCut->nLeaves], 0 );
82 If_CutTruthPermute( p->puTempW, If_CutLeaveNum(pCut), pCut->nLeaves, p->nTruth6Words[pCut->nLeaves], PinDelays, If_CutLeaves(pCut) );
83 truthId = Vec_MemHashInsert( p->vTtMem[pCut->nLeaves], p->puTempW );
84 pCut->iCutFunc = Abc_Var2Lit( truthId, If_CutTruthIsCompl(pCut) );
85 assert( (p->puTempW[0] & 1) == 0 );
86}
ABC_NAMESPACE_IMPL_START void If_CutTruthPermute(word *pTruth, int nLeaves, int nVars, int nWords, float *pDelays, int *pVars)
DECLARATIONS ///.
Definition ifTruth.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutSopBalanceEval()

int If_CutSopBalanceEval ( If_Man_t * p,
If_Cut_t * pCut,
Vec_Int_t * vAig )
extern

Definition at line 248 of file ifDelay.c.

249{
250 pCut->fUser = 1;
251 if ( vAig )
252 Vec_IntClear( vAig );
253 if ( pCut->nLeaves == 0 ) // const
254 {
255 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
256 if ( vAig )
257 Vec_IntPush( vAig, Abc_LitIsCompl(If_CutTruthLit(pCut)) );
258 pCut->Cost = 0;
259 return 0;
260 }
261 if ( pCut->nLeaves == 1 ) // variable
262 {
263 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
264 if ( vAig )
265 Vec_IntPush( vAig, 0 );
266 if ( vAig )
267 Vec_IntPush( vAig, Abc_LitIsCompl(If_CutTruthLit(pCut)) );
268 pCut->Cost = 0;
269 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
270 }
271 else
272 {
273 int fVerbose = 0;
274 Vec_Int_t * vCover = Vec_WecEntry( p->vTtIsops[pCut->nLeaves], Abc_Lit2Var(If_CutTruthLit(pCut)) );
275 int Delay, Area = 0;
276 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
277 if ( vCover == NULL )
278 return -1;
279 assert( Vec_IntSize(vCover) > 0 );
280 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
281 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
282 Delay = If_CutSopBalanceEvalIntInt( vCover, If_CutLeaveNum(pCut), pTimes, vAig, Abc_LitIsCompl(If_CutTruthLit(pCut)) ^ pCut->fCompl, &Area );
283 pCut->Cost = Area;
284 if ( fVerbose )
285 {
286 int Max = 0, Two = 0;
287 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
288 Max = Abc_MaxInt( Max, pTimes[i] );
289 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
290 if ( pTimes[i] != Max )
291 Two = Abc_MaxInt( Two, pTimes[i] );
292 if ( Two + 2 < Max && Max + 3 < Delay )
293 {
294 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
295 printf( "%3d ", pTimes[i] );
296 for ( ; i < p->pPars->nLutSize; i++ )
297 printf( " " );
298 printf( "-> %3d ", Delay );
299 Dau_DsdPrintFromTruth( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut) );
300 Kit_TruthIsopPrintCover( vCover, If_CutLeaveNum(pCut), Abc_LitIsCompl(If_CutTruthLit(pCut)) ^ pCut->fCompl );
301 {
302 Vec_Int_t vIsop;
303 int pIsop[64];
304 vIsop.nCap = vIsop.nSize = Abc_Tt6Esop( *If_CutTruthW(p, pCut), pCut->nLeaves, pIsop );
305 vIsop.pArray = pIsop;
306 printf( "ESOP (%d -> %d)\n", Vec_IntSize(vCover), vIsop.nSize );
307 Kit_TruthIsopPrintCover( &vIsop, If_CutLeaveNum(pCut), 0 );
308 }
309 printf( "\n" );
310 }
311 }
312 return Delay;
313 }
314}
void Dau_DsdPrintFromTruth(word *pTruth, int nVarsInit)
Definition dauDsd.c:1968
int If_CutSopBalanceEvalIntInt(Vec_Int_t *vCover, int nLeaves, int *pTimes, Vec_Int_t *vAig, int fCompl, int *pArea)
Definition ifDelay.c:232
void Kit_TruthIsopPrintCover(Vec_Int_t *vCover, int nVars, int fCompl)
Definition kitIsop.c:183
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutSopBalanceEvalInt()

int If_CutSopBalanceEvalInt ( Vec_Int_t * vCover,
int * pTimes,
int * pFaninLits,
Vec_Int_t * vAig,
int * piRes,
int nSuppAll,
int * pArea )
extern

Function*************************************************************

Synopsis [Evaluate delay using SOP balancing.]

Description []

SideEffects []

SeeAlso []

Definition at line 192 of file ifDelay.c.

193{
194 int nCounterAnd, pCounterAnd[IF_MAX_FUNC_LUTSIZE], pFaninLitsAnd[IF_MAX_FUNC_LUTSIZE];
195 int nCounterOr, pCounterOr[IF_MAX_CUBES], pFaninLitsOr[IF_MAX_CUBES];
196 int i, k, Entry, Literal, nLits, Delay = 0, iRes = 0;
197 if ( Vec_IntSize(vCover) > IF_MAX_CUBES )
198 return -1;
199 nCounterOr = 0;
200 Vec_IntForEachEntry( vCover, Entry, i )
201 {
202 nCounterAnd = nLits = 0;
203 for ( k = 0; k < nSuppAll; k++ )
204 {
205 Literal = 3 & (Entry >> (k << 1));
206 if ( Literal == 1 ) // neg literal
207 nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], vAig ? Abc_LitNot(pFaninLits[k]) : -1, vAig, nSuppAll, 0, 0 );
208 else if ( Literal == 2 ) // pos literal
209 nLits++, Delay = If_LogCounterAddAig( pCounterAnd, &nCounterAnd, pFaninLitsAnd, pTimes[k], vAig ? pFaninLits[k] : -1, vAig, nSuppAll, 0, 0 );
210 else if ( Literal != 0 )
211 assert( 0 );
212 }
213 assert( nCounterAnd > 0 );
214 assert( nLits > 0 );
215 if ( vAig )
216 iRes = If_LogCreateAndXorMulti( vAig, pFaninLitsAnd, nCounterAnd, nSuppAll, 0 );
217 else
218 *pArea += nLits == 1 ? 0 : nLits - 1;
219 Delay = If_LogCounterAddAig( pCounterOr, &nCounterOr, pFaninLitsOr, Delay, vAig ? Abc_LitNot(iRes) : -1, vAig, nSuppAll, 0, 0 );
220 }
221 assert( nCounterOr > 0 );
222 if ( vAig )
223 {
224 *piRes = Abc_LitNot( If_LogCreateAndXorMulti( vAig, pFaninLitsOr, nCounterOr, nSuppAll, 0 ) );
225 if ( ((vCover->nCap >> 16) & 1) ) // hack to remember complemented attribute
226 *piRes = Abc_LitNot( *piRes );
227 }
228 else
229 *pArea += Vec_IntSize(vCover) == 1 ? 0 : Vec_IntSize(vCover) - 1;
230 return Delay;
231}
#define IF_MAX_CUBES
DECLARATIONS ///.
Definition ifDelay.c:31
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ If_CutSopBalancePinDelays()

int If_CutSopBalancePinDelays ( If_Man_t * p,
If_Cut_t * pCut,
char * pPerm )
extern

Definition at line 159 of file ifDelay.c.

160{
161 if ( pCut->nLeaves == 0 ) // const
162 return 0;
163 if ( pCut->nLeaves == 1 ) // variable
164 {
165 pPerm[0] = 0;
166 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
167 }
168 else
169 {
170 Vec_Int_t * vCover;
171 int i, pTimes[IF_MAX_FUNC_LUTSIZE];
172 vCover = Vec_WecEntry( p->vTtIsops[pCut->nLeaves], Abc_Lit2Var(If_CutTruthLit(pCut)) );
173 if ( Vec_IntSize(vCover) == 0 )
174 return -1;
175 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
176 pTimes[i] = (int)If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
177 return If_CutSopBalancePinDelaysIntInt( vCover, pTimes, If_CutLeaveNum(pCut), pPerm );
178 }
179}
int If_CutSopBalancePinDelaysIntInt(Vec_Int_t *vCover, int *pTimes, int nSuppAll, char *pPerm)
Definition ifDelay.c:149
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutSopBalancePinDelaysInt()

int If_CutSopBalancePinDelaysInt ( Vec_Int_t * vCover,
int * pTimes,
word * pFaninRes,
int nSuppAll,
word * pRes )
extern

Function*************************************************************

Synopsis [Compute pin delays.]

Description []

SideEffects []

SeeAlso []

Definition at line 120 of file ifDelay.c.

121{
122 word pPinDelsAnd[IF_MAX_FUNC_LUTSIZE], pPinDelsOr[IF_MAX_CUBES];
123 int nCounterAnd, pCounterAnd[IF_MAX_FUNC_LUTSIZE];
124 int nCounterOr, pCounterOr[IF_MAX_CUBES];
125 int i, k, Entry, Literal, Delay = 0;
126 word ResAnd;
127 if ( Vec_IntSize(vCover) > IF_MAX_CUBES )
128 return -1;
129 nCounterOr = 0;
130 Vec_IntForEachEntry( vCover, Entry, i )
131 {
132 nCounterAnd = 0;
133 for ( k = 0; k < nSuppAll; k++ )
134 {
135 Literal = 3 & (Entry >> (k << 1));
136 if ( Literal == 1 || Literal == 2 ) // neg or pos literal
137 Delay = If_LogCounterPinDelays( pCounterAnd, &nCounterAnd, pPinDelsAnd, pTimes[k], pFaninRes[k], nSuppAll, 0 );
138 else if ( Literal != 0 )
139 assert( 0 );
140 }
141 assert( nCounterAnd > 0 );
142 ResAnd = If_LogPinDelaysMulti( pPinDelsAnd, nCounterAnd, nSuppAll, 0 );
143 Delay = If_LogCounterPinDelays( pCounterOr, &nCounterOr, pPinDelsOr, Delay, ResAnd, nSuppAll, 0 );
144 }
145 assert( nCounterOr > 0 );
146 *pRes = If_LogPinDelaysMulti( pPinDelsOr, nCounterOr, nSuppAll, 0 );
147 return Delay;
148}
Here is the caller graph for this function:

◆ If_CutSort()

void If_CutSort ( If_Man_t * p,
If_Set_t * pCutSet,
If_Cut_t * pCut )
extern

Function*************************************************************

Synopsis [Performs incremental sorting of cuts.]

Description [Currently only the trivial sorting is implemented.]

SideEffects []

SeeAlso []

Definition at line 746 of file ifCut.c.

747{
748// int Counter = 0;
749 int i;
750
751 // the new cut is the last one
752 assert( pCutSet->ppCuts[pCutSet->nCuts] == pCut );
753 assert( pCutSet->nCuts <= pCutSet->nCutsMax );
754
755 // cut structure is empty
756 if ( pCutSet->nCuts == 0 )
757 {
758 pCutSet->nCuts++;
759 return;
760 }
761
762 if ( !pCut->fUseless &&
763 (p->pPars->fUseDsd || p->pPars->pFuncCell2 || p->pPars->fUseBat ||
764 p->pPars->pLutStruct || p->pPars->fUserRecLib || p->pPars->fUserSesLib || p->pPars->fUserLutDec || p->pPars->fUserLut2D ||
765 p->pPars->fEnableCheck07 || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec ||
766 p->pPars->fUseDsdTune || p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u || p->pPars->fUseCheck1 || p->pPars->fUseCheck2) )
767 {
768 If_Cut_t * pFirst = pCutSet->ppCuts[0];
769 if ( pFirst->fUseless || If_ManSortCompare(p, pFirst, pCut) == 1 )
770 {
771 pCutSet->ppCuts[0] = pCut;
772 pCutSet->ppCuts[pCutSet->nCuts] = pFirst;
773 If_CutSort( p, pCutSet, pFirst );
774 return;
775 }
776 }
777
778 // the cut will be added - find its place
779 for ( i = pCutSet->nCuts-1; i >= 0; i-- )
780 {
781// Counter++;
782 if ( If_ManSortCompare( p, pCutSet->ppCuts[i], pCut ) <= 0 || (i == 0 && !pCutSet->ppCuts[0]->fUseless && pCut->fUseless) )
783 break;
784 pCutSet->ppCuts[i+1] = pCutSet->ppCuts[i];
785 pCutSet->ppCuts[i] = pCut;
786 }
787// Abc_Print( 1, "%d ", Counter );
788
789 // update the number of cuts
790 if ( pCutSet->nCuts < pCutSet->nCutsMax )
791 pCutSet->nCuts++;
792}
void If_CutSort(If_Man_t *p, If_Set_t *pCutSet, If_Cut_t *pCut)
Definition ifCut.c:746
short nCutsMax
Definition if.h:324
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_CutTraverse()

void If_CutTraverse ( If_Man_t * p,
If_Obj_t * pRoot,
If_Cut_t * pCut,
Vec_Ptr_t * vNodes )
extern

Definition at line 565 of file ifUtil.c.

566{
567 If_Obj_t * pLeaf;
568 int i;
569 // collect the internal nodes of the cut
570 Vec_PtrClear( vNodes );
571 If_CutForEachLeaf( p, pCut, pLeaf, i )
572 {
573 Vec_PtrPush( vNodes, pLeaf );
574 assert( pLeaf->fMark == 0 );
575 pLeaf->fMark = 1;
576 }
577 // collect other nodes
578 If_CutTraverse_rec( pRoot, vNodes );
579 // clean the mark
580 Vec_PtrForEachEntry( If_Obj_t *, vNodes, pLeaf, i )
581 pLeaf->fMark = 0;
582}
unsigned fMark
Definition if.h:338
Here is the caller graph for this function:

◆ If_CutVerifyCuts()

int If_CutVerifyCuts ( If_Set_t * pCutSet,
int fOrdered )
extern

Definition at line 62 of file ifCut.c.

63{
64 static int Count = 0;
65 If_Cut_t * pCut0, * pCut1;
66 int i, k, m, n, Value;
67 assert( pCutSet->nCuts > 0 );
68 for ( i = 0; i < pCutSet->nCuts; i++ )
69 {
70 pCut0 = pCutSet->ppCuts[i];
71 assert( pCut0->uSign == If_ObjCutSignCompute(pCut0) );
72 if ( fOrdered )
73 {
74 // check duplicates
75 for ( m = 1; m < (int)pCut0->nLeaves; m++ )
76 assert( pCut0->pLeaves[m-1] < pCut0->pLeaves[m] );
77 }
78 else
79 {
80 // check duplicates
81 for ( m = 0; m < (int)pCut0->nLeaves; m++ )
82 for ( n = m+1; n < (int)pCut0->nLeaves; n++ )
83 assert( pCut0->pLeaves[m] != pCut0->pLeaves[n] );
84 }
85 // check pairs
86 for ( k = 0; k < pCutSet->nCuts; k++ )
87 {
88 pCut1 = pCutSet->ppCuts[k];
89 if ( pCut0 == pCut1 )
90 continue;
91 Count++;
92 // check containments
93 Value = If_CutVerifyCut( pCut0, pCut1 );
94// assert( Value == 0 );
95 if ( Value )
96 {
97 assert( pCut0->uSign == If_ObjCutSignCompute(pCut0) );
98 assert( pCut1->uSign == If_ObjCutSignCompute(pCut1) );
99 If_CutPrint( pCut0 );
100 If_CutPrint( pCut1 );
101 assert( 0 );
102 }
103 }
104 }
105 return 1;
106}
void If_CutPrint(If_Cut_t *pCut)
Definition ifCut.c:864
Here is the call graph for this function:

◆ If_DeriveHashTable6()

Vec_Mem_t * If_DeriveHashTable6 ( int nVars,
word uTruth )
extern

Function*************************************************************

Synopsis [Check the function of 6-input LUT.]

Description []

SideEffects []

SeeAlso []

Definition at line 345 of file ifTruth.c.

346{
347 int fVerbose = 0;
348 int nMints = (1 << nVars);
349 int nPerms = Extra_Factorial( nVars );
350 int * pComp = Extra_GreyCodeSchedule( nVars );
351 int * pPerm = Extra_PermSchedule( nVars );
352 word Canon = ABC_CONST(0xFFFFFFFFFFFFFFFF);
353 word tCur, tTemp1, tTemp2;
354 Vec_Mem_t * vTtMem6 = Vec_MemAllocForTTSimple( nVars );
355 int i, p, c;
356 for ( i = 0; i < 2; i++ )
357 {
358 tCur = i ? ~uTruth : uTruth;
359 tTemp1 = tCur;
360 for ( p = 0; p < nPerms; p++ )
361 {
362 tTemp2 = tCur;
363 for ( c = 0; c < nMints; c++ )
364 {
365 if ( Canon > tCur )
366 Canon = tCur;
367 Vec_MemHashInsert( vTtMem6, &tCur );
368 tCur = Abc_Tt6Flip( tCur, pComp[c] );
369 }
370 assert( tTemp2 == tCur );
371 tCur = Abc_Tt6SwapAdjacent( tCur, pPerm[p] );
372 }
373 assert( tTemp1 == tCur );
374 }
375 ABC_FREE( pComp );
376 ABC_FREE( pPerm );
377 if ( fVerbose )
378 {
379/*
380 word * pEntry;
381 Vec_MemForEachEntry( vTtMem6, pEntry, i )
382 {
383 Extra_PrintHex( stdout, (unsigned*)pEntry, nVars );
384 printf( ", " );
385 if ( i % 4 == 3 )
386 printf( "\n" );
387 }
388*/
389 Extra_PrintHex( stdout, (unsigned*)&uTruth, nVars ); printf( "\n" );
390 Extra_PrintHex( stdout, (unsigned*)&Canon, nVars ); printf( "\n" );
391 printf( "Members = %d.\n", Vec_MemEntryNum(vTtMem6) );
392 }
393 return vTtMem6;
394}
#define ABC_FREE(obj)
Definition abc_global.h:267
int * Extra_PermSchedule(int n)
int Extra_Factorial(int n)
int * Extra_GreyCodeSchedule(int n)
void Extra_PrintHex(FILE *pFile, unsigned *pTruth, int nVars)
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
Definition utilMem.c:35
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManAlloc()

If_DsdMan_t * If_DsdManAlloc ( int nVars,
int nLutSize )
extern

Definition at line 264 of file ifDsd.c.

265{
266 If_DsdMan_t * p; int v;
267 char pFileName[100];
268 assert( nVars <= DAU_MAX_VAR );
269 sprintf( pFileName, "%02d.dsd", nVars );
270 p = ABC_CALLOC( If_DsdMan_t, 1 );
271 p->pStore = Abc_UtilStrsav( pFileName );
272 p->nVars = nVars;
273 p->LutSize = LutSize;
274 p->nWords = Abc_TtWordNum( nVars );
275 p->nBins = Abc_PrimeCudd( 100000 );
276 p->pBins = ABC_CALLOC( unsigned, p->nBins );
277 p->pMem = Mem_FlexStart();
278 p->nConfigWords = 1;
279 Vec_PtrGrow( &p->vObjs, 10000 );
280 Vec_IntGrow( &p->vNexts, 10000 );
281 Vec_IntGrow( &p->vTruths, 10000 );
283 If_DsdObjAlloc( p, IF_DSD_VAR, 0 )->nSupp = 1;
284 p->vTemp1 = Vec_IntAlloc( 32 );
285 p->vTemp2 = Vec_IntAlloc( 32 );
286 p->pTtElems = If_ManDsdTtElems();
287 for ( v = 3; v <= nVars; v++ )
288 {
289 p->vTtMem[v] = Vec_MemAlloc( Abc_TtWordNum(v), 12 );
290 Vec_MemHashAlloc( p->vTtMem[v], 10000 );
291 p->vTtDecs[v] = Vec_PtrAlloc( 1000 );
292 }
293/*
294 p->pTtGia = Gia_ManStart( nVars );
295 Gia_ManHashAlloc( p->pTtGia );
296 for ( v = 0; v < nVars; v++ )
297 Gia_ManAppendCi( p->pTtGia );
298*/
299 for ( v = 2; v < nVars; v++ )
300 p->pSched[v] = Extra_GreyCodeSchedule( v );
301 if ( LutSize )
302 p->pSat = If_ManSatBuildXY( LutSize );
303 p->vCover = Vec_IntAlloc( 0 );
304 return p;
305}
#define DAU_MAX_VAR
INCLUDES ///.
Definition dau.h:42
@ IF_DSD_CONST0
Definition ifDsd.c:56
@ IF_DSD_VAR
Definition ifDsd.c:57
If_DsdObj_t * If_DsdObjAlloc(If_DsdMan_t *p, int Type, int nFans)
Definition ifDsd.c:247
void * If_ManSatBuildXY(int nLutSize)
DECLARATIONS ///.
Definition ifSat.c:45
struct If_DsdMan_t_ If_DsdMan_t
Definition if.h:84
Mem_Flex_t * Mem_FlexStart()
Definition mem.c:327
unsigned nSupp
Definition ifDsd.c:69
char * sprintf()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManAllocIsops()

void If_DsdManAllocIsops ( If_DsdMan_t * p,
int nLutSize )
extern

Definition at line 306 of file ifDsd.c.

307{
308 Vec_Int_t * vLevel;
309 int v, i, fCompl;
310 word * pTruth;
311 if ( p->vIsops[3] != NULL )
312 return;
313 if ( Vec_PtrSize(&p->vObjs) > 2 )
314 printf( "Warning: DSD manager is already started without ISOPs.\n" );
315 for ( v = 3; v <= nLutSize; v++ )
316 {
317 p->vIsops[v] = Vec_WecAlloc( 100 );
318 Vec_MemForEachEntry( p->vTtMem[v], pTruth, i )
319 {
320 vLevel = Vec_WecPushLevel( p->vIsops[v] );
321 fCompl = Kit_TruthIsop( (unsigned *)pTruth, v, p->vCover, 1 );
322 if ( fCompl >= 0 && Vec_IntSize(p->vCover) <= 8 )
323 {
324 Vec_IntGrow( vLevel, Vec_IntSize(p->vCover) );
325 Vec_IntAppend( vLevel, p->vCover );
326 if ( fCompl )
327 vLevel->nCap ^= (1<<16); // hack to remember complemented attribute
328 }
329 }
330 assert( Vec_WecSize(p->vIsops[v]) == Vec_MemEntryNum(p->vTtMem[v]) );
331 }
332}
#define Vec_MemForEachEntry(p, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecMem.h:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManCheckDec()

int If_DsdManCheckDec ( If_DsdMan_t * p,
int iDsd )
extern

Definition at line 201 of file ifDsd.c.

202{
203 return If_DsdVecObjMark( &p->vObjs, Abc_Lit2Var(iDsd) );
204}
Here is the caller graph for this function:

◆ If_DsdManCheckXY()

unsigned If_DsdManCheckXY ( If_DsdMan_t * p,
int iDsd,
int LutSize,
int fDerive,
unsigned uMaskNot,
int fHighEffort,
int fVerbose )
extern

Definition at line 2017 of file ifDsd.c.

2018{
2019 unsigned uSet = If_DsdManCheckXY_int( p, iDsd, LutSize, fDerive, uMaskNot, fVerbose );
2020 if ( uSet == 0 && fHighEffort )
2021 {
2022// abctime clk = Abc_Clock();
2023 int nVars = If_DsdVecLitSuppSize( &p->vObjs, iDsd );
2024 word * pRes = If_DsdManComputeTruth( p, iDsd, NULL );
2025 uSet = If_ManSatCheckXYall( p->pSat, LutSize, pRes, nVars, p->vTemp1 );
2026 if ( uSet )
2027 {
2028// If_DsdManPrintOne( stdout, p, Abc_Lit2Var(iDsd), NULL, 1 );
2029// Dau_DecPrintSet( uSet, nVars, 1 );
2030 }
2031// p->timeCheck2 += Abc_Clock() - clk;
2032 }
2033 return uSet;
2034}
unsigned If_DsdManCheckXY_int(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fVerbose)
Definition ifDsd.c:1942
word * If_DsdManComputeTruth(If_DsdMan_t *p, int iDsd, unsigned char *pPermLits)
Definition ifDsd.c:1427
unsigned If_ManSatCheckXYall(void *pSat, int nLutSize, word *pTruth, int nVars, Vec_Int_t *vLits)
Definition ifSat.c:477
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManCleanMarks()

void If_DsdManCleanMarks ( If_DsdMan_t * p,
int fVerbose )
extern

Definition at line 1255 of file ifDsd.c.

1256{
1257 If_DsdObj_t * pObj;
1258 int i;
1259 ABC_FREE( p->pCellStr );
1260 Vec_WrdFreeP( &p->vConfigs );
1261 If_DsdVecForEachObj( &p->vObjs, pObj, i )
1262 pObj->fMark = 0;
1263}
struct If_DsdObj_t_ If_DsdObj_t
Definition ifDsd.c:64
#define If_DsdVecForEachObj(vVec, pObj, i)
Definition ifDsd.c:139
unsigned fMark
Definition ifDsd.c:70

◆ If_DsdManCleanOccur()

void If_DsdManCleanOccur ( If_DsdMan_t * p,
int fVerbose )
extern

Definition at line 1248 of file ifDsd.c.

1249{
1250 If_DsdObj_t * pObj;
1251 int i;
1252 If_DsdVecForEachObj( &p->vObjs, pObj, i )
1253 pObj->Count = 0;
1254}
unsigned Count
Definition ifDsd.c:71

◆ If_DsdManCompute()

int If_DsdManCompute ( If_DsdMan_t * p,
word * pTruth,
int nLeaves,
unsigned char * pPerm,
char * pLutStruct )
extern

Function*************************************************************

Synopsis [Add the function to the DSD manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 2063 of file ifDsd.c.

2064{
2065 word pCopy[DAU_MAX_WORD], * pRes;
2066 char pDsd[DAU_MAX_STR];
2067 int iDsd, nSizeNonDec, nSupp = 0;
2068 int nWords = Abc_TtWordNum(nLeaves);
2069// abctime clk = 0;
2070 assert( nLeaves <= DAU_MAX_VAR );
2071 Abc_TtCopy( pCopy, pTruth, nWords, 0 );
2072//clk = Abc_Clock();
2073 nSizeNonDec = Dau_DsdDecompose( pCopy, nLeaves, 0, 1, pDsd );
2074//p->timeDsd += Abc_Clock() - clk;
2075 if ( nSizeNonDec > 0 )
2076 Abc_TtStretch6( pCopy, nSizeNonDec, p->nVars );
2077 memset( pPerm, 0xFF, (size_t)nLeaves );
2078//clk = Abc_Clock();
2079 iDsd = If_DsdManAddDsd( p, pDsd, pCopy, pPerm, &nSupp );
2080//p->timeCanon += Abc_Clock() - clk;
2081 assert( nSupp == nLeaves );
2082 // verify the result
2083//clk = Abc_Clock();
2084 pRes = If_DsdManComputeTruth( p, iDsd, pPerm );
2085//p->timeVerify += Abc_Clock() - clk;
2086 if ( !Abc_TtEqual(pRes, pTruth, nWords) )
2087 {
2088// If_DsdManPrint( p, NULL );
2089 printf( "\n" );
2090 printf( "Verification failed!\n" );
2091 printf( "%s\n", pDsd );
2092 Dau_DsdPrintFromTruth( pTruth, nLeaves );
2093 Dau_DsdPrintFromTruth( pRes, nLeaves );
2094 If_DsdManPrintOne( stdout, p, Abc_Lit2Var(iDsd), pPerm, 1 );
2095 printf( "\n" );
2096 }
2097 If_DsdVecObjIncRef( &p->vObjs, Abc_Lit2Var(iDsd) );
2098 assert( If_DsdVecLitSuppSize(&p->vObjs, iDsd) == nLeaves );
2099 return iDsd;
2100}
#define DAU_MAX_WORD
Definition dau.h:44
#define DAU_MAX_STR
Definition dau.h:43
int If_DsdManAddDsd(If_DsdMan_t *p, char *pDsd, word *pTruth, unsigned char *pPerm, int *pnSupp)
Definition ifDsd.c:1718
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManFileName()

char * If_DsdManFileName ( If_DsdMan_t * p)
extern

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file ifDsd.c.

170{
171 return p->pStore;
172}

◆ If_DsdManFilter()

If_DsdMan_t * If_DsdManFilter ( If_DsdMan_t * p,
int Limit )
extern

Definition at line 1294 of file ifDsd.c.

1295{
1296 If_DsdMan_t * pNew = If_DsdManAlloc( p->nVars, p->LutSize );
1297 If_DsdObj_t * pObj;
1298 Vec_Int_t * vMap;
1299 int i;
1300 vMap = Vec_IntStartFull( Vec_PtrSize(&p->vObjs) );
1301 Vec_IntWriteEntry( vMap, 0, 0 );
1302 Vec_IntWriteEntry( vMap, 1, 1 );
1303 If_DsdVecForEachNode( &p->vObjs, pObj, i )
1304 if ( (int)pObj->Count >= Limit )
1305 If_DsdManFilter_rec( pNew, p, i, vMap );
1306 Vec_IntFree( vMap );
1307 return pNew;
1308}
void If_DsdManFilter_rec(If_DsdMan_t *pNew, If_DsdMan_t *p, int i, Vec_Int_t *vMap)
Definition ifDsd.c:1273
#define If_DsdVecForEachNode(vVec, pObj, i)
Definition ifDsd.c:145
If_DsdMan_t * If_DsdManAlloc(int nVars, int LutSize)
Definition ifDsd.c:264
Here is the call graph for this function:

◆ If_DsdManFree()

void If_DsdManFree ( If_DsdMan_t * p,
int fVerbose )
extern

Definition at line 333 of file ifDsd.c.

334{
335 int v;
336// If_DsdManDumpDsd( p );
337 if ( fVerbose )
338 If_DsdManPrint( p, NULL, 0, 0, 0, 0, 0 );
339 if ( fVerbose )
340 {
341 char FileName[10];
342 for ( v = 3; v <= p->nVars; v++ )
343 {
344 sprintf( FileName, "dumpdsd%02d", v );
345 Vec_MemDumpTruthTables( p->vTtMem[v], FileName, v );
346 }
347 }
348 for ( v = 2; v < p->nVars; v++ )
349 ABC_FREE( p->pSched[v] );
350 for ( v = 3; v <= p->nVars; v++ )
351 {
352 Vec_MemHashFree( p->vTtMem[v] );
353 Vec_MemFree( p->vTtMem[v] );
354 Vec_VecFree( (Vec_Vec_t *)(p->vTtDecs[v]) );
355 if ( p->vIsops[v] )
356 Vec_WecFree( p->vIsops[v] );
357 }
358 Vec_WrdFreeP( &p->vConfigs );
359 Vec_IntFreeP( &p->vTemp1 );
360 Vec_IntFreeP( &p->vTemp2 );
361 ABC_FREE( p->vObjs.pArray );
362 ABC_FREE( p->vNexts.pArray );
363 ABC_FREE( p->vTruths.pArray );
364 Mem_FlexStop( p->pMem, 0 );
365 Gia_ManStopP( &p->pTtGia );
366 Vec_IntFreeP( &p->vCover );
367 If_ManSatUnbuild( p->pSat );
368 ABC_FREE( p->pCellStr );
369 ABC_FREE( p->pStore );
370 ABC_FREE( p->pBins );
371 ABC_FREE( p );
372}
void Gia_ManStopP(Gia_Man_t **p)
Definition giaMan.c:224
void If_DsdManPrint(If_DsdMan_t *p, char *pFileName, int Number, int Support, int fOccurs, int fTtDump, int fVerbose)
Definition ifDsd.c:701
void If_ManSatUnbuild(void *p)
Definition ifSat.c:86
void Mem_FlexStop(Mem_Flex_t *p, int fVerbose)
Definition mem.c:359
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition vecVec.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManGetCellStr()

char * If_DsdManGetCellStr ( If_DsdMan_t * p)
extern

Definition at line 219 of file ifDsd.c.

220{
221 return p->pCellStr;
222}
Here is the caller graph for this function:

◆ If_DsdManGetFuncConfig()

word * If_DsdManGetFuncConfig ( If_DsdMan_t * p,
int iDsd )
extern

Definition at line 215 of file ifDsd.c.

216{
217 return p->vConfigs ? Vec_WrdEntryP(p->vConfigs, p->nConfigWords * Abc_Lit2Var(iDsd)) : NULL;
218}
Here is the caller graph for this function:

◆ If_DsdManInvertMarks()

void If_DsdManInvertMarks ( If_DsdMan_t * p,
int fVerbose )
extern

Definition at line 1264 of file ifDsd.c.

1265{
1266 If_DsdObj_t * pObj;
1267 int i;
1268 ABC_FREE( p->pCellStr );
1269 //Vec_WrdFreeP( &p->vConfigs );
1270 If_DsdVecForEachObj( &p->vObjs, pObj, i )
1271 pObj->fMark = !pObj->fMark;
1272}

◆ If_DsdManLoad()

If_DsdMan_t * If_DsdManLoad ( char * pFileName)
extern

Definition at line 1106 of file ifDsd.c.

1107{
1108 If_DsdMan_t * p;
1109 If_DsdObj_t * pObj;
1110 Vec_Int_t * vSets;
1111 char pBuffer[10];
1112 unsigned * pSpot;
1113 word * pTruth;
1114 int i, v, Num, Num2, RetValue;
1115 FILE * pFile = fopen( pFileName, "rb" );
1116 if ( pFile == NULL )
1117 {
1118 printf( "Reading DSD manager file \"%s\" has failed.\n", pFileName );
1119 return NULL;
1120 }
1121 RetValue = fread( pBuffer, 4, 1, pFile );
1122 if ( strncmp(pBuffer, DSD_VERSION, strlen(DSD_VERSION)) )
1123 {
1124 printf( "Unrecognized format of file \"%s\".\n", pFileName );
1125 return NULL;
1126 }
1127 RetValue = fread( &Num, 4, 1, pFile );
1128 p = If_DsdManAlloc( Num, 0 );
1129 ABC_FREE( p->pStore );
1130 p->pStore = Abc_UtilStrsav( pFileName );
1131 RetValue = fread( &Num, 4, 1, pFile );
1132 p->LutSize = Num;
1133 p->pSat = If_ManSatBuildXY( p->LutSize );
1134 RetValue = fread( &Num, 4, 1, pFile );
1135 assert( Num >= 2 );
1136 Vec_PtrFillExtra( &p->vObjs, Num, NULL );
1137 Vec_IntFill( &p->vNexts, Num, 0 );
1138 Vec_IntFill( &p->vTruths, Num, -1 );
1139 p->nBins = Abc_PrimeCudd( 2*Num );
1140 p->pBins = ABC_REALLOC( unsigned, p->pBins, p->nBins );
1141 memset( p->pBins, 0, sizeof(unsigned) * p->nBins );
1142 for ( i = 2; i < Vec_PtrSize(&p->vObjs); i++ )
1143 {
1144 RetValue = fread( &Num, 4, 1, pFile );
1145 pObj = (If_DsdObj_t *)Mem_FlexEntryFetch( p->pMem, sizeof(word) * Num );
1146 RetValue = fread( pObj, sizeof(word)*Num, 1, pFile );
1147 Vec_PtrWriteEntry( &p->vObjs, i, pObj );
1148 if ( pObj->Type == IF_DSD_PRIME )
1149 {
1150 RetValue = fread( &Num, 4, 1, pFile );
1151 Vec_IntWriteEntry( &p->vTruths, i, Num );
1152 }
1153 pSpot = If_DsdObjHashLookup( p, pObj->Type, (int *)pObj->pFans, pObj->nFans, If_DsdObjTruthId(p, pObj) );
1154 assert( *pSpot == 0 );
1155 *pSpot = pObj->Id;
1156 }
1157 assert( p->nUniqueMisses == Vec_PtrSize(&p->vObjs) - 2 );
1158 p->nUniqueMisses = 0;
1159 pTruth = ABC_ALLOC( word, p->nWords );
1160 for ( v = 3; v <= p->nVars; v++ )
1161 {
1162 int nBytes = sizeof(word)*Vec_MemEntrySize(p->vTtMem[v]);
1163 RetValue = fread( &Num, 4, 1, pFile );
1164 for ( i = 0; i < Num; i++ )
1165 {
1166 RetValue = fread( pTruth, nBytes, 1, pFile );
1167 Vec_MemHashInsert( p->vTtMem[v], pTruth );
1168 }
1169 assert( Num == Vec_MemEntryNum(p->vTtMem[v]) );
1170 RetValue = fread( &Num2, 4, 1, pFile );
1171 for ( i = 0; i < Num2; i++ )
1172 {
1173 RetValue = fread( &Num, 4, 1, pFile );
1174 vSets = Vec_IntAlloc( Num );
1175 RetValue = fread( Vec_IntArray(vSets), sizeof(int)*Num, 1, pFile );
1176 vSets->nSize = Num;
1177 Vec_PtrPush( p->vTtDecs[v], vSets );
1178 }
1179 assert( Num2 == Vec_PtrSize(p->vTtDecs[v]) );
1180 }
1181 ABC_FREE( pTruth );
1182 RetValue = fread( &Num, 4, 1, pFile );
1183 p->nConfigWords = Num;
1184 RetValue = fread( &Num, 4, 1, pFile );
1185 p->nTtBits = Num;
1186 RetValue = fread( &Num, 4, 1, pFile );
1187 if ( RetValue && Num )
1188 {
1189 p->vConfigs = Vec_WrdStart( Num );
1190 RetValue = fread( Vec_WrdArray(p->vConfigs), sizeof(word)*Num, 1, pFile );
1191 }
1192 RetValue = fread( &Num, 4, 1, pFile );
1193 if ( RetValue && Num )
1194 {
1195 p->pCellStr = ABC_CALLOC( char, Num + 1 );
1196 RetValue = fread( p->pCellStr, sizeof(char)*Num, 1, pFile );
1197 }
1198 fclose( pFile );
1199 return p;
1200}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_REALLOC(type, obj, num)
Definition abc_global.h:268
#define DSD_VERSION
DECLARATIONS ///.
Definition ifDsd.c:51
unsigned * If_DsdObjHashLookup(If_DsdMan_t *p, int Type, int *pLits, int nLits, int truthId)
Definition ifDsd.c:920
@ IF_DSD_PRIME
Definition ifDsd.c:61
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition mem.c:388
unsigned nFans
Definition ifDsd.c:72
unsigned pFans[0]
Definition ifDsd.c:73
unsigned Type
Definition ifDsd.c:68
unsigned Id
Definition ifDsd.c:67
int strncmp()
Here is the call graph for this function:

◆ If_DsdManLutSize()

int If_DsdManLutSize ( If_DsdMan_t * p)
extern

Definition at line 181 of file ifDsd.c.

182{
183 return p->LutSize;
184}
Here is the caller graph for this function:

◆ If_DsdManMerge()

void If_DsdManMerge ( If_DsdMan_t * p,
If_DsdMan_t * pNew )
extern

Definition at line 1201 of file ifDsd.c.

1202{
1203 If_DsdObj_t * pObj;
1204 Vec_Int_t * vMap;
1205 int pFanins[DAU_MAX_VAR];
1206 int i, k, iFanin, Id;
1207 if ( p->nVars < pNew->nVars )
1208 {
1209 printf( "The number of variables should be the same or smaller.\n" );
1210 return;
1211 }
1212 if ( p->LutSize != pNew->LutSize )
1213 {
1214 printf( "LUT size should be the same.\n" );
1215 return;
1216 }
1217 assert( p->nTtBits == pNew->nTtBits );
1218 assert( p->nConfigWords == pNew->nConfigWords );
1219 if ( If_DsdManHasMarks(p) != If_DsdManHasMarks(pNew) )
1220 printf( "Warning! Old manager has %smarks while new manager has %smarks.\n",
1221 If_DsdManHasMarks(p) ? "" : "no ", If_DsdManHasMarks(pNew) ? "" : "no " );
1222 vMap = Vec_IntAlloc( Vec_PtrSize(&pNew->vObjs) );
1223 Vec_IntPush( vMap, 0 );
1224 Vec_IntPush( vMap, 1 );
1225 if ( p->vConfigs && pNew->vConfigs )
1226 Vec_WrdFillExtra( p->vConfigs, p->nConfigWords * (Vec_PtrSize(&p->vObjs) + Vec_PtrSize(&pNew->vObjs)), 0 );
1227 If_DsdVecForEachNode( &pNew->vObjs, pObj, i )
1228 {
1229 If_DsdObjForEachFaninLit( &pNew->vObjs, pObj, iFanin, k )
1230 pFanins[k] = Abc_Lit2LitV( Vec_IntArray(vMap), iFanin );
1231 Id = If_DsdObjFindOrAdd( p, pObj->Type, pFanins, pObj->nFans, pObj->Type == IF_DSD_PRIME ? If_DsdObjTruth(pNew, pObj) : NULL );
1232 if ( pObj->fMark )
1233 If_DsdVecObjSetMark( &p->vObjs, Id );
1234 if ( p->vConfigs && pNew->vConfigs && p->nConfigWords * i < Vec_WrdSize(pNew->vConfigs) )
1235 {
1236 //Vec_WrdFillExtra( p->vConfigs, Id, Vec_WrdEntry(pNew->vConfigs, i) );
1237 word * pConfigNew = Vec_WrdEntryP(pNew->vConfigs, p->nConfigWords * i);
1238 word * pConfigOld = Vec_WrdEntryP(p->vConfigs, p->nConfigWords * Id);
1239 memcpy( pConfigOld, pConfigNew, sizeof(word) * p->nConfigWords );
1240 }
1241 Vec_IntPush( vMap, Id );
1242 }
1243 assert( Vec_IntSize(vMap) == Vec_PtrSize(&pNew->vObjs) );
1244 Vec_IntFree( vMap );
1245 if ( p->vConfigs && pNew->vConfigs )
1246 Vec_WrdShrink( p->vConfigs, p->nConfigWords * Vec_PtrSize(&p->vObjs) );
1247}
int If_DsdObjFindOrAdd(If_DsdMan_t *p, int Type, int *pLits, int nLits, word *pTruth)
Definition ifDsd.c:993
#define If_DsdObjForEachFaninLit(vVec, pObj, iLit, i)
Definition ifDsd.c:149
int If_DsdManHasMarks(If_DsdMan_t *p)
Definition ifDsd.c:432
int nVars
Definition ifDsd.c:79
Vec_Wrd_t * vConfigs
Definition ifDsd.c:97
int nConfigWords
Definition ifDsd.c:96
int nTtBits
Definition ifDsd.c:95
int LutSize
Definition ifDsd.c:80
Vec_Ptr_t vObjs
Definition ifDsd.c:85
Here is the call graph for this function:

◆ If_DsdManObjNum()

int If_DsdManObjNum ( If_DsdMan_t * p)
extern

Definition at line 177 of file ifDsd.c.

178{
179 return Vec_PtrSize( &p->vObjs );
180}
Here is the caller graph for this function:

◆ If_DsdManPermBitNum()

int If_DsdManPermBitNum ( If_DsdMan_t * p)
extern

Definition at line 189 of file ifDsd.c.

190{
191 return (Abc_Base2Log(p->nVars + 1) + 1) * p->nVars;
192}
Here is the caller graph for this function:

◆ If_DsdManPrint()

void If_DsdManPrint ( If_DsdMan_t * p,
char * pFileName,
int Number,
int Support,
int fOccurs,
int fTtDump,
int fVerbose )
extern

Definition at line 701 of file ifDsd.c.

702{
703 If_DsdObj_t * pObj;
704 Vec_Int_t * vStructs, * vCounts;
705 int CountUsed = 0, CountNonDsd = 0, CountNonDsdStr = 0, CountMarked = 0, CountPrime = 0;
706 int i, v, * pPerm, DsdMax = 0, MemSizeTTs = 0, MemSizeDecs = 0;
707 FILE * pFile;
708 pFile = pFileName ? fopen( pFileName, "wb" ) : stdout;
709 if ( pFileName && pFile == NULL )
710 {
711 printf( "cannot open output file\n" );
712 return;
713 }
714 if ( fVerbose )
715 {
716 fprintf( pFile, "***** NOTATIONS USED BELOW *****\n" );
717 fprintf( pFile, "Support -- the support size\n" );
718 fprintf( pFile, "Obj -- the number of nodes in the DSD manager for each support size\n" );
719 fprintf( pFile, " (the constant node and the primary input node have no support)\n" );
720 fprintf( pFile, "ObjNDSD -- the number of prime nodes (that is, nodes whose function has no DSD)\n" );
721 fprintf( pFile, " (percentage is relative to the number of all nodes of that size)\n" );
722 fprintf( pFile, "NPNNDSD -- the number of different NPN classes of prime nodes\n" );
723 fprintf( pFile, " (Each NPN class may appear more than once. For example: F1 = 17(ab(cd))\n" );
724 fprintf( pFile, " and F2 = 17(ab[cd]) both have prime majority node (hex TT is 17),\n" );
725 fprintf( pFile, " but in one case the majority node is fed by AND, and in another by XOR.\n" );
726 fprintf( pFile, " These two majority nodes are different nodes in the DSD manager\n" );
727 fprintf( pFile, "Str -- the number of structures for each support size\n" );
728 fprintf( pFile, " (each structure is composed of one or more nodes)\n" );
729 fprintf( pFile, "StrNDSD -- the number of DSD structures containing at least one prime node\n" );
730 fprintf( pFile, "Marked -- the number of DSD structures matchable with the LUT structure (say, \"44\")\n" );
731 }
732 If_DsdVecForEachObj( &p->vObjs, pObj, i )
733 {
734 if ( If_DsdObjType(pObj) == IF_DSD_PRIME )
735 DsdMax = Abc_MaxInt( DsdMax, pObj->nFans );
736 CountPrime += If_DsdObjType(pObj) == IF_DSD_PRIME;
737 CountNonDsdStr += If_DsdManCheckNonDec_rec( p, pObj->Id );
738 CountUsed += ( If_DsdVecObjRef(&p->vObjs, pObj->Id) > 0 );
739 CountMarked += If_DsdVecObjMark( &p->vObjs, i );
740 }
741 for ( v = 3; v <= p->nVars; v++ )
742 {
743 CountNonDsd += Vec_MemEntryNum(p->vTtMem[v]);
744 MemSizeTTs += Vec_MemEntrySize(p->vTtMem[v]) * Vec_MemEntryNum(p->vTtMem[v]);
745 MemSizeDecs += (int)Vec_VecMemoryInt((Vec_Vec_t *)(p->vTtDecs[v]));
746 }
748 printf( "Number of inputs = %d. LUT size = %d. Marks = %s. NewAsUseless = %s. Bookmark = %d.\n",
749 p->nVars, p->LutSize, If_DsdManHasMarks(p)? "yes" : "no", p->fNewAsUseless? "yes" : "no", p->nObjsPrev );
750 if ( p->pCellStr )
751 printf( "Symbolic cell description: %s\n", p->pCellStr );
752 if ( p->pTtGia )
753 fprintf( pFile, "Non-DSD AIG nodes = %8d\n", Gia_ManAndNum(p->pTtGia) );
754 fprintf( pFile, "Unique table misses = %8d\n", p->nUniqueMisses );
755 fprintf( pFile, "Unique table hits = %8d\n", p->nUniqueHits );
756 fprintf( pFile, "Memory used for objects = %8.2f MB.\n", 1.0*Mem_FlexReadMemUsage(p->pMem)/(1<<20) );
757 fprintf( pFile, "Memory used for functions = %8.2f MB.\n", 8.0*(MemSizeTTs+sizeof(int)*Vec_IntCap(&p->vTruths))/(1<<20) );
758 fprintf( pFile, "Memory used for hash table = %8.2f MB.\n", 1.0*sizeof(int)*(p->nBins+Vec_IntCap(&p->vNexts))/(1<<20) );
759 fprintf( pFile, "Memory used for bound sets = %8.2f MB.\n", 1.0*MemSizeDecs/(1<<20) );
760 fprintf( pFile, "Memory used for array = %8.2f MB.\n", 1.0*sizeof(void *)*Vec_PtrCap(&p->vObjs)/(1<<20) );
761 if ( p->pTtGia )
762 fprintf( pFile, "Memory used for AIG = %8.2f MB.\n", 8.0*Gia_ManAndNum(p->pTtGia)/(1<<20) );
763 if ( p->timeDsd )
764 {
765 Abc_PrintTime( 1, "Time DSD ", p->timeDsd );
766 Abc_PrintTime( 1, "Time canon ", p->timeCanon-p->timeCheck );
767 Abc_PrintTime( 1, "Time check ", p->timeCheck );
768 Abc_PrintTime( 1, "Time check2", p->timeCheck2 );
769 Abc_PrintTime( 1, "Time verify", p->timeVerify );
770 }
771 if ( fOccurs )
772 If_DsdManPrintOccurs( stdout, p );
773// If_DsdManHashProfile( p );
774 if ( fTtDump )
775 If_DsdManDumpDsd( p, Support );
776 if ( fTtDump )
777 If_DsdManDumpAll( p, Support );
778// If_DsdManPrintDecs( stdout, p );
779 if ( !fVerbose )
780 return;
781 vStructs = Vec_IntAlloc( 1000 );
782 vCounts = Vec_IntAlloc( 1000 );
783 If_DsdVecForEachObj( &p->vObjs, pObj, i )
784 {
785 if ( Number && i % Number )
786 continue;
787 if ( Support && Support != If_DsdObjSuppSize(pObj) )
788 continue;
789 Vec_IntPush( vStructs, i );
790 Vec_IntPush( vCounts, -(int)pObj->Count );
791// If_DsdManPrintOne( pFile, p, pObj->Id, NULL, 1 );
792 }
793// fprintf( pFile, "\n" );
794 pPerm = Abc_MergeSortCost( Vec_IntArray(vCounts), Vec_IntSize(vCounts) );
795 for ( i = 0; i < Abc_MinInt(Vec_IntSize(vCounts), 20); i++ )
796 {
797 printf( "%2d : ", i+1 );
798 pObj = If_DsdVecObj( &p->vObjs, Vec_IntEntry(vStructs, pPerm[i]) );
799 If_DsdManPrintOne( pFile, p, pObj->Id, NULL, 1 );
800 }
801 ABC_FREE( pPerm );
802 Vec_IntFree( vStructs );
803 Vec_IntFree( vCounts );
804 if ( pFileName )
805 fclose( pFile );
806}
int * Abc_MergeSortCost(int *pCosts, int nSize)
Definition utilSort.c:442
void If_DsdManDumpDsd(If_DsdMan_t *p, int Support)
Definition ifDsd.c:373
int If_DsdManCheckNonDec_rec(If_DsdMan_t *p, int Id)
Definition ifDsd.c:470
void If_DsdManPrintDistrib(If_DsdMan_t *p)
Definition ifDsd.c:647
void If_DsdManPrintOccurs(FILE *pFile, If_DsdMan_t *p)
Definition ifDsd.c:589
void If_DsdManDumpAll(If_DsdMan_t *p, int Support)
Definition ifDsd.c:407
int Mem_FlexReadMemUsage(Mem_Flex_t *p)
Definition mem.c:461
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_DsdManReadMark()

int If_DsdManReadMark ( If_DsdMan_t * p,
int iDsd )
extern

Definition at line 205 of file ifDsd.c.

206{
207 return If_DsdVecObjMark( &p->vObjs, Abc_Lit2Var(iDsd) );
208}
Here is the caller graph for this function:

◆ If_DsdManSave()

void If_DsdManSave ( If_DsdMan_t * p,
char * pFileName )
extern

Function*************************************************************

Synopsis [Saving/loading DSD manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 1049 of file ifDsd.c.

1050{
1051 If_DsdObj_t * pObj;
1052 Vec_Int_t * vSets;
1053 word * pTruth;
1054 int i, v, Num;
1055 FILE * pFile = fopen( pFileName ? pFileName : p->pStore, "wb" );
1056 if ( pFile == NULL )
1057 {
1058 printf( "Writing DSD manager file \"%s\" has failed.\n", pFileName ? pFileName : p->pStore );
1059 return;
1060 }
1061 fwrite( DSD_VERSION, 4, 1, pFile );
1062 Num = p->nVars;
1063 fwrite( &Num, 4, 1, pFile );
1064 Num = p->LutSize;
1065 fwrite( &Num, 4, 1, pFile );
1066 Num = Vec_PtrSize(&p->vObjs);
1067 fwrite( &Num, 4, 1, pFile );
1068 Vec_PtrForEachEntryStart( If_DsdObj_t *, &p->vObjs, pObj, i, 2 )
1069 {
1070 Num = If_DsdObjWordNum( pObj->nFans );
1071 fwrite( &Num, 4, 1, pFile );
1072 fwrite( pObj, sizeof(word)*Num, 1, pFile );
1073 if ( pObj->Type == IF_DSD_PRIME )
1074 fwrite( Vec_IntEntryP(&p->vTruths, i), 4, 1, pFile );
1075 }
1076 for ( v = 3; v <= p->nVars; v++ )
1077 {
1078 int nBytes = sizeof(word)*Vec_MemEntrySize(p->vTtMem[v]);
1079 Num = Vec_MemEntryNum(p->vTtMem[v]);
1080 fwrite( &Num, 4, 1, pFile );
1081 Vec_MemForEachEntry( p->vTtMem[v], pTruth, i )
1082 fwrite( pTruth, nBytes, 1, pFile );
1083 Num = Vec_PtrSize(p->vTtDecs[v]);
1084 fwrite( &Num, 4, 1, pFile );
1085 Vec_PtrForEachEntry( Vec_Int_t *, p->vTtDecs[v], vSets, i )
1086 {
1087 Num = Vec_IntSize(vSets);
1088 fwrite( &Num, 4, 1, pFile );
1089 fwrite( Vec_IntArray(vSets), sizeof(int)*Num, 1, pFile );
1090 }
1091 }
1092 Num = p->nConfigWords;
1093 fwrite( &Num, 4, 1, pFile );
1094 Num = p->nTtBits;
1095 fwrite( &Num, 4, 1, pFile );
1096 Num = p->vConfigs ? Vec_WrdSize(p->vConfigs) : 0;
1097 fwrite( &Num, 4, 1, pFile );
1098 if ( Num )
1099 fwrite( Vec_WrdArray(p->vConfigs), sizeof(word)*Num, 1, pFile );
1100 Num = p->pCellStr ? strlen(p->pCellStr) : 0;
1101 fwrite( &Num, 4, 1, pFile );
1102 if ( Num )
1103 fwrite( p->pCellStr, sizeof(char)*Num, 1, pFile );
1104 fclose( pFile );
1105}
Here is the call graph for this function:

◆ If_DsdManSetLutSize()

void If_DsdManSetLutSize ( If_DsdMan_t * p,
int nLutSize )
extern

Definition at line 193 of file ifDsd.c.

194{
195 p->LutSize = nLutSize;
196}

◆ If_DsdManSetNewAsUseless()

void If_DsdManSetNewAsUseless ( If_DsdMan_t * p)
extern

Definition at line 209 of file ifDsd.c.

210{
211 if ( p->nObjsPrev == 0 )
212 p->nObjsPrev = If_DsdManObjNum(p);
213 p->fNewAsUseless = 1;
214}
int If_DsdManObjNum(If_DsdMan_t *p)
Definition ifDsd.c:177
Here is the call graph for this function:

◆ If_DsdManSuppSize()

int If_DsdManSuppSize ( If_DsdMan_t * p,
int iDsd )
extern

Definition at line 197 of file ifDsd.c.

198{
199 return If_DsdVecLitSuppSize( &p->vObjs, iDsd );
200}
Here is the caller graph for this function:

◆ If_DsdManTtBitNum()

int If_DsdManTtBitNum ( If_DsdMan_t * p)
extern

Definition at line 185 of file ifDsd.c.

186{
187 return p->nTtBits;
188}
Here is the caller graph for this function:

◆ If_DsdManTune()

void If_DsdManTune ( If_DsdMan_t * p,
int LutSize,
int fFast,
int fAdd,
int fSpec,
int fVerbose )
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2411 of file ifDsd.c.

2412{
2413 ProgressBar * pProgress = NULL;
2414 sat_solver * pSat = NULL;
2415 If_DsdObj_t * pObj;
2416 Vec_Int_t * vLits;
2417 int i, Value, nVars;
2418 word * pTruth;
2419 if ( !fAdd || !LutSize )
2420 If_DsdVecForEachObj( &p->vObjs, pObj, i )
2421 pObj->fMark = 0;
2422 if ( LutSize == 0 )
2423 return;
2424 vLits = Vec_IntAlloc( 1000 );
2425 pSat = (sat_solver *)If_ManSatBuildXY( LutSize );
2426 pProgress = Extra_ProgressBarStart( stdout, Vec_PtrSize(&p->vObjs) );
2427 If_DsdVecForEachObj( &p->vObjs, pObj, i )
2428 {
2429 Extra_ProgressBarUpdate( pProgress, i, NULL );
2430 nVars = If_DsdObjSuppSize(pObj);
2431 if ( nVars <= LutSize )
2432 continue;
2433 if ( fAdd && !pObj->fMark )
2434 continue;
2435 pObj->fMark = 0;
2436 if ( If_DsdManCheckXY(p, Abc_Var2Lit(i, 0), LutSize, 0, 0, 0, 0) )
2437 continue;
2438 if ( fFast )
2439 Value = 0;
2440 else
2441 {
2442 pTruth = If_DsdManComputeTruth( p, Abc_Var2Lit(i, 0), NULL );
2443 Value = If_ManSatCheckXYall( pSat, LutSize, pTruth, nVars, vLits );
2444 }
2445 if ( Value )
2446 continue;
2447 If_DsdVecObjSetMark( &p->vObjs, i );
2448 }
2449 Extra_ProgressBarStop( pProgress );
2450 If_ManSatUnbuild( pSat );
2451 Vec_IntFree( vLits );
2452 if ( fVerbose )
2454}
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
#define sat_solver
Definition cecSatG2.c:34
void Extra_ProgressBarStop(ProgressBar *p)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
unsigned If_DsdManCheckXY(If_DsdMan_t *p, int iDsd, int LutSize, int fDerive, unsigned uMaskNot, int fHighEffort, int fVerbose)
Definition ifDsd.c:2017
Here is the call graph for this function:

◆ If_DsdManVarNum()

int If_DsdManVarNum ( If_DsdMan_t * p)
extern

Definition at line 173 of file ifDsd.c.

174{
175 return p->nVars;
176}
Here is the caller graph for this function:

◆ If_LibBoxAdd()

void If_LibBoxAdd ( If_LibBox_t * p,
If_Box_t * pBox )
extern

Definition at line 136 of file ifLibBox.c.

137{
138 if ( pBox->Id >= Vec_PtrSize(p->vBoxes) )
139 Vec_PtrFillExtra( p->vBoxes, 2 * pBox->Id + 10, NULL );
140 assert( Vec_PtrEntry( p->vBoxes, pBox->Id ) == NULL );
141 Vec_PtrWriteEntry( p->vBoxes, pBox->Id, pBox );
142 p->nBoxes++;
143}
int Id
Definition if.h:372
Here is the caller graph for this function:

◆ If_LibBoxFindBox()

If_Box_t * If_LibBoxFindBox ( If_LibBox_t * p,
char * pName )
extern

Definition at line 125 of file ifLibBox.c.

126{
127 If_Box_t * pBox;
128 int i;
129 if ( p == NULL )
130 return NULL;
131 If_LibBoxForEachBox( p, pBox, i )
132 if ( !strcmp(pBox->pName, pName) )
133 return pBox;
134 return NULL;
135}
#define If_LibBoxForEachBox(p, pBox, i)
DECLARATIONS ///.
Definition ifLibBox.c:31
char * pName
Definition if.h:367
int strcmp()
Here is the call graph for this function:

◆ If_LibBoxFree()

void If_LibBoxFree ( If_LibBox_t * p)
extern

Definition at line 98 of file ifLibBox.c.

99{
100 If_Box_t * pBox;
101 int i;
102 if ( p == NULL )
103 return;
104 If_LibBoxForEachBox( p, pBox, i )
105 If_BoxFree( pBox );
106 Vec_PtrFree( p->vBoxes );
107 ABC_FREE( p );
108}
void If_BoxFree(If_Box_t *p)
Definition ifLibBox.c:68
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LibBoxLoad()

int If_LibBoxLoad ( char * pFileName)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 381 of file ifLibBox.c.

382{
383 FILE * pFile;
384 If_LibBox_t * pLib;
385 char * pFileNameOther;
386 // check if library can be read
387 pFileNameOther = Extra_FileNameGenericAppend( pFileName, ".cdl" );
388 pFile = fopen( pFileNameOther, "r" );
389 if ( pFile == NULL )
390 return 0;
391 fclose( pFile );
392 // read library
393 pLib = If_LibBoxRead2( pFileNameOther );
394 // replace the current library
396 Abc_FrameSetLibBox( pLib );
397 return 1;
398}
ABC_DLL void Abc_FrameSetLibBox(void *pLib)
Definition mainFrame.c:94
ABC_DLL void * Abc_FrameReadLibBox()
Definition mainFrame.c:58
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
If_LibBox_t * If_LibBoxRead2(char *pFileName)
Definition ifLibBox.c:160
void If_LibBoxFree(If_LibBox_t *p)
Definition ifLibBox.c:98
struct If_LibBox_t_ If_LibBox_t
Definition if.h:83
Here is the call graph for this function:

◆ If_LibBoxNum()

int If_LibBoxNum ( If_LibBox_t * p)
extern

Definition at line 144 of file ifLibBox.c.

145{
146 return p->nBoxes;
147}
Here is the caller graph for this function:

◆ If_LibBoxPrint()

void If_LibBoxPrint ( FILE * pFile,
If_LibBox_t * p )
extern

Definition at line 339 of file ifLibBox.c.

340{
341 If_Box_t * pBox;
342 int i, j, k;
343 fprintf( pFile, "# Box library written by ABC on %s.\n", Extra_TimeStamp() );
344 fprintf( pFile, "# <Name> <ID> <Type> <I> <O>\n" );
345 If_LibBoxForEachBox( p, pBox, i )
346 {
347 fprintf( pFile, "%s %d %d %d %d\n", pBox->pName, pBox->Id, !pBox->fBlack, pBox->nPis, pBox->nPos );
348 for ( j = 0; j < pBox->nPos; j++, fprintf(pFile, "\n") )
349 for ( k = 0; k < pBox->nPis; k++ )
350 if ( pBox->pDelays[j * pBox->nPis + k] == -ABC_INFINITY )
351 fprintf( pFile, " - " );
352 else
353 fprintf( pFile, "%5d ", pBox->pDelays[j * pBox->nPis + k] );
354 }
355}
char * Extra_TimeStamp()
int nPos
Definition if.h:374
int nPis
Definition if.h:373
char fBlack
Definition if.h:369
int * pDelays
Definition if.h:375
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LibBoxRead()

If_LibBox_t * If_LibBoxRead ( char * pFileName)
extern

Definition at line 278 of file ifLibBox.c.

279{
280 FILE * pFile;
281 If_LibBox_t * p;
282 If_Box_t * pBox;
283 char * pToken, * pName;
284 int i, Id, fBlack, nPis, nPos;
285 pFile = fopen( pFileName, "rb" );
286 if ( pFile == NULL )
287 {
288 printf( "Cannot open file \"%s\".\n", pFileName );
289 return NULL;
290 }
291 // get the library name
292 pToken = If_LibBoxGetToken( pFile );
293 if ( pToken == NULL )
294 {
295 fclose( pFile );
296 printf( "Cannot read library name from file \"%s\".\n", pFileName );
297 return NULL;
298 }
299 if ( pToken[0] == '.' )
300 {
301 fclose( pFile );
302 printf( "Wrong box format. Please try \"read_box -e\".\n" );
303 return NULL;
304 }
305
306 // create library
307 p = If_LibBoxStart();
308 while ( pToken )
309 {
310 // save name
311 pName = Abc_UtilStrsav(pToken);
312 // save ID
313 pToken = If_LibBoxGetToken( pFile );
314 Id = atoi( pToken );
315 // save white/black
316 pToken = If_LibBoxGetToken( pFile );
317 fBlack = !atoi( pToken );
318 // save PIs
319 pToken = If_LibBoxGetToken( pFile );
320 nPis = atoi( pToken );
321 // save POs
322 pToken = If_LibBoxGetToken( pFile );
323 nPos = atoi( pToken );
324 // create box
325 pBox = If_BoxStart( pName, Id, nPis, nPos, 0, fBlack, 0 );
326 If_LibBoxAdd( p, pBox );
327 // read the table
328 for ( i = 0; i < nPis * nPos; i++ )
329 {
330 pToken = If_LibBoxGetToken( pFile );
331 pBox->pDelays[i] = (pToken[0] == '-') ? -ABC_INFINITY : atoi(pToken);
332 }
333 // extract next name
334 pToken = If_LibBoxGetToken( pFile );
335 }
336 fclose( pFile );
337 return p;
338}
char * If_LibBoxGetToken(FILE *pFile)
Definition ifLibBox.c:255
If_Box_t * If_BoxStart(char *pName, int Id, int nPis, int nPos, int fSeq, int fBlack, int fOuter)
FUNCTION DEFINITIONS ///.
Definition ifLibBox.c:49
void If_LibBoxAdd(If_LibBox_t *p, If_Box_t *pBox)
Definition ifLibBox.c:136
If_LibBox_t * If_LibBoxStart()
Definition ifLibBox.c:86
Here is the call graph for this function:

◆ If_LibBoxRead2()

If_LibBox_t * If_LibBoxRead2 ( char * pFileName)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 160 of file ifLibBox.c.

161{
162 int nSize = 100000;
163 char * pBuffer;
164 FILE * pFile;
165 If_LibBox_t * p = NULL;
166 If_Box_t * pBox = NULL;
167 char * pToken, * pName;
168 int fSeq, fBlack, fOuter;
169 int i, Id, nPis, nPos;
170 pFile = fopen( pFileName, "rb" );
171 if ( pFile == NULL )
172 {
173 printf( "Cannot open file \"%s\".\n", pFileName );
174 return NULL;
175 }
176 // read lines
177 nPis = nPos = 0;
178 pBuffer = ABC_ALLOC( char, nSize );
179 while ( fgets( pBuffer, nSize, pFile ) )
180 {
181 pToken = strtok( pBuffer, " \n\r\t" );
182 if ( pToken == NULL )
183 continue;
184 if ( pToken[0] == '.' )
185 {
186 if ( !strcmp(pToken, ".box") )
187 {
188 // save ID
189 pToken = strtok( NULL, " \n\r\t" );
190 Id = atoi( pToken );
191 // save name
192 pToken = strtok( NULL, " \n\r\t" );
193 pName = Abc_UtilStrsav(pToken);
194 // save PIs
195 pToken = strtok( NULL, " \n\r\t" );
196 nPis = atoi( pToken );
197 // save POs
198 pToken = strtok( NULL, " \n\r\t" );
199 nPos = atoi( pToken );
200 // save attributes
201 fSeq = fBlack = fOuter = 0;
202 pToken = strtok( NULL, " \n\r\t" );
203 while ( pToken )
204 {
205 if ( !strcmp(pToken, "seq") )
206 fSeq = 1;
207 else if ( !strcmp(pToken, "black") )
208 fBlack = 1;
209 else if ( !strcmp(pToken, "outer") )
210 fOuter = 1;
211 else assert( !strcmp(pToken, "comb") || !strcmp(pToken, "white") || !strcmp(pToken, "inner") );
212 pToken = strtok( NULL, " \n\r\t" );
213 }
214 // create library
215 if ( p == NULL )
216 p = If_LibBoxStart();
217 // create box
218 pBox = If_BoxStart( pName, Id, nPis, nPos, fSeq, fBlack, fOuter );
219 If_LibBoxAdd( p, pBox );
220 }
221 continue;
222 }
223 // read the table
224 assert( nPis > 0 && nPos > 0 );
225 for ( i = 0; i < nPis * nPos; i++ )
226 {
227 while ( pToken == NULL )
228 {
229 if ( fgets( pBuffer, nSize, pFile ) == NULL )
230 { printf( "The table does not have enough entries.\n" ); fflush(stdout); assert( 0 ); }
231 pToken = strtok( pBuffer, " \n\r\t" );
232 }
233 pBox->pDelays[i] = (pToken[0] == '-') ? -1 : atoi(pToken);
234 pToken = strtok( NULL, " \n\r\t" );
235 }
236 pBox = NULL;
237 }
238 ABC_FREE( pBuffer );
239 fclose( pFile );
240 return p;
241}
char * strtok()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LibBoxReadBox()

If_Box_t * If_LibBoxReadBox ( If_LibBox_t * p,
int Id )
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 121 of file ifLibBox.c.

122{
123 return (If_Box_t *)Vec_PtrEntry( p->vBoxes, Id );
124}

◆ If_LibBoxStart()

If_LibBox_t * If_LibBoxStart ( )
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file ifLibBox.c.

87{
88 If_LibBox_t * p;
89 p = ABC_CALLOC( If_LibBox_t, 1 );
90 p->vBoxes = Vec_PtrAlloc( 100 );
91 return p;
92}
Here is the caller graph for this function:

◆ If_LibBoxWrite()

void If_LibBoxWrite ( char * pFileName,
If_LibBox_t * p )
extern

Definition at line 356 of file ifLibBox.c.

357{
358 FILE * pFile;
359 pFile = fopen( pFileName, "wb" );
360 if ( pFile == NULL )
361 {
362 printf( "Cannot open file \"%s\".\n", pFileName );
363 return;
364 }
365 If_LibBoxPrint( pFile, p );
366 fclose( pFile );
367 printf( "Finished writing box library into file \"%s\".\n", pFileName );
368}
void If_LibBoxPrint(FILE *pFile, If_LibBox_t *p)
Definition ifLibBox.c:339
Here is the call graph for this function:

◆ If_LibLutDelaysAreDifferent()

int If_LibLutDelaysAreDifferent ( If_LibLut_t * pLutLib)
extern

Function*************************************************************

Synopsis [Returns 1 if the delays are discrete.]

Description []

SideEffects []

SeeAlso []

Definition at line 407 of file ifLibLut.c.

408{
409 int i, k;
410 float Delay = pLutLib->pLutDelays[1][0];
411 if ( pLutLib->fVarPinDelays )
412 {
413 for ( i = 2; i <= pLutLib->LutMax; i++ )
414 for ( k = 0; k < i; k++ )
415 if ( pLutLib->pLutDelays[i][k] != Delay )
416 return 1;
417 }
418 else
419 {
420 for ( i = 2; i <= pLutLib->LutMax; i++ )
421 if ( pLutLib->pLutDelays[i][0] != Delay )
422 return 1;
423 }
424 return 0;
425}
int fVarPinDelays
Definition if.h:191
int LutMax
Definition if.h:190
float pLutDelays[IF_MAX_LUTSIZE+1][IF_MAX_LUTSIZE+1]
Definition if.h:193

◆ If_LibLutDelaysAreDiscrete()

int If_LibLutDelaysAreDiscrete ( If_LibLut_t * pLutLib)
extern

Function*************************************************************

Synopsis [Returns 1 if the delays are discrete.]

Description []

SideEffects []

SeeAlso []

Definition at line 383 of file ifLibLut.c.

384{
385 float Delay;
386 int i;
387 for ( i = 1; i <= pLutLib->LutMax; i++ )
388 {
389 Delay = pLutLib->pLutDelays[i][0];
390 if ( ((float)((int)Delay)) != Delay )
391 return 0;
392 }
393 return 1;
394}

◆ If_LibLutDup()

If_LibLut_t * If_LibLutDup ( If_LibLut_t * p)
extern

Function*************************************************************

Synopsis [Duplicates the LUT library.]

Description []

SideEffects []

SeeAlso []

Definition at line 312 of file ifLibLut.c.

313{
314 If_LibLut_t * pNew;
315 pNew = ABC_ALLOC( If_LibLut_t, 1 );
316 *pNew = *p;
317 pNew->pName = Abc_UtilStrsav( pNew->pName );
318 return pNew;
319}
struct If_LibLut_t_ If_LibLut_t
Definition if.h:82
char * pName
Definition if.h:189
Here is the caller graph for this function:

◆ If_LibLutFastestPinDelay()

float If_LibLutFastestPinDelay ( If_LibLut_t * p)
extern

Function*************************************************************

Synopsis [Gets the delay of the fastest pin.]

Description []

SideEffects []

SeeAlso []

Definition at line 478 of file ifLibLut.c.

479{
480 return !p? 1.0 : p->pLutDelays[p->LutMax][0];
481}

◆ If_LibLutFree()

void If_LibLutFree ( If_LibLut_t * pLutLib)
extern

Function*************************************************************

Synopsis [Frees the LUT library.]

Description []

SideEffects []

SeeAlso []

Definition at line 332 of file ifLibLut.c.

333{
334 if ( pLutLib == NULL )
335 return;
336 ABC_FREE( pLutLib->pName );
337 ABC_FREE( pLutLib );
338}
Here is the caller graph for this function:

◆ If_LibLutPrint()

void If_LibLutPrint ( If_LibLut_t * pLutLib)
extern

Function*************************************************************

Synopsis [Prints the LUT library.]

Description []

SideEffects []

SeeAlso []

Definition at line 352 of file ifLibLut.c.

353{
354 int i, k;
355 Abc_Print( 1, "# The area/delay of k-variable LUTs:\n" );
356 Abc_Print( 1, "# k area delay\n" );
357 if ( pLutLib->fVarPinDelays )
358 {
359 for ( i = 1; i <= pLutLib->LutMax; i++ )
360 {
361 Abc_Print( 1, "%d %7.2f ", i, pLutLib->pLutAreas[i] );
362 for ( k = 0; k < i; k++ )
363 Abc_Print( 1, " %7.2f", pLutLib->pLutDelays[i][k] );
364 Abc_Print( 1, "\n" );
365 }
366 }
367 else
368 for ( i = 1; i <= pLutLib->LutMax; i++ )
369 Abc_Print( 1, "%d %7.2f %7.2f\n", i, pLutLib->pLutAreas[i], pLutLib->pLutDelays[i][0] );
370}
float pLutAreas[IF_MAX_LUTSIZE+1]
Definition if.h:192

◆ If_LibLutRead()

If_LibLut_t * If_LibLutRead ( char * FileName)
extern

Function*************************************************************

Synopsis [Reads the description of LUTs from the LUT library file.]

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file ifLibLut.c.

203{
204 char pBuffer[1000], * pToken;
205 If_LibLut_t * p;
206 FILE * pFile;
207 int i, k;
208
209 pFile = fopen( FileName, "r" );
210 if ( pFile == NULL )
211 {
212 Abc_Print( -1, "Cannot open LUT library file \"%s\".\n", FileName );
213 return NULL;
214 }
215
216 p = ABC_ALLOC( If_LibLut_t, 1 );
217 memset( p, 0, sizeof(If_LibLut_t) );
218 p->pName = Abc_UtilStrsav( FileName );
219
220 i = 1;
221 while ( fgets( pBuffer, 1000, pFile ) != NULL )
222 {
223 pToken = strtok( pBuffer, " \t\n" );
224 if ( pToken == NULL )
225 continue;
226 if ( pToken[0] == '#' )
227 continue;
228 if ( i != atoi(pToken) )
229 {
230 Abc_Print( 1, "Error in the LUT library file \"%s\".\n", FileName );
231 ABC_FREE( p->pName );
232 ABC_FREE( p );
233 fclose( pFile );
234 return NULL;
235 }
236
237 // read area
238 pToken = strtok( NULL, " \t\n" );
239 p->pLutAreas[i] = (float)atof(pToken);
240
241 // read delays
242 k = 0;
243 while ( (pToken = strtok( NULL, " \t\n" )) )
244 p->pLutDelays[i][k++] = (float)atof(pToken);
245
246 // check for out-of-bound
247 if ( k > i )
248 {
249 ABC_FREE( p->pName );
250 ABC_FREE( p );
251 Abc_Print( 1, "LUT %d has too many pins (%d). Max allowed is %d.\n", i, k, i );
252 fclose( pFile );
253 return NULL;
254 }
255
256 // check if var delays are specified
257 if ( k > 1 )
258 p->fVarPinDelays = 1;
259
260 if ( i == IF_MAX_LUTSIZE )
261 {
262 ABC_FREE( p->pName );
263 ABC_FREE( p );
264 Abc_Print( 1, "Skipping LUTs of size more than %d.\n", i );
265 fclose( pFile );
266 return NULL;
267 }
268 i++;
269 }
270 p->LutMax = i-1;
271
272 // check the library
273 if ( p->fVarPinDelays )
274 {
275 for ( i = 1; i <= p->LutMax; i++ )
276 for ( k = 0; k < i; k++ )
277 {
278 if ( p->pLutDelays[i][k] <= 0.0 )
279 Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n",
280 k, i, p->pLutDelays[i][k] );
281 if ( k && p->pLutDelays[i][k-1] > p->pLutDelays[i][k] )
282 Abc_Print( 0, "Pin %d of LUT %d has delay %f. Pin %d of LUT %d has delay %f. Pin delays should be in non-decreasing order. Technology mapping may not work correctly.\n",
283 k-1, i, p->pLutDelays[i][k-1],
284 k, i, p->pLutDelays[i][k] );
285 }
286 }
287 else
288 {
289 for ( i = 1; i <= p->LutMax; i++ )
290 {
291 if ( p->pLutDelays[i][0] <= 0.0 )
292 Abc_Print( 0, "LUT %d has delay %f. Pin delays should be non-negative numbers. Technology mapping may not work correctly.\n",
293 i, p->pLutDelays[i][0] );
294 }
295 }
296
297 fclose( pFile );
298 return p;
299}
double atof()
Here is the call graph for this function:

◆ If_LibLutSetSimple()

If_LibLut_t * If_LibLutSetSimple ( int nLutSize)
extern

Function*************************************************************

Synopsis [Sets simple LUT library.]

Description []

SideEffects []

SeeAlso []

Definition at line 438 of file ifLibLut.c.

439{
440 If_LibLut_t s_LutLib10= { "lutlib",10, 0, {0,1,1,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1},{1},{1}} };
441 If_LibLut_t s_LutLib9 = { "lutlib", 9, 0, {0,1,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1},{1}} };
442 If_LibLut_t s_LutLib8 = { "lutlib", 8, 0, {0,1,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1},{1}} };
443 If_LibLut_t s_LutLib7 = { "lutlib", 7, 0, {0,1,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1},{1}} };
444 If_LibLut_t s_LutLib6 = { "lutlib", 6, 0, {0,1,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1},{1}} };
445 If_LibLut_t s_LutLib5 = { "lutlib", 5, 0, {0,1,1,1,1,1}, {{0},{1},{1},{1},{1},{1}} };
446 If_LibLut_t s_LutLib4 = { "lutlib", 4, 0, {0,1,1,1,1}, {{0},{1},{1},{1},{1}} };
447 If_LibLut_t s_LutLib3 = { "lutlib", 3, 0, {0,1,1,1}, {{0},{1},{1},{1}} };
448 If_LibLut_t * pLutLib;
449 assert( nLutSize >= 3 && nLutSize <= 10 );
450 switch ( nLutSize )
451 {
452 case 3: pLutLib = &s_LutLib3; break;
453 case 4: pLutLib = &s_LutLib4; break;
454 case 5: pLutLib = &s_LutLib5; break;
455 case 6: pLutLib = &s_LutLib6; break;
456 case 7: pLutLib = &s_LutLib7; break;
457 case 8: pLutLib = &s_LutLib8; break;
458 case 9: pLutLib = &s_LutLib9; break;
459 case 10: pLutLib = &s_LutLib10; break;
460 default: pLutLib = NULL; break;
461 }
462 if ( pLutLib == NULL )
463 return NULL;
464 return If_LibLutDup(pLutLib);
465}
If_LibLut_t * If_LibLutDup(If_LibLut_t *p)
Definition ifLibLut.c:312
Here is the call graph for this function:

◆ If_LibLutSlowestPinDelay()

float If_LibLutSlowestPinDelay ( If_LibLut_t * p)
extern

Function*************************************************************

Synopsis [Gets the delay of the slowest pin.]

Description []

SideEffects []

SeeAlso []

Definition at line 494 of file ifLibLut.c.

495{
496 return !p? 1.0 : (p->fVarPinDelays? p->pLutDelays[p->LutMax][p->LutMax-1]: p->pLutDelays[p->LutMax][0]);
497}

◆ If_Lut2DecEval()

int If_Lut2DecEval ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pObj,
int optDelay,
int fFirst )
extern

Definition at line 508 of file ifDelay.c.

509{
510 pCut->fUser = 1;
511 pCut->Cost = pCut->nLeaves > 1 ? 1 : 0;
512 pCut->decDelay = 0;
513 if ( pCut->nLeaves == 0 ) // const
514 {
515 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
516 return 0;
517 }
518 if ( pCut->nLeaves == 1 ) // variable
519 {
520 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
521 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
522 }
523
524 int LutSize = p->pPars->nLutDecSize;
525 int i, leaf_delay;
526 int DelayMax = -1, nLeafMax = 0;
527 unsigned uLeafMask = 0;
528 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
529 {
530 leaf_delay = If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
531
532 if ( DelayMax < leaf_delay )
533 {
534 DelayMax = leaf_delay;
535 nLeafMax = 1;
536 uLeafMask = (1 << i);
537 }
538 else if ( DelayMax == leaf_delay )
539 {
540 nLeafMax++;
541 uLeafMask |= (1 << i);
542 }
543 }
544 if ( If_CutLeaveNum(pCut) <= LutSize )
545 {
546 pCut->decDelay = ( 1 << LutSize ) - 1;
547 return DelayMax + 1;
548 }
549
550 /* compute the decomposition */
551 int use_late_arrival = 0;
552 unsigned cost = 1;
553
554 if ( !fFirst )
555 {
556 if ( optDelay )
557 {
558 /* checks based on delay: must be better than the previous best cut */
559 use_late_arrival = DelayMax + 2 >= If_ObjCutBest(pObj)->Delay;
560 }
561 else
562 {
563 /* checks based on delay: look at the required time */
564 use_late_arrival = DelayMax + 2 > pObj->Required + p->fEpsilon;
565 }
566 }
567
568 /* Too many late-arriving signals */
569 if ( nLeafMax == LutSize && use_late_arrival )
570 {
571 /* unfeasible decomposition */
572 pCut->Cost = IF_COST_MAX;
573 return ABC_INFINITY;
574 }
575
576 if ( !use_late_arrival )
577 {
578 uLeafMask = 0;
579 }
580
581 /* returns the delay of the decomposition */
582 word *pTruth = If_CutTruthW( p, pCut );
583 int val = acd2_evaluate( pTruth, pCut->nLeaves, LutSize, &uLeafMask, &cost, !use_late_arrival );
584
585 /* not feasible decomposition */
586 pCut->decDelay = uLeafMask;
587 if ( val < 0 )
588 {
589 pCut->Cost = IF_COST_MAX;
590 return ABC_INFINITY;
591 }
592
593 pCut->Cost = 2;
594 return DelayMax + val;
595}
int acd2_evaluate(word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned *cost, int try_no_late_arrival)
#define IF_COST_MAX
Definition if.h:59
unsigned decDelay
Definition if.h:317
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LutDecEval()

int If_LutDecEval ( If_Man_t * p,
If_Cut_t * pCut,
If_Obj_t * pObj,
int optDelay,
int fFirst )
extern

Definition at line 415 of file ifDelay.c.

416{
417 pCut->fUser = 1;
418 pCut->Cost = pCut->nLeaves > 1 ? 1 : 0;
419 pCut->decDelay = 0;
420 if ( pCut->nLeaves == 0 ) // const
421 {
422 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
423 return 0;
424 }
425 if ( pCut->nLeaves == 1 ) // variable
426 {
427 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
428 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
429 }
430
431 int LutSize = p->pPars->nLutDecSize;
432 int i, leaf_delay;
433 int DelayMax = -1, nLeafMax = 0;
434 unsigned uLeafMask = 0;
435 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
436 {
437 leaf_delay = If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
438
439 if ( DelayMax < leaf_delay )
440 {
441 DelayMax = leaf_delay;
442 nLeafMax = 1;
443 uLeafMask = (1 << i);
444 }
445 else if ( DelayMax == leaf_delay )
446 {
447 nLeafMax++;
448 uLeafMask |= (1 << i);
449 }
450 }
451 if ( If_CutLeaveNum(pCut) <= LutSize )
452 {
453 pCut->decDelay = ( 1 << LutSize ) - 1;
454 return DelayMax + 1;
455 }
456
457 /* compute the decomposition */
458 int use_late_arrival = 0;
459 unsigned cost = 1;
460
461 if ( !fFirst )
462 {
463 if ( optDelay )
464 {
465 /* checks based on delay: must be better than the previous best cut */
466 use_late_arrival = DelayMax + 2 >= If_ObjCutBest(pObj)->Delay;
467 }
468 else
469 {
470 /* checks based on delay: look at the required time */
471 use_late_arrival = DelayMax + 2 > pObj->Required + p->fEpsilon;
472 }
473 }
474
475 /* Too many late-arriving signals */
476 if ( nLeafMax == LutSize )
477 {
478 if ( use_late_arrival )
479 {
480 /* unfeasible decomposition */
481 pCut->Cost = IF_COST_MAX;
482 return ABC_INFINITY;
483 }
484 else
485 {
486 /* remove critical signals as not needed */
487 uLeafMask = 0;
488 }
489 }
490
491 /* returns the delay of the decomposition */
492 word *pTruth = If_CutTruthW( p, pCut );
493 int val = acd_evaluate( pTruth, pCut->nLeaves, LutSize, &uLeafMask, &cost, !use_late_arrival );
494
495 /* not feasible decomposition */
496 pCut->decDelay = uLeafMask;
497 if ( val < 0 )
498 {
499 pCut->Cost = IF_COST_MAX;
500 return ABC_INFINITY;
501 }
502
503 pCut->Cost = cost;
504
505 return DelayMax + val;
506}
ABC_NAMESPACE_IMPL_START int acd_evaluate(word *pTruth, unsigned nVars, int lutSize, unsigned *pdelay, unsigned *cost, int try_no_late_arrival)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_LutDecPinRequired()

float If_LutDecPinRequired ( If_Man_t * p,
If_Cut_t * pCut,
int i,
float required )
extern

Definition at line 625 of file ifDelay.c.

626{
627 if ( pCut->nLeaves == 0 ) // const
628 {
629 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
630 return required;
631 }
632 if ( pCut->nLeaves == 1 ) // variable
633 {
634 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
635 return 0;
636 }
637
638 return ( ( pCut->decDelay >> i ) & 1 ) == 0 ? 2 : 1;
639}
Here is the caller graph for this function:

◆ If_LutDecReEval()

int If_LutDecReEval ( If_Man_t * p,
If_Cut_t * pCut )
extern

Definition at line 597 of file ifDelay.c.

598{
599 // pCut->fUser = 1;
600
601 if ( pCut->nLeaves == 0 ) // const
602 {
603 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 0 );
604 return 0;
605 }
606 if ( pCut->nLeaves == 1 ) // variable
607 {
608 assert( Abc_Lit2Var(If_CutTruthLit(pCut)) == 1 );
609 return (int)If_ObjCutBest(If_CutLeaf(p, pCut, 0))->Delay;
610 }
611
612 // int LutSize = p->pPars->pLutStruct[0] - '0';
613 int i, leaf_delay;
614 int DelayMax = -1;
615 for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
616 {
617 leaf_delay = If_ObjCutBest(If_CutLeaf(p, pCut, i))->Delay;
618 leaf_delay += ( ( pCut->decDelay >> i ) & 1 ) == 0 ? 2 : 1;
619 DelayMax = Abc_MaxInt( leaf_delay, DelayMax );
620 }
621
622 return DelayMax;
623}
Here is the caller graph for this function:

◆ If_ManCleanCutData()

void If_ManCleanCutData ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Sets all the cut data to NULL.]

Description []

SideEffects []

SeeAlso []

Definition at line 64 of file ifUtil.c.

65{
66 If_Obj_t * pObj;
67 int i;
68 If_ManForEachObj( p, pObj, i )
69 If_CutSetData( If_ObjCutBest(pObj), NULL );
70}
Here is the caller graph for this function:

◆ If_ManCleanMarkV()

void If_ManCleanMarkV ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Sets all visited marks to 0.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file ifUtil.c.

84{
85 If_Obj_t * pObj;
86 int i;
87 If_ManForEachObj( p, pObj, i )
88 pObj->fVisit = 0;
89}
unsigned fVisit
Definition if.h:339

◆ If_ManCleanNodeCopy()

void If_ManCleanNodeCopy ( If_Man_t * p)
extern

DECLARATIONS ///.

CFile****************************************************************

FileName [ifUtil.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [FPGA mapping based on priority cuts.]

Synopsis [Various utilities.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 21, 2006.]

Revision [

Id
ifUtil.c,v 1.00 2006/11/21 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Sets all the node copy to NULL.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ifUtil.c.

46{
47 If_Obj_t * pObj;
48 int i;
49 If_ManForEachObj( p, pObj, i )
50 If_ObjSetCopy( pObj, NULL );
51}
Here is the caller graph for this function:

◆ If_ManCollectMappingDirect()

Vec_Ptr_t * If_ManCollectMappingDirect ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Collects nodes used in the mapping in the topological order.]

Description []

SideEffects []

SeeAlso []

Definition at line 462 of file ifUtil.c.

463{
464 Vec_Ptr_t * vOrder;
465 If_Obj_t * pObj;
466 int i;
468 vOrder = Vec_PtrAlloc( If_ManObjNum(p) );
469 If_ManForEachObj( p, pObj, i )
470 if ( If_ObjIsAnd(pObj) && pObj->nRefs )
471 Vec_PtrPush( vOrder, pObj );
472 return vOrder;
473}
void If_ManMarkMapping(If_Man_t *p)
Definition ifUtil.c:434
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ If_ManCollectMappingInt()

Vec_Int_t * If_ManCollectMappingInt ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Collects nodes used in the mapping in the topological order.]

Description [Represents mapping as an array of integers.]

SideEffects []

SeeAlso []

Definition at line 486 of file ifUtil.c.

487{
488 Vec_Int_t * vOrder;
489 If_Cut_t * pCutBest;
490 If_Obj_t * pObj;
491 int i, k, nLeaves, * ppLeaves;
493 vOrder = Vec_IntAlloc( If_ManObjNum(p) );
494 If_ManForEachObj( p, pObj, i )
495 if ( If_ObjIsAnd(pObj) && pObj->nRefs )
496 {
497 pCutBest = If_ObjCutBest( pObj );
498 nLeaves = If_CutLeaveNum( pCutBest );
499 ppLeaves = If_CutLeaves( pCutBest );
500 // save the number of leaves, the leaves, and finally, the root
501 Vec_IntPush( vOrder, nLeaves );
502 for ( k = 0; k < nLeaves; k++ )
503 Vec_IntPush( vOrder, ppLeaves[k] );
504 Vec_IntPush( vOrder, pObj->Id );
505 }
506 return vOrder;
507}
Here is the call graph for this function:

◆ If_ManComputeRequired()

void If_ManComputeRequired ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Computes the required times of all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 313 of file ifTime.c.

314{
315 If_Obj_t * pObj;
316 int i, Counter;
317 float reqTime;
318
319 // compute area, clean required times, collect nodes used in the mapping
320// p->AreaGlo = If_ManScanMapping( p );
322 if ( p->pManTim == NULL )
323 {
324 // get the global required times
325 p->RequiredGlo = If_ManDelayMax( p, 0 );
326
327 // consider the case when the required times are given
328 if ( p->pPars->pTimesReq && !p->pPars->fAreaOnly )
329 {
330 // make sure that the required time hold
331 Counter = 0;
332 If_ManForEachCo( p, pObj, i )
333 {
334 if ( If_ObjArrTime(If_ObjFanin0(pObj)) > p->pPars->pTimesReq[i] + p->fEpsilon )
335 {
336 If_ObjFanin0(pObj)->Required = If_ObjArrTime(If_ObjFanin0(pObj));
337 Counter++;
338 // Abc_Print( 0, "Required times are violated for output %d (arr = %d; req = %d).\n",
339 // i, (int)If_ObjArrTime(If_ObjFanin0(pObj)), (int)p->pPars->pTimesReq[i] );
340 }
341 else
342 If_ObjFanin0(pObj)->Required = p->pPars->pTimesReq[i];
343 }
344 if ( Counter && !p->fReqTimeWarn )
345 {
346 Abc_Print( 0, "Required times are exceeded at %d output%s. The earliest arrival times are used.\n", Counter, Counter > 1 ? "s":"" );
347 p->fReqTimeWarn = 1;
348 }
349 }
350 else
351 {
352 // find new delay target
353 if ( p->pPars->nRelaxRatio && p->pPars->DelayTargetNew == 0 )
354 p->pPars->DelayTargetNew = p->RequiredGlo * (100.0 + p->pPars->nRelaxRatio) / 100.0;
355
356 // update the required times according to the target
357 if ( p->pPars->DelayTarget != -1 )
358 {
359 if ( p->RequiredGlo > p->pPars->DelayTarget + p->fEpsilon )
360 {
361 if ( p->fNextRound == 0 )
362 {
363 p->fNextRound = 1;
364 Abc_Print( 0, "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget );
365 }
366 }
367 else if ( p->RequiredGlo < p->pPars->DelayTarget - p->fEpsilon )
368 {
369 if ( p->fNextRound == 0 )
370 {
371 p->fNextRound = 1;
372// Abc_Print( 0, "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget );
373 }
374 p->RequiredGlo = p->pPars->DelayTarget;
375 }
376 }
377 else if ( p->pPars->DelayTargetNew > 0 ) // relax the required times
378 p->RequiredGlo = p->pPars->DelayTargetNew;
379 // do not propagate required times if area minimization is requested
380 if ( p->pPars->fAreaOnly )
381 return;
382 // set the required times for the POs
383 if ( p->pPars->fDoAverage )
384 {
385 if ( p->pPars->nRelaxRatio )
386 {
387 If_ManForEachCo( p, pObj, i )
388 If_ObjFanin0(pObj)->Required = If_ObjArrTime(If_ObjFanin0(pObj)) * (100.0 + p->pPars->nRelaxRatio) / 100.0;
389 }
390 else
391 {
392 If_ManForEachCo( p, pObj, i )
393 If_ObjFanin0(pObj)->Required = If_ObjArrTime(If_ObjFanin0(pObj));
394 }
395 }
396 else if ( p->pPars->fLatchPaths )
397 {
398 If_ManForEachLatchInput( p, pObj, i )
399 If_ObjFanin0(pObj)->Required = p->RequiredGlo;
400 }
401 else
402 {
403 If_ManForEachCo( p, pObj, i )
404 If_ObjFanin0(pObj)->Required = p->RequiredGlo;
405 }
406 }
407 // go through the nodes in the reverse topological order
408 // Vec_PtrForEachEntry( If_Obj_t *, p->vMapped, pObj, i )
409 // If_CutPropagateRequired( p, pObj, If_ObjCutBest(pObj), pObj->Required );
410 If_ManForEachObjReverse( p, pObj, i )
411 {
412 if ( pObj->nRefs == 0 )
413 continue;
414 If_CutPropagateRequired( p, pObj, If_ObjCutBest(pObj), pObj->Required );
415 }
416 }
417 else
418 {
419 // get the global required times
420 p->RequiredGlo = If_ManDelayMax( p, 0 );
421
422 // find new delay target
423 if ( p->pPars->nRelaxRatio && p->pPars->DelayTargetNew == 0 )
424 p->pPars->DelayTargetNew = p->RequiredGlo * (100.0 + p->pPars->nRelaxRatio) / 100.0;
425
426 // update the required times according to the target
427 if ( p->pPars->DelayTarget != -1 )
428 {
429 if ( p->RequiredGlo > p->pPars->DelayTarget + p->fEpsilon )
430 {
431 if ( p->fNextRound == 0 )
432 {
433 p->fNextRound = 1;
434 Abc_Print( 0, "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget );
435 }
436 }
437 else if ( p->RequiredGlo < p->pPars->DelayTarget - p->fEpsilon )
438 {
439 if ( p->fNextRound == 0 )
440 {
441 p->fNextRound = 1;
442// Abc_Print( 0, "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget );
443 }
444 p->RequiredGlo = p->pPars->DelayTarget;
445 }
446 }
447 else if ( p->pPars->DelayTargetNew > 0 ) // relax the required times
448 p->RequiredGlo = p->pPars->DelayTargetNew;
449
450 // do not propagate required times if area minimization is requested
451 if ( p->pPars->fAreaOnly )
452 return;
453 // set the required times for the POs
454 Tim_ManIncrementTravId( p->pManTim );
455 if ( p->vCoAttrs )
456 {
457 assert( If_ManCoNum(p) == Vec_IntSize(p->vCoAttrs) );
458 If_ManForEachCo( p, pObj, i )
459 {
460 if ( Vec_IntEntry(p->vCoAttrs, i) == -1 ) // -1=internal
461 continue;
462 if ( Vec_IntEntry(p->vCoAttrs, i) == 0 ) // 0=optimize
463 Tim_ManSetCoRequired( p->pManTim, i, p->RequiredGlo );
464 else if ( Vec_IntEntry(p->vCoAttrs, i) == 1 ) // 1=keep
465 Tim_ManSetCoRequired( p->pManTim, i, If_ObjArrTime(If_ObjFanin0(pObj)) );
466 else if ( Vec_IntEntry(p->vCoAttrs, i) == 2 ) // 2=relax
467 Tim_ManSetCoRequired( p->pManTim, i, IF_FLOAT_LARGE );
468 else assert( 0 );
469 }
470 }
471 else if ( p->pPars->fDoAverage )
472 {
473 if ( p->pPars->nRelaxRatio )
474 {
475 If_ManForEachCo( p, pObj, i )
476 Tim_ManSetCoRequired( p->pManTim, i, If_ObjArrTime(If_ObjFanin0(pObj)) * (100.0 + p->pPars->nRelaxRatio) / 100.0 );
477 }
478 else
479 {
480 If_ManForEachCo( p, pObj, i )
481 Tim_ManSetCoRequired( p->pManTim, i, If_ObjArrTime(If_ObjFanin0(pObj)) );
482 }
483 }
484 else if ( p->pPars->fLatchPaths )
485 {
486 If_ManForEachPo( p, pObj, i )
487 Tim_ManSetCoRequired( p->pManTim, i, IF_FLOAT_LARGE );
488 If_ManForEachLatchInput( p, pObj, i )
489 Tim_ManSetCoRequired( p->pManTim, i, p->RequiredGlo );
490 }
491 else
492 {
493 Tim_ManInitPoRequiredAll( p->pManTim, p->RequiredGlo );
494// If_ManForEachCo( p, pObj, i )
495// Tim_ManSetCoRequired( p->pManTim, pObj->IdPio, p->RequiredGlo );
496 }
497 // go through the nodes in the reverse topological order
498 If_ManForEachObjReverse( p, pObj, i )
499 {
500 if ( If_ObjIsAnd(pObj) )
501 {
502 if ( pObj->nRefs == 0 )
503 continue;
504 If_CutPropagateRequired( p, pObj, If_ObjCutBest(pObj), pObj->Required );
505 }
506 else if ( If_ObjIsCi(pObj) )
507 {
508 reqTime = pObj->Required;
509 Tim_ManSetCiRequired( p->pManTim, pObj->IdPio, reqTime );
510 }
511 else if ( If_ObjIsCo(pObj) )
512 {
513 reqTime = Tim_ManGetCoRequired( p->pManTim, pObj->IdPio );
514 If_ObjFanin0(pObj)->Required = IF_MIN( reqTime, If_ObjFanin0(pObj)->Required );
515 }
516 else if ( If_ObjIsConst1(pObj) )
517 {
518 }
519 else // add the node to the mapper
520 assert( 0 );
521 }
522 }
523}
float If_ManDelayMax(If_Man_t *p, int fSeq)
Definition ifTime.c:269
void If_CutPropagateRequired(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut, float ObjRequired)
Definition ifTime.c:178
#define If_ManForEachCo(p, pObj, i)
Definition if.h:477
void If_ManMarkMapping(If_Man_t *p)
Definition ifUtil.c:434
#define If_ManForEachObjReverse(p, pObj, i)
Definition if.h:494
#define If_ManForEachLatchInput(p, pObj, i)
Definition if.h:486
#define If_ManForEachPo(p, pObj, i)
Definition if.h:483
int IdPio
Definition if.h:345
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition timTrav.c:44
void Tim_ManSetCiRequired(Tim_Man_t *p, int iCi, float Delay)
Definition timTime.c:135
void Tim_ManInitPoRequiredAll(Tim_Man_t *p, float Delay)
Definition timTime.c:97
void Tim_ManSetCoRequired(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:154
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition timTime.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManComputeSwitching()

void If_ManComputeSwitching ( If_Man_t * pIfMan)
extern

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Interface with the FPGA mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 59 of file abcIf.c.

60{
61 abctime clk = Abc_Clock();
62 Gia_Man_t * pNew;
63 Vec_Int_t * vCopy;
64 If_Obj_t * pIfObj;
65 int i;
66 assert( pIfMan->vSwitching == NULL );
67 // create the new manager
68 pNew = Gia_ManStart( If_ManObjNum(pIfMan) );
69 vCopy = Vec_IntAlloc( If_ManObjNum(pIfMan) );
70 // constant and inputs
71 Vec_IntPush( vCopy, 1 );
72 If_ManForEachCi( pIfMan, pIfObj, i )
73 Vec_IntPush( vCopy, Gia_ManAppendCi(pNew) );
74 // internal nodes
75 If_ManForEachNode( pIfMan, pIfObj, i )
76 {
77 int iLit0 = Abc_LitNotCond( Vec_IntEntry(vCopy, If_ObjFanin0(pIfObj)->Id), If_ObjFaninC0(pIfObj) );
78 int iLit1 = Abc_LitNotCond( Vec_IntEntry(vCopy, If_ObjFanin1(pIfObj)->Id), If_ObjFaninC1(pIfObj) );
79 Vec_IntPush( vCopy, Gia_ManAppendAnd(pNew, iLit0, iLit1) );
80 }
81 // outputs
82 If_ManForEachCo( pIfMan, pIfObj, i )
83 {
84 int iLit0 = Abc_LitNotCond( Vec_IntEntry(vCopy, If_ObjFanin0(pIfObj)->Id), If_ObjFaninC0(pIfObj) );
85 Vec_IntPush( vCopy, Gia_ManAppendCo(pNew, iLit0) );
86 }
87 assert( Vec_IntSize(vCopy) == If_ManObjNum(pIfMan) );
88 Vec_IntFree( vCopy );
89 // compute switching activity
90 pIfMan->vSwitching = Gia_ManComputeSwitchProbs( pNew, 48, 16, 0 );
91 Gia_ManStop( pNew );
92 if ( pIfMan->pPars->fVerbose )
93 Abc_PrintTime( 1, "Computing switching activity", Abc_Clock() - clk );
94}
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Definition giaSwitch.c:658
#define If_ManForEachCi(p, pObj, i)
Definition if.h:474
#define If_ManForEachNode(p, pObj, i)
Definition if.h:497
If_Par_t * pPars
Definition if.h:201
Vec_Int_t * vSwitching
Definition if.h:225
int fVerbose
Definition if.h:152
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManCountSpecialPos()

int If_ManCountSpecialPos ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Returns the number of POs pointing to the same internal nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 520 of file ifUtil.c.

521{
522 If_Obj_t * pObj;
523 int i, Counter = 0;
524 // clean all marks
525 If_ManForEachPo( p, pObj, i )
526 If_ObjFanin0(pObj)->fMark = 0;
527 // label nodes
528 If_ManForEachPo( p, pObj, i )
529 if ( !If_ObjFaninC0(pObj) )
530 If_ObjFanin0(pObj)->fMark = 1;
531 // label nodes
532 If_ManForEachPo( p, pObj, i )
533 if ( If_ObjFaninC0(pObj) )
534 Counter += If_ObjFanin0(pObj)->fMark;
535 // clean all marks
536 If_ManForEachPo( p, pObj, i )
537 If_ObjFanin0(pObj)->fMark = 0;
538 return Counter;
539}

◆ If_ManCreateAnd()

If_Obj_t * If_ManCreateAnd ( If_Man_t * p,
If_Obj_t * pFan0,
If_Obj_t * pFan1 )
extern

Function*************************************************************

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 384 of file ifMan.c.

385{
386 If_Obj_t * pObj;
387 // perform constant propagation
388 if ( pFan0 == pFan1 )
389 return pFan0;
390 if ( pFan0 == If_Not(pFan1) )
391 return If_Not(p->pConst1);
392 if ( If_Regular(pFan0) == p->pConst1 )
393 return pFan0 == p->pConst1 ? pFan1 : If_Not(p->pConst1);
394 if ( If_Regular(pFan1) == p->pConst1 )
395 return pFan1 == p->pConst1 ? pFan0 : If_Not(p->pConst1);
396 // get memory for the new object
397 pObj = If_ManSetupObj( p );
398 pObj->Type = IF_AND;
399 pObj->fCompl0 = If_IsComplement(pFan0); pFan0 = If_Regular(pFan0);
400 pObj->fCompl1 = If_IsComplement(pFan1); pFan1 = If_Regular(pFan1);
401 pObj->pFanin0 = pFan0; pFan0->nRefs++; pFan0->nVisits++; pFan0->nVisitsCopy++;
402 pObj->pFanin1 = pFan1; pFan1->nRefs++; pFan1->nVisits++; pFan1->nVisitsCopy++;
403 pObj->fPhase = (pObj->fCompl0 ^ pFan0->fPhase) & (pObj->fCompl1 ^ pFan1->fPhase);
404 pObj->Level = 1 + IF_MAX( pFan0->Level, pFan1->Level );
405 if ( p->nLevelMax < (int)pObj->Level )
406 p->nLevelMax = (int)pObj->Level;
407 p->nObjs[IF_AND]++;
408 return pObj;
409}
unsigned fPhase
Definition if.h:336
If_Obj_t * pFanin1
Definition if.h:350
If_Obj_t * pFanin0
Definition if.h:349
unsigned Level
Definition if.h:343
int nVisits
Definition if.h:347
unsigned fCompl1
Definition if.h:335
unsigned Type
Definition if.h:333
int nVisitsCopy
Definition if.h:348
unsigned fCompl0
Definition if.h:334
Here is the caller graph for this function:

◆ If_ManCreateChoice()

void If_ManCreateChoice ( If_Man_t * p,
If_Obj_t * pObj )
extern

Function*************************************************************

Synopsis [Creates the choice node.]

Description [Should be called after the equivalence class nodes are linked.]

SideEffects []

SeeAlso []

Definition at line 460 of file ifMan.c.

461{
462 If_Obj_t * pTemp;
463 // mark the node as a representative if its class
464 assert( pObj->fRepr == 0 );
465 pObj->fRepr = 1;
466 // update the level of this node (needed for correct required time computation)
467 for ( pTemp = pObj; pTemp; pTemp = pTemp->pEquiv )
468 {
469 pObj->Level = IF_MAX( pObj->Level, pTemp->Level );
470 pTemp->nVisits++; pTemp->nVisitsCopy++;
471 }
472 // mark the largest level
473 if ( p->nLevelMax < (int)pObj->Level )
474 p->nLevelMax = (int)pObj->Level;
475 p->nChoices++;
476}
unsigned fRepr
Definition if.h:337
If_Obj_t * pEquiv
Definition if.h:351
Here is the caller graph for this function:

◆ If_ManCreateCi()

If_Obj_t * If_ManCreateCi ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Creates primary input.]

Description []

SideEffects []

SeeAlso []

Definition at line 334 of file ifMan.c.

335{
336 If_Obj_t * pObj;
337 pObj = If_ManSetupObj( p );
338 pObj->Type = IF_CI;
339 pObj->IdPio = Vec_PtrSize( p->vCis );
340 Vec_PtrPush( p->vCis, pObj );
341 p->nObjs[IF_CI]++;
342 return pObj;
343}
Here is the caller graph for this function:

◆ If_ManCreateCo()

If_Obj_t * If_ManCreateCo ( If_Man_t * p,
If_Obj_t * pDriver )
extern

Function*************************************************************

Synopsis [Creates primary output with the given driver.]

Description []

SideEffects []

SeeAlso []

Definition at line 356 of file ifMan.c.

357{
358 If_Obj_t * pObj;
359 pObj = If_ManSetupObj( p );
360 pObj->IdPio = Vec_PtrSize( p->vCos );
361 Vec_PtrPush( p->vCos, pObj );
362 pObj->Type = IF_CO;
363 pObj->fCompl0 = If_IsComplement(pDriver); pDriver = If_Regular(pDriver);
364 pObj->pFanin0 = pDriver; pDriver->nRefs++;
365 pObj->fPhase = (pObj->fCompl0 ^ pDriver->fPhase);
366 pObj->Level = pDriver->Level;
367 if ( p->nLevelMax < (int)pObj->Level )
368 p->nLevelMax = (int)pObj->Level;
369 p->nObjs[IF_CO]++;
370 return pObj;
371}
Here is the caller graph for this function:

◆ If_ManCreateMux()

If_Obj_t * If_ManCreateMux ( If_Man_t * p,
If_Obj_t * pFan0,
If_Obj_t * pFan1,
If_Obj_t * pCtrl )
extern

Function*************************************************************

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 441 of file ifMan.c.

442{
443 If_Obj_t * pRes1, * pRes2;
444 pRes1 = If_ManCreateAnd( p, pFan0, If_Not(pCtrl) );
445 pRes2 = If_ManCreateAnd( p, pFan1, pCtrl );
446 return If_Not( If_ManCreateAnd( p, If_Not(pRes1), If_Not(pRes2) ) );
447}
If_Obj_t * If_ManCreateAnd(If_Man_t *p, If_Obj_t *pFan0, If_Obj_t *pFan1)
Definition ifMan.c:384
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManCreateXor()

If_Obj_t * If_ManCreateXor ( If_Man_t * p,
If_Obj_t * pFan0,
If_Obj_t * pFan1 )
extern

Function*************************************************************

Synopsis [Create the new node assuming it does not exist.]

Description []

SideEffects []

SeeAlso []

Definition at line 422 of file ifMan.c.

423{
424 If_Obj_t * pRes1, * pRes2;
425 pRes1 = If_ManCreateAnd( p, If_Not(pFan0), pFan1 );
426 pRes2 = If_ManCreateAnd( p, pFan0, If_Not(pFan1) );
427 return If_Not( If_ManCreateAnd( p, If_Not(pRes1), If_Not(pRes2) ) );
428}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManCrossCut()

int If_ManCrossCut ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Computes cross-cut of the circuit.]

Description []

SideEffects []

SeeAlso []

Definition at line 316 of file ifUtil.c.

317{
318 If_Obj_t * pObj, * pFanin;
319 int i, nCutSize = 0, nCutSizeMax = 0;
320 If_ManForEachObj( p, pObj, i )
321 {
322 if ( !If_ObjIsAnd(pObj) )
323 continue;
324 // consider the node
325 if ( nCutSizeMax < ++nCutSize )
326 nCutSizeMax = nCutSize;
327 if ( pObj->nVisits == 0 )
328 nCutSize--;
329 // consider the fanins
330 pFanin = If_ObjFanin0(pObj);
331 if ( !If_ObjIsCi(pFanin) && --pFanin->nVisits == 0 )
332 nCutSize--;
333 pFanin = If_ObjFanin1(pObj);
334 if ( !If_ObjIsCi(pFanin) && --pFanin->nVisits == 0 )
335 nCutSize--;
336 // consider the choice class
337 if ( pObj->fRepr )
338 for ( pFanin = pObj; pFanin; pFanin = pFanin->pEquiv )
339 if ( !If_ObjIsCi(pFanin) && --pFanin->nVisits == 0 )
340 nCutSize--;
341 }
342 If_ManForEachObj( p, pObj, i )
343 {
344 assert( If_ObjIsCi(pObj) || pObj->fVisit == 0 );
345 pObj->nVisits = pObj->nVisitsCopy;
346 }
347 assert( nCutSize == 0 );
348// Abc_Print( 1, "Max cross cut size = %6d.\n", nCutSizeMax );
349 return nCutSizeMax;
350}
Here is the caller graph for this function:

◆ If_ManDelayMax()

float If_ManDelayMax ( If_Man_t * p,
int fSeq )
extern

Function*************************************************************

Synopsis [Returns the max delay of the POs.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file ifTime.c.

270{
271 If_Obj_t * pObj;
272 float DelayBest;
273 int i;
274 if ( p->pPars->fLatchPaths && (p->pPars->nLatchesCi == 0 || p->pPars->nLatchesCo == 0) )
275 {
276 Abc_Print( 0, "Delay optimization of latch path is not performed because there is no latches.\n" );
277 p->pPars->fLatchPaths = 0;
278 }
279 DelayBest = -IF_FLOAT_LARGE;
280 if ( fSeq )
281 {
282 assert( p->pPars->nLatchesCi > 0 );
283 If_ManForEachPo( p, pObj, i )
284 if ( DelayBest < If_ObjArrTime(If_ObjFanin0(pObj)) )
285 DelayBest = If_ObjArrTime(If_ObjFanin0(pObj));
286 }
287 else if ( p->pPars->fLatchPaths )
288 {
289 If_ManForEachLatchInput( p, pObj, i )
290 if ( DelayBest < If_ObjArrTime(If_ObjFanin0(pObj)) )
291 DelayBest = If_ObjArrTime(If_ObjFanin0(pObj));
292 }
293 else
294 {
295 If_ManForEachCo( p, pObj, i )
296 if ( DelayBest < If_ObjArrTime(If_ObjFanin0(pObj)) )
297 DelayBest = If_ObjArrTime(If_ObjFanin0(pObj));
298 }
299 return DelayBest;
300}
Here is the caller graph for this function:

◆ If_ManDerefChoiceCutSet()

void If_ManDerefChoiceCutSet ( If_Man_t * p,
If_Obj_t * pObj )
extern

Function*************************************************************

Synopsis [Dereferences cutset of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 663 of file ifMan.c.

664{
665 If_Obj_t * pTemp;
666 assert( If_ObjIsAnd(pObj) );
667 assert( pObj->fRepr );
668 assert( pObj->nVisits > 0 );
669 // consider the nodes in the choice class
670 for ( pTemp = pObj; pTemp; pTemp = pTemp->pEquiv )
671 {
672// assert( pTemp == pObj || pTemp->nVisits == 1 );
673 if ( --pTemp->nVisits == 0 )
674 {
675// Mem_FixedEntryRecycle( p->pMemSet, (char *)pTemp->pCutSet );
676 If_ManCutSetRecycle( p, pTemp->pCutSet );
677 pTemp->pCutSet = NULL;
678 }
679 }
680}
If_Set_t * pCutSet
Definition if.h:360
Here is the caller graph for this function:

◆ If_ManDerefNodeCutSet()

void If_ManDerefNodeCutSet ( If_Man_t * p,
If_Obj_t * pObj )
extern

Function*************************************************************

Synopsis [Dereferences cutset of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 620 of file ifMan.c.

621{
622 If_Obj_t * pFanin;
623 assert( If_ObjIsAnd(pObj) );
624 // consider the node
625 assert( pObj->nVisits >= 0 );
626 if ( pObj->nVisits == 0 )
627 {
628// Mem_FixedEntryRecycle( p->pMemSet, (char *)pObj->pCutSet );
629 If_ManCutSetRecycle( p, pObj->pCutSet );
630 pObj->pCutSet = NULL;
631 }
632 // consider the first fanin
633 pFanin = If_ObjFanin0(pObj);
634 assert( pFanin->nVisits > 0 );
635 if ( !If_ObjIsCi(pFanin) && --pFanin->nVisits == 0 )
636 {
637// Mem_FixedEntryRecycle( p->pMemSet, (char *)pFanin->pCutSet );
638 If_ManCutSetRecycle( p, pFanin->pCutSet );
639 pFanin->pCutSet = NULL;
640 }
641 // consider the second fanin
642 pFanin = If_ObjFanin1(pObj);
643 assert( pFanin->nVisits > 0 );
644 if ( !If_ObjIsCi(pFanin) && --pFanin->nVisits == 0 )
645 {
646// Mem_FixedEntryRecycle( p->pMemSet, (char *)pFanin->pCutSet );
647 If_ManCutSetRecycle( p, pFanin->pCutSet );
648 pFanin->pCutSet = NULL;
649 }
650}
Here is the caller graph for this function:

◆ If_ManDeriveGiaFromCells()

void * If_ManDeriveGiaFromCells ( void * pGia)
extern

Function*************************************************************

Synopsis [Derive GIA using programmable bits.]

Description []

SideEffects []

SeeAlso []

Definition at line 825 of file ifTune.c.

826{
827 Gia_Man_t * p = (Gia_Man_t *)pGia;
828 Gia_Man_t * pNew, * pTemp;
829 Vec_Int_t * vCover, * vLeaves;
830 Ifn_Ntk_t * pNtkCell;
831 Gia_Obj_t * pObj;
832 word * pConfigData;
833 //word * pTruth;
834 int k, i, iLut, iVar;
835 int nConfigInts, Count = 0;
836 assert( p->vConfigs != NULL );
837 assert( p->pCellStr != NULL );
838 assert( Gia_ManHasMapping(p) );
839 // derive cell network
840 pNtkCell = Ifn_NtkParse( p->pCellStr );
841 Ifn_Prepare( pNtkCell, NULL, pNtkCell->nInps );
842 nConfigInts = Vec_IntEntry( p->vConfigs, 1 );
843 // create new manager
844 pNew = Gia_ManStart( 6*Gia_ManObjNum(p)/5 + 100 );
845 pNew->pName = Abc_UtilStrsav( p->pName );
846 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
847 // map primary inputs
849 Gia_ManConst0(p)->Value = 0;
850 Gia_ManForEachCi( p, pObj, i )
851 pObj->Value = Gia_ManAppendCi(pNew);
852 // iterate through nodes used in the mapping
853 vLeaves = Vec_IntAlloc( 16 );
854 vCover = Vec_IntAlloc( 1 << 16 );
855 Gia_ManHashStart( pNew );
856 //Gia_ObjComputeTruthTableStart( p, Gia_ManLutSizeMax(p) );
857 Gia_ManForEachAnd( p, pObj, iLut )
858 {
859 if ( Gia_ObjIsBuf(pObj) )
860 {
861 pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) );
862 continue;
863 }
864 if ( !Gia_ObjIsLut(p, iLut) )
865 continue;
866 // collect leaves
867 //Vec_IntClear( vLeaves );
868 //Gia_LutForEachFanin( p, iLut, iVar, k )
869 // Vec_IntPush( vLeaves, iVar );
870 //pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, iLut), vLeaves );
871 // collect incoming literals
872 Vec_IntClear( vLeaves );
873 Gia_LutForEachFanin( p, iLut, iVar, k )
874 Vec_IntPush( vLeaves, Gia_ManObj(p, iVar)->Value );
875 pConfigData = (word *)Vec_IntEntryP( p->vConfigs, 2 + nConfigInts * Count++ );
876 Gia_ManObj(p, iLut)->Value = If_ManSatDeriveGiaFromBits( pNew, pNtkCell, pConfigData, vLeaves, vCover );
877 }
878 assert( Vec_IntEntry(p->vConfigs, 0) == Count );
879 assert( Vec_IntSize(p->vConfigs) == 2 + nConfigInts * Count );
880 //Gia_ObjComputeTruthTableStop( p );
881 Gia_ManForEachCo( p, pObj, i )
882 pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
883 Gia_ManHashStop( pNew );
884 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
885 Vec_IntFree( vLeaves );
886 Vec_IntFree( vCover );
887 ABC_FREE( pNtkCell );
888 // perform cleanup
889 pNew = Gia_ManCleanup( pTemp = pNew );
890 Gia_ManStop( pTemp );
891 return pNew;
892
893}
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition gia.h:1161
void Gia_ManFillValue(Gia_Man_t *p)
Definition giaUtil.c:369
Gia_Man_t * Gia_ManCleanup(Gia_Man_t *p)
Definition giaScl.c:84
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int Ifn_Prepare(Ifn_Ntk_t *p, word *pTruth, int nVars)
FUNCTION DEFINITIONS ///.
Definition ifTune.c:115
Ifn_Ntk_t * Ifn_NtkParse(char *pStr)
Definition ifTune.c:440
int If_ManSatDeriveGiaFromBits(void *pGia, Ifn_Ntk_t *p, word *pConfigData, Vec_Int_t *vLeaves, Vec_Int_t *vCover)
Definition ifTune.c:742
struct Ifn_Ntk_t_ Ifn_Ntk_t
Definition if.h:85
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
unsigned Value
Definition gia.h:89
int nInps
Definition ifTune.c:72
Here is the call graph for this function:

◆ If_ManImproveMapping()

void If_ManImproveMapping ( If_Man_t * p)
extern

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Improves current mapping using expand/Expand of one cut.]

Description [Assumes current mapping assigned and required times computed.]

SideEffects []

SeeAlso []

Definition at line 51 of file ifReduce.c.

52{
53 abctime clk;
54
55 clk = Abc_Clock();
56 If_ManImproveExpand( p, p->pPars->nLutSize );
58 if ( p->pPars->fVerbose )
59 {
60 Abc_Print( 1, "E: Del = %7.2f. Ar = %9.1f. Edge = %8d. ",
61 p->RequiredGlo, p->AreaGlo, p->nNets );
62 if ( p->dPower )
63 Abc_Print( 1, "Switch = %7.2f. ", p->dPower );
64 Abc_Print( 1, "Cut = %8d. ", p->nCutsMerged );
65 Abc_PrintTime( 1, "T", Abc_Clock() - clk );
66 }
67}
void If_ManComputeRequired(If_Man_t *p)
Definition ifTime.c:313
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManMarkMapping()

void If_ManMarkMapping ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Computes area, references, and nodes used in the mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 434 of file ifUtil.c.

435{
436 If_Obj_t * pObj;
437 int i;
438 If_ManForEachObj( p, pObj, i )
439 {
440 pObj->Required = IF_FLOAT_LARGE;
441 pObj->nVisits = pObj->nVisitsCopy;
442 pObj->nRefs = 0;
443 }
444 p->nNets = 0;
445 p->dPower = 0.0;
446 p->AreaGlo = 0.0;
447 If_ManForEachCo( p, pObj, i )
448 p->AreaGlo += If_ManMarkMapping_rec( p, If_ObjFanin0(pObj) );
449}
float If_ManMarkMapping_rec(If_Man_t *p, If_Obj_t *pObj)
Definition ifUtil.c:400
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManPerformMapping()

int If_ManPerformMapping ( If_Man_t * p)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 82 of file ifCore.c.

83{
84 p->pPars->fAreaOnly = p->pPars->fArea; // temporary
85 // create the CI cutsets
87 // allocate memory for other cutsets
89 // derive reverse top order
90 p->vObjsRev = If_ManReverseOrder( p );
92}
int If_ManPerformMappingComb(If_Man_t *p)
Definition ifCore.c:106
void If_ManSetupCiCutSets(If_Man_t *p)
Definition ifMan.c:566
Vec_Ptr_t * If_ManReverseOrder(If_Man_t *p)
Definition ifUtil.c:363
void If_ManSetupSetAll(If_Man_t *p, int nCrossCut)
Definition ifMan.c:693
int If_ManCrossCut(If_Man_t *p)
Definition ifUtil.c:316
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManPerformMappingComb()

int If_ManPerformMappingComb ( If_Man_t * p)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 106 of file ifCore.c.

107{
108 If_Obj_t * pObj;
109 abctime clkTotal = Abc_Clock();
110 int i;
111
112 //p->vVisited2 = Vec_IntAlloc( 100 );
113 //p->vMarks = Vec_StrStart( If_ManObjNum(p) );
114
115 // set arrival times and fanout estimates
116 If_ManForEachCi( p, pObj, i )
117 {
118 If_ObjSetArrTime( pObj, p->pPars->pTimesArr ? p->pPars->pTimesArr[i] : (float)0.0 );
119 pObj->EstRefs = (float)1.0;
120 }
121
122 // delay oriented mapping
123 if ( p->pPars->fPreprocess && !p->pPars->fArea )
124 {
125 // map for delay
126 If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, 1, "Delay" );
127
128 // map for delay second option
129 p->pPars->fFancy = 1;
131 If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, 0, "Delay-2" );
132 p->pPars->fFancy = 0;
133 // map for area
134 p->pPars->fArea = 1;
136 If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, 0, "Area" );
137 p->pPars->fArea = 0;
138 }
139 else
140 If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0, 1, "Delay" );
141
142 // try to improve area by expanding and reducing the cuts
143 if ( p->pPars->fExpRed )
145
146 // area flow oriented mapping
147 for ( i = 0; i < p->pPars->nFlowIters; i++ )
148 {
149 If_ManPerformMappingRound( p, p->pPars->nCutsMax, 1, 0, 0, "Flow" );
150 if ( p->pPars->fExpRed )
152 }
153
154 // area oriented mapping
155 for ( i = 0; i < p->pPars->nAreaIters; i++ )
156 {
157 If_ManPerformMappingRound( p, p->pPars->nCutsMax, 2, 0, 0, "Area" );
158 if ( p->pPars->fExpRed )
160 }
161
162 if ( p->pPars->fVerbose )
163 {
164// Abc_Print( 1, "Total memory = %7.2f MB. Peak cut memory = %7.2f MB. ",
165// 1.0 * (p->nObjBytes + 2*sizeof(void *)) * If_ManObjNum(p) / (1<<20),
166// 1.0 * p->nSetBytes * Mem_FixedReadMaxEntriesUsed(p->pMemSet) / (1<<20) );
167 Abc_PrintTime( 1, "Total time", Abc_Clock() - clkTotal );
168 }
169// Abc_Print( 1, "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) );
170 s_MappingTime = Abc_Clock() - clkTotal;
171// Abc_Print( 1, "Special POs = %d.\n", If_ManCountSpecialPos(p) );
172
173/*
174 {
175 static char * pLastName = NULL;
176 FILE * pTable = fopen( "fpga/ucsb/stats.txt", "a+" );
177 if ( pLastName == NULL || strcmp(pLastName, p->pName) )
178 {
179 fprintf( pTable, "\n" );
180 fprintf( pTable, "%s ", p->pName );
181
182 fprintf( pTable, "%d ", If_ManCiNum(p) );
183 fprintf( pTable, "%d ", If_ManCoNum(p) );
184 fprintf( pTable, "%d ", If_ManAndNum(p) );
185
186 ABC_FREE( pLastName );
187 pLastName = Abc_UtilStrsav( p->pName );
188 }
189
190 fprintf( pTable, "%d ", (int)p->AreaGlo );
191 fprintf( pTable, "%d ", (int)p->RequiredGlo );
192 fclose( pTable );
193 }
194*/
195 p->pPars->FinalDelay = p->RequiredGlo;
196 p->pPars->FinalArea = p->AreaGlo;
197 return 1;
198}
void If_ManResetOriginalRefs(If_Man_t *p)
Definition ifUtil.c:287
int If_ManPerformMappingRound(If_Man_t *p, int nCutsUsed, int Mode, int fPreprocess, int fFirst, char *pLabel)
Definition ifMap.c:606
void If_ManImproveMapping(If_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition ifReduce.c:51
abctime s_MappingTime
DECLARATIONS ///.
Definition abcPrint.c:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManPerformMappingRound()

int If_ManPerformMappingRound ( If_Man_t * p,
int nCutsUsed,
int Mode,
int fPreprocess,
int fFirst,
char * pLabel )
extern

Function*************************************************************

Synopsis [Performs one mapping pass over all nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 606 of file ifMap.c.

607{
608 ProgressBar * pProgress = NULL;
609 If_Obj_t * pObj;
610 int i;
611 abctime clk = Abc_Clock();
612 float arrTime;
613 assert( Mode >= 0 && Mode <= 2 );
614 p->nBestCutSmall[0] = p->nBestCutSmall[1] = 0;
615 // set the sorting function
616 if ( Mode || p->pPars->fArea ) // area
617 p->SortMode = 1;
618 else if ( p->pPars->fFancy )
619 p->SortMode = 2;
620 else
621 p->SortMode = 0;
622 // set the cut number
623 p->nCutsUsed = nCutsUsed;
624 p->nCutsMerged = 0;
625 // make sure the visit counters are all zero
626 If_ManForEachNode( p, pObj, i )
627 assert( pObj->nVisits == pObj->nVisitsCopy );
628 // map the internal nodes
629 if ( p->pManTim != NULL )
630 {
631 Tim_ManIncrementTravId( p->pManTim );
632 If_ManForEachObj( p, pObj, i )
633 {
634 if ( If_ObjIsAnd(pObj) )
635 {
636 If_ObjPerformMappingAnd( p, pObj, Mode, fPreprocess, fFirst );
637 if ( pObj->fRepr )
638 If_ObjPerformMappingChoice( p, pObj, Mode, fPreprocess );
639 }
640 else if ( If_ObjIsCi(pObj) )
641 {
642//Abc_Print( 1, "processing CI %d\n", pObj->Id );
643 arrTime = Tim_ManGetCiArrival( p->pManTim, pObj->IdPio );
644 If_ObjSetArrTime( pObj, arrTime );
645 }
646 else if ( If_ObjIsCo(pObj) )
647 {
648 arrTime = If_ObjArrTime( If_ObjFanin0(pObj) );
649 Tim_ManSetCoArrival( p->pManTim, pObj->IdPio, arrTime );
650 }
651 else if ( If_ObjIsConst1(pObj) )
652 {
653 arrTime = -IF_INFINITY;
654 If_ObjSetArrTime( pObj, arrTime );
655 }
656 else
657 assert( 0 );
658 }
659// Tim_ManPrint( p->pManTim );
660 }
661 else
662 {
663 pProgress = Extra_ProgressBarStart( stdout, If_ManObjNum(p) );
664 If_ManForEachNode( p, pObj, i )
665 {
666 Extra_ProgressBarUpdate( pProgress, i, pLabel );
667 If_ObjPerformMappingAnd( p, pObj, Mode, fPreprocess, fFirst );
668 if ( pObj->fRepr )
669 If_ObjPerformMappingChoice( p, pObj, Mode, fPreprocess );
670 }
671 }
672 Extra_ProgressBarStop( pProgress );
673 // make sure the visit counters are all zero
674 If_ManForEachNode( p, pObj, i )
675 assert( pObj->nVisits == 0 );
676 // compute required times and stats
678// Tim_ManPrint( p->pManTim );
679 if ( p->pPars->fVerbose )
680 {
681 char Symb = fPreprocess? 'P' : ((Mode == 0)? 'D' : ((Mode == 1)? 'F' : 'A'));
682 Abc_Print( 1, "%c: Del = %7.2f. Ar = %9.1f. Edge = %8d. ",
683 Symb, p->RequiredGlo, p->AreaGlo, p->nNets );
684 if ( p->dPower )
685 Abc_Print( 1, "Switch = %7.2f. ", p->dPower );
686 Abc_Print( 1, "Cut = %8d. ", p->nCutsMerged );
687 Abc_PrintTime( 1, "T", Abc_Clock() - clk );
688// Abc_Print( 1, "Max number of cuts = %d. Average number of cuts = %5.2f.\n",
689// p->nCutsMax, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
690 }
691 return 1;
692}
void If_ObjPerformMappingAnd(If_Man_t *p, If_Obj_t *pObj, int Mode, int fPreprocess, int fFirst)
Definition ifMap.c:162
void If_ObjPerformMappingChoice(If_Man_t *p, If_Obj_t *pObj, int Mode, int fPreprocess)
Definition ifMap.c:521
#define IF_INFINITY
Definition if.h:57
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:116
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition timTime.c:174
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManPerformMappingSeq()

int If_ManPerformMappingSeq ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Performs sequential mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 334 of file ifSeq.c.

335{
336 abctime clkTotal = Abc_Clock();
337 int PeriodBest;
338
339 p->SortMode = 0;
340
341 // perform combinational mapping to get the upper bound on the clock period
342 If_ManPerformMappingRound( p, 1, 0, 0, 1, NULL );
343 p->RequiredGlo = If_ManDelayMax( p, 0 );
344 p->RequiredGlo2 = p->RequiredGlo;
345
346 // set direct linking of latches with their inputs
348
349 // collect latches
350 p->vLatchOrder = If_ManCollectLatches( p );
351
352 // set parameters
353 p->nCutsUsed = p->pPars->nCutsMax;
354 p->nAttempts = 0;
355 p->nMaxIters = 50;
356 p->Period = (int)p->RequiredGlo;
357
358 // make sure the clock period works
359 if ( !If_ManBinarySearchPeriod( p ) )
360 {
361 Abc_Print( 1, "If_ManPerformMappingSeq(): The upper bound on the clock period cannot be computed.\n" );
362 return 0;
363 }
364
365 // perform binary search
366 PeriodBest = If_ManBinarySearch_rec( p, 0, p->Period );
367
368 // recompute the best l-values
369 if ( p->Period != PeriodBest )
370 {
371 p->Period = PeriodBest;
372 if ( !If_ManBinarySearchPeriod( p ) )
373 {
374 Abc_Print( 1, "If_ManPerformMappingSeq(): The final clock period cannot be confirmed.\n" );
375 return 0;
376 }
377 }
378// if ( p->pPars->fVerbose )
379 {
380 Abc_Print( 1, "The best clock period is %3d. ", p->Period );
381 Abc_PrintTime( 1, "Time", Abc_Clock() - clkTotal );
382 }
383 p->RequiredGlo = (float)(PeriodBest);
384
385 // postprocess it using combinational mapping
387 s_MappingTime = Abc_Clock() - clkTotal;
388 return 1;
389}
Vec_Ptr_t * If_ManCollectLatches(If_Man_t *p)
Definition ifSeq.c:95
int If_ManBinarySearch_rec(If_Man_t *p, int FiMin, int FiMax)
Definition ifSeq.c:269
void If_ManPerformMappingSeqPost(If_Man_t *p)
Definition ifSeq.c:293
void If_ManPrepareMappingSeq(If_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition ifSeq.c:47
int If_ManBinarySearchPeriod(If_Man_t *p)
Definition ifSeq.c:198
float If_ManDelayMax(If_Man_t *p, int fSeq)
Definition ifTime.c:269
Here is the call graph for this function:

◆ If_ManResetOriginalRefs()

void If_ManResetOriginalRefs ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Computes area, references, and nodes used in the mapping.]

Description [Collects the nodes in reverse topological order in array p->vMapping.]

SideEffects []

SeeAlso []

Definition at line 287 of file ifUtil.c.

288{
289 If_Obj_t * pObj;
290 int i;
291 If_ManForEachObj( p, pObj, i )
292 pObj->nRefs = 0;
293 If_ManForEachObj( p, pObj, i )
294 {
295 if ( If_ObjIsAnd(pObj) )
296 {
297 pObj->pFanin0->nRefs++;
298 pObj->pFanin1->nRefs++;
299 }
300 else if ( If_ObjIsCo(pObj) )
301 pObj->pFanin0->nRefs++;
302 }
303}
Here is the caller graph for this function:

◆ If_ManRestart()

void If_ManRestart ( If_Man_t * p)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 185 of file ifMan.c.

186{
187 ABC_FREE( p->pMemCi );
188 Vec_PtrClear( p->vCis );
189 Vec_PtrClear( p->vCos );
190 Vec_PtrClear( p->vObjs );
191 Vec_PtrClear( p->vTemp );
192 Mem_FixedRestart( p->pMemObj );
193 // create the constant node
194 p->pConst1 = If_ManSetupObj( p );
195 p->pConst1->Type = IF_CONST1;
196 p->pConst1->fPhase = 1;
197 // reset the counter of other nodes
198 p->nObjs[IF_CI] = p->nObjs[IF_CO] = p->nObjs[IF_AND] = 0;
199}
void Mem_FixedRestart(Mem_Fixed_t *p)
Definition mem.c:255
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManReverseOrder()

Vec_Ptr_t * If_ManReverseOrder ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Computes the reverse topological order of nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 363 of file ifUtil.c.

364{
365 Vec_Ptr_t * vOrder;
366 If_Obj_t * pObj, ** ppStore;
367 int i;
368 // allocate place to store the nodes
369 ppStore = ABC_ALLOC( If_Obj_t *, p->nLevelMax + 1 );
370 memset( ppStore, 0, sizeof(If_Obj_t *) * (p->nLevelMax + 1) );
371 // add the nodes
372 If_ManForEachObj( p, pObj, i )
373 {
374 assert( pObj->Level >= 0 && pObj->Level <= (unsigned)p->nLevelMax );
375 pObj->pCopy = (char *)ppStore[pObj->Level];
376 ppStore[pObj->Level] = pObj;
377 }
378 vOrder = Vec_PtrAlloc( If_ManObjNum(p) );
379 for ( i = p->nLevelMax; i >= 0; i-- )
380 for ( pObj = ppStore[i]; pObj; pObj = (If_Obj_t *)pObj->pCopy )
381 Vec_PtrPush( vOrder, pObj );
382 ABC_FREE( ppStore );
383 // print the order
384// Vec_PtrForEachEntry( If_Obj_t *, vOrder, pObj, i )
385// Abc_Print( 1, "Obj %2d Type %d Level = %d\n", pObj->Id, pObj->Type, pObj->Level );
386 return vOrder;
387}
void * pCopy
Definition if.h:356
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSatBuildFromCell()

void * If_ManSatBuildFromCell ( char * pStr,
Vec_Int_t ** pvPiVars,
Vec_Int_t ** pvPoVars,
Ifn_Ntk_t ** ppNtk )
extern

Definition at line 633 of file ifTune.c.

634{
635 Ifn_Ntk_t * p = Ifn_NtkParse( pStr );
636 Ifn_Prepare( p, NULL, p->nInps );
637 *ppNtk = p;
638 if ( p == NULL )
639 return NULL;
640// Ifn_NtkPrint( p );
641 return Ifn_ManSatBuild( p, pvPiVars, pvPoVars );
642}
sat_solver * Ifn_ManSatBuild(Ifn_Ntk_t *p, Vec_Int_t **pvPiVars, Vec_Int_t **pvPoVars)
Definition ifTune.c:619
Here is the call graph for this function:

◆ If_ManSatBuildXY()

void * If_ManSatBuildXY ( int nLutSize)
extern

DECLARATIONS ///.

CFile****************************************************************

FileName [ifSat.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [FPGA mapping based on priority cuts.]

Synopsis [SAT-based evaluation.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 21, 2006.]

Revision [

Id
ifSat.c,v 1.00 2006/11/21 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Builds SAT instance for the given structure.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file ifSat.c.

46{
47 int nMintsL = (1 << nLutSize);
48 int nMintsF = (1 << (2 * nLutSize - 1));
49 int nVars = 2 * nMintsL + nMintsF;
50 int iVarP0 = 0; // LUT0 parameters (total nMintsL)
51 int iVarP1 = nMintsL; // LUT1 parameters (total nMintsL)
52 int m,iVarM = 2 * nMintsL; // MUX vars (total nMintsF)
54 sat_solver_setnvars( p, nVars );
55 for ( m = 0; m < nMintsF; m++ )
56 sat_solver_add_mux( p,
57 iVarM + m,
58 iVarP0 + m % nMintsL,
59 iVarP1 + 2 * (m / nMintsL) + 1,
60 iVarP1 + 2 * (m / nMintsL),
61 0, 0, 0, 0 );
62 return p;
63}
sat_solver * sat_solver_new(void)
Definition satSolver.c:1137
void sat_solver_setnvars(sat_solver *s, int n)
Definition satSolver.c:1272
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSatBuildXYZ()

void * If_ManSatBuildXYZ ( int nLutSize)
extern

Definition at line 64 of file ifSat.c.

65{
66 int nMintsL = (1 << nLutSize);
67 int nMintsF = (1 << (3 * nLutSize - 2));
68 int nVars = 3 * nMintsL + nMintsF;
69 int iVarP0 = 0; // LUT0 parameters (total nMintsL)
70 int iVarP1 = nMintsL; // LUT1 parameters (total nMintsL)
71 int iVarP2 = 2 * nMintsL; // LUT2 parameters (total nMintsL)
72 int m,iVarM = 3 * nMintsL; // MUX vars (total nMintsF)
74 sat_solver_setnvars( p, nVars );
75 for ( m = 0; m < nMintsF; m++ )
76 sat_solver_add_mux41( p,
77 iVarM + m,
78 iVarP0 + m % nMintsL,
79 iVarP1 + (m >> nLutSize) % nMintsL,
80 iVarP2 + 4 * (m >> (2 * nLutSize)) + 0,
81 iVarP2 + 4 * (m >> (2 * nLutSize)) + 1,
82 iVarP2 + 4 * (m >> (2 * nLutSize)) + 2,
83 iVarP2 + 4 * (m >> (2 * nLutSize)) + 3 );
84 return p;
85}
Here is the call graph for this function:

◆ If_ManSatCheckXY()

int If_ManSatCheckXY ( void * pSat,
int nLutSize,
word * pTruth,
int nVars,
unsigned uSet,
word * pTBound,
word * pTFree,
Vec_Int_t * vLits )
extern

Function*************************************************************

Synopsis [Returns config string for the given truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 151 of file ifSat.c.

152{
153 sat_solver * p = (sat_solver *)pSat;
154 int iBSet, nBSet = 0, pBSet[IF_MAX_FUNC_LUTSIZE];
155 int iSSet, nSSet = 0, pSSet[IF_MAX_FUNC_LUTSIZE];
156 int iFSet, nFSet = 0, pFSet[IF_MAX_FUNC_LUTSIZE];
157 int nMintsL = (1 << nLutSize);
158 int nMintsF = (1 << (2 * nLutSize - 1));
159 int v, Value, m, mNew, nMintsFNew, nMintsLNew;
160 word Res;
161 // collect variable sets
162 Dau_DecSortSet( uSet, nVars, &nBSet, &nSSet, &nFSet );
163 assert( nBSet + nSSet + nFSet == nVars );
164 // check variable bounds
165 assert( nSSet + nBSet <= nLutSize );
166 assert( nLutSize + nSSet + nFSet <= 2*nLutSize - 1 );
167 nMintsFNew = (1 << (nLutSize + nSSet + nFSet));
168 // remap minterms
169 Vec_IntFill( vLits, nMintsF, -1 );
170 for ( m = 0; m < (1 << nVars); m++ )
171 {
172 mNew = iBSet = iSSet = iFSet = 0;
173 for ( v = 0; v < nVars; v++ )
174 {
175 Value = ((uSet >> (v << 1)) & 3);
176 if ( Value == 0 ) // FS
177 {
178 if ( ((m >> v) & 1) )
179 mNew |= 1 << (nLutSize + nSSet + iFSet), pFSet[iFSet] = v;
180 iFSet++;
181 }
182 else if ( Value == 1 ) // BS
183 {
184 if ( ((m >> v) & 1) )
185 mNew |= 1 << (nSSet + iBSet), pBSet[iBSet] = v;
186 iBSet++;
187 }
188 else if ( Value == 3 ) // SS
189 {
190 if ( ((m >> v) & 1) )
191 {
192 mNew |= 1 << iSSet;
193 mNew |= 1 << (nLutSize + iSSet);
194 pSSet[iSSet] = v;
195 }
196 iSSet++;
197 }
198 else assert( Value == 0 );
199 }
200 assert( iBSet == nBSet && iFSet == nFSet );
201 assert( Vec_IntEntry(vLits, mNew) == -1 );
202 Vec_IntWriteEntry( vLits, mNew, Abc_TtGetBit(pTruth, m) );
203 }
204 // find assumptions
205 v = 0;
206 Vec_IntForEachEntry( vLits, Value, m )
207 {
208// printf( "%d", (Value >= 0) ? Value : 2 );
209 if ( Value >= 0 )
210 Vec_IntWriteEntry( vLits, v++, Abc_Var2Lit(2 * nMintsL + m, !Value) );
211 }
212 Vec_IntShrink( vLits, v );
213// printf( " %d\n", Vec_IntSize(vLits) );
214 // run SAT solver
215 Value = sat_solver_solve( p, Vec_IntArray(vLits), Vec_IntArray(vLits) + Vec_IntSize(vLits), 0, 0, 0, 0 );
216 if ( Value != l_True )
217 return 0;
218 if ( pTBound && pTFree )
219 {
220 // collect config
221 assert( nSSet + nBSet <= nLutSize );
222 *pTBound = 0;
223 nMintsLNew = (1 << (nSSet + nBSet));
224 for ( m = 0; m < nMintsLNew; m++ )
225 if ( sat_solver_var_value(p, m) )
226 Abc_TtSetBit( pTBound, m );
227 *pTBound = Abc_Tt6Stretch( *pTBound, nSSet + nBSet );
228 // collect configs
229 assert( nSSet + nFSet + 1 <= nLutSize );
230 *pTFree = 0;
231 nMintsLNew = (1 << (1 + nSSet + nFSet));
232 for ( m = 0; m < nMintsLNew; m++ )
233 if ( sat_solver_var_value(p, nMintsL+m) )
234 Abc_TtSetBit( pTFree, m );
235 *pTFree = Abc_Tt6Stretch( *pTFree, 1 + nSSet + nFSet );
236 if ( nVars != 6 || nLutSize != 4 )
237 return 1;
238 // verify the result
239 Res = If_ManSat6Truth( *pTBound, *pTFree, pBSet, nBSet, pSSet, nSSet, pFSet, nFSet );
240 if ( pTruth[0] != Res )
241 {
242 Dau_DsdPrintFromTruth( pTruth, nVars );
243 Dau_DsdPrintFromTruth( &Res, nVars );
244 Dau_DsdPrintFromTruth( pTBound, nSSet+nBSet );
245 Dau_DsdPrintFromTruth( pTFree, nSSet+nFSet+1 );
246 printf( "Verification failed!\n" );
247 }
248 }
249 return 1;
250}
#define l_True
Definition bmcBmcS.c:35
#define sat_solver_solve
Definition cecSatG2.c:45
void Dau_DecSortSet(unsigned set, int nVars, int *pnUnique, int *pnShared, int *pnFree)
Definition dauNonDsd.c:371
word If_ManSat6Truth(word uBound, word uFree, int *pBSet, int nBSet, int *pSSet, int nSSet, int *pFSet, int nFSet)
Definition ifSat.c:119
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSatCheckXYall()

unsigned If_ManSatCheckXYall ( void * pSat,
int nLutSize,
word * pTruth,
int nVars,
Vec_Int_t * vLits )
extern

Definition at line 477 of file ifSat.c.

478{
479 unsigned uSet = If_ManSatCheckXYall_int( pSat, nLutSize, pTruth, nVars, vLits );
480// Dau_DecPrintSet( uSet, nVars, 1 );
481 return uSet;
482}
unsigned If_ManSatCheckXYall_int(void *pSat, int nLutSize, word *pTruth, int nVars, Vec_Int_t *vLits)
Definition ifSat.c:263
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSatDeriveGiaFromBits()

int If_ManSatDeriveGiaFromBits ( void * pGia,
Ifn_Ntk_t * p,
word * pConfigData,
Vec_Int_t * vLeaves,
Vec_Int_t * vCover )
extern

Function*************************************************************

Synopsis [Derive GIA using programmable bits.]

Description []

SideEffects []

SeeAlso []

Definition at line 742 of file ifTune.c.

743{
744 Gia_Man_t * pNew = (Gia_Man_t *)pGia;
745 int i, k, iLit, iVar = 0, nVarsNew, pVarMap[1000];
746 int nTtBits = p->nParsVIni - p->nObjs;
747 int nPermBits = Abc_Base2Log(p->nInps + 1) + 1;
748 int fCompl = Abc_TtGetBit( pConfigData, nTtBits + nPermBits * p->nInps );
749 assert( Vec_IntSize(vLeaves) <= p->nInps && p->nParsVIni < 1000 );
750 for ( i = 0; i < p->nInps; i++ )
751 {
752 for ( iLit = k = 0; k < nPermBits; k++ )
753 if ( Abc_TtGetBit(pConfigData, nTtBits + i * nPermBits + k) )
754 iLit |= (1 << k);
755 assert( Abc_Lit2Var(iLit) < Vec_IntSize(vLeaves) );
756 pVarMap[i] = Abc_Lit2LitL( Vec_IntArray(vLeaves), iLit );
757 }
758 for ( i = p->nInps; i < p->nObjs; i++ )
759 {
760 int Type = p->Nodes[i].Type;
761 int nFans = p->Nodes[i].nFanins;
762 int * pFans = p->Nodes[i].Fanins;
763 //int iFanin = p->Nodes[i].iFirst;
764 assert( nFans <= 6 );
765 if ( Type == IFN_DSD_AND )
766 {
767 iLit = 1;
768 for ( k = 0; k < nFans; k++ )
769 iLit = Gia_ManHashAnd( pNew, iLit, pVarMap[pFans[k]] );
770 pVarMap[i] = iLit;
771 }
772 else if ( Type == IFN_DSD_XOR )
773 {
774 iLit = 0;
775 for ( k = 0; k < nFans; k++ )
776 iLit = Gia_ManHashXor( pNew, iLit, pVarMap[pFans[k]] );
777 pVarMap[i] = iLit;
778 }
779 else if ( Type == IFN_DSD_MUX )
780 {
781 assert( nFans == 3 );
782 pVarMap[i] = Gia_ManHashMux( pNew, pVarMap[pFans[0]], pVarMap[pFans[1]], pVarMap[pFans[2]] );
783 }
784 else if ( Type == IFN_DSD_PRIME )
785 {
786 int pFaninLits[16];
787 // collect truth table
788 word uTruth = 0;
789 int nMints = (1 << nFans);
790 for ( k = 0; k < nMints; k++ )
791 if ( Abc_TtGetBit(pConfigData, iVar++) )
792 uTruth |= ((word)1 << k);
793 uTruth = Abc_Tt6Stretch( uTruth, nFans );
794 // collect function
795 for ( k = 0; k < nFans; k++ )
796 pFaninLits[k] = pVarMap[pFans[k]];
797 // implement the function
798 nVarsNew = Abc_TtMinBase( &uTruth, pFaninLits, nFans, 6 );
799 if ( nVarsNew == 0 )
800 pVarMap[i] = (int)(uTruth & 1);
801 else
802 {
803 extern int Kit_TruthToGia( Gia_Man_t * pMan, unsigned * pTruth, int nVars, Vec_Int_t * vMemory, Vec_Int_t * vLeaves, int fHash );
804 Vec_Int_t Leaves = { nVarsNew, nVarsNew, pFaninLits };
805 pVarMap[i] = Kit_TruthToGia( pNew, (unsigned *)&uTruth, nVarsNew, vCover, &Leaves, 1 ); // hashing enabled!!!
806 }
807 }
808 else assert( 0 );
809 }
810 assert( iVar == nTtBits );
811 return Abc_LitNotCond( pVarMap[p->nObjs - 1], fCompl );
812}
ABC_NAMESPACE_IMPL_START int Kit_TruthToGia(Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
DECLARATIONS ///.
Definition kitHop.c:80
int Gia_ManHashXor(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:668
int Gia_ManHashMux(Gia_Man_t *p, int iCtrl, int iData1, int iData0)
Definition giaHash.c:692
int Gia_ManHashAnd(Gia_Man_t *p, int iLit0, int iLit1)
Definition giaHash.c:576
@ IFN_DSD_AND
Definition ifTune.c:43
@ IFN_DSD_MUX
Definition ifTune.c:45
@ IFN_DSD_XOR
Definition ifTune.c:44
@ IFN_DSD_PRIME
Definition ifTune.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSatFindCofigBits()

int If_ManSatFindCofigBits ( void * pSat,
Vec_Int_t * vPiVars,
Vec_Int_t * vPoVars,
word * pTruth,
int nVars,
word Perm,
int nInps,
Vec_Int_t * vValues )
extern

Definition at line 698 of file ifTune.c.

699{
700 // extract permutation
701 int RetValue, i, pPerm[IF_MAX_FUNC_LUTSIZE];
702 assert( nInps <= IF_MAX_FUNC_LUTSIZE );
703 for ( i = 0; i < nInps; i++ )
704 {
705 pPerm[i] = Abc_TtGetHex( &Perm, i );
706 assert( pPerm[i] < nVars );
707 }
708 // perform SAT check
709 RetValue = Ifn_ManSatCheckOne( (sat_solver *)pSat, vPoVars, pTruth, nVars, pPerm, nInps, vValues );
710 Vec_IntClear( vValues );
711 if ( RetValue == 0 )
712 return 0;
713 Ifn_ManSatDeriveOne( (sat_solver*)pSat, vPiVars, vValues );
714 return 1;
715}
int Ifn_ManSatCheckOne(sat_solver *pSat, Vec_Int_t *vPoVars, word *pTruth, int nVars, int *pPerm, int nInps, Vec_Int_t *vLits)
Definition ifTune.c:662
void Ifn_ManSatDeriveOne(sat_solver *pSat, Vec_Int_t *vPiVars, Vec_Int_t *vValues)
Definition ifTune.c:691
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSatUnbuild()

void If_ManSatUnbuild ( void * p)
extern

Definition at line 86 of file ifSat.c.

87{
88 if ( p )
90}
void sat_solver_delete(sat_solver *s)
Definition satSolver.c:1341
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManScanMapping()

float If_ManScanMapping ( If_Man_t * p)
extern

◆ If_ManScanMappingDirect()

float If_ManScanMappingDirect ( If_Man_t * p)
extern

◆ If_ManScanMappingSeq()

float If_ManScanMappingSeq ( If_Man_t * p)
extern

◆ If_ManSetDefaultPars()

void If_ManSetDefaultPars ( If_Par_t * pPars)
extern

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file ifCore.c.

48{
49 memset( pPars, 0, sizeof(If_Par_t) );
50 pPars->nLutSize = -1;
51 pPars->nCutsMax = 8;
52 pPars->nFlowIters = 1;
53 pPars->nAreaIters = 2;
54 pPars->DelayTarget = -1;
55 pPars->Epsilon = (float)0.005;
56 pPars->fPreprocess = 1;
57 pPars->fArea = 0;
58 pPars->fFancy = 0;
59 pPars->fExpRed = 1;
60 pPars->fLatchPaths = 0;
61 pPars->fEdge = 1;
62 pPars->fPower = 0;
63 pPars->fCutMin = 0;
64 pPars->fBidec = 0;
65 pPars->fUserLutDec = 0;
66 pPars->fUserLut2D = 0;
67 pPars->fVerbose = 0;
68}
struct If_Par_t_ If_Par_t
Definition if.h:78
int fLatchPaths
Definition if.h:121
int fUserLut2D
Definition if.h:151
float Epsilon
Definition if.h:111
int fPower
Definition if.h:124
int fUserLutDec
Definition if.h:150
int nLutSize
Definition if.h:104
int fExpRed
Definition if.h:120
int fEdge
Definition if.h:123
int nFlowIters
Definition if.h:106
int nAreaIters
Definition if.h:107
int fBidec
Definition if.h:131
int nCutsMax
Definition if.h:105
float DelayTarget
Definition if.h:110
int fCutMin
Definition if.h:125
int fPreprocess
Definition if.h:117
int fFancy
Definition if.h:119
int fArea
Definition if.h:118
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSetupCiCutSets()

void If_ManSetupCiCutSets ( If_Man_t * p)
extern

Function*************************************************************

Synopsis [Prepares memory for one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 566 of file ifMan.c.

567{
568 If_Obj_t * pObj;
569 int i;
570 assert( p->pMemCi == NULL );
571 // create elementary cuts for the CIs
572 If_ManForEachCi( p, pObj, i )
573 If_ManSetupCutTriv( p, &pObj->CutBest, pObj->Id );
574 // create elementary cutsets for the CIs
575 p->pMemCi = (If_Set_t *)ABC_ALLOC( char, If_ManCiNum(p) * (sizeof(If_Set_t) + sizeof(void *)) );
576 If_ManForEachCi( p, pObj, i )
577 {
578 pObj->pCutSet = (If_Set_t *)((char *)p->pMemCi + i * (sizeof(If_Set_t) + sizeof(void *)));
579 pObj->pCutSet->nCuts = 1;
580 pObj->pCutSet->nCutsMax = p->pPars->nCutsMax;
581 pObj->pCutSet->ppCuts = (If_Cut_t **)(pObj->pCutSet + 1);
582 pObj->pCutSet->ppCuts[0] = &pObj->CutBest;
583 }
584}
void If_ManSetupCutTriv(If_Man_t *p, If_Cut_t *pCut, int ObjId)
Definition ifMan.c:517
struct If_Set_t_ If_Set_t
Definition if.h:81
If_Cut_t CutBest
Definition if.h:361
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManSetupCutTriv()

void If_ManSetupCutTriv ( If_Man_t * p,
If_Cut_t * pCut,
int ObjId )
extern

Function*************************************************************

Synopsis [Prepares memory for one cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 517 of file ifMan.c.

518{
519 pCut->fCompl = 0;
520 pCut->nLimit = p->pPars->nLutSize;
521 pCut->nLeaves = 1;
522 pCut->pLeaves[0] = p->pPars->fLiftLeaves? (ObjId << 8) : ObjId;
523 pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
524 pCut->iCutFunc = p->pPars->fUseTtPerm ? 3 : (p->pPars->fTruth ? 2: -1);
525 pCut->uMaskFunc = 0;
526 assert( pCut->pLeaves[0] < p->vObjs->nSize );
527}
Here is the caller graph for this function:

◆ If_ManSetupNodeCutSet()

If_Set_t * If_ManSetupNodeCutSet ( If_Man_t * p,
If_Obj_t * pObj )
extern

Function*************************************************************

Synopsis [Prepares cutset of the node.]

Description [Elementary cutset will be added last.]

SideEffects []

SeeAlso []

Definition at line 597 of file ifMan.c.

598{
599 assert( If_ObjIsAnd(pObj) );
600 assert( pObj->pCutSet == NULL );
601// pObj->pCutSet = (If_Set_t *)Mem_FixedEntryFetch( p->pMemSet );
602// If_ManSetupSet( p, pObj->pCutSet );
603 pObj->pCutSet = If_ManCutSetFetch( p );
604 pObj->pCutSet->nCuts = 0;
605 pObj->pCutSet->nCutsMax = p->pPars->nCutsMax;
606 return pObj->pCutSet;
607}
Here is the caller graph for this function:

◆ If_ManSetupSetAll()

void If_ManSetupSetAll ( If_Man_t * p,
int nCrossCut )
extern

Function*************************************************************

Synopsis [Dereferences cutset of the node.]

Description []

SideEffects []

SeeAlso []

Definition at line 693 of file ifMan.c.

694{
695 If_Set_t * pCutSet;
696 int i, nCutSets;
697 nCutSets = 128 + nCrossCut;
698 p->pFreeList = p->pMemAnd = pCutSet = (If_Set_t *)ABC_ALLOC( char, nCutSets * p->nSetBytes );
699 for ( i = 0; i < nCutSets; i++ )
700 {
701 If_ManSetupSet( p, pCutSet );
702 if ( i == nCutSets - 1 )
703 pCutSet->pNext = NULL;
704 else
705 pCutSet->pNext = (If_Set_t *)( (char *)pCutSet + p->nSetBytes );
706 pCutSet = pCutSet->pNext;
707 }
708 assert( pCutSet == NULL );
709
710 if ( p->pPars->fVerbose )
711 {
712 Abc_Print( 1, "Node = %7d. Ch = %5d. Total mem = %7.2f MB. Peak cut mem = %7.2f MB.\n",
713 If_ManAndNum(p), p->nChoices,
714 1.0 * (p->nObjBytes + 2*sizeof(void *)) * If_ManObjNum(p) / (1<<20),
715 1.0 * p->nSetBytes * nCrossCut / (1<<20) );
716 }
717// Abc_Print( 1, "Cross cut = %d.\n", nCrossCut );
718
719}
void If_ManSetupSet(If_Man_t *p, If_Set_t *pSet)
Definition ifMan.c:489
If_Set_t * pNext
Definition if.h:326
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManStart()

If_Man_t * If_ManStart ( If_Par_t * pPars)
extern

FUNCTION DEFINITIONS ///.

Function*************************************************************

Synopsis [Starts the AIG manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 50 of file ifMan.c.

51{
52 If_Man_t * p; int v;
53 assert( !pPars->fUseDsd || !pPars->fUseTtPerm );
54 // start the manager
55 p = ABC_ALLOC( If_Man_t, 1 );
56 memset( p, 0, sizeof(If_Man_t) );
57 p->pPars = pPars;
58 p->fEpsilon = pPars->Epsilon;
59 // allocate arrays for nodes
60 p->vCis = Vec_PtrAlloc( 100 );
61 p->vCos = Vec_PtrAlloc( 100 );
62 p->vObjs = Vec_PtrAlloc( 100 );
63 p->vTemp = Vec_PtrAlloc( 100 );
64 p->vVisited = Vec_PtrAlloc( 100 );
65 // prepare the memory manager
66 if ( p->pPars->fTruth )
67 {
68 for ( v = 0; v <= p->pPars->nLutSize; v++ )
69 p->nTruth6Words[v] = Abc_Truth6WordNum( v );
70 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
71 p->vTtMem[v] = Vec_MemAllocForTT( v, pPars->fUseTtPerm );
72 for ( v = 0; v < 6; v++ )
73 p->vTtMem[v] = p->vTtMem[6];
74 if ( p->pPars->fDelayOpt || pPars->nGateSize > 0 )
75 {
76 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
77 p->vTtIsops[v] = Vec_WecAlloc( 1000 );
78 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
79 Vec_WecInit( p->vTtIsops[v], 2 );
80 for ( v = 0; v < 6; v++ )
81 p->vTtIsops[v] = p->vTtIsops[6];
82 }
83 if ( pPars->fDelayOpt || pPars->nGateSize > 0 || pPars->fDsdBalance )
84 {
85 p->vCover = Vec_IntAlloc( 0 );
86 p->vArray = Vec_IntAlloc( 1000 );
87 }
88 }
89 p->nPermWords = p->pPars->fUsePerm? If_CutPermWords( p->pPars->nLutSize ) : 0;
90 p->nObjBytes = sizeof(If_Obj_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords);
91 p->nCutBytes = sizeof(If_Cut_t) + sizeof(int) * (p->pPars->nLutSize + p->nPermWords);
92 p->nSetBytes = sizeof(If_Set_t) + (sizeof(If_Cut_t *) + p->nCutBytes) * (p->pPars->nCutsMax + 1);
93 p->pMemObj = Mem_FixedStart( p->nObjBytes );
94 // report expected memory usage
95 if ( p->pPars->fVerbose )
96 Abc_Print( 1, "K = %d. Memory (bytes): Truth = %4d. Cut = %4d. Obj = %4d. Set = %4d. CutMin = %s\n",
97 p->pPars->nLutSize, 8 * p->nTruth6Words[p->pPars->nLutSize], p->nCutBytes, p->nObjBytes, p->nSetBytes, p->pPars->fCutMin? "yes":"no" );
98 // room for temporary truth tables
99 p->puTemp[0] = p->pPars->fTruth? ABC_ALLOC( unsigned, 8 * p->nTruth6Words[p->pPars->nLutSize] ) : NULL;
100 p->puTemp[1] = p->pPars->fTruth? p->puTemp[0] + p->nTruth6Words[p->pPars->nLutSize]*2 : NULL;
101 p->puTemp[2] = p->pPars->fTruth? p->puTemp[1] + p->nTruth6Words[p->pPars->nLutSize]*2 : NULL;
102 p->puTemp[3] = p->pPars->fTruth? p->puTemp[2] + p->nTruth6Words[p->pPars->nLutSize]*2 : NULL;
103 p->puTempW = p->pPars->fTruth? ABC_ALLOC( word, p->nTruth6Words[p->pPars->nLutSize] ) : NULL;
104 if ( pPars->fUseDsd )
105 {
106 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
107 {
108 p->vTtDsds[v] = Vec_IntAlloc( 1000 );
109 Vec_IntPush( p->vTtDsds[v], 0 );
110 Vec_IntPush( p->vTtDsds[v], 2 );
111 p->vTtPerms[v] = Vec_StrAlloc( 10000 );
112 Vec_StrFill( p->vTtPerms[v], 2 * v, IF_BIG_CHAR );
113 Vec_StrWriteEntry( p->vTtPerms[v], v, 0 );
114 }
115 for ( v = 0; v < 6; v++ )
116 {
117 p->vTtDsds[v] = p->vTtDsds[6];
118 p->vTtPerms[v] = p->vTtPerms[6];
119 }
120 }
121 if ( pPars->fUseTtPerm )
122 {
123 p->vPairHash = Hash_IntManStart( 10000 );
124 p->vPairPerms = Vec_StrAlloc( 10000 );
125 Vec_StrFill( p->vPairPerms, p->pPars->nLutSize, 0 );
126 p->vPairRes = Vec_IntAlloc( 1000 );
127 Vec_IntPush( p->vPairRes, -1 );
128 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
129 p->vTtOccurs[v] = Vec_IntAlloc( 1000 );
130 for ( v = 0; v < 6; v++ )
131 p->vTtOccurs[v] = p->vTtOccurs[6];
132 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
133 Vec_IntPushTwo( p->vTtOccurs[v], 0, 0 );
134 }
135 if ( pPars->fUseCofVars )
136 {
137 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
138 {
139 p->vTtVars[v] = Vec_StrAlloc( 1000 );
140 Vec_StrPush( p->vTtVars[v], 0 );
141 Vec_StrPush( p->vTtVars[v], 0 );
142 }
143 for ( v = 0; v < 6; v++ )
144 p->vTtVars[v] = p->vTtVars[6];
145 }
146 if ( pPars->fUseAndVars )
147 {
148 for ( v = 6; v <= Abc_MaxInt(6,p->pPars->nLutSize); v++ )
149 {
150 p->vTtDecs[v] = Vec_IntAlloc( 1000 );
151 Vec_IntPush( p->vTtDecs[v], 0 );
152 Vec_IntPush( p->vTtDecs[v], 0 );
153 }
154 for ( v = 0; v < 6; v++ )
155 p->vTtDecs[v] = p->vTtDecs[6];
156 }
157 if ( pPars->fUseBat )
158 {
159// abctime clk = Abc_Clock();
160 extern int Bat_ManCellFuncLookup( void * pMan, unsigned * pTruth, int nVars, int nLeaves, char * pStr );
161 extern void Bat_ManFuncSetupTable();
162 pPars->pFuncCell = (int (*) (If_Man_t *, unsigned *, int, int, char *))Bat_ManCellFuncLookup;
164// Abc_PrintTime( 1, "Setup time", Abc_Clock() - clk );
165 }
166 // create the constant node
167 p->pConst1 = If_ManSetupObj( p );
168 p->pConst1->Type = IF_CONST1;
169 p->pConst1->fPhase = 1;
170 p->nObjs[IF_CONST1]++;
171 return p;
172}
int Bat_ManCellFuncLookup(void *pMan, unsigned *pTruth, int nVars, int nLeaves, char *pStr)
Definition ifMatch2.c:51
ABC_NAMESPACE_IMPL_START void Bat_ManFuncSetupTable()
DECLARATIONS ///.
Definition ifMatch2.c:45
Mem_Fixed_t * Mem_FixedStart(int nEntrySize)
FUNCTION DEFINITIONS ///.
Definition mem.c:100
int fUseDsd
Definition if.h:140
int nGateSize
Definition if.h:108
int fDelayOpt
Definition if.h:126
int fUseAndVars
Definition if.h:143
int fUseCofVars
Definition if.h:142
int fUseTtPerm
Definition if.h:144
int fUseBat
Definition if.h:133
int(* pFuncCell)(If_Man_t *, unsigned *, int, int, char *)
Definition if.h:180
int fDsdBalance
Definition if.h:128
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ManStop()

void If_ManStop ( If_Man_t * p)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 212 of file ifMan.c.

213{
214 extern void If_ManCacheAnalize( If_Man_t * p );
215 int i;
216 if ( p->pPars->fVerbose && p->vCutData )
218 if ( p->pPars->fVerbose && p->pPars->fTruth )
219 {
220 int nUnique = 0, nMemTotal = 0;
221 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
222 nUnique += Vec_MemEntryNum(p->vTtMem[i]);
223 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
224 nMemTotal += (int)Vec_MemMemory(p->vTtMem[i]);
225 printf( "Unique truth tables = %d Memory = %.2f MB ", nUnique, 1.0 * nMemTotal / (1<<20) );
226 Abc_PrintTime( 1, "Time", p->timeCache[4] );
227 if ( p->nCacheMisses )
228 {
229 printf( "Cache hits = %d. Cache misses = %d (%.2f %%)\n", p->nCacheHits, p->nCacheMisses, 100.0 * p->nCacheMisses / (p->nCacheHits + p->nCacheMisses) );
230 Abc_PrintTime( 1, "Non-DSD ", p->timeCache[0] );
231 Abc_PrintTime( 1, "DSD hits ", p->timeCache[1] );
232 Abc_PrintTime( 1, "DSD misses", p->timeCache[2] );
233 Abc_PrintTime( 1, "TOTAL ", p->timeCache[0] + p->timeCache[1] + p->timeCache[2] );
234 Abc_PrintTime( 1, "Canon ", p->timeCache[3] );
235 }
236 }
237 if ( p->pPars->fVerbose && p->nCutsUselessAll )
238 {
239 for ( i = 0; i <= 16; i++ )
240 if ( p->nCutsUseless[i] )
241 Abc_Print( 1, "Useless cuts %2d = %9d (out of %9d) (%6.2f %%)\n", i, p->nCutsUseless[i], p->nCutsCount[i], 100.0*p->nCutsUseless[i]/Abc_MaxInt(p->nCutsCount[i],1) );
242 Abc_Print( 1, "Useless cuts all = %9d (out of %9d) (%6.2f %%)\n", p->nCutsUselessAll, p->nCutsCountAll, 100.0*p->nCutsUselessAll/Abc_MaxInt(p->nCutsCountAll,1) );
243 }
244// if ( p->pPars->fVerbose && p->nCuts5 )
245// Abc_Print( 1, "Statistics about 5-cuts: Total = %d Non-decomposable = %d (%.2f %%)\n", p->nCuts5, p->nCuts5-p->nCuts5a, 100.0*(p->nCuts5-p->nCuts5a)/p->nCuts5 );
246 if ( p->pIfDsdMan )
247 p->pIfDsdMan = NULL;
248 if ( p->pPars->fUseDsd && (p->nCountNonDec[0] || p->nCountNonDec[1]) )
249 printf( "NonDec0 = %d. NonDec1 = %d.\n", p->nCountNonDec[0], p->nCountNonDec[1] );
250 Vec_IntFreeP( &p->vCoAttrs );
251 Vec_PtrFree( p->vCis );
252 Vec_PtrFree( p->vCos );
253 Vec_PtrFree( p->vObjs );
254 Vec_PtrFree( p->vTemp );
255 Vec_IntFreeP( &p->vCover );
256 Vec_IntFreeP( &p->vArray );
257 Vec_WrdFreeP( &p->vAnds );
258 Vec_WrdFreeP( &p->vAndGate );
259 Vec_WrdFreeP( &p->vOrGate );
260 Vec_PtrFreeP( &p->vObjsRev );
261 Vec_PtrFreeP( &p->vLatchOrder );
262 Vec_IntFreeP( &p->vLags );
263 Vec_IntFreeP( &p->vDump );
264 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
265 Vec_IntFreeP( &p->vTtDsds[i] );
266 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
267 Vec_StrFreeP( &p->vTtPerms[i] );
268 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
269 Vec_StrFreeP( &p->vTtVars[i] );
270 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
271 Vec_IntFreeP( &p->vTtDecs[i] );
272 Vec_IntFreeP( &p->vCutData );
273 Vec_IntFreeP( &p->vPairRes );
274 Vec_StrFreeP( &p->vPairPerms );
275 Vec_PtrFreeP( &p->vVisited );
276 Vec_StrFreeP( &p->vMarks );
277 Vec_IntFreeP( &p->vVisited2 );
278 if ( p->vPairHash )
279 Hash_IntManStop( p->vPairHash );
280 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
281 Vec_MemHashFree( p->vTtMem[i] );
282 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
283 Vec_MemFreeP( &p->vTtMem[i] );
284 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
285 Vec_WecFreeP( &p->vTtIsops[i] );
286 for ( i = 6; i <= Abc_MaxInt(6,p->pPars->nLutSize); i++ )
287 Vec_IntFreeP( &p->vTtOccurs[i] );
288 Mem_FixedStop( p->pMemObj, 0 );
289 if ( p->vTtMem6 )
290 {
291 Vec_MemHashFree( p->vTtMem6 );
292 Vec_MemFreeP( &p->vTtMem6 );
293 }
294 ABC_FREE( p->pMemCi );
295 ABC_FREE( p->pMemAnd );
296 ABC_FREE( p->puTemp[0] );
297 ABC_FREE( p->puTempW );
298 // free pars memory
299 ABC_FREE( p->pPars->pTimesArr );
300 ABC_FREE( p->pPars->pTimesReq );
301 if ( p->pManTim )
302 Tim_ManStop( p->pManTim );
303 if ( p->vSwitching )
304 Vec_IntFree( p->vSwitching );
305 if ( p->pPars->fUseBat )
306 {
307 extern void Bat_ManFuncSetdownTable();
309 }
310 // hash table
311// if ( p->pPars->fVerbose && p->nTableEntries[0] )
312// printf( "Hash table 2: Entries = %7d. Size = %7d.\n", p->nTableEntries[0], p->nTableSize[0] );
313// if ( p->pPars->fVerbose && p->nTableEntries[1] )
314// printf( "Hash table 3: Entries = %7d. Size = %7d.\n", p->nTableEntries[1], p->nTableSize[1] );
315 ABC_FREE( p->pHashTable[0] );
316 ABC_FREE( p->pHashTable[1] );
317 if ( p->pMemEntries )
318 Mem_FixedStop( p->pMemEntries, 0 );
319 ABC_FREE( p->pName );
320 ABC_FREE( p );
321}
void If_ManCacheAnalize(If_Man_t *p)
Definition ifCache.c:70
void Bat_ManFuncSetdownTable()
Definition ifMatch2.c:48
void Mem_FixedStop(Mem_Fixed_t *p, int fVerbose)
Definition mem.c:139
void Tim_ManStop(Tim_Man_t *p)
Definition timMan.c:378
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_MatchCheck1()

int If_MatchCheck1 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1119 of file ifDec07.c.

1120{
1121 if ( nLeaves < nVars )
1122 return 1;
1123 assert( nLeaves == nVars );
1124 if ( Abc_Tt6Check1( ((word *)pTruth)[0], nLeaves ) )
1125 return 1;
1126 return 0;
1127}

◆ If_MatchCheck2()

int If_MatchCheck2 ( If_Man_t * p,
unsigned * pTruth,
int nVars,
int nLeaves,
char * pStr )
extern

Definition at line 1128 of file ifDec07.c.

1129{
1130 if ( nLeaves < nVars )
1131 return 1;
1132 assert( nLeaves == nVars );
1133 if ( Abc_Tt6Check2( ((word *)pTruth)[0], nLeaves ) )
1134 return 1;
1135 return 0;
1136}

◆ If_ObjPerformMappingAnd()

void If_ObjPerformMappingAnd ( If_Man_t * p,
If_Obj_t * pObj,
int Mode,
int fPreprocess,
int fFirst )
extern

Function*************************************************************

Synopsis [Finds the best cut for the given node.]

Description [Mapping modes: delay (0), area flow (1), area (2).]

SideEffects []

SeeAlso []

Definition at line 162 of file ifMap.c.

163{
164 If_Set_t * pCutSet;
165 If_Cut_t * pCut0, * pCut1, * pCut;
166 If_Cut_t * pCut0R, * pCut1R;
167 int fFunc0R, fFunc1R;
168 int i, k, v, iCutDsd, fChange;
169 int fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib || p->pPars->fUserSesLib || p->pPars->fUserLutDec || p->pPars->fUserLut2D ||
170 p->pPars->fUseDsdTune || p->pPars->fUseCofVars || p->pPars->fUseAndVars || p->pPars->fUse34Spec || p->pPars->pLutStruct || p->pPars->pFuncCell2 || p->pPars->fUseCheck1 || p->pPars->fUseCheck2;
171 int fUseAndCut = (p->pPars->nAndDelay > 0) || (p->pPars->nAndArea > 0);
172 assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->pCutSet->nCuts > 0 );
173 assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->pCutSet->nCuts > 0 );
174
175 // prepare
176 if ( Mode == 0 )
177 pObj->EstRefs = (float)pObj->nRefs;
178 else if ( Mode == 1 )
179 pObj->EstRefs = (float)((2.0 * pObj->EstRefs + pObj->nRefs) / 3.0);
180 // deref the selected cut
181 if ( Mode && pObj->nRefs > 0 )
182 If_CutAreaDeref( p, If_ObjCutBest(pObj) );
183
184 // prepare the cutset
185 pCutSet = If_ManSetupNodeCutSet( p, pObj );
186
187 // get the current assigned best cut
188 pCut = If_ObjCutBest(pObj);
189 if ( !fFirst )
190 {
191 // recompute the parameters of the best cut
192 if ( p->pPars->fDelayOpt )
193 pCut->Delay = If_CutSopBalanceEval( p, pCut, NULL );
194 else if ( p->pPars->fDsdBalance )
195 pCut->Delay = If_CutDsdBalanceEval( p, pCut, NULL );
196 else if ( p->pPars->fUserRecLib )
197 pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj );
198 else if ( p->pPars->fUserSesLib )
199 {
200 int Cost = 0;
201 pCut->fUser = 1;
202 pCut->Delay = (float)Abc_ExactDelayCost( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut), If_CutArrTimeProfile(p, pCut), If_CutPerm(pCut), &Cost, If_ManCutAigDelay(p, pObj, pCut) );
203 if ( Cost == ABC_INFINITY )
204 {
205 for ( v = 0; v < If_CutLeaveNum(pCut); v++ )
206 If_CutPerm(pCut)[v] = IF_BIG_CHAR;
207 pCut->Cost = IF_COST_MAX;
208 pCut->fUseless = 1;
209 }
210 }
211 else if ( p->pPars->fUserLutDec || p->pPars->fUserLut2D )
212 {
213 pCut->Delay = If_LutDecReEval( p, pCut );
214 }
215 else if ( p->pPars->fDelayOptLut )
216 pCut->Delay = If_CutLutBalanceEval( p, pCut );
217 else if( p->pPars->nGateSize > 0 )
218 pCut->Delay = If_CutDelaySop( p, pCut );
219 else
220 pCut->Delay = If_CutDelay( p, pObj, pCut );
221 assert( pCut->Delay != -1 );
222// assert( pCut->Delay <= pObj->Required + p->fEpsilon );
223 if ( pCut->Delay > pObj->Required + 2*p->fEpsilon )
224 Abc_Print( 1, "If_ObjPerformMappingAnd(): Warning! Node with ID %d has delay (%f) exceeding the required times (%f).\n",
225 pObj->Id, pCut->Delay, pObj->Required + p->fEpsilon );
226 pCut->Area = (Mode == 2)? If_CutAreaDerefed( p, pCut ) : If_CutAreaFlow( p, pCut );
227 if ( p->pPars->fEdge )
228 pCut->Edge = (Mode == 2)? If_CutEdgeDerefed( p, pCut ) : If_CutEdgeFlow( p, pCut );
229 if ( p->pPars->fPower )
230 pCut->Power = (Mode == 2)? If_CutPowerDerefed( p, pCut, pObj ) : If_CutPowerFlow( p, pCut, pObj );
231 // save the best cut from the previous iteration
232 if ( !fPreprocess || pCut->nLeaves <= 1 )
233 If_CutCopy( p, pCutSet->ppCuts[pCutSet->nCuts++], pCut );
234 }
235
236 // generate cuts
237 If_ObjForEachCut( pObj->pFanin0, pCut0, i )
238 If_ObjForEachCut( pObj->pFanin1, pCut1, k )
239 {
240 // get the next free cut
241 assert( pCutSet->nCuts <= pCutSet->nCutsMax );
242 pCut = pCutSet->ppCuts[pCutSet->nCuts];
243 // make sure K-feasible cut exists
244 if ( If_WordCountOnes(pCut0->uSign | pCut1->uSign) > p->pPars->nLutSize )
245 continue;
246
247 pCut0R = pCut0;
248 pCut1R = pCut1;
249 fFunc0R = pCut0->iCutFunc ^ pCut0->fCompl ^ pObj->fCompl0;
250 fFunc1R = pCut1->iCutFunc ^ pCut1->fCompl ^ pObj->fCompl1;
251 if ( !p->pPars->fUseTtPerm || pCut0->nLeaves > pCut1->nLeaves || (pCut0->nLeaves == pCut1->nLeaves && fFunc0R > fFunc1R) )
252 {
253 }
254 else
255 {
256 ABC_SWAP( If_Cut_t *, pCut0R, pCut1R );
257 ABC_SWAP( int, fFunc0R, fFunc1R );
258 }
259
260 // merge the cuts
261 if ( p->pPars->fUseTtPerm )
262 {
263 if ( !If_CutMerge( p, pCut0R, pCut1R, pCut ) )
264 continue;
265 }
266 else
267 {
268 if ( !If_CutMergeOrdered( p, pCut0, pCut1, pCut ) )
269 continue;
270 }
271 if ( p->pPars->fUserLutDec && !fFirst && pCut->nLeaves > p->pPars->nLutDecSize )
272 continue;
273 if ( pObj->fSpec && pCut->nLeaves == (unsigned)p->pPars->nLutSize )
274 continue;
275 p->nCutsMerged++;
276 p->nCutsTotal++;
277 // check if this cut is contained in any of the available cuts
278 if ( !p->pPars->fSkipCutFilter && If_CutFilter( pCutSet, pCut, fSave0 ) )
279 continue;
280 // check if the cut is a special AND-gate cut
281 pCut->fAndCut = fUseAndCut && pCut->nLeaves == 2 && pCut->pLeaves[0] == pObj->pFanin0->Id && pCut->pLeaves[1] == pObj->pFanin1->Id;
282 //assert( pCut->nLeaves != 2 || pCut->pLeaves[0] < pCut->pLeaves[1] );
283 //assert( pCut->nLeaves != 2 || pObj->pFanin0->Id < pObj->pFanin1->Id );
284 // compute the truth table
285 pCut->iCutFunc = -1;
286 pCut->fCompl = 0;
287 if ( p->pPars->fTruth )
288 {
289// int nShared = pCut0->nLeaves + pCut1->nLeaves - pCut->nLeaves;
290 abctime clk = 0;
291 if ( p->pPars->fVerbose )
292 clk = Abc_Clock();
293 if ( p->pPars->fUseTtPerm )
294 fChange = If_CutComputeTruthPerm( p, pCut, pCut0R, pCut1R, fFunc0R, fFunc1R );
295 else
296 fChange = If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
297 if ( p->pPars->fVerbose )
298 p->timeCache[4] += Abc_Clock() - clk;
299 if ( !p->pPars->fSkipCutFilter && fChange && If_CutFilter( pCutSet, pCut, fSave0 ) )
300 continue;
301 if ( p->pPars->fLut6Filter && pCut->nLeaves == 6 && !If_CutCheckTruth6(p, pCut) )
302 continue;
303 if ( p->pPars->fUseDsd )
304 {
305 extern void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd );
306 int truthId = Abc_Lit2Var(pCut->iCutFunc);
307 if ( truthId >= Vec_IntSize(p->vTtDsds[pCut->nLeaves]) || Vec_IntEntry(p->vTtDsds[pCut->nLeaves], truthId) == -1 )
308 {
309 while ( truthId >= Vec_IntSize(p->vTtDsds[pCut->nLeaves]) )
310 {
311 Vec_IntPush( p->vTtDsds[pCut->nLeaves], -1 );
312 for ( v = 0; v < Abc_MaxInt(6, pCut->nLeaves); v++ )
313 Vec_StrPush( p->vTtPerms[pCut->nLeaves], IF_BIG_CHAR );
314 }
315 iCutDsd = If_DsdManCompute( p->pIfDsdMan, If_CutTruthWR(p, pCut), pCut->nLeaves, (unsigned char *)If_CutDsdPerm(p, pCut), p->pPars->pLutStruct );
316 Vec_IntWriteEntry( p->vTtDsds[pCut->nLeaves], truthId, iCutDsd );
317 }
318 assert( If_DsdManSuppSize(p->pIfDsdMan, If_CutDsdLit(p, pCut)) == (int)pCut->nLeaves );
319 //If_ManCacheRecord( p, If_CutDsdLit(p, pCut0), If_CutDsdLit(p, pCut1), nShared, If_CutDsdLit(p, pCut) );
320 }
321 // run user functions
322 pCut->fUseless = 0;
323 if ( p->pPars->pFuncCell || p->pPars->pFuncCell2 )
324 {
325 assert( p->pPars->fUseTtPerm == 0 );
326 assert( pCut->nLimit >= 4 && pCut->nLimit <= 16 );
327 if ( p->pPars->fUseDsd )
328 pCut->fUseless = If_DsdManCheckDec( p->pIfDsdMan, If_CutDsdLit(p, pCut) );
329 else if ( p->pPars->pFuncCell2 )
330 pCut->fUseless = !p->pPars->pFuncCell2( p, (word *)If_CutTruthW(p, pCut), pCut->nLeaves, NULL, NULL );
331 else
332 pCut->fUseless = !p->pPars->pFuncCell( p, If_CutTruth(p, pCut), Abc_MaxInt(6, pCut->nLeaves), pCut->nLeaves, p->pPars->pLutStruct );
333 p->nCutsUselessAll += pCut->fUseless;
334 p->nCutsUseless[pCut->nLeaves] += pCut->fUseless;
335 p->nCutsCountAll++;
336 p->nCutsCount[pCut->nLeaves]++;
337 // skip 5-input cuts, which cannot be decomposed
338 if ( (p->pPars->fEnableCheck75 || p->pPars->fEnableCheck75u) && pCut->nLeaves == 5 && pCut->nLimit == 5 )
339 {
340 extern int If_CluCheckDecInAny( word t, int nVars );
341 extern int If_CluCheckDecOut( word t, int nVars );
342 unsigned TruthU = *If_CutTruth(p, pCut);
343 word Truth = (((word)TruthU << 32) | (word)TruthU);
344 p->nCuts5++;
345 if ( If_CluCheckDecInAny( Truth, 5 ) )
346 p->nCuts5a++;
347 else
348 continue;
349 }
350 else if ( p->pPars->fVerbose && pCut->nLeaves == 5 )
351 {
352 extern int If_CluCheckDecInAny( word t, int nVars );
353 extern int If_CluCheckDecOut( word t, int nVars );
354 unsigned TruthU = *If_CutTruth(p, pCut);
355 word Truth = (((word)TruthU << 32) | (word)TruthU);
356 p->nCuts5++;
357 if ( If_CluCheckDecInAny( Truth, 5 ) || If_CluCheckDecOut( Truth, 5 ) )
358 p->nCuts5a++;
359 }
360 }
361 else if ( p->pPars->fUseDsdTune )
362 {
363 pCut->fUseless = If_DsdManReadMark( p->pIfDsdMan, If_CutDsdLit(p, pCut) );
364 p->nCutsUselessAll += pCut->fUseless;
365 p->nCutsUseless[pCut->nLeaves] += pCut->fUseless;
366 p->nCutsCountAll++;
367 p->nCutsCount[pCut->nLeaves]++;
368 }
369 else if ( p->pPars->fUse34Spec )
370 {
371 assert( pCut->nLeaves <= 4 );
372 if ( pCut->nLeaves == 4 && !Abc_Tt4Check( (int)(0xFFFF & *If_CutTruth(p, pCut)) ) )
373 pCut->fUseless = 1;
374 }
375 else
376 {
377 if ( p->pPars->fUseAndVars )
378 {
379 int iDecMask = -1, truthId = Abc_Lit2Var(pCut->iCutFunc);
380 assert( p->pPars->nLutSize <= 13 );
381 if ( truthId >= Vec_IntSize(p->vTtDecs[pCut->nLeaves]) || Vec_IntEntry(p->vTtDecs[pCut->nLeaves], truthId) == -1 )
382 {
383 while ( truthId >= Vec_IntSize(p->vTtDecs[pCut->nLeaves]) )
384 Vec_IntPush( p->vTtDecs[pCut->nLeaves], -1 );
385 if ( (int)pCut->nLeaves > p->pPars->nLutSize / 2 && (int)pCut->nLeaves <= 2 * (p->pPars->nLutSize / 2) )
386 iDecMask = Abc_TtProcessBiDec( If_CutTruthWR(p, pCut), (int)pCut->nLeaves, p->pPars->nLutSize / 2 );
387 else
388 iDecMask = 0;
389 Vec_IntWriteEntry( p->vTtDecs[pCut->nLeaves], truthId, iDecMask );
390 }
391 iDecMask = Vec_IntEntry(p->vTtDecs[pCut->nLeaves], truthId);
392 assert( iDecMask >= 0 );
393 pCut->fUseless = (int)(iDecMask == 0 && (int)pCut->nLeaves > p->pPars->nLutSize / 2);
394 p->nCutsUselessAll += pCut->fUseless;
395 p->nCutsUseless[pCut->nLeaves] += pCut->fUseless;
396 p->nCutsCountAll++;
397 p->nCutsCount[pCut->nLeaves]++;
398 }
399 if ( p->pPars->fUseCofVars && (!p->pPars->fUseAndVars || pCut->fUseless) )
400 {
401 int iCofVar = -1, truthId = Abc_Lit2Var(pCut->iCutFunc);
402 if ( truthId >= Vec_StrSize(p->vTtVars[pCut->nLeaves]) || Vec_StrEntry(p->vTtVars[pCut->nLeaves], truthId) == (char)-1 )
403 {
404 while ( truthId >= Vec_StrSize(p->vTtVars[pCut->nLeaves]) )
405 Vec_StrPush( p->vTtVars[pCut->nLeaves], (char)-1 );
406 iCofVar = Abc_TtCheckCondDep( If_CutTruthWR(p, pCut), pCut->nLeaves, p->pPars->nLutSize / 2 );
407 Vec_StrWriteEntry( p->vTtVars[pCut->nLeaves], truthId, (char)iCofVar );
408 }
409 iCofVar = Vec_StrEntry(p->vTtVars[pCut->nLeaves], truthId);
410 assert( iCofVar >= 0 && iCofVar <= (int)pCut->nLeaves );
411 pCut->fUseless = (int)(iCofVar == (int)pCut->nLeaves && pCut->nLeaves > 0);
412 p->nCutsUselessAll += pCut->fUseless;
413 p->nCutsUseless[pCut->nLeaves] += pCut->fUseless;
414 p->nCutsCountAll++;
415 p->nCutsCount[pCut->nLeaves]++;
416 }
417 }
418 }
419
420 // compute the application-specific cost and depth
421 pCut->fUser = (p->pPars->pFuncCost != NULL);
422 pCut->Cost = p->pPars->pFuncCost? p->pPars->pFuncCost(p, pCut) : 0;
423 if ( pCut->Cost == IF_COST_MAX )
424 continue;
425 // check if the cut satisfies the required times
426 if ( p->pPars->fDelayOpt )
427 pCut->Delay = If_CutSopBalanceEval( p, pCut, NULL );
428 else if ( p->pPars->fDsdBalance )
429 pCut->Delay = If_CutDsdBalanceEval( p, pCut, NULL );
430 else if ( p->pPars->fUserRecLib )
431 pCut->Delay = If_CutDelayRecCost3( p, pCut, pObj );
432 else if ( p->pPars->fUserLutDec )
433 {
434 pCut->Delay = If_LutDecEval( p, pCut, pObj, Mode == 0, fFirst );
435 pCut->fUseless = pCut->Delay == ABC_INFINITY;
436 }
437 else if ( p->pPars->fUserLut2D )
438 {
439 pCut->Delay = If_Lut2DecEval( p, pCut, pObj, Mode == 0, fFirst );
440 pCut->fUseless = pCut->Delay == ABC_INFINITY;
441 }
442 else if ( p->pPars->fUserSesLib )
443 {
444 int Cost = 0;
445 pCut->fUser = 1;
446 pCut->Delay = (float)Abc_ExactDelayCost( If_CutTruthW(p, pCut), If_CutLeaveNum(pCut), If_CutArrTimeProfile(p, pCut), If_CutPerm(pCut), &Cost, If_ManCutAigDelay(p, pObj, pCut) );
447 if ( Cost == ABC_INFINITY )
448 {
449 for ( v = 0; v < If_CutLeaveNum(pCut); v++ )
450 If_CutPerm(pCut)[v] = IF_BIG_CHAR;
451 pCut->Cost = IF_COST_MAX;
452 pCut->fUseless = 1;
453 }
454 }
455 else if ( p->pPars->fDelayOptLut )
456 pCut->Delay = If_CutLutBalanceEval( p, pCut );
457 else if( p->pPars->nGateSize > 0 )
458 pCut->Delay = If_CutDelaySop( p, pCut );
459 else
460 pCut->Delay = If_CutDelay( p, pObj, pCut );
461 if ( pCut->Delay == -1 )
462 continue;
463 if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon && pCutSet->nCuts > 0 )
464 continue;
465 // compute area of the cut (this area may depend on the application specific cost)
466 pCut->Area = (Mode == 2)? If_CutAreaDerefed( p, pCut ) : If_CutAreaFlow( p, pCut );
467 if ( p->pPars->fEdge )
468 pCut->Edge = (Mode == 2)? If_CutEdgeDerefed( p, pCut ) : If_CutEdgeFlow( p, pCut );
469 if ( p->pPars->fPower )
470 pCut->Power = (Mode == 2)? If_CutPowerDerefed( p, pCut, pObj ) : If_CutPowerFlow( p, pCut, pObj );
471// pCut->AveRefs = (Mode == 0)? (float)0.0 : If_CutAverageRefs( p, pCut );
472 // insert the cut into storage
473 If_CutSort( p, pCutSet, pCut );
474// If_CutTraverse( p, pObj, pCut );
475 }
476 assert( pCutSet->nCuts > 0 );
477// If_CutVerifyCuts( pCutSet, !p->pPars->fUseTtPerm );
478
479 // update the best cut
480 if ( !fPreprocess || pCutSet->ppCuts[0]->Delay <= pObj->Required + p->fEpsilon )
481 {
482 If_CutCopy( p, If_ObjCutBest(pObj), pCutSet->ppCuts[0] );
483 if ( p->pPars->fUserRecLib || p->pPars->fUserSesLib )
484 assert(If_ObjCutBest(pObj)->Cost < IF_COST_MAX && If_ObjCutBest(pObj)->Delay < ABC_INFINITY);
485 }
486 // add the trivial cut to the set
487 if ( !pObj->fSkipCut && If_ObjCutBest(pObj)->nLeaves > 1 )
488 {
489 If_ManSetupCutTriv( p, pCutSet->ppCuts[pCutSet->nCuts++], pObj->Id );
490 assert( pCutSet->nCuts <= pCutSet->nCutsMax+1 );
491 }
492// if ( If_ObjCutBest(pObj)->nLeaves == 0 )
493// p->nBestCutSmall[0]++;
494// else if ( If_ObjCutBest(pObj)->nLeaves == 1 )
495// p->nBestCutSmall[1]++;
496
497 // ref the selected cut
498 if ( Mode && pObj->nRefs > 0 )
499 If_CutAreaRef( p, If_ObjCutBest(pObj) );
500 if ( If_ObjCutBest(pObj)->fUseless )
501 Abc_Print( 1, "The best cut is useless.\n" );
502 // call the user specified function for each cut
503 if ( p->pPars->pFuncUser )
504 If_ObjForEachCut( pObj, pCut, i )
505 p->pPars->pFuncUser( p, pObj, pCut );
506 // free the cuts
507 If_ManDerefNodeCutSet( p, pObj );
508}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
ABC_NAMESPACE_IMPL_START void If_ManCacheRecord(If_Man_t *p, int iDsd0, int iDsd1, int nShared, int iDsd)
DECLARATIONS ///.
Definition ifCache.c:45
int If_CluCheckDecInAny(word t, int nVars)
Definition ifDec16.c:1767
int Abc_ExactDelayCost(word *pTruth, int nVars, int *pArrTimeProfile, char *pPerm, int *Cost, int AigLevel)
Definition abcExact.c:2716
int * If_CutArrTimeProfile(If_Man_t *p, If_Cut_t *pCut)
Definition ifMap.c:143
int If_ManCutAigDelay(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
Definition ifMap.c:66
int If_CutDelayRecCost3(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj)
Definition abcRec3.c:1004
int If_CutMerge(If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
Definition ifCut.c:364
float If_CutAreaDeref(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1056
int If_CutComputeTruthPerm(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
Definition ifTruth.c:269
void If_ManSetupCutTriv(If_Man_t *p, If_Cut_t *pCut, int ObjId)
Definition ifMan.c:517
float If_CutPowerFlow(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
Definition ifCut.c:1003
float If_CutEdgeDerefed(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1211
float If_CutDelay(If_Man_t *p, If_Obj_t *pObj, If_Cut_t *pCut)
Definition ifTime.c:91
float If_CutEdgeFlow(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:965
int If_CutFilter(If_Set_t *pCutSet, If_Cut_t *pCut, int fSaveCut0)
Definition ifCut.c:146
float If_CutAreaRef(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1083
If_Set_t * If_ManSetupNodeCutSet(If_Man_t *p, If_Obj_t *pObj)
Definition ifMan.c:597
int If_DsdManSuppSize(If_DsdMan_t *p, int iDsd)
Definition ifDsd.c:197
float If_CutAreaFlow(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:927
int If_CutLutBalanceEval(If_Man_t *p, If_Cut_t *pCut)
Definition ifDelay.c:369
int If_DsdManCompute(If_DsdMan_t *p, word *pTruth, int nLeaves, unsigned char *pPerm, char *pLutStruct)
Definition ifDsd.c:2063
int If_CutDsdBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
Definition ifDsd.c:2322
int If_CutDelaySop(If_Man_t *p, If_Cut_t *pCut)
Definition ifDelay.c:64
int If_LutDecReEval(If_Man_t *p, If_Cut_t *pCut)
Definition ifDelay.c:597
int If_DsdManReadMark(If_DsdMan_t *p, int iDsd)
Definition ifDsd.c:205
int If_Lut2DecEval(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
Definition ifDelay.c:508
void If_CutSort(If_Man_t *p, If_Set_t *pCutSet, If_Cut_t *pCut)
Definition ifCut.c:746
int If_CutCheckTruth6(If_Man_t *p, If_Cut_t *pCut)
Definition ifTruth.c:396
#define If_ObjForEachCut(pObj, pCut, i)
Definition if.h:500
void If_ManDerefNodeCutSet(If_Man_t *p, If_Obj_t *pObj)
Definition ifMan.c:620
float If_CutAreaDerefed(If_Man_t *p, If_Cut_t *pCut)
Definition ifCut.c:1110
int If_CutSopBalanceEval(If_Man_t *p, If_Cut_t *pCut, Vec_Int_t *vAig)
Definition ifDelay.c:248
int If_CutMergeOrdered(If_Man_t *p, If_Cut_t *pCut0, If_Cut_t *pCut1, If_Cut_t *pCut)
Definition ifCut.c:290
float If_CutPowerDerefed(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pRoot)
Definition ifCut.c:1314
int If_CutComputeTruth(If_Man_t *p, If_Cut_t *pCut, If_Cut_t *pCut0, If_Cut_t *pCut1, int fCompl0, int fCompl1)
Definition ifTruth.c:99
int If_LutDecEval(If_Man_t *p, If_Cut_t *pCut, If_Obj_t *pObj, int optDelay, int fFirst)
Definition ifDelay.c:415
int If_DsdManCheckDec(If_DsdMan_t *p, int iDsd)
Definition ifDsd.c:201
float Power
Definition if.h:305
float Area
Definition if.h:303
float Edge
Definition if.h:304
unsigned fSkipCut
Definition if.h:342
unsigned fSpec
Definition if.h:340
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ObjPerformMappingChoice()

void If_ObjPerformMappingChoice ( If_Man_t * p,
If_Obj_t * pObj,
int Mode,
int fPreprocess )
extern

Function*************************************************************

Synopsis [Finds the best cut for the choice node.]

Description []

SideEffects []

SeeAlso []

Definition at line 521 of file ifMap.c.

522{
523 If_Set_t * pCutSet;
524 If_Obj_t * pTemp;
525 If_Cut_t * pCutTemp, * pCut;
526 int i, fSave0 = p->pPars->fDelayOpt || p->pPars->fDelayOptLut || p->pPars->fDsdBalance || p->pPars->fUserRecLib || p->pPars->fUserSesLib || p->pPars->fUse34Spec || p->pPars->fUserLutDec || p->pPars->fUserLut2D;
527 assert( pObj->pEquiv != NULL );
528
529 // prepare
530 if ( Mode && pObj->nRefs > 0 )
531 If_CutAreaDeref( p, If_ObjCutBest(pObj) );
532
533 // remove elementary cuts
534 for ( pTemp = pObj; pTemp; pTemp = pTemp->pEquiv )
535 if ( pTemp != pObj || pTemp->pCutSet->nCuts > 1 )
536 pTemp->pCutSet->nCuts--;
537
538 // update the cutset of the node
539 pCutSet = pObj->pCutSet;
540
541 // generate cuts
542 for ( pTemp = pObj->pEquiv; pTemp; pTemp = pTemp->pEquiv )
543 {
544 if ( pTemp->pCutSet->nCuts == 0 )
545 continue;
546 // go through the cuts of this node
547 If_ObjForEachCut( pTemp, pCutTemp, i )
548 {
549 if ( pCutTemp->fUseless )
550 continue;
551 // get the next free cut
552 assert( pCutSet->nCuts <= pCutSet->nCutsMax );
553 pCut = pCutSet->ppCuts[pCutSet->nCuts];
554 // copy the cut into storage
555 If_CutCopy( p, pCut, pCutTemp );
556 // check if this cut is contained in any of the available cuts
557 if ( If_CutFilter( pCutSet, pCut, fSave0 ) )
558 continue;
559 // check if the cut satisfies the required times
560// assert( pCut->Delay == If_CutDelay( p, pTemp, pCut ) );
561 if ( Mode && pCut->Delay > pObj->Required + p->fEpsilon && pCutSet->nCuts > 0 )
562 continue;
563 // set the phase attribute
564 pCut->fCompl = pObj->fPhase ^ pTemp->fPhase;
565 // compute area of the cut (this area may depend on the application specific cost)
566 pCut->Area = (Mode == 2)? If_CutAreaDerefed( p, pCut ) : If_CutAreaFlow( p, pCut );
567 if ( p->pPars->fEdge )
568 pCut->Edge = (Mode == 2)? If_CutEdgeDerefed( p, pCut ) : If_CutEdgeFlow( p, pCut );
569 if ( p->pPars->fPower )
570 pCut->Power = (Mode == 2)? If_CutPowerDerefed( p, pCut, pObj ) : If_CutPowerFlow( p, pCut, pObj );
571// pCut->AveRefs = (Mode == 0)? (float)0.0 : If_CutAverageRefs( p, pCut );
572 // insert the cut into storage
573 If_CutSort( p, pCutSet, pCut );
574 }
575 }
576 assert( pCutSet->nCuts > 0 );
577
578 // update the best cut
579 if ( !fPreprocess || pCutSet->ppCuts[0]->Delay <= pObj->Required + p->fEpsilon )
580 If_CutCopy( p, If_ObjCutBest(pObj), pCutSet->ppCuts[0] );
581 // add the trivial cut to the set
582 if ( !pObj->fSkipCut && If_ObjCutBest(pObj)->nLeaves > 1 )
583 {
584 If_ManSetupCutTriv( p, pCutSet->ppCuts[pCutSet->nCuts++], pObj->Id );
585 assert( pCutSet->nCuts <= pCutSet->nCutsMax+1 );
586 }
587
588 // ref the selected cut
589 if ( Mode && pObj->nRefs > 0 )
590 If_CutAreaRef( p, If_ObjCutBest(pObj) );
591 // free the cuts
592 If_ManDerefChoiceCutSet( p, pObj );
593}
void If_ManDerefChoiceCutSet(If_Man_t *p, If_Obj_t *pObj)
Definition ifMan.c:663
Here is the call graph for this function:
Here is the caller graph for this function:

◆ If_ObjPrint()

void If_ObjPrint ( If_Obj_t * pObj)
extern

Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 604 of file ifUtil.c.

605{
606 if ( pObj == NULL )
607 {
608 printf( "Object is NULL." );
609 return;
610 }
611 printf( "Obj %4d : ", If_ObjId(pObj) );
612 if ( If_ObjIsConst1(pObj) )
613 printf( "constant 1" );
614 else if ( If_ObjIsCi(pObj) )
615 printf( "PI" );
616 else if ( If_ObjIsCo(pObj) )
617 printf( "PO( %4d%s )", If_ObjId(If_ObjFanin0(pObj)), (If_ObjFaninC0(pObj)? "\'" : " ") );
618 else
619 printf( "AND( %4d%s, %4d%s )",
620 If_ObjId(If_ObjFanin0(pObj)), (If_ObjFaninC0(pObj)? "\'" : " "),
621 If_ObjId(If_ObjFanin1(pObj)), (If_ObjFaninC1(pObj)? "\'" : " ") );
622 printf( " (refs = %3d)", pObj->nVisitsCopy );
623 printf( "\n" );
624}

◆ Ifn_NtkInputNum()

int Ifn_NtkInputNum ( Ifn_Ntk_t * p)
extern

Definition at line 167 of file ifTune.c.

168{
169 return p->nInps;
170}
Here is the caller graph for this function:

◆ Ifn_NtkLutSizeMax()

int Ifn_NtkLutSizeMax ( Ifn_Ntk_t * p)
extern

Definition at line 159 of file ifTune.c.

160{
161 int i, LutSize = 0;
162 for ( i = p->nInps; i < p->nObjs; i++ )
163 if ( p->Nodes[i].Type == IFN_DSD_PRIME )
164 LutSize = Abc_MaxInt( LutSize, (int)p->Nodes[i].nFanins );
165 return LutSize;
166}
Here is the caller graph for this function:

◆ Ifn_NtkMatch()

int Ifn_NtkMatch ( Ifn_Ntk_t * p,
word * pTruth,
int nVars,
int nConfls,
int fVerbose,
int fVeryVerbose,
word * pConfig )
extern

Definition at line 1328 of file ifTune.c.

1329{
1330 word * pTruth1;
1331 int RetValue = 0;
1332 int nIterMax = (1<<nVars);
1333 int i, v, status, iMint = 0;
1334 abctime clk = Abc_Clock();
1335// abctime clkTru = 0, clkSat = 0, clk2;
1336 sat_solver * pSat;
1337 if ( nVars == 0 )
1338 return 1;
1339 pSat = sat_solver_new();
1340 Ifn_Prepare( p, pTruth, nVars );
1341 sat_solver_setnvars( pSat, p->nPars );
1342 Ifn_NtkAddConstraints( p, pSat );
1343 if ( fVeryVerbose )
1344 Ifn_NtkMatchPrintStatus( pSat, 0, l_True, -1, -1, Abc_Clock() - clk );
1345 if ( pConfig ) assert( *pConfig == 0 );
1346 for ( i = 0; i < nIterMax; i++ )
1347 {
1348 // get variable assignment
1349 for ( v = 0; v < p->nObjs; v++ )
1350 p->Values[v] = v < p->nVars ? (iMint >> v) & 1 : -1;
1351 p->Values[p->nObjs-1] = Abc_TtGetBit( pTruth, iMint );
1352 // derive clauses
1353 if ( !Ifn_NtkAddClauses( p, p->Values, pSat ) )
1354 break;
1355 // find assignment of parameters
1356// clk2 = Abc_Clock();
1357 status = sat_solver_solve( pSat, NULL, NULL, nConfls, 0, 0, 0 );
1358// clkSat += Abc_Clock() - clk2;
1359 if ( fVeryVerbose )
1360 Ifn_NtkMatchPrintStatus( pSat, i+1, status, iMint, p->Values[p->nObjs-1], Abc_Clock() - clk );
1361 if ( status != l_True )
1362 break;
1363 // collect assignment
1364 for ( v = p->nObjs; v < p->nPars; v++ )
1365 p->Values[v] = sat_solver_var_value(pSat, v);
1366 // find truth table
1367// clk2 = Abc_Clock();
1368 pTruth1 = Ifn_NtkDeriveTruth( p, p->Values );
1369// clkTru += Abc_Clock() - clk2;
1370 Abc_TtXor( pTruth1, pTruth1, p->pTruth, p->nWords, 0 );
1371 // find mismatch if present
1372 iMint = Abc_TtFindFirstBit( pTruth1, p->nVars );
1373 if ( iMint == -1 )
1374 {
1375 if ( pConfig )
1376 Ifn_NtkMatchCollectConfig( p, pSat, pConfig );
1377/*
1378 if ( pPerm )
1379 {
1380 int RetValue = Ifn_ManSatFindCofigBitsTest( p, pTruth, nVars, *pPerm );
1381 Ifn_NtkMatchPrintPerm( *pPerm, p->nInps );
1382 if ( RetValue == 0 )
1383 printf( "Verification failed.\n" );
1384 }
1385*/
1386 RetValue = 1;
1387 break;
1388 }
1389 }
1390 assert( i < nIterMax );
1391 if ( fVerbose )
1392 {
1393 printf( "%s Iter =%4d. Confl = %6d. ", RetValue ? "yes":"no ", i, sat_solver_nconflicts(pSat) );
1394 if ( RetValue )
1395 Ifn_NtkMatchPrintConfig( p, pSat );
1396 printf( "\n" );
1397 }
1398 sat_solver_delete( pSat );
1399// Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1400// Abc_PrintTime( 1, "Sat", clkSat );
1401// Abc_PrintTime( 1, "Tru", clkTru );
1402 return RetValue;
1403}
void Ifn_NtkAddConstraints(Ifn_Ntk_t *p, sat_solver *pSat)
Definition ifTune.c:1053
void Ifn_NtkMatchPrintConfig(Ifn_Ntk_t *p, sat_solver *pSat)
Definition ifTune.c:1276
int Ifn_NtkAddClauses(Ifn_Ntk_t *p, int *pValues, sat_solver *pSat)
Definition ifTune.c:1110
word * Ifn_NtkDeriveTruth(Ifn_Ntk_t *p, int *pValues)
Definition ifTune.c:906
void Ifn_NtkMatchCollectConfig(Ifn_Ntk_t *p, sat_solver *pSat, word *pConfig)
Definition ifTune.c:1305
void Ifn_NtkMatchPrintStatus(sat_solver *p, int Iter, int status, int iMint, int Value, abctime clk)
Definition ifTune.c:1260
int sat_solver_nconflicts(sat_solver *s)
Definition satSolver.c:2381
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ifn_NtkParse()

Ifn_Ntk_t * Ifn_NtkParse ( char * pStr)
extern

Definition at line 440 of file ifTune.c.

441{
443 if ( Ifn_ManStrType2(pStr) )
444 {
445 if ( !Ifn_NtkParseInt2( pStr, p ) )
446 {
447 ABC_FREE( p );
448 return NULL;
449 }
450 }
451 else
452 {
453 if ( !Ifn_NtkParseInt( pStr, p ) )
454 {
455 ABC_FREE( p );
456 return NULL;
457 }
458 }
459 Ifn_NtkParseConstraints( pStr, p );
460 Abc_TtElemInit2( p->pTtElems, p->nInps );
461// printf( "Finished parsing: " ); Ifn_NtkPrint(p);
462 return p;
463}
int Ifn_NtkParseInt2(char *pStr, Ifn_Ntk_t *p)
Definition ifTune.c:378
int Ifn_ManStrType2(char *pStr)
Definition ifTune.c:316
int Ifn_NtkParseInt(char *pStr, Ifn_Ntk_t *p)
Definition ifTune.c:285
void Ifn_NtkParseConstraints(char *pStr, Ifn_Ntk_t *p)
Definition ifTune.c:423
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ifn_NtkPrint()

void Ifn_NtkPrint ( Ifn_Ntk_t * p)
extern

Definition at line 141 of file ifTune.c.

142{
143 int i, k;
144 if ( p == NULL )
145 printf( "String is empty.\n" );
146 if ( p == NULL )
147 return;
148 for ( i = p->nInps; i < p->nObjs; i++ )
149 {
150 printf( "%c=", 'a'+i );
151 printf( "%c", Ifn_Symbs[p->Nodes[i].Type][0] );
152 for ( k = 0; k < (int)p->Nodes[i].nFanins; k++ )
153 printf( "%c", 'a'+p->Nodes[i].Fanins[k] );
154 printf( "%c", Ifn_Symbs[p->Nodes[i].Type][1] );
155 printf( ";" );
156 }
157 printf( "\n" );
158}
Here is the caller graph for this function:

◆ Ifn_NtkTtBits()

int Ifn_NtkTtBits ( char * pStr)
extern

Definition at line 464 of file ifTune.c.

465{
466 int i, Counter = 0;
467 Ifn_Ntk_t * pNtk = Ifn_NtkParse( pStr );
468 for ( i = pNtk->nInps; i < pNtk->nObjs; i++ )
469 if ( pNtk->Nodes[i].Type == IFN_DSD_PRIME )
470 Counter += (1 << pNtk->Nodes[i].nFanins);
471 ABC_FREE( pNtk );
472 return Counter;
473}
Ifn_Obj_t Nodes[2 *IFN_INS]
Definition ifTune.c:74
unsigned Type
Definition ifTune.c:63
unsigned nFanins
Definition ifTune.c:64
Here is the call graph for this function:
Here is the caller graph for this function: