@@ -41,6 +41,13 @@ def __init__(self, level, number_of_input_bits, number_of_exits,
41
41
self .number_of_paths_per_exit = number_of_paths_per_exit
42
42
assert not number_of_inputs_per_exit or len (number_of_inputs_per_exit ) == number_of_exits
43
43
self .number_of_inputs_per_exit = number_of_inputs_per_exit
44
+
45
+ #### probably very bad practice, but a findable bug.
46
+ if "s2o" in kwargs :
47
+ print (kwargs )
48
+ super ().__init__ (kwargs ["s2o" ])
49
+
50
+ print ("BV_Grouping init just finished execution." )
44
51
45
52
def __repr__ (self ):
46
53
return f"{ self .level } w/ { self .number_of_input_bits } input bits & { self .number_of_exits } exits"
@@ -128,6 +135,7 @@ class BV_Dont_Care_Grouping(BV_Grouping):
128
135
def __init__ (self , number_of_input_bits ):
129
136
super ().__init__ (0 , number_of_input_bits , 1 , {1 :2 ** number_of_input_bits }, {1 :1 })
130
137
138
+
131
139
def __repr__ (self ):
132
140
return "dontcare @ " + super ().__repr__ ()
133
141
@@ -218,7 +226,7 @@ class BV_Fork_Grouping(BV_Grouping, SBDD_s2o):
218
226
219
227
def __init__ (self , s2o ):
220
228
assert 1 < len (s2o ) <= 2 ** 8
221
- number_of_paths_per_exit = dict ([(i , inputs [i ].bit_count ()) for i in inputs ])
229
+ number_of_paths_per_exit = dict ([(i , s2o [i ].bit_count ()) for i in s2o ])
222
230
super ().__init__ (level = 0 , number_of_input_bits = 8 , number_of_exits = len (s2o ), number_of_paths_per_exit = number_of_paths_per_exit , number_of_inputs_per_exit = number_of_paths_per_exit , s2o = s2o )
223
231
224
232
def __repr__ (self ):
@@ -301,19 +309,10 @@ def representative(self):
301
309
return BV_Fork_Grouping .representatives [self ]
302
310
303
311
def projection_proto (number_of_input_bits ):
304
- return BV_Fork_Grouping (dict ([(i + 1 , 2 ** i ) for i in range (2 ** number_of_input_bits )]),
305
- number_of_input_bits ).representative ()
306
-
307
- ## TODO: at this point, pair_product(self, g2) and
308
- ## triple_product(self, g2, g3) has been im-
309
- ## lemented in the SBDD_s2o father class. t-
310
- ## he problem is this version does not util-
311
- ## ze the cache of BV_Grouping class. optio-
312
- ## ns are using BV_grouping cache by implem-
313
- ## enting a helper function here or using t-
314
- ## he cached versions of SBDD classes (clea-
315
- ## ner approach I suppose)
312
+ return BV_Fork_Grouping (dict ([(i + 1 , 2 ** i ) for i in range (2 ** number_of_input_bits )]),
313
+ number_of_input_bits ).representative ()
316
314
315
+
317
316
"""
318
317
# def pair_product(self, g2):
319
318
# assert isinstance(g2, BV_Grouping)
@@ -1272,4 +1271,13 @@ def test():
1272
1271
CFLOBVDD .projection (2 , 0 , 4 , 4 ).ternary_apply_and_reduce (CFLOBVDD .projection (2 , 2 , 4 , 4 ),
1273
1272
CFLOBVDD .projection (2 , 3 , 4 , 4 ), lambda x , y , z : y if x else z , 4 )
1274
1273
CFLOBVDD .projection (2 , 0 , 4 , 4 ).ternary_apply_and_reduce (CFLOBVDD .projection (2 , 2 , 4 , 4 ),
1275
- CFLOBVDD .projection (2 , 3 , 4 , 4 ), lambda x , y , z : y if x else z , 4 )
1274
+ CFLOBVDD .projection (2 , 3 , 4 , 4 ), lambda x , y , z : y if x else z , 4 )
1275
+
1276
+
1277
+
1278
+
1279
+
1280
+ if __name__ == '__main__' :
1281
+ a = {2 : 42 , 16 : 53 }
1282
+ b = BV_Fork_Grouping (a )
1283
+
0 commit comments