src/base/abci/abcMap.c File Reference

#include "abc.h"
#include "main.h"
#include "mio.h"
#include "mapper.h"
Include dependency graph for abcMap.c:

Go to the source code of this file.

Functions

static Map_Man_tAbc_NtkToMap (Abc_Ntk_t *pNtk, double DelayTarget, int fRecovery, float *pSwitching, int fVerbose)
static Abc_Ntk_tAbc_NtkFromMap (Map_Man_t *pMan, Abc_Ntk_t *pNtk)
static Abc_Obj_tAbc_NodeFromMap_rec (Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, int fPhase)
static Abc_Obj_tAbc_NodeFromMapPhase_rec (Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, int fPhase)
static Abc_Obj_tAbc_NodeFromMapSuper_rec (Abc_Ntk_t *pNtkNew, Map_Node_t *pNodeMap, Map_Super_t *pSuper, Abc_Obj_t *pNodePis[], int nNodePis)
static Abc_Ntk_tAbc_NtkFromMapSuperChoice (Map_Man_t *pMan, Abc_Ntk_t *pNtk)
static void Abc_NodeSuperChoice (Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode)
static void Abc_NodeFromMapCutPhase (Abc_Ntk_t *pNtkNew, Map_Cut_t *pCut, int fPhase)
static Abc_Obj_tAbc_NodeFromMapSuperChoice_rec (Abc_Ntk_t *pNtkNew, Map_Super_t *pSuper, Abc_Obj_t *pNodePis[], int nNodePis)
Abc_Ntk_tAbc_NtkMap (Abc_Ntk_t *pNtk, double DelayTarget, int fRecovery, int fSwitching, int fVerbose)
Abc_Ntk_tAbc_NtkSuperChoice (Abc_Ntk_t *pNtk)

Function Documentation

Abc_Obj_t * Abc_NodeFromMap_rec ( Abc_Ntk_t pNtkNew,
Map_Node_t pNodeMap,
int  fPhase 
) [static]

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

Synopsis [Constructs the nodes corrresponding to one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 256 of file abcMap.c.

00257 {
00258     Abc_Obj_t * pNodeNew, * pNodeInv;
00259 
00260     // check the case of constant node
00261     if ( Map_NodeIsConst(pNodeMap) )
00262         return fPhase? Abc_NtkCreateNodeConst1(pNtkNew) : Abc_NtkCreateNodeConst0(pNtkNew);
00263 
00264     // check if the phase is already implemented
00265     pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
00266     if ( pNodeNew )
00267         return pNodeNew;
00268 
00269     // implement the node if the best cut is assigned
00270     if ( Map_NodeReadCutBest(pNodeMap, fPhase) != NULL )
00271         return Abc_NodeFromMapPhase_rec( pNtkNew, pNodeMap, fPhase );
00272 
00273     // if the cut is not assigned, implement the node
00274     assert( Map_NodeReadCutBest(pNodeMap, !fPhase) != NULL || Map_NodeIsConst(pNodeMap) );
00275     pNodeNew = Abc_NodeFromMapPhase_rec( pNtkNew, pNodeMap, !fPhase );
00276 
00277     // add the inverter
00278     pNodeInv = Abc_NtkCreateNode( pNtkNew );
00279     Abc_ObjAddFanin( pNodeInv, pNodeNew );
00280     pNodeInv->pData = Mio_LibraryReadInv(Map_ManReadGenLib(Map_NodeReadMan(pNodeMap)));
00281 
00282     // set the inverter
00283     Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeInv );
00284     return pNodeInv;
00285 }

void Abc_NodeFromMapCutPhase ( Abc_Ntk_t pNtkNew,
Map_Cut_t pCut,
int  fPhase 
) [static]

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

Synopsis [Constructs the nodes corrresponding to one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 568 of file abcMap.c.

00569 {
00570     Abc_Obj_t * pNodePIs[10];
00571     Map_Node_t ** ppLeaves;
00572     Map_Super_t * pSuperBest;
00573     unsigned uPhaseBest;
00574     int i, fInvPin, nLeaves;
00575 
00576     pSuperBest = Map_CutReadSuperBest( pCut, fPhase );
00577     if ( pSuperBest == NULL )
00578         return;
00579 
00580     // get the information about the best cut 
00581     uPhaseBest = Map_CutReadPhaseBest( pCut, fPhase );
00582     nLeaves    = Map_CutReadLeavesNum( pCut );
00583     ppLeaves   = Map_CutReadLeaves( pCut );
00584 
00585     // collect the PI nodes
00586     for ( i = 0; i < nLeaves; i++ )
00587     {
00588         fInvPin = ((uPhaseBest & (1 << i)) > 0);
00589         pNodePIs[i] = (Abc_Obj_t *)Map_NodeReadData( ppLeaves[i], !fInvPin );
00590         assert( pNodePIs[i] != NULL );
00591     }
00592 
00593     // implement the supergate
00594     Abc_NodeFromMapSuperChoice_rec( pNtkNew, pSuperBest, pNodePIs, nLeaves );
00595 }

Abc_Obj_t * Abc_NodeFromMapPhase_rec ( Abc_Ntk_t pNtkNew,
Map_Node_t pNodeMap,
int  fPhase 
) [static]

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

Synopsis [Constructs the nodes corrresponding to one node.]

Description []

SideEffects []

SeeAlso []

Definition at line 298 of file abcMap.c.

00299 {
00300     Abc_Obj_t * pNodePIs[10];
00301     Abc_Obj_t * pNodeNew;
00302     Map_Node_t ** ppLeaves;
00303     Map_Cut_t * pCutBest;
00304     Map_Super_t * pSuperBest;
00305     unsigned uPhaseBest;
00306     int i, fInvPin, nLeaves;
00307 
00308     // make sure the node can be implemented in this phase
00309     assert( Map_NodeReadCutBest(pNodeMap, fPhase) != NULL || Map_NodeIsConst(pNodeMap) );
00310     // check if the phase is already implemented
00311     pNodeNew = (Abc_Obj_t *)Map_NodeReadData( pNodeMap, fPhase );
00312     if ( pNodeNew )
00313         return pNodeNew;
00314 
00315     // get the information about the best cut 
00316     pCutBest   = Map_NodeReadCutBest( pNodeMap, fPhase );
00317     pSuperBest = Map_CutReadSuperBest( pCutBest, fPhase );
00318     uPhaseBest = Map_CutReadPhaseBest( pCutBest, fPhase );
00319     nLeaves    = Map_CutReadLeavesNum( pCutBest );
00320     ppLeaves   = Map_CutReadLeaves( pCutBest );
00321 
00322     // collect the PI nodes
00323     for ( i = 0; i < nLeaves; i++ )
00324     {
00325         fInvPin = ((uPhaseBest & (1 << i)) > 0);
00326         pNodePIs[i] = Abc_NodeFromMap_rec( pNtkNew, ppLeaves[i], !fInvPin );
00327         assert( pNodePIs[i] != NULL );
00328     }
00329 
00330     // implement the supergate
00331     pNodeNew = Abc_NodeFromMapSuper_rec( pNtkNew, pNodeMap, pSuperBest, pNodePIs, nLeaves );
00332     Map_NodeSetData( pNodeMap, fPhase, (char *)pNodeNew );
00333     return pNodeNew;
00334 }

Abc_Obj_t * Abc_NodeFromMapSuper_rec ( Abc_Ntk_t pNtkNew,
Map_Node_t pNodeMap,
Map_Super_t pSuper,
Abc_Obj_t pNodePis[],
int  nNodePis 
) [static]

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

Synopsis [Constructs the nodes corrresponding to one supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 347 of file abcMap.c.

00348 {
00349     Mio_Gate_t * pRoot;
00350     Map_Super_t ** ppFanins;
00351     Abc_Obj_t * pNodeNew, * pNodeFanin;
00352     int nFanins, Number, i;
00353 
00354     // get the parameters of the supergate
00355     pRoot = Map_SuperReadRoot(pSuper);
00356     if ( pRoot == NULL )
00357     {
00358         Number = Map_SuperReadNum(pSuper);
00359         if ( Number < nNodePis )  
00360         {
00361             return pNodePis[Number];
00362         }
00363         else
00364         {  
00365 //            assert( 0 );
00366             /* It might happen that a super gate with 5 inputs is constructed that
00367              * actually depends only on the first four variables; i.e the fifth is a
00368              * don't care -- in that case we connect constant node for the fifth
00369              * (since the cut only has 4 variables). An interesting question is what
00370              * if the first variable (and not the fifth one is the redundant one;
00371              * can that happen?) */
00372             return Abc_NtkCreateNodeConst0(pNtkNew);
00373         }
00374     }
00375 
00376     // get information about the fanins of the supergate
00377     nFanins  = Map_SuperReadFaninNum( pSuper );
00378     ppFanins = Map_SuperReadFanins( pSuper );
00379     // create a new node with these fanins
00380     pNodeNew = Abc_NtkCreateNode( pNtkNew );
00381     for ( i = 0; i < nFanins; i++ )
00382     {
00383         pNodeFanin = Abc_NodeFromMapSuper_rec( pNtkNew, pNodeMap, ppFanins[i], pNodePis, nNodePis );
00384         Abc_ObjAddFanin( pNodeNew, pNodeFanin );
00385     }
00386     pNodeNew->pData = pRoot;
00387     return pNodeNew;
00388 }

Abc_Obj_t * Abc_NodeFromMapSuperChoice_rec ( Abc_Ntk_t pNtkNew,
Map_Super_t pSuper,
Abc_Obj_t pNodePis[],
int  nNodePis 
) [static]

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

Synopsis [Constructs the nodes corrresponding to one supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 609 of file abcMap.c.

00610 {
00611     Mio_Gate_t * pRoot;
00612     Map_Super_t ** ppFanins;
00613     Abc_Obj_t * pNodeNew, * pNodeFanin;
00614     int nFanins, Number, i;
00615 
00616     // get the parameters of the supergate
00617     pRoot = Map_SuperReadRoot(pSuper);
00618     if ( pRoot == NULL )
00619     {
00620         Number = Map_SuperReadNum(pSuper);
00621         if ( Number < nNodePis )  
00622         {
00623             return pNodePis[Number];
00624         }
00625         else
00626         {  
00627 //            assert( 0 );
00628             /* It might happen that a super gate with 5 inputs is constructed that
00629              * actually depends only on the first four variables; i.e the fifth is a
00630              * don't care -- in that case we connect constant node for the fifth
00631              * (since the cut only has 4 variables). An interesting question is what
00632              * if the first variable (and not the fifth one is the redundant one;
00633              * can that happen?) */
00634             return Abc_NtkCreateNodeConst0(pNtkNew);
00635         }
00636     }
00637 
00638     // get information about the fanins of the supergate
00639     nFanins  = Map_SuperReadFaninNum( pSuper );
00640     ppFanins = Map_SuperReadFanins( pSuper );
00641     // create a new node with these fanins
00642     pNodeNew = Abc_NtkCreateNode( pNtkNew );
00643     for ( i = 0; i < nFanins; i++ )
00644     {
00645         pNodeFanin = Abc_NodeFromMapSuperChoice_rec( pNtkNew, ppFanins[i], pNodePis, nNodePis );
00646         Abc_ObjAddFanin( pNodeNew, pNodeFanin );
00647     }
00648     pNodeNew->pData = Abc_SopRegister( pNtkNew->pManFunc, Mio_GateReadSop(pRoot) );
00649     return pNodeNew;
00650 }

void Abc_NodeSuperChoice ( Abc_Ntk_t pNtkNew,
Abc_Obj_t pNode 
) [static]

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

Synopsis [Creates the mapped network.]

Description []

SideEffects []

SeeAlso []

Definition at line 543 of file abcMap.c.

00544 {
00545     Map_Node_t * pMapNode = (Map_Node_t *)pNode->pNext;
00546     Map_Cut_t * pCuts, * pTemp;
00547 
00548     pCuts = Map_NodeReadCuts(pMapNode);
00549     for ( pTemp = Map_CutReadNext(pCuts); pTemp; pTemp = Map_CutReadNext(pTemp) )
00550     {
00551         Abc_NodeFromMapCutPhase( pNtkNew, pTemp, 0 );
00552         Abc_NodeFromMapCutPhase( pNtkNew, pTemp, 1 );
00553     }
00554 }

Abc_Ntk_t * Abc_NtkFromMap ( Map_Man_t pMan,
Abc_Ntk_t pNtk 
) [static]

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

Synopsis [Creates the mapped network.]

Description []

SideEffects []

SeeAlso []

Definition at line 214 of file abcMap.c.

00215 {
00216     ProgressBar * pProgress;
00217     Abc_Ntk_t * pNtkNew;
00218     Map_Node_t * pNodeMap;
00219     Abc_Obj_t * pNode, * pNodeNew;
00220     int i, nDupGates;
00221     // create the new network
00222     pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_MAP );
00223     // make the mapper point to the new network
00224     Map_ManCleanData( pMan );
00225     Abc_NtkForEachCi( pNtk, pNode, i )
00226         Map_NodeSetData( Map_ManReadInputs(pMan)[i], 1, (char *)pNode->pCopy );
00227     // assign the mapping of the required phase to the POs
00228     pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) );
00229     Abc_NtkForEachCo( pNtk, pNode, i )
00230     {
00231         Extra_ProgressBarUpdate( pProgress, i, NULL );
00232         pNodeMap = Map_ManReadOutputs(pMan)[i];
00233         pNodeNew = Abc_NodeFromMap_rec( pNtkNew, Map_Regular(pNodeMap), !Map_IsComplement(pNodeMap) );
00234         assert( !Abc_ObjIsComplement(pNodeNew) );
00235         Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
00236     }
00237     Extra_ProgressBarStop( pProgress );
00238     // decouple the PO driver nodes to reduce the number of levels
00239     nDupGates = Abc_NtkLogicMakeSimpleCos( pNtkNew, 1 );
00240 //    if ( nDupGates && Map_ManReadVerbose(pMan) )
00241 //        printf( "Duplicated %d gates to decouple the CO drivers.\n", nDupGates );
00242     return pNtkNew;
00243 }

Abc_Ntk_t * Abc_NtkFromMapSuperChoice ( Map_Man_t pMan,
Abc_Ntk_t pNtk 
) [static]

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

Synopsis [Creates the mapped network.]

Description []

SideEffects []

SeeAlso []

Definition at line 470 of file abcMap.c.

00471 {
00472     extern Abc_Ntk_t * Abc_NtkMulti( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor );
00473     ProgressBar * pProgress;
00474     Abc_Ntk_t * pNtkNew, * pNtkNew2;
00475     Abc_Obj_t * pNode;
00476     int i;
00477 
00478     // save the pointer to the mapped nodes
00479     Abc_NtkForEachCi( pNtk, pNode, i )
00480         pNode->pNext = pNode->pCopy;
00481     Abc_NtkForEachPo( pNtk, pNode, i )
00482         pNode->pNext = pNode->pCopy;
00483     Abc_NtkForEachNode( pNtk, pNode, i )
00484         pNode->pNext = pNode->pCopy;
00485 
00486     // duplicate the network
00487     pNtkNew2 = Abc_NtkDup( pNtk );
00488     pNtkNew  = Abc_NtkMulti( pNtkNew2, 0, 20, 0, 0, 1, 0 );
00489     if ( !Abc_NtkBddToSop( pNtkNew, 0 ) )
00490     {
00491         printf( "Abc_NtkFromMapSuperChoice(): Converting to SOPs has failed.\n" );
00492         return NULL;
00493     }
00494 
00495     // set the old network to point to the new network
00496     Abc_NtkForEachCi( pNtk, pNode, i )
00497         pNode->pCopy = pNode->pCopy->pCopy;
00498     Abc_NtkForEachPo( pNtk, pNode, i )
00499         pNode->pCopy = pNode->pCopy->pCopy;
00500     Abc_NtkForEachNode( pNtk, pNode, i )
00501         pNode->pCopy = pNode->pCopy->pCopy;
00502     Abc_NtkDelete( pNtkNew2 );
00503 
00504     // set the pointers from the mapper to the new nodes
00505     Abc_NtkForEachCi( pNtk, pNode, i )
00506     {
00507         Map_NodeSetData( Map_ManReadInputs(pMan)[i], 0, (char *)Abc_NtkCreateNodeInv(pNtkNew,pNode->pCopy) );
00508         Map_NodeSetData( Map_ManReadInputs(pMan)[i], 1, (char *)pNode->pCopy );
00509     }
00510     Abc_NtkForEachNode( pNtk, pNode, i )
00511     {
00512 //        if ( Abc_NodeIsConst(pNode) )
00513 //            continue;
00514         Map_NodeSetData( (Map_Node_t *)pNode->pNext, 0, (char *)Abc_NtkCreateNodeInv(pNtkNew,pNode->pCopy) );
00515         Map_NodeSetData( (Map_Node_t *)pNode->pNext, 1, (char *)pNode->pCopy );
00516     }
00517 
00518     // assign the mapping of the required phase to the POs
00519     pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) );
00520     Abc_NtkForEachNode( pNtk, pNode, i )
00521     {
00522         Extra_ProgressBarUpdate( pProgress, i, NULL );
00523 //        if ( Abc_NodeIsConst(pNode) )
00524 //            continue;
00525         Abc_NodeSuperChoice( pNtkNew, pNode );
00526     }
00527     Extra_ProgressBarStop( pProgress );
00528     return pNtkNew;
00529 }

Abc_Ntk_t* Abc_NtkMap ( Abc_Ntk_t pNtk,
double  DelayTarget,
int  fRecovery,
int  fSwitching,
int  fVerbose 
)

FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Interface with the mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 57 of file abcMap.c.

00058 {
00059     int fShowSwitching = 1;
00060     Abc_Ntk_t * pNtkNew;
00061     Map_Man_t * pMan;
00062     Vec_Int_t * vSwitching;
00063     float * pSwitching = NULL;
00064     int clk;
00065 
00066     assert( Abc_NtkIsStrash(pNtk) );
00067 
00068     // check that the library is available
00069     if ( Abc_FrameReadLibGen() == NULL )
00070     {
00071         printf( "The current library is not available.\n" );
00072         return 0;
00073     }
00074 
00075     // derive the supergate library
00076     if ( Abc_FrameReadLibSuper() == NULL && Abc_FrameReadLibGen() )
00077     {
00078         printf( "A simple supergate library is derived from gate library \"%s\".\n", 
00079             Mio_LibraryReadName(Abc_FrameReadLibGen()) );
00080         Map_SuperLibDeriveFromGenlib( Abc_FrameReadLibGen() );
00081     }
00082 
00083     // print a warning about choice nodes
00084     if ( Abc_NtkGetChoiceNum( pNtk ) )
00085         printf( "Performing mapping with choices.\n" );
00086 
00087     // compute switching activity
00088     fShowSwitching |= fSwitching;
00089     if ( fShowSwitching )
00090     {
00091         extern Vec_Int_t * Sim_NtkComputeSwitching( Abc_Ntk_t * pNtk, int nPatterns );
00092         vSwitching = Sim_NtkComputeSwitching( pNtk, 4096 );
00093         pSwitching = (float *)vSwitching->pArray;
00094     }
00095 
00096     // perform the mapping
00097     pMan = Abc_NtkToMap( pNtk, DelayTarget, fRecovery, pSwitching, fVerbose );
00098     if ( pSwitching ) Vec_IntFree( vSwitching );
00099     if ( pMan == NULL )
00100         return NULL;
00101 clk = clock();
00102     Map_ManSetSwitching( pMan, fSwitching );
00103     if ( !Map_Mapping( pMan ) )
00104     {
00105         Map_ManFree( pMan );
00106         return NULL;
00107     }
00108 //    Map_ManPrintStatsToFile( pNtk->pSpec, Map_ManReadAreaFinal(pMan), Map_ManReadRequiredGlo(pMan), clock()-clk );
00109 
00110     // reconstruct the network after mapping
00111     pNtkNew = Abc_NtkFromMap( pMan, pNtk );
00112     if ( pNtkNew == NULL )
00113         return NULL;
00114     Map_ManFree( pMan );
00115 
00116     if ( pNtk->pExdc )
00117         pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
00118 
00119     // make sure that everything is okay
00120     if ( !Abc_NtkCheck( pNtkNew ) )
00121     {
00122         printf( "Abc_NtkMap: The network check has failed.\n" );
00123         Abc_NtkDelete( pNtkNew );
00124         return NULL;
00125     }
00126     return pNtkNew;
00127 }

Abc_Ntk_t* Abc_NtkSuperChoice ( Abc_Ntk_t pNtk  ) 

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

Synopsis [Interface with the mapping package.]

Description []

SideEffects []

SeeAlso []

Definition at line 405 of file abcMap.c.

00406 {
00407     Abc_Ntk_t * pNtkNew;
00408 
00409     Map_Man_t * pMan;
00410 
00411     assert( Abc_NtkIsStrash(pNtk) );
00412 
00413     // check that the library is available
00414     if ( Abc_FrameReadLibGen() == NULL )
00415     {
00416         printf( "The current library is not available.\n" );
00417         return 0;
00418     }
00419 
00420     // derive the supergate library
00421     if ( Abc_FrameReadLibSuper() == NULL && Abc_FrameReadLibGen() )
00422     {
00423         printf( "A simple supergate library is derived from gate library \"%s\".\n", 
00424             Mio_LibraryReadName(Abc_FrameReadLibGen()) );
00425         Map_SuperLibDeriveFromGenlib( Abc_FrameReadLibGen() );
00426     }
00427 
00428     // print a warning about choice nodes
00429     if ( Abc_NtkGetChoiceNum( pNtk ) )
00430         printf( "Performing mapping with choices.\n" );
00431 
00432     // perform the mapping
00433     pMan = Abc_NtkToMap( pNtk, -1, 1, NULL, 0 );
00434     if ( pMan == NULL )
00435         return NULL;
00436     if ( !Map_Mapping( pMan ) )
00437     {
00438         Map_ManFree( pMan );
00439         return NULL;
00440     }
00441 
00442     // reconstruct the network after mapping
00443     pNtkNew = Abc_NtkFromMapSuperChoice( pMan, pNtk );
00444     if ( pNtkNew == NULL )
00445         return NULL;
00446     Map_ManFree( pMan );
00447 
00448     // make sure that everything is okay
00449     if ( !Abc_NtkCheck( pNtkNew ) )
00450     {
00451         printf( "Abc_NtkMap: The network check has failed.\n" );
00452         Abc_NtkDelete( pNtkNew );
00453         return NULL;
00454     }
00455     return pNtkNew;
00456 }

Map_Man_t * Abc_NtkToMap ( Abc_Ntk_t pNtk,
double  DelayTarget,
int  fRecovery,
float *  pSwitching,
int  fVerbose 
) [static]

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

FileName [abcMap.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Interface with the SC mapping package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis [Load the network into manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 140 of file abcMap.c.

00141 {
00142     Map_Man_t * pMan;
00143     ProgressBar * pProgress;
00144     Map_Node_t * pNodeMap;
00145     Vec_Ptr_t * vNodes;
00146     Abc_Obj_t * pNode, * pFanin, * pPrev;
00147     int i;
00148 
00149     assert( Abc_NtkIsStrash(pNtk) );
00150 
00151     // start the mapping manager and set its parameters
00152     pMan = Map_ManCreate( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk), Abc_NtkPoNum(pNtk) + Abc_NtkLatchNum(pNtk), fVerbose );
00153     if ( pMan == NULL )
00154         return NULL;
00155     Map_ManSetAreaRecovery( pMan, fRecovery );
00156     Map_ManSetOutputNames( pMan, Abc_NtkCollectCioNames(pNtk, 1) );
00157     Map_ManSetDelayTarget( pMan, (float)DelayTarget );
00158     Map_ManSetInputArrivals( pMan, (Map_Time_t *)Abc_NtkGetCiArrivalTimes(pNtk) );
00159 
00160     // create PIs and remember them in the old nodes
00161     Abc_NtkCleanCopy( pNtk );
00162     Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)Map_ManReadConst1(pMan);
00163     Abc_NtkForEachCi( pNtk, pNode, i )
00164     {
00165         pNodeMap = Map_ManReadInputs(pMan)[i];
00166         pNode->pCopy = (Abc_Obj_t *)pNodeMap;
00167         if ( pSwitching )
00168             Map_NodeSetSwitching( pNodeMap, pSwitching[pNode->Id] );
00169     }
00170 
00171     // load the AIG into the mapper
00172     vNodes = Abc_AigDfs( pNtk, 0, 0 );
00173     pProgress = Extra_ProgressBarStart( stdout, vNodes->nSize );
00174     Vec_PtrForEachEntry( vNodes, pNode, i )
00175     {
00176         Extra_ProgressBarUpdate( pProgress, i, NULL );
00177         // add the node to the mapper
00178         pNodeMap = Map_NodeAnd( pMan, 
00179             Map_NotCond( Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) ),
00180             Map_NotCond( Abc_ObjFanin1(pNode)->pCopy, Abc_ObjFaninC1(pNode) ) );
00181         assert( pNode->pCopy == NULL );
00182         // remember the node
00183         pNode->pCopy = (Abc_Obj_t *)pNodeMap;
00184         if ( pSwitching )
00185             Map_NodeSetSwitching( pNodeMap, pSwitching[pNode->Id] );
00186         // set up the choice node
00187         if ( Abc_AigNodeIsChoice( pNode ) )
00188             for ( pPrev = pNode, pFanin = pNode->pData; pFanin; pPrev = pFanin, pFanin = pFanin->pData )
00189             {
00190                 Map_NodeSetNextE( (Map_Node_t *)pPrev->pCopy, (Map_Node_t *)pFanin->pCopy );
00191                 Map_NodeSetRepr( (Map_Node_t *)pFanin->pCopy, (Map_Node_t *)pNode->pCopy );
00192             }
00193     }
00194     Extra_ProgressBarStop( pProgress );
00195     Vec_PtrFree( vNodes );
00196 
00197     // set the primary outputs in the required phase
00198     Abc_NtkForEachCo( pNtk, pNode, i )
00199         Map_ManReadOutputs(pMan)[i] = Map_NotCond( (Map_Node_t *)Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) );
00200     return pMan;
00201 }


Generated on Tue Jan 5 12:18:37 2010 for abc70930 by  doxygen 1.6.1