[libre-riscv-dev] SV Prefix questions

Jacob Lifshay programmerjake at gmail.com
Wed Jun 26 07:12:47 BST 2019


On Tue, Jun 25, 2019 at 10:37 PM Luke Kenneth Casson Leighton <lkcl at lkcl.net>
wrote:
> no, it's not quite right.
Just use the encoding from the V extension:
https://github.com/riscv/riscv-v-spec/blob/e014590220e7b95b1dfa3c0665277ae1550828c9/vcfg-format.adoc

uses the same encoding as vsetvli
+----+-------+-----------+-------+------+---------+
| 31 | 30:20 | 19:15     | 14:12 | 11:7 | 6:0     |
+====+=======+===========+=======+======+=========+
| 0  | MAXVL | rs1 (AVL) | 111   | rd   | 1010111 |
+----+-------+-----------+-------+------+---------+

if sv.setvl is added (SVorig variant), then the MVL CSR can just be
removed, since it's only used when setting VL (from what I recall). If the
programmer doesn't want to use sv.setvl, they can just use csrw like
normal, since VL is a CSR.

Also, addressing your concerns about needing to modify binutils, the .insn
directive was added to binutils 2.31.
sv.setvl can simply be encoded using (not verified, since I don't have a
new enough binutils):
.insn i 0x57, 0, rd, rs1, MAXVL

> it's complicated, needs a lot of thought, on how to encode both the
> CSRRW and CSRRWI versions into the opcode without wasting opcode
> space.
>
> *all of which takes time*!
I think you may be trying to rush a little too much. Slow down, so we don't
accidentally make a mistake and pay for it later.


More information about the libre-riscv-dev mailing list