From: Luke Kenneth Casson Leighton Date: Tue, 29 Jun 2021 10:39:46 +0000 (+0100) Subject: use inline for remap.py X-Git-Tag: DRAFT_SVP64_0_1~699 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f81335ede5cf2863ac06daa51b1d2015d8d0a89;p=libreriscv.git use inline for remap.py --- diff --git a/openpower/sv/remap.mdwn b/openpower/sv/remap.mdwn index 736816673..c96af492b 100644 --- a/openpower/sv/remap.mdwn +++ b/openpower/sv/remap.mdwn @@ -22,11 +22,13 @@ REMAP is quite expensive to set up, and on some implementations introduce latenc There are four "shape" SPRs, SHAPE0-3, 32-bits in each, which have the same format. -[[!inline raw="yes" pages="simple_v_extension/shape_table_format" ]] +[[!inline raw="yes" pages="openpower/sv/shape_table_format" ]] The algorithm below shows how REMAP works more clearly, and may be executed as a python program: +[[!inline raw="yes" pages="openpower/sv/remap.py" ]] + xdim = 3 # changeme ydim = 4 zdim = 1 diff --git a/openpower/sv/shape_table_format.mdwn b/openpower/sv/shape_table_format.mdwn new file mode 100644 index 000000000..557ee2523 --- /dev/null +++ b/openpower/sv/shape_table_format.mdwn @@ -0,0 +1,43 @@ +Shape is 32-bits. When SHAPE is set entirely to zeros, remapping is +disabled: the register's elements are a linear (1D) vector. + +| 31..30 | 29..24 | 23..21 | 20..18 | 17..12 | 11..6 | 5..0 | +| -------- | ------ | ------- | ------- | ------- | -------- | ------- | +| applydim | offset | invxyz | permute | zdimsz | ydimsz | xdimsz | + +applydim will set to zero the dimensions less than this. applydim=0 +applies all three. applydim=1 applies y and z. applydim=2 applys only +z. applydim=3 is reserved. + +invxyz will invert the start index of each of x, y or z. If invxyz[0] is +zero then x-dimensional counting begins from 0 and increments, otherwise +it begins from xdimsz-1 and iterates down to zero. Likewise for y and z. + +offset will have the effect equivalent to the sequential element loop +to appear to run for offset (additional) iterations prior to actually +generating output. + +xdimsz, ydimsz and zdimsz are offset by 1, such that a value of 0 indicates +that the array dimensionality for that dimension is 1. A value of xdimsz=2 +would indicate that in the first dimension there are 3 elements in the +array. The format of the array is therefore as follows: + + array[xdim+1][ydim+1][zdim+1] + +However whilst illustrative of the dimensionality, that does not take the +"permute" setting into account. "permute" may be any one of six values +(0-5, with values of 6 and 7 being reserved, and not legal). The table +below shows how the permutation dimensionality order works: + +| permute | order | array format | +| ------- | ----- | ------------------------ | +| 000 | 0,1,2 | (xdim+1)(ydim+1)(zdim+1) | +| 001 | 0,2,1 | (xdim+1)(zdim+1)(ydim+1) | +| 010 | 1,0,2 | (ydim+1)(xdim+1)(zdim+1) | +| 011 | 1,2,0 | (ydim+1)(zdim+1)(xdim+1) | +| 100 | 2,0,1 | (zdim+1)(xdim+1)(ydim+1) | +| 101 | 2,1,0 | (zdim+1)(ydim+1)(xdim+1) | + +In other words, the "permute" option changes the order in which +nested for-loops over the array would be done. + diff --git a/simple_v_extension/shape_table_format.mdwn b/simple_v_extension/shape_table_format.mdwn deleted file mode 100644 index 557ee2523..000000000 --- a/simple_v_extension/shape_table_format.mdwn +++ /dev/null @@ -1,43 +0,0 @@ -Shape is 32-bits. When SHAPE is set entirely to zeros, remapping is -disabled: the register's elements are a linear (1D) vector. - -| 31..30 | 29..24 | 23..21 | 20..18 | 17..12 | 11..6 | 5..0 | -| -------- | ------ | ------- | ------- | ------- | -------- | ------- | -| applydim | offset | invxyz | permute | zdimsz | ydimsz | xdimsz | - -applydim will set to zero the dimensions less than this. applydim=0 -applies all three. applydim=1 applies y and z. applydim=2 applys only -z. applydim=3 is reserved. - -invxyz will invert the start index of each of x, y or z. If invxyz[0] is -zero then x-dimensional counting begins from 0 and increments, otherwise -it begins from xdimsz-1 and iterates down to zero. Likewise for y and z. - -offset will have the effect equivalent to the sequential element loop -to appear to run for offset (additional) iterations prior to actually -generating output. - -xdimsz, ydimsz and zdimsz are offset by 1, such that a value of 0 indicates -that the array dimensionality for that dimension is 1. A value of xdimsz=2 -would indicate that in the first dimension there are 3 elements in the -array. The format of the array is therefore as follows: - - array[xdim+1][ydim+1][zdim+1] - -However whilst illustrative of the dimensionality, that does not take the -"permute" setting into account. "permute" may be any one of six values -(0-5, with values of 6 and 7 being reserved, and not legal). The table -below shows how the permutation dimensionality order works: - -| permute | order | array format | -| ------- | ----- | ------------------------ | -| 000 | 0,1,2 | (xdim+1)(ydim+1)(zdim+1) | -| 001 | 0,2,1 | (xdim+1)(zdim+1)(ydim+1) | -| 010 | 1,0,2 | (ydim+1)(xdim+1)(zdim+1) | -| 011 | 1,2,0 | (ydim+1)(zdim+1)(xdim+1) | -| 100 | 2,0,1 | (zdim+1)(xdim+1)(ydim+1) | -| 101 | 2,1,0 | (zdim+1)(ydim+1)(xdim+1) | - -In other words, the "permute" option changes the order in which -nested for-loops over the array would be done. -