[HN Gopher] Writing a Tiny RISC-V Emulator [video]
       ___________________________________________________________________
        
       Writing a Tiny RISC-V Emulator [video]
        
       Author : f1shy
       Score  : 34 points
       Date   : 2023-01-05 17:32 UTC (5 hours ago)
        
 (HTM) web link (www.youtube.com)
 (TXT) w3m dump (www.youtube.com)
        
       | 1vuio0pswjnm7 wrote:
       | At 4:22, he says watching buildroot run "it really feels like you
       | are gaining a couple of IQ every single time."
       | 
       | LOL.
       | 
       | Over many years I spent too much time staring at NetBSD kernels
       | and other binaries building under build.sh. I think I am
       | generally dumber as a result.
       | 
       | Perhaps one becomes a little more knowledgeable about UNIX but
       | certainly not more knowledgeable about _life_. There is something
       | relaxing about watching UNIX compile though.
       | 
       | I can relate to his complaint about bulding python and cmake. I
       | just compiled cmake yesterday. Wow it is slow. I could build
       | multiple BSD kernels in the time it takes to compile cmake.
       | 
       | At the end, he makes a comment about how the boot console is
       | really fast but once it is disabled the system is much slower. He
       | wants to stay in the boot console but does not know how. This is
       | easy on NetBSD. Even though terminal emulators for X11 can be
       | really fast and allow for cut and paste, I prefer VGA textmode.
       | 
       | Here is another tiny emulator with a RISC-V buildroot port. I
       | like this one because it works with musl.
       | 
       | https://www.bellard.org/tinyemu/
       | 
       | https://www.bellard.org/tinyemu/buildroot.html
        
       | fwsgonzo wrote:
       | I definitely recommend people to consider the base ISA of RISC-V
       | if they want to try to implement a CPU or even full-system
       | emulation.
       | 
       | I understand that implementing a GameBoy emulator might be more
       | attractive because you are working towards something graphical
       | that you can eventually play, and that's what I did first. It was
       | a fun project! You can also get something similar with RISC-V,
       | eg. Doom (SDL example:
       | https://github.com/fwsGonzo/libriscv/tree/master/examples/do...)
       | 
       | The road to fully working DOOM will probably be shorter because
       | you will only have to implement RV32I and then an ELF loader. The
       | rest is handled through SDL2 outside of the emulator, and I/O is
       | handled through system calls from Doom running as a guest inside
       | it. Note that DOOM does not support 64-bit.
       | 
       | Otherwise, if you want to start out with emulating something
       | smaller or something from your childhood check out r/emudev on
       | reddit. A very helpful and nice community there.
        
         | HideousKojima wrote:
         | CHIP-8 is another easy target for beginners. You're
         | _technically_ implementing an interpreter rather than writing
         | an emulator, but 99% of the principles are the same.
        
       | sylware wrote:
       | Mister ffmpeg/tinycc/qemu/(much more) did just that:
       | https://bellard.org
        
       ___________________________________________________________________
       (page generated 2023-01-05 23:01 UTC)