ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sbd.c
Go to the documentation of this file.
1
20
21#include "sbdInt.h"
22#include "misc/vec/vecHsh.h"
23
25
26
30
34
46int Sbd_CountConfigVars( Vec_Int_t * vSet, int nVars, int Degree )
47{
48 int i, k, Entry = 0, Entry2, Count = 0, Below;
49 int Prev = Vec_IntEntry( vSet, 0 );
50 Vec_IntForEachEntryStart( vSet, Entry, i, 1 )
51 {
52 assert( Degree*Prev >= Entry );
53 if ( Degree*Prev == Entry )
54 {
55 Prev = Entry;
56 continue;
57 }
58 Below = nVars;
59 Vec_IntForEachEntryStart( vSet, Entry2, k, i )
60 Below += Entry2;
61 Count += Below * (Degree*Prev - 1);
62 Prev = Entry;
63 }
64 Count += nVars * Degree*Prev;
65 return Vec_IntSum(vSet) < nVars - 1 ? 0 : Count;
66}
68{
69 int nInputs = 9;
70 int nNodes = 10;
71 int Degree = 3;
72 int fVerbose = 1;
73 Hsh_VecMan_t * p = Hsh_VecManStart( 10000 ); // hash table for arrays
74 Vec_Int_t * vSet = Vec_IntAlloc( 100 );
75 int i, k, e, Start, Stop;
76 printf( "Counting topologies for %d inputs and %d degree-%d nodes.\n", nInputs, nNodes, Degree );
77 Start = Hsh_VecManAdd( p, vSet );
78 for ( i = 1; i <= nNodes; i++ )
79 {
80 Stop = Hsh_VecSize( p );
81 for ( e = Start; e < Stop; e++ )
82 {
83 Vec_Int_t * vTemp = Hsh_VecReadEntry( p, e );
84 Vec_IntClear( vSet );
85 Vec_IntAppend( vSet, vTemp );
86 for ( k = 0; k < Vec_IntSize(vSet); k++ )
87 {
88 // skip if the number of entries on this level is equal to the number of fanins on the previous level
89 if ( k ? (Vec_IntEntry(vSet, k) == Degree*Vec_IntEntry(vSet, k-1)) : (Vec_IntEntry(vSet, 0) > 0) )
90 continue;
91 Vec_IntAddToEntry( vSet, k, 1 );
92 Hsh_VecManAdd( p, vSet );
93 Vec_IntAddToEntry( vSet, k, -1 );
94 }
95 Vec_IntPush( vSet, 1 );
96 Hsh_VecManAdd( p, vSet );
97 }
98 printf( "Nodes = %2d : This = %8d All = %8d\n", i, Hsh_VecSize(p) - Stop, Hsh_VecSize(p) );
99 if ( fVerbose )
100 {
101 for ( e = Stop; e < Hsh_VecSize(p); e++ )
102 {
103 Vec_Int_t * vTemp = Hsh_VecReadEntry( p, e );
104 printf( "Params = %3d. ", Sbd_CountConfigVars(vTemp, nInputs, Degree) );
105 Vec_IntPrint( vTemp );
106 }
107 printf( "\n" );
108 }
109 Start = Stop;
110 }
111 Vec_IntFree( vSet );
112 Hsh_VecManStop( p );
113}
114
115
119
120
122
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
ABC_NAMESPACE_IMPL_START int Sbd_CountConfigVars(Vec_Int_t *vSet, int nVars, int Degree)
DECLARATIONS ///.
Definition sbd.c:46
void Sbd_CountTopos()
Definition sbd.c:67
#define assert(ex)
Definition util_old.h:213
struct Hsh_VecMan_t_ Hsh_VecMan_t
Definition vecHsh.h:85
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition vecInt.h:56