3 ms·
The Readme doesn't answer it but I struggle to see why you want a c implementation of an ISA.
by rowanG077 3y ago
The Readme doesn't answer it but I struggle to see why you want a c implementation of an ISA.
- nly 3y agoSo you can compile and run it on any platform with a C compiler
- rowanG077 3y agoThat is just something you can do with C code. That is not a goal in itself. Why would you want to run a C ISA instead of just using a standard simulator? Why not use verilator + any of the open source RISC-V cores?
- LoganDark 3y agoBecause those are slower, more complex, and more difficult to understand?
- rowanG077 3y agoI doubt verilator is much slower. The speed of it is insane. They are indeed more complex and difficult to understand. But I fail to see how that is a criterium. I would very much rather include an industry standard library in comparison to something homegrown.
- LoganDark 3y ago> They are indeed more complex and difficult to understand. But I fail to see how that is a criterium. It's... not? Like, if you want to merely use an ISA, you don't need it to be simple or easy to understand, in fact tons of people pride themselves on making extremely high-performance RISC-V cores with OoOE and so on. But the reason why someone might want a C implementation of an ISA is different from the reason people might want to go implement an ISA in a real project: maybe they want a software simulator that is easy to understand for one reason or another, perhaps for learning or demonstration purposes, or just as a fun hobby project. These people wouldn't benefit from just pulling down Verilator or using one of the existing BATTLE-TESTED INDUSTRY-STANDARD PROFESSIONALLY-AUDITED HIGH-PERFORMANCE implementations because they literally don't care about any of those things. In any case, it's a fallacy to assume that every programming project out there has to address a need in order to have a place. https://justforfunnoreally.dev https://justforfunnoreally.dev
- rowanG077 3y agoYes a hobby/learning is a great reason, why not just start with that? I was simply wondering what the reason was. Maybe the author had an interesting need for a C implementation to do something. Me asking for the reason is not me saying it doesn't deserve to exist. I don't think you are arguing in good faith here.
- LoganDark 3y ago> why not just start with that? I'm not the one who started the thread. > I don't think you are arguing in good faith here. With that, this discussion is over.
- srgpqt 3y agoPerhaps this could be used to run sandboxed code. Game engines could safely run mods using something like this, ala QuakeC.
- mcraiha 3y agoFor modern game engine you most likely want WebAssembly support. e.g. Flight Simulator does that https://flightsimulator.zendesk.com/hc/en-us/articles/7662900486940-WASM-Support-FAQ https://flightsimulator.zendesk.com/hc/en-us/articles/766290...
- mnurzia 3y agoDefinitely. My motivation for writing this was to have a simple CPU for a virtual game console-like project. I decided to release it on its own, though.
- Farmadupe 3y agoConsidering it's allocation-free, maybe it's an ultralight/ simulator for checking large quantities of compiler output? (i.e no VM to create and destroy for every testcase) Or the same but for testing some verilog/vhdl CPU implemetation in a simulator? Or since it's only 500SLOC, maybe it's just for fun!
- detrites 3y agoNot sure if this was intended, but coming to this as someone vaguely aware of RISC-V, it's looking like a fantastic form of documentation for the ISA, that both describes and gives a way to play with it, but in an intuitive, even fun manner. Obviously this works best for someone who already knows C - but, given it's C89 mitigates against this aspect somewhat.
- rowanG077 3y agoA reference implementation would be in Verilog or VHDL.