(no commit message)
[libreriscv.git] / openpower / sv / propagation.mdwn
1 # SV Context Propagation
2
3 [[sv/svp64]] context is 24 bits long, and Swizzle is 12. These are enormous and not sustainable as far as power consumption is concerned. Also, there is repetition of the same contexts to different instructions. An idea therefore is to add a level of indirection that allows these contexts to be applied to multiple instructions.
4
5 The basic principle is to have a special instruction in an svp64 context that takes a copy of the `RM[0..23]` bits, alongside a 21 bit suite that indicates which of the following 20 32 bit instructions will have that `RM` applied to them. 20 bits of the 21 bit suite are pushed into a 64 bit SPR, with the top 24 bits cobtaining the `RM` and the other 40 being a shift register. This may be done multiple times.
6
7 The 21 bit suite is inserted in bit-order from bit zero up until the last highest set bit (excluding that last bit). For example: if the immediate contains 0b110 then the 40 bit shift register is pushed up by 2 bits, and its LSBs become 0b10. Thus, the number of bits to be inserted is encoded within the 21 bits (using only 1 marker bit to do so).
8
9 | 0.5|6.7 | 8.10|11.31| name |
10 | -- | -- | --- | --- | ------- |
11 | OP | MM | | | ?-Form |
12 | OP | 00 | idx | imm | |
13
14 There are up to 8 possible 64 bit SPRs, the last (indexed 0b111) is always zeros. Each is independently shifting down except when a Context Propagation instruction or an svp64 encoded instruction is at the current PC.
15
16 Any time the LSB of any one of the 7 Context SPRs is zero, the 24 bit `RM` Context in that SPR is applied to the current 32 bit v3.0B instruction, making it an svp64 opcode instead of v3.0B.
17
18 When the 40 bits of any one of the SPRs reaches zero the entire SPR is set to zero, and the entire SPR bank shuffles down so that at no time will there be an SPR containing zeros splitting up the SPRs. This allows a data-dependent fail-first copy of all SPRs to be used as a single instruction because the last SPR will always be zero.
19
20 As these changes occur on a precise schedule: compilers should not have difficulties statically allocating the Context Propagation, as long as certain conventions are followed, such as avoidance of allowing the context to propagate through branches used by more than one incoming path, and loops.
21
22