For anyone else curious: custom FPGA-based CPU code but not a custom architecture. This is an RV32I core. The article takes along time to give up this fact.
Deciding on an ISA like RV32I only sets constraints on your architecture, it doesn't give you any of it for free. So I think it's entirely valid to say that it's a custom architecture if they didn't use any pre-existing CPU design. Basically, they had the API interface and implemented everything behind it. I think saying that "it's an RV32I core" vastly underrates the design work that goes into actually implementing…
Running Doom on Our Custom CPU and Going Viral
11–20 of 41 posts
Re: Running Doom on Our Custom CPU and Going Viral
#12For anyone else curious: custom FPGA-based CPU code but not a custom architecture. This is an RV32I core. The article takes along time to give up this fact.
Re: Running Doom on Our Custom CPU and Going Viral
#13Great work! This reminded me of a project I built a while back: a RV32IM emulator in C++ that can boot and run DOOM. Initially I implemented only RV32I, and implementing the M extension provided a massive speedup! If anyone's curious, here's the source code: https://github.com/lalitshankarch/rvcore
Nice one! Sounds like a fun project to do. Did you follow any tutorial or guide for this? If so, I would appreciate it if you shared it.
I made a post a while back that details the entire process: https://www.reddit.com/r/EmuDev/comments/1t1or4j/doom_runs_o...
Re: Running Doom on Our Custom CPU and Going Viral
#14Earlier quoted context omitted.
Deciding on an ISA like RV32I only sets constraints on your architecture, it doesn't give you any of it for free. So I think it's entirely valid to say that it's a custom architecture if they didn't use any pre-existing CPU design. Basically, they had the API interface and implemented everything behind it. I think saying that "it's an RV32I core" vastly underrates the design work that goes into actually implementing…
It's a custom implementation of an existing architecture
Re: Running Doom on Our Custom CPU and Going Viral
#15Re: Running Doom on Our Custom CPU and Going Viral
#16Re: Running Doom on Our Custom CPU and Going Viral
#17Great work! This reminded me of a project I built a while back: a RV32IM emulator in C++ that can boot and run DOOM. Initially I implemented only RV32I, and implementing the M extension provided a massive speedup! If anyone's curious, here's the source code: https://github.com/lalitshankarch/rvcore
Nice one! Sounds like a fun project to do. Did you follow any tutorial or guide for this? If so, I would appreciate it if you shared it.
Then, wire your simulator to https://github.com/riscv-software-src/riscv-tests, and there you have an official test suite. When everything passes, you have a fully-compliant RISC-V CPU. You can at this point tell GCC or Rust or your favourite language to compile to RV32IM and see it run on your simulator. It's a very gratifying process.
If you get at this stage, you might want to use the ecall instruction to hard-code I/O operations such as "read from stdin" or "print a character", and there you have a sandboxed CPU that you can target with your favourite programming language. Make it run DOOM (start with https://github.com/ozkl/doomgeneric and see which I/O do you need), or turn it into a toy game console; the sky's the limit.
---
Here's a copy-paste of the list of resources I have saved in my notes:
- https://github.com/libriscv/libriscv A very fast RISC-V VM with sandboxing of memory and syscalls.
- https://luplab.gitlab.io/rvcodecjs/ RISC-V Instruction Encoder/Decoder
- https://www.cs.sfu.ca/~ashriram/Courses/CS295/assets/noteboo... Reference card
- https://cs.brown.edu/courses/csci1952y/2024/assets/docs/risc... Spec
- https://riscv-software-src.github.io/riscv-unified-db/manual...
- ABI: https://lists.riscv.org/g/tech-psabi/attachment/61/0/riscv-a...
Good luck!
Re: Running Doom on Our Custom CPU and Going Viral
#18Earlier quoted context omitted.
Deciding on an ISA like RV32I only sets constraints on your architecture, it doesn't give you any of it for free. So I think it's entirely valid to say that it's a custom architecture if they didn't use any pre-existing CPU design. Basically, they had the API interface and implemented everything behind it. I think saying that "it's an RV32I core" vastly underrates the design work that goes into actually implementing…
It's a custom implementation of an existing architecture
Re: Running Doom on Our Custom CPU and Going Viral
#19Re: Running Doom on Our Custom CPU and Going Viral
#20Reading "Custom CPU" I expected wafer.space, instead of FPGA.