src/base/abci/abcAuto.c File Reference

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

Go to the source code of this file.

Functions

static void Abc_NtkAutoPrintAll (DdManager *dd, int nInputs, DdNode *pbOutputs[], int nOutputs, char *pInputNames[], char *pOutputNames[], int fNaive)
static void Abc_NtkAutoPrintOne (DdManager *dd, int nInputs, DdNode *pbOutputs[], int Output, char *pInputNames[], char *pOutputNames[], int fNaive)
void Abc_NtkAutoPrint (Abc_Ntk_t *pNtk, int Output, int fNaive, int fVerbose)

Function Documentation

void Abc_NtkAutoPrint ( Abc_Ntk_t pNtk,
int  Output,
int  fNaive,
int  fVerbose 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file abcAuto.c.

00046 {
00047         DdManager * dd;         // the BDD manager used to hold shared BDDs
00048         DdNode ** pbGlobal;     // temporary storage for global BDDs
00049         char ** pInputNames;    // pointers to the CI names
00050         char ** pOutputNames;   // pointers to the CO names
00051         int nOutputs, nInputs, i;
00052     Vec_Ptr_t * vFuncsGlob;
00053     Abc_Obj_t * pObj;
00054 
00055     // compute the global BDDs
00056     if ( Abc_NtkBuildGlobalBdds(pNtk, 10000000, 1, 1, fVerbose) == NULL )
00057         return;
00058 
00059     // get information about the network
00060     nInputs  = Abc_NtkCiNum(pNtk);
00061     nOutputs = Abc_NtkCoNum(pNtk);
00062 //    dd       = pNtk->pManGlob;
00063     dd = Abc_NtkGlobalBddMan( pNtk );
00064 
00065     // complement the global functions
00066     vFuncsGlob = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
00067     Abc_NtkForEachCo( pNtk, pObj, i )
00068         Vec_PtrPush( vFuncsGlob, Abc_ObjGlobalBdd(pObj) );
00069     pbGlobal = (DdNode **)Vec_PtrArray( vFuncsGlob );
00070 
00071     // get the network names
00072     pInputNames = Abc_NtkCollectCioNames( pNtk, 0 );
00073     pOutputNames = Abc_NtkCollectCioNames( pNtk, 1 );
00074 
00075     // print the size of the BDDs
00076     if ( fVerbose )
00077         printf( "Shared BDD size = %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
00078 
00079         // allocate additional variables
00080         for ( i = 0; i < nInputs; i++ )
00081                 Cudd_bddNewVar( dd );
00082         assert( Cudd_ReadSize(dd) == 2 * nInputs );
00083 
00084         // create ZDD variables in the manager
00085         Cudd_zddVarsFromBddVars( dd, 2 );
00086 
00087         // perform the analysis of the primary output functions for auto-symmetry
00088         if ( Output == -1 )
00089                 Abc_NtkAutoPrintAll( dd, nInputs, pbGlobal, nOutputs, pInputNames, pOutputNames, fNaive );
00090         else
00091                 Abc_NtkAutoPrintOne( dd, nInputs, pbGlobal, Output, pInputNames, pOutputNames, fNaive );
00092 
00093         // deref the PO functions
00094 //    Abc_NtkFreeGlobalBdds( pNtk );
00095         // stop the global BDD manager
00096 //    Extra_StopManager( pNtk->pManGlob );
00097 //    pNtk->pManGlob = NULL;
00098     Abc_NtkFreeGlobalBdds( pNtk, 1 );
00099     free( pInputNames );
00100     free( pOutputNames );
00101     Vec_PtrFree( vFuncsGlob );
00102 }

void Abc_NtkAutoPrintAll ( DdManager dd,
int  nInputs,
DdNode pbOutputs[],
int  nOutputs,
char *  pInputNames[],
char *  pOutputNames[],
int  fNaive 
) [static]

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

FileName [abcAuto.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Computation of autosymmetries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS ///

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 115 of file abcAuto.c.

00116 {
00117         DdNode * bSpace1, * bSpace2, * bCanVars, * bReduced, * zEquations;
00118         double nMints; 
00119         int nSupp, SigCounter, o;
00120 
00121         int nAutos;
00122         int nAutoSyms;
00123         int nAutoSymsMax;
00124         int nAutoSymsMaxSupp;
00125         int nAutoSymOuts;
00126         int nSuppSizeMax;
00127         int clk;
00128         
00129         nAutoSymOuts = 0;
00130         nAutoSyms    = 0;
00131         nAutoSymsMax = 0;
00132         nAutoSymsMaxSupp = 0;
00133         nSuppSizeMax = 0;
00134         clk = clock();
00135 
00136         SigCounter = 0;
00137         for ( o = 0; o < nOutputs; o++ )
00138         {
00139 //              bSpace1  = Extra_bddSpaceFromFunctionFast( dd, pbOutputs[o] );           Cudd_Ref( bSpace1 );
00140                 bSpace1  = Extra_bddSpaceFromFunction( dd, pbOutputs[o], pbOutputs[o] ); Cudd_Ref( bSpace1 );
00141                 bCanVars = Extra_bddSpaceCanonVars( dd, bSpace1 );                       Cudd_Ref( bCanVars );
00142                 bReduced = Extra_bddSpaceReduce( dd, pbOutputs[o], bCanVars );           Cudd_Ref( bReduced );
00143                 zEquations = Extra_bddSpaceEquations( dd, bSpace1 );                     Cudd_Ref( zEquations );
00144 
00145                 nSupp  = Cudd_SupportSize( dd, bSpace1 );
00146                 nMints = Cudd_CountMinterm( dd, bSpace1, nSupp );
00147                 nAutos = Extra_Base2LogDouble(nMints);
00148                 printf( "Output #%3d: Inputs = %2d. AutoK = %2d.\n", o, nSupp, nAutos );
00149 
00150                 if ( nAutos > 0 )
00151                 {
00152                         nAutoSymOuts++;
00153                         nAutoSyms += nAutos;
00154                         if ( nAutoSymsMax < nAutos )
00155                         {
00156                                 nAutoSymsMax = nAutos;
00157                                 nAutoSymsMaxSupp = nSupp;
00158                         }
00159                 }
00160                 if ( nSuppSizeMax < nSupp )
00161                         nSuppSizeMax = nSupp;
00162 
00163 
00164 //PRB( dd, bCanVars );
00165 //PRB( dd, bReduced );
00166 //Cudd_PrintMinterm( dd, bReduced );
00167 //printf( "The equations are:\n" );
00168 //Cudd_zddPrintCover( dd, zEquations );
00169 //printf( "\n" );
00170 //fflush( stdout );
00171 
00172                 bSpace2 = Extra_bddSpaceFromMatrixPos( dd, zEquations );   Cudd_Ref( bSpace2 );
00173 //PRB( dd, bSpace1 );
00174 //PRB( dd, bSpace2 );
00175                 if ( bSpace1 != bSpace2 )
00176                         printf( "Spaces are NOT EQUAL!\n" );
00177 //              else
00178 //                      printf( "Spaces are equal.\n" );
00179         
00180                 Cudd_RecursiveDeref( dd, bSpace1 );
00181                 Cudd_RecursiveDeref( dd, bSpace2 );
00182                 Cudd_RecursiveDeref( dd, bCanVars );
00183                 Cudd_RecursiveDeref( dd, bReduced );
00184                 Cudd_RecursiveDerefZdd( dd, zEquations );
00185         }
00186 
00187         printf( "The cumulative statistics for all outputs:\n" );
00188         printf( "Ins=%3d ",      nInputs );
00189         printf( "InMax=%3d   ",  nSuppSizeMax );
00190         printf( "Outs=%3d ",     nOutputs );
00191         printf( "Auto=%3d   ",   nAutoSymOuts );
00192         printf( "SumK=%3d ",     nAutoSyms );
00193         printf( "KMax=%2d ",     nAutoSymsMax );
00194         printf( "Supp=%3d   ",   nAutoSymsMaxSupp );
00195         printf( "Time=%4.2f ", (float)(clock() - clk)/(float)(CLOCKS_PER_SEC) );
00196         printf( "\n" );
00197 }

void Abc_NtkAutoPrintOne ( DdManager dd,
int  nInputs,
DdNode pbOutputs[],
int  Output,
char *  pInputNames[],
char *  pOutputNames[],
int  fNaive 
) [static]

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 210 of file abcAuto.c.

00211 {
00212         DdNode * bSpace1, * bCanVars, * bReduced, * zEquations;
00213         double nMints; 
00214         int nSupp, SigCounter;
00215         int nAutos;
00216 
00217         SigCounter = 0;
00218         bSpace1  = Extra_bddSpaceFromFunctionFast( dd, pbOutputs[Output] );                Cudd_Ref( bSpace1 );
00219 //      bSpace1  = Extra_bddSpaceFromFunction( dd, pbOutputs[Output], pbOutputs[Output] ); Cudd_Ref( bSpace1 );
00220         bCanVars = Extra_bddSpaceCanonVars( dd, bSpace1 );                                 Cudd_Ref( bCanVars );
00221         bReduced = Extra_bddSpaceReduce( dd, pbOutputs[Output], bCanVars );                Cudd_Ref( bReduced );
00222         zEquations = Extra_bddSpaceEquations( dd, bSpace1 );                               Cudd_Ref( zEquations );
00223 
00224         nSupp  = Cudd_SupportSize( dd, bSpace1 );
00225         nMints = Cudd_CountMinterm( dd, bSpace1, nSupp );
00226         nAutos = Extra_Base2LogDouble(nMints);
00227         printf( "Output #%3d: Inputs = %2d. AutoK = %2d.\n", Output, nSupp, nAutos );
00228 
00229         Cudd_RecursiveDeref( dd, bSpace1 );
00230         Cudd_RecursiveDeref( dd, bCanVars );
00231         Cudd_RecursiveDeref( dd, bReduced );
00232         Cudd_RecursiveDerefZdd( dd, zEquations );
00233 }


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