ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcPlace.c
Go to the documentation of this file.
1
20
21#include "base/abc/abc.h"
22
23// placement includes
25
27
28
32
36int nAllocSize = 0;
37
41
53static inline void Abc_PlaceCreateCell( Abc_Obj_t * pObj, int fAnd )
54{
55 assert( cells[pObj->Id].m_id == 0 );
56
57 cells[pObj->Id].m_id = pObj->Id;
58 cells[pObj->Id].m_label = "";
59 cells[pObj->Id].m_parent = &(abstractCells[fAnd]);
60 cells[pObj->Id].m_fixed = 0;
61 addConcreteCell(&(cells[pObj->Id]));
62}
63
75static inline void Abc_PlaceUpdateNet( Abc_Obj_t * pObj )
76{
77 Abc_Obj_t * pFanout;
78 int k;
79 // free the old array of net terminals
80 if ( nets[pObj->Id].m_terms )
81 free( nets[pObj->Id].m_terms );
82 // fill in the net with the new information
83 nets[pObj->Id].m_id = pObj->Id;
84 nets[pObj->Id].m_weight = 1.0;
85 nets[pObj->Id].m_numTerms = Abc_ObjFanoutNum(pObj); //fanout
86 nets[pObj->Id].m_terms = ALLOC(ConcreteCell*, Abc_ObjFanoutNum(pObj));
87 Abc_ObjForEachFanout( pObj, pFanout, k )
88 nets[pObj->Id].m_terms[k] = &(cells[pFanout->Id]);
89 addConcreteNet(&(nets[pObj->Id]));
90}
91
103float Abc_PlaceEvaluateCut( Abc_Obj_t * pRoot, Vec_Ptr_t * vFanins )
104{
105 Abc_Obj_t * pObj;
106// double x, y;
107 int i;
108 Vec_PtrForEachEntry( Abc_Obj_t *, vFanins, pObj, i )
109 {
110// pObj->Id
111 }
112 return 0.0;
113}
114
126void Abc_PlaceUpdate( Vec_Ptr_t * vAddedCells, Vec_Ptr_t * vUpdatedNets )
127{
128 Abc_Obj_t * pObj, * pFanin;
129 int i, k;
130 Vec_Ptr_t * vCells, * vNets;
131
132 // start the arrays of new cells and nets
133 vCells = Vec_PtrAlloc( 16 );
134 vNets = Vec_PtrAlloc( 32 );
135
136 // go through the new nodes
137 Vec_PtrForEachEntry( Abc_Obj_t *, vAddedCells, pObj, i )
138 {
139 assert( !Abc_ObjIsComplement(pObj) );
140 Abc_PlaceCreateCell( pObj, 1 );
141 Abc_PlaceUpdateNet( pObj );
142
143 // add the new cell and its fanin nets to temporary storage
144 Vec_PtrPush( vCells, &(cells[pObj->Id]) );
145 Abc_ObjForEachFanin( pObj, pFanin, k )
146 Vec_PtrPushUnique( vNets, &(nets[pFanin->Id]) );
147 }
148
149 // go through the modified nets
150 Vec_PtrForEachEntry( Abc_Obj_t *, vUpdatedNets, pObj, i )
151 {
152 assert( !Abc_ObjIsComplement(pObj) );
153 if ( Abc_ObjType(pObj) == ABC_OBJ_NONE ) // dead node
154 continue;
155 Abc_PlaceUpdateNet( pObj );
156 }
157
158 // update the placement
159// fastPlace( Vec_PtrSize(vCells), (ConcreteCell **)Vec_PtrArray(vCells),
160// Vec_PtrSize(vNets), (ConcreteNet **)Vec_PtrArray(vNets) );
161
162 // clean up
163 Vec_PtrFree( vCells );
164 Vec_PtrFree( vNets );
165}
166
179{
180 Abc_Obj_t * pObj;
181 int i;
182
183 // allocate and clean internal storage
184 nAllocSize = 5 * Abc_NtkObjNumMax(pNtk);
187 memset( cells, 0, sizeof(ConcreteCell) * nAllocSize );
188 memset( nets, 0, sizeof(ConcreteNet) * nAllocSize );
189
190 // create AbstractCells
191 // 1: pad
192 // 2: and
193 if (!abstractCells)
195
196 abstractCells[0].m_height = 1.0;
197 abstractCells[0].m_width = 1.0;
198 abstractCells[0].m_label = "pio";
199 abstractCells[0].m_pad = 1;
200
201 abstractCells[1].m_height = 1.0;
202 abstractCells[1].m_width = 1.0;
203 abstractCells[1].m_label = "and";
204 abstractCells[1].m_pad = 0;
205
206 // input pads
207 Abc_NtkForEachCi( pNtk, pObj, i )
208 Abc_PlaceCreateCell( pObj, 0 );
209
210 // ouput pads
211 Abc_NtkForEachCo( pNtk, pObj, i )
212 Abc_PlaceCreateCell( pObj, 0 );
213
214 // AND nodes
215 Abc_AigForEachAnd( pNtk, pObj, i )
216 Abc_PlaceCreateCell( pObj, 1 );
217
218 // all nets
219 Abc_NtkForEachObj( pNtk, pObj, i )
220 {
221 if ( !Abc_ObjIsCi(pObj) && !Abc_ObjIsNode(pObj) )
222 continue;
223 Abc_PlaceUpdateNet( pObj );
224 }
225
226 globalPreplace((float)0.8);
227 globalPlace();
228}
229
242{
243 int i;
244
245
246 // clean up
247 for ( i = 0; i < nAllocSize; i++ )
248 FREE( nets[i].m_terms );
250 FREE( cells );
251 FREE( nets );
252}
253
257
258
260
void Abc_PlaceUpdate(Vec_Ptr_t *vAddedCells, Vec_Ptr_t *vUpdatedNets)
Definition abcPlace.c:126
ABC_NAMESPACE_IMPL_START AbstractCell * abstractCells
DECLARATIONS ///.
Definition abcPlace.c:33
int nAllocSize
Definition abcPlace.c:36
ConcreteNet * nets
Definition abcPlace.c:35
ConcreteCell * cells
Definition abcPlace.c:34
void Abc_PlaceBegin(Abc_Ntk_t *pNtk)
Definition abcPlace.c:178
void Abc_PlaceEnd(Abc_Ntk_t *pNtk)
Definition abcPlace.c:241
float Abc_PlaceEvaluateCut(Abc_Obj_t *pRoot, Vec_Ptr_t *vFanins)
Definition abcPlace.c:103
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition abc.h:488
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition abc.h:449
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
@ ABC_OBJ_NONE
Definition abc.h:87
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define ALLOC(type, num)
Definition avl.h:27
#define FREE(obj)
Definition avl.h:31
#define REALLOC(type, obj, num)
Definition avl.h:29
void addConcreteNet(ConcreteNet *net)
Adds a net to the placement database.
Definition place_base.c:114
void addConcreteCell(ConcreteCell *cell)
Definition place_base.c:155
void globalPreplace(float utilization)
Place pad ring, leaving a core area to meet a desired utilization.
Definition place_pads.c:31
void globalPlace()
Performs analytic placement using a GORDIAN-like algorithm.
int Id
Definition abc.h:132
#define assert(ex)
Definition util_old.h:213
char * memset()
VOID_HACK free()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55