Input your RISC-V code here:


The most recent instructions will be shown here when stepping.

Features

  • Reset to load the code, Step one instruction, or Run all instructions
  • Set a breakpoint by clicking on the line number (only for Run)
  • View registers on the right, memory on the bottom of this page

Download

Memory


Memory Address Decimal Hex Binary
0x0000000000x000000000b00000000000000000000000000000000
0x0000000400x000000000b00000000000000000000000000000000
0x0000000800x000000000b00000000000000000000000000000000
0x0000000c00x000000000b00000000000000000000000000000000
0x0000001000x000000000b00000000000000000000000000000000
0x0000001400x000000000b00000000000000000000000000000000
0x0000001800x000000000b00000000000000000000000000000000
0x0000001c00x000000000b00000000000000000000000000000000
0x0000002000x000000000b00000000000000000000000000000000
0x0000002400x000000000b00000000000000000000000000000000

Registers

Init Value Register Decimal Hex Binary
0x0 (zero)00x000000000b00000000000000000000000000000000
x1 (ra)00x000000000b00000000000000000000000000000000
x2 (sp)00x000000000b00000000000000000000000000000000
x3 (gp)00x000000000b00000000000000000000000000000000
x4 (tp)00x000000000b00000000000000000000000000000000
x5 (t0)00x000000000b00000000000000000000000000000000
x6 (t1)00x000000000b00000000000000000000000000000000
x7 (t2)00x000000000b00000000000000000000000000000000
x8 (s0/fp)00x000000000b00000000000000000000000000000000
x9 (s1)00x000000000b00000000000000000000000000000000
x10 (a0)00x000000000b00000000000000000000000000000000
x11 (a1)00x000000000b00000000000000000000000000000000
x12 (a2)00x000000000b00000000000000000000000000000000
x13 (a3)00x000000000b00000000000000000000000000000000
x14 (a4)00x000000000b00000000000000000000000000000000
x15 (a5)00x000000000b00000000000000000000000000000000
x16 (a6)00x000000000b00000000000000000000000000000000
x17 (a7)00x000000000b00000000000000000000000000000000
x18 (s2)00x000000000b00000000000000000000000000000000
x19 (s3)00x000000000b00000000000000000000000000000000
x20 (s4)00x000000000b00000000000000000000000000000000
x21 (s5)00x000000000b00000000000000000000000000000000
x22 (s6)00x000000000b00000000000000000000000000000000
x23 (s7)00x000000000b00000000000000000000000000000000
x24 (s8)00x000000000b00000000000000000000000000000000
x25 (s9)00x000000000b00000000000000000000000000000000
x26 (s10)00x000000000b00000000000000000000000000000000
x27 (s11)00x000000000b00000000000000000000000000000000
x28 (t3)00x000000000b00000000000000000000000000000000
x29 (t4)00x000000000b00000000000000000000000000000000
x30 (t5)00x000000000b00000000000000000000000000000000
x31 (t6)00x000000000b00000000000000000000000000000000

Supported Instructions

SIMULATOR ISA HEIRV32 ISA
Instr Type Instr Struct Operation Function Type
Arithmeticsaddadd rd, rs1, rs2rd = rs1 + rs2AdditionR-Type
Arithmeticsaddiaddi rd, rs1, immrd = rs1 + SignExt(imm)Addition ImmediateI-Type
Arithmeticssubsub rd, rs1, rs2rd = rs1 - rs2SubstractionR-Type
Logicalandand rd, rs1, rs2rd = rs1 & rs2ANDR-Type
Logicalandiandi rd, rs1, immrd = rs1 & SignExt(imm)AND ImmediateR-Type
Logicaloror rd, rs1, rs2rd = rs1 | rs2ORR-Type
Logicaloriori rd, rs1, immrd = rs1 | SignExt(imm)OR ImmediateI-Type
Logicalxorxor rd, rs1, rs2rd = rs1 ^ rs2XORR-Type
Logicalxorixori rd, rs1, immrd = rs1 ^ SignExt(imm)XOR ImmediateI-Type
Setssltslt rd, rs1, rs2rd = (rs1 < rs2) ? 1:0Set If Less ThenR-Type
Setssltislti rd, rs1, immrd = (rs1 < SignExt(imm)) ? 1:0Set If Less Then ImmediateI-Type
Setssltusltu rd, rs1, rs2rd = (rs1 < rs2) ? 1:0Set If Less Then UnsignedR-Type
Setssltiusltiu rd, rs1, immrd = (rs1 < SignExt(imm)) ? 1:0Set If Less Then Immediate UnsignedI-Type
Shiftssrasra rd, rs1, rs2rd = rs1 >>> rs2Shift Right ArithmeticR-Type
Shiftssraisrai rd, rs1, immrd = rs1 >>> uimmShift Right Arithmetic ImmediateI-Type
Shiftssrlsrl rd, rs1, rs2rd = rs1 >> rs2Shift Right LogicalR-Type
Shiftssrlisrli rd, rs1, immrd = rs1 >> uimmShift Right Logical ImmediateI-Type
Shiftssllsll rd, rs1, rs2rd = rs1 << rs2[4:0]Shift Left LogicalR-Type
Shiftssllislli rd, rs1, immrd = rs1 << uimmShift Left Logical ImmediateI-Type
Memorylwlw rd, imm(rs1)rd = Memory[(rs1 + imm)[31:0]]Load WordI-Type
Memoryswsw rs2, imm(rs1)Memory[(rs1 + imm)[31:0]] = rs2Store WordS-Type
Memorylblb rd, imm(rs1)rd = Memory[SignExt(rs1 + imm)][7:0]Load ByteI-Type
Memorylbulb rd, imm(rs1)rd = Memory[rs1 + imm][7:0]Load Byte (unsigned)I-Type
Memorylhlh rd, imm(rs1)rd = Memory[SignExt(rs1 + imm)][15:0]Load LWordI-Type
Memorylhulhu rd, imm(rs1)rd = Memory[(rs1 + imm)][15:0]Load LWord (unsigned)I-Type
Memorysbsb rs2, imm(rs1)Memory[(rs1 + imm)][15:0] = rs2[15:0]Store ByteS-Type
PCluilui rd, immrd = [upimm,0x000]Load Upper ImmediateU-Type
PCauipcauipc rd, immrd = [upimm, 0x000] + PCAdd Upper Immediate to PCU-Type
Jumpsjaljal rd, labelPC = label, rd = x0 = ra = PC + 4Jump And Link, imm is shifted << 1J-Type
Jumpsjalrjalr rd, rs1, immPC = rs1 + SignExt(imm), rd = PC + 4Jump And Link RegisterI-Type
Branchesbeqbeq rs1, rs2, labelif(rs1 == rs2) PC = labelBranch If EqualB-Type
Branchesbnebne rs1, rs2, labelif(rs1 != rs2) PC = labelBranch if Not EqualB-Type
Branchesbltblt rs1, rs2, labelif(rs1 < rs2) PC = labelBranch If Less ThenB-Type
Branchesbgebge rs1, rs2, labelif(rs1 >= rs2) PC = labelBranch If Greater Than Or EqualB-Type
Branchesbltubltu rs1, rs2, labelif(rs1 < rs2) PC = labelBranch If Less Then UnsignedB-Type
Branchesbgeubgeu rs1, rs2, labelif(rs1 >= rs2) PC = labelBranch If Greater Then Or Equal UnsignedB-Type

Supported Registers

Register ABI Name Description/th> Saver
x0zeroHard-wired zero-
x1raReturn AddressCaller
x2spStack PointerCallee
x3gpGlobal Pointer-
x4tpThread Pointer-
x5t0Temporary / alternate link registerCaller
x6-x7t1-t2TemporariesCaller
x8s0/fpSaved RegisterCallee
x9s1Saved registerCallee
x10-x11a0-a1Function arguments/return valuesCaller
x12-x17a2-a7Function argumentsCaller
x18-x27s2-s11Saved RegistersCallee
x28-x31t3-t6TemporariesCaller

RISC-V Reference: riscv-spec-v2.2.pdf

Credit to Danny Qiu for the creation of the original MIPS interpreter and to the Cornell University with it's course "CS340 - Computer System Organization and Programming" for the adaptation to RISC-V.