ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
llb4Map.c
Go to the documentation of this file.
1
20
21#include "llbInt.h"
22#include "base/abc/abc.h"
23#include "map/if/if.h"
24
26
27
31
35
47Vec_Int_t * Llb_AigMap( Aig_Man_t * pAig, int nLutSize, int nLutMin )
48{
49 extern Abc_Ntk_t * Abc_NtkFromAigPhase( Aig_Man_t * pMan );
50 extern If_Man_t * Abc_NtkToIf( Abc_Ntk_t * pNtk, If_Par_t * pPars );
51 extern void Gia_ManSetIfParsDefault( void * pPars );
52 If_Par_t Pars, * pPars = &Pars;
53 If_Man_t * pIfMan;
54 If_Obj_t * pAnd;
55 Abc_Ntk_t * pNtk;
56 Abc_Obj_t * pNode;
57 Vec_Int_t * vNodes;
58 Aig_Obj_t * pObj;
59 int i;
60
61 // create ABC network
62 pNtk = Abc_NtkFromAigPhase( pAig );
63 assert( Abc_NtkIsStrash(pNtk) );
64
65 // derive mapping parameters
67 pPars->nLutSize = nLutSize;
68
69 // get timing information
72
73 // perform LUT mapping
74 pIfMan = Abc_NtkToIf( pNtk, pPars );
75 if ( pIfMan == NULL )
76 {
77 Abc_NtkDelete( pNtk );
78 return NULL;
79 }
80 if ( !If_ManPerformMapping( pIfMan ) )
81 {
82 Abc_NtkDelete( pNtk );
83 If_ManStop( pIfMan );
84 return NULL;
85 }
86
87 // mark nodes in the AIG used in the mapping
88 Aig_ManCleanMarkA( pAig );
89 Aig_ManForEachNode( pAig, pObj, i )
90 {
91 pNode = (Abc_Obj_t *)pObj->pData;
92 if ( pNode == NULL )
93 continue;
94 pAnd = (If_Obj_t *)pNode->pCopy;
95 if ( pAnd == NULL )
96 continue;
97 if ( pAnd->nRefs > 0 && (int)If_ObjCutBest(pAnd)->nLeaves >= nLutMin )
98 pObj->fMarkA = 1;
99 }
100 Abc_NtkDelete( pNtk );
101 If_ManStop( pIfMan );
102
103 // unmark flop drivers
104 Saig_ManForEachLi( pAig, pObj, i )
105 Aig_ObjFanin0(pObj)->fMarkA = 0;
106
107 // collect mapping
108 vNodes = Vec_IntAlloc( 100 );
109 Aig_ManForEachNode( pAig, pObj, i )
110 if ( pObj->fMarkA )
111 Vec_IntPush( vNodes, Aig_ObjId(pObj) );
112 Aig_ManCleanMarkA( pAig );
113 return vNodes;
114}
115
116
120
121
123
ABC_NAMESPACE_IMPL_START If_Man_t * Abc_NtkToIf(Abc_Ntk_t *pNtk, If_Par_t *pPars)
DECLARATIONS ///.
Definition abcIf.c:209
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
ABC_DLL float * Abc_NtkGetCoRequiredFloats(Abc_Ntk_t *pNtk)
Definition abcTiming.c:802
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL float * Abc_NtkGetCiArrivalFloats(Abc_Ntk_t *pNtk)
Definition abcTiming.c:789
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition aigUtil.c:148
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
#define Aig_ManForEachNode(p, pObj, i)
Definition aig.h:413
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
DECLARATIONS ///.
Definition abcDar.c:595
void Gia_ManSetIfParsDefault(void *pIfPars)
FUNCTION DEFINITIONS ///.
Definition giaIf.c:59
struct If_Par_t_ If_Par_t
Definition if.h:78
void If_ManStop(If_Man_t *p)
Definition ifMan.c:212
int If_ManPerformMapping(If_Man_t *p)
Definition ifCore.c:82
struct If_Man_t_ If_Man_t
BASIC TYPES ///.
Definition if.h:77
struct If_Obj_t_ If_Obj_t
Definition if.h:79
ABC_NAMESPACE_IMPL_START Vec_Int_t * Llb_AigMap(Aig_Man_t *pAig, int nLutSize, int nLutMin)
DECLARATIONS ///.
Definition llb4Map.c:47
#define Saig_ManForEachLi(p, pObj, i)
Definition saig.h:98
Abc_Obj_t * pCopy
Definition abc.h:148
unsigned int fMarkA
Definition aig.h:79
void * pData
Definition aig.h:87
int nRefs
Definition if.h:346
float * pTimesArr
Definition if.h:176
int nLutSize
Definition if.h:104
float * pTimesReq
Definition if.h:177
#define assert(ex)
Definition util_old.h:213