rvcodec.js: a RISC-V instruction encoder/decoder

483 views
Skip to first unread message

Joël Porquet-Lupine

unread,
Sep 11, 2023, 5:47:08 PM9/11/23
to isa...@groups.riscv.org, riscv...@groups.riscv.org
Dear RISC-V community,

I've been meaning to announce `rvcodec.js` for a while. It's a great little instruction encoder/decoder which you can find it here: https://luplab.gitlab.io/rvcodecjs/.

Essentially, you type in (almost) any valid RISC-V instruction, either in its decoded assembly form (e.g., `addi x2, x10, 897`) or in its encoded binary/hexadecimal form (e.g., `0x38150113`), and it gives you the conversion as well as some useful information. One aspect that can be particularly interesting is that it visually maps the relationships between the assembly tokens and binary fields: just hover your cursor over the fields to see it!

At this point, the project is in semi-maintenance mode as we support the most common instruction sets: RV32I, RV64I, and the entirety of the GC extensions. We also support RV128I and the Q extension as they were easy to add, and plenty of other nice features (completion of opcodes, ABI names, etc.).

rvcodec.js is open-source (AGLP3) and the source code is available here: https://gitlab.com/luplab/rvcodecjs/.

Hope you find this project useful!

Cheers,
Joël

--
Joël Porquet-Lupine (he/him)
Assistant Professor of Teaching Computer Science
University of California, Davis

Dan Petrisko

unread,
Sep 11, 2023, 6:02:06 PM9/11/23
to Joël Porquet-Lupine, isa...@groups.riscv.org, riscv...@groups.riscv.org
Hi Joël,

Wow, this is incredibly useful. Thank you! If I may suggest a feature to make this better for custom instructions. In addition to the ISA type, I would like to be able to select the RISC-V instruction type (I-type, R-type, etc.) and have it decode to generic fields rather than defaulting to invalid instruction.

Best,
-Dan



--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/CAFz%3D2HCJOog2Bu9C19oDBKpOBT1QLNH4cuMSdn--vaPr1f79%3Dw%40mail.gmail.com.

Jeff Scott

unread,
Sep 11, 2023, 6:51:08 PM9/11/23
to Dan Petrisko, Joël Porquet-Lupine, isa...@groups.riscv.org, riscv...@groups.riscv.org

Agree, this is very nice.  Noticed it does not support B (Zbb) or Zc yet.  Hope you have time to keep growing the supported extensions!

 

Good work!

 

Jeff

 

From: Dan Petrisko <petr...@cs.washington.edu>
Sent: Monday, September 11, 2023 5:02 PM
To: Joël Porquet-Lupine <jpor...@ucdavis.edu>
Cc: isa...@groups.riscv.org; riscv...@groups.riscv.org
Subject: [EXT] Re: [isa-dev] rvcodec.js: a RISC-V instruction encoder/decoder

 

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

 

Joël Porquet-Lupine

unread,
Sep 12, 2023, 1:26:59 PM9/12/23
to Jeff Scott, Dan Petrisko, isa...@groups.riscv.org, riscv...@groups.riscv.org
Hi all,

Thanks for the feedback! I've created two tickets based on your suggestions:

- Better support for custom instructions: https://gitlab.com/luplab/rvcodecjs/-/issues/43

We'll try to work on these sometime during this academic year!

Best,
Joël
Reply all
Reply to author
Forward
0 new messages