From 33012d9530c40817e1fc5230b3e663f7690b2e94 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 4 Sep 2005 08:01:00 -0700 Subject: Version abc50904 --- src/opt/sim/simSym.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 src/opt/sim/simSym.c (limited to 'src/opt/sim/simSym.c') diff --git a/src/opt/sim/simSym.c b/src/opt/sim/simSym.c new file mode 100644 index 00000000..706b13dc --- /dev/null +++ b/src/opt/sim/simSym.c @@ -0,0 +1,93 @@ +/**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 $] + +***********************************************************************/ + +#include "abc.h" +#include "sim.h" + +//////////////////////////////////////////////////////////////////////// +/// DECLARATIONS /// +//////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////// +/// FUNCTION DEFITIONS /// +//////////////////////////////////////////////////////////////////////// + +/**Function************************************************************* + + Synopsis [Computes two variable symmetries.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Sim_ComputeTwoVarSymms( Abc_Ntk_t * pNtk ) +{ + Sym_Man_t * p; + Vec_Ptr_t * vResult; + int Result; + int i, clk = clock(); + +// srand( time(NULL) ); + srand( 0xABC ); + + // start the simulation manager + p = Sym_ManStart( pNtk ); + p->nPairsTotal = Sim_UtilCountAllPairs( p->vSuppFun, p->nSimWords, p->vPairsTotal ); + + // detect symmetries using circuit structure + Sim_SymmsStructCompute( pNtk, p->vMatrSymms ); + p->nPairsSymm = p->nPairsSymmStr = Sim_UtilCountPairs( p->vMatrSymms, p->vPairsSym ); + +printf( "Total = %6d. Sym = %6d. NonSym = %6d. Remaining = %6d.\n", + p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsTotal-p->nPairsSymm-p->nPairsNonSymm ); + + // detect symmetries using simulation + for ( i = 1; i <= 1000; i++ ) + { + // generate random pattern + Sim_UtilGetRandom( p->uPatRand, p->nSimWords ); + // simulate this pattern + Sim_SymmsSimulate( p, p->uPatRand, p->vMatrNonSymms ); + if ( i % 100 != 0 ) + continue; + // count the number of pairs + p->nPairsSymm = Sim_UtilCountPairs( p->vMatrSymms, p->vPairsSym ); + p->nPairsNonSymm = Sim_UtilCountPairs( p->vMatrNonSymms, p->vPairsNonSym ); + +printf( "Total = %6d. Sym = %6d. NonSym = %6d. Remaining = %6d.\n", + p->nPairsTotal, p->nPairsSymm, p->nPairsNonSymm, p->nPairsTotal-p->nPairsSymm-p->nPairsNonSymm ); + } + + Result = p->nPairsSymm; + vResult = p->vMatrSymms; + // p->vMatrSymms = NULL; + Sym_ManStop( p ); + return Result; +} + + +//////////////////////////////////////////////////////////////////////// +/// END OF FILE /// +//////////////////////////////////////////////////////////////////////// + + -- cgit v1.2.3