abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
llb4Map.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [llb2Map.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [BDD based reachability.]
8 
9  Synopsis [Non-linear quantification scheduling.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: llb2Map.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "llbInt.h"
22 #include "base/abc/abc.h"
23 #include "map/if/if.h"
24 
26 
27 
28 ////////////////////////////////////////////////////////////////////////
29 /// DECLARATIONS ///
30 ////////////////////////////////////////////////////////////////////////
31 
32 ////////////////////////////////////////////////////////////////////////
33 /// FUNCTION DEFINITIONS ///
34 ////////////////////////////////////////////////////////////////////////
35 
36 /**Function*************************************************************
37 
38  Synopsis [Returns internal nodes used in the mapping.]
39 
40  Description []
41 
42  SideEffects []
43 
44  SeeAlso []
45 
46 ***********************************************************************/
47 Vec_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
66  Gia_ManSetIfParsDefault( pPars );
67  pPars->nLutSize = nLutSize;
68 
69  // get timing information
70  pPars->pTimesArr = Abc_NtkGetCiArrivalFloats(pNtk);
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 
117 ////////////////////////////////////////////////////////////////////////
118 /// END OF FILE ///
119 ////////////////////////////////////////////////////////////////////////
120 
121 
123 
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
unsigned nLeaves
Definition: if.h:289
int nLutSize
Definition: if.h:103
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition: aig.h:50
Definition: if.h:100
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Definition: if.h:303
void * pData
Definition: aig.h:87
static Aig_Obj_t * Aig_ObjFanin0(Aig_Obj_t *pObj)
Definition: aig.h:308
ABC_DLL float * Abc_NtkGetCoRequiredFloats(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:676
unsigned int fMarkA
Definition: aig.h:79
static If_Cut_t * If_ObjCutBest(If_Obj_t *pObj)
Definition: if.h:401
int nRefs
Definition: if.h:318
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
void Gia_ManSetIfParsDefault(void *pIfPars)
FUNCTION DEFINITIONS ///.
Definition: giaIf.c:57
Abc_Obj_t * pCopy
Definition: abc.h:148
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
ABC_NAMESPACE_IMPL_START If_Man_t * Abc_NtkToIf(Abc_Ntk_t *pNtk, If_Par_t *pPars)
DECLARATIONS ///.
Definition: abcIf.c:188
#define Saig_ManForEachLi(p, pObj, i)
Definition: saig.h:98
Definition: if.h:180
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
if(last==0)
Definition: sparse_int.h:34
float * pTimesArr
Definition: if.h:161
Definition: aig.h:69
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
float * pTimesReq
Definition: if.h:162
ABC_NAMESPACE_IMPL_START Vec_Int_t * Llb_AigMap(Aig_Man_t *pAig, int nLutSize, int nLutMin)
DECLARATIONS ///.
Definition: llb4Map.c:47
Abc_Ntk_t * Abc_NtkFromAigPhase(Aig_Man_t *pMan)
Definition: abcDar.c:590
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
ABC_DLL float * Abc_NtkGetCiArrivalFloats(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:658
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
void Aig_ManCleanMarkA(Aig_Man_t *p)
Definition: aigUtil.c:148
static int Aig_ObjId(Aig_Obj_t *pObj)
Definition: aig.h:286
#define assert(ex)
Definition: util_old.h:213
void If_ManStop(If_Man_t *p)
Definition: ifMan.c:205