Working on a new project, was wondering if rust is good for this :]

heya, this summer i want to make a relatively straightforward, peaty complicated project - i want to write a digital simulated cpu, that runs my own custom os that runs conway's game of life and later on a game of my own :] (hopefully) i was talking to some ppl and a couple suggested using rust rather c or c++

so do you think rust is good for this? yes i would prefer writing all 3 in one Lang but it is not necessary

some more info on the project

CPU/REAL HARDWARE

i havent decided on what cpu to make yet, there's allot of them and i might make one of my own. but i should provide my real specs so that you have more info (if you wanted to say something abt hardware acs or what cpu to make)

  • 2core i3-8145U @ 2.10GHz base ~3.95GHz max
  • intel 620 graphics
  • 8g 2400 ram

(yes its a laptop)

OS

it wont have a gui, it will just be a terminal with mostly only the necessary commands and maybe a couple built in jokes

GAME

it will just be conway's game of life, if this works out really well than im might make that game i always wanted to and try and drive it, although i suspect ill need to make a custom cpu and a reasonably good one at that.

HARDWARE ACS/BOOTLOADER

these are the two i know the least about. i have no clue how to write it, or what to use. but to be fair this is by far the ones ive done the least research into

so any ideas? should i use rust?

Yes, Rust is suitable for this. There's a bunch of emulators written in Rust. There's a whole OS, so it can definitely do that.

1 Like

I once wrote simulations of 8 bit Intel 8080 and ZiLog Z80 processors that run on the 32 bit Propeller micro-controller from Parallax Inc. I wrote it all an assembler. What I found was that I could emulate the entire 8080 in the 512 instruction space of a Propeller CPU (it has 8 CPU's in a chip). That was important because keeping all the code inside a CPU achieved maximum speed. However the Z80 instruction set adds a lot of instructions to the base 8080 set. That meant the code was too big to fit in the CPU's fast memory space and had to be swapped in and out from shared RAM, which slowed things down a lot.

Anyway, my limited experience of writing an emulator makes me suggest you emulate a nice simple processor rather than the massively complex instruction set of the Intel architecture. That likely would not just be a much simpler task but also likely perform better.

One such simple processor architecture is the RISC V: https://riscv.org/

Not only is that a simple instruction set to emulate the RISC-V is supported by the Rust compiler. So one can write the emulation in Rust and then get the emulator to run your software written in Rust.

2 Likes

thanks for all that! sorry to get back so late, i had some things going on. like you said im not planing on a big chip, 16 bits or even 8. just enough to have some commands and run cgl.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.