add in skip mode implementation into matrix demo
[libreriscv.git] / openpower / sv / shape_table_format.mdwn
1 Shape is 32-bits. When SHAPE is set entirely to zeros, remapping is
2 disabled: the register's elements are a linear (1D) vector.
3
4 | 31..30 | 29..28 | 27..24 | 23..21 | 20..18 | 17..12 | 11..6 | 5..0 |
5 | ------ | ------ | ------ | ------ | ------- | ------- | ------- | ------- |
6 | 0b00 | skip | offset | invxyz | permute | zdimsz | ydimsz | xdimsz |
7 | 0b01 | submode| offset | invxyz | rsvd | rsvd | rsvd | xdimsz |
8
9 mode sets different behaviours (straight matrix multiply, FFT, DCT).
10
11 * **mode=0b00** sets straight Matrix Mode
12 * **mode=0b01** sets "FFT / DCT" mode and activates submodes
13
14 submode further selects schedules for FFT and DCT.
15
16 * **submode=0b000** selects the ``j`` offset of the innermost for-loop
17 of Tukey-Cooley
18 * **submode=0b010** selects the ``j+halfsize`` offset of the innermost for-loop
19 of Tukey-Cooley
20 * **submode=0b011** selects the ``k`` of exptable (which coefficient)
21
22 skip allows dimensions to be skipped from being included in the resultant
23 output index. this allows sequences to be repeated: ```0 0 0 1 1 1 2 2 2 ...``` or in the case of skip=0b11 this results in modulo ```0 1 2 0 1 2 ...```
24
25 * **skip=0b00** indicates no dimensions to be skipped
26 * **skip=0b01** sets "skip 1st dimension"
27 * **skip=0b10** sets "skip 2nd dimension"
28 * **skip=0b11** sets "skip 3rd dimension"
29
30 invxyz will invert the start index of each of x, y or z. If invxyz[0] is
31 zero then x-dimensional counting begins from 0 and increments, otherwise
32 it begins from xdimsz-1 and iterates down to zero. Likewise for y and z.
33
34 offset will have the effect of offsetting the result by ```offset``` elements:
35
36 for i in 0..VL-1:
37 GPR(RT + remap(i) + SVSHAPE.offset) = ....
38
39 this appears redundant because the register RT could simply be changed by a compiler, until element width overrides are introduced. also
40 bear in mind that unlike a static compiler SVSHAPE.offset may
41 be set dynamically at runtime.
42
43 xdimsz, ydimsz and zdimsz are offset by 1, such that a value of 0 indicates
44 that the array dimensionality for that dimension is 1. any dimension
45 not intended to be used must have its value set to 0 (dimensionality
46 of 1). A value of xdimsz=2 would indicate that in the first dimension
47 there are 3 elements in the array. For example, to create a 2D array
48 X,Y of dimensionality X=3 and Y=2, set xdimsz=2, ydimsz=1 and zdimsz=0
49
50 The format of the array is therefore as follows:
51
52 array[xdimsz+1][ydimsz+1][zdimsz+1]
53
54 However whilst illustrative of the dimensionality, that does not take the
55 "permute" setting into account. "permute" may be any one of six values
56 (0-5, with values of 6 and 7 being reserved, and not legal). The table
57 below shows how the permutation dimensionality order works:
58
59 | permute | order | array format |
60 | ------- | ----- | ------------------------ |
61 | 000 | 0,1,2 | (xdim+1)(ydim+1)(zdim+1) |
62 | 001 | 0,2,1 | (xdim+1)(zdim+1)(ydim+1) |
63 | 010 | 1,0,2 | (ydim+1)(xdim+1)(zdim+1) |
64 | 011 | 1,2,0 | (ydim+1)(zdim+1)(xdim+1) |
65 | 100 | 2,0,1 | (zdim+1)(xdim+1)(ydim+1) |
66 | 101 | 2,1,0 | (zdim+1)(ydim+1)(xdim+1) |
67
68 In other words, the "permute" option changes the order in which
69 nested for-loops over the array would be done. See executable
70 python reference code for further details.
71