Skip to content

Commit cf793c1

Browse files
committed
Considering None in BVDD expressions
1 parent f25b0de commit cf793c1

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

tools/bitme.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ def get_input_expression(var_line, inputs):
185185
return [comparison_line]
186186

187187
def get_bvdd_node_expression(sid_line, bvdd, sbdd, index = 0):
188-
if isinstance(bvdd, bool) or isinstance(bvdd, int):
188+
if bvdd is None:
189+
return None
190+
elif isinstance(bvdd, bool) or isinstance(bvdd, int):
189191
return Constd(btor2.Parser.next_nid(), sid_line, int(bvdd),
190192
"domain-propagated value", 0)
191193
elif bvdd.is_dont_care():
@@ -205,9 +207,12 @@ def get_bvdd_node_expression(sid_line, bvdd, sbdd, index = 0):
205207
if sbdd:
206208
assert 0 <= inputs < 256
207209
inputs = 2**inputs
210+
output_line = Values.get_bvdd_node_expression(sid_line, output, sbdd, index + 1)
211+
if output_line is None:
212+
continue
208213
exp_line = Ite(btor2.Parser.next_nid(), sid_line,
209214
Values.get_input_expression(var_line, inputs)[0],
210-
Values.get_bvdd_node_expression(sid_line, output, sbdd, index + 1),
215+
output_line,
211216
exp_line,
212217
var_line.comment, var_line.line_no)
213218
return exp_line

tools/bvdd.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ def intersection(self, bvdd2, bvdd3 = None):
221221
def is_not_empty(self):
222222
return not (self.is_constant() and self.get_dont_care_output() is None)
223223

224+
def is_not_full(self):
225+
return not (self.is_constant() and self.get_dont_care_output() is not None)
226+
224227
# for CFLOBVDDs
225228

226229
def projection_proto(index):

tools/pdd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def is_consistent(self):
3030
for output1_value in self.o2s:
3131
inputs1 = self.o2s[output1_value]
3232
if len(self.o2s) == 1:
33-
if not inputs1.is_constant() or inputs1.get_dont_care_output() is None:
33+
if inputs1.is_not_full():
3434
return False
3535
for output2_value in self.o2s:
3636
if output1_value != output2_value:

0 commit comments

Comments
 (0)