From 306fb60109305de2bbd4bdac0bb92bc3ae093a2a Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Tue, 29 Jun 2021 11:57:52 +0100 Subject: [PATCH] comments and experimentation with remap.py --- openpower/sv/remap.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/openpower/sv/remap.py b/openpower/sv/remap.py index c14b1102a..2b5c4f373 100644 --- a/openpower/sv/remap.py +++ b/openpower/sv/remap.py @@ -2,14 +2,15 @@ xdim = 3 ydim = 2 zdim = 1 +VL = xdim * ydim * zdim # set total (can repeat, e.g. VL=x*y*z*4) + lims = [xdim, ydim, zdim] idxs = [0,0,0] # starting indices -order = [0,1,2] # experiment with different permutations, here -offs = 2 # experiment with different offset, here -applydim = 0 -invxyz = [1,0,0] +order = [1,0,2] # experiment with different permutations, here +offset = 0 # experiment with different offsetet, here +invxyz = [0,1,0] -for idx in range(offs): +for idx in range(offset): for i in range(3): idxs[order[i]] = idxs[order[i]] + 1 if (idxs[order[i]] != lims[order[i]]): @@ -17,20 +18,19 @@ for idx in range(offs): print idxs[order[i]] = 0 -break_count = 0 +break_count = 0 # for pretty-printing -for idx in range(xdim * ydim * zdim): +for idx in range(VL): ix = [0] * 3 for i in range(3): - if i >= applydim: - ix[i] = idxs[i] + ix[i] = idxs[i] if invxyz[i]: ix[i] = lims[i] - 1 - ix[i] new_idx = ix[0] + ix[1] * xdim + ix[2] * xdim * ydim - print new_idx, + print ("%d->%d" % (idx, new_idx)), break_count += 1 if break_count == lims[order[0]]: - print + print ("") break_count = 0 for i in range(3): idxs[order[i]] = idxs[order[i]] + 1 -- 2.30.2