Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devincarr/sim
A simple VM created in Rust
https://github.com/devincarr/sim
Last synced: about 2 months ago
JSON representation
A simple VM created in Rust
- Host: GitHub
- URL: https://github.com/devincarr/sim
- Owner: DevinCarr
- Created: 2015-06-23T21:33:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-04T04:30:39.000Z (over 8 years ago)
- Last Synced: 2023-08-01T08:28:41.886Z (over 1 year ago)
- Language: Rust
- Size: 4.88 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Sim
=======
A very simple virtual machine based on [this](https://blog.felixangell.com/virtual-machine-in-c/), but written in rust instead. This also acts as a beginner project in rust.## Current ISA
Instruction | Machine code | Description
-----------------|---------------|------------
halt | 0 | Halt the program
pushi `$im` | 1,`i32` | Push the immediate (`$im`) onto the stack
pushr `$im` | 2,`i32` | Push a register (location `$im`) onto the stack
pop | 3 | Pop the top of the stack
add `src`,`dest` | 4,`i32`,`i32` | Add the `src` and `dest` registers and put back into `dest`
movi `$im`,`dest`| 5,`i32`,`i32` | Move the `$im` into the register at `dest`
movr `src`,`dest`| 6,`i32`,`i32` | Move the value from `src` to `dest`
log | 7 | Print out the current stack#### Memory:
Stack size: `16`Registers:
Register | Value
---------|-------
eax | 0
ebx | 1
ecx | 2
edx | 3# Running
*See prog.si for example format*
`$ sim < prog.si`