src/base/abci/abcRenode.c File Reference

#include "abc.h"
#include "reo.h"
#include "if.h"
#include "kit.h"
Include dependency graph for abcRenode.c:

Go to the source code of this file.

Functions

static int Abc_NtkRenodeEvalAig (If_Cut_t *pCut)
static int Abc_NtkRenodeEvalBdd (If_Cut_t *pCut)
static int Abc_NtkRenodeEvalSop (If_Cut_t *pCut)
static int Abc_NtkRenodeEvalCnf (If_Cut_t *pCut)
static int Abc_NtkRenodeEvalMv (If_Cut_t *pCut)
Abc_Ntk_tAbc_NtkRenode (Abc_Ntk_t *pNtk, int nFaninMax, int nCubeMax, int nFlowIters, int nAreaIters, int fArea, int fUseBdds, int fUseSops, int fUseCnfs, int fUseMv, int fVerbose)

Variables

static reo_mans_pReo = NULL
static DdManagers_pDd = NULL
static Vec_Int_ts_vMemory = NULL
static Vec_Int_ts_vMemory2 = NULL
static int nDsdCounter = 0

Function Documentation

Abc_Ntk_t* Abc_NtkRenode ( Abc_Ntk_t pNtk,
int  nFaninMax,
int  nCubeMax,
int  nFlowIters,
int  nAreaIters,
int  fArea,
int  fUseBdds,
int  fUseSops,
int  fUseCnfs,
int  fUseMv,
int  fVerbose 
)

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

Synopsis [Performs renoding as technology mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file abcRenode.c.

00059 {
00060     extern Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars );
00061     If_Par_t Pars, * pPars = &Pars;
00062     Abc_Ntk_t * pNtkNew;
00063 
00064     if ( Abc_NtkGetChoiceNum( pNtk ) )
00065         printf( "Performing renoding with choices.\n" );
00066 
00067     nDsdCounter = 0;
00068 
00069     // set defaults
00070     memset( pPars, 0, sizeof(If_Par_t) );
00071     // user-controlable paramters
00072     pPars->nLutSize    =  nFaninMax;
00073     pPars->nCutsMax    =  nCubeMax;
00074     pPars->nFlowIters  =  nFlowIters;
00075     pPars->nAreaIters  =  nAreaIters;
00076     pPars->DelayTarget = -1;
00077     pPars->fPreprocess =  1;
00078     pPars->fArea       =  fArea;
00079     pPars->fFancy      =  0;
00080     pPars->fExpRed     =  0; //
00081     pPars->fLatchPaths =  0;
00082     pPars->fSeqMap     =  0;
00083     pPars->fVerbose    =  fVerbose;
00084     // internal parameters
00085     pPars->fTruth      =  1;
00086     pPars->fUsePerm    =  1; 
00087     pPars->nLatches    =  0;
00088     pPars->pLutLib     =  NULL; // Abc_FrameReadLibLut();
00089     pPars->pTimesArr   =  NULL; 
00090     pPars->pTimesArr   =  NULL;   
00091     pPars->fUseBdds    =  fUseBdds;
00092     pPars->fUseSops    =  fUseSops;
00093     pPars->fUseCnfs    =  fUseCnfs;
00094     pPars->fUseMv      =  fUseMv;
00095     if ( fUseBdds )
00096         pPars->pFuncCost = Abc_NtkRenodeEvalBdd;
00097     else if ( fUseSops )
00098         pPars->pFuncCost = Abc_NtkRenodeEvalSop;
00099     else if ( fUseCnfs )
00100     {
00101         pPars->fArea = 1;
00102         pPars->pFuncCost = Abc_NtkRenodeEvalCnf;
00103     }
00104     else if ( fUseMv )
00105         pPars->pFuncCost = Abc_NtkRenodeEvalMv;
00106     else
00107         pPars->pFuncCost = Abc_NtkRenodeEvalAig;
00108 
00109     // start the manager
00110     if ( fUseBdds )
00111     {
00112         assert( s_pReo == NULL );
00113         s_pDd  = Cudd_Init( nFaninMax, 0, CUDD_UNIQUE_SLOTS, CUDD_CACHE_SLOTS, 0 );
00114         s_pReo = Extra_ReorderInit( nFaninMax, 100 );
00115         pPars->pReoMan  = s_pReo;
00116     }
00117     else
00118     {
00119         assert( s_vMemory == NULL );
00120         s_vMemory  = Vec_IntAlloc( 1 << 16 );
00121         s_vMemory2 = Vec_IntAlloc( 1 << 16 );
00122     }
00123 
00124     // perform mapping/renoding
00125     pNtkNew = Abc_NtkIf( pNtk, pPars );
00126 
00127     // start the manager
00128     if ( fUseBdds )
00129     {
00130         Extra_StopManager( s_pDd );
00131         Extra_ReorderQuit( s_pReo );
00132         s_pReo = NULL;
00133         s_pDd  = NULL;
00134     }
00135     else
00136     {
00137         Vec_IntFree( s_vMemory );
00138         Vec_IntFree( s_vMemory2 );
00139         s_vMemory = NULL;
00140         s_vMemory2 = NULL;
00141     }
00142 
00143 //    printf( "Decomposed %d functions.\n", nDsdCounter );
00144 
00145     return pNtkNew;
00146 }

int Abc_NtkRenodeEvalAig ( If_Cut_t pCut  )  [static]

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

FileName [abcRenode.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis [Computes the cost based on the factored form.]

Description []

SideEffects []

SeeAlso []

Definition at line 159 of file abcRenode.c.

00160 {
00161     Kit_Graph_t * pGraph;
00162     int i, nNodes;
00163 /*
00164 extern void Kit_DsdTest( unsigned * pTruth, int nVars );
00165 if ( If_CutLeaveNum(pCut) == 8 )
00166 {
00167     nDsdCounter++;
00168     Kit_DsdTest( If_CutTruth(pCut), If_CutLeaveNum(pCut) );
00169 }
00170 */
00171     pGraph = Kit_TruthToGraph( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory );
00172     if ( pGraph == NULL )
00173     {
00174         for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
00175             pCut->pPerm[i] = 100;
00176         return IF_COST_MAX;
00177     }
00178     nNodes = Kit_GraphNodeNum( pGraph );
00179     for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
00180         pCut->pPerm[i] = Kit_GraphLeafDepth_rec( pGraph, Kit_GraphNodeLast(pGraph), Kit_GraphNode(pGraph, i) );
00181     Kit_GraphFree( pGraph );
00182     return nNodes;
00183 }

int Abc_NtkRenodeEvalBdd ( If_Cut_t pCut  )  [static]

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

Synopsis [Computes the cost based on the BDD size after reordering.]

Description []

SideEffects []

SeeAlso []

Definition at line 196 of file abcRenode.c.

00197 {
00198     int pOrder[IF_MAX_LUTSIZE];
00199     DdNode * bFunc, * bFuncNew;
00200     int i, k, nNodes;
00201     for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
00202         pCut->pPerm[i] = pOrder[i] = -100;
00203     bFunc = Kit_TruthToBdd( s_pDd, If_CutTruth(pCut), If_CutLeaveNum(pCut), 0 );  Cudd_Ref( bFunc );
00204     bFuncNew = Extra_Reorder( s_pReo, s_pDd, bFunc, pOrder );                     Cudd_Ref( bFuncNew );
00205     for ( i = k = 0; i < If_CutLeaveNum(pCut); i++ )
00206         if ( pOrder[i] >= 0 )
00207             pCut->pPerm[pOrder[i]] = ++k; // double-check this!
00208     nNodes = -1 + Cudd_DagSize( bFuncNew );
00209     Cudd_RecursiveDeref( s_pDd, bFuncNew );
00210     Cudd_RecursiveDeref( s_pDd, bFunc );
00211     return nNodes; 
00212 }

int Abc_NtkRenodeEvalCnf ( If_Cut_t pCut  )  [static]

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

Synopsis [Computes the cost based on two ISOPs.]

Description []

SideEffects []

SeeAlso []

Definition at line 248 of file abcRenode.c.

00249 {
00250     int i, RetValue, nClauses;
00251     // set internal mapper parameters
00252     for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
00253         pCut->pPerm[i] = 1;
00254     // compute ISOP for the positive phase
00255     RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory, 0 );
00256     if ( RetValue == -1 )
00257         return IF_COST_MAX;
00258     assert( RetValue == 0 || RetValue == 1 );
00259     nClauses = Vec_IntSize( s_vMemory );
00260     // compute ISOP for the negative phase
00261     Kit_TruthNot( If_CutTruth(pCut), If_CutTruth(pCut), If_CutLeaveNum(pCut) );
00262     RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory, 0 );
00263     Kit_TruthNot( If_CutTruth(pCut), If_CutTruth(pCut), If_CutLeaveNum(pCut) );
00264     if ( RetValue == -1 )
00265         return IF_COST_MAX;
00266     assert( RetValue == 0 || RetValue == 1 );
00267     nClauses += Vec_IntSize( s_vMemory );
00268     return nClauses;
00269 }

int Abc_NtkRenodeEvalMv ( If_Cut_t pCut  )  [static]

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

Synopsis [Computes the cost of MV-SOP of the cut function.]

Description []

SideEffects []

SeeAlso []

Definition at line 282 of file abcRenode.c.

00283 {
00284     int i, RetValue;
00285     // set internal mapper parameters
00286     for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
00287         pCut->pPerm[i] = 1;
00288     // compute ISOP for the positive phase
00289     RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory, 0 );
00290     if ( RetValue == -1 )
00291         return IF_COST_MAX;
00292     assert( RetValue == 0 || RetValue == 1 );
00293     // compute ISOP for the negative phase
00294     Kit_TruthNot( If_CutTruth(pCut), If_CutTruth(pCut), If_CutLeaveNum(pCut) );
00295     RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory2, 0 );
00296     Kit_TruthNot( If_CutTruth(pCut), If_CutTruth(pCut), If_CutLeaveNum(pCut) );
00297     if ( RetValue == -1 )
00298         return IF_COST_MAX;
00299     assert( RetValue == 0 || RetValue == 1 );
00300     // return the cost of the cut 
00301     RetValue = Abc_NodeEvalMvCost( If_CutLeaveNum(pCut), s_vMemory, s_vMemory2 );
00302     if ( RetValue >= IF_COST_MAX )
00303         return IF_COST_MAX;
00304     return RetValue;
00305 }

int Abc_NtkRenodeEvalSop ( If_Cut_t pCut  )  [static]

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

Synopsis [Computes the cost based on ISOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 225 of file abcRenode.c.

00226 {
00227     int i, RetValue;
00228     for ( i = 0; i < If_CutLeaveNum(pCut); i++ )
00229         pCut->pPerm[i] = 1;
00230     RetValue = Kit_TruthIsop( If_CutTruth(pCut), If_CutLeaveNum(pCut), s_vMemory, 1 );
00231     if ( RetValue == -1 )
00232         return IF_COST_MAX;
00233     assert( RetValue == 0 || RetValue == 1 );
00234     return Vec_IntSize( s_vMemory );
00235 }


Variable Documentation

int nDsdCounter = 0 [static]

Definition at line 41 of file abcRenode.c.

DdManager* s_pDd = NULL [static]

Definition at line 37 of file abcRenode.c.

reo_man* s_pReo = NULL [static]

Definition at line 36 of file abcRenode.c.

Vec_Int_t* s_vMemory = NULL [static]

Definition at line 38 of file abcRenode.c.

Vec_Int_t* s_vMemory2 = NULL [static]

Definition at line 39 of file abcRenode.c.


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