====== Spike ====== Spike is the canonical RISC-V ISA simulator. It supports several ISA extensions, including some that are not yet ratified. See the [[https://github.com/riscv/riscv-isa-sim|README]] on %%GitHub%% for more information. It is available from ports as [[http://www.freshports.org/emulators/riscv-isa-sim|emulators/riscv-isa-sim]]. ==== Building From Source ==== setenv PREFIX $HOME/riscv git clone https://github.com/freebsd-riscv/riscv-isa-sim cd riscv-isa-sim mkdir build && cd build setenv CPPFLAGS -DRISCV_ENABLE_DIRTY=1 ../configure --prefix=$PREFIX gmake install ==== Build a small rootfs for Spike to be used as mdroot (memory disk) ==== Spike has no network or disk controller, so the only way to get a root filesystem is to embed one in the kernel. Build a memory disk with a basic set of files: fetch https://raw.githubusercontent.com/bukinr/riscv-tools/master/image/basic.files tools/tools/makeroot/makeroot.sh -s 32m -f basic.files mdroot.img $DESTDIR Add the following to your kernel config to include the memory disk: options MD_ROOT options MD_ROOT_SIZE=32768 # 32MB ram disk makeoptions MFS_IMAGE=/path/to/mdroot.img options ROOTDEVNAME=\"ufs:/dev/md0\" ==== Run Spike ==== spike -m2048 -p2 /path/to/bbl