1 # Dynamic Partitioned Slice (`SimdSlice`)
3 In order to match the semantics of nmigen's `Slice` class, `SimdSlice` has to have each element of the result have
4 exactly the same `Shape` as the result of slicing the input `SimdSignal`'s corresponding element.
10 a = a_s.sig # shorthand to make table smaller
12 b = b_s.sig # shorthand to make table smaller
18 <tr class="text-right">
19 <th scope="row" class="text-left">Bit #</th>
20 <td>63⁠…⁠56</td>
21 <td>55⁠…⁠48</td>
22 <td>47⁠…⁠40</td>
23 <td>39⁠…⁠32</td>
24 <td>31⁠…⁠24</td>
25 <td>23⁠…⁠16</td>
26 <td>15⁠…⁠8</td>
27 <td>7⁠…⁠0</td>
29 <tr class="text-right">
30 <th scope="row" class="text-left">ElWid: 8-bit</th>
31 <td><code>a[56:64]</code></td>
32 <td><code>a[48:56]</code></td>
33 <td><code>a[40:48]</code></td>
34 <td><code>a[32:40]</code></td>
35 <td><code>a[24:32]</code></td>
36 <td><code>a[16:24]</code></td>
37 <td><code>a[8:16]</code></td>
38 <td><code>a[0:8]</code></td>
40 <tr class="text-right">
41 <th scope="row" class="text-left">ElWid: 16-bit</th>
42 <td colspan="2"><code>a[48:64]</code></td>
43 <td colspan="2"><code>a[32:48]</code></td>
44 <td colspan="2"><code>a[16:32]</code></td>
45 <td colspan="2"><code>a[0:16]</code></td>
47 <tr class="text-right">
48 <th scope="row" class="text-left">ElWid: 32-bit</th>
49 <td colspan="4"><code>a[32:64]</code></td>
50 <td colspan="4"><code>a[0:32]</code></td>
52 <tr class="text-right">
53 <th scope="row" class="text-left">ElWid: 64-bit</th>
54 <td colspan="8"><code>a[0:64]</code></td>
58 So, slicing bits `3:6` of a 32-bit element of `a` must, because we have to match nmigen, produce a 3-bit element, which might seem like no problem, however, slicing bits `3:6` of a 16-bit element of a 64-bit `SimdSignal` must *also* produce a 3-bit element, so, in order to get a `SimdSignal` where *all* elements are 3-bit elements, as required by `SimdSlice`'s output, we have to introduce padding:
63 <tr class="text-right">
64 <th scope="row" class="text-left">Bit #</th>
65 <td>23⁠…⁠21</td>
66 <td>20⁠…⁠18</td>
67 <td>17⁠…⁠15</td>
68 <td>14⁠…⁠12</td>
69 <td>11⁠…⁠9</td>
70 <td>8⁠…⁠6</td>
71 <td>5⁠…⁠3</td>
72 <td>2⁠…⁠0</td>
74 <tr class="text-right">
75 <th scope="row" class="text-left">ElWid: 8-bit</th>
76 <td><code>b[21:24]</code></td>
77 <td><code>b[18:21]</code></td>
78 <td><code>b[15:18]</code></td>
79 <td><code>b[12:15]</code></td>
80 <td><code>b[9:12]</code></td>
81 <td><code>b[6:9]</code></td>
82 <td><code>b[3:6]</code></td>
83 <td><code>b[0:3]</code></td>
85 <tr class="text-right">
86 <th scope="row" class="text-left">ElWid: 16-bit</th>
87 <td class="text-center"><i>Padding</i></td>
88 <td><code>b[18:21]</code></td>
89 <td class="text-center"><i>Padding</i></td>
90 <td><code>b[12:15]</code></td>
91 <td class="text-center"><i>Padding</i></td>
92 <td><code>b[6:9]</code></td>
93 <td class="text-center"><i>Padding</i></td>
94 <td><code>b[0:3]</code></td>
96 <tr class="text-right">
97 <th scope="row" class="text-left">ElWid: 32-bit</th>
98 <td colspan="3" class="text-center"><i>Padding</i></td>
99 <td><code>b[12:15]</code></td>
100 <td colspan="3" class="text-center"><i>Padding</i></td>
101 <td><code>b[0:3]</code></td>
103 <tr class="text-right">
104 <th scope="row" class="text-left">ElWid: 64-bit</th>
105 <td colspan="7" class="text-center"><i>Padding</i></td>
106 <td><code>b[0:3]</code></td>
111 /* duplicated from bootstrap so text editors can see it
112 -- ignored by ikiwiki */
114 text-align: left !important
118 text-align: right !important
122 text-align: center !important