src/opt/sim/simSym.c File Reference

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

Go to the source code of this file.

Functions

int Sim_ComputeTwoVarSymms (Abc_Ntk_t *pNtk, int fVerbose)

Function Documentation

int Sim_ComputeTwoVarSymms ( Abc_Ntk_t pNtk,
int  fVerbose 
)

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

FileName [simSym.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Simulation to determine two-variable symmetries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************

Synopsis [Computes two variable symmetries.]

Description []

SideEffects []

SeeAlso []

Definition at line 43 of file simSym.c.

00044 {
00045     Sym_Man_t * p;
00046     Vec_Ptr_t * vResult;
00047     int Result;
00048     int i, clk, clkTotal = clock();
00049 
00050     srand( 0xABC );
00051 
00052     // start the simulation manager
00053     p = Sym_ManStart( pNtk, fVerbose );
00054     p->nPairsTotal = p->nPairsRem = Sim_UtilCountAllPairs( p->vSuppFun, p->nSimWords, p->vPairsTotal );
00055     if ( fVerbose )
00056         printf( "Total = %8d.  Sym = %8d.  NonSym = %8d.  Remaining = %8d.\n", 
00057                p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsRem );
00058 
00059     // detect symmetries using circuit structure
00060 clk = clock();
00061     Sim_SymmsStructCompute( pNtk, p->vMatrSymms, p->vSuppFun );
00062 p->timeStruct = clock() - clk;
00063 
00064     Sim_UtilCountPairsAll( p );
00065     p->nPairsSymmStr = p->nPairsSymm;
00066     if ( fVerbose )
00067         printf( "Total = %8d.  Sym = %8d.  NonSym = %8d.  Remaining = %8d.\n", 
00068             p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsRem );
00069 
00070     // detect symmetries using simulation
00071     for ( i = 1; i <= 1000; i++ )
00072     {
00073         // simulate this pattern
00074         Sim_UtilSetRandom( p->uPatRand, p->nSimWords );
00075         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00076         if ( i % 50 != 0 )
00077             continue;
00078         // check disjointness
00079         assert( Sim_UtilMatrsAreDisjoint( p ) );
00080         // count the number of pairs
00081         Sim_UtilCountPairsAll( p );
00082         if ( i % 500 != 0 )
00083             continue;
00084         if ( fVerbose )
00085             printf( "Total = %8d.  Sym = %8d.  NonSym = %8d.  Remaining = %8d.\n", 
00086                 p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsRem );
00087     }
00088 
00089     // detect symmetries using SAT
00090     for ( i = 1; Sim_SymmsGetPatternUsingSat( p, p->uPatRand ); i++ )
00091     {
00092         // simulate this pattern in four polarities
00093         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00094         Sim_XorBit( p->uPatRand, p->iVar1 );
00095         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00096         Sim_XorBit( p->uPatRand, p->iVar2 );
00097         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00098         Sim_XorBit( p->uPatRand, p->iVar1 );
00099         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00100         Sim_XorBit( p->uPatRand, p->iVar2 );
00101 /*
00102         // try the previuos pair
00103         Sim_XorBit( p->uPatRand, p->iVar1Old );
00104         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00105         Sim_XorBit( p->uPatRand, p->iVar2Old );
00106         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00107         Sim_XorBit( p->uPatRand, p->iVar1Old );
00108         Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms );
00109 */
00110         if ( i % 10 != 0 )
00111             continue;
00112         // check disjointness
00113         assert( Sim_UtilMatrsAreDisjoint( p ) );
00114         // count the number of pairs
00115         Sim_UtilCountPairsAll( p );
00116         if ( i % 50 != 0 )
00117             continue;
00118         if ( fVerbose )
00119             printf( "Total = %8d.  Sym = %8d.  NonSym = %8d.  Remaining = %8d.\n", 
00120                 p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsRem );
00121     }
00122 
00123     // count the number of pairs
00124     Sim_UtilCountPairsAll( p );
00125     if ( fVerbose )
00126         printf( "Total = %8d.  Sym = %8d.  NonSym = %8d.  Remaining = %8d.\n", 
00127             p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsRem );
00128 //    Sim_UtilCountPairsAllPrint( p );
00129 
00130     Result = p->nPairsSymm;
00131     vResult = p->vMatrSymms;  
00132 p->timeTotal = clock() - clkTotal;
00133     //  p->vMatrSymms = NULL;
00134     Sym_ManStop( p );
00135     return Result;
00136 }


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