src/base/abci/abcDress.c File Reference

#include "abc.h"
#include "io.h"
Include dependency graph for abcDress.c:

Go to the source code of this file.

Functions

static stmm_tableAbc_NtkDressDeriveMapping (Abc_Ntk_t *pNtk)
static void Abc_NtkDressTransferNames (Abc_Ntk_t *pNtk, stmm_table *tMapping, int fVerbose)
Abc_Ntk_tAbc_NtkIvyFraig (Abc_Ntk_t *pNtk, int nConfLimit, int fDoSparse, int fProve, int fTransfer, int fVerbose)
void Abc_NtkDress (Abc_Ntk_t *pNtkLogic, char *pFileName, int fVerbose)

Function Documentation

void Abc_NtkDress ( Abc_Ntk_t pNtkLogic,
char *  pFileName,
int  fVerbose 
)

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

Synopsis [Transfers names from one netlist to the other.]

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file abcDress.c.

00049 {
00050     Abc_Ntk_t * pNtkOrig, * pNtkLogicOrig;
00051     Abc_Ntk_t * pMiter, * pMiterFraig;
00052     stmm_table * tMapping;
00053 
00054     assert( Abc_NtkIsLogic(pNtkLogic) );
00055 
00056     // get the original netlist
00057     pNtkOrig = Io_ReadNetlist( pFileName, Io_ReadFileType(pFileName), 1 );
00058     if ( pNtkOrig == NULL )
00059         return;
00060     assert( Abc_NtkIsNetlist(pNtkOrig) );
00061 
00062     Abc_NtkCleanCopy(pNtkLogic);
00063     Abc_NtkCleanCopy(pNtkOrig);
00064 
00065     // convert it into the logic network
00066     pNtkLogicOrig = Abc_NtkToLogic( pNtkOrig );
00067     // check that the networks have the same PIs/POs/latches
00068     if ( !Abc_NtkCompareSignals( pNtkLogic, pNtkLogicOrig, 1, 1 ) )
00069     {
00070         Abc_NtkDelete( pNtkOrig );
00071         Abc_NtkDelete( pNtkLogicOrig );
00072         return;
00073     }
00074 
00075     // convert the current logic network into an AIG
00076     pMiter = Abc_NtkStrash( pNtkLogic, 1, 0, 0 );
00077 
00078     // convert it into the AIG and make the netlist point to the AIG
00079     Abc_NtkAppend( pMiter, pNtkLogicOrig, 1 );
00080     Abc_NtkTransferCopy( pNtkOrig );
00081     Abc_NtkDelete( pNtkLogicOrig );
00082 
00083 if ( fVerbose ) 
00084 {
00085 printf( "After mitering:\n" );
00086 printf( "Logic:  Nodes = %5d. Copy = %5d. \n", Abc_NtkNodeNum(pNtkLogic), Abc_NtkCountCopy(pNtkLogic) );
00087 printf( "Orig:   Nodes = %5d. Copy = %5d. \n", Abc_NtkNodeNum(pNtkOrig),  Abc_NtkCountCopy(pNtkOrig) );
00088 }
00089 
00090     // fraig the miter (miter nodes point to the fraiged miter)
00091     pMiterFraig = Abc_NtkIvyFraig( pMiter, 100, 1, 0, 1, 0 );
00092     // make netlists point to the fraiged miter
00093     Abc_NtkTransferCopy( pNtkLogic );
00094     Abc_NtkTransferCopy( pNtkOrig );
00095     Abc_NtkDelete( pMiter );
00096 
00097 if ( fVerbose ) 
00098 {
00099 printf( "After fraiging:\n" );
00100 printf( "Logic:  Nodes = %5d. Copy = %5d. \n", Abc_NtkNodeNum(pNtkLogic), Abc_NtkCountCopy(pNtkLogic) );
00101 printf( "Orig:   Nodes = %5d. Copy = %5d. \n", Abc_NtkNodeNum(pNtkOrig),  Abc_NtkCountCopy(pNtkOrig) );
00102 }
00103 
00104     // derive mapping from the fraiged nodes into their prototype nodes in the original netlist
00105     tMapping = Abc_NtkDressDeriveMapping( pNtkOrig );
00106 
00107     // transfer the names to the new netlist
00108     Abc_NtkDressTransferNames( pNtkLogic, tMapping, fVerbose );
00109 
00110     // clean up
00111     stmm_free_table( tMapping );
00112     Abc_NtkDelete( pMiterFraig );
00113     Abc_NtkDelete( pNtkOrig );
00114 }

stmm_table * Abc_NtkDressDeriveMapping ( Abc_Ntk_t pNtk  )  [static]

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

FileName [abcDress.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Transfers names from one netlist to the other.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis [Returns the mapping from the fraig nodes point into the nodes of the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file abcDress.c.

00128 {
00129     stmm_table * tResult;
00130     Abc_Obj_t * pNode, * pNodeMap, * pNodeFraig;
00131     int i;
00132     assert( Abc_NtkIsNetlist(pNtk) );
00133     tResult = stmm_init_table(stmm_ptrcmp,stmm_ptrhash);
00134     Abc_NtkForEachNode( pNtk, pNode, i )
00135     {
00136         // get the fraiged node
00137         pNodeFraig = Abc_ObjRegular(pNode->pCopy);
00138         // if this node is already mapped, skip
00139         if ( stmm_is_member( tResult, (char *)pNodeFraig ) )
00140             continue;
00141         // get the mapping of this node
00142         pNodeMap = Abc_ObjNotCond( pNode, Abc_ObjIsComplement(pNode->pCopy) );
00143         // add the mapping
00144         stmm_insert( tResult, (char *)pNodeFraig, (char *)pNodeMap );
00145     }
00146     return tResult;
00147 }

void Abc_NtkDressTransferNames ( Abc_Ntk_t pNtk,
stmm_table tMapping,
int  fVerbose 
) [static]

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

Synopsis [Attaches the names of to the new netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 160 of file abcDress.c.

00161 {
00162     Abc_Obj_t * pNet, * pNode, * pNodeMap, * pNodeFraig;
00163     char * pName;
00164     int i, Counter = 0, CounterInv = 0, CounterInit = stmm_count(tMapping);
00165     assert( Abc_NtkIsLogic(pNtk) );
00166     Abc_NtkForEachNode( pNtk, pNode, i )
00167     {
00168         // if the node already has a name, quit
00169         pName = Nm_ManFindNameById( pNtk->pManName, pNode->Id );
00170         if ( pName != NULL )
00171             continue;
00172         // get the fraiged node
00173         pNodeFraig = Abc_ObjRegular(pNode->pCopy);
00174         // find the matching node of the original netlist
00175         if ( !stmm_lookup( tMapping, (char *)pNodeFraig, (char **)&pNodeMap ) )
00176             continue;
00177         // find the true match
00178         pNodeMap = Abc_ObjNotCond( pNodeMap, Abc_ObjIsComplement(pNode->pCopy) );
00179         // get the name
00180         pNet = Abc_ObjFanout0(Abc_ObjRegular(pNodeMap));
00181         pName = Nm_ManFindNameById( pNet->pNtk->pManName, pNet->Id );
00182         assert( pName != NULL );
00183         // set the name
00184         if ( Abc_ObjIsComplement(pNodeMap) )
00185         {
00186             Abc_ObjAssignName( pNode, pName, "_inv" );
00187             CounterInv++;
00188         }
00189         else
00190         {
00191             Abc_ObjAssignName( pNode, pName, NULL );
00192             Counter++;
00193         }
00194         // remove the name
00195         stmm_delete( tMapping, (char **)&pNodeFraig, (char **)&pNodeMap );
00196     }
00197     if ( fVerbose )
00198     {
00199         printf( "Total number of names collected = %5d.\n", CounterInit );
00200         printf( "Total number of names assigned  = %5d. (Dir = %5d. Compl = %5d.)\n", 
00201             Counter + CounterInv, Counter, CounterInv );
00202     }
00203 }

Abc_Ntk_t* Abc_NtkIvyFraig ( Abc_Ntk_t pNtk,
int  nConfLimit,
int  fDoSparse,
int  fProve,
int  fTransfer,
int  fVerbose 
)

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

Synopsis [Gives the current ABC network to AIG manager for processing.]

Description []

SideEffects []

SeeAlso []

Definition at line 447 of file abcIvy.c.

00448 {
00449     Ivy_FraigParams_t Params, * pParams = &Params; 
00450     Abc_Ntk_t * pNtkAig;
00451     Ivy_Man_t * pMan, * pTemp;
00452     pMan = Abc_NtkIvyBefore( pNtk, 0, 0 );
00453     if ( pMan == NULL )
00454         return NULL;
00455     Ivy_FraigParamsDefault( pParams );
00456     pParams->nBTLimitNode = nConfLimit;
00457     pParams->fVerbose     = fVerbose;
00458     pParams->fProve       = fProve;
00459     pParams->fDoSparse    = fDoSparse;
00460     pMan = Ivy_FraigPerform( pTemp = pMan, pParams );
00461     // transfer the pointers
00462     if ( fTransfer == 1 )
00463     {
00464         Vec_Ptr_t * vCopies;
00465         vCopies = Abc_NtkSaveCopy( pNtk );
00466         pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
00467         Abc_NtkLoadCopy( pNtk, vCopies );
00468         Vec_PtrFree( vCopies );
00469         Abc_NtkTransferPointers( pNtk, pNtkAig );
00470     }
00471     else
00472         pNtkAig = Abc_NtkIvyAfter( pNtk, pMan, 0, 0 );
00473     Ivy_ManStop( pTemp );
00474     Ivy_ManStop( pMan );
00475     return pNtkAig;
00476 }


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