ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcMap.c
Go to the documentation of this file.
1
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#include "misc/util/utilNam.h"
26#include "map/scl/sclCon.h"
27#include "map/scl/sclLib.h"
28
30
31
35
36extern Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose );
37extern Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk, int fUseBuffs );
38static Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase );
39static Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase );
40
41static Abc_Ntk_t * Abc_NtkFromMapSuperChoice( Map_Man_t * pMan, Abc_Ntk_t * pNtk );
42static void Abc_NodeSuperChoice( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNode );
43static void Abc_NodeFromMapCutPhase( Abc_Ntk_t * pNtkNew, Map_Cut_t * pCut, int fPhase );
44static Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * pSuper, Abc_Obj_t * pNodePis[], int nNodePis );
45
46
50
62Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, Mio_Library_t* userLib, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fUseBuffs, int fVerbose )
63{
64 static int fUseMulti = 0;
65 int fShowSwitching = 1;
66 Abc_Ntk_t * pNtkNew;
67 Map_Man_t * pMan;
68 Vec_Int_t * vSwitching = NULL;
69 float * pSwitching = NULL;
70 abctime clk, clkTotal = Abc_Clock();
72
73 assert( Abc_NtkIsStrash(pNtk) );
74 // derive library from SCL
75 // if the library is created here, it will be deleted when pSuperLib is deleted in Map_SuperLibFree()
77 {
78 if ( pLib && Mio_LibraryHasProfile(pLib) )
79 pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), pLib, Slew, Gain, nGatesMin, fVerbose );
80 else
81 pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), NULL, Slew, Gain, nGatesMin, fVerbose );
82 if ( Abc_FrameReadLibGen() )
83 {
86 }
87 // remove supergate library
90 }
91
92 if ( userLib != NULL ) {
93 pLib = userLib;
94 }
95
96 // quit if there is no library
97 if ( pLib == NULL )
98 {
99 printf( "The current library is not available.\n" );
100 return 0;
101 }
102 if ( AreaMulti != 0.0 )
103 fUseMulti = 1, printf( "The cell areas are multiplied by the factor: <num_fanins> ^ (%.2f).\n", AreaMulti );
104 if ( DelayMulti != 0.0 )
105 fUseMulti = 1, printf( "The cell delays are multiplied by the factor: <num_fanins> ^ (%.2f).\n", DelayMulti );
106
107 // penalize large gates by increasing their area
108 if ( AreaMulti != 0.0 )
109 Mio_LibraryMultiArea( pLib, AreaMulti );
110 if ( DelayMulti != 0.0 )
111 Mio_LibraryMultiDelay( pLib, DelayMulti );
112
113 // derive the supergate library
114 if ( fUseMulti || Abc_FrameReadLibSuper() == NULL )
115 {
116 if ( fVerbose )
117 printf( "Converting \"%s\" into supergate library \"%s\".\n",
119 // compute supergate library to be used for mapping
120 if ( Mio_LibraryHasProfile(pLib) )
121 printf( "Abc_NtkMap(): Genlib library has profile.\n" );
122 Map_SuperLibDeriveFromGenlib( pLib, fVerbose );
123 }
124
125 // return the library to normal
126 if ( AreaMulti != 0.0 )
128 if ( DelayMulti != 0.0 )
130
131 // print a warning about choice nodes
132 if ( fVerbose && Abc_NtkGetChoiceNum( pNtk ) )
133 printf( "Performing mapping with choices.\n" );
134
135 // compute switching activity
136 fShowSwitching |= fSwitching;
137 if ( fShowSwitching )
138 {
139 extern Vec_Int_t * Sim_NtkComputeSwitching( Abc_Ntk_t * pNtk, int nPatterns );
140 vSwitching = Sim_NtkComputeSwitching( pNtk, 4096 );
141 pSwitching = (float *)vSwitching->pArray;
142 }
143
144 // perform the mapping
145 pMan = Abc_NtkToMap( pNtk, DelayTarget, fRecovery, pSwitching, fVerbose );
146 if ( pSwitching ) Vec_IntFree( vSwitching );
147 if ( pMan == NULL )
148 return NULL;
149clk = Abc_Clock();
150 Map_ManSetSwitching( pMan, fSwitching );
151 Map_ManSetSkipFanout( pMan, fSkipFanout );
152 if ( fUseProfile )
153 Map_ManSetUseProfile( pMan );
154 if ( LogFan != 0 )
155 Map_ManCreateNodeDelays( pMan, LogFan );
156 if ( !Map_Mapping( pMan ) )
157 {
158 Map_ManFree( pMan );
159 return NULL;
160 }
161// Map_ManPrintStatsToFile( pNtk->pSpec, Map_ManReadAreaFinal(pMan), Map_ManReadRequiredGlo(pMan), Abc_Clock()-clk );
162
163 // reconstruct the network after mapping (use buffers when user requested or in the area mode)
164 pNtkNew = Abc_NtkFromMap( pMan, pNtk, fUseBuffs || (DelayTarget == (double)ABC_INFINITY) );
165 if ( Mio_LibraryHasProfile(pLib) )
167 Map_ManFree( pMan );
168 if ( pNtkNew == NULL )
169 return NULL;
170
171 if ( pNtk->pExdc )
172 pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
173if ( fVerbose )
174{
175ABC_PRT( "Total runtime", Abc_Clock() - clkTotal );
176}
177
178 // make sure that everything is okay
179 if ( !Abc_NtkCheck( pNtkNew ) )
180 {
181 printf( "Abc_NtkMap: The network check has failed.\n" );
182 Abc_NtkDelete( pNtkNew );
183 return NULL;
184 }
185 return pNtkNew;
186}
187
200{
201 Map_Time_t * p;
202 int i;
203 p = ABC_CALLOC( Map_Time_t, Abc_NtkCiNum(pNtk) );
204 for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
205 {
206 p[i].Fall = ppTimes[i].Fall;
207 p[i].Rise = ppTimes[i].Rise;
208 p[i].Worst = Abc_MaxFloat( p[i].Fall, p[i].Rise );
209 }
210 ABC_FREE( ppTimes );
211 return p;
212}
214{
215 Map_Time_t * p;
216 int i;
217 p = ABC_CALLOC( Map_Time_t, Abc_NtkCoNum(pNtk) );
218 for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
219 {
220 p[i].Fall = ppTimes[i].Fall;
221 p[i].Rise = ppTimes[i].Rise;
222 p[i].Worst = Abc_MaxFloat( p[i].Fall, p[i].Rise );
223 }
224 ABC_FREE( ppTimes );
225 return p;
226}
227
240{
241 Map_Time_t * p; int i;
242 p = ABC_CALLOC( Map_Time_t, Abc_NtkCiNum(pNtk) );
243 for ( i = 0; i < Abc_NtkCiNum(pNtk); i++ )
244 p[i].Fall = p[i].Rise = p[i].Worst = Scl_Int2Flt( Scl_ConGetInArr(i) );
245 return p;
246}
248{
249 Map_Time_t * p; int i;
250 p = ABC_CALLOC( Map_Time_t, Abc_NtkCoNum(pNtk) );
251 for ( i = 0; i < Abc_NtkCoNum(pNtk); i++ )
252 p[i].Fall = p[i].Rise = p[i].Worst = Scl_Int2Flt( Scl_ConGetOutReq(i) );
253 return p;
254}
255
267Map_Man_t * Abc_NtkToMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, float * pSwitching, int fVerbose )
268{
269 Map_Man_t * pMan;
270 Map_Node_t * pNodeMap;
271 Vec_Ptr_t * vNodes;
272 Abc_Obj_t * pNode, * pFanin, * pPrev;
273 int i;
274
275 assert( Abc_NtkIsStrash(pNtk) );
276
277 // start the mapping manager and set its parameters
278 pMan = Map_ManCreate( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) - pNtk->nBarBufs, Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk) - pNtk->nBarBufs, fVerbose );
279 if ( pMan == NULL )
280 return NULL;
281 Map_ManSetAreaRecovery( pMan, fRecovery );
283 Map_ManSetDelayTarget( pMan, (float)DelayTarget );
284 Map_ManCreateAigIds( pMan, Abc_NtkObjNumMax(pNtk) );
285
286 // set arrival and requireds
287 if ( Scl_ConIsRunning() && Scl_ConHasInArrs() )
289 else
291 if ( Scl_ConIsRunning() && Scl_ConHasOutReqs() )
293 else
295
296 // create PIs and remember them in the old nodes
297 Abc_NtkCleanCopy( pNtk );
299 Abc_NtkForEachCi( pNtk, pNode, i )
300 {
301 if ( i == Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
302 break;
303 pNodeMap = Map_ManReadInputs(pMan)[i];
304 pNode->pCopy = (Abc_Obj_t *)pNodeMap;
305 if ( pSwitching )
306 Map_NodeSetSwitching( pNodeMap, pSwitching[pNode->Id] );
307 Map_NodeSetAigId( pNodeMap, pNode->Id );
308 }
309
310 // load the AIG into the mapper
311 vNodes = Abc_AigDfsMap( pNtk );
312 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pNode, i )
313 {
314 if ( Abc_ObjIsLatch(pNode) )
315 {
316 pFanin = Abc_ObjFanin0(pNode);
317 pNodeMap = Map_NodeBuf( pMan, Map_NotCond( Abc_ObjFanin0(pFanin)->pCopy, (int)Abc_ObjFaninC0(pFanin) ) );
318 Abc_ObjFanout0(pNode)->pCopy = (Abc_Obj_t *)pNodeMap;
319 continue;
320 }
321 assert( Abc_ObjIsNode(pNode) );
322 // add the node to the mapper
323 pNodeMap = Map_NodeAnd( pMan,
324 Map_NotCond( Abc_ObjFanin0(pNode)->pCopy, (int)Abc_ObjFaninC0(pNode) ),
325 Map_NotCond( Abc_ObjFanin1(pNode)->pCopy, (int)Abc_ObjFaninC1(pNode) ) );
326 assert( pNode->pCopy == NULL );
327 // remember the node
328 pNode->pCopy = (Abc_Obj_t *)pNodeMap;
329 if ( pSwitching )
330 Map_NodeSetSwitching( pNodeMap, pSwitching[pNode->Id] );
331 // set up the choice node
332 if ( Abc_AigNodeIsChoice( pNode ) )
333 for ( pPrev = pNode, pFanin = (Abc_Obj_t *)pNode->pData; pFanin; pPrev = pFanin, pFanin = (Abc_Obj_t *)pFanin->pData )
334 {
335 Map_NodeSetNextE( (Map_Node_t *)pPrev->pCopy, (Map_Node_t *)pFanin->pCopy );
336 Map_NodeSetRepr( (Map_Node_t *)pFanin->pCopy, (Map_Node_t *)pNode->pCopy );
337 }
338 Map_NodeSetAigId( pNodeMap, pNode->Id );
339 }
340 assert( Map_ManReadBufNum(pMan) == pNtk->nBarBufs );
341 Vec_PtrFree( vNodes );
342
343 // set the primary outputs in the required phase
344 Abc_NtkForEachCo( pNtk, pNode, i )
345 {
346 if ( i == Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
347 break;
348 Map_ManReadOutputs(pMan)[i] = Map_NotCond( (Map_Node_t *)Abc_ObjFanin0(pNode)->pCopy, (int)Abc_ObjFaninC0(pNode) );
349 }
350 return pMan;
351}
352
364Abc_Obj_t * Abc_NodeFromMapSuper_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, Map_Super_t * pSuper, Abc_Obj_t * pNodePis[], int nNodePis )
365{
367 Mio_Gate_t * pRoot;
368 Map_Super_t ** ppFanins;
369 Abc_Obj_t * pNodeNew, * pNodeFanin;
370 int nFanins, Number, i;
371
372 // get the parameters of the supergate
373 pRoot = Map_SuperReadRoot(pSuper);
374 if ( pRoot == NULL )
375 {
376 Number = Map_SuperReadNum(pSuper);
377 if ( Number < nNodePis )
378 {
379 return pNodePis[Number];
380 }
381 else
382 {
383// assert( 0 );
384 /* It might happen that a super gate with 5 inputs is constructed that
385 * actually depends only on the first four variables; i.e the fifth is a
386 * don't care -- in that case we connect constant node for the fifth
387 * (since the cut only has 4 variables). An interesting question is what
388 * if the first variable (and not the fifth one is the redundant one;
389 * can that happen?) */
390 return Abc_NtkCreateNodeConst0(pNtkNew);
391 }
392 }
393 pRoot = Mio_LibraryReadGateByName( pLib, Mio_GateReadName(pRoot), NULL );
394
395 // get information about the fanins of the supergate
396 nFanins = Map_SuperReadFaninNum( pSuper );
397 ppFanins = Map_SuperReadFanins( pSuper );
398 // create a new node with these fanins
399 pNodeNew = Abc_NtkCreateNode( pNtkNew );
400 for ( i = 0; i < nFanins; i++ )
401 {
402 pNodeFanin = Abc_NodeFromMapSuper_rec( pNtkNew, pNodeMap, ppFanins[i], pNodePis, nNodePis );
403 Abc_ObjAddFanin( pNodeNew, pNodeFanin );
404 }
405 pNodeNew->pData = pRoot;
406 return pNodeNew;
407}
408Abc_Obj_t * Abc_NodeFromMapPhase_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase )
409{
410 Abc_Obj_t * pNodePIs[10];
411 Abc_Obj_t * pNodeNew;
412 Map_Node_t ** ppLeaves;
413 Map_Cut_t * pCutBest;
414 Map_Super_t * pSuperBest;
415 unsigned uPhaseBest;
416 int i, fInvPin, nLeaves;
417
418 // make sure the node can be implemented in this phase
419 assert( Map_NodeReadCutBest(pNodeMap, fPhase) != NULL || Map_NodeIsConst(pNodeMap) );
420 // check if the phase is already implemented
421 pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
422 if ( pNodeNew )
423 return pNodeNew;
424
425 // get the information about the best cut
426 pCutBest = Map_NodeReadCutBest( pNodeMap, fPhase );
427 pSuperBest = Map_CutReadSuperBest( pCutBest, fPhase );
428 uPhaseBest = Map_CutReadPhaseBest( pCutBest, fPhase );
429 nLeaves = Map_CutReadLeavesNum( pCutBest );
430 ppLeaves = Map_CutReadLeaves( pCutBest );
431 //Vec_Ptr_t * vAnds = Map_CutInternalNodes( pNodeMap, pCutBest );
432
433 // collect the PI nodes
434 for ( i = 0; i < nLeaves; i++ )
435 {
436 fInvPin = ((uPhaseBest & (1 << i)) > 0);
437 pNodePIs[i] = Abc_NodeFromMap_rec( pNtkNew, ppLeaves[i], !fInvPin );
438 assert( pNodePIs[i] != NULL );
439 }
440
441 // implement the supergate
442 pNodeNew = Abc_NodeFromMapSuper_rec( pNtkNew, pNodeMap, pSuperBest, pNodePIs, nLeaves );
443 Vec_IntWriteEntry( pNtkNew->vOrigNodeIds, pNodeNew->Id, Abc_Var2Lit( Map_NodeReadAigId(pNodeMap), fPhase ) );
444 Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeNew );
445 return pNodeNew;
446}
447Abc_Obj_t * Abc_NodeFromMap_rec( Abc_Ntk_t * pNtkNew, Map_Node_t * pNodeMap, int fPhase )
448{
449 Abc_Obj_t * pNodeNew, * pNodeInv;
450
451 // check the case of constant node
452 if ( Map_NodeIsConst(pNodeMap) )
453 {
454 pNodeNew = fPhase? Abc_NtkCreateNodeConst1(pNtkNew) : Abc_NtkCreateNodeConst0(pNtkNew);
455 if ( pNodeNew->pData == NULL )
456 printf( "Error creating mapped network: Library does not have a constant %d gate.\n", fPhase );
457 return pNodeNew;
458 }
459
460 // check if the phase is already implemented
461 pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
462 if ( pNodeNew )
463 return pNodeNew;
464
465 // implement the node if the best cut is assigned
466 if ( Map_NodeReadCutBest(pNodeMap, fPhase) != NULL )
467 return Abc_NodeFromMapPhase_rec( pNtkNew, pNodeMap, fPhase );
468
469 // if the cut is not assigned, implement the node
470 assert( Map_NodeReadCutBest(pNodeMap, !fPhase) != NULL || Map_NodeIsConst(pNodeMap) );
471 pNodeNew = Abc_NodeFromMapPhase_rec( pNtkNew, pNodeMap, !fPhase );
472
473 // add the inverter
474 pNodeInv = Abc_NtkCreateNode( pNtkNew );
475 Vec_IntWriteEntry( pNtkNew->vOrigNodeIds, pNodeInv->Id, Abc_Var2Lit( Map_NodeReadAigId(pNodeMap), fPhase ) );
476 Abc_ObjAddFanin( pNodeInv, pNodeNew );
478
479 // set the inverter
480 Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeInv );
481 return pNodeInv;
482}
483Abc_Ntk_t * Abc_NtkFromMap( Map_Man_t * pMan, Abc_Ntk_t * pNtk, int fUseBuffs )
484{
485 Abc_Ntk_t * pNtkNew;
486 Map_Node_t * pNodeMap;
487 Abc_Obj_t * pNode, * pNodeNew;
488 int i, nDupGates;
489 assert( Map_ManReadBufNum(pMan) == pNtk->nBarBufs );
490 // create the new network
491 pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_MAP );
492 pNtkNew->vOrigNodeIds = Vec_IntStartFull( 2 * Abc_NtkObjNumMax(pNtk) );
493 // make the mapper point to the new network
494 Map_ManCleanData( pMan );
495 Abc_NtkForEachCi( pNtk, pNode, i )
496 {
497 if ( i >= Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
498 break;
499 Map_NodeSetData( Map_ManReadInputs(pMan)[i], 1, (char *)pNode->pCopy );
500 }
501 Abc_NtkForEachCi( pNtk, pNode, i )
502 {
503 if ( i < Abc_NtkCiNum(pNtk) - pNtk->nBarBufs )
504 continue;
505 Map_NodeSetData( Map_ManReadBufs(pMan)[i - (Abc_NtkCiNum(pNtk) - pNtk->nBarBufs)], 1, (char *)pNode->pCopy );
506 }
507 // assign the mapping of the required phase to the POs
508 Abc_NtkForEachCo( pNtk, pNode, i )
509 {
510 if ( i < Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
511 continue;
512 pNodeMap = Map_ManReadBufDriver( pMan, i - (Abc_NtkCoNum(pNtk) - pNtk->nBarBufs) );
513 pNodeNew = Abc_NodeFromMap_rec( pNtkNew, Map_Regular(pNodeMap), !Map_IsComplement(pNodeMap) );
514 assert( !Abc_ObjIsComplement(pNodeNew) );
515 Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
516 }
517 Abc_NtkForEachCo( pNtk, pNode, i )
518 {
519 if ( i >= Abc_NtkCoNum(pNtk) - pNtk->nBarBufs )
520 break;
521 pNodeMap = Map_ManReadOutputs(pMan)[i];
522 pNodeNew = Abc_NodeFromMap_rec( pNtkNew, Map_Regular(pNodeMap), !Map_IsComplement(pNodeMap) );
523 assert( !Abc_ObjIsComplement(pNodeNew) );
524 Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
525 }
526 // decouple the PO driver nodes to reduce the number of levels
527 nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, !fUseBuffs );
528// if ( nDupGates && Map_ManReadVerbose(pMan) )
529// printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
530 return pNtkNew;
531}
532
545{
546 Abc_Ntk_t * pNtkNew;
547
548 Map_Man_t * pMan;
549
550 assert( Abc_NtkIsStrash(pNtk) );
551
552 // check that the library is available
553 if ( Abc_FrameReadLibGen() == NULL )
554 {
555 printf( "The current library is not available.\n" );
556 return 0;
557 }
558
559 // derive the supergate library
560 if ( Abc_FrameReadLibSuper() == NULL && Abc_FrameReadLibGen() )
561 {
562// printf( "A simple supergate library is derived from gate library \"%s\".\n",
563// Mio_LibraryReadName((Mio_Library_t *)Abc_FrameReadLibGen()) );
565 }
566
567 // print a warning about choice nodes
568 if ( Abc_NtkGetChoiceNum( pNtk ) )
569 printf( "Performing mapping with choices.\n" );
570
571 // perform the mapping
572 pMan = Abc_NtkToMap( pNtk, -1, 1, NULL, 0 );
573 if ( pMan == NULL )
574 return NULL;
575 if ( !Map_Mapping( pMan ) )
576 {
577 Map_ManFree( pMan );
578 return NULL;
579 }
580
581 // reconstruct the network after mapping
582 pNtkNew = Abc_NtkFromMapSuperChoice( pMan, pNtk );
583 if ( pNtkNew == NULL )
584 return NULL;
585 Map_ManFree( pMan );
586
587 // make sure that everything is okay
588 if ( !Abc_NtkCheck( pNtkNew ) )
589 {
590 printf( "Abc_NtkMap: The network check has failed.\n" );
591 Abc_NtkDelete( pNtkNew );
592 return NULL;
593 }
594 return pNtkNew;
595}
596
597
609Abc_Ntk_t * Abc_NtkFromMapSuperChoice( Map_Man_t * pMan, Abc_Ntk_t * pNtk )
610{
611 extern Abc_Ntk_t * Abc_NtkMulti( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor );
612 ProgressBar * pProgress;
613 Abc_Ntk_t * pNtkNew, * pNtkNew2;
614 Abc_Obj_t * pNode;
615 int i;
616
617 // save the pointer to the mapped nodes
618 Abc_NtkForEachCi( pNtk, pNode, i )
619 pNode->pNext = pNode->pCopy;
620 Abc_NtkForEachPo( pNtk, pNode, i )
621 pNode->pNext = pNode->pCopy;
622 Abc_NtkForEachNode( pNtk, pNode, i )
623 pNode->pNext = pNode->pCopy;
624
625 // duplicate the network
626 pNtkNew2 = Abc_NtkDup( pNtk );
627 pNtkNew = Abc_NtkMulti( pNtkNew2, 0, 20, 0, 0, 1, 0 );
628 if ( !Abc_NtkBddToSop( pNtkNew, -1, ABC_INFINITY, 1 ) )
629 {
630 printf( "Abc_NtkFromMapSuperChoice(): Converting to SOPs has failed.\n" );
631 return NULL;
632 }
633
634 // set the old network to point to the new network
635 Abc_NtkForEachCi( pNtk, pNode, i )
636 pNode->pCopy = pNode->pCopy->pCopy;
637 Abc_NtkForEachPo( pNtk, pNode, i )
638 pNode->pCopy = pNode->pCopy->pCopy;
639 Abc_NtkForEachNode( pNtk, pNode, i )
640 pNode->pCopy = pNode->pCopy->pCopy;
641 Abc_NtkDelete( pNtkNew2 );
642
643 // set the pointers from the mapper to the new nodes
644 Abc_NtkForEachCi( pNtk, pNode, i )
645 {
646 Map_NodeSetData( Map_ManReadInputs(pMan)[i], 0, (char *)Abc_NtkCreateNodeInv(pNtkNew,pNode->pCopy) );
647 Map_NodeSetData( Map_ManReadInputs(pMan)[i], 1, (char *)pNode->pCopy );
648 }
649 Abc_NtkForEachNode( pNtk, pNode, i )
650 {
651// if ( Abc_NodeIsConst(pNode) )
652// continue;
653 Map_NodeSetData( (Map_Node_t *)pNode->pNext, 0, (char *)Abc_NtkCreateNodeInv(pNtkNew,pNode->pCopy) );
654 Map_NodeSetData( (Map_Node_t *)pNode->pNext, 1, (char *)pNode->pCopy );
655 }
656
657 // assign the mapping of the required phase to the POs
658 pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) );
659 Abc_NtkForEachNode( pNtk, pNode, i )
660 {
661 Extra_ProgressBarUpdate( pProgress, i, NULL );
662// if ( Abc_NodeIsConst(pNode) )
663// continue;
664 Abc_NodeSuperChoice( pNtkNew, pNode );
665 }
666 Extra_ProgressBarStop( pProgress );
667 return pNtkNew;
668}
669
670
682void Abc_NodeSuperChoice( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNode )
683{
684 Map_Node_t * pMapNode = (Map_Node_t *)pNode->pNext;
685 Map_Cut_t * pCuts, * pTemp;
686
687 pCuts = Map_NodeReadCuts(pMapNode);
688 for ( pTemp = Map_CutReadNext(pCuts); pTemp; pTemp = Map_CutReadNext(pTemp) )
689 {
690 Abc_NodeFromMapCutPhase( pNtkNew, pTemp, 0 );
691 Abc_NodeFromMapCutPhase( pNtkNew, pTemp, 1 );
692 }
693}
694
695
707void Abc_NodeFromMapCutPhase( Abc_Ntk_t * pNtkNew, Map_Cut_t * pCut, int fPhase )
708{
709 Abc_Obj_t * pNodePIs[10];
710 Map_Node_t ** ppLeaves;
711 Map_Super_t * pSuperBest;
712 unsigned uPhaseBest;
713 int i, fInvPin, nLeaves;
714
715 pSuperBest = Map_CutReadSuperBest( pCut, fPhase );
716 if ( pSuperBest == NULL )
717 return;
718
719 // get the information about the best cut
720 uPhaseBest = Map_CutReadPhaseBest( pCut, fPhase );
721 nLeaves = Map_CutReadLeavesNum( pCut );
722 ppLeaves = Map_CutReadLeaves( pCut );
723
724 // collect the PI nodes
725 for ( i = 0; i < nLeaves; i++ )
726 {
727 fInvPin = ((uPhaseBest & (1 << i)) > 0);
728 pNodePIs[i] = (Abc_Obj_t *)Map_NodeReadData( ppLeaves[i], !fInvPin );
729 assert( pNodePIs[i] != NULL );
730 }
731
732 // implement the supergate
733 Abc_NodeFromMapSuperChoice_rec( pNtkNew, pSuperBest, pNodePIs, nLeaves );
734}
735
736
748Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec( Abc_Ntk_t * pNtkNew, Map_Super_t * pSuper, Abc_Obj_t * pNodePis[], int nNodePis )
749{
751 Mio_Gate_t * pRoot;
752 Map_Super_t ** ppFanins;
753 Abc_Obj_t * pNodeNew, * pNodeFanin;
754 int nFanins, Number, i;
755
756 // get the parameters of the supergate
757 pRoot = Map_SuperReadRoot(pSuper);
758 if ( pRoot == NULL )
759 {
760 Number = Map_SuperReadNum(pSuper);
761 if ( Number < nNodePis )
762 {
763 return pNodePis[Number];
764 }
765 else
766 {
767// assert( 0 );
768 /* It might happen that a super gate with 5 inputs is constructed that
769 * actually depends only on the first four variables; i.e the fifth is a
770 * don't care -- in that case we connect constant node for the fifth
771 * (since the cut only has 4 variables). An interesting question is what
772 * if the first variable (and not the fifth one is the redundant one;
773 * can that happen?) */
774 return Abc_NtkCreateNodeConst0(pNtkNew);
775 }
776 }
777 pRoot = Mio_LibraryReadGateByName( pLib, Mio_GateReadName(pRoot), NULL );
778
779 // get information about the fanins of the supergate
780 nFanins = Map_SuperReadFaninNum( pSuper );
781 ppFanins = Map_SuperReadFanins( pSuper );
782 // create a new node with these fanins
783 pNodeNew = Abc_NtkCreateNode( pNtkNew );
784 for ( i = 0; i < nFanins; i++ )
785 {
786 pNodeFanin = Abc_NodeFromMapSuperChoice_rec( pNtkNew, ppFanins[i], pNodePis, nNodePis );
787 Abc_ObjAddFanin( pNodeNew, pNodeFanin );
788 }
789 pNodeNew->pData = Abc_SopRegister( (Mem_Flex_t *)pNtkNew->pManFunc, Mio_GateReadSop(pRoot) );
790 return pNodeNew;
791}
792
805{
806 Abc_Obj_t * pNode2;
807 Mio_Gate_t * pGate = (Mio_Gate_t *)pNode->pData;
808 assert( Abc_NtkHasMapping(pNode->pNtk) );
809 if ( pGate == NULL || Mio_GateReadTwin(pGate) == NULL )
810 return NULL;
811 // assuming the twin node is following next
812 if ( (int)Abc_ObjId(pNode) == Abc_NtkObjNumMax(pNode->pNtk) - 1 )
813 return NULL;
814 pNode2 = Abc_NtkObj( pNode->pNtk, Abc_ObjId(pNode) + 1 );
815 if ( pNode2 == NULL || !Abc_ObjIsNode(pNode2) || Abc_ObjFaninNum(pNode) != Abc_ObjFaninNum(pNode2) )
816 return NULL;
817 if ( Mio_GateReadTwin(pGate) != (Mio_Gate_t *)pNode2->pData )
818 return NULL;
819 return pNode2;
820}
821
822
835{
836 Vec_Ptr_t * vNodes;
837 Vec_Int_t * vMapping;
838 Vec_Str_t * vGates;
839 Abc_Obj_t * pObj, * pFanin;
840 int i, k, nNodes, nFanins, nExtra, * pArray;
841 assert( Abc_NtkHasMapping(pNtk) );
842 // collect nodes in the DFS order
843 vNodes = Abc_NtkDfs( pNtk, 0 );
844 // assign unique numbers
845 nNodes = nFanins = 0;
846 Abc_NtkForEachCi( pNtk, pObj, i )
847 pObj->iTemp = nNodes++;
848 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
849 pObj->iTemp = nNodes++, nFanins += Abc_ObjFaninNum(pObj);
850 // allocate attay to store mapping (4 counters + fanins for each node + PO drivers + gate names)
851 vMapping = Vec_IntAlloc( 4 + Abc_NtkNodeNum(pNtk) + nFanins + Abc_NtkCoNum(pNtk) + 10000 );
852 // write the numbers of CI/CO/Node/FF
853 Vec_IntPush( vMapping, Abc_NtkCiNum(pNtk) );
854 Vec_IntPush( vMapping, Abc_NtkCoNum(pNtk) );
855 Vec_IntPush( vMapping, Vec_PtrSize(vNodes) );
856 Vec_IntPush( vMapping, Abc_NtkLatchNum(pNtk) );
857 // write the nodes
858 vGates = Vec_StrAlloc( 10000 );
859 Vec_PtrForEachEntry( Abc_Obj_t *, vNodes, pObj, i )
860 {
861 Vec_IntPush( vMapping, Abc_ObjFaninNum(pObj) );
862 Abc_ObjForEachFanin( pObj, pFanin, k )
863 Vec_IntPush( vMapping, pFanin->iTemp );
864 // remember this gate (to be added to the mapping later)
865 Vec_StrPrintStr( vGates, Mio_GateReadName((Mio_Gate_t *)pObj->pData) );
866 Vec_StrPush( vGates, '\0' );
867 }
868 // write the COs literals
869 Abc_NtkForEachCo( pNtk, pObj, i )
870 Vec_IntPush( vMapping, Abc_ObjFanin0(pObj)->iTemp );
871 // write signal names
872 Abc_NtkForEachCi( pNtk, pObj, i ) {
873 Vec_StrPrintStr( vGates, Abc_ObjName(pObj) );
874 Vec_StrPush( vGates, '\0' );
875 }
876 Abc_NtkForEachCo( pNtk, pObj, i ) {
877 Vec_StrPrintStr( vGates, Abc_ObjName(pObj) );
878 Vec_StrPush( vGates, '\0' );
879 }
880 // finish off the array
881 nExtra = 4 - Vec_StrSize(vGates) % 4;
882 for ( i = 0; i < nExtra; i++ )
883 Vec_StrPush( vGates, '\0' );
884 // add gates to the array
885 assert( Vec_StrSize(vGates) % 4 == 0 );
886 nExtra = Vec_StrSize(vGates) / 4;
887 pArray = (int *)Vec_StrArray(vGates);
888 for ( i = 0; i < nExtra; i++ )
889 Vec_IntPush( vMapping, pArray[i] );
890 // cleanup and return
891 Vec_PtrFree( vNodes );
892 Vec_StrFree( vGates );
893 return vMapping;
894}
895
908{
909 if ( !pArray ) {
910 printf("Mapping is not available.\n");
911 return NULL;
912 }
914 if ( !pLib ) {
915 printf("Library is not available.\n");
916 return NULL;
917 }
919 pNtkMapped->pName = Extra_UtilStrsav( "mapped" );
920 pNtkMapped->pManFunc = pLib;
921 int nCis, nCos, nNodes, nFlops;
922 int i, k, nLeaves, Pos = 4;
923 char * pBuffer, * pName;
924 Mio_Gate_t *pGate;
925 Abc_Obj_t * pObj;
926 nCis = pArray[0];
927 nCos = pArray[1];
928 nNodes = pArray[2];
929 nFlops = pArray[3];
930 // create pis
931 for ( i = 0; i < nCis-nFlops; i++ )
932 Abc_NtkCreatePi( pNtkMapped );
933 // create nodes
934 for ( i = 0; i < nNodes; i++ )
935 Abc_NtkCreateNode( pNtkMapped );
936 // create pos
937 for ( i = 0; i < nCos-nFlops; i++ )
938 Abc_NtkCreatePo( pNtkMapped );
939 // create flops
940 for ( i = 0; i < nFlops; i++ )
941 Abc_NtkAddLatch( pNtkMapped, NULL, ABC_INIT_ZERO );
942 // connect nodes
943 for ( i = 0; i < nNodes; i++ )
944 {
945 nLeaves = pArray[Pos++];
946 for ( k = 0; k < nLeaves; k++ )
947 Abc_ObjAddFanin( Abc_NtkObj( pNtkMapped, nCis + i + 1 ), Abc_NtkObj( pNtkMapped, pArray[Pos++] + 1 ) );
948 }
949 for ( i = 0; i < nCos; i++ )
950 Abc_ObjAddFanin( Abc_NtkCo( pNtkMapped, i ), Abc_NtkObj( pNtkMapped, pArray[Pos++] + 1 ) );
951
952 pBuffer = (char *)(pArray + Pos);
953 for ( i = 0; i < nNodes; i++ )
954 {
955 pName = pBuffer;
956 pBuffer += strlen(pName) + 1;
957 pGate = Mio_LibraryReadGateByName( pLib, pName, NULL );
958 Abc_NtkObj( pNtkMapped, nCis + i + 1 )->pData = pGate;
959 }
960
961 assert( Abc_NtkCiNum(pNtkMapped) == nCis );
962 Abc_NtkForEachCi( pNtkMapped, pObj, i ) {
963 pName = pBuffer;
964 pBuffer += strlen(pName) + 1;
965 Abc_ObjAssignName( pObj, pName, NULL );
966 }
967 assert( Abc_NtkCoNum(pNtkMapped) == nCos );
968 Abc_NtkForEachCo( pNtkMapped, pObj, i ) {
969 pName = pBuffer;
970 pBuffer += strlen(pName) + 1;
971 Abc_ObjAssignName( pObj, pName, NULL );
972 }
973
974 if ( !Abc_NtkCheck( pNtkMapped ) ) {
975 fprintf( stdout, "Abc_NtkFromMiniMapping(): Network check has failed.\n" );
976 }
977
978 return pNtkMapped;
979}
980
992Abc_Ntk_t * Abc_NtkReadFromFile( char * pFileName )
993{
994 int nSize = Extra_FileSize( pFileName );
995 if ( nSize == 0 )
996 return NULL;
997 FILE * pFile = fopen( pFileName, "rb" );
998 char * pArray = ABC_ALLOC( char, nSize );
999 int nSize2 = fread( pArray, sizeof(char), nSize, pFile );
1000 assert( nSize2 == nSize );
1001 fclose( pFile );
1002 Abc_Ntk_t * pNtk = Abc_NtkFromMiniMapping( (int*)pArray );
1003 ABC_FREE( pArray );
1004 return pNtk;
1005}
1006int Abc_NtkWriteToFile( char * pFileName, Abc_Ntk_t * pNtk )
1007{
1008 Vec_Int_t * vRes = Abc_NtkWriteMiniMapping( pNtk );
1009 FILE * pFile = fopen( pFileName, "wb" );
1010 if ( pFile == NULL ) { printf( "Cannot open input file \"%s\" for writing.\n", pFileName ); return 0; }
1011 int nSize = fwrite( Vec_IntArray(vRes), sizeof(int), Vec_IntSize(vRes), pFile );
1012 assert( nSize == Vec_IntSize(vRes) );
1013 Vec_IntFree( vRes );
1014 fclose( pFile );
1015 return 1;
1016}
1017
1018
1030void Abc_NtkPrintMiniMapping( int * pArray )
1031{
1032 int nCis, nCos, nNodes, nFlops;
1033 int i, k, nLeaves, Pos = 4;
1034 char * pBuffer, * pName;
1035 nCis = pArray[0];
1036 nCos = pArray[1];
1037 nNodes = pArray[2];
1038 nFlops = pArray[3];
1039 printf( "Mapped network has %d CIs, %d COs, %d gates, and %d flops.\n", nCis, nCos, nNodes, nFlops );
1040 printf( "The first %d object IDs (from 0 to %d) are reserved for the CIs.\n", nCis, nCis - 1 );
1041 for ( i = 0; i < nNodes; i++ )
1042 {
1043 nLeaves = pArray[Pos++];
1044 printf( "Node %d has %d fanins {", nCis + i, nLeaves );
1045 for ( k = 0; k < nLeaves; k++ )
1046 printf( " %d", pArray[Pos++] );
1047 printf( " }\n" );
1048 }
1049 for ( i = 0; i < nCos; i++ )
1050 printf( "CO %d is driven by node %d\n", i, pArray[Pos++] );
1051 pBuffer = (char *)(pArray + Pos);
1052 for ( i = 0; i < nNodes; i++ )
1053 {
1054 pName = pBuffer;
1055 pBuffer += strlen(pName) + 1;
1056 printf( "Node %d has gate \"%s\"\n", nCis + i, pName );
1057 }
1058 for ( i = 0; i < nCis; i++ )
1059 {
1060 pName = pBuffer;
1061 pBuffer += strlen(pName) + 1;
1062 printf( "CI %d has name \"%s\"\n", i, pName );
1063 }
1064 for ( i = 0; i < nCos; i++ )
1065 {
1066 pName = pBuffer;
1067 pBuffer += strlen(pName) + 1;
1068 printf( "CO %d has name \"%s\"\n", i, pName );
1069 }
1070}
1071
1084{
1085 Abc_Ntk_t * pNtk;
1086 if ( pAbc == NULL )
1087 printf( "ABC framework is not initialized by calling Abc_Start()\n" );
1088 pNtk = Abc_NtkFromMiniMapping( (int *)p );
1089 Abc_FrameReplaceCurrentNetwork( pAbc, pNtk );
1090}
1091
1104{
1105 //Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
1106 Abc_Ntk_t * pNtk;
1107 Vec_Int_t * vMapping;
1108 int * pArray;
1109 if ( pAbc == NULL )
1110 printf( "ABC framework is not initialized by calling Abc_Start()\n" );
1111 pNtk = Abc_FrameReadNtk( pAbc );
1112 if ( pNtk == NULL )
1113 printf( "Current network in ABC framework is not defined.\n" );
1114 if ( !Abc_NtkHasMapping(pNtk) )
1115 printf( "Current network in ABC framework is not mapped.\n" );
1116 // derive mini-mapping
1117 vMapping = Abc_NtkWriteMiniMapping( pNtk );
1118 pArray = Vec_IntArray( vMapping );
1119 ABC_FREE( vMapping );
1120 // print mini-mapping (optional)
1121// Abc_NtkPrintMiniMapping( pArray );
1122 // return the array representation of mini-mapping
1123 return pArray;
1124}
1125
1138{
1139 Vec_Int_t * vMapping;
1140 vMapping = Abc_NtkWriteMiniMapping( p );
1141 Abc_NtkPrintMiniMapping( Vec_IntArray(vMapping) );
1142 printf( "Array has size %d ints.\n", Vec_IntSize(vMapping) );
1143 Vec_IntFree( vMapping );
1144}
1145
1157void Abc_NtkSetCiArrivalTime( Abc_Frame_t * pAbc, int iCi, float Rise, float Fall )
1158{
1159 //Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
1160 Abc_Ntk_t * pNtk;
1161 Abc_Obj_t * pNode;
1162 if ( pAbc == NULL )
1163 {
1164 printf( "ABC framework is not initialized by calling Abc_Start()\n" );
1165 return;
1166 }
1167 pNtk = Abc_FrameReadNtk( pAbc );
1168 if ( pNtk == NULL )
1169 {
1170 printf( "Current network in ABC framework is not defined.\n" );
1171 return;
1172 }
1173 if ( iCi < 0 || iCi >= Abc_NtkCiNum(pNtk) )
1174 {
1175 printf( "CI index is not valid.\n" );
1176 return;
1177 }
1178 pNode = Abc_NtkCi( pNtk, iCi );
1179 Abc_NtkTimeSetArrival( pNtk, Abc_ObjId(pNode), Rise, Fall );
1180}
1181void Abc_NtkSetCoRequiredTime( Abc_Frame_t * pAbc, int iCo, float Rise, float Fall )
1182{
1183 //Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
1184 Abc_Ntk_t * pNtk;
1185 Abc_Obj_t * pNode;
1186 if ( pAbc == NULL )\
1187 {
1188 printf( "ABC framework is not initialized by calling Abc_Start()\n" );
1189 return;
1190 }
1191 pNtk = Abc_FrameReadNtk( pAbc );
1192 if ( pNtk == NULL )
1193 {
1194 printf( "Current network in ABC framework is not defined.\n" );
1195 return;
1196 }
1197 if ( iCo < 0 || iCo >= Abc_NtkCoNum(pNtk) )
1198 {
1199 printf( "CO index is not valid.\n" );
1200 return;
1201 }
1202 pNode = Abc_NtkCo( pNtk, iCo );
1203 Abc_NtkTimeSetRequired( pNtk, Abc_ObjId(pNode), Rise, Fall );
1204}
1205
1217void Abc_NtkSetAndGateDelay( Abc_Frame_t * pAbc, float Delay )
1218{
1219 //Abc_Frame_t * pAbc = (Abc_Frame_t *)pAbc0;
1220 Abc_Ntk_t * pNtk;
1221 if ( pAbc == NULL )
1222 {
1223 printf( "ABC framework is not initialized by calling Abc_Start()\n" );
1224 return;
1225 }
1226 pNtk = Abc_FrameReadNtk( pAbc );
1227 if ( pNtk == NULL )
1228 {
1229 printf( "Current network in ABC framework is not defined.\n" );
1230 return;
1231 }
1232 pNtk->AndGateDelay = Delay;
1233}
1234
1238
1239
1241
Vec_Int_t * Abc_NtkWriteMiniMapping(Abc_Ntk_t *pNtk)
Definition abcMap.c:834
void Abc_NtkInputMiniMapping(Abc_Frame_t *pAbc, void *p)
Definition abcMap.c:1083
void Abc_NtkPrintMiniMapping(int *pArray)
Definition abcMap.c:1030
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:267
Map_Time_t * Abc_NtkMapCopyCiArrival(Abc_Ntk_t *pNtk, Abc_Time_t *ppTimes)
Definition abcMap.c:199
Abc_Ntk_t * Abc_NtkFromMiniMapping(int *pArray)
Definition abcMap.c:907
Abc_Obj_t * Abc_NtkFetchTwinNode(Abc_Obj_t *pNode)
Definition abcMap.c:804
int * Abc_NtkOutputMiniMapping(Abc_Frame_t *pAbc)
Definition abcMap.c:1103
int Abc_NtkWriteToFile(char *pFileName, Abc_Ntk_t *pNtk)
Definition abcMap.c:1006
Abc_Ntk_t * Abc_NtkSuperChoice(Abc_Ntk_t *pNtk)
Definition abcMap.c:544
void Abc_NtkSetAndGateDelay(Abc_Frame_t *pAbc, float Delay)
Definition abcMap.c:1217
void Abc_NtkTestMiniMapping(Abc_Ntk_t *p)
Definition abcMap.c:1137
Abc_Ntk_t * Abc_NtkMap(Abc_Ntk_t *pNtk, Mio_Library_t *userLib, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fUseBuffs, int fVerbose)
FUNCTION DEFINITIONS ///.
Definition abcMap.c:62
Map_Time_t * Abc_NtkMapCopyCoRequiredCon(Abc_Ntk_t *pNtk)
Definition abcMap.c:247
Map_Time_t * Abc_NtkMapCopyCoRequired(Abc_Ntk_t *pNtk, Abc_Time_t *ppTimes)
Definition abcMap.c:213
Abc_Ntk_t * Abc_NtkFromMap(Map_Man_t *pMan, Abc_Ntk_t *pNtk, int fUseBuffs)
Definition abcMap.c:483
Map_Time_t * Abc_NtkMapCopyCiArrivalCon(Abc_Ntk_t *pNtk)
Definition abcMap.c:239
Abc_Ntk_t * Abc_NtkReadFromFile(char *pFileName)
Definition abcMap.c:992
void Abc_NtkSetCoRequiredTime(Abc_Frame_t *pAbc, int iCo, float Rise, float Fall)
Definition abcMap.c:1181
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:364
void Abc_NtkSetCiArrivalTime(Abc_Frame_t *pAbc, int iCi, float Rise, float Fall)
Definition abcMap.c:1157
ABC_NAMESPACE_IMPL_START Abc_Ntk_t * Abc_NtkMulti(Abc_Ntk_t *pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor)
DECLARATIONS ///.
Definition abcMulti.c:650
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachCo(pNtk, pCo, i)
Definition abc.h:522
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition abcNtk.c:53
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition abcFanio.c:84
ABC_DLL Abc_Time_t * Abc_NtkGetCiArrivalTimes(Abc_Ntk_t *pNtk)
Definition abcTiming.c:750
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst1(Abc_Ntk_t *pNtk)
Definition abcObj.c:643
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
ABC_DLL Abc_Obj_t * Abc_NtkAddLatch(Abc_Ntk_t *pNtk, Abc_Obj_t *pDriver, Abc_InitType_t Init)
Definition abcLatch.c:254
ABC_DLL int Abc_NtkGetChoiceNum(Abc_Ntk_t *pNtk)
Definition abcUtil.c:463
ABC_DLL Vec_Ptr_t * Abc_NtkDfs(Abc_Ntk_t *pNtk, int fCollectAll)
Definition abcDfs.c:82
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition abcCheck.c:64
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeConst0(Abc_Ntk_t *pNtk)
Definition abcObj.c:612
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
@ ABC_INIT_ZERO
Definition abc.h:104
ABC_DLL char * Abc_ObjAssignName(Abc_Obj_t *pObj, char *pName, char *pSuffix)
Definition abcNames.c:69
@ ABC_NTK_LOGIC
Definition abc.h:57
ABC_DLL void Abc_NtkTimeSetRequired(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition abcTiming.c:224
ABC_DLL int Abc_NtkLogicMakeSimpleCos(Abc_Ntk_t *pNtk, int fDuplicate)
Definition abcUtil.c:1080
struct Abc_Time_t_ Abc_Time_t
Definition abc.h:120
ABC_DLL Abc_Obj_t * Abc_NtkCreateNodeInv(Abc_Ntk_t *pNtk, Abc_Obj_t *pFanin)
Definition abcObj.c:674
ABC_DLL char ** Abc_NtkCollectCioNames(Abc_Ntk_t *pNtk, int fCollectCos)
Definition abcNames.c:285
#define Abc_NtkForEachCi(pNtk, pCi, i)
Definition abc.h:518
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
@ ABC_FUNC_MAP
Definition abc.h:68
ABC_DLL void Abc_NtkTimeSetArrival(Abc_Ntk_t *pNtk, int ObjId, float Rise, float Fall)
Definition abcTiming.c:208
ABC_DLL Vec_Ptr_t * Abc_AigDfsMap(Abc_Ntk_t *pNtk)
Definition abcDfs.c:1238
ABC_DLL int Abc_NtkBddToSop(Abc_Ntk_t *pNtk, int fMode, int nCubeLimit, int fCubeSort)
Definition abcFunc.c:866
ABC_DLL char * Abc_SopRegister(Mem_Flex_t *pMan, const char *pName)
DECLARATIONS ///.
Definition abcSop.c:62
ABC_DLL Abc_Time_t * Abc_NtkGetCoRequiredTimes(Abc_Ntk_t *pNtk)
Definition abcTiming.c:763
ABC_DLL Abc_Ntk_t * Abc_NtkStartFrom(Abc_Ntk_t *pNtk, Abc_NtkType_t Type, Abc_NtkFunc_t Func)
Definition abcNtk.c:157
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition abcAig.c:683
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition abc_global.h:250
#define ABC_CALLOC(type, num)
Definition abc_global.h:265
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Definition abcapis.h:38
ABC_DLL void Abc_FrameSetLibSuper(void *pLib)
Definition mainFrame.c:97
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition mainFrame.c:327
ABC_DLL void * Abc_FrameReadLibSuper()
Definition mainFrame.c:61
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition mainFrame.c:538
ABC_DLL void * Abc_FrameReadLibScl()
Definition mainFrame.c:62
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
ABC_NAMESPACE_IMPL_START typedef char ProgressBar
Definition bbrNtbdd.c:27
ush Pos
Definition deflate.h:88
Cube * p
Definition exorList.c:222
int Extra_FileSize(char *pFileName)
void Extra_ProgressBarStop(ProgressBar *p)
char * Extra_UtilStrsav(const char *s)
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
ProgressBar * Extra_ProgressBarStart(FILE *pFile, int nItemsTotal)
FUNCTION DEFINITIONS ///.
void Map_ManSetOutputNames(Map_Man_t *p, char **ppNames)
unsigned Map_CutReadPhaseBest(Map_Cut_t *p, int fPhase)
#define Map_NotCond(p, c)
Definition mapper.h:70
void Map_NodeSetData(Map_Node_t *p, int fPhase, char *pData)
void Map_ManSetOutputRequireds(Map_Man_t *p, Map_Time_t *pArrivals)
Map_Cut_t * Map_NodeReadCutBest(Map_Node_t *p, int fPhase)
typedefABC_NAMESPACE_HEADER_START struct Map_ManStruct_t_ Map_Man_t
INCLUDES ///.
Definition mapper.h:40
void Map_NodeSetRepr(Map_Node_t *p, Map_Node_t *pRepr)
int Map_NodeReadAigId(Map_Node_t *p)
int Map_SuperLibDeriveFromGenlib(Mio_Library_t *pLib, int fVerbose)
Definition mapperLib.c:202
void Map_ManSetUseProfile(Map_Man_t *p)
int Map_CutReadLeavesNum(Map_Cut_t *p)
int Map_SuperReadFaninNum(Map_Super_t *p)
int Map_NodeIsConst(Map_Node_t *p)
Map_Cut_t * Map_NodeReadCuts(Map_Node_t *p)
void Map_ManSetSwitching(Map_Man_t *p, int fSwitching)
Mio_Gate_t * Map_SuperReadRoot(Map_Super_t *p)
struct Map_CutStruct_t_ Map_Cut_t
Definition mapper.h:43
Map_Node_t ** Map_ManReadOutputs(Map_Man_t *p)
int Map_ManReadBufNum(Map_Man_t *p)
Map_Node_t * Map_ManReadConst1(Map_Man_t *p)
Map_Node_t ** Map_ManReadInputs(Map_Man_t *p)
struct Map_SuperStruct_t_ Map_Super_t
Definition mapper.h:45
struct Map_SuperLibStruct_t_ Map_SuperLib_t
Definition mapper.h:46
struct Map_TimeStruct_t_ Map_Time_t
Definition mapper.h:49
Map_Node_t ** Map_ManReadBufs(Map_Man_t *p)
Map_Node_t * Map_ManReadBufDriver(Map_Man_t *p, int i)
void Map_ManCreateNodeDelays(Map_Man_t *p, int LogFan)
int Map_Mapping(Map_Man_t *p)
DECLARATIONS ///.
Definition mapperCore.c:50
void Map_NodeSetSwitching(Map_Node_t *p, float Switching)
Map_Super_t * Map_CutReadSuperBest(Map_Cut_t *p, int fPhase)
int Map_SuperReadNum(Map_Super_t *p)
Map_Node_t * Map_NodeBuf(Map_Man_t *p, Map_Node_t *p1)
void Map_ManSetAreaRecovery(Map_Man_t *p, int fAreaRecovery)
void Map_ManCleanData(Map_Man_t *p)
void Map_ManSetSkipFanout(Map_Man_t *p, int fSkipFanout)
char * Map_NodeReadData(Map_Node_t *p, int fPhase)
Map_Man_t * Map_ManCreate(int nInputs, int nOutputs, int fVerbose)
FUNCTION DEFINITIONS ///.
void Map_NodeSetAigId(Map_Node_t *p, int Id)
void Map_ManFree(Map_Man_t *pMan)
void Map_ManSetInputArrivals(Map_Man_t *p, Map_Time_t *pArrivals)
#define Map_Regular(p)
Definition mapper.h:68
void Map_NodeSetNextE(Map_Node_t *p, Map_Node_t *pNextE)
void Map_SuperLibFree(Map_SuperLib_t *p)
Definition mapperLib.c:170
Map_Cut_t * Map_CutReadNext(Map_Cut_t *p)
Map_Node_t * Map_NodeAnd(Map_Man_t *p, Map_Node_t *p1, Map_Node_t *p2)
Map_Super_t ** Map_SuperReadFanins(Map_Super_t *p)
Map_Node_t ** Map_CutReadLeaves(Map_Cut_t *p)
void Map_ManSetDelayTarget(Map_Man_t *p, float DelayTarget)
#define Map_IsComplement(p)
GLOBAL VARIABLES ///.
Definition mapper.h:67
void Map_ManCreateAigIds(Map_Man_t *p, int nObjs)
struct Map_NodeStruct_t_ Map_Node_t
Definition mapper.h:41
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition mioApi.c:43
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
char * Mio_GateReadSop(Mio_Gate_t *pGate)
Definition mioApi.c:179
Mio_Gate_t * Mio_GateReadTwin(Mio_Gate_t *pGate)
Definition mioApi.c:176
void Mio_LibraryTransferProfile(Mio_Library_t *pLibDst, Mio_Library_t *pLibSrc)
Definition mioUtils.c:1565
int Mio_LibraryHasProfile(Mio_Library_t *pLib)
Definition mioUtils.c:1555
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition mioApi.c:105
void Mio_LibraryMultiDelay(Mio_Library_t *pLib, double Multi)
Definition mioUtils.c:1269
char * Mio_GateReadName(Mio_Gate_t *pGate)
Definition mioApi.c:169
void Mio_LibraryTransferDelays(Mio_Library_t *pLibD, Mio_Library_t *pLibS)
Definition mioUtils.c:1300
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition mioApi.c:50
Mio_Library_t * Abc_SclDeriveGenlib(void *pScl, void *pMio, float Slew, float Gain, int nGatesMin, int fVerbose)
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
void Mio_LibraryMultiArea(Mio_Library_t *pLib, double Multi)
Definition mioUtils.c:1257
void Mio_LibraryTransferProfile2(Mio_Library_t *pLibDst, Mio_Library_t *pLibSrc)
Definition mioUtils.c:1590
struct Mem_Flex_t_ Mem_Flex_t
Definition mem.h:34
int Abc_SclHasDelayInfo(void *pScl)
Definition sclLibUtil.c:427
Vec_Int_t * Sim_NtkComputeSwitching(Abc_Ntk_t *pNtk, int nPatterns)
FUNCTION DEFINITIONS ///.
Definition simSwitch.c:52
char * pName
Definition abc.h:158
int nBarBufs
Definition abc.h:174
float AndGateDelay
Definition abc.h:194
Vec_Int_t * vOrigNodeIds
Definition abc.h:217
Abc_Ntk_t * pExdc
Definition abc.h:201
void * pManFunc
Definition abc.h:191
void * pData
Definition abc.h:145
Abc_Ntk_t * pNtk
Definition abc.h:130
int Id
Definition abc.h:132
int iTemp
Definition abc.h:149
Abc_Obj_t * pCopy
Definition abc.h:148
Abc_Obj_t * pNext
Definition abc.h:131
float Rise
Definition abc.h:124
float Fall
Definition abc.h:125
#define assert(ex)
Definition util_old.h:213
int strlen()
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