Skip to content

Commit

Permalink
treewide: Move IIS setup steps to script
Browse files Browse the repository at this point in the history
  • Loading branch information
colluca committed Feb 21, 2024
1 parent d876f78 commit a01a082
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 62 deletions.
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ Bender.lock
.vscode/
__pycache__

// Modelsim Fiels
# Modelsim Files
*.wlf
modelsim.ini
*stacktrace*
transcript

gmon.out

// Docs
# Docs
/site/
/docs/generated/
/docs/generated/

# Installation directories
/.venv/
/tools/
23 changes: 1 addition & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,12 @@ variables:
TERM: ansi
FORCE_COLOR: 1
# Configure environment
PYTHON: /usr/local/anaconda3-2022.05/bin/python3
BENDER: bender-0.27.1
CC: gcc-9.2.0
CXX: g++-9.2.0
VCS_SEPP: vcs-2020.12
VERILATOR_SEPP: verilator-4.110
QUESTA_SEPP: questa-2022.3
LLVM_BINROOT: /usr/pack/riscv-1.0-kgf/pulp-llvm-0.12.0/bin
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: /usr/pack/gcc-9.2.0-af/linux-x64/bin/gcc
LLVM_SYS_120_PREFIX: /usr/pack/llvm-12.0.1-af
CMAKE: cmake-3.18.1

before_script:
- $PYTHON -m venv .venv
- source .venv/bin/activate
# Unpack packages in a local temporary directory which can be safely cleaned
# after installation. Also protects against "No space left on device" errors
# occurring when the /tmp folder is filled by other processes.
- mkdir tmp
- TMPDIR=tmp pip install -r python-requirements.txt
- rm -rf tmp
- $BENDER vendor init
# Install spike-dasm
# yamllint disable rule:line-length
- wget https://github.com/pulp-platform/riscv-isa-sim/releases/download/snitch-v0.1.0/snitch-spike-dasm-0.1.0-x86_64-linux-gnu-almalinux8.7.tar.gz
# yamllint enable rule:line-length
- tar xzf snitch-spike-dasm-0.1.0-x86_64-linux-gnu-almalinux8.7.tar.gz
source iis-setup.sh

##############
# Build docs #
Expand Down
40 changes: 3 additions & 37 deletions docs/ug/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,46 +46,12 @@ The following instructions are extracted from the Docker container [README.md](h

## IIS environment setup

To make sure the right versions of each tool are picked up, set the following environment variables, e.g. in a bash shell:
To make sure the right versions of each tool are picked up on your IIS machine and install additional tools, run:

```bash
export PYTHON="/usr/local/anaconda3-2022.05/bin/python3"
export BENDER="bender-0.27.1"
export CC="gcc-9.2.0"
export CXX="g++-9.2.0"
export LLVM_BINROOT="/usr/pack/riscv-1.0-kgf/pulp-llvm-0.12.0/bin"
# As a temporary workaround (until correct tool versions are installed system-wide):
export PATH=/usr/scratch/dachstein/colluca/opt/verible/bin:$PATH

# Install spike-dasm
cd sw/deps/riscv-isa-sim
autoconf
mkdir build
cd build
../configure
make
export PATH=$(pwd):$PATH
source iis-setup.sh
```

Add these commands to your shell startup file (e.g. `~/.bashrc` if you use bash as the default shell) to ensure that the environment is set up correctly every time you open a new shell.
Have a look inside the script. You will want to add some of the steps contained therein to your shell startup file, e.g. exporting environment variables and activating the Python virtual environment. This way, every time you open a new shell, your environment will be ready for developing on Snitch, and you won't have to repeat the installation steps.

Create a Python virtual environment:

```shell
$PYTHON -m venv ~/.venvs/snitch_cluster
```

Activate your environment, e.g. in a bash shell:

```bash
source ~/.venvs/snitch_cluster/bin/activate
```

You may want to add the last command to your shell startup file to ensure that the virtual environment is activated on every new shell you open.

Install the required packages in the currently active virtual environment:

```shell
pip install -r python-requirements.txt
```
<!--end-section-2-->
33 changes: 33 additions & 0 deletions iis-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

# Define environment variables
export PYTHON=/usr/local/anaconda3-2022.05/bin/python3
export BENDER=bender-0.27.1
export CC=gcc-9.2.0
export CXX=g++-9.2.0
export VCS_SEPP=vcs-2020.12
export VERILATOR_SEPP=verilator-4.110
export QUESTA_SEPP=questa-2022.3
export LLVM_BINROOT=/usr/pack/riscv-1.0-kgf/pulp-llvm-0.12.0/bin

# Create Python virtual environment with required packages
$PYTHON -m venv .venv
source .venv/bin/activate
# Unpack packages in a local temporary directory which can be safely cleaned
# after installation. Also protects against "No space left on device" errors
# occurring when the /tmp folder is filled by other processes.
mkdir tmp
TMPDIR=tmp pip install -r python-requirements.txt
rm -rf tmp

# Bender initialization
$BENDER vendor init

# Install spike-dasm
mkdir tools/
cd tools/
wget https://github.com/pulp-platform/riscv-isa-sim/releases/download/snitch-v0.1.0/snitch-spike-dasm-0.1.0-x86_64-linux-gnu-almalinux8.7.tar.gz
tar xzf snitch-spike-dasm-0.1.0-x86_64-linux-gnu-almalinux8.7.tar.gz
cd -
echo $PATH
export PATH=$(pwd)/tools:$PATH

0 comments on commit a01a082

Please sign in to comment.