[Libre-soc-bugs] [Bug 565] Improve formal verification on PartitionedSignal

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Fri Jan 8 22:56:48 GMT 2021


https://bugs.libre-soc.org/show_bug.cgi?id=565

--- Comment #13 from Jacob Lifshay <programmerjake at gmail.com> ---
A recursive function to create legal partitions:

def legal_partitions(log2_size):
    yield [0] * ((1 << log2_size) - 1)
    if log2_size == 0:
        return
    assert log2_size > 0
    next_smaller_partitions = list(legal_partitions(log2_size - 1))
    for left in next_smaller_partitions:
        for right in next_smaller_partitions:
            yield [*left, 1, *right]

for log2_size in range(4):
    print(f"log2_size={log2_size}:")
    for p in legal_partitions(log2_size):
        print(p)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list