@@ -174,13 +174,15 @@ def projection_proto(index):
174
174
# use offset 1 for CFLOBVDDs
175
175
return BVDD .projection (index , 1 )
176
176
177
- def apply (self , return_tuple , index = 0 ):
177
+ def apply (self , return_tuple , index = 0 , level = 0 ):
178
178
new_bvdd = type (self )({})
179
179
s2o = self .get_s2o ()
180
180
for inputs in s2o :
181
181
output = s2o [inputs ]
182
182
if isinstance (output , BVDD ):
183
- new_bvdd .set (inputs , output .apply (return_tuple , index + 1 ))
183
+ new_bvdd .set (inputs , output .apply (return_tuple , index + 1 , level ))
184
+ elif index < 2 ** level - 1 :
185
+ new_bvdd .set (inputs , BVDD .constant (output ).apply (return_tuple , index + 1 , level ))
184
186
else :
185
187
new_bvdd .set (inputs , return_tuple [output ])
186
188
return new_bvdd .reduce_SBDD ().reduce_BVDD (index )
@@ -270,10 +272,11 @@ def upsample(self, level, a_rt_inv = None, b_rt_inv = None, b_cs = None, b_rts =
270
272
a_c .set (inputs , a_rt_inv [output ])
271
273
return a_c .reduce_SBDD ().reduce_BVDD (index ), a_rt_inv , b_rt_inv , b_cs , b_rts
272
274
273
- def downsample (self , bvdds , return_tuples ):
275
+ def downsample (self , level , bvdds , return_tuples ):
276
+ assert level > 0
274
277
# apply to bvdds may reduce to constants
275
278
return self .apply (dict ([(exit_i , bvdds [exit_i ].apply (return_tuples [exit_i ], 1 ))
276
- for exit_i in bvdds ]))
279
+ for exit_i in bvdds ]), 0 , level - 1 )
277
280
278
281
def tuple2exit (tuple_inv , tuple_ins ):
279
282
if tuple_ins not in tuple_inv :
0 commit comments