From: Luke Kenneth Casson Leighton Date: Wed, 13 Oct 2021 12:36:47 +0000 (+0100) Subject: add assert to check that the 5-6-6-6 example returns the expected X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=93cc0c33f0177226ee156a7623642335d0a74e71;p=ieee754fpu.git add assert to check that the 5-6-6-6 example returns the expected partition points 5,6,12,18 --- diff --git a/src/ieee754/part/layout_experiment.py b/src/ieee754/part/layout_experiment.py index cba74c91..4a18850e 100644 --- a/src/ieee754/part/layout_experiment.py +++ b/src/ieee754/part/layout_experiment.py @@ -218,6 +218,7 @@ if __name__ == '__main__': # elwidth=0b11 3x 24-bit | .....6 | .....6 | .....6 | .....6 | # expected partitions (^) ^ ^ ^^ (^) # to be at these points: (|) | | || (|) + # (24) 18 12 65 (0) widths_at_elwidth = { 0: 5, 1: 6, @@ -227,7 +228,13 @@ if __name__ == '__main__': print ("5,6,6,6 elements", widths_at_elwidth) for i in range(4): - pprint((i, layout(i, False, vec_el_counts, widths_at_elwidth))) + pp, bitp, bm, b, c, d, e = \ + layout(i, False, vec_el_counts, widths_at_elwidth) + pprint((i, (pp, bitp, bm, b, c, d, e))) + # now check that the expected partition points occur + print("5,6,6,6 ppt keys", pp.keys()) + assert list(pp.keys()) == [5,6,12,18] + # this tests elwidth as an actual Signal. layout is allowed to # determine arbitrarily the overall length