1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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 ///
////////////////////////////////////////////////////////////////////////
|