Skip to content

Commit dd94aed

Browse files
committed
Including CFLOBVDDs
1 parent 1be3683 commit dd94aed

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

tools/cflobvdd.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ def is_always_true(self):
15221522
(self.number_of_distinct_outputs() == 1 or
15231523
(self.number_of_distinct_outputs() == 2 and None in self.outputs.values())))
15241524

1525-
def constant(level, swap_level, fork_level, output = 0):
1525+
def constant_CFLOBVDD(level, swap_level, fork_level, output = 0):
15261526
assert 0 <= swap_level <= level
15271527
assert 0 <= fork_level <= level
15281528
with CFLOBVDD.max_level_lock:
@@ -1533,13 +1533,20 @@ def constant(level, swap_level, fork_level, output = 0):
15331533
def byte_constant(level, swap_level, fork_level, number_of_input_bytes, output):
15341534
assert number_of_input_bytes > 0
15351535
level = max(level, swap_level, fork_level, ceil(log2(number_of_input_bytes)))
1536-
return CFLOBVDD.constant(level, swap_level, fork_level, output)
1536+
return CFLOBVDD.constant_CFLOBVDD(level, swap_level, fork_level, output)
1537+
1538+
def constant(output):
1539+
return CFLOBVDD.byte_constant(CFLOBVDD.level,
1540+
CFLOBVDD.swap_level,
1541+
CFLOBVDD.fork_level,
1542+
CFLOBVDD.number_of_inputs,
1543+
output)
15371544

15381545
def false(level, swap_level, fork_level):
1539-
return CFLOBVDD.constant(level, swap_level, fork_level, False)
1546+
return CFLOBVDD.constant_CFLOBVDD(level, swap_level, fork_level, False)
15401547

15411548
def true(level, swap_level, fork_level):
1542-
return CFLOBVDD.constant(level, swap_level, fork_level, True)
1549+
return CFLOBVDD.constant_CFLOBVDD(level, swap_level, fork_level, True)
15431550

15441551
def flip_value_tuple(self):
15451552
# self must be reduced
@@ -1557,15 +1564,15 @@ def complement(self):
15571564

15581565
def unary_apply_and_reduce(self, op, number_of_output_bits):
15591566
return self.binary_apply_and_reduce(
1560-
CFLOBVDD.constant(self.grouping.level,
1567+
CFLOBVDD.constant_CFLOBVDD(self.grouping.level,
15611568
self.grouping.swap_level, self.grouping.fork_level),
15621569
lambda x, y: op(x) if x is not None else None,
15631570
number_of_output_bits)
15641571

15651572
def compute_unary(self, op, op_id, number_of_output_bits):
15661573
return self.unary_apply_and_reduce(op, number_of_output_bits)
15671574

1568-
def projection(level, swap_level, fork_level, input_i, reorder = False, input_value = None):
1575+
def projection_CFLOBVDD(level, swap_level, fork_level, input_i, reorder = False, input_value = None):
15691576
assert 0 <= swap_level <= level
15701577
assert 0 <= fork_level <= level
15711578
assert 0 <= input_i < 2**level
@@ -1586,7 +1593,16 @@ def byte_projection(level, swap_level, fork_level, number_of_input_bytes,
15861593
byte_i, reorder = False, input_value = None):
15871594
level = max(level, swap_level, fork_level, ceil(log2(number_of_input_bytes)))
15881595
assert 0 <= byte_i < 2**level
1589-
return CFLOBVDD.projection(level, swap_level, fork_level, byte_i, reorder, input_value)
1596+
return CFLOBVDD.projection_CFLOBVDD(level, swap_level, fork_level, byte_i, reorder, input_value)
1597+
1598+
def projection(index, input_value = None):
1599+
return CFLOBVDD.byte_projection(CFLOBVDD.level,
1600+
CFLOBVDD.swap_level,
1601+
CFLOBVDD.fork_level,
1602+
CFLOBVDD.number_of_inputs,
1603+
index,
1604+
True,
1605+
input_value)
15901606

15911607
def collapse_classes_leftmost(equiv_classes):
15921608
# legacy code
@@ -1712,20 +1728,10 @@ def number_of_partitioned_inputs(self):
17121728
return self.number_of_solutions(CFLOBVDD.has_input)
17131729

17141730
def partitioned_constant():
1715-
return CFLOBVDD.byte_constant(CFLOBVDD.level,
1716-
CFLOBVDD.swap_level,
1717-
CFLOBVDD.fork_level,
1718-
CFLOBVDD.number_of_inputs,
1719-
CFLOBVDD.has_input)
1731+
return CFLOBVDD.constant(CFLOBVDD.has_input)
17201732

17211733
def partitioned_projection(index, input_value):
1722-
return CFLOBVDD.byte_projection(CFLOBVDD.level,
1723-
CFLOBVDD.swap_level,
1724-
CFLOBVDD.fork_level,
1725-
CFLOBVDD.number_of_inputs,
1726-
index,
1727-
True,
1728-
input_value)
1734+
return CFLOBVDD.projection(index, input_value)
17291735

17301736
def op_union(output1, output2):
17311737
return output1 if output2 == CFLOBVDD.no_input else output2

0 commit comments

Comments
 (0)