ScratchStats LogoScratchStats

ScratchStats

Explore Scratch statistics and discover trending projects and creators.

Community

  • Apply for Verified
  • Apply for Reviewer

More

  • Donate
Not affiliated with Scratch.
Back to Jordydmills's profile

RISC-V emulator

JOJordydmills•Created October 16, 2025
2
1
5 views
View on Scratch
View on TurboWarp

Instructions

Press space to input a command into the instruction set. once your done writing your script press the up arrow key to run it. If you wanna show all the lists and stuff do left up right and to hide right up left. I'm working on making programs so u can press down arrow for user input which stores the key that's pressed in ram address 63. To save your programs and load them, click see inside, right click ROM, click export, and for loading them click import. -------------------------commands----------------------------------------li r1 5 (puts the number 5 into register 1) add r1 r2 r3 (adds register 2 and 3 and outputs into register 1) addi r1 r2 5 (adds register 1 and adds the number 5 and outputs into register 1) neg r1 r2 (takes the value in register 2 and makes it negative and outputs into register 1) sub r1 r2 r3 (subtracts the values in register 2 and 3 and outputs into register 1) mul r1 r2 r3 (multiples register 2 and 3 and outputs into register 1) div r1 r2 r3 (divides register 2 and 3 and outputs into register 1) rem r1 r2 r3 (finds the remainder of register 2 and 3 and outputs into register 1) sll r1 r2 (does to the power of with exponent being r2 and base number being r1 and puts output into r1) slli r1 5 (same thing as sll but the exponent is the 5) srl r1 r2 (same as sll but shifts right by r2) srli r1 2 (same is srl but shifts by the 2) sra r1 r2 (same is srl but keeps the type (negative or positive) the same) srai r1 5 (same is sra but changes by the 5) lw r3 r1 (takes the value from ram address value in r1 and puts it in r3) sw r4 r3 (lw but the opposite) vw v4 t4 (takes SMth from ram addr 4 puts into vram addr 4 jmp 5 (change instruction counter by 5) beq r1 r2 5 (if r1=r2 change instruction counter by 5) beqz r1 5 (if r1=0 change instruction counter by 5) bne r1 r2 5 (if not r1=r2 change instruction counter by 5) bnez r1 5 (if r1 not 0 change instruction counter by 5) blt r1 r2 5 (if r1 < r2 change instruction counter by 5) bltz r1 5 (if r1 < 0 change instruction counter by 5) bgt r1 r2 5 (if r1 > r2 change instruction counter by 5) bgtz r1 5 ( if r1 > 0 change instruction counter by 5) ble r1 r2 5 (if r1= r2 or r1<r2 change instruction counter by 5) blez r1 5. (if r1 < 0 or r1=0 change instruction counter by 5) bge r1 r2 5 (if r1> r2 change instruction counter by 5) bgez r1 5 (if r1 > 0 or r1=0 change instruction counter by 5) ------------------------------------------------------------------------------ If you want to put something in the console then put your thing in ram address 64. inputs go into ram address 63. with the VRAM, item 1 is the top left pixel and then VRAM item 2 is the one to the right of it and so on. The pixel screen is 4096 pixels in total (64x64). Keep in mind this is like real RISC V so you can add directly to RAM it has to go to registers and then transfer to ram. With VRAM you can only transfer from ram to VRAM, not register to VRAM.

Notes & Credits

I would really like someone to try to make a bios, bootloader, and OS in this. I have some custom commands for the display NOTE: ram addresses 1-4 cant be used because they are used for decoding instructions. same with 64 being used for console, same with 63 for user input. Risc-V is a type of CPU with about 50 commands, I am coding the 32 bit version of Risc-V. this emulator has about 8 kilobytes of ram and 32 registers. It also has 128 kilobytes of VRAM.

Project Details

Project ID1229785191
CreatedOctober 16, 2025
Last ModifiedMay 26, 2026
SharedOctober 17, 2025
CommentsAllowed