abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcRewrite.c File Reference
#include "base/abc/abc.h"
#include "opt/rwr/rwr.h"
#include "bool/dec/dec.h"

Go to the source code of this file.

Functions

static
ABC_NAMESPACE_IMPL_START
Cut_Man_t
Abc_NtkStartCutManForRewrite (Abc_Ntk_t *pNtk)
 DECLARATIONS ///. More...
 
static void Abc_NodePrintCuts (Abc_Obj_t *pNode)
 
static void Abc_ManShowCutCone (Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves)
 
void Abc_PlaceBegin (Abc_Ntk_t *pNtk)
 
void Abc_PlaceEnd (Abc_Ntk_t *pNtk)
 
void Abc_PlaceUpdate (Vec_Ptr_t *vAddedCells, Vec_Ptr_t *vUpdatedNets)
 
int Abc_NtkRewrite (Abc_Ntk_t *pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable)
 FUNCTION DEFINITIONS ///. More...
 
void Abc_ManRewritePrintDivs (Vec_Ptr_t *vDivs, int nLeaves)
 
void Abc_ManShowCutCone_rec (Abc_Obj_t *pNode, Vec_Ptr_t *vDivs)
 
void Abc_RwrExpWithCut_rec (Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, int fUseA)
 
void Abc_RwrExpWithCut (Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves)
 

Function Documentation

void Abc_ManRewritePrintDivs ( Vec_Ptr_t vDivs,
int  nLeaves 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file abcRewrite.c.

270 {
271  Abc_Obj_t * pFanin, * pNode, * pRoot;
272  int i, k;
273  pRoot = (Abc_Obj_t *)Vec_PtrEntryLast(vDivs);
274  // print the nodes
275  Vec_PtrForEachEntry( Abc_Obj_t *, vDivs, pNode, i )
276  {
277  if ( i < nLeaves )
278  {
279  printf( "%6d : %c\n", pNode->Id, 'a'+i );
280  continue;
281  }
282  printf( "%6d : %2d = ", pNode->Id, i );
283  // find the first fanin
284  Vec_PtrForEachEntry( Abc_Obj_t *, vDivs, pFanin, k )
285  if ( Abc_ObjFanin0(pNode) == pFanin )
286  break;
287  if ( k < nLeaves )
288  printf( "%c", 'a' + k );
289  else
290  printf( "%d", k );
291  printf( "%s ", Abc_ObjFaninC0(pNode)? "\'" : "" );
292  // find the second fanin
293  Vec_PtrForEachEntry( Abc_Obj_t *, vDivs, pFanin, k )
294  if ( Abc_ObjFanin1(pNode) == pFanin )
295  break;
296  if ( k < nLeaves )
297  printf( "%c", 'a' + k );
298  else
299  printf( "%d", k );
300  printf( "%s ", Abc_ObjFaninC1(pNode)? "\'" : "" );
301  if ( pNode == pRoot )
302  printf( " root" );
303  printf( "\n" );
304  }
305  printf( "\n" );
306 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static void * Vec_PtrEntryLast(Vec_Ptr_t *p)
Definition: vecPtr.h:413
if(last==0)
Definition: sparse_int.h:34
else
Definition: sparse_int.h:55
int Id
Definition: abc.h:132
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_ManShowCutCone ( Abc_Obj_t pNode,
Vec_Ptr_t vLeaves 
)
static

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 340 of file abcRewrite.c.

341 {
342  Abc_Ntk_t * pNtk = pNode->pNtk;
343  Abc_Obj_t * pObj;
344  Vec_Ptr_t * vDivs;
345  int i;
346  vDivs = Vec_PtrAlloc( 100 );
347  Abc_NtkIncrementTravId( pNtk );
348  Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
349  {
351  Vec_PtrPush( vDivs, Abc_ObjRegular(pObj) );
352  }
353  Abc_ManShowCutCone_rec( pNode, vDivs );
354  Abc_ManRewritePrintDivs( vDivs, Vec_PtrSize(vLeaves) );
355  Vec_PtrFree( vDivs );
356 }
void Abc_ManRewritePrintDivs(Vec_Ptr_t *vDivs, int nLeaves)
Definition: abcRewrite.c:269
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
void Abc_ManShowCutCone_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vDivs)
Definition: abcRewrite.c:319
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
Abc_Ntk_t * pNtk
Definition: abc.h:130
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_ManShowCutCone_rec ( Abc_Obj_t pNode,
Vec_Ptr_t vDivs 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 319 of file abcRewrite.c.

320 {
321  if ( Abc_NodeIsTravIdCurrent(pNode) )
322  return;
324  Abc_ManShowCutCone_rec( Abc_ObjFanin0(pNode), vDivs );
325  Abc_ManShowCutCone_rec( Abc_ObjFanin1(pNode), vDivs );
326  Vec_PtrPush( vDivs, pNode );
327 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
void Abc_ManShowCutCone_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vDivs)
Definition: abcRewrite.c:319
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static void Abc_NodeSetTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:409
void Abc_NodePrintCuts ( Abc_Obj_t pNode)
static

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

Synopsis [Prints the cuts at the nodes.]

Description []

SideEffects []

SeeAlso []

Definition at line 240 of file abcRewrite.c.

241 {
242  Vec_Ptr_t * vCuts;
243  Cut_Cut_t * pCut;
244  int k;
245 
246  printf( "\nNode %s\n", Abc_ObjName(pNode) );
247  vCuts = (Vec_Ptr_t *)pNode->pCopy;
248  Vec_PtrForEachEntry( Cut_Cut_t *, vCuts, pCut, k )
249  {
250  Extra_PrintBinary( stdout, (unsigned *)&pCut->uSign, 16 );
251  printf( " " );
252  Cut_CutPrint( pCut, 0 );
253  printf( "\n" );
254  }
255 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Abc_Obj_t * pCopy
Definition: abc.h:148
unsigned uSign
Definition: cut.h:85
void Cut_CutPrint(Cut_Cut_t *pCut, int fSeq)
Definition: cutCut.c:276
void Extra_PrintBinary(FILE *pFile, unsigned Sign[], int nBits)
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition: abcNames.c:48
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Abc_NtkRewrite ( Abc_Ntk_t pNtk,
int  fUpdateLevel,
int  fUseZeros,
int  fVerbose,
int  fVeryVerbose,
int  fPlaceEnable 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Performs incremental rewriting of the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 61 of file abcRewrite.c.

62 {
63  extern void Dec_GraphUpdateNetwork( Abc_Obj_t * pRoot, Dec_Graph_t * pGraph, int fUpdateLevel, int nGain );
64  ProgressBar * pProgress;
65  Cut_Man_t * pManCut;
66  Rwr_Man_t * pManRwr;
67  Abc_Obj_t * pNode;
68 // Vec_Ptr_t * vAddedCells = NULL, * vUpdatedNets = NULL;
69  Dec_Graph_t * pGraph;
70  int i, nNodes, nGain, fCompl;
71  abctime clk, clkStart = Abc_Clock();
72 
73  assert( Abc_NtkIsStrash(pNtk) );
74  // cleanup the AIG
76 /*
77  {
78  Vec_Vec_t * vParts;
79  vParts = Abc_NtkPartitionSmart( pNtk, 50, 1 );
80  Vec_VecFree( vParts );
81  }
82 */
83 
84  // start placement package
85 // if ( fPlaceEnable )
86 // {
87 // Abc_PlaceBegin( pNtk );
88 // vAddedCells = Abc_AigUpdateStart( pNtk->pManFunc, &vUpdatedNets );
89 // }
90 
91  // start the rewriting manager
92  pManRwr = Rwr_ManStart( 0 );
93  if ( pManRwr == NULL )
94  return 0;
95  // compute the reverse levels if level update is requested
96  if ( fUpdateLevel )
97  Abc_NtkStartReverseLevels( pNtk, 0 );
98  // start the cut manager
99 clk = Abc_Clock();
100  pManCut = Abc_NtkStartCutManForRewrite( pNtk );
101 Rwr_ManAddTimeCuts( pManRwr, Abc_Clock() - clk );
102  pNtk->pManCut = pManCut;
103 
104  if ( fVeryVerbose )
105  Rwr_ScoresClean( pManRwr );
106 
107  // resynthesize each node once
108  pManRwr->nNodesBeg = Abc_NtkNodeNum(pNtk);
109  nNodes = Abc_NtkObjNumMax(pNtk);
110  pProgress = Extra_ProgressBarStart( stdout, nNodes );
111  Abc_NtkForEachNode( pNtk, pNode, i )
112  {
113  Extra_ProgressBarUpdate( pProgress, i, NULL );
114  // stop if all nodes have been tried once
115  if ( i >= nNodes )
116  break;
117  // skip persistant nodes
118  if ( Abc_NodeIsPersistant(pNode) )
119  continue;
120  // skip the nodes with many fanouts
121  if ( Abc_ObjFanoutNum(pNode) > 1000 )
122  continue;
123 
124  // for each cut, try to resynthesize it
125  nGain = Rwr_NodeRewrite( pManRwr, pManCut, pNode, fUpdateLevel, fUseZeros, fPlaceEnable );
126  if ( !(nGain > 0 || (nGain == 0 && fUseZeros)) )
127  continue;
128  // if we end up here, a rewriting step is accepted
129 
130  // get hold of the new subgraph to be added to the AIG
131  pGraph = (Dec_Graph_t *)Rwr_ManReadDecs(pManRwr);
132  fCompl = Rwr_ManReadCompl(pManRwr);
133 
134  // reset the array of the changed nodes
135  if ( fPlaceEnable )
137 
138  // complement the FF if needed
139  if ( fCompl ) Dec_GraphComplement( pGraph );
140 clk = Abc_Clock();
141  Dec_GraphUpdateNetwork( pNode, pGraph, fUpdateLevel, nGain );
142 Rwr_ManAddTimeUpdate( pManRwr, Abc_Clock() - clk );
143  if ( fCompl ) Dec_GraphComplement( pGraph );
144 
145  // use the array of changed nodes to update placement
146 // if ( fPlaceEnable )
147 // Abc_PlaceUpdate( vAddedCells, vUpdatedNets );
148  }
149  Extra_ProgressBarStop( pProgress );
150 Rwr_ManAddTimeTotal( pManRwr, Abc_Clock() - clkStart );
151  // print stats
152  pManRwr->nNodesEnd = Abc_NtkNodeNum(pNtk);
153  if ( fVerbose )
154  Rwr_ManPrintStats( pManRwr );
155 // Rwr_ManPrintStatsFile( pManRwr );
156  if ( fVeryVerbose )
157  Rwr_ScoresReport( pManRwr );
158  // delete the managers
159  Rwr_ManStop( pManRwr );
160  Cut_ManStop( pManCut );
161  pNtk->pManCut = NULL;
162 
163  // start placement package
164 // if ( fPlaceEnable )
165 // {
166 // Abc_PlaceEnd( pNtk );
167 // Abc_AigUpdateStop( pNtk->pManFunc );
168 // }
169 
170  // put the nodes into the DFS order and reassign their IDs
171  {
172 // abctime clk = Abc_Clock();
173  Abc_NtkReassignIds( pNtk );
174 // ABC_PRT( "time", Abc_Clock() - clk );
175  }
176 // Abc_AigCheckFaninOrder( pNtk->pManFunc );
177  // fix the levels
178  if ( fUpdateLevel )
179  Abc_NtkStopReverseLevels( pNtk );
180  else
181  Abc_NtkLevel( pNtk );
182  // check
183  if ( !Abc_NtkCheck( pNtk ) )
184  {
185  printf( "Abc_NtkRewrite: The network check has failed.\n" );
186  return 0;
187  }
188  return 1;
189 }
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
int Rwr_ManReadCompl(Rwr_Man_t *p)
Definition: rwrMan.c:245
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
int nNodesEnd
Definition: rwr.h:83
Definition: rwr.h:50
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
int nNodesBeg
Definition: rwr.h:82
void Dec_GraphUpdateNetwork(Abc_Obj_t *pRoot, Dec_Graph_t *pGraph, int fUpdateLevel, int nGain)
Definition: decAbc.c:240
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static abctime Abc_Clock()
Definition: abc_global.h:279
DECLARATIONS ///.
Definition: abcAig.c:52
ABC_DLL void Abc_NtkStopReverseLevels(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:1190
ABC_DLL void Abc_NtkReassignIds(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1769
void Rwr_ManAddTimeTotal(Rwr_Man_t *p, abctime Time)
Definition: rwrMan.c:293
void * pManFunc
Definition: abc.h:191
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
DECLARATIONS ///.
ABC_DLL int Abc_AigCleanup(Abc_Aig_t *pMan)
Definition: abcAig.c:194
void Rwr_ManPrintStats(Rwr_Man_t *p)
Definition: rwrMan.c:143
void Cut_ManStop(Cut_Man_t *p)
Definition: cutMan.c:124
void * Rwr_ManReadDecs(Rwr_Man_t *p)
Definition: rwrMan.c:213
Rwr_Man_t * Rwr_ManStart(int fPrecompute)
DECLARATIONS ///.
Definition: rwrMan.c:47
void * pManCut
Definition: abc.h:193
void Rwr_ManAddTimeUpdate(Rwr_Man_t *p, abctime Time)
Definition: rwrMan.c:277
ABC_DLL void Abc_NtkStartReverseLevels(Abc_Ntk_t *pNtk, int nMaxLevelIncrease)
Definition: abcTiming.c:1162
void Extra_ProgressBarStop(ProgressBar *p)
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
static int Abc_NodeIsPersistant(Abc_Obj_t *pNode)
Definition: abc.h:401
void Rwr_ManAddTimeCuts(Rwr_Man_t *p, abctime Time)
Definition: rwrMan.c:261
void Rwr_ScoresReport(Rwr_Man_t *p)
Definition: rwrEva.c:550
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
static ABC_NAMESPACE_IMPL_START Cut_Man_t * Abc_NtkStartCutManForRewrite(Abc_Ntk_t *pNtk)
DECLARATIONS ///.
Definition: abcRewrite.c:203
ABC_DLL void Abc_AigUpdateReset(Abc_Aig_t *pMan)
Definition: abcAig.c:1460
ABC_INT64_T abctime
Definition: abc_global.h:278
ABC_DLL int Abc_NtkLevel(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1265
void Rwr_ManStop(Rwr_Man_t *p)
Definition: rwrMan.c:109
int Rwr_NodeRewrite(Rwr_Man_t *p, Cut_Man_t *pManCut, Abc_Obj_t *pNode, int fUpdateLevel, int fUseZeros, int fPlaceEnable)
FUNCTION DEFINITIONS ///.
Definition: rwrEva.c:59
void Rwr_ScoresClean(Rwr_Man_t *p)
Definition: rwrEva.c:504
static void Dec_GraphComplement(Dec_Graph_t *pGraph)
Definition: dec.h:388
Cut_Man_t * Abc_NtkStartCutManForRewrite ( Abc_Ntk_t pNtk)
static

DECLARATIONS ///.

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

FileName [abcRewrite.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Technology-independent resynthesis of the AIG based on DAG aware rewriting.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

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

Synopsis [Starts the cut manager for rewriting.]

Description []

SideEffects []

SeeAlso []

Definition at line 203 of file abcRewrite.c.

204 {
205  static Cut_Params_t Params, * pParams = &Params;
206  Cut_Man_t * pManCut;
207  Abc_Obj_t * pObj;
208  int i;
209  // start the cut manager
210  memset( pParams, 0, sizeof(Cut_Params_t) );
211  pParams->nVarsMax = 4; // the max cut size ("k" of the k-feasible cuts)
212  pParams->nKeepMax = 250; // the max number of cuts kept at a node
213  pParams->fTruth = 1; // compute truth tables
214  pParams->fFilter = 1; // filter dominated cuts
215  pParams->fSeq = 0; // compute sequential cuts
216  pParams->fDrop = 0; // drop cuts on the fly
217  pParams->fVerbose = 0; // the verbosiness flag
218  pParams->nIdsMax = Abc_NtkObjNumMax( pNtk );
219  pManCut = Cut_ManStart( pParams );
220  if ( pParams->fDrop )
222  // set cuts for PIs
223  Abc_NtkForEachCi( pNtk, pObj, i )
224  if ( Abc_ObjFanoutNum(pObj) > 0 )
225  Cut_NodeSetTriv( pManCut, pObj->Id );
226  return pManCut;
227 }
char * memset()
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
static int Abc_ObjFanoutNum(Abc_Obj_t *pObj)
Definition: abc.h:365
void Cut_NodeSetTriv(Cut_Man_t *p, int Node)
Definition: cutApi.c:145
void Cut_ManSetFanoutCounts(Cut_Man_t *p, Vec_Int_t *vFanCounts)
Definition: cutMan.c:229
Cut_Man_t * Cut_ManStart(Cut_Params_t *pParams)
FUNCTION DEFINITIONS ///.
Definition: cutMan.c:47
if(last==0)
Definition: sparse_int.h:34
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
ABC_DLL Vec_Int_t * Abc_NtkFanoutCounts(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:1701
void Abc_PlaceBegin ( Abc_Ntk_t pNtk)

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

Synopsis [This procedure is called before the writing start.]

Description []

SideEffects []

SeeAlso []

Definition at line 178 of file abcPlace.c.

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 }
char * memset()
ConcreteCell * cells
Definition: abcPlace.c:34
static int Abc_ObjIsCi(Abc_Obj_t *pObj)
Definition: abc.h:351
void globalPlace()
Performs analytic placement using a GORDIAN-like algorithm.
Definition: place_gordian.c:39
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
float m_width
Definition: place_base.h:45
ABC_NAMESPACE_IMPL_START AbstractCell * abstractCells
DECLARATIONS ///.
Definition: abcPlace.c:33
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
ConcreteNet * nets
Definition: abcPlace.c:35
#define Abc_AigForEachAnd(pNtk, pNode, i)
Definition: abc.h:485
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
#define ALLOC(type, num)
Definition: avl.h:27
float m_height
Definition: place_base.h:45
void globalPreplace(float utilization)
Place pad ring, leaving a core area to meet a desired utilization.
Definition: place_pads.c:31
#define REALLOC(type, obj, num)
Definition: avl.h:29
char * m_label
Definition: place_base.h:43
static void Abc_PlaceCreateCell(Abc_Obj_t *pObj, int fAnd)
FUNCTION DEFINITIONS ///.
Definition: abcPlace.c:53
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
#define Abc_NtkForEachObj(pNtk, pObj, i)
ITERATORS ///.
Definition: abc.h:446
static void Abc_PlaceUpdateNet(Abc_Obj_t *pObj)
Definition: abcPlace.c:75
int nAllocSize
Definition: abcPlace.c:36
void Abc_PlaceEnd ( Abc_Ntk_t pNtk)

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

Synopsis [This procedure is called after the writing completes.]

Description []

SideEffects []

SeeAlso []

Definition at line 241 of file abcPlace.c.

242 {
243  int i;
244 
245 
246  // clean up
247  for ( i = 0; i < nAllocSize; i++ )
248  FREE( nets[i].m_terms );
249  FREE( abstractCells );
250  FREE( cells );
251  FREE( nets );
252 }
ConcreteCell * cells
Definition: abcPlace.c:34
ABC_NAMESPACE_IMPL_START AbstractCell * abstractCells
DECLARATIONS ///.
Definition: abcPlace.c:33
ConcreteNet * nets
Definition: abcPlace.c:35
#define FREE(obj)
Definition: avl.h:31
int nAllocSize
Definition: abcPlace.c:36
void Abc_PlaceUpdate ( Vec_Ptr_t vAddedCells,
Vec_Ptr_t vUpdatedNets 
)

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

Synopsis [Updates placement after one step of rewriting.]

Description []

SideEffects []

SeeAlso []

Definition at line 126 of file abcPlace.c.

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 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
ConcreteCell * cells
Definition: abcPlace.c:34
static int Vec_PtrPushUnique(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:656
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ConcreteNet * nets
Definition: abcPlace.c:35
static unsigned Abc_ObjType(Abc_Obj_t *pObj)
Definition: abc.h:328
static void Abc_PlaceCreateCell(Abc_Obj_t *pObj, int fAnd)
FUNCTION DEFINITIONS ///.
Definition: abcPlace.c:53
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int Id
Definition: abc.h:132
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
static void Abc_PlaceUpdateNet(Abc_Obj_t *pObj)
Definition: abcPlace.c:75
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_RwrExpWithCut ( Abc_Obj_t pNode,
Vec_Ptr_t vLeaves 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 396 of file abcRewrite.c.

397 {
398  Abc_Obj_t * pObj;
399  int i, CountA, CountB;
400  Abc_RwrExpWithCut_rec( Abc_ObjFanin0(pNode), vLeaves, 1 );
401  Abc_RwrExpWithCut_rec( Abc_ObjFanin1(pNode), vLeaves, 0 );
402  CountA = CountB = 0;
403  Vec_PtrForEachEntry( Abc_Obj_t *, vLeaves, pObj, i )
404  {
405  CountA += Abc_ObjRegular(pObj)->fMarkA;
406  CountB += Abc_ObjRegular(pObj)->fMarkB;
407  Abc_ObjRegular(pObj)->fMarkA = 0;
408  Abc_ObjRegular(pObj)->fMarkB = 0;
409  }
410  printf( "(%d,%d:%d) ", CountA, CountB, CountA+CountB-Vec_PtrSize(vLeaves) );
411 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
unsigned fMarkA
Definition: abc.h:134
void Abc_RwrExpWithCut_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, int fUseA)
Definition: abcRewrite.c:370
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
unsigned fMarkB
Definition: abc.h:135
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Abc_RwrExpWithCut_rec ( Abc_Obj_t pNode,
Vec_Ptr_t vLeaves,
int  fUseA 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 370 of file abcRewrite.c.

371 {
372  if ( Vec_PtrFind(vLeaves, pNode) >= 0 || Vec_PtrFind(vLeaves, Abc_ObjNot(pNode)) >= 0 )
373  {
374  if ( fUseA )
375  Abc_ObjRegular(pNode)->fMarkA = 1;
376  else
377  Abc_ObjRegular(pNode)->fMarkB = 1;
378  return;
379  }
380  assert( Abc_ObjIsNode(pNode) );
381  Abc_RwrExpWithCut_rec( Abc_ObjFanin0(pNode), vLeaves, fUseA );
382  Abc_RwrExpWithCut_rec( Abc_ObjFanin1(pNode), vLeaves, fUseA );
383 }
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
unsigned fMarkA
Definition: abc.h:134
void Abc_RwrExpWithCut_rec(Abc_Obj_t *pNode, Vec_Ptr_t *vLeaves, int fUseA)
Definition: abcRewrite.c:370
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
static int Vec_PtrFind(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:694
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static Abc_Obj_t * Abc_ObjRegular(Abc_Obj_t *p)
Definition: abc.h:323
unsigned fMarkB
Definition: abc.h:135
#define assert(ex)
Definition: util_old.h:213
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324