first matrix-multiply REMAP demo using generators
[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..24 | 23..21 | 20..18 | 17..12 | 11..6 | 5..0 |
5 | -------- | ------ | ------- | ------- | ------- | ------- | ------- |
6 | mode | offset | invxyz | permute | zdimsz | ydimsz | xdimsz |
7
8 mode sets different behaviours (straight matrix multiply, FFT, DCT).
9
10 * **mode=0b00** sets straight permute
11 * **mode=0b01** sets "skip 2nd dimension"
12 * **mode=0b10** sets "skip 1st dimension"
13 * **mode=0b11** is reserved
14
15 invxyz will invert the start index of each of x, y or z. If invxyz[0] is
16 zero then x-dimensional counting begins from 0 and increments, otherwise
17 it begins from xdimsz-1 and iterates down to zero. Likewise for y and z.
18
19 offset will have the effect equivalent to the sequential element loop
20 to appear to run for offset (additional) iterations prior to actually
21 generating output. in pseudo-code the loop would be:
22
23 for index in offset to (offset+VL-1)
24
25 xdimsz, ydimsz and zdimsz are offset by 1, such that a value of 0 indicates
26 that the array dimensionality for that dimension is 1. any dimension
27 not intended to be used must have its value set to 0 (dimensionality
28 of 1). A value of xdimsz=2 would indicate that in the first dimension
29 there are 3 elements in the array. For example, to create a 2D array
30 X,Y of dimensionality X=3 and Y=2, set xdimsz=2, ydimsz=1 and zdimsz=0
31
32 The format of the array is therefore as follows:
33
34 array[xdimsz+1][ydimsz+1][zdimsz+1]
35
36 However whilst illustrative of the dimensionality, that does not take the
37 "permute" setting into account. "permute" may be any one of six values
38 (0-5, with values of 6 and 7 being reserved, and not legal). The table
39 below shows how the permutation dimensionality order works:
40
41 | permute | order | array format |
42 | ------- | ----- | ------------------------ |
43 | 000 | 0,1,2 | (xdim+1)(ydim+1)(zdim+1) |
44 | 001 | 0,2,1 | (xdim+1)(zdim+1)(ydim+1) |
45 | 010 | 1,0,2 | (ydim+1)(xdim+1)(zdim+1) |
46 | 011 | 1,2,0 | (ydim+1)(zdim+1)(xdim+1) |
47 | 100 | 2,0,1 | (zdim+1)(xdim+1)(ydim+1) |
48 | 101 | 2,1,0 | (zdim+1)(ydim+1)(xdim+1) |
49
50 In other words, the "permute" option changes the order in which
51 nested for-loops over the array would be done. See executable
52 python reference code for further details.
53