From: Luke Kenneth Casson Leighton Date: Sat, 23 Dec 2023 17:38:59 +0000 (+0000) Subject: bug 1155: add new idea by jacob to do x+y+z mode for bigmul remap X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1ece0cc3a;p=openpower-isa.git bug 1155: add new idea by jacob to do x+y+z mode for bigmul remap --- diff --git a/src/openpower/decoder/isa/remapyield.py b/src/openpower/decoder/isa/remapyield.py index d7b4bdef..82eb13b8 100644 --- a/src/openpower/decoder/isa/remapyield.py +++ b/src/openpower/decoder/isa/remapyield.py @@ -51,9 +51,11 @@ def iterate_indices(SVSHAPE): # those to be knocked out if SVSHAPE.skip == i+1: continue #print ("select %d %s" % (i, dbg)) - idx *= mult # shifts up by previous dimension(s) + if SVSHAPE.mode == 0b00: + idx *= mult # shifts up by previous dimension(s) result += idx # adds on this dimension - mult *= lim # for the next dimension + if SVSHAPE.mode == 0b00: + mult *= lim # for the next dimension loopends = (x_end | ((y_end and x_end)<<1) | @@ -64,18 +66,25 @@ def iterate_indices(SVSHAPE): yield result + SVSHAPE.offset, loopends step += 1 +def dump_shape(SVSHAPE0): + # enumerate over the iterator function, getting new indices + for idx, (new_idx, end) in enumerate(iterate_indices(SVSHAPE0)): + estring = bin(end)[2:] if end else '' + print ("%2d->%-2d" % (idx, new_idx), "%2s" % estring, end=' ') + if end != 0: + print() + if end == 0b111: + break + + def demo(): - # set the dimension sizes here - xdim = 3 - ydim = 2 - zdim = 4 + xdim, ydim, zdim = 3, 2, 4 # set the dimension sizes here + VL = xdim * ydim * zdim # set total (can repeat, e.g. VL=x*y*z*4) - # set total (can repeat, e.g. VL=x*y*z*4) - VL = xdim * ydim * zdim + class SVSHAPE: pass # dummy class - # set up an SVSHAPE - class SVSHAPE: - pass + # set up an SVSHAPE with matrix mode + print("matrix", xdim, ydim, zdim) SVSHAPE0 = SVSHAPE() SVSHAPE0.lims = [xdim, ydim, zdim] SVSHAPE0.order = [1,0,2] # experiment with different permutations, here @@ -84,11 +93,19 @@ def demo(): SVSHAPE0.offset = 0 # experiment with different offset, here SVSHAPE0.invxyz = [0,0,0] # inversion if desired - # enumerate over the iterator function, getting new indices - for idx, (new_idx, end) in enumerate(iterate_indices(SVSHAPE0)): - if idx >= VL: - break - print ("%d->%d" % (idx, new_idx), "end", bin(end)[2:]) + dump_shape(SVSHAPE0) + + # rhombus - see https://bugs.libre-soc.org/show_bug.cgi?id=1155#c17 + print("\ntriangular, skip-x", xdim, ydim, zdim) + SVSHAPE0 = SVSHAPE() + SVSHAPE0.lims = [xdim, ydim, zdim] + SVSHAPE0.order = [0,1,2] # experiment with different permutations, here + SVSHAPE0.mode = 0b11 + SVSHAPE0.skip = 0b01 # try skipping x-dimension (for fun) + SVSHAPE0.offset = 0 # experiment with different offset, here + SVSHAPE0.invxyz = [0,0,0] # inversion if desired + + dump_shape(SVSHAPE0) # run the demo if __name__ == '__main__':