To build the application, you must have installed the following:
- Rust
- Verilator and/or Icarus Verilog (I recommend Verilator, as it is much faster)
- Bash (to use the provided scripts, otherwise you will need to run the commands / write scripts manually for your shell)
Warning
For Windows, I highly recommend to use WSL, as this project was built and verified for Linux first. You may have problems trying to run it on bare Windows.
Included in the repo is a script to build everything.
To build, simply run from the project directory:
$ ./scripts/build_all.shIncluded in the repo is a script to assemble and run a program.
To run the included hello_world program, simply run from the project directory:
$ ./scripts/run.sh verilator programs/hello_world.asmor, using Icarus Verilog:
$ ./scripts/run.sh iverilog programs/hello_world.asmUsually it's fine to just use the run.sh script, which will assemble and run the application all in one, but you may want to only assemble a program.
Included in the repo is a script to assemble a program.
To assemble the included hello_world program, simply run from the project directory:
$ ./scripts/assmeble.sh programs/hello_world.asmNote
By default, the assembler will print the machine code to stdout. You can optionally write the output to a file using redirection or using the -o <OUTPUT> option. For a full list of options the assembler supports, use the -h option.
The simulator allows you to run a program by passing in the machine code for that program.
Included in the repo is a script to run the simulator.
To simulate a program hello_world (which contains the machine code of hello_world.asm), simply run from the project directory:
$ ./scripts/simulate.sh verilator +src=hello_worldor, using Icarus Verilog:
$ ./scripts/simulate.sh iverilog +src=hello_worldNote
The scripts will simply delegate all inputs after the first to the simulator. Therefore, all Verilator or Icarus Verilog options can also be passed through this script.
x86_64 Linux binaries can found in the releases page. These binaries will not work with the scripts.