abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
abcMap.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [abcMap.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Network and node package.]
8 
9  Synopsis [Interface with the SC mapping package.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - June 20, 2005.]
16 
17  Revision [$Id: abcMap.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "base/abc/abc.h"
22 #include "base/main/main.h"
23 #include "map/mio/mio.h"
24 #include "map/mapper/mapper.h"
25 
27 
28 
29 ////////////////////////////////////////////////////////////////////////
30 /// DECLARATIONS ///
31 ////////////////////////////////////////////////////////////////////////
32 
33 static Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose );
34 static Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk );
35 static Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase );
36 static Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase );
37 
38 static Abc_Ntk_t * Abc_NtkFromMapSuperChoice( Map_Man_t * pMan, Abc_Ntk_t * pNtk );
39 static void Abc_NodeSuperChoice( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNode );
40 static void Abc_NodeFromMapCutPhase( Abc_Ntk_t * pNtkNew, Map_Cut_t * pCut, int fPhase );
41 static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * pSuper, Abc_Obj_t * pNodePis[], int nNodePis );
42 
43 
44 ////////////////////////////////////////////////////////////////////////
45 /// FUNCTION DEFINITIONS ///
46 ////////////////////////////////////////////////////////////////////////
47 
48 /**Function*************************************************************
49 
50  Synopsis [Interface with the mapping package.]
51 
52  Description []
53 
54  SideEffects []
55 
56  SeeAlso []
57 
58 ***********************************************************************/
59 Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose )
60 {
61  static int fUseMulti = 0;
62  int fShowSwitching = 1;
63  Abc_Ntk_t * pNtkNew;
64  Map_Man_t * pMan;
65  Vec_Int_t * vSwitching = NULL;
66  float * pSwitching = NULL;
67  abctime clk, clkTotal = Abc_Clock();
69 
70  assert( Abc_NtkIsStrash(pNtk) );
71  // derive library from SCL
72  // if the library is created here, it will be deleted when pSuperLib is deleted in Map_SuperLibFree()
74  {
75  pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin, fVerbose );
76  if ( Abc_FrameReadLibGen() )
78  // remove supergate library
80  Abc_FrameSetLibSuper( NULL );
81  }
82  // quit if there is no library
83  if ( pLib == NULL )
84  {
85  printf( "The current library is not available.\n" );
86  return 0;
87  }
88  if ( AreaMulti != 0.0 )
89  fUseMulti = 1, printf( "The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti );
90  if ( DelayMulti != 0.0 )
91  fUseMulti = 1, printf( "The cell delays are multiplied by the factor: <num_fanins> ^ (%.2f).\n", DelayMulti );
92 
93  // penalize large gates by increasing their area
94  if ( AreaMulti != 0.0 )
95  Mio_LibraryMultiArea( pLib, AreaMulti );
96  if ( DelayMulti != 0.0 )
97  Mio_LibraryMultiDelay( pLib, DelayMulti );
98 
99  // derive the supergate library
100  if ( fUseMulti || Abc_FrameReadLibSuper() == NULL )
101  {
102  if ( fVerbose )
103  printf( "Converting \"%s\" into supergate library \"%s\".\n",
105  // compute supergate library to be used for mapping
106  Map_SuperLibDeriveFromGenlib( pLib, fVerbose );
107  }
108 
109  // return the library to normal
110  if ( AreaMulti != 0.0 )
112  if ( DelayMulti != 0.0 )
114 
115  // print a warning about choice nodes
116  if ( fVerbose && Abc_NtkGetChoiceNum( pNtk ) )
117  printf( "Performing mapping with choices.\n" );
118 
119  // compute switching activity
120  fShowSwitching |= fSwitching;
121  if ( fShowSwitching )
122  {
123  extern Vec_Int_t * Sim_NtkComputeSwitching( Abc_Ntk_t * pNtk, int nPatterns );
124  vSwitching = Sim_NtkComputeSwitching( pNtk, 4096 );
125  pSwitching = (float *)vSwitching->pArray;
126  }
127 
128  // perform the mapping
129  pMan = Abc_NtkToMap( pNtk, DelayTarget, fRecovery, pSwitching, fVerbose );
130  if ( pSwitching ) Vec_IntFree( vSwitching );
131  if ( pMan == NULL )
132  return NULL;
133 clk = Abc_Clock();
134  Map_ManSetSwitching( pMan, fSwitching );
135  if ( LogFan != 0 )
136  Map_ManCreateNodeDelays( pMan, LogFan );
137  if ( !Map_Mapping( pMan ) )
138  {
139  Map_ManFree( pMan );
140  return NULL;
141  }
142 // Map_ManPrintStatsToFile( pNtk->pSpec, Map_ManReadAreaFinal(pMan), Map_ManReadRequiredGlo(pMan), Abc_Clock()-clk );
143 
144  // reconstruct the network after mapping
145  pNtkNew = Abc_NtkFromMap( pMan, pNtk );
146  Map_ManFree( pMan );
147  if ( pNtkNew == NULL )
148  return NULL;
149 
150  if ( pNtk->pExdc )
151  pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
152 if ( fVerbose )
153 {
154 ABC_PRT( "Total runtime", Abc_Clock() - clkTotal );
155 }
156 
157  // make sure that everything is okay
158  if ( !Abc_NtkCheck( pNtkNew ) )
159  {
160  printf( "Abc_NtkMap: The network check has failed.\n" );
161  Abc_NtkDelete( pNtkNew );
162  return NULL;
163  }
164  return pNtkNew;
165 }
166 
167 /**Function*************************************************************
168 
169  Synopsis [Load the network into manager.]
170 
171  Description []
172 
173  SideEffects []
174 
175  SeeAlso []
176 
177 ***********************************************************************/
179 {
180  Map_Time_t * p;
181  int i;
182  p = ABC_CALLOC( Map_Time_t, Abc_NtkCiNum(pNtk) );
183  for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
184  {
185  p->Fall = ppTimes[i].Fall;
186  p->Rise = ppTimes[i].Rise;
187  p->Worst = Abc_MaxFloat( p->Fall, p->Rise );
188  }
189  ABC_FREE( ppTimes );
190  return p;
191 }
193 {
194  Map_Time_t * p;
195  int i;
196  p = ABC_CALLOC( Map_Time_t, Abc_NtkCoNum(pNtk) );
197  for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
198  {
199  p->Fall = ppTimes[i].Fall;
200  p->Rise = ppTimes[i].Rise;
201  p->Worst = Abc_MaxFloat( p->Fall, p->Rise );
202  }
203  ABC_FREE( ppTimes );
204  return p;
205 }
206 
207 /**Function*************************************************************
208 
209  Synopsis [Load the network into manager.]
210 
211  Description []
212 
213  SideEffects []
214 
215  SeeAlso []
216 
217 ***********************************************************************/
218 Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose )
219 {
220  Map_Man_t * pMan;
221  Map_Node_t * pNodeMap;
222  Vec_Ptr_t * vNodes;
223  Abc_Obj_t * pNode, * pFanin, * pPrev;
224  int i;
225 
226  assert( Abc_NtkIsStrash(pNtk) );
227 
228  // start the mapping manager and set its parameters
229  pMan = Map_ManCreate( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) - pNtk->nBarBufs, Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) - pNtk->nBarBufs, fVerbose );
230  if ( pMan == NULL )
231  return NULL;
232  Map_ManSetAreaRecovery( pMan, fRecovery );
234  Map_ManSetDelayTarget( pMan, (float)DelayTarget );
237 
238  // create PIs and remember them in the old nodes
239  Abc_NtkCleanCopy( pNtk );
241  Abc_NtkForEachCi( pNtk, pNode, i )
242  {
243  if ( i == Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
244  break;
245  pNodeMap = Map_ManReadInputs(pMan)[i];
246  pNode->pCopy = (Abc_Obj_t *)pNodeMap;
247  if ( pSwitching )
248  Map_NodeSetSwitching( pNodeMap, pSwitching[pNode->Id] );
249  }
250 
251  // load the AIG into the mapper
252  vNodes = Abc_AigDfsMap( pNtk );
253  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
254  {
255  if ( Abc_ObjIsLatch(pNode) )
256  {
257  pFanin = Abc_ObjFanin0(pNode);
258  pNodeMap = Map_NodeBuf( pMan, Map_NotCond( Abc_ObjFanin0(pFanin)->pCopy, (int)Abc_ObjFaninC0(pFanin) ) );
259  Abc_ObjFanout0(pNode)->pCopy = (Abc_Obj_t *)pNodeMap;
260  continue;
261  }
262  assert( Abc_ObjIsNode(pNode) );
263  // add the node to the mapper
264  pNodeMap = Map_NodeAnd( pMan,
265  Map_NotCond( Abc_ObjFanin0(pNode)->pCopy, (int)Abc_ObjFaninC0(pNode) ),
266  Map_NotCond( Abc_ObjFanin1(pNode)->pCopy, (int)Abc_ObjFaninC1(pNode) ) );
267  assert( pNode->pCopy == NULL );
268  // remember the node
269  pNode->pCopy = (Abc_Obj_t *)pNodeMap;
270  if ( pSwitching )
271  Map_NodeSetSwitching( pNodeMap, pSwitching[pNode->Id] );
272  // set up the choice node
273  if ( Abc_AigNodeIsChoice( pNode ) )
274  for ( pPrev = pNode, pFanin = (Abc_Obj_t *)pNode->pData; pFanin; pPrev = pFanin, pFanin = (Abc_Obj_t *)pFanin->pData )
275  {
276  Map_NodeSetNextE( (Map_Node_t *)pPrev->pCopy, (Map_Node_t *)pFanin->pCopy );
277  Map_NodeSetRepr( (Map_Node_t *)pFanin->pCopy, (Map_Node_t *)pNode->pCopy );
278  }
279  }
280  assert( Map_ManReadBufNum(pMan) == pNtk->nBarBufs );
281  Vec_PtrFree( vNodes );
282 
283  // set the primary outputs in the required phase
284  Abc_NtkForEachCo( pNtk, pNode, i )
285  {
286  if ( i == Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
287  break;
288  Map_ManReadOutputs(pMan)[i] = Map_NotCond( (Map_Node_t *)Abc_ObjFanin0(pNode)->pCopy, (int)Abc_ObjFaninC0(pNode) );
289  }
290  return pMan;
291 }
292 
293 /**Function*************************************************************
294 
295  Synopsis [Creates the mapped network.]
296 
297  Description []
298 
299  SideEffects []
300 
301  SeeAlso []
302 
303 ***********************************************************************/
304 Abc_Obj_t * Abc_NodeFromMapSuper_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, Map_Super_t * pSuper, Abc_Obj_t * pNodePis[], int nNodePis )
305 {
307  Mio_Gate_t * pRoot;
308  Map_Super_t ** ppFanins;
309  Abc_Obj_t * pNodeNew, * pNodeFanin;
310  int nFanins, Number, i;
311 
312  // get the parameters of the supergate
313  pRoot = Map_SuperReadRoot(pSuper);
314  if ( pRoot == NULL )
315  {
316  Number = Map_SuperReadNum(pSuper);
317  if ( Number < nNodePis )
318  {
319  return pNodePis[Number];
320  }
321  else
322  {
323 // assert( 0 );
324  /* It might happen that a super gate with 5 inputs is constructed that
325  * actually depends only on the first four variables; i.e the fifth is a
326  * don't care -- in that case we connect constant node for the fifth
327  * (since the cut only has 4 variables). An interesting question is what
328  * if the first variable (and not the fifth one is the redundant one;
329  * can that happen?) */
330  return Abc_NtkCreateNodeConst0(pNtkNew);
331  }
332  }
333  pRoot = Mio_LibraryReadGateByName( pLib, Mio_GateReadName(pRoot), NULL );
334 
335  // get information about the fanins of the supergate
336  nFanins = Map_SuperReadFaninNum( pSuper );
337  ppFanins = Map_SuperReadFanins( pSuper );
338  // create a new node with these fanins
339  pNodeNew = Abc_NtkCreateNode( pNtkNew );
340  for ( i = 0; i < nFanins; i++ )
341  {
342  pNodeFanin = Abc_NodeFromMapSuper_rec( pNtkNew, pNodeMap, ppFanins[i], pNodePis, nNodePis );
343  Abc_ObjAddFanin( pNodeNew, pNodeFanin );
344  }
345  pNodeNew->pData = pRoot;
346  return pNodeNew;
347 }
348 Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase )
349 {
350  Abc_Obj_t * pNodePIs[10];
351  Abc_Obj_t * pNodeNew;
352  Map_Node_t ** ppLeaves;
353  Map_Cut_t * pCutBest;
354  Map_Super_t * pSuperBest;
355  unsigned uPhaseBest;
356  int i, fInvPin, nLeaves;
357 
358  // make sure the node can be implemented in this phase
359  assert( Map_NodeReadCutBest(pNodeMap, fPhase) != NULL || Map_NodeIsConst(pNodeMap) );
360  // check if the phase is already implemented
361  pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
362  if ( pNodeNew )
363  return pNodeNew;
364 
365  // get the information about the best cut
366  pCutBest = Map_NodeReadCutBest( pNodeMap, fPhase );
367  pSuperBest = Map_CutReadSuperBest( pCutBest, fPhase );
368  uPhaseBest = Map_CutReadPhaseBest( pCutBest, fPhase );
369  nLeaves = Map_CutReadLeavesNum( pCutBest );
370  ppLeaves = Map_CutReadLeaves( pCutBest );
371 
372  // collect the PI nodes
373  for ( i = 0; i < nLeaves; i++ )
374  {
375  fInvPin = ((uPhaseBest & (1 << i)) > 0);
376  pNodePIs[i] = Abc_NodeFromMap_rec( pNtkNew, ppLeaves[i], !fInvPin );
377  assert( pNodePIs[i] != NULL );
378  }
379 
380  // implement the supergate
381  pNodeNew = Abc_NodeFromMapSuper_rec( pNtkNew, pNodeMap, pSuperBest, pNodePIs, nLeaves );
382  Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeNew );
383  return pNodeNew;
384 }
385 Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase )
386 {
387  Abc_Obj_t * pNodeNew, * pNodeInv;
388 
389  // check the case of constant node
390  if ( Map_NodeIsConst(pNodeMap) )
391  {
392  pNodeNew = fPhase? Abc_NtkCreateNodeConst1(pNtkNew) : Abc_NtkCreateNodeConst0(pNtkNew);
393  if ( pNodeNew->pData == NULL )
394  printf( "Error creating mapped network: Library does not have a constant %d gate.\n", fPhase );
395  return pNodeNew;
396  }
397 
398  // check if the phase is already implemented
399  pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
400  if ( pNodeNew )
401  return pNodeNew;
402 
403  // implement the node if the best cut is assigned
404  if ( Map_NodeReadCutBest(pNodeMap, fPhase) != NULL )
405  return Abc_NodeFromMapPhase_rec( pNtkNew, pNodeMap, fPhase );
406 
407  // if the cut is not assigned, implement the node
408  assert( Map_NodeReadCutBest(pNodeMap, !fPhase) != NULL || Map_NodeIsConst(pNodeMap) );
409  pNodeNew = Abc_NodeFromMapPhase_rec( pNtkNew, pNodeMap, !fPhase );
410 
411  // add the inverter
412  pNodeInv = Abc_NtkCreateNode( pNtkNew );
413  Abc_ObjAddFanin( pNodeInv, pNodeNew );
415 
416  // set the inverter
417  Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeInv );
418  return pNodeInv;
419 }
421 {
422  Abc_Ntk_t * pNtkNew;
423  Map_Node_t * pNodeMap;
424  Abc_Obj_t * pNode, * pNodeNew;
425  int i, nDupGates;
426  assert( Map_ManReadBufNum(pMan) == pNtk->nBarBufs );
427  // create the new network
428  pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_MAP );
429  // make the mapper point to the new network
430  Map_ManCleanData( pMan );
431  Abc_NtkForEachCi( pNtk, pNode, i )
432  {
433  if ( i >= Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
434  break;
435  Map_NodeSetData( Map_ManReadInputs(pMan)[i], 1, (char *)pNode->pCopy );
436  }
437  Abc_NtkForEachCi( pNtk, pNode, i )
438  {
439  if ( i < Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
440  continue;
441  Map_NodeSetData( Map_ManReadBufs(pMan)[i - (Abc_NtkCiNum(pNtk) - pNtk->nBarBufs)], 1, (char *)pNode->pCopy );
442  }
443  // assign the mapping of the required phase to the POs
444  Abc_NtkForEachCo( pNtk, pNode, i )
445  {
446  if ( i < Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
447  continue;
448  pNodeMap = Map_ManReadBufDriver( pMan, i - (Abc_NtkCoNum(pNtk) - pNtk->nBarBufs) );
449  pNodeNew = Abc_NodeFromMap_rec( pNtkNew, Map_Regular(pNodeMap), !Map_IsComplement(pNodeMap) );
450  assert( !Abc_ObjIsComplement(pNodeNew) );
451  Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
452  }
453  Abc_NtkForEachCo( pNtk, pNode, i )
454  {
455  if ( i >= Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
456  break;
457  pNodeMap = Map_ManReadOutputs(pMan)[i];
458  pNodeNew = Abc_NodeFromMap_rec( pNtkNew, Map_Regular(pNodeMap), !Map_IsComplement(pNodeMap) );
459  assert( !Abc_ObjIsComplement(pNodeNew) );
460  Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
461  }
462  // decouple the PO driver nodes to reduce the number of levels
463  nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, 1 );
464 // if ( nDupGates && Map_ManReadVerbose(pMan) )
465 // printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
466  return pNtkNew;
467 }
468 
469 /**Function*************************************************************
470 
471  Synopsis [Interface with the mapping package.]
472 
473  Description []
474 
475  SideEffects []
476 
477  SeeAlso []
478 
479 ***********************************************************************/
481 {
482  Abc_Ntk_t * pNtkNew;
483 
484  Map_Man_t * pMan;
485 
486  assert( Abc_NtkIsStrash(pNtk) );
487 
488  // check that the library is available
489  if ( Abc_FrameReadLibGen() == NULL )
490  {
491  printf( "The current library is not available.\n" );
492  return 0;
493  }
494 
495  // derive the supergate library
496  if ( Abc_FrameReadLibSuper() == NULL && Abc_FrameReadLibGen() )
497  {
498 // printf( "A simple supergate library is derived from gate library \"%s\".\n",
499 // Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) );
501  }
502 
503  // print a warning about choice nodes
504  if ( Abc_NtkGetChoiceNum( pNtk ) )
505  printf( "Performing mapping with choices.\n" );
506 
507  // perform the mapping
508  pMan = Abc_NtkToMap( pNtk, -1, 1, NULL, 0 );
509  if ( pMan == NULL )
510  return NULL;
511  if ( !Map_Mapping( pMan ) )
512  {
513  Map_ManFree( pMan );
514  return NULL;
515  }
516 
517  // reconstruct the network after mapping
518  pNtkNew = Abc_NtkFromMapSuperChoice( pMan, pNtk );
519  if ( pNtkNew == NULL )
520  return NULL;
521  Map_ManFree( pMan );
522 
523  // make sure that everything is okay
524  if ( !Abc_NtkCheck( pNtkNew ) )
525  {
526  printf( "Abc_NtkMap: The network check has failed.\n" );
527  Abc_NtkDelete( pNtkNew );
528  return NULL;
529  }
530  return pNtkNew;
531 }
532 
533 
534 /**Function*************************************************************
535 
536  Synopsis [Creates the mapped network.]
537 
538  Description []
539 
540  SideEffects []
541 
542  SeeAlso []
543 
544 ***********************************************************************/
546 {
547  extern Abc_Ntk_t * Abc_NtkMulti( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor );
548  ProgressBar * pProgress;
549  Abc_Ntk_t * pNtkNew, * pNtkNew2;
550  Abc_Obj_t * pNode;
551  int i;
552 
553  // save the pointer to the mapped nodes
554  Abc_NtkForEachCi( pNtk, pNode, i )
555  pNode->pNext = pNode->pCopy;
556  Abc_NtkForEachPo( pNtk, pNode, i )
557  pNode->pNext = pNode->pCopy;
558  Abc_NtkForEachNode( pNtk, pNode, i )
559  pNode->pNext = pNode->pCopy;
560 
561  // duplicate the network
562  pNtkNew2 = Abc_NtkDup( pNtk );
563  pNtkNew = Abc_NtkMulti( pNtkNew2, 0, 20, 0, 0, 1, 0 );
564  if ( !Abc_NtkBddToSop( pNtkNew, 0 ) )
565  {
566  printf( "Abc_NtkFromMapSuperChoice(): Converting to SOPs has failed.\n" );
567  return NULL;
568  }
569 
570  // set the old network to point to the new network
571  Abc_NtkForEachCi( pNtk, pNode, i )
572  pNode->pCopy = pNode->pCopy->pCopy;
573  Abc_NtkForEachPo( pNtk, pNode, i )
574  pNode->pCopy = pNode->pCopy->pCopy;
575  Abc_NtkForEachNode( pNtk, pNode, i )
576  pNode->pCopy = pNode->pCopy->pCopy;
577  Abc_NtkDelete( pNtkNew2 );
578 
579  // set the pointers from the mapper to the new nodes
580  Abc_NtkForEachCi( pNtk, pNode, i )
581  {
582  Map_NodeSetData( Map_ManReadInputs(pMan)[i], 0, (char *)Abc_NtkCreateNodeInv(pNtkNew,pNode->pCopy) );
583  Map_NodeSetData( Map_ManReadInputs(pMan)[i], 1, (char *)pNode->pCopy );
584  }
585  Abc_NtkForEachNode( pNtk, pNode, i )
586  {
587 // if ( Abc_NodeIsConst(pNode) )
588 // continue;
589  Map_NodeSetData( (Map_Node_t *)pNode->pNext, 0, (char *)Abc_NtkCreateNodeInv(pNtkNew,pNode->pCopy) );
590  Map_NodeSetData( (Map_Node_t *)pNode->pNext, 1, (char *)pNode->pCopy );
591  }
592 
593  // assign the mapping of the required phase to the POs
594  pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) );
595  Abc_NtkForEachNode( pNtk, pNode, i )
596  {
597  Extra_ProgressBarUpdate( pProgress, i, NULL );
598 // if ( Abc_NodeIsConst(pNode) )
599 // continue;
600  Abc_NodeSuperChoice( pNtkNew, pNode );
601  }
602  Extra_ProgressBarStop( pProgress );
603  return pNtkNew;
604 }
605 
606 
607 /**Function*************************************************************
608 
609  Synopsis [Creates the mapped network.]
610 
611  Description []
612 
613  SideEffects []
614 
615  SeeAlso []
616 
617 ***********************************************************************/
618 void Abc_NodeSuperChoice( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNode )
619 {
620  Map_Node_t * pMapNode = (Map_Node_t *)pNode->pNext;
621  Map_Cut_t * pCuts, * pTemp;
622 
623  pCuts = Map_NodeReadCuts(pMapNode);
624  for ( pTemp = Map_CutReadNext(pCuts); pTemp; pTemp = Map_CutReadNext(pTemp) )
625  {
626  Abc_NodeFromMapCutPhase( pNtkNew, pTemp, 0 );
627  Abc_NodeFromMapCutPhase( pNtkNew, pTemp, 1 );
628  }
629 }
630 
631 
632 /**Function*************************************************************
633 
634  Synopsis [Constructs the nodes corrresponding to one node.]
635 
636  Description []
637 
638  SideEffects []
639 
640  SeeAlso []
641 
642 ***********************************************************************/
643 void Abc_NodeFromMapCutPhase( Abc_Ntk_t * pNtkNew, Map_Cut_t * pCut, int fPhase )
644 {
645  Abc_Obj_t * pNodePIs[10];
646  Map_Node_t ** ppLeaves;
647  Map_Super_t * pSuperBest;
648  unsigned uPhaseBest;
649  int i, fInvPin, nLeaves;
650 
651  pSuperBest = Map_CutReadSuperBest( pCut, fPhase );
652  if ( pSuperBest == NULL )
653  return;
654 
655  // get the information about the best cut
656  uPhaseBest = Map_CutReadPhaseBest( pCut, fPhase );
657  nLeaves = Map_CutReadLeavesNum( pCut );
658  ppLeaves = Map_CutReadLeaves( pCut );
659 
660  // collect the PI nodes
661  for ( i = 0; i < nLeaves; i++ )
662  {
663  fInvPin = ((uPhaseBest & (1 << i)) > 0);
664  pNodePIs[i] = (Abc_Obj_t *)Map_NodeReadData( ppLeaves[i], !fInvPin );
665  assert( pNodePIs[i] != NULL );
666  }
667 
668  // implement the supergate
669  Abc_NodeFromMapSuperChoice_rec( pNtkNew, pSuperBest, pNodePIs, nLeaves );
670 }
671 
672 
673 /**Function*************************************************************
674 
675  Synopsis [Constructs the nodes corrresponding to one supergate.]
676 
677  Description []
678 
679  SideEffects []
680 
681  SeeAlso []
682 
683 ***********************************************************************/
684 Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * pSuper, Abc_Obj_t * pNodePis[], int nNodePis )
685 {
687  Mio_Gate_t * pRoot;
688  Map_Super_t ** ppFanins;
689  Abc_Obj_t * pNodeNew, * pNodeFanin;
690  int nFanins, Number, i;
691 
692  // get the parameters of the supergate
693  pRoot = Map_SuperReadRoot(pSuper);
694  if ( pRoot == NULL )
695  {
696  Number = Map_SuperReadNum(pSuper);
697  if ( Number < nNodePis )
698  {
699  return pNodePis[Number];
700  }
701  else
702  {
703 // assert( 0 );
704  /* It might happen that a super gate with 5 inputs is constructed that
705  * actually depends only on the first four variables; i.e the fifth is a
706  * don't care -- in that case we connect constant node for the fifth
707  * (since the cut only has 4 variables). An interesting question is what
708  * if the first variable (and not the fifth one is the redundant one;
709  * can that happen?) */
710  return Abc_NtkCreateNodeConst0(pNtkNew);
711  }
712  }
713  pRoot = Mio_LibraryReadGateByName( pLib, Mio_GateReadName(pRoot), NULL );
714 
715  // get information about the fanins of the supergate
716  nFanins = Map_SuperReadFaninNum( pSuper );
717  ppFanins = Map_SuperReadFanins( pSuper );
718  // create a new node with these fanins
719  pNodeNew = Abc_NtkCreateNode( pNtkNew );
720  for ( i = 0; i < nFanins; i++ )
721  {
722  pNodeFanin = Abc_NodeFromMapSuperChoice_rec( pNtkNew, ppFanins[i], pNodePis, nNodePis );
723  Abc_ObjAddFanin( pNodeNew, pNodeFanin );
724  }
725  pNodeNew->pData = Abc_SopRegister( (Mem_Flex_t *)pNtkNew->pManFunc, Mio_GateReadSop(pRoot) );
726  return pNodeNew;
727 }
728 
729 /**Function*************************************************************
730 
731  Synopsis [Returns the twin node if it exists.]
732 
733  Description []
734 
735  SideEffects []
736 
737  SeeAlso []
738 
739 ***********************************************************************/
741 {
742  Abc_Obj_t * pNode2;
743  Mio_Gate_t * pGate = (Mio_Gate_t *)pNode->pData;
744  assert( Abc_NtkHasMapping(pNode->pNtk) );
745  if ( pGate == NULL || Mio_GateReadTwin(pGate) == NULL )
746  return NULL;
747  // assuming the twin node is following next
748  if ( (int)Abc_ObjId(pNode) == Abc_NtkObjNumMax(pNode->pNtk) - 1 )
749  return NULL;
750  pNode2 = Abc_NtkObj( pNode->pNtk, Abc_ObjId(pNode) + 1 );
751  if ( pNode2 == NULL || !Abc_ObjIsNode(pNode2) || Abc_ObjFaninNum(pNode) != Abc_ObjFaninNum(pNode2) )
752  return NULL;
753  if ( Mio_GateReadTwin(pGate) != (Mio_Gate_t *)pNode2->pData )
754  return NULL;
755  return pNode2;
756 }
757 
758 
759 /**Function*************************************************************
760 
761  Synopsis [Dumps mapped network in the mini-mapped format.]
762 
763  Description []
764 
765  SideEffects []
766 
767  SeeAlso []
768 
769 ***********************************************************************/
771 {
772  Vec_Ptr_t * vNodes;
773  Vec_Int_t * vMapping;
774  Vec_Str_t * vGates;
775  Abc_Obj_t * pObj, * pFanin;
776  int i, k, nNodes, nFanins, nExtra, * pArray;
777  assert( Abc_NtkHasMapping(pNtk) );
778  // collect nodes in the DFS order
779  vNodes = Abc_NtkDfs( pNtk, 0 );
780  // assign unique numbers
781  nNodes = nFanins = 0;
782  Abc_NtkForEachCi( pNtk, pObj, i )
783  pObj->iTemp = nNodes++;
784  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
785  pObj->iTemp = nNodes++, nFanins += Abc_ObjFaninNum(pObj);
786  // allocate attay to store mapping (4 counters + fanins for each node + PO drivers + gate names)
787  vMapping = Vec_IntAlloc( 4 + Abc_NtkNodeNum(pNtk) + nFanins + Abc_NtkCoNum(pNtk) + 10000 );
788  // write the numbers of CI/CO/Node/FF
789  Vec_IntPush( vMapping, Abc_NtkCiNum(pNtk) );
790  Vec_IntPush( vMapping, Abc_NtkCoNum(pNtk) );
791  Vec_IntPush( vMapping, Abc_NtkNodeNum(pNtk) );
792  Vec_IntPush( vMapping, Abc_NtkLatchNum(pNtk) );
793  // write the nodes
794  vGates = Vec_StrAlloc( 10000 );
795  Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
796  {
797  Vec_IntPush( vMapping, Abc_ObjFaninNum(pObj) );
798  Abc_ObjForEachFanin( pObj, pFanin, k )
799  Vec_IntPush( vMapping, pFanin->iTemp );
800  // remember this gate (to be added to the mapping later)
801  Vec_StrPrintStr( vGates, Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
802  Vec_StrPush( vGates, '\0' );
803  }
804  // write the COs literals
805  Abc_NtkForEachCo( pNtk, pObj, i )
806  Vec_IntPush( vMapping, Abc_ObjFanin0(pObj)->iTemp );
807  // finish off the array
808  nExtra = 4 - Vec_StrSize(vGates) % 4;
809  for ( i = 0; i < nExtra; i++ )
810  Vec_StrPush( vGates, '\0' );
811  // add gates to the array
812  assert( Vec_StrSize(vGates) % 4 == 0 );
813  nExtra = Vec_StrSize(vGates) / 4;
814  pArray = (int *)Vec_StrArray(vGates);
815  for ( i = 0; i < nExtra; i++ )
816  Vec_IntPush( vMapping, pArray[i] );
817  // cleanup and return
818  Vec_PtrFree( vNodes );
819  Vec_StrFree( vGates );
820  return vMapping;
821 }
822 
823 /**Function*************************************************************
824 
825  Synopsis [Prints mapped network represented in mini-mapped format.]
826 
827  Description []
828 
829  SideEffects []
830 
831  SeeAlso []
832 
833 ***********************************************************************/
834 void Abc_NtkPrintMiniMapping( int * pArray )
835 {
836  int nCis, nCos, nNodes, nFlops;
837  int i, k, nLeaves, Pos = 4;
838  char * pBuffer, * pName;
839  nCis = pArray[0];
840  nCos = pArray[1];
841  nNodes = pArray[2];
842  nFlops = pArray[3];
843  printf( "Mapped network has %d CIs, %d COs, %d gates, and %d flops.\n", nCis, nCos, nNodes, nFlops );
844  printf( "The first %d object IDs (from 0 to %d) are reserved for the CIs.\n", nCis, nCis - 1 );
845  for ( i = 0; i < nNodes; i++ )
846  {
847  printf( "Node %d has fanins {", nCis + i );
848  nLeaves = pArray[Pos++];
849  for ( k = 0; k < nLeaves; k++ )
850  printf( " %d", pArray[Pos++] );
851  printf( " }\n" );
852  }
853  for ( i = 0; i < nCos; i++ )
854  printf( "CO %d is driven by node %d\n", i, pArray[Pos++] );
855  pBuffer = (char *)(pArray + Pos);
856  for ( i = 0; i < nNodes; i++ )
857  {
858  pName = pBuffer;
859  pBuffer += strlen(pName) + 1;
860  printf( "Node %d has gate \"%s\"\n", nCis + i, pName );
861  }
862 }
863 
864 /**Function*************************************************************
865 
866  Synopsis [This procedure outputs an array representing mini-mapped network.]
867 
868  Description []
869 
870  SideEffects []
871 
872  SeeAlso []
873 
874 ***********************************************************************/
875 int * Abc_NtkOutputMiniMapping( void * pAbc0 )
876 {
877  Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
878  Abc_Ntk_t * pNtk;
879  Vec_Int_t * vMapping;
880  int * pArray;
881  if ( pAbc == NULL )
882  printf( "ABC framework is not initialized by calling Abc_Start()\n" );
883  pNtk = Abc_FrameReadNtk( pAbc );
884  if ( pNtk == NULL )
885  printf( "Current network in ABC framework is not defined.\n" );
886  if ( !Abc_NtkHasMapping(pNtk) )
887  printf( "Current network in ABC framework is not mapped.\n" );
888  // derive mini-mapping
889  vMapping = Abc_NtkWriteMiniMapping( pNtk );
890  pArray = Vec_IntArray( vMapping );
891  ABC_FREE( vMapping );
892  // print mini-mapping (optional)
893 // Abc_NtkPrintMiniMapping( pArray );
894  // return the array representation of mini-mapping
895  return pArray;
896 }
897 
898 /**Function*************************************************************
899 
900  Synopsis [Test for mini-mapped format.]
901 
902  Description []
903 
904  SideEffects []
905 
906  SeeAlso []
907 
908 ***********************************************************************/
910 {
911  Vec_Int_t * vMapping;
912  vMapping = Abc_NtkWriteMiniMapping( p );
914  printf( "Array has size %d ints.\n", Vec_IntSize(vMapping) );
915  Vec_IntFree( vMapping );
916 }
917 
918 /**Function*************************************************************
919 
920  Synopsis [These APIs set arriva/required times of CIs/COs.]
921 
922  Description []
923 
924  SideEffects []
925 
926  SeeAlso []
927 
928 ***********************************************************************/
929 void Abc_NtkSetCiArrivalTime( void * pAbc0, int iCi, float Rise, float Fall )
930 {
931  Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
932  Abc_Ntk_t * pNtk;
933  Abc_Obj_t * pNode;
934  if ( pAbc == NULL )
935  printf( "ABC framework is not initialized by calling Abc_Start()\n" );
936  pNtk = Abc_FrameReadNtk( pAbc );
937  if ( pNtk == NULL )
938  printf( "Current network in ABC framework is not defined.\n" );
939  if ( iCi < 0 || iCi >= Abc_NtkCiNum(pNtk) )
940  printf( "CI index is not valid.\n" );
941  pNode = Abc_NtkCi( pNtk, iCi );
942  Abc_NtkTimeSetArrival( pNtk, Abc_ObjId(pNode), Rise, Fall );
943 }
944 void Abc_NtkSetCoRequiredTime( void * pAbc0, int iCo, float Rise, float Fall )
945 {
946  Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
947  Abc_Ntk_t * pNtk;
948  Abc_Obj_t * pNode;
949  if ( pAbc == NULL )
950  printf( "ABC framework is not initialized by calling Abc_Start()\n" );
951  pNtk = Abc_FrameReadNtk( pAbc );
952  if ( pNtk == NULL )
953  printf( "Current network in ABC framework is not defined.\n" );
954  if ( iCo < 0 || iCo >= Abc_NtkCoNum(pNtk) )
955  printf( "CO index is not valid.\n" );
956  pNode = Abc_NtkCo( pNtk, iCo );
957  Abc_NtkTimeSetRequired( pNtk, Abc_ObjId(pNode), Rise, Fall );
958 }
959 
960 ////////////////////////////////////////////////////////////////////////
961 /// END OF FILE ///
962 ////////////////////////////////////////////////////////////////////////
963 
964 
966 
static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec(Abc_Ntk_t *pNtkNew, Map_Super_t *pSuper, Abc_Obj_t *pNodePis[], int nNodePis)
Definition: abcMap.c:684
int iTemp
Definition: abc.h:149
static int * Vec_IntArray(Vec_Int_t *p)
Definition: vecInt.h:328
static unsigned Abc_ObjId(Abc_Obj_t *pObj)
Definition: abc.h:329
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition: mioApi.c:99
#define Map_NotCond(p, c)
Definition: mapper.h:70
static int Abc_NtkIsStrash(Abc_Ntk_t *pNtk)
Definition: abc.h:251
Map_Node_t * Map_ManReadConst1(Map_Man_t *p)
Definition: mapperCreate.c:56
ABC_DLL void Abc_FrameSetLibSuper(void *pLib)
Definition: mainFrame.c:84
void Map_SuperLibFree(Map_SuperLib_t *p)
Definition: mapperLib.c:167
Abc_Obj_t * Abc_NtkFetchTwinNode(Abc_Obj_t *pNode)
Definition: abcMap.c:740
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Map_Node_t ** Map_ManReadBufs(Map_Man_t *p)
Definition: mapperCreate.c:54
static ABC_NAMESPACE_IMPL_START Map_Man_t * Abc_NtkToMap(Abc_Ntk_t *pNtk, double DelayTarget, int fRecovery, float *pSwitching, int fVerbose)
DECLARATIONS ///.
Definition: abcMap.c:218
static Abc_Obj_t * Abc_ObjFanin1(Abc_Obj_t *pObj)
Definition: abc.h:374
Map_Man_t * Map_ManCreate(int nInputs, int nOutputs, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: mapperCreate.c:184
ABC_DLL void * Abc_FrameReadLibGen()
Definition: mainFrame.c:56
Abc_Ntk_t * Abc_NtkSuperChoice(Abc_Ntk_t *pNtk)
Definition: abcMap.c:480
void Mio_LibraryMultiDelay(Mio_Library_t *pLib, double Multi)
Definition: mioUtils.c:841
ABC_DLL Vec_Ptr_t * Abc_AigDfsMap(Abc_Ntk_t *pNtk)
Definition: abcDfs.c:1054
Map_Cut_t * Map_NodeReadCuts(Map_Node_t *p)
Definition: mapperCreate.c:92
static int Abc_NtkObjNumMax(Abc_Ntk_t *pNtk)
Definition: abc.h:284
Map_Time_t * Abc_NtkMapCopyCoRequired(Abc_Ntk_t *pNtk, Abc_Time_t *ppTimes)
Definition: abcMap.c:192
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Abc_Ntk_t * pExdc
Definition: abc.h:201
static int Abc_ObjFaninC1(Abc_Obj_t *pObj)
Definition: abc.h:378
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static char * Vec_StrArray(Vec_Str_t *p)
Definition: vecStr.h:272
static int Abc_ObjIsLatch(Abc_Obj_t *pObj)
Definition: abc.h:356
int Abc_SclHasDelayInfo(void *pScl)
Definition: sclLibUtil.c:292
void Map_ManSetOutputNames(Map_Man_t *p, char **ppNames)
Definition: mapperCreate.c:63
ush Pos
Definition: deflate.h:88
Map_Super_t ** Map_SuperReadFanins(Map_Super_t *p)
Definition: mapperCreate.c:153
Abc_Ntk_t * Abc_NtkMulti(Abc_Ntk_t *pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor)
FUNCTION DEFINITIONS ///.
Definition: abcMulti.c:59
ABC_DLL void Abc_NtkTimeSetArrival(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition: abcTiming.c:185
Map_Cut_t * Map_CutReadNext(Map_Cut_t *p)
Definition: mapperCreate.c:137
ABC_DLL char ** Abc_NtkCollectCioNames(Abc_Ntk_t *pNtk, int fCollectCos)
Definition: abcNames.c:278
static void Abc_NodeSuperChoice(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode)
Definition: abcMap.c:618
static int Abc_ObjFaninNum(Abc_Obj_t *pObj)
Definition: abc.h:364
static int Abc_NtkHasMapping(Abc_Ntk_t *pNtk)
Definition: abc.h:256
void Map_NodeSetData(Map_Node_t *p, int fPhase, char *pData)
Definition: mapperCreate.c:96
static int Abc_NtkLatchNum(Abc_Ntk_t *pNtk)
Definition: abc.h:294
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition: abcObj.c:633
static int Abc_ObjFaninC0(Abc_Obj_t *pObj)
Definition: abc.h:377
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:419
static int Abc_NtkCiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:287
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition: abc.h:519
static Abc_Obj_t * Abc_NtkCi(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:317
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition: abcDfs.c:81
static abctime Abc_Clock()
Definition: abc_global.h:279
void Map_ManSetInputArrivals(Map_Man_t *p, Map_Time_t *pArrivals)
Definition: mapperCreate.c:66
static void Vec_StrPush(Vec_Str_t *p, char Entry)
Definition: vecStr.h:535
static Abc_Obj_t * Abc_NtkObj(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:314
Abc_Obj_t * Abc_NodeFromMapSuper_rec(Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, Map_Super_t *pSuper, Abc_Obj_t *pNodePis[], int nNodePis)
Definition: abcMap.c:304
int * Abc_NtkOutputMiniMapping(void *pAbc0)
Definition: abcMap.c:875
int Map_NodeIsConst(Map_Node_t *p)
Definition: mapperCreate.c:112
static Abc_Obj_t * Abc_ObjFanin0(Abc_Obj_t *pObj)
Definition: abc.h:373
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:430
static float Abc_MaxFloat(float a, float b)
Definition: abc_global.h:243
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
Definition: mapper.h:67
static int Abc_NtkCoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:288
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition: mioApi.c:43
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition: abcNtk.c:1233
static Abc_Obj_t * Abc_NtkCo(Abc_Ntk_t *pNtk, int i)
Definition: abc.h:318
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
Map_Super_t * Map_CutReadSuperBest(Map_Cut_t *p, int fPhase)
Definition: mapperCreate.c:129
void Map_NodeSetRepr(Map_Node_t *p, Map_Node_t *pRepr)
Definition: mapperCreate.c:98
void * pManFunc
Definition: abc.h:191
static int Abc_ObjIsNode(Abc_Obj_t *pObj)
Definition: abc.h:355
static int Abc_NtkNodeNum(Abc_Ntk_t *pNtk)
Definition: abc.h:293
Mio_Library_t * Abc_SclDeriveGenlib(void *pScl, float Slew, float Gain, int nGatesMin, int fVerbose)
Definition: sclLibUtil.c:818
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, char *pName)
DECLARATIONS ///.
Definition: abcSop.c:56
void Map_ManSetDelayTarget(Map_Man_t *p, float DelayTarget)
Definition: mapperCreate.c:65
DECLARATIONS ///.
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition: abcNtk.c:106
Abc_Obj_t * pCopy
Definition: abc.h:148
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static Abc_Ntk_t * Abc_NtkFromMapSuperChoice(Map_Man_t *pMan, Abc_Ntk_t *pNtk)
Definition: abcMap.c:545
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition: abcObj.c:662
static void Vec_StrFree(Vec_Str_t *p)
Definition: bblif.c:616
Map_Node_t ** Map_ManReadInputs(Map_Man_t *p)
Definition: mapperCreate.c:52
void Abc_NtkSetCoRequiredTime(void *pAbc0, int iCo, float Rise, float Fall)
Definition: abcMap.c:944
void Map_ManSetOutputRequireds(Map_Man_t *p, Map_Time_t *pArrivals)
Definition: mapperCreate.c:67
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
int Map_ManReadBufNum(Map_Man_t *p)
Definition: mapperCreate.c:51
ABC_DLL void * Abc_FrameReadLibSuper()
Definition: mainFrame.c:58
int Map_SuperLibDeriveFromGenlib(Mio_Library_t *pLib, int fVerbose)
Definition: mapperLib.c:199
void Mio_LibraryMultiArea(Mio_Library_t *pLib, double Multi)
Definition: mioUtils.c:829
STRUCTURE DEFINITIONS ///.
Definition: mioInt.h:61
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Map_CutReadLeavesNum(Map_Cut_t *p)
Definition: mapperCreate.c:132
Map_Node_t ** Map_CutReadLeaves(Map_Cut_t *p)
Definition: mapperCreate.c:133
void Extra_ProgressBarStop(ProgressBar *p)
void Map_ManSetSwitching(Map_Man_t *p, int fSwitching)
Definition: mapperCreate.c:75
char * Map_NodeReadData(Map_Node_t *p, int fPhase)
Definition: mapperCreate.c:89
static Abc_Obj_t * Abc_NodeFromMapPhase_rec(Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, int fPhase)
Definition: abcMap.c:348
Vec_Int_t * Sim_NtkComputeSwitching(Abc_Ntk_t *pNtk, int nPatterns)
FUNCTION DEFINITIONS ///.
Definition: simSwitch.c:52
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition: abc.h:461
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
#define Map_Regular(p)
Definition: mapper.h:68
void Mio_LibraryTransferDelays(Mio_Library_t *pLibD, Mio_Library_t *pLibS)
Definition: mioUtils.c:872
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition: mainFrame.c:282
static Abc_Ntk_t * Abc_NtkFromMap(Map_Man_t *pMan, Abc_Ntk_t *pNtk)
Definition: abcMap.c:420
typedefABC_NAMESPACE_HEADER_START struct Map_ManStruct_t_ Map_Man_t
INCLUDES ///.
Definition: mapper.h:40
ABC_DLL Abc_Time_t * Abc_NtkGetCiArrivalTimes(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:619
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Definition: abcUtil.c:1047
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
Definition: mioApi.c:150
static int Abc_AigNodeIsChoice(Abc_Obj_t *pNode)
Definition: abc.h:398
Map_Time_t * Abc_NtkMapCopyCiArrival(Abc_Ntk_t *pNtk, Abc_Time_t *ppTimes)
Definition: abcMap.c:178
float Fall
Definition: abc.h:125
Abc_Ntk_t * pNtk
Definition: abc.h:130
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition: abc.h:515
static int Abc_NtkPoNum(Abc_Ntk_t *pNtk)
Definition: abc.h:286
Map_Node_t ** Map_ManReadOutputs(Map_Man_t *p)
Definition: mapperCreate.c:53
ABC_DLL void Abc_NtkTimeSetRequired(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition: abcTiming.c:200
ABC_DLL int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fDirect)
Definition: abcFunc.c:359
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
int nBarBufs
Definition: abc.h:174
void Map_ManCreateNodeDelays(Map_Man_t *p, int LogFan)
Definition: mapperCreate.c:284
Map_Node_t * Map_NodeAnd(Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
Definition: mapperCreate.c:447
#define ABC_FREE(obj)
Definition: abc_global.h:232
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition: abcObj.c:604
int Id
Definition: abc.h:132
void Map_ManSetAreaRecovery(Map_Man_t *p, int fAreaRecovery)
Definition: mapperCreate.c:64
ABC_DLL void * Abc_FrameReadLibScl()
Definition: mainFrame.c:59
static int Abc_NtkPiNum(Abc_Ntk_t *pNtk)
Definition: abc.h:285
#define ABC_PRT(a, t)
Definition: abc_global.h:220
void Map_ManFree(Map_Man_t *pMan)
Definition: mapperCreate.c:248
static Abc_Obj_t * Abc_NtkCreateNode(Abc_Ntk_t *pNtk)
Definition: abc.h:308
Map_Node_t * Map_NodeBuf(Map_Man_t *p, Map_Node_t *p1)
Definition: mapperCreate.c:552
void Abc_NtkTestMiniMapping(Abc_Ntk_t *p)
Definition: abcMap.c:909
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int Map_SuperReadFaninNum(Map_Super_t *p)
Definition: mapperCreate.c:154
static void Abc_NodeFromMapCutPhase(Abc_Ntk_t *pNtkNew, Map_Cut_t *pCut, int fPhase)
Definition: abcMap.c:643
int Map_Mapping(Map_Man_t *p)
DECLARATIONS ///.
Definition: mapperCore.c:50
Vec_Int_t * Abc_NtkWriteMiniMapping(Abc_Ntk_t *pNtk)
Definition: abcMap.c:770
Mio_Gate_t * Map_SuperReadRoot(Map_Super_t *p)
Definition: mapperCreate.c:151
Abc_Obj_t * pNext
Definition: abc.h:131
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition: abcUtil.c:507
#define assert(ex)
Definition: util_old.h:213
static void Extra_ProgressBarUpdate(ProgressBar *p, int nItemsCur, char *pString)
Definition: extra.h:243
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int strlen()
void Map_NodeSetSwitching(Map_Node_t *p, float Switching)
Definition: mapperCreate.c:99
static void Vec_StrPrintStr(Vec_Str_t *p, const char *pStr)
Definition: vecStr.h:627
Map_Node_t * Map_ManReadBufDriver(Map_Man_t *p, int i)
Definition: mapperCreate.c:55
Abc_Ntk_t * Abc_NtkMap(Abc_Ntk_t *pNtk, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition: abcMap.c:59
int Map_SuperReadNum(Map_Super_t *p)
Definition: mapperCreate.c:152
void Map_ManCleanData(Map_Man_t *p)
Definition: mapperUtils.c:652
void * pData
Definition: abc.h:145
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition: abc.h:517
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
unsigned Map_CutReadPhaseBest(Map_Cut_t *p, int fPhase)
Definition: mapperCreate.c:134
void Map_NodeSetNextE(Map_Node_t *p, Map_Node_t *pNextE)
Definition: mapperCreate.c:97
static int Abc_ObjIsComplement(Abc_Obj_t *p)
Definition: abc.h:322
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition: mioApi.c:143
Map_Cut_t * Map_NodeReadCutBest(Map_Node_t *p, int fPhase)
Definition: mapperCreate.c:93
void Abc_NtkPrintMiniMapping(int *pArray)
Definition: abcMap.c:834
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition: mioApi.c:48
float Rise
Definition: abc.h:124
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition: mioApi.c:153
static Abc_Obj_t * Abc_ObjFanout0(Abc_Obj_t *pObj)
Definition: abc.h:371
static Abc_Obj_t * Abc_NodeFromMap_rec(Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, int fPhase)
Definition: abcMap.c:385
ABC_DLL Abc_Time_t * Abc_NtkGetCoRequiredTimes(Abc_Ntk_t *pNtk)
Definition: abcTiming.c:632
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Abc_NtkSetCiArrivalTime(void *pAbc0, int iCi, float Rise, float Fall)
Definition: abcMap.c:929