Simple-V Spike emulator

1. Set RISCV and PATH variables

RISCV will be the location where riscv-tools will place all created executables into when building. RISCV must also be appended to the PATH to allow the usage of the created executables without specifying RISCV.

example dev script (riscvdev.sh):

  export RISCV="$HOME/src/riscv"
  export PATH="$PATH:$RISCV/bin"

2. Install riscv-tools: https://github.com/riscv/riscv-tools

riscv-tools is needed to perform a variety of actions such as: compiling a program to work with a spike simulator, simulate the kernel running on spike, and more!

  1. Clone the riscv-tools repository

    • git clone https://github.com/riscv/riscv-tools
  2. Follow the instructions found in the README.md

    • Note: Be sure to be inside the riscv-tools directory when executing the instructions found there
  3. Run the riscv-tests within riscv-tools to verify installation

    • Navigate to riscv-tests/isa inside riscv-tools and execute the following:
        * make
        * make run
      

When the tests a stream of text will be output to the terminal, however, this is normal. Both commands must complete without error and errors will stop the execution of either command.

3. Clone and check out Simple-V versions of riscv-isa-sim:

These are repositories used by libre and contains an augmented version of the spike simulator . Do not clone these inside riscv-tools!

  1. Clone the Simple-V version of riscv-isa-sim

    • git clone https://git.libre-riscv.org/git/riscv-isa-sim.git
  2. Checkout the correct branch

    • cd risc-v-isa-sim
    • git branch sv origin/sv
    • git checkout sv

4. Clone and check out Simple-V versions riscv-tests:

These are repositories used by libre and contains an augmented versions of the tests found in riscv-tools. Do not clone these inside riscv-tools!

  1. Clone the Simple-V version of riscv-tests

    • git clone https://git.libre-riscv.org/git/riscv-tests.git
  2. Checkout the correct branch

    • cd riscv-tests
    • git branch sv origin/sv
    • git checkout sv

make install needed on the simulator for the tests to pick it up... In progress..

To run the sv unit tests (requires $RISCV to be set correctly i think, or at least riscv32/64-unknown-elf-gcc to be in the path)

  • $ cd riscv-tests
  • $ cd isa
  • $ make
  • $ make run

To override the fact that spike loads libspike_main.so and other dynamic libraries from /usr/local/lib (or other location in the path):

$ export LD_LIBRARY_PATH=`pwd`
$ ./spike pk ./a.out