3 sv.setvl allows optional setting of both MVL and of indirectly marking one of the scalar registers as being VL.
5 Unlike the majority of other CSRs, which contain status bits that change behaviour, VL is closely interlinked with the instructions it affects and often requires arithmetic interaction.
7 Thus it makes more sense to actually *use* one of the scalar registers *as* VL.
9 A potential implementation optimisation technique involves keeping 5 bits which specify the scalar register in use as VL actually in the instruction decode phase. On detection of a CSRR rd, VL, if the cached copy of VL is not pointing to x0, the CSRR instruction is *replaced* with a "MV rd, vlcachedreg" instruction. See [[discussion]] for further details.
11 Format for Vector Configuration Instructions under OP-V major opcode:
13 | 31|30 20|19 15|14 12|11 7|6 0| name |
14 |---|-------|--------|-------|----|-------|------------|
15 | 0 | VLMAX | rs1 | 1 1 1 | rd |1010111| sv.setvl |
16 | 0 | VLMAX | 0 (x0) | 1 1 1 | rd |1010111| sv.setvl |
17 | 1 | -- | -- | 1 1 1 | -- |1010111| *reserved* |
26 // instruction fields:
28 rs1 = get_rs1_field();
29 vlmax = get_immed_field();
31 // handle illegal instruction decoding
37 if rs1 == 0 { // rs1 is x0
40 vlval = min(regs[rs1], vlmax)
49 # questions <a name="questions"></>
51 Moved to [[discussion]]