From: Luke Kenneth Casson Leighton Date: Wed, 13 Oct 2021 12:25:09 +0000 (+0100) Subject: fix layout() to put in only the number of *requested* vector elements X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a52b594062be6fd16d37b1f906904720bdda3525;p=ieee754fpu.git fix layout() to put in only the number of *requested* vector elements --- diff --git a/src/ieee754/part/layout_experiment.py b/src/ieee754/part/layout_experiment.py index 903b74e3..cba74c91 100644 --- a/src/ieee754/part/layout_experiment.py +++ b/src/ieee754/part/layout_experiment.py @@ -122,17 +122,18 @@ def layout(elwid, signed, vec_el_counts, lane_shapes=None, fixed_width=None): "calculated width not aligned multiples" width = fixed_width print("part_wid", part_wid, "count", part_count) - else: - # go with computed width - part_wid = cpart_wid # create the breakpoints dictionary. # do multi-stage version https://bugs.libre-soc.org/show_bug.cgi?id=713#c34 # https://stackoverflow.com/questions/26367812/ dpoints = defaultdict(list) # if empty key, create a (empty) list for i, c in vec_el_counts.items(): + # calculate part_wid based on overall width divided by number + # of elements. + part_wid = width // c def add_p(p): dpoints[p].append(i) # auto-creates list if key non-existent - for start in range(0, part_count, c): + # for each elwidth, create the required number of vector elements + for start in range(c): add_p(start * part_wid) # start of lane add_p(start * part_wid + lane_shapes[i]) # start of padding # do not need the breakpoints at the very start or the very end