# create the breakpoints dictionary.
# do multi-stage version https://bugs.libre-soc.org/show_bug.cgi?id=713#c34
# https://stackoverflow.com/questions/26367812/
+
+ # first phase: create a dictionary of partition points (dpoints) and
+ # also keep a record of where each element starts and ends (lpoints)
dpoints = defaultdict(list) # if empty key, create a (empty) list
lpoints = defaultdict(list) # dict of list of start-end points
padding_masks = {}
if always_padding:
bmask |= 1 << bit_index
partition_start = partition_end
- return (PartitionPoints(points), bitp, bmask, width, lane_shapes,
+ return (PartitionPoints(points), bitp, lpoints, bmask, width, lane_shapes,
part_wid)
# XXX XXX XXX XXX quick tests TODO convert to proper ones but kinda good
print("5,6,6,6 elements", widths_at_elwidth)
for i in range(4):
- pp, bitp, bm, b, c, d = \
+ pp, bitp, lp, bm, b, c, d = \
layout(i, vec_el_counts, widths_at_elwidth)
- pprint((i, (pp, bitp, bm, b, c, d)))
+ pprint((i, (pp, bitp, lp, bm, b, c, d)))
# 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]
print("24,12,5,6 elements", widths_at_elwidth)
for i in range(4):
- pp, bitp, bm, b, c, d = \
+ pp, bitp, lp, bm, b, c, d = \
layout(i, vec_el_counts, widths_at_elwidth)
- pprint((i, (pp, bitp, bm, b, c, d)))
+ pprint((i, (pp, bitp, lp, bm, b, c, d)))
# now check that the expected partition points occur
print("24,12,5,6 ppt keys", pp.keys())
assert list(pp.keys()) == [5, 6, 12, 17, 18]
# https://bugs.libre-soc.org/show_bug.cgi?id=713#c30
elwid = Signal(2)
- pp, bitp, bm, b, c, d = layout(
+ pp, bitp, lp, bm, b, c, d = layout(
elwid, vec_el_counts, widths_at_elwidth)
- pprint((pp, b, c, d))
+ pprint((pp, lp, b, c, d))
for k, v in bitp.items():
print("bitp elwidth=%d" % k, bin(v))
print("bmask", bin(bm))
# bit-37 bit-22 bit-6
elwid = Signal(2)
- pp, bitp, bm, b, c, d = layout(elwid, vec_el_counts,
+ pp, bitp, lp, bm, b, c, d = layout(elwid, vec_el_counts,
widths_at_elwidth,
fixed_width=64)
- pprint((pp, b, c, d))
+ pprint((pp, lp, b, c, d))
for k, v in bitp.items():
print("bitp elwidth=%d" % k, bin(v))
print("bmask", bin(bm))
print("11,8,5,8 elements (FP64/32/16/BF exponents)", widths_at_elwidth)
for i in range(4):
- pp, bitp, bm, b, c, d = \
+ pp, bitp, lp, bm, b, c, d = \
layout(i, vec_el_counts, widths_at_elwidth,
fixed_width=32)
- pprint((i, (pp, bitp, bin(bm), b, c, d)))
+ pprint((i, (pp, lp, bitp, bin(bm), b, c, d)))
# now check that the expected partition points occur
print("11,8,5,8 pp keys", pp.keys())
#assert list(pp.keys()) == [5,6,12,18]
print("11,8,5,8 elements (FP64/32/16/BF exponents)", widths_at_elwidth)
for i in range(4):
- pp, bitp, bm, b, c, d = \
+ pp, bitp, lp, bm, b, c, d = \
layout(i, vec_el_counts, widths_at_elwidth,
fixed_width=32)
- pprint((i, (pp, bitp, bin(bm), b, c, d)))
+ pprint((i, (pp, lp, bitp, bin(bm), b, c, d)))
# now check that the expected partition points occur
print("11,8,5,8 pp keys", pp.keys())
#assert list(pp.keys()) == [5,6,12,18]