Machine Code to Assembly

RISC-V Instruction Decoder

Enter a 32-bit RISC-V machine word and inspect the corresponding assembly instruction, opcode, funct fields, register fields, and immediate layout. The current tool covers a verified integer-instruction subset.

Input

Examples
Input Formats

Accepts 0x-prefixed hex, 8 hex digits, 0b-prefixed binary, 32 binary bits, and unsigned decimal.

!Supported Scope

The current decoder only covers a verified subset of 32-bit R/I/S/B/U/J integer instructions, including selected CSR and RV64 instructions; compressed, A/F/D/C/V, and most privileged or FENCE instructions are reported as unsupported.

Decode Result

Assembly
add x1, x2, x3
Hex
0x003100B3
Format
R-type
Extension
RV32I
32-bit Field Layout
0000000
00011
00010
000
00001
0110011
310
funct7function code
bits 31..25
rs2source register 2
bits 24..20
rs1source register 1
bits 19..15
funct3function code
bits 14..12
rddestination register
bits 11..7
opcodeopcode
bits 6..0
0000 0000 0011 0001 0000 0000 1011 0011
Field Breakdown
funct7
bits 31..25
0x0
0000000
rs2
bits 24..20
3
00011
rs1
bits 19..15
2
00010
funct3
bits 14..12
0x0
000
rd
bits 11..7
1
00001
opcode
bits 6..0
51
0110011

Built-in Accuracy Checks

These fixed examples cover R/I/S/B/U/J formats and act as regression checks for the decoder's core paths.

0x003100B3
add x1, x2, x3add x1, x2, x3
0x00A10093
addi x1, x2, 0xAaddi x1, x2, 0xA
0x00112423
sw x1, 8(x2)sw x1, 8(x2)
0x00208863
beq x1, x2, 0x10beq x1, x2, 0x10
0x000100B7
lui x1, 0x10lui x1, 0x10
0x020000EF
jal x1, 0x20jal x1, 0x20