C to RISC-V Explorer

C source, RV32IM assembly, and machine-code instruction encoding
Conceptualized by Adelson Chua
RV32IM · ILP32 · C17
Preparing the embedded compiler…All compilation stays in this browser.
Matching colors connect each C line with its instructions. Click an instruction to inspect its encoding.Fully offline
01

C source

Describe the computation
program.c
Click a C line to trace its instructions.
02

RISC-V assembly

Express the operations
The compiler output will appear here. Real instructions show expanded pseudo-instructions.
03

Machine code

Encode each instruction
Each RV32IM instruction occupies four bytes. Select a row to inspect its encoding.
32 bits · little-endian bytes
Live C checks

Preparing the C checks…

Compiler messages
The embedded compiler is starting.

How to explore

Edit the C program, then compile. Select a C line or an instruction to connect the three views. Compare -O0 with -O2 to see how optimization changes the result.

RISC-V instruction encoding

Compiler credits & licenses

The compiler is Clang / LLVM, distributed under Apache 2.0 with LLVM exceptions. The embedded build is provided by Mokxi. The runtime and retained upstream notices are included below.