From: Jacob Lifshay Date: Fri, 15 Oct 2021 03:45:49 +0000 (-0700) Subject: remove redundant plist variable X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=885d992390307f80b2f0de82d223338347700de3;p=ieee754fpu.git remove redundant plist variable --- diff --git a/src/ieee754/part/layout_experiment.py b/src/ieee754/part/layout_experiment.py index 65fe1425..72bceb20 100644 --- a/src/ieee754/part/layout_experiment.py +++ b/src/ieee754/part/layout_experiment.py @@ -156,14 +156,13 @@ def layout(elwid, vec_el_counts, lane_shapes=None, fixed_width=None): # sort dpoints keys dpoints = dict(sorted(dpoints.items(), key=lambda i: i[0])) - plist = list(dpoints.keys()) print("dpoints") pprint(dpoints) # second stage, add (map to) the elwidth==i expressions. # TODO: use nmutil.treereduce? points = {} - for p in plist: + for p in dpoints.keys(): points[p] = map(lambda i: elwid == i, dpoints[p]) points[p] = reduce(operator.or_, points[p]) @@ -173,14 +172,13 @@ def layout(elwid, vec_el_counts, lane_shapes=None, fixed_width=None): bitp = {} for i in vec_el_counts.keys(): bitp[i] = 0 - for p, elwidths in dpoints.items(): + for bit_index, (p, elwidths) in enumerate(dpoints.items()): if i in elwidths: - bitpos = plist.index(p) - bitp[i] |= 1 << bitpos + bitp[i] |= 1 << bit_index # fourth stage: determine which partitions are 100% unused. # these can then be "blanked out" - bmask = (1 << len(plist))-1 + bmask = (1 << len(dpoints)) - 1 for p in bitp.values(): bmask &= ~p return (PartitionPoints(points), bitp, bmask, width, lane_shapes,