Skip to content

Commit

Permalink
updates to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
hngenc committed Nov 26, 2022
1 parent fd92323 commit 6bdf36d
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 164 deletions.
35 changes: 0 additions & 35 deletions .github/scripts/build-toolchains.sh

This file was deleted.

2 changes: 2 additions & 0 deletions .github/scripts/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ LOCAL_ESP_DIR=$HOME/esp-tools-install
LOCAL_CHIPYARD_DIR=$HOME/chipyard
LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verilator
LOCAL_VERILATOR_DIR=$HOME/verilator-install
LOCAL_CONDA=/opt/conda/

echo "::set-output name=LOCAL_WORK_DIR::$LOCAL_WORK_DIR"
echo "::set-output name=LOCAL_CHECKOUT_DIR::$LOCAL_CHECKOUT_DIR"
Expand All @@ -36,3 +37,4 @@ echo "::set-output name=LOCAL_ESP_DIR::$LOCAL_ESP_DIR"
echo "::set-output name=LOCAL_CHIPYARD_DIR::$LOCAL_CHIPYARD_DIR"
echo "::set-output name=LOCAL_SIM_DIR::$LOCAL_SIM_DIR"
echo "::set-output name=LOCAL_VERILATOR_DIR::$LOCAL_VERILATOR_DIR"
echo "::set-output name=LOCAL_CONDA::$LOCAL_CONDA"
31 changes: 19 additions & 12 deletions .github/scripts/do-rtl-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,27 @@ set -ex
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

rm -rf $LOCAL_CHIPYARD_DIR/generators/gemmini/*
cd $LOCAL_CHECKOUT_DIR
git submodule update --init --recursive software/gemmini-rocc-tests
mv -f $LOCAL_CHECKOUT_DIR/* $LOCAL_CHIPYARD_DIR/generators/gemmini/
source $SCRIPT_DIR/enable-conda.sh

cd $LOCAL_CHIPYARD_DIR
source env.sh

TOOLS_DIR=$LOCAL_ESP_DIR
LD_LIB_DIR=$LOCAL_ESP_DIR/lib
cd $LOCAL_CHIPYARD_DIR
echo Printing current chipyard commit
git log -1 --format="%H"

# enter the verilator directory and build the specific config on remote server
cd $LOCAL_CHIPYARD_DIR/generators/gemmini
echo Printing current gemmini commit
git log -1 --format="%H"

cd $LOCAL_CHIPYARD_DIR/generators/rocket-chip
echo Printing rocket-chip commit
git log -1 --format="%H"

echo Printing rocket-chip sources
ls src/main/scala/

cd $LOCAL_SIM_DIR
make -C $LOCAL_SIM_DIR clean
export RISCV=$TOOLS_DIR
export LD_LIBRARY_PATH=$LD_LIB_DIR
export PATH=$LOCAL_VERILATOR_DIR/bin:$PATH
export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR
export COURSIER_CACHE=$LOCAL_WORK_DIR/.coursier-cache
make -j$LOCAL_MAKE_NPROC -C $LOCAL_SIM_DIR VERILATOR_OPT_FLAGS="-O0 -OG" JAVA_OPTS="-Xmx2500M -Xss8M" SBT_OPTS="-Dsbt.ivy.home=$LOCAL_CHIPYARD_DIR/.ivy2 -Dsbt.supershell=false -Dsbt.global.base=$LOCAL_CHIPYARD_DIR/.sbt -Dsbt.boot.directory=$LOCAL_CHIPYARD_DIR/.sbt/boot" CONFIG=GemminiRocketConfig

13 changes: 13 additions & 0 deletions .github/scripts/enable-conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

export PATH="$LOCAL_CONDA/bin:$PATH"
conda init
source ~/.bashrc
conda activate base
if ! { conda env list | grep 'chipyard'; } >/dev/null 2>&1; then
conda create -n chipyard
conda activate chipyard
conda install -c conda-forge conda-lock
fi
conda activate chipyard

42 changes: 42 additions & 0 deletions .github/scripts/install-gemmini.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

#-------------------------------------------------------------
# installs gemmini
#
# run location: circle ci docker image
#-------------------------------------------------------------

# turn echo on and error on earliest command
set -ex

# get shared variables
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

source $SCRIPT_DIR/enable-conda.sh

cd $HOME
rm -rf chipyard
git clone --progress --verbose https://github.com/ucb-bar/chipyard.git chipyard
cd $LOCAL_CHIPYARD_DIR

echo "Checking out Chipyard version: $(cat $LOCAL_CHECKOUT_DIR/CHIPYARD.hash)"
git fetch
git checkout $(cat $LOCAL_CHECKOUT_DIR/CHIPYARD.hash)

./build-setup.sh esp-tools

source env.sh

cd toolchains/esp-tools/riscv-isa-sim/build
echo "Checking out Spike version $(cat $LOCAL_CHECKOUT_DIR/SPIKE.hash)"
git checkout $(cat $LOCAL_CHECKOUT_DIR/SPIKE.hash)
make && make install

cd $LOCAL_CHECKOUT_DIR
chown -R $(whoami) .
git config --global --add safe.directory $LOCAL_CHECKOUT_DIR
git submodule update --init --recursive software/gemmini-rocc-tests
rm -rf $LOCAL_CHIPYARD_DIR/generators/gemmini/* $LOCAL_CHIPYARD_DIR/generators/gemmini/.git*
mv -f $LOCAL_CHECKOUT_DIR/* $LOCAL_CHECKOUT_DIR/.git* $LOCAL_CHIPYARD_DIR/generators/gemmini/

20 changes: 0 additions & 20 deletions .github/scripts/install-verilator.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .github/scripts/prepare-for-rtl-build.sh

This file was deleted.

10 changes: 10 additions & 0 deletions .github/scripts/remove-chipyard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -ex

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

rm -rf $LOCAL_CHIPYARD_DIR
rm -rf $LOCAL_CONDA

6 changes: 3 additions & 3 deletions .github/scripts/run-tests-rtl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ set -ex
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

source $SCRIPT_DIR/enable-conda.sh

TOOLS_DIR=$LOCAL_ESP_DIR
PATH=$PATH:$LOCAL_ESP_DIR/bin
cd $LOCAL_CHIPYARD_DIR
source env.sh

cd $LOCAL_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests
CFLAGS=-DFAST ./build.sh

cd build
make test-baremetal-bareMetalC RUNNER="'make -C $LOCAL_CHIPYARD_DIR/sims/verilator/ CONFIG=GemminiRocketConfig run-binary-hex BINARY='"


24 changes: 13 additions & 11 deletions .github/scripts/run-tests-spike.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@ set -ex
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
source $SCRIPT_DIR/defaults.sh

source $SCRIPT_DIR/enable-conda.sh

# clone and build our version of spike
TOOLS_DIR=$LOCAL_ESP_DIR
PATH=$PATH:$LOCAL_ESP_DIR/bin
cd $LOCAL_CHIPYARD_DIR
source env.sh

git clone https://github.com/ucb-bar/esp-isa-sim.git
cd esp-isa-sim
git checkout $(cat $LOCAL_CHECKOUT_DIR/SPIKE.hash)
cp $LOCAL_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests/include/gemmini_params.h gemmini/
cd $LOCAL_CHIPYARD_DIR/toolchains/esp-tools/riscv-isa-sim
echo Printing current spike commit
git log -1 --format="%H"

mkdir build
cd build
../configure --prefix=$TOOLS_DIR
make -j8 install
cd $LOCAL_CHIPYARD_DIR/generators/gemmini
echo Printing current gemmini commit
git log -1 --format="%H"

cd $LOCAL_CHIPYARD_DIR/generators/gemmini/software/gemmini-rocc-tests
echo Printing current gemmini-rocc-tests commit
git log -1 --format="%H"

./build.sh

cd build
make test-baremetal

Loading

0 comments on commit 6bdf36d

Please sign in to comment.