[libre-riscv-dev] sv 1d/2d/3d data shaping

Luke Kenneth Casson Leighton lkcl at lkcl.net
Mon Oct 15 19:53:17 BST 2018


ok so i thought about this a bit more, and i believe it may be
achievable with an additional (small!) CAM CSR table that contains the
dimensions required and the order in which they are to be applied.  i
am reluctant to specify all the permutations required of 3D at this
stage however it may be ok to leave room for further expansion.

the key thing here is to be able to "reorder" linear data with an
algorithm that, for 2D, would go something like this:

xdim = CSRtb[reg].x_sz
ydim = CSRtb[reg].y_sz

for idx in range(VL):
  if (swap_xy)
  {
     new_idx = (idx % xdim) * ydim + (idx / ydim)
  }

or something to that effect, where if say xdim = 2 and ydim = 4, then
the loop from 0 to 7 on idx would produce a sequence 0,2,4,6,1,3,5,7
thus re-ordering the elements without requiring LD/ST to and from
memory.

would something like that do the trick, jacob?

l.



More information about the libre-riscv-dev mailing list