src/base/abci/abcSymm.c File Reference

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

Go to the source code of this file.

Functions

static void Abc_NtkSymmetriesUsingBdds (Abc_Ntk_t *pNtk, int fNaive, int fReorder, int fVerbose)
static void Abc_NtkSymmetriesUsingSandS (Abc_Ntk_t *pNtk, int fVerbose)
static void Ntk_NetworkSymmsBdd (DdManager *dd, Abc_Ntk_t *pNtk, int fNaive, int fVerbose)
static void Ntk_NetworkSymmsPrint (Abc_Ntk_t *pNtk, Extra_SymmInfo_t *pSymms)
void Abc_NtkSymmetries (Abc_Ntk_t *pNtk, int fUseBdds, int fNaive, int fReorder, int fVerbose)

Function Documentation

void Abc_NtkSymmetries ( Abc_Ntk_t pNtk,
int  fUseBdds,
int  fNaive,
int  fReorder,
int  fVerbose 
)

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

Synopsis [The top level procedure to compute symmetries.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file abcSymm.c.

00048 {
00049     if ( fUseBdds || fNaive )
00050         Abc_NtkSymmetriesUsingBdds( pNtk, fNaive, fReorder, fVerbose );
00051     else
00052         Abc_NtkSymmetriesUsingSandS( pNtk, fVerbose );
00053 }

void Abc_NtkSymmetriesUsingBdds ( Abc_Ntk_t pNtk,
int  fNaive,
int  fReorder,
int  fVerbose 
) [static]

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

FileName [abcSymm.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Computation of two-variable symmetries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis [Symmetry computation using BDDs (both naive and smart).]

Description []

SideEffects []

SeeAlso []

Definition at line 84 of file abcSymm.c.

00085 {
00086     DdManager * dd;
00087     int clk, clkBdd, clkSym;
00088     int fGarbCollect = 1;
00089 
00090     // compute the global functions
00091 clk = clock();
00092     dd = Abc_NtkBuildGlobalBdds( pNtk, 10000000, 1, fReorder, fVerbose );
00093     printf( "Shared BDD size = %d nodes.\n", Abc_NtkSizeOfGlobalBdds(pNtk) ); 
00094     Cudd_AutodynDisable( dd );
00095     if ( !fGarbCollect )
00096         Cudd_DisableGarbageCollection( dd );
00097     Cudd_zddVarsFromBddVars( dd, 2 );
00098 clkBdd = clock() - clk;
00099     // create the collapsed network
00100 clk = clock();
00101     Ntk_NetworkSymmsBdd( dd, pNtk, fNaive, fVerbose );
00102 clkSym = clock() - clk;
00103     // undo the global functions
00104     Abc_NtkFreeGlobalBdds( pNtk, 1 );
00105 printf( "Statistics of BDD-based symmetry detection:\n" );
00106 printf( "Algorithm = %s. Reordering = %s. Garbage collection = %s.\n", 
00107        fNaive? "naive" : "fast", fReorder? "yes" : "no", fGarbCollect? "yes" : "no" );
00108 PRT( "Constructing BDDs", clkBdd );
00109 PRT( "Computing symms  ", clkSym );
00110 PRT( "TOTAL            ", clkBdd + clkSym );
00111 }

void Abc_NtkSymmetriesUsingSandS ( Abc_Ntk_t pNtk,
int  fVerbose 
) [static]

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

Synopsis [Symmetry computation using simulation and SAT.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file abcSymm.c.

00067 {
00068     extern int Sim_ComputeTwoVarSymms( Abc_Ntk_t * pNtk, int fVerbose );
00069     int nSymms = Sim_ComputeTwoVarSymms( pNtk, fVerbose );
00070     printf( "The total number of symmetries is %d.\n", nSymms );
00071 }

void Ntk_NetworkSymmsBdd ( DdManager dd,
Abc_Ntk_t pNtk,
int  fNaive,
int  fVerbose 
) [static]

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

Synopsis [Symmetry computation using BDDs (both naive and smart).]

Description []

SideEffects []

SeeAlso []

Definition at line 124 of file abcSymm.c.

00125 {
00126     Extra_SymmInfo_t * pSymms;
00127     Abc_Obj_t * pNode;
00128     DdNode * bFunc;
00129     int nSymms = 0;
00130     int nSupps = 0;
00131     int i;
00132 
00133     // compute symmetry info for each PO
00134     Abc_NtkForEachCo( pNtk, pNode, i )
00135     {
00136 //      bFunc = pNtk->vFuncsGlob->pArray[i];
00137         bFunc = Abc_ObjGlobalBdd( pNode );
00138         nSupps += Cudd_SupportSize( dd, bFunc );
00139         if ( Cudd_IsConstant(bFunc) )
00140             continue;
00141         if ( fNaive )
00142             pSymms = Extra_SymmPairsComputeNaive( dd, bFunc );
00143         else
00144             pSymms = Extra_SymmPairsCompute( dd, bFunc );
00145         nSymms += pSymms->nSymms;
00146         if ( fVerbose )
00147         {
00148             printf( "Output %6s (%d): ", Abc_ObjName(pNode), pSymms->nSymms );
00149             Ntk_NetworkSymmsPrint( pNtk, pSymms );
00150         }
00151 //Extra_SymmPairsPrint( pSymms );
00152         Extra_SymmPairsDissolve( pSymms );
00153     }
00154     printf( "Total number of vars in functional supports = %8d.\n", nSupps );
00155     printf( "Total number of two-variable symmetries     = %8d.\n", nSymms );
00156 }

void Ntk_NetworkSymmsPrint ( Abc_Ntk_t pNtk,
Extra_SymmInfo_t pSymms 
) [static]

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

Synopsis [Printing symmetry groups from the symmetry data structure.]

Description []

SideEffects []

SeeAlso []

Definition at line 169 of file abcSymm.c.

00170 {
00171     char ** pInputNames;
00172     int * pVarTaken;
00173     int i, k, nVars, nSize, fStart;
00174 
00175     // get variable names
00176     nVars = Abc_NtkCiNum(pNtk);
00177     pInputNames = Abc_NtkCollectCioNames( pNtk, 0 );
00178 
00179     // alloc the array of marks
00180     pVarTaken = ALLOC( int, nVars );
00181     memset( pVarTaken, 0, sizeof(int) * nVars );
00182 
00183     // print the groups
00184     fStart = 1;
00185     nSize = pSymms->nVars;
00186     for ( i = 0; i < nSize; i++ )
00187     {
00188         // skip the variable already considered
00189         if ( pVarTaken[i] )
00190             continue;
00191         // find all the vars symmetric with this one
00192         for ( k = 0; k < nSize; k++ )
00193         {
00194             if ( k == i )
00195                 continue;
00196             if ( pSymms->pSymms[i][k] == 0 )
00197                 continue;
00198             // vars i and k are symmetric
00199             assert( pVarTaken[k] == 0 );
00200             // there is a new symmetry pair 
00201             if ( fStart == 1 )
00202             {  // start a new symmetry class
00203                 fStart = 0;
00204                 printf( "  { %s", pInputNames[ pSymms->pVars[i] ] );
00205                 // mark the var as taken
00206                 pVarTaken[i] = 1;
00207             }
00208             printf( " %s", pInputNames[ pSymms->pVars[k] ] );
00209             // mark the var as taken
00210             pVarTaken[k] = 1;
00211         }
00212         if ( fStart == 0 )
00213         {
00214             printf( " }" );
00215             fStart = 1; 
00216         }   
00217     }   
00218     printf( "\n" );
00219 
00220     free( pInputNames );
00221     free( pVarTaken );
00222 }


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