离线模式
漫林
今日觉察
Free tools

Free RISC-V Simulator

Type RV32IM assembly with labels and pseudo-instructions, then run it at full speed or one instruction at a time. Set breakpoints, step back, and watch registers, memory, the machine code and the console as the program runs.

Open RISC-V Simulator →

How to run RISC-V assembly online

Write or open a program

Start from an example, type your own assembly or open a .s file. Put data under .data and code under .text.

Run or step

Press Run to go at full speed, or Step to run one instruction and see which registers and memory changed. Click beside a line number to set a breakpoint.

Read the results

Output and input happen in the console. Check registers and memory, step back to find where things went wrong, and copy the machine code as hex.

Tips for debugging assembly

Step back instead of restarting

Went one step too far? Step back undoes the last instructions, registers, memory and output included, so you can look again without running from the start.

Save ra before you call

call overwrites ra. A function that calls another must save ra on the stack first and restore it before ret, as in the factorial example.

Watch the Runs column

The machine code tab counts how often each instruction ran. A loop body that ran once too often or never ran points straight at a wrong branch.

Manlin services

Make space for what matters

Use Manlin to reflect, plan and take your next step.

Manlin Life OS: a path from awareness to action

RISC-V simulator FAQ

Is this RISC-V simulator free?

Yes. This online RISC-V simulator is free, with no account, no limits on runs and nothing to install.

Which instructions does it support?

The 32-bit base integer set (RV32I), the M extension for multiply, divide and remainder, and reads of the cycle, time and instret counters — the core instruction set taught in computer architecture and assembly courses.

Will programs from my course run here?

Most will. Code starts at 0x00400000 and data at 0x10010000, and the system calls use the same numbers (a7 = 1 print integer, 4 print string, 5 read integer, 10 exit and so on) as the common teaching simulators. The Reference tab lists them all.

How do I print and read input?

Put the call number in a7 and the argument in a0, then run ecall. When the program reads, the console asks for input: type it and press Enter. You can also type ahead before the program asks.

How are cycles counted?

The instruction count is exact. The cycle count is an estimate for a simple in-order core: 1 cycle per instruction, 2 per load, 3 per jump or taken branch, 3 per multiply and 33 per divide.

Can I get the machine code?

Yes. The Machine code tab shows every instruction's address, hex word and decoded form. Copy it as hex, one word per line, or download a .hex or raw .bin file.

Why does my program stop with a misaligned access?

Words must be read and written at addresses that are a multiple of 4, and halfwords at a multiple of 2. Put .align 2 before word data, or check the address you computed. The error names the address and the line.

Can I step backwards?

Yes. Step back undoes up to the last 4,096 instructions, registers, memory and output included, so you can find a bug without running from the start.

Is my code uploaded?

No. Assembling and running happen in your browser, and your program is saved in this browser's storage so it is still here next time.

More tools in this category

View all free tools →