ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaLf.c File Reference
#include "gia.h"
#include "misc/tim/tim.h"
#include "misc/vec/vecSet.h"
#include "misc/vec/vecMem.h"
#include "misc/util/utilTruth.h"
Include dependency graph for giaLf.c:

Go to the source code of this file.

Classes

struct  Lf_Cut_t_
 
struct  Lf_Plc_t_
 
struct  Lf_Bst_t_
 
struct  Lf_Mem_t_
 
struct  Lf_Man_t_
 

Macros

#define LF_LEAF_MAX   13
 DECLARATIONS ///.
 
#define LF_CUT_MAX   32
 
#define LF_LOG_PAGE   12
 
#define LF_NO_LEAF   255
 
#define LF_CUT_WORDS   (4+LF_LEAF_MAX/2)
 
#define LF_TT_WORDS   ((LF_LEAF_MAX > 6) ? 1 << (LF_LEAF_MAX-6) : 1)
 
#define LF_EPSILON   0.005
 
#define Lf_CutSetForEachCut(nWords, pCutSet, pCut, i, nCuts)
 
#define Lf_CutForEachVar(pCut, Var, i)
 

Typedefs

typedef struct Lf_Cut_t_ Lf_Cut_t
 
typedef struct Lf_Plc_t_ Lf_Plc_t
 
typedef struct Lf_Bst_t_ Lf_Bst_t
 
typedef struct Lf_Mem_t_ Lf_Mem_t
 
typedef struct Lf_Man_t_ Lf_Man_t
 

Functions

int Kit_TruthToGia (Gia_Man_t *pMan, unsigned *pTruth, int nVars, Vec_Int_t *vMemory, Vec_Int_t *vLeaves, int fHash)
 DECLARATIONS ///.
 
int Lf_ObjArrival_rec (Lf_Man_t *p, Gia_Obj_t *pDriver)
 
int Lf_ObjCoArrival2_rec (Lf_Man_t *p, Gia_Obj_t *pDriver)
 
int Lf_ManComputeCrossCut (Gia_Man_t *p)
 
int Lf_ManTtIsMux (word t)
 
void Lf_ManAnalyzeCoDrivers (Gia_Man_t *p, int *pnDrivers, int *pnInverts)
 
void Lf_ManComputeSwitching (Gia_Man_t *p, Vec_Flt_t *vSwitches)
 
float Lf_CutRef_rec (Lf_Man_t *p, Lf_Cut_t *pCut)
 
float Lf_CutDeref_rec (Lf_Man_t *p, Lf_Cut_t *pCut)
 
void Lf_ObjMergeOrder (Lf_Man_t *p, int iObj)
 
void Lf_ManSetFlowRefs (Gia_Man_t *p, Vec_Flt_t *vRefs, Vec_Int_t *vOffsets)
 
void Lf_ManSetCutRefs (Lf_Man_t *p)
 
void Lf_ManSetMapRefsOne (Lf_Man_t *p, int iObj)
 
int Lf_ManSetMapRefs (Lf_Man_t *p)
 
void Lf_ManCountMapRefsOne (Lf_Man_t *p, int iObj)
 
void Lf_ManCountMapRefs (Lf_Man_t *p)
 
Gia_Man_tLf_ManDeriveMapping (Lf_Man_t *p)
 
Gia_Man_tLf_ManDeriveMappingCoarse (Lf_Man_t *p)
 
Gia_Man_tLf_ManDeriveMappingGia (Lf_Man_t *p)
 
Lf_Man_tLf_ManAlloc (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
void Lf_ManFree (Lf_Man_t *p)
 
void Lf_ManSetDefaultPars (Jf_Par_t *pPars)
 
void Lf_ManPrintStats (Lf_Man_t *p, char *pTitle)
 
void Lf_ManPrintInit (Lf_Man_t *p)
 
void Lf_ManPrintQuit (Lf_Man_t *p, Gia_Man_t *pNew)
 
void Lf_ManComputeMapping (Lf_Man_t *p)
 
Gia_Man_tLf_ManPerformMappingInt (Gia_Man_t *pGia, Jf_Par_t *pPars)
 
Gia_Man_tLf_ManPerformMapping (Gia_Man_t *p, Jf_Par_t *pPars)
 
Gia_Man_tGia_ManPerformLfMapping (Gia_Man_t *p, Jf_Par_t *pPars, int fNormalized)
 

Macro Definition Documentation

◆ LF_CUT_MAX

#define LF_CUT_MAX   32

Definition at line 34 of file giaLf.c.

◆ LF_CUT_WORDS

#define LF_CUT_WORDS   (4+LF_LEAF_MAX/2)

Definition at line 37 of file giaLf.c.

◆ Lf_CutForEachVar

#define Lf_CutForEachVar ( pCut,
Var,
i )
Value:
for ( i = 0; i < (int)pCut->nLeaves && (Var = pCut->pLeaves[i]); i++ ) if ( Lf_ObjOff(p, Var) < 0 ) {} else
Cube * p
Definition exorList.c:222
int Var
Definition exorList.c:228

Definition at line 135 of file giaLf.c.

◆ Lf_CutSetForEachCut

#define Lf_CutSetForEachCut ( nWords,
pCutSet,
pCut,
i,
nCuts )
Value:
for ( i = 0, pCut = pCutSet; i < nCuts; pCut = Lf_CutNext(pCut, nWords), i++ )
int nWords
Definition abcNpn.c:127

Definition at line 134 of file giaLf.c.

◆ LF_EPSILON

#define LF_EPSILON   0.005

Definition at line 39 of file giaLf.c.

◆ LF_LEAF_MAX

#define LF_LEAF_MAX   13

DECLARATIONS ///.

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

FileName [giaLf.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Cut computation.]

Author [Alan Mishchenko]`

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
giaLf.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 33 of file giaLf.c.

◆ LF_LOG_PAGE

#define LF_LOG_PAGE   12

Definition at line 35 of file giaLf.c.

◆ LF_NO_LEAF

#define LF_NO_LEAF   255

Definition at line 36 of file giaLf.c.

◆ LF_TT_WORDS

#define LF_TT_WORDS   ((LF_LEAF_MAX > 6) ? 1 << (LF_LEAF_MAX-6) : 1)

Definition at line 38 of file giaLf.c.

Typedef Documentation

◆ Lf_Bst_t

typedef struct Lf_Bst_t_ Lf_Bst_t

Definition at line 60 of file giaLf.c.

◆ Lf_Cut_t

typedef struct Lf_Cut_t_ Lf_Cut_t

Definition at line 41 of file giaLf.c.

◆ Lf_Man_t

typedef struct Lf_Man_t_ Lf_Man_t

Definition at line 77 of file giaLf.c.

◆ Lf_Mem_t

typedef struct Lf_Mem_t_ Lf_Mem_t

Definition at line 67 of file giaLf.c.

◆ Lf_Plc_t

typedef struct Lf_Plc_t_ Lf_Plc_t

Definition at line 54 of file giaLf.c.

Function Documentation

◆ Gia_ManPerformLfMapping()

Gia_Man_t * Gia_ManPerformLfMapping ( Gia_Man_t * p,
Jf_Par_t * pPars,
int fNormalized )

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

Synopsis [Interface of LUT mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 2292 of file giaLf.c.

2293{
2294 Gia_Man_t * pNew;
2295 assert( !pPars->fCutGroup || pPars->nLutSize == 9 || pPars->nLutSize == 11 || pPars->nLutSize == 13 );
2296 // reconstruct GIA according to the hierarchy manager
2297 assert( pPars->pTimesArr == NULL );
2298 assert( pPars->pTimesReq == NULL );
2299 if ( p->pManTime )
2300 {
2301 if ( fNormalized )
2302 {
2303 pNew = Gia_ManDupUnnormalize( p );
2304 if ( pNew == NULL )
2305 return NULL;
2306 Gia_ManTransferTiming( pNew, p );
2307 p = pNew;
2308 // set arrival and required times
2309 pPars->pTimesArr = Tim_ManGetArrTimes( (Tim_Man_t *)p->pManTime );
2310 pPars->pTimesReq = Tim_ManGetReqTimes( (Tim_Man_t *)p->pManTime );
2311 }
2312 else
2313 p = Gia_ManDup( p );
2314 }
2315 else
2316 p = Gia_ManDup( p );
2317 // perform mapping
2318 pNew = Lf_ManPerformMappingInt( p, pPars );
2319 if ( pNew != p )
2320 {
2321 // transfer name
2322 ABC_FREE( pNew->pName );
2323 ABC_FREE( pNew->pSpec );
2324 pNew->pName = Abc_UtilStrsav( p->pName );
2325 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
2326 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
2327 // return the original (unmodified by the mapper) timing manager
2328 Gia_ManTransferTiming( pNew, p );
2329 Gia_ManStop( p );
2330 }
2331 // normalize and transfer mapping
2332 pNew = Gia_ManDupNormalize( p = pNew, 0 );
2333 Gia_ManTransferMapping( pNew, p );
2334// Gia_ManTransferPacking( pNew, p );
2335 Gia_ManTransferTiming( pNew, p );
2336 Gia_ManStop( p );
2337 return pNew;
2338}
#define ABC_FREE(obj)
Definition abc_global.h:267
Gia_Man_t * Lf_ManPerformMappingInt(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaLf.c:2182
void Gia_ManStop(Gia_Man_t *p)
Definition giaMan.c:82
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition giaDup.c:720
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2370
Gia_Man_t * Gia_ManDupNormalize(Gia_Man_t *p, int fHashMapping)
Definition giaTim.c:139
Gia_Man_t * Gia_ManDupUnnormalize(Gia_Man_t *p)
Definition giaTim.c:382
void Gia_ManTransferMapping(Gia_Man_t *p, Gia_Man_t *pGia)
Definition giaIf.c:2305
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
float * pTimesArr
Definition gia.h:389
float * pTimesReq
Definition gia.h:390
int nLutSize
Definition gia.h:336
int fCutGroup
Definition gia.h:369
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition tim.h:92
float * Tim_ManGetArrTimes(Tim_Man_t *p)
Definition timMan.c:482
float * Tim_ManGetReqTimes(Tim_Man_t *p)
Definition timMan.c:497
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:

◆ Kit_TruthToGia()

int Kit_TruthToGia ( Gia_Man_t * pMan,
unsigned * pTruth,
int nVars,
Vec_Int_t * vMemory,
Vec_Int_t * vLeaves,
int fHash )
extern

DECLARATIONS ///.

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

FileName [giaMap.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Manipulation of mapping associated with the AIG.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
giaMap.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]

Definition at line 80 of file kitHop.c.

81{
82 int iLit;
83 Kit_Graph_t * pGraph;
84 // transform truth table into the decomposition tree
85 if ( vMemory == NULL )
86 {
87 vMemory = Vec_IntAlloc( 0 );
88 pGraph = Kit_TruthToGraph( pTruth, nVars, vMemory );
89 Vec_IntFree( vMemory );
90 }
91 else
92 pGraph = Kit_TruthToGraph( pTruth, nVars, vMemory );
93 if ( pGraph == NULL )
94 {
95 printf( "Kit_TruthToGia(): Converting truth table to AIG has failed for function:\n" );
96 Kit_DsdPrintFromTruth( pTruth, nVars ); printf( "\n" );
97 }
98 // derive the AIG for the decomposition tree
99 iLit = Kit_GraphToGia( pMan, pGraph, vLeaves, fHash );
100 Kit_GraphFree( pGraph );
101 return iLit;
102}
int Kit_GraphToGia(Gia_Man_t *pMan, Kit_Graph_t *pGraph, Vec_Int_t *vLeaves, int fHash)
Definition kitHop.c:70
struct Kit_Graph_t_ Kit_Graph_t
Definition kit.h:88
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition kitDsd.c:491
void Kit_GraphFree(Kit_Graph_t *pGraph)
Definition kitGraph.c:132
Kit_Graph_t * Kit_TruthToGraph(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Definition kitGraph.c:356

◆ Lf_CutDeref_rec()

float Lf_CutDeref_rec ( Lf_Man_t * p,
Lf_Cut_t * pCut )

Definition at line 1085 of file giaLf.c.

1086{
1087 word CutTemp[LF_CUT_WORDS] = {0};
1088 float Count = Lf_CutArea(p, pCut);
1089 int i, Var;
1090 Lf_CutForEachVar( pCut, Var, i )
1091 if ( !Lf_ObjMapRefDec(p, Var) )
1092 Count += Lf_CutDeref_rec( p, Lf_ObjCutBestNew(p, Var, (Lf_Cut_t *)CutTemp) );
1093 return Count;
1094}
struct Lf_Cut_t_ Lf_Cut_t
Definition giaLf.c:41
#define LF_CUT_WORDS
Definition giaLf.c:37
float Lf_CutDeref_rec(Lf_Man_t *p, Lf_Cut_t *pCut)
Definition giaLf.c:1085
#define Lf_CutForEachVar(pCut, Var, i)
Definition giaLf.c:135
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_CutRef_rec()

float Lf_CutRef_rec ( Lf_Man_t * p,
Lf_Cut_t * pCut )

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

Synopsis [Exact local area.]

Description []

SideEffects []

SeeAlso []

Definition at line 1075 of file giaLf.c.

1076{
1077 word CutTemp[LF_CUT_WORDS] = {0};
1078 float Count = Lf_CutArea(p, pCut);
1079 int i, Var;
1080 Lf_CutForEachVar( pCut, Var, i )
1081 if ( !Lf_ObjMapRefInc(p, Var) )
1082 Count += Lf_CutRef_rec( p, Lf_ObjCutBestNew(p, Var, (Lf_Cut_t *)CutTemp) );
1083 return Count;
1084}
float Lf_CutRef_rec(Lf_Man_t *p, Lf_Cut_t *pCut)
Definition giaLf.c:1075
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManAlloc()

Lf_Man_t * Lf_ManAlloc ( Gia_Man_t * pGia,
Jf_Par_t * pPars )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1938 of file giaLf.c.

1939{
1940 Lf_Man_t * p; int i, k = 0;
1941 assert( pPars->nCutNum > 1 && pPars->nCutNum <= LF_CUT_MAX );
1942 assert( pPars->nLutSize > 1 && pPars->nLutSize <= LF_LEAF_MAX );
1943 ABC_FREE( pGia->pRefs );
1944 Vec_IntFreeP( &pGia->vMapping );
1945 Gia_ManCleanValue( pGia );
1946 if ( Gia_ManHasChoices(pGia) )
1947 Gia_ManSetPhase(pGia);
1948 p = ABC_CALLOC( Lf_Man_t, 1 );
1949 Lf_ManAnalyzeCoDrivers( pGia, &p->nCoDrivers, &p->nInverters );
1950 if ( pPars->fPower )
1951 Lf_ManComputeSwitching( pGia, &p->vSwitches );
1952 p->clkStart = Abc_Clock();
1953 p->pGia = pGia;
1954 p->pPars = pPars;
1955 p->nCutWords = (sizeof(Lf_Cut_t)/sizeof(int) + pPars->nLutSize + 1) >> 1;
1956 p->nSetWords = p->nCutWords * pPars->nCutNum;
1957 p->vTtMem = pPars->fCutMin ? Vec_MemAllocForTT( pPars->nLutSize, 0 ) : NULL;
1958 if ( pPars->fCutMin && pPars->fUseMux7 )
1959 Vec_MemAddMuxTT( p->vTtMem, pPars->nLutSize );
1960 p->pObjBests = ABC_CALLOC( Lf_Bst_t, Gia_ManAndNotBufNum(pGia) );
1961 Vec_IntGrow( &p->vFreeSets, (1<<14) );
1962 Vec_PtrGrow( &p->vFreePages, 256 );
1963 Lf_MemAlloc( &p->vStoreOld, 16, &p->vFreePages, p->nCutWords );
1964 Lf_MemAlloc( &p->vStoreNew, 16, &p->vFreePages, p->nCutWords );
1965 Vec_IntFill( &p->vOffsets, Gia_ManObjNum(pGia), -1 );
1966 Vec_IntFill( &p->vRequired, Gia_ManObjNum(pGia), ABC_INFINITY );
1967 Vec_IntFill( &p->vCutSets, Gia_ManAndNotBufNum(pGia), -1 );
1968 Vec_FltFill( &p->vFlowRefs, Gia_ManAndNotBufNum(pGia), 0 );
1969 Vec_IntFill( &p->vMapRefs, Gia_ManAndNotBufNum(pGia), 0 );
1970 Vec_IntFill( &p->vCiArrivals, Gia_ManCiNum(pGia), 0 );
1971 Gia_ManForEachAndId( pGia, i )
1972 if ( !Gia_ObjIsBuf(Gia_ManObj(pGia, i)) )
1973 Vec_IntWriteEntry( &p->vOffsets, i, k++ );
1974 assert( k == Gia_ManAndNotBufNum(pGia) );
1975 Lf_ManSetFlowRefs( pGia, &p->vFlowRefs, &p->vOffsets );
1976 if ( pPars->pTimesArr )
1977 for ( i = 0; i < Gia_ManPiNum(pGia); i++ )
1978 Vec_IntWriteEntry( &p->vCiArrivals, i, pPars->pTimesArr[i] );
1979 return p;
1980}
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
void Lf_ManComputeSwitching(Gia_Man_t *p, Vec_Flt_t *vSwitches)
Definition giaLf.c:333
void Lf_ManSetFlowRefs(Gia_Man_t *p, Vec_Flt_t *vRefs, Vec_Int_t *vOffsets)
Definition giaLf.c:1412
#define LF_CUT_MAX
Definition giaLf.c:34
void Lf_ManAnalyzeCoDrivers(Gia_Man_t *p, int *pnDrivers, int *pnInverts)
Definition giaLf.c:319
struct Lf_Bst_t_ Lf_Bst_t
Definition giaLf.c:60
#define LF_LEAF_MAX
DECLARATIONS ///.
Definition giaLf.c:33
struct Lf_Man_t_ Lf_Man_t
Definition giaLf.c:77
void Gia_ManCleanValue(Gia_Man_t *p)
Definition giaUtil.c:351
void Gia_ManSetPhase(Gia_Man_t *p)
Definition giaUtil.c:420
#define Gia_ManForEachAndId(p, i)
Definition gia.h:1216
Vec_Int_t * vMapping
Definition gia.h:136
int * pRefs
Definition gia.h:118
int nCutNum
Definition gia.h:337
int fCutMin
Definition gia.h:358
int fUseMux7
Definition gia.h:355
int fPower
Definition gia.h:356
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManAnalyzeCoDrivers()

void Lf_ManAnalyzeCoDrivers ( Gia_Man_t * p,
int * pnDrivers,
int * pnInverts )

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

Synopsis [Count the number of unique drivers and invertors.]

Description []

SideEffects []

SeeAlso []

Definition at line 319 of file giaLf.c.

320{
321 Gia_Obj_t * pObj;
322 int i, Entry, nDrivers, nInverts;
323 Vec_Int_t * vMarks = Vec_IntStart( Gia_ManObjNum(p) );
324 nDrivers = nInverts = 0;
325 Gia_ManForEachCo( p, pObj, i )
326 *Vec_IntEntryP( vMarks, Gia_ObjFaninId0p(p, pObj) ) |= Gia_ObjFaninC0(pObj) ? 2 : 1;
327 Vec_IntForEachEntry( vMarks, Entry, i )
328 nDrivers += (int)(Entry != 0), nInverts += (int)(Entry == 3);
329 Vec_IntFree( vMarks );
330 *pnDrivers = nDrivers;
331 *pnInverts = nInverts;
332}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
#define Gia_ManForEachCo(p, pObj, i)
Definition gia.h:1236
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the caller graph for this function:

◆ Lf_ManComputeCrossCut()

int Lf_ManComputeCrossCut ( Gia_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file giaLf.c.

227{
228 Gia_Obj_t * pObj;
229 int i, nCutMax = 0, nCutCur = 0;
230 assert( p->pMuxes == NULL );
231 Gia_ManForEachObj( p, pObj, i )
232 pObj->Value = 0;
233 Gia_ManForEachAnd( p, pObj, i )
234 {
235 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) )
236 Gia_ObjFanin0(pObj)->Value++;
237 if ( Gia_ObjIsAnd(Gia_ObjFanin1(pObj)) )
238 Gia_ObjFanin1(pObj)->Value++;
239 }
240 Gia_ManForEachAnd( p, pObj, i )
241 {
242 if ( pObj->Value )
243 nCutCur++;
244 if ( nCutMax < nCutCur )
245 nCutMax = nCutCur;
246 if ( Gia_ObjIsAnd(Gia_ObjFanin0(pObj)) && --Gia_ObjFanin0(pObj)->Value == 0 )
247 nCutCur--;
248 if ( Gia_ObjIsAnd(Gia_ObjFanin1(pObj)) && --Gia_ObjFanin1(pObj)->Value == 0 )
249 nCutCur--;
250 }
251 assert( nCutCur == 0 );
252 if ( nCutCur )
253 printf( "Cutset is not 0\n" );
254 Gia_ManForEachObj( p, pObj, i )
255 assert( pObj->Value == 0 );
256 printf( "CutMax = %d\n", nCutMax );
257 return nCutMax;
258}
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
#define Gia_ManForEachObj(p, pObj, i)
MACRO DEFINITIONS ///.
Definition gia.h:1190
unsigned Value
Definition gia.h:89

◆ Lf_ManComputeMapping()

void Lf_ManComputeMapping ( Lf_Man_t * p)

Definition at line 2138 of file giaLf.c.

2139{
2140 Gia_Obj_t * pObj;
2141 int i, arrTime;
2142 assert( p->vStoreNew.iCur == 0 );
2144 if ( p->pGia->pManTime != NULL )
2145 {
2146 assert( !Gia_ManBufNum(p->pGia) );
2147 Tim_ManIncrementTravId( (Tim_Man_t*)p->pGia->pManTime );
2148 Gia_ManForEachObj1( p->pGia, pObj, i )
2149 {
2150 if ( Gia_ObjIsBuf(pObj) )
2151 continue;
2152 if ( Gia_ObjIsAnd(pObj) )
2153 Lf_ObjMergeOrder( p, i );
2154 else if ( Gia_ObjIsCi(pObj) )
2155 {
2156 arrTime = Tim_ManGetCiArrival( (Tim_Man_t*)p->pGia->pManTime, Gia_ObjCioId(pObj) );
2157 Lf_ObjSetCiArrival( p, Gia_ObjCioId(pObj), arrTime );
2158 }
2159 else if ( Gia_ObjIsCo(pObj) )
2160 {
2161 arrTime = Lf_ObjCoArrival( p, Gia_ObjCioId(pObj) );
2162 Tim_ManSetCoArrival( (Tim_Man_t*)p->pGia->pManTime, Gia_ObjCioId(pObj), arrTime );
2163 }
2164 else assert( 0 );
2165 }
2166// Tim_ManPrint( p->pGia->pManTime );
2167 }
2168 else
2169 {
2170 Gia_ManForEachAnd( p->pGia, pObj, i )
2171 if ( !Gia_ObjIsBuf(pObj) )
2172 Lf_ObjMergeOrder( p, i );
2173 }
2174 Lf_MemRecycle( &p->vStoreOld );
2175 ABC_SWAP( Lf_Mem_t, p->vStoreOld, p->vStoreNew );
2176 if ( p->fUseEla )
2178 else
2180 Lf_ManPrintStats( p, (char *)(p->fUseEla ? "Ela " : (p->Iter ? "Area " : "Delay")) );
2181}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
void Lf_ManPrintStats(Lf_Man_t *p, char *pTitle)
Definition giaLf.c:2050
void Lf_ObjMergeOrder(Lf_Man_t *p, int iObj)
Definition giaLf.c:1186
void Lf_ManSetCutRefs(Lf_Man_t *p)
Definition giaLf.c:1448
struct Lf_Mem_t_ Lf_Mem_t
Definition giaLf.c:67
void Lf_ManCountMapRefs(Lf_Man_t *p)
Definition giaLf.c:1633
int Lf_ManSetMapRefs(Lf_Man_t *p)
Definition giaLf.c:1520
#define Gia_ManForEachObj1(p, pObj, i)
Definition gia.h:1192
void Tim_ManSetCoArrival(Tim_Man_t *p, int iCo, float Delay)
Definition timTime.c:116
void Tim_ManIncrementTravId(Tim_Man_t *p)
DECLARATIONS ///.
Definition timTrav.c:44
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:

◆ Lf_ManComputeSwitching()

void Lf_ManComputeSwitching ( Gia_Man_t * p,
Vec_Flt_t * vSwitches )

Definition at line 333 of file giaLf.c.

334{
335// abctime clk = Abc_Clock();
336 Vec_Flt_t * vSwitching = (Vec_Flt_t *)Gia_ManComputeSwitchProbs( p, 48, 16, 0 );
337 assert( Vec_FltCap(vSwitches) == 0 );
338 *vSwitches = *vSwitching;
339 ABC_FREE( vSwitching );
340// Abc_PrintTime( 1, "Computing switching activity", Abc_Clock() - clk );
341}
Vec_Int_t * Gia_ManComputeSwitchProbs(Gia_Man_t *pGia, int nFrames, int nPref, int fProbOne)
Definition giaSwitch.c:658
typedefABC_NAMESPACE_HEADER_START struct Vec_Flt_t_ Vec_Flt_t
INCLUDES ///.
Definition vecFlt.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManCountMapRefs()

void Lf_ManCountMapRefs ( Lf_Man_t * p)

Definition at line 1633 of file giaLf.c.

1634{
1635 // compute delay
1636 Gia_Obj_t * pObj;
1637 int i, Id, Delay = 0;
1638 for ( i = 0; i < Gia_ManCoNum(p->pGia); i++ )
1639 Delay = Abc_MaxInt( Delay, Lf_ObjCoArrival2(p, i) );
1640 // check delay target
1641 if ( p->pPars->DelayTarget == -1 && p->pPars->nRelaxRatio )
1642 p->pPars->DelayTarget = (int)((float)Delay * (100.0 + p->pPars->nRelaxRatio) / 100.0);
1643 if ( p->pPars->DelayTarget != -1 )
1644 {
1645 if ( Delay < p->pPars->DelayTarget + 0.01 )
1646 Delay = p->pPars->DelayTarget;
1647 else if ( p->pPars->nRelaxRatio == 0 )
1648 Abc_Print( 0, "Relaxing user-specified delay target from %d to %d.\n", p->pPars->DelayTarget, Delay );
1649 }
1650 p->pPars->Delay = Delay;
1651 // compute area/edges/required
1652 p->pPars->Mux7 = p->pPars->Area = p->pPars->Edge = p->Switches = 0;
1653 Vec_IntFill( &p->vRequired, Gia_ManObjNum(p->pGia), ABC_INFINITY );
1654 if ( p->pPars->fUseMux7 )
1655 Gia_ManCleanMark0(p->pGia);
1656 if ( p->pGia->pManTime != NULL )
1657 {
1658 Tim_ManIncrementTravId( (Tim_Man_t*)p->pGia->pManTime );
1659 if ( p->pPars->fDoAverage )
1660 for ( i = 0; i < Gia_ManCoNum(p->pGia); i++ )
1661 Tim_ManSetCoRequired( (Tim_Man_t*)p->pGia->pManTime, i, (int)(Lf_ObjCoArrival(p, i) * (100.0 + p->pPars->nRelaxRatio) / 100.0) );
1662 else
1663 Tim_ManInitPoRequiredAll( (Tim_Man_t*)p->pGia->pManTime, Delay );
1664 Gia_ManForEachObjReverse1( p->pGia, pObj, i )
1665 {
1666 if ( Gia_ObjIsBuf(pObj) )
1667 Lf_ObjSetRequired( p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(p, i) );
1668 else if ( Gia_ObjIsAnd(pObj) )
1669 {
1670 if ( Lf_ObjMapRefNum(p, i) )
1672 }
1673 else if ( Gia_ObjIsCi(pObj) )
1674 Tim_ManSetCiRequired( (Tim_Man_t*)p->pGia->pManTime, Gia_ObjCioId(pObj), Lf_ObjRequired(p, i) );
1675 else if ( Gia_ObjIsCo(pObj) )
1676 {
1677 int reqTime = Tim_ManGetCoRequired( (Tim_Man_t*)p->pGia->pManTime, Gia_ObjCioId(pObj) );
1678 Lf_ObjSetRequired( p, Gia_ObjFaninId0(pObj, i), reqTime );
1679 }
1680 else assert( 0 );
1681 }
1682 }
1683 else
1684 {
1685 Gia_ManForEachCoDriverId( p->pGia, Id, i )
1686 Lf_ObjSetRequired( p, Id, p->pPars->fDoAverage ? (int)(Lf_ObjCoArrival(p, i) * (100.0 + p->pPars->nRelaxRatio) / 100.0) : Delay );
1687 Gia_ManForEachAndReverse( p->pGia, pObj, i )
1688 if ( Gia_ObjIsBuf(pObj) )
1689 Lf_ObjSetRequired( p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(p, i) );
1690 else if ( Lf_ObjMapRefNum(p, i) )
1692 }
1693 if ( p->pPars->fUseMux7 )
1694 Gia_ManCleanMark0(p->pGia);
1695}
void Lf_ManCountMapRefsOne(Lf_Man_t *p, int iObj)
Definition giaLf.c:1617
#define Gia_ManForEachAndReverse(p, pObj, i)
Definition gia.h:1222
#define Gia_ManForEachCoDriverId(p, DriverId, i)
Definition gia.h:1246
#define Gia_ManForEachObjReverse1(p, pObj, i)
Definition gia.h:1208
void Gia_ManCleanMark0(Gia_Man_t *p)
Definition giaUtil.c:256
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:

◆ Lf_ManCountMapRefsOne()

void Lf_ManCountMapRefsOne ( Lf_Man_t * p,
int iObj )

Definition at line 1617 of file giaLf.c.

1618{
1619 Lf_Bst_t * pBest = Lf_ObjReadBest( p, iObj );
1620 Lf_Cut_t * pCut = Lf_ObjCutBest( p, iObj );
1621 int k ,Required = Lf_ObjRequired( p, iObj );
1622 assert( Lf_ObjMapRefNum(p, iObj) > 0 );
1623 assert( Lf_BestIsMapped(pBest) );
1624 assert( !pCut->fMux7 );
1625// assert( pCut->Delay <= Required );
1626 for ( k = 0; k < (int)pCut->nLeaves; k++ )
1627 Lf_ObjSetRequired( p, pCut->pLeaves[k], Required - 1 );
1628 if ( Vec_FltSize(&p->vSwitches) )
1629 p->Switches += Lf_CutSwitches(p, pCut);
1630 p->pPars->Edge += pCut->nLeaves;
1631 p->pPars->Area++;
1632}
unsigned nLeaves
Definition giaLf.c:51
unsigned fMux7
Definition giaLf.c:50
int pLeaves[0]
Definition giaLf.c:52
Here is the caller graph for this function:

◆ Lf_ManDeriveMapping()

Gia_Man_t * Lf_ManDeriveMapping ( Lf_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1709 of file giaLf.c.

1710{
1711 Vec_Int_t * vMapping;
1712 Lf_Cut_t * pCut;
1713 int i, k;
1714 assert( !p->pPars->fCutMin && p->pGia->vMapping == NULL );
1715 vMapping = Vec_IntAlloc( Gia_ManObjNum(p->pGia) + (int)p->pPars->Edge + (int)p->pPars->Area * 2 );
1716 Vec_IntFill( vMapping, Gia_ManObjNum(p->pGia), 0 );
1717 Gia_ManForEachAndId( p->pGia, i )
1718 {
1719 if ( !Lf_ObjMapRefNum(p, i) )
1720 continue;
1721 assert( !Gia_ObjIsBuf(Gia_ManObj(p->pGia,i)) );
1722 pCut = Lf_ObjCutBest( p, i );
1723 assert( !pCut->fMux7 );
1724 Vec_IntWriteEntry( vMapping, i, Vec_IntSize(vMapping) );
1725 Vec_IntPush( vMapping, pCut->nLeaves );
1726 for ( k = 0; k < (int)pCut->nLeaves; k++ )
1727 Vec_IntPush( vMapping, pCut->pLeaves[k] );
1728 Vec_IntPush( vMapping, i );
1729 }
1730 assert( Vec_IntCap(vMapping) == 16 || Vec_IntSize(vMapping) == Vec_IntCap(vMapping) );
1731 p->pGia->vMapping = vMapping;
1732 return p->pGia;
1733}
Here is the caller graph for this function:

◆ Lf_ManDeriveMappingCoarse()

Gia_Man_t * Lf_ManDeriveMappingCoarse ( Lf_Man_t * p)

Definition at line 1734 of file giaLf.c.

1735{
1736 Gia_Man_t * pNew, * pGia = p->pGia;
1737 Gia_Obj_t * pObj;
1738 Lf_Cut_t * pCut;
1739 int i, k;
1740 assert( !p->pPars->fCutMin && pGia->pMuxes );
1741 // create new manager
1742 pNew = Gia_ManStart( Gia_ManObjNum(pGia) );
1743 pNew->pName = Abc_UtilStrsav( pGia->pName );
1744 pNew->pSpec = Abc_UtilStrsav( pGia->pSpec );
1745 // start mapping
1746 pNew->vMapping = Vec_IntAlloc( Gia_ManObjNum(pGia) + 2*Gia_ManXorNum(pGia) + 2*Gia_ManMuxNum(pGia) + (int)p->pPars->Edge + 2*(int)p->pPars->Area + 4*(int)p->pPars->Mux7 );
1747 Vec_IntFill( pNew->vMapping, Gia_ManObjNum(pGia) + 2*Gia_ManXorNum(pGia) + 2*Gia_ManMuxNum(pGia), 0 );
1748 // process objects
1749 Gia_ManConst0(pGia)->Value = 0;
1750 Gia_ManForEachObj1( pGia, pObj, i )
1751 {
1752 if ( Gia_ObjIsCi(pObj) )
1753 { pObj->Value = Gia_ManAppendCi( pNew ); continue; }
1754 if ( Gia_ObjIsCo(pObj) )
1755 { pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) ); continue; }
1756 if ( Gia_ObjIsBuf(pObj) )
1757 { pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) ); continue; }
1758 if ( Gia_ObjIsMuxId(pGia, i) )
1759 pObj->Value = Gia_ManAppendMux( pNew, Gia_ObjFanin2Copy(pGia, pObj), Gia_ObjFanin1Copy(pObj), Gia_ObjFanin0Copy(pObj) );
1760 else if ( Gia_ObjIsXor(pObj) )
1761 pObj->Value = Gia_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1762 else
1763 pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
1764 if ( !Lf_ObjMapRefNum(p, i) )
1765 continue;
1766 pCut = Lf_ObjCutBest( p, i );
1767 Vec_IntWriteEntry( pNew->vMapping, Abc_Lit2Var(pObj->Value), Vec_IntSize(pNew->vMapping) );
1768 Vec_IntPush( pNew->vMapping, pCut->nLeaves );
1769 for ( k = 0; k < (int)pCut->nLeaves; k++ )
1770 Vec_IntPush( pNew->vMapping, Abc_Lit2Var(Gia_ManObj(pGia, pCut->pLeaves[k])->Value) );
1771 Vec_IntPush( pNew->vMapping, pCut->fMux7 ? -Abc_Lit2Var(pObj->Value) : Abc_Lit2Var(pObj->Value) );
1772 }
1773 Gia_ManSetRegNum( pNew, Gia_ManRegNum(pGia) );
1774 assert( Vec_IntCap(pNew->vMapping) == 16 || Vec_IntSize(pNew->vMapping) == Vec_IntCap(pNew->vMapping) );
1775 return pNew;
1776}
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
unsigned * pMuxes
Definition gia.h:106
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManDeriveMappingGia()

Gia_Man_t * Lf_ManDeriveMappingGia ( Lf_Man_t * p)

Definition at line 1849 of file giaLf.c.

1850{
1851 Gia_Man_t * pNew;
1852 Gia_Obj_t * pObj;
1853 Vec_Int_t * vCopies = Vec_IntStartFull( Gia_ManObjNum(p->pGia) );
1854 Vec_Int_t * vMapping = Vec_IntStart( 2*Gia_ManObjNum(p->pGia) + (int)p->pPars->Edge + 2*(int)p->pPars->Area + 4*(int)p->pPars->Mux7 );
1855 Vec_Int_t * vMapping2 = Vec_IntStart( (int)p->pPars->Edge + 2*(int)p->pPars->Area + 1000 );
1856 Vec_Int_t * vCover = Vec_IntAlloc( 1 << 16 );
1857 Vec_Int_t * vLeaves = Vec_IntAlloc( 16 );
1858 Lf_Cut_t * pCut;
1859 int i, iLit;
1860 assert( p->pPars->fCutMin );
1861 // create new manager
1862 pNew = Gia_ManStart( Gia_ManObjNum(p->pGia) );
1863 pNew->pName = Abc_UtilStrsav( p->pGia->pName );
1864 pNew->pSpec = Abc_UtilStrsav( p->pGia->pSpec );
1865 Vec_IntWriteEntry( vCopies, 0, 0 );
1866 Gia_ManForEachObj1( p->pGia, pObj, i )
1867 {
1868 if ( Gia_ObjIsCi(pObj) )
1869 {
1870 Vec_IntWriteEntry( vCopies, i, Gia_ManAppendCi(pNew) );
1871 continue;
1872 }
1873 if ( Gia_ObjIsCo(pObj) )
1874 {
1875 iLit = Vec_IntEntry( vCopies, Gia_ObjFaninId0p(p->pGia, pObj) );
1876 iLit = Gia_ManAppendCo( pNew, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) );
1877 continue;
1878 }
1879 if ( Gia_ObjIsBuf(pObj) )
1880 {
1881 iLit = Vec_IntEntry( vCopies, Gia_ObjFaninId0p(p->pGia, pObj) );
1882 iLit = Gia_ManAppendBuf( pNew, Abc_LitNotCond(iLit, Gia_ObjFaninC0(pObj)) );
1883 Vec_IntWriteEntry( vCopies, i, iLit );
1884 continue;
1885 }
1886 if ( !Lf_ObjMapRefNum(p, i) )
1887 continue;
1888 pCut = Lf_ObjCutBest( p, i );
1889 assert( pCut->iFunc >= 0 );
1890 if ( pCut->nLeaves == 0 )
1891 {
1892 assert( Abc_Lit2Var(pCut->iFunc) == 0 );
1893 Vec_IntWriteEntry( vCopies, i, pCut->iFunc );
1894 continue;
1895 }
1896 if ( pCut->nLeaves == 1 )
1897 {
1898 assert( Abc_Lit2Var(pCut->iFunc) == 1 );
1899 iLit = Vec_IntEntry( vCopies, pCut->pLeaves[0] );
1900 Vec_IntWriteEntry( vCopies, i, Abc_LitNotCond(iLit, Abc_LitIsCompl(pCut->iFunc)) );
1901 continue;
1902 }
1903 iLit = Lf_ManDerivePart( p, pNew, vMapping, vMapping2, vCopies, pCut, vLeaves, vCover, pObj );
1904 Vec_IntWriteEntry( vCopies, i, Abc_LitNotCond(iLit, Abc_LitIsCompl(pCut->iFunc)) );
1905 }
1906 Vec_IntFree( vCopies );
1907 Vec_IntFree( vCover );
1908 Vec_IntFree( vLeaves );
1909 // finish mapping
1910 if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
1911 Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
1912 else
1913 Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
1914 assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
1915 Vec_IntForEachEntry( vMapping, iLit, i )
1916 if ( iLit > 0 )
1917 Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
1918 Vec_IntAppend( vMapping, vMapping2 );
1919 Vec_IntFree( vMapping2 );
1920 // attach mapping and packing
1921 assert( pNew->vMapping == NULL );
1922 pNew->vMapping = vMapping;
1923 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p->pGia) );
1924 return pNew;
1925}
int iFunc
Definition giaLf.c:47
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManFree()

void Lf_ManFree ( Lf_Man_t * p)

Definition at line 1981 of file giaLf.c.

1982{
1983 ABC_FREE( p->pPars->pTimesArr );
1984 ABC_FREE( p->pPars->pTimesReq );
1985 if ( p->pPars->fCutMin )
1986 Vec_MemHashFree( p->vTtMem );
1987 if ( p->pPars->fCutMin )
1988 Vec_MemFree( p->vTtMem );
1989 Vec_PtrFreeData( &p->vMemSets );
1990 Vec_PtrFreeData( &p->vFreePages );
1991 Vec_PtrFreeData( &p->vStoreOld.vPages );
1992 Vec_PtrFreeData( &p->vStoreNew.vPages );
1993 ABC_FREE( p->vMemSets.pArray );
1994 ABC_FREE( p->vFreePages.pArray );
1995 ABC_FREE( p->vStoreOld.vPages.pArray );
1996 ABC_FREE( p->vStoreNew.vPages.pArray );
1997 ABC_FREE( p->vFreePages.pArray );
1998 ABC_FREE( p->vFreeSets.pArray );
1999 ABC_FREE( p->vOffsets.pArray );
2000 ABC_FREE( p->vRequired.pArray );
2001 ABC_FREE( p->vCutSets.pArray );
2002 ABC_FREE( p->vFlowRefs.pArray );
2003 ABC_FREE( p->vMapRefs.pArray );
2004 ABC_FREE( p->vSwitches.pArray );
2005 ABC_FREE( p->vCiArrivals.pArray );
2006 ABC_FREE( p->pObjBests );
2007 ABC_FREE( p );
2008}
Here is the caller graph for this function:

◆ Lf_ManPerformMapping()

Gia_Man_t * Lf_ManPerformMapping ( Gia_Man_t * p,
Jf_Par_t * pPars )

Definition at line 2242 of file giaLf.c.

2243{
2244 Gia_Man_t * pNew;
2245 if ( p->pManTime && Tim_ManBoxNum((Tim_Man_t*)p->pManTime) && Gia_ManIsNormalized(p) )
2246 {
2247 Tim_Man_t * pTimOld = (Tim_Man_t *)p->pManTime;
2248 p->pManTime = Tim_ManDup( pTimOld, 1 );
2249 pNew = Gia_ManDupUnnormalize( p );
2250 if ( pNew == NULL )
2251 return NULL;
2252 Gia_ManTransferTiming( pNew, p );
2253 p = pNew;
2254 // mapping
2255 pNew = Lf_ManPerformMappingInt( p, pPars );
2256 if ( pNew != p )
2257 {
2258 Gia_ManTransferTiming( pNew, p );
2259 Gia_ManStop( p );
2260 }
2261 // normalize
2262 pNew = Gia_ManDupNormalize( p = pNew, 0 );
2263 Gia_ManTransferMapping( pNew, p );
2264// Gia_ManTransferPacking( pNew, p );
2265 Gia_ManTransferTiming( pNew, p );
2266 Gia_ManStop( p ); // do not delete if the original one!
2267 // cleanup
2268 Tim_ManStop( (Tim_Man_t *)pNew->pManTime );
2269 pNew->pManTime = pTimOld;
2270 assert( Gia_ManIsNormalized(pNew) );
2271 }
2272 else
2273 {
2274 // mapping
2275 pNew = Lf_ManPerformMappingInt( p, pPars );
2276 Gia_ManTransferTiming( pNew, p );
2277 }
2278 return pNew;
2279}
int Gia_ManIsNormalized(Gia_Man_t *p)
Definition giaTim.c:114
void * pManTime
Definition gia.h:194
int Tim_ManBoxNum(Tim_Man_t *p)
Definition timMan.c:722
void Tim_ManStop(Tim_Man_t *p)
Definition timMan.c:378
Tim_Man_t * Tim_ManDup(Tim_Man_t *p, int fUnitDelay)
Definition timMan.c:86
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManPerformMappingInt()

Gia_Man_t * Lf_ManPerformMappingInt ( Gia_Man_t * pGia,
Jf_Par_t * pPars )

Definition at line 2182 of file giaLf.c.

2183{
2184 int fUsePowerMode = 0;
2185 Lf_Man_t * p;
2186 Gia_Man_t * pNew, * pCls;
2187 if ( pPars->fUseMux7 )
2188 pPars->fCoarsen = 1, pPars->nRoundsEla = 0;
2189 if ( Gia_ManHasChoices(pGia) || pPars->nLutSizeMux )
2190 pPars->fCutMin = 1;
2191 if ( pPars->fCoarsen )
2192 {
2193 pCls = Gia_ManDupMuxes(pGia, pPars->nCoarseLimit);
2194 pCls->pManTime = pGia->pManTime; pGia->pManTime = NULL;
2195 }
2196 else pCls = pGia;
2197 p = Lf_ManAlloc( pCls, pPars );
2198 if ( pPars->fVerbose && pPars->fCoarsen )
2199 {
2200 printf( "Initial " ); Gia_ManPrintMuxStats( pGia ); printf( "\n" );
2201 printf( "Derived " ); Gia_ManPrintMuxStats( pCls ); printf( "\n" );
2202 }
2203 Lf_ManPrintInit( p );
2204
2205 // power mode
2206 if ( fUsePowerMode && Vec_FltSize(&p->vSwitches) )
2207 pPars->fPower = 0;
2208
2209 // perform mapping
2210 for ( p->Iter = 0; p->Iter < p->pPars->nRounds; p->Iter++ )
2212 p->fUseEla = 1;
2213 for ( ; p->Iter < p->pPars->nRounds + pPars->nRoundsEla; p->Iter++ )
2215
2216 // power mode
2217 if ( fUsePowerMode && Vec_FltSize(&p->vSwitches) )
2218 {
2219 pPars->fPower = 1;
2220 for ( ; p->Iter < p->pPars->nRounds + pPars->nRoundsEla + 2; p->Iter++ )
2222 }
2223
2224 if ( pPars->fVeryVerbose && pPars->fCutMin )
2225 Vec_MemDumpTruthTables( p->vTtMem, Gia_ManName(p->pGia), pPars->nLutSize );
2226 if ( pPars->fCutMin )
2227 pNew = Lf_ManDeriveMappingGia( p );
2228 else if ( pPars->fCoarsen )
2229 pNew = Lf_ManDeriveMappingCoarse( p );
2230 else
2231 pNew = Lf_ManDeriveMapping( p );
2232 Gia_ManMappingVerify( pNew );
2233 Lf_ManPrintQuit( p, pNew );
2234 Lf_ManFree( p );
2235 if ( pCls != pGia )
2236 {
2237 pGia->pManTime = pCls->pManTime; pCls->pManTime = NULL;
2238 Gia_ManStop( pCls );
2239 }
2240 return pNew;
2241}
void Lf_ManFree(Lf_Man_t *p)
Definition giaLf.c:1981
Gia_Man_t * Lf_ManDeriveMapping(Lf_Man_t *p)
Definition giaLf.c:1709
void Lf_ManComputeMapping(Lf_Man_t *p)
Definition giaLf.c:2138
Gia_Man_t * Lf_ManDeriveMappingGia(Lf_Man_t *p)
Definition giaLf.c:1849
void Lf_ManPrintInit(Lf_Man_t *p)
Definition giaLf.c:2066
Lf_Man_t * Lf_ManAlloc(Gia_Man_t *pGia, Jf_Par_t *pPars)
Definition giaLf.c:1938
Gia_Man_t * Lf_ManDeriveMappingCoarse(Lf_Man_t *p)
Definition giaLf.c:1734
void Lf_ManPrintQuit(Lf_Man_t *p, Gia_Man_t *pNew)
Definition giaLf.c:2085
Gia_Man_t * Gia_ManDupMuxes(Gia_Man_t *p, int Limit)
Definition giaMuxes.c:98
void Gia_ManPrintMuxStats(Gia_Man_t *p)
Definition giaMuxes.c:63
void Gia_ManMappingVerify(Gia_Man_t *p)
Definition giaIf.c:2257
int nLutSizeMux
Definition gia.h:375
int nRoundsEla
Definition gia.h:340
int fCoarsen
Definition gia.h:357
int fVeryVerbose
Definition gia.h:371
int nCoarseLimit
Definition gia.h:342
int fVerbose
Definition gia.h:370
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManPrintInit()

void Lf_ManPrintInit ( Lf_Man_t * p)

Definition at line 2066 of file giaLf.c.

2067{
2068 if ( !p->pPars->fVerbose )
2069 return;
2070 printf( "LutSize = %d ", p->pPars->nLutSize );
2071 printf( "CutNum = %d ", p->pPars->nCutNum );
2072 printf( "Iter = %d ", p->pPars->nRounds + p->pPars->nRoundsEla );
2073 if ( p->pPars->nRelaxRatio )
2074 printf( "Ratio = %d ", p->pPars->nRelaxRatio );
2075 printf( "Edge = %d ", p->pPars->fOptEdge );
2076 if ( p->pPars->DelayTarget != -1 )
2077 printf( "Delay = %d ", p->pPars->DelayTarget );
2078 printf( "CutMin = %d ", p->pPars->fCutMin );
2079 printf( "Coarse = %d ", p->pPars->fCoarsen );
2080 printf( "Cut/Set = %d/%d Bytes", 8*p->nCutWords, 8*p->nSetWords );
2081 printf( "\n" );
2082 printf( "Computing cuts...\r" );
2083 fflush( stdout );
2084}
Here is the caller graph for this function:

◆ Lf_ManPrintQuit()

void Lf_ManPrintQuit ( Lf_Man_t * p,
Gia_Man_t * pNew )

Definition at line 2085 of file giaLf.c.

2086{
2087 float MemGia = Gia_ManMemory(p->pGia) / (1<<20);
2088 float MemMan = 1.0 * sizeof(int) * (2 * Gia_ManObjNum(p->pGia) + 3 * Gia_ManAndNotBufNum(p->pGia)) / (1<<20); // offset, required, cutsets, maprefs, flowrefs
2089 float MemCutsB = 1.0 * (p->vStoreOld.MaskPage + 1) * (Vec_PtrSize(&p->vFreePages) + Vec_PtrSize(&p->vStoreOld.vPages)) / (1<<20) + 1.0 * sizeof(Lf_Bst_t) * Gia_ManAndNotBufNum(p->pGia) / (1<<20);
2090 float MemCutsF = 1.0 * sizeof(word) * p->nSetWords * (1<<LF_LOG_PAGE) * Vec_PtrSize(&p->vMemSets) / (1<<20);
2091 float MemTt = p->vTtMem ? Vec_MemMemory(p->vTtMem) / (1<<20) : 0;
2092 float MemMap = Vec_IntMemory(pNew->vMapping) / (1<<20);
2093 if ( p->CutCount[0] == 0 )
2094 p->CutCount[0] = 1;
2095 if ( !p->pPars->fVerbose )
2096 {
2097 int i, CountOver[2] = {0};
2098 int nLutSize = p->pPars->fCutGroup ? p->pPars->nLutSize/2 : p->pPars->nLutSize;
2099 Gia_ManForEachLut( pNew, i )
2100 CountOver[Gia_ObjLutSize(pNew, i) > nLutSize]++;
2101 if ( p->pPars->fCutGroup )
2102 printf( "Created %d regular %d-LUTs and %d dual %d-LUTs. The total of %d %d-LUTs.\n",
2103 CountOver[0], nLutSize, CountOver[1], nLutSize, CountOver[0] + 2*CountOver[1], nLutSize );
2104 return;
2105 }
2106 printf( "CutPair = %.0f ", p->CutCount[0] );
2107 printf( "Merge = %.0f (%.2f %%) ", p->CutCount[1], 100.0*p->CutCount[1]/p->CutCount[0] );
2108 printf( "Eval = %.0f (%.2f %%) ", p->CutCount[2], 100.0*p->CutCount[2]/p->CutCount[0] );
2109 printf( "Cut = %.0f (%.2f %%) ", p->CutCount[3], 100.0*p->CutCount[3]/p->CutCount[0] );
2110 printf( "\n" );
2111 printf( "Gia = %.2f MB ", MemGia );
2112 printf( "Man = %.2f MB ", MemMan );
2113 printf( "Best = %.2f MB ", MemCutsB );
2114 printf( "Front = %.2f MB ", MemCutsF );
2115 printf( "Map = %.2f MB ", MemMap );
2116 printf( "TT = %.2f MB ", MemTt );
2117 printf( "Total = %.2f MB", MemGia + MemMan + MemCutsB + MemCutsF + MemMap + MemTt );
2118 printf( "\n" );
2119 if ( 1 )
2120 {
2121 int i;
2122 for ( i = 0; i <= p->pPars->nLutSize; i++ )
2123 printf( "%d:%d ", i, p->nCutCounts[i] );
2124 printf( "Equal = %d (%.0f %%) ", p->nCutEqual, 100.0 * p->nCutEqual / p->Iter / Gia_ManAndNotBufNum(p->pGia) );
2125 if ( p->vTtMem )
2126 printf( "TT = %d (%.2f %%) ", Vec_MemEntryNum(p->vTtMem), 100.0 * Vec_MemEntryNum(p->vTtMem) / p->CutCount[2] );
2127 if ( p->pGia->pMuxes && p->nCutMux )
2128 printf( "MuxTT = %d (%.0f %%) ", p->nCutMux, 100.0 * p->nCutMux / p->Iter / Gia_ManMuxNum(p->pGia) );
2129 printf( "\n" );
2130 }
2131 printf( "CoDrvs = %d (%.2f %%) ", p->nCoDrivers, 100.0*p->nCoDrivers/Gia_ManCoNum(p->pGia) );
2132 printf( "CoInvs = %d (%.2f %%) ", p->nInverters, 100.0*p->nInverters/Gia_ManCoNum(p->pGia) );
2133 printf( "Front = %d (%.2f %%) ", p->nFrontMax, 100.0*p->nFrontMax/Gia_ManAndNum(p->pGia) );
2134 printf( "TimeFails = %d ", p->nTimeFails );
2135 Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
2136 fflush( stdout );
2137}
#define LF_LOG_PAGE
Definition giaLf.c:35
double Gia_ManMemory(Gia_Man_t *p)
Definition giaMan.c:194
#define Gia_ManForEachLut(p, i)
Definition gia.h:1157
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManPrintStats()

void Lf_ManPrintStats ( Lf_Man_t * p,
char * pTitle )

Definition at line 2050 of file giaLf.c.

2051{
2052 if ( !p->pPars->fVerbose )
2053 return;
2054 printf( "%s : ", pTitle );
2055 printf( "Level =%6lu ", (long)p->pPars->Delay );
2056 printf( "Area =%9lu ", (long)p->pPars->Area );
2057 printf( "Edge =%9lu ", (long)p->pPars->Edge );
2058 printf( "LUT =%9lu ", (long)p->pPars->Area+p->nInverters );
2059 if ( Vec_FltSize(&p->vSwitches) )
2060 printf( "Swt =%8.1f ", p->Switches );
2061 if ( p->pPars->fUseMux7 )
2062 printf( "Mux7 =%7lu ", (long)p->pPars->Mux7 );
2063 Abc_PrintTime( 1, "Time", Abc_Clock() - p->clkStart );
2064 fflush( stdout );
2065}
Here is the caller graph for this function:

◆ Lf_ManSetCutRefs()

void Lf_ManSetCutRefs ( Lf_Man_t * p)

Definition at line 1448 of file giaLf.c.

1449{
1450 Gia_Obj_t * pObj; int i;
1451 if ( Vec_PtrSize(&p->vMemSets) * (1 << LF_LOG_PAGE) != Vec_IntSize(&p->vFreeSets) )
1452 printf( "The number of used cutsets = %d.\n", Vec_PtrSize(&p->vMemSets) * (1 << LF_LOG_PAGE) - Vec_IntSize(&p->vFreeSets) );
1453 Gia_ManForEachAnd( p->pGia, pObj, i )
1454 {
1455 assert( pObj->Value == 0 );
1456 if ( Gia_ObjIsBuf(pObj) )
1457 continue;
1458 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1459 Gia_ObjFanin0(pObj)->Value++;
1460 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin1(pObj)) )
1461 Gia_ObjFanin1(pObj)->Value++;
1462 if ( Gia_ObjIsMuxId(p->pGia, i) && Gia_ObjIsAndNotBuf(Gia_ObjFanin2(p->pGia, pObj)) )
1463 Gia_ObjFanin2(p->pGia, pObj)->Value++;
1464 if ( Gia_ObjSibl(p->pGia, i) && Gia_ObjIsAndNotBuf(Gia_ObjSiblObj(p->pGia, i)) )
1465 Gia_ObjSiblObj(p->pGia, i)->Value++;
1466 }
1467}
Here is the caller graph for this function:

◆ Lf_ManSetDefaultPars()

void Lf_ManSetDefaultPars ( Jf_Par_t * pPars)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2021 of file giaLf.c.

2022{
2023 memset( pPars, 0, sizeof(Jf_Par_t) );
2024 pPars->nLutSize = 6;
2025 pPars->nCutNum = 8;
2026 pPars->nProcNum = 0;
2027 pPars->nRounds = 4;
2028 pPars->nRoundsEla = 1;
2029 pPars->nRelaxRatio = 0;
2030 pPars->nCoarseLimit = 3;
2031 pPars->nAreaTuner = 1;
2032 pPars->nVerbLimit = 5;
2033 pPars->DelayTarget = -1;
2034 pPars->fAreaOnly = 0;
2035 pPars->fOptEdge = 1;
2036 pPars->fUseMux7 = 0;
2037 pPars->fPower = 0;
2038 pPars->fCoarsen = 1;
2039 pPars->fCutMin = 0;
2040 pPars->fFuncDsd = 0;
2041 pPars->fGenCnf = 0;
2042 pPars->fPureAig = 0;
2043 pPars->fCutHashing = 0;
2044 pPars->fCutSimple = 0;
2045 pPars->fVerbose = 0;
2046 pPars->fVeryVerbose = 0;
2047 pPars->nLutSizeMax = LF_LEAF_MAX;
2048 pPars->nCutNumMax = LF_CUT_MAX;
2049}
struct Jf_Par_t_ Jf_Par_t
Definition gia.h:333
int nRounds
Definition gia.h:339
int fGenCnf
Definition gia.h:360
int fFuncDsd
Definition gia.h:359
int fCutSimple
Definition gia.h:368
int nProcNum
Definition gia.h:338
int nRelaxRatio
Definition gia.h:341
int fOptEdge
Definition gia.h:354
int fAreaOnly
Definition gia.h:350
int nCutNumMax
Definition gia.h:373
int nLutSizeMax
Definition gia.h:372
int nAreaTuner
Definition gia.h:343
int fPureAig
Definition gia.h:365
int fCutHashing
Definition gia.h:367
int nVerbLimit
Definition gia.h:345
int DelayTarget
Definition gia.h:349
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManSetFlowRefs()

void Lf_ManSetFlowRefs ( Gia_Man_t * p,
Vec_Flt_t * vRefs,
Vec_Int_t * vOffsets )

Definition at line 1412 of file giaLf.c.

1413{
1414 int fDiscount = 1;
1415 Gia_Obj_t * pObj, * pCtrl, * pData0, * pData1;
1416 int i, Id;
1417 Vec_FltFill( vRefs, Gia_ManAndNotBufNum(p), 0 );
1418 Gia_ManForEachAnd( p, pObj, i )
1419 {
1420 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1421 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjFaninId0(pObj, i)), 1 );
1422 if ( Gia_ObjIsBuf(pObj) )
1423 continue;
1424 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin1(pObj)) )
1425 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjFaninId1(pObj, i)), 1 );
1426 if ( p->pMuxes )
1427 {
1428 if ( Gia_ObjIsMuxId(p, i) && Gia_ObjIsAndNotBuf(Gia_ObjFanin2(p, pObj)) )
1429 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjFaninId2(p, i)), 1 );
1430 }
1431 else if ( fDiscount && Gia_ObjIsMuxType(pObj) ) // discount XOR/MUX
1432 {
1433 pCtrl = Gia_Regular(Gia_ObjRecognizeMux(pObj, &pData1, &pData0));
1434 pData0 = Gia_Regular(pData0);
1435 pData1 = Gia_Regular(pData1);
1436 if ( Gia_ObjIsAndNotBuf(pCtrl) )
1437 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjId(p, pCtrl)), -1 );
1438 if ( pData0 == pData1 && Gia_ObjIsAndNotBuf(pData0) )
1439 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Gia_ObjId(p, pData0)), -1 );
1440 }
1441 }
1442 Gia_ManForEachCoDriverId( p, Id, i )
1443 if ( Gia_ObjIsAndNotBuf(Gia_ManObj(p, Id)) )
1444 Vec_FltAddToEntry( vRefs, Vec_IntEntry(vOffsets, Id), 1 );
1445 for ( i = 0; i < Vec_FltSize(vRefs); i++ )
1446 Vec_FltUpdateEntry( vRefs, i, 1 );
1447}
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition giaUtil.c:1056
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition giaUtil.c:982
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManSetMapRefs()

int Lf_ManSetMapRefs ( Lf_Man_t * p)

Definition at line 1520 of file giaLf.c.

1521{
1522 float Coef = 1.0 / (1.0 + (p->Iter + 1) * (p->Iter + 1));
1523 float * pFlowRefs;
1524 int * pMapRefs, i;
1525 Gia_Obj_t * pObj;
1526 // compute delay
1527 int Delay = 0;
1528 for ( i = 0; i < Gia_ManCoNum(p->pGia); i++ )
1529 Delay = Abc_MaxInt( Delay, Lf_ObjCoArrival(p, i) );
1530 // check delay target
1531 if ( p->pPars->DelayTarget == -1 && p->pPars->nRelaxRatio )
1532 p->pPars->DelayTarget = (int)((float)Delay * (100.0 + p->pPars->nRelaxRatio) / 100.0);
1533 if ( p->pPars->DelayTarget != -1 )
1534 {
1535 if ( Delay < p->pPars->DelayTarget + 0.01 )
1536 Delay = p->pPars->DelayTarget;
1537 else if ( p->pPars->nRelaxRatio == 0 )
1538 Abc_Print( 0, "Relaxing user-specified delay target from %d to %d.\n", p->pPars->DelayTarget, Delay );
1539 }
1540 p->pPars->Delay = Delay;
1541 // compute area/edges/required
1542 p->pPars->Mux7 = p->pPars->Area = p->pPars->Edge = p->Switches = 0;
1543 Vec_IntFill( &p->vMapRefs, Gia_ManAndNotBufNum(p->pGia), 0 );
1544 Vec_IntFill( &p->vRequired, Gia_ManObjNum(p->pGia), ABC_INFINITY );
1545 if ( p->pPars->fUseMux7 )
1546 {
1547 Gia_ManCleanMark0(p->pGia);
1548 Gia_ManForEachCi( p->pGia, pObj, i )
1549 pObj->fMark0 = 1;
1550 }
1551 if ( p->pGia->pManTime != NULL )
1552 {
1553 assert( !Gia_ManBufNum(p->pGia) );
1554 Tim_ManIncrementTravId( (Tim_Man_t*)p->pGia->pManTime );
1555 if ( p->pPars->fDoAverage )
1556 for ( i = 0; i < Gia_ManCoNum(p->pGia); i++ )
1557 Tim_ManSetCoRequired( (Tim_Man_t*)p->pGia->pManTime, i, (int)(Lf_ObjCoArrival(p, i) * (100.0 + p->pPars->nRelaxRatio) / 100.0) );
1558 else
1559 Tim_ManInitPoRequiredAll( (Tim_Man_t*)p->pGia->pManTime, Delay );
1560 Gia_ManForEachObjReverse1( p->pGia, pObj, i )
1561 {
1562 if ( Gia_ObjIsBuf(pObj) )
1563 Lf_ObjSetRequired( p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(p, i) );
1564 else if ( Gia_ObjIsAnd(pObj) )
1565 {
1566 if ( Lf_ObjMapRefNum(p, i) )
1567 Lf_ManSetMapRefsOne( p, i );
1568 }
1569 else if ( Gia_ObjIsCi(pObj) )
1570 Tim_ManSetCiRequired( (Tim_Man_t*)p->pGia->pManTime, Gia_ObjCioId(pObj), Lf_ObjRequired(p, i) );
1571 else if ( Gia_ObjIsCo(pObj) )
1572 {
1573 int iDriverId = Gia_ObjFaninId0(pObj, i);
1574 int reqTime = Tim_ManGetCoRequired( (Tim_Man_t*)p->pGia->pManTime, Gia_ObjCioId(pObj) );
1575 Lf_ObjSetRequired( p, iDriverId, reqTime );
1576 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1577 Lf_ObjMapRefInc( p, iDriverId );
1578 }
1579 else assert( 0 );
1580 }
1581 }
1582 else
1583 {
1584 Gia_ManForEachCo( p->pGia, pObj, i )
1585 {
1586 int iDriverId = Gia_ObjFaninId0p(p->pGia, pObj);
1587 int reqTime = p->pPars->fDoAverage ? (int)(Lf_ObjCoArrival(p, i) * (100.0 + p->pPars->nRelaxRatio) / 100.0) : Delay;
1588 Lf_ObjSetRequired( p, iDriverId, reqTime );
1589 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1590 Lf_ObjMapRefInc( p, iDriverId );
1591 }
1592 Gia_ManForEachAndReverse( p->pGia, pObj, i )
1593 {
1594 if ( Gia_ObjIsBuf(pObj) )
1595 {
1596 Lf_ObjSetRequired( p, Gia_ObjFaninId0(pObj, i), Lf_ObjRequired(p, i) );
1597 if ( Gia_ObjIsAndNotBuf(Gia_ObjFanin0(pObj)) )
1598 Lf_ObjMapRefInc( p, Gia_ObjFaninId0(pObj, i) );
1599 }
1600 else if ( Lf_ObjMapRefNum(p, i) )
1601 Lf_ManSetMapRefsOne( p, i );
1602 }
1603 }
1604 if ( p->pPars->fUseMux7 )
1605 Gia_ManCleanMark0(p->pGia);
1606 // blend references
1607 assert( Vec_IntSize(&p->vMapRefs) == Gia_ManAndNotBufNum(p->pGia) );
1608 assert( Vec_FltSize(&p->vFlowRefs) == Gia_ManAndNotBufNum(p->pGia) );
1609 pMapRefs = Vec_IntArray(&p->vMapRefs);
1610 pFlowRefs = Vec_FltArray(&p->vFlowRefs);
1611 for ( i = 0; i < Vec_IntSize(&p->vMapRefs); i++ )
1612 pFlowRefs[i] = Coef * pFlowRefs[i] + (1.0 - Coef) * Abc_MaxFloat(1, pMapRefs[i]);
1613// pFlowRefs[i] = 0.2 * pFlowRefs[i] + 0.8 * Abc_MaxFloat(1, pMapRefs[i]);
1614 return p->pPars->Area;
1615}
void Lf_ManSetMapRefsOne(Lf_Man_t *p, int iObj)
Definition giaLf.c:1485
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
unsigned fMark0
Definition gia.h:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ManSetMapRefsOne()

void Lf_ManSetMapRefsOne ( Lf_Man_t * p,
int iObj )

Definition at line 1485 of file giaLf.c.

1486{
1487 Lf_Cut_t * pCut;
1488 Lf_Bst_t * pBest = Lf_ObjReadBest( p, iObj );
1489 int k, Index, Required = Lf_ObjRequired( p, iObj );
1490 assert( Lf_ObjMapRefNum(p, iObj) > 0 );
1491 assert( !pBest->Cut[0].fUsed && !pBest->Cut[1].fUsed );
1492 if ( !p->pPars->fUseMux7 || !Lf_ManSetMuxCut(p, pBest, iObj, Required) )
1493 {
1494 Index = (int)(Lf_BestDiffCuts(pBest) && pBest->Delay[1] <= Required);
1495 pBest->Cut[Index].fUsed = 1;
1496 }
1497 pCut = Lf_ObjCutBest( p, iObj );
1498 assert( !pCut->fMux7 || pCut->nLeaves == 3 );
1499// assert( pCut->Delay <= Required );
1500 for ( k = 0; k < (int)pCut->nLeaves; k++ )
1501 {
1502// if ( pCut->fMux7 && pCut->pLeaves[k] != Gia_ObjFaninId2(p->pGia, iObj) )
1503// Lf_ObjSetRequired( p, pCut->pLeaves[k], Required );
1504// else
1505 Lf_ObjSetRequired( p, pCut->pLeaves[k], Required - 1 );
1506 if ( Gia_ObjIsAndNotBuf(Gia_ManObj(p->pGia, pCut->pLeaves[k])) )
1507 Lf_ObjMapRefInc( p, pCut->pLeaves[k] );
1508 }
1509 if ( pCut->fMux7 )
1510 {
1511 p->pPars->Mux7++;
1512 p->pPars->Edge++;
1513 return;
1514 }
1515 if ( Vec_FltSize(&p->vSwitches) )
1516 p->Switches += Lf_CutSwitches(p, pCut);
1517 p->pPars->Edge += pCut->nLeaves;
1518 p->pPars->Area++;
1519}
int Delay[3]
Definition giaLf.c:63
Lf_Plc_t Cut[2]
Definition giaLf.c:65
unsigned fUsed
Definition giaLf.c:57
Here is the caller graph for this function:

◆ Lf_ManTtIsMux()

int Lf_ManTtIsMux ( word t)

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

Synopsis [Detect MUX truth tables.]

Description []

SideEffects []

SeeAlso []

Definition at line 271 of file giaLf.c.

272{
273 static unsigned s_Muxes[24] = {
274 (~0xAAAAAAAA & ~0xCCCCCCCC) | ( 0xAAAAAAAA & ~0xF0F0F0F0),
275 (~0xAAAAAAAA & ~0xCCCCCCCC) | ( 0xAAAAAAAA & 0xF0F0F0F0),
276 (~0xAAAAAAAA & 0xCCCCCCCC) | ( 0xAAAAAAAA & ~0xF0F0F0F0),
277 (~0xAAAAAAAA & 0xCCCCCCCC) | ( 0xAAAAAAAA & 0xF0F0F0F0),
278 ( 0xAAAAAAAA & ~0xCCCCCCCC) | (~0xAAAAAAAA & ~0xF0F0F0F0),
279 ( 0xAAAAAAAA & ~0xCCCCCCCC) | (~0xAAAAAAAA & 0xF0F0F0F0),
280 ( 0xAAAAAAAA & 0xCCCCCCCC) | (~0xAAAAAAAA & ~0xF0F0F0F0),
281 ( 0xAAAAAAAA & 0xCCCCCCCC) | (~0xAAAAAAAA & 0xF0F0F0F0),
282
283 (~0xCCCCCCCC & ~0xAAAAAAAA) | ( 0xCCCCCCCC & ~0xF0F0F0F0),
284 (~0xCCCCCCCC & ~0xAAAAAAAA) | ( 0xCCCCCCCC & 0xF0F0F0F0),
285 (~0xCCCCCCCC & 0xAAAAAAAA) | ( 0xCCCCCCCC & ~0xF0F0F0F0),
286 (~0xCCCCCCCC & 0xAAAAAAAA) | ( 0xCCCCCCCC & 0xF0F0F0F0),
287 ( 0xCCCCCCCC & ~0xAAAAAAAA) | (~0xCCCCCCCC & ~0xF0F0F0F0),
288 ( 0xCCCCCCCC & ~0xAAAAAAAA) | (~0xCCCCCCCC & 0xF0F0F0F0),
289 ( 0xCCCCCCCC & 0xAAAAAAAA) | (~0xCCCCCCCC & ~0xF0F0F0F0),
290 ( 0xCCCCCCCC & 0xAAAAAAAA) | (~0xCCCCCCCC & 0xF0F0F0F0),
291
292 (~0xF0F0F0F0 & ~0xCCCCCCCC) | ( 0xF0F0F0F0 & ~0xAAAAAAAA),
293 (~0xF0F0F0F0 & ~0xCCCCCCCC) | ( 0xF0F0F0F0 & 0xAAAAAAAA),
294 (~0xF0F0F0F0 & 0xCCCCCCCC) | ( 0xF0F0F0F0 & ~0xAAAAAAAA),
295 (~0xF0F0F0F0 & 0xCCCCCCCC) | ( 0xF0F0F0F0 & 0xAAAAAAAA),
296 ( 0xF0F0F0F0 & ~0xCCCCCCCC) | (~0xF0F0F0F0 & ~0xAAAAAAAA),
297 ( 0xF0F0F0F0 & ~0xCCCCCCCC) | (~0xF0F0F0F0 & 0xAAAAAAAA),
298 ( 0xF0F0F0F0 & 0xCCCCCCCC) | (~0xF0F0F0F0 & ~0xAAAAAAAA),
299 ( 0xF0F0F0F0 & 0xCCCCCCCC) | (~0xF0F0F0F0 & 0xAAAAAAAA)
300 };
301 int i;
302 for ( i = 0; i < 24; i++ )
303 if ( ((unsigned)t) == s_Muxes[i] )
304 return 1;
305 return 0;
306}

◆ Lf_ObjArrival_rec()

int Lf_ObjArrival_rec ( Lf_Man_t * p,
Gia_Obj_t * pDriver )

Definition at line 162 of file giaLf.c.

163{
164 if ( Gia_ObjIsBuf(pDriver) )
165 return Lf_ObjArrival_rec( p, Gia_ObjFanin0(pDriver) );
166 if ( Gia_ObjIsAnd(pDriver) )
167 return Lf_ObjReadBest(p, Gia_ObjId(p->pGia, pDriver))->Delay[0];
168 if ( Gia_ObjIsCi(pDriver) )
169 return Lf_ObjCiArrival(p, Gia_ObjCioId(pDriver));
170 return 0;
171}
int Lf_ObjArrival_rec(Lf_Man_t *p, Gia_Obj_t *pDriver)
Definition giaLf.c:162
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ObjCoArrival2_rec()

int Lf_ObjCoArrival2_rec ( Lf_Man_t * p,
Gia_Obj_t * pDriver )

Definition at line 183 of file giaLf.c.

184{
185 if ( Gia_ObjIsBuf(pDriver) )
186 return Lf_ObjCoArrival2_rec( p, Gia_ObjFanin0(pDriver) );
187 if ( Gia_ObjIsAnd(pDriver) )
188 {
189 Lf_Bst_t * pBest = Lf_ObjReadBest(p, Gia_ObjId(p->pGia, pDriver));
190 int Index = Lf_BestCutIndex( pBest );
191 assert( Index < 2 || Gia_ObjIsMux(p->pGia, pDriver) );
192 return pBest->Delay[Index];
193 }
194 if ( Gia_ObjIsCi(pDriver) )
195 return Lf_ObjCiArrival(p, Gia_ObjCioId(pDriver));
196 return 0;
197}
int Lf_ObjCoArrival2_rec(Lf_Man_t *p, Gia_Obj_t *pDriver)
Definition giaLf.c:183
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Lf_ObjMergeOrder()

void Lf_ObjMergeOrder ( Lf_Man_t * p,
int iObj )

Definition at line 1186 of file giaLf.c.

1187{
1188 word CutSet[LF_CUT_MAX][LF_CUT_WORDS] = {{0}};
1189 Lf_Cut_t * pCutSet0, * pCutSet1, * pCutSet2, * pCut0, * pCut1, * pCut2;
1190 Lf_Cut_t * pCutSet = (Lf_Cut_t *)CutSet, * pCutsR[LF_CUT_MAX];
1191 Gia_Obj_t * pObj = Gia_ManObj(p->pGia, iObj);
1192 Lf_Bst_t * pBest = Lf_ObjReadBest(p, iObj);
1193 float FlowRefs = Lf_ObjFlowRefs(p, iObj);
1194 int Required = Lf_ObjRequired(p, iObj);
1195 int nLutSize = p->pPars->fCutGroup ? p->pPars->nLutSize/2 : p->pPars->nLutSize;
1196 int nCutNum = p->pPars->nCutNum;
1197 int nCutWords = p->nCutWords;
1198 int fComp0 = Gia_ObjFaninC0(pObj);
1199 int fComp1 = Gia_ObjFaninC1(pObj);
1200 int nCuts0 = Lf_ManPrepareSet( p, Gia_ObjFaninId0(pObj, iObj), 0, &pCutSet0 );
1201 int nCuts1 = Lf_ManPrepareSet( p, Gia_ObjFaninId1(pObj, iObj), 1, &pCutSet1 );
1202 int iSibl = Gia_ObjSibl(p->pGia, iObj);
1203 int i, k, n, iCutUsed, nCutsR = 0;
1204 float Value1 = -1, Value2 = -1;
1205 assert( !Gia_ObjIsBuf(pObj) );
1206 Lf_CutSetForEachCut( nCutWords, pCutSet, pCut0, i, nCutNum )
1207 pCutsR[i] = pCut0;
1208 if ( p->Iter )
1209 {
1210 assert( nCutsR == 0 );
1211 // load cuts
1212 Lf_MemLoadCut( &p->vStoreOld, pBest->Cut[0].Handle, iObj, pCutsR[0], p->pPars->fCutMin, 1 );
1213 if ( Lf_BestDiffCuts(pBest) )
1214 Lf_MemLoadCut( &p->vStoreOld, pBest->Cut[1].Handle, iObj, pCutsR[1], p->pPars->fCutMin, 1 );
1215 // deref the cut
1216 if ( p->fUseEla && Lf_ObjMapRefNum(p, iObj) > 0 )
1217 Value1 = Lf_CutDeref_rec( p, pCutsR[Lf_BestIndex(pBest)] );
1218 // update required times
1219 if ( Required == ABC_INFINITY )//&& !p->fUseEla )
1220 Required = Lf_CutRequired( p, pCutsR[0] );
1221 // compute parameters
1222 Lf_CutParams( p, pCutsR[nCutsR++], Required, FlowRefs, pObj );
1223 if ( Lf_BestDiffCuts(pBest) )
1224 {
1225 assert( nCutsR == 1 );
1226 Lf_CutParams( p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1227 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1228 }
1229 if ( pCutsR[0]->fLate )
1230 p->nTimeFails++;
1231 }
1232 if ( iSibl )
1233 {
1234 Gia_Obj_t * pObjE = Gia_ObjSiblObj(p->pGia, iObj);
1235 int fCompE = Gia_ObjPhase(pObj) ^ Gia_ObjPhase(pObjE);
1236 int nCutsE = Lf_ManPrepareSet( p, iSibl, 2, &pCutSet2 );
1237 Lf_CutSetForEachCut( nCutWords, pCutSet2, pCut2, n, nCutsE )
1238 {
1239 if ( pCut2->pLeaves[0] == iSibl )
1240 continue;
1241 Lf_CutCopy( pCutsR[nCutsR], pCut2, nCutWords );
1242 if ( pCutsR[nCutsR]->iFunc >= 0 )
1243 pCutsR[nCutsR]->iFunc = Abc_LitNotCond( pCutsR[nCutsR]->iFunc, fCompE );
1244 Lf_CutParams( p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1245 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1246 }
1247 }
1248 if ( Gia_ObjIsMuxId(p->pGia, iObj) )
1249 {
1250 Lf_Cut_t * pCutSave = NULL;
1251 int fComp2 = Gia_ObjFaninC2(p->pGia, pObj);
1252 int nCuts2 = Lf_ManPrepareSet( p, Gia_ObjFaninId2(p->pGia, iObj), 2, &pCutSet2 );
1253 p->CutCount[0] += nCuts0 * nCuts1 * nCuts2;
1254 Lf_CutSetForEachCut( nCutWords, pCutSet0, pCut0, i, nCuts0 ) if ( (int)pCut0->nLeaves <= nLutSize )
1255 Lf_CutSetForEachCut( nCutWords, pCutSet1, pCut1, k, nCuts1 ) if ( (int)pCut1->nLeaves <= nLutSize )
1256 Lf_CutSetForEachCut( nCutWords, pCutSet2, pCut2, n, nCuts2 ) if ( (int)pCut2->nLeaves <= nLutSize )
1257 {
1258 pCutSave = pCut2;
1259 if ( Lf_CutCountBits(pCut0->Sign | pCut1->Sign | pCut2->Sign) > nLutSize )
1260 continue;
1261 p->CutCount[1]++;
1262 if ( !Lf_CutMergeOrderMux(pCut0, pCut1, pCut2, pCutsR[nCutsR], nLutSize) )
1263 continue;
1264 if ( Lf_SetLastCutIsContained(pCutsR, nCutsR) )
1265 continue;
1266 p->CutCount[2]++;
1267 if ( p->pPars->fCutMin && Lf_CutComputeTruthMux(p, pCut0, pCut1, pCut2, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
1268 pCutsR[nCutsR]->Sign = Lf_CutGetSign(pCutsR[nCutsR]);
1269 if ( p->pPars->nLutSizeMux && p->pPars->nLutSizeMux == (int)pCutsR[nCutsR]->nLeaves &&
1270 Lf_ManFindCofVar(Lf_CutTruth(p,pCutsR[nCutsR]), Abc_Truth6WordNum(nLutSize), pCutsR[nCutsR]->nLeaves) == -1 )
1271 continue;
1272 Lf_CutParams( p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1273 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1274 }
1275 if ( p->pPars->fCutGroup )
1276 {
1277 assert( pCutSave->nLeaves == 1 );
1278 assert( pCutSave->pLeaves[0] == Gia_ObjFaninId2(p->pGia, iObj) );
1279 Lf_CutSetForEachCut( nCutWords, pCutSet0, pCut0, i, nCuts0 ) if ( (int)pCut0->nLeaves <= nLutSize )
1280 Lf_CutSetForEachCut( nCutWords, pCutSet1, pCut1, k, nCuts1 ) if ( (int)pCut1->nLeaves <= nLutSize )
1281 {
1282 assert( (int)pCut0->nLeaves + (int)pCut1->nLeaves + 1 <= p->pPars->nLutSize );
1283 // if ( Lf_CutCountBits(pCut0->Sign | pCut1->Sign | pCutSave->Sign) > p->pPars->nLutSize )
1284 // continue;
1285 p->CutCount[1]++;
1286 if ( !Lf_CutMergeOrderMux(pCut0, pCut1, pCutSave, pCutsR[nCutsR], p->pPars->nLutSize) )
1287 continue;
1288 if ( Lf_SetLastCutIsContained(pCutsR, nCutsR) )
1289 continue;
1290 p->CutCount[2]++;
1291 if ( p->pPars->fCutMin && Lf_CutComputeTruthMux(p, pCut0, pCut1, pCutSave, fComp0, fComp1, fComp2, pCutsR[nCutsR]) )
1292 pCutsR[nCutsR]->Sign = Lf_CutGetSign(pCutsR[nCutsR]);
1293 // if ( p->pPars->nLutSizeMux && p->pPars->nLutSizeMux == (int)pCutsR[nCutsR]->nLeaves &&
1294 // Lf_ManFindCofVar(Lf_CutTruth(p,pCutsR[nCutsR]), Abc_Truth6WordNum(nLutSize), pCutsR[nCutsR]->nLeaves) == -1 )
1295 // continue;
1296 Lf_CutParams( p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1297 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1298 }
1299 }
1300 }
1301 else
1302 {
1303 int fIsXor = Gia_ObjIsXor(pObj);
1304 p->CutCount[0] += nCuts0 * nCuts1;
1305 Lf_CutSetForEachCut( nCutWords, pCutSet0, pCut0, i, nCuts0 ) if ( (int)pCut0->nLeaves <= nLutSize )
1306 Lf_CutSetForEachCut( nCutWords, pCutSet1, pCut1, k, nCuts1 ) if ( (int)pCut1->nLeaves <= nLutSize )
1307 {
1308 if ( (int)(pCut0->nLeaves + pCut1->nLeaves) > nLutSize && Lf_CutCountBits(pCut0->Sign | pCut1->Sign) > nLutSize )
1309 continue;
1310 p->CutCount[1]++;
1311 if ( !Lf_CutMergeOrder(pCut0, pCut1, pCutsR[nCutsR], nLutSize) )
1312 continue;
1313 if ( Lf_SetLastCutIsContained(pCutsR, nCutsR) )
1314 continue;
1315 p->CutCount[2]++;
1316 if ( p->pPars->fCutMin && Lf_CutComputeTruth(p, pCut0, pCut1, fComp0, fComp1, pCutsR[nCutsR], fIsXor) )
1317 pCutsR[nCutsR]->Sign = Lf_CutGetSign(pCutsR[nCutsR]);
1318 if ( p->pPars->nLutSizeMux && p->pPars->nLutSizeMux == (int)pCutsR[nCutsR]->nLeaves &&
1319 Lf_ManFindCofVar(Lf_CutTruth(p,pCutsR[nCutsR]), Abc_Truth6WordNum(nLutSize), pCutsR[nCutsR]->nLeaves) == -1 )
1320 continue;
1321 Lf_CutParams( p, pCutsR[nCutsR], Required, FlowRefs, pObj );
1322 nCutsR = Lf_SetAddCut( pCutsR, nCutsR, nCutNum );
1323 }
1324 }
1325 // debug printout
1326 if ( 0 )
1327 {
1328 printf( "*** Obj = %d FlowRefs = %.2f MapRefs = %2d Required = %2d\n", iObj, FlowRefs, Lf_ObjMapRefNum(p, iObj), Required );
1329 for ( i = 0; i < nCutsR; i++ )
1330 Lf_CutPrint( p, pCutsR[i] );
1331 printf( "\n" );
1332 }
1333 // verify
1334 assert( nCutsR > 0 && nCutsR < nCutNum );
1335// assert( Lf_SetCheckArray(pCutsR, nCutsR) );
1336 // delay cut
1337 assert( nCutsR == 1 || pCutsR[0]->Delay <= pCutsR[1]->Delay );
1338 pBest->Cut[0].fUsed = pBest->Cut[1].fUsed = 0;
1339 pBest->Cut[0].Handle = pBest->Cut[1].Handle = Lf_MemSaveCut(&p->vStoreNew, pCutsR[0], iObj);
1340 pBest->Delay[0] = pBest->Delay[1] = pCutsR[0]->Delay;
1341 pBest->Flow[0] = pBest->Flow[1] = pCutsR[0]->Flow;
1342 p->nCutCounts[pCutsR[0]->nLeaves]++;
1343 p->CutCount[3] += nCutsR;
1344 p->nCutEqual++;
1345 // area cut
1346 iCutUsed = 0;
1347 if ( nCutsR > 1 && pCutsR[0]->Flow > pCutsR[1]->Flow + LF_EPSILON )//&& !pCutsR[1]->fLate ) // can remove !fLate
1348 {
1349 pBest->Cut[1].Handle = Lf_MemSaveCut(&p->vStoreNew, pCutsR[1], iObj);
1350 pBest->Delay[1] = pCutsR[1]->Delay;
1351 pBest->Flow[1] = pCutsR[1]->Flow;
1352 p->nCutCounts[pCutsR[1]->nLeaves]++;
1353 p->nCutEqual--;
1354 if ( !pCutsR[1]->fLate )
1355 iCutUsed = 1;
1356 }
1357 // mux cut
1358 if ( p->pPars->fUseMux7 && Gia_ObjIsMuxId(p->pGia, iObj) )
1359 {
1360 pCut2 = Lf_ObjCutMux( p, iObj );
1361 Lf_CutParams( p, pCut2, Required, FlowRefs, pObj );
1362 pBest->Delay[2] = pCut2->Delay;
1363 pBest->Flow[2] = pCut2->Flow;
1364 // update area value of the best area cut
1365// if ( !pCut2->fLate )
1366// pBest->Flow[1] = Abc_MinFloat( pBest->Flow[1], pBest->Flow[2] );
1367 }
1368 // reference resulting cut
1369 if ( p->fUseEla )
1370 {
1371 pBest->Cut[iCutUsed].fUsed = 1;
1372 if ( Lf_ObjMapRefNum(p, iObj) > 0 )
1373 Value2 = Lf_CutRef_rec( p, pCutsR[iCutUsed] );
1374// if ( Value1 < Value2 )
1375// printf( "ELA degradated cost at node %d from %d to %d.\n", iObj, Value1, Value2 ), fflush(stdout);
1376// assert( Value1 >= Value2 );
1377// if ( Value1 != -1 )
1378// printf( "%.2f -> %.2f ", Value1, Value2 );
1379 }
1380 if ( pObj->Value == 0 )
1381 return;
1382 // store the cutset
1383 pCutSet = Lf_ManFetchSet(p, iObj);
1384 Lf_CutSetForEachCut( nCutWords, pCutSet, pCut0, i, nCutNum )
1385 {
1386 assert( !pCut0->fMux7 );
1387 if ( i < nCutsR )
1388 Lf_CutCopy( pCut0, pCutsR[i], nCutWords );
1389 else if ( i == nCutsR && pCutsR[0]->nLeaves > 1 && (nCutsR == 1 || pCutsR[1]->nLeaves > 1) )
1390 Lf_CutCreateUnit( pCut0, iObj );
1391 else
1392 pCut0->nLeaves = LF_NO_LEAF;
1393 }
1394}
#define Lf_CutSetForEachCut(nWords, pCutSet, pCut, i, nCuts)
Definition giaLf.c:134
#define LF_EPSILON
Definition giaLf.c:39
#define LF_NO_LEAF
Definition giaLf.c:36
float Flow[3]
Definition giaLf.c:64
float Flow
Definition giaLf.c:46
int Delay
Definition giaLf.c:45
word Sign
Definition giaLf.c:44
unsigned Handle
Definition giaLf.c:58
Here is the call graph for this function:
Here is the caller graph for this function: