Move Chipyard CI to Github Actions
- As similar as possible to the circle ci code. - The `.github/README.md` file has a fair amount of documentation for this. - Creates a worfklow file - re-uses most of the circleci/scipts unchanged - defines a number of *Composite Actions* which are like YML subroutines - Removes the circle-ci code - Points the CI badge in the top level README to use the GA test result
This commit is contained in:
@@ -1,75 +0,0 @@
|
|||||||
Chipyard CI
|
|
||||||
===========
|
|
||||||
|
|
||||||
Website: https://circleci.com/gh/ucb-bar/chipyard
|
|
||||||
|
|
||||||
CircleCI Brief Explanation
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
CircleCI is controlled by the `config.yml` script.
|
|
||||||
It consists of a *workflow* which has a series of *jobs* within it that do particular tasks.
|
|
||||||
All jobs in the workflow must pass for the CI run to be successful.
|
|
||||||
|
|
||||||
At the bottom of the `config.yml` there is a `workflows:` section that specifies the order in which the jobs of the workflow should run.
|
|
||||||
For example:
|
|
||||||
|
|
||||||
- prepare-rocketchip:
|
|
||||||
requires:
|
|
||||||
- install-riscv-toolchain
|
|
||||||
|
|
||||||
This specifies that the `prepare-rocketchip` job needs the `install-riscv-toolchain` steps to run before it can run.
|
|
||||||
|
|
||||||
All jobs in the CI workflow are specified at the top of `config.yml`
|
|
||||||
They specify a docker image to use (in this case a riscv-boom image since that is already available and works nicely) and an environment.
|
|
||||||
Finally, in the `steps:` section, the steps are run sequentially and state persists throughout a job.
|
|
||||||
So when you run something like `checkout` the next step has the checked out code.
|
|
||||||
Caching in the job is done by giving a file to cache on.
|
|
||||||
`restore_cache:` loads the cache into the environment if the key matches while `save_cache:` writes to the cache with the key IF IT IS NOT PRESENT.
|
|
||||||
Note, if the cache is already present for that key, the write to it is ignored.
|
|
||||||
Here the key is built from a string where the `checksum` portion converts the file given into a hash.
|
|
||||||
|
|
||||||
.circleci directory
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
This directory contains all the collateral for the Chipyard CI to work.
|
|
||||||
The following is included:
|
|
||||||
|
|
||||||
`build-toolchains.sh` # build either riscv-tools or esp-tools
|
|
||||||
`create-hash.sh` # create hashes of riscv-tools/esp-tools so circleci caching can work
|
|
||||||
`do-rtl-build.sh` # use verilator to build a sim executable (remotely)
|
|
||||||
`config.yml` # main circleci config script to enumerate jobs/workflows
|
|
||||||
`defaults.sh` # default variables used
|
|
||||||
`check-commit.sh` # check that submodule commits are valid
|
|
||||||
`build-extra-tests.sh` # build default chipyard tests located in tests/
|
|
||||||
`clean-old-files.sh` # clean up build server files
|
|
||||||
`do-fpga-rtl-build.sh` # similar to `do-rtl-build` but using fpga/
|
|
||||||
`install-verilator.sh` # install verilator on build server
|
|
||||||
`run-firesim-scala-tests.sh` # run firesim scala tests
|
|
||||||
`run-tests.sh # run tests for a specific set of designs
|
|
||||||
`images/` # docker image used in CI
|
|
||||||
|
|
||||||
How things are setup for Chipyard
|
|
||||||
---------------------------------
|
|
||||||
|
|
||||||
The steps for CI to run are as follows.
|
|
||||||
1st, build the toolchains in parallel (note: `esp-tools` is currently not used in the run).
|
|
||||||
The docker image sets up the `PATH` and `RISCV` variable so that `riscv-tools` is the default (currently the `env.sh` script that is created at tool build is unused).
|
|
||||||
2nd, create the simulator binary.
|
|
||||||
This requires the `riscv-tools` for `fesvr` and `verilator` to be able to build the binary.
|
|
||||||
This stores all collateral for the tests (srcs, generated-srcs, sim binary, etc) to run "out of the gate" in the next job (make needs everything or else it will run again).
|
|
||||||
3rd, finally run the desired tests.
|
|
||||||
|
|
||||||
Other CI Setup
|
|
||||||
--------------
|
|
||||||
|
|
||||||
To get the CI to work correctly you need to setup CircleCI environment variables to point to the remote directory to build files and the server user/ip.
|
|
||||||
In the project settings, you can find this under "Build Settings" "Environment Variables".
|
|
||||||
You need to add two variables like the following:
|
|
||||||
|
|
||||||
CI\_DIR = /path/to/where/you/want/to/store/remote/files
|
|
||||||
SERVER = username@myserver.coolmachine.berkeley.edu
|
|
||||||
|
|
||||||
Additionally, you need to add under the "PERMISSIONS" "SSH Permissions" section a private key that is on the build server that you are using.
|
|
||||||
After adding a private key, it will show a fingerprint that should be added under the jobs that need to be run.
|
|
||||||
|
|
||||||
Note: On the remote server you need to have the `*.pub` key file added to the `authorized_keys` file.
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# turn echo on and error on earliest command
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# get shared variables
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
source $SCRIPT_DIR/defaults.sh
|
|
||||||
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests clean
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# create the riscv tools/esp tools binaries
|
|
||||||
# passed in as <riscv-tools or esp-tools>
|
|
||||||
|
|
||||||
# turn echo on and error on earliest command
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# get shared variables
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
source $SCRIPT_DIR/defaults.sh
|
|
||||||
|
|
||||||
if [ ! -d "$HOME/$1-install" ]; then
|
|
||||||
cd $HOME
|
|
||||||
|
|
||||||
# init all submodules including the tools
|
|
||||||
CHIPYARD_DIR="$LOCAL_CHIPYARD_DIR" NPROC=$CI_MAKE_NPROC $LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1
|
|
||||||
fi
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# check to see that submodule commits are present on the master branch
|
|
||||||
|
|
||||||
# turn echo on and error on earliest command
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# get shared variables
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
source $SCRIPT_DIR/defaults.sh
|
|
||||||
|
|
||||||
# enter bhd repo
|
|
||||||
cd $LOCAL_CHIPYARD_DIR
|
|
||||||
|
|
||||||
# ignore the private vlsi submodules
|
|
||||||
git config submodule.vlsi/hammer-cadence-plugins.update none
|
|
||||||
git config submodule.vlsi/hammer-mentor-plugins.update none
|
|
||||||
git config submodule.vlsi/hammer-synopsys-plugins.update none
|
|
||||||
|
|
||||||
# initialize submodules and get the hashes
|
|
||||||
git submodule update --init
|
|
||||||
status=$(git submodule status)
|
|
||||||
|
|
||||||
all_names=()
|
|
||||||
|
|
||||||
|
|
||||||
search_submodule() {
|
|
||||||
echo "Running check on submodule $submodule in $dir"
|
|
||||||
hash=$(echo "$status" | grep "$dir.*$submodule " | awk '{print$1}' | grep -o "[[:alnum:]]*")
|
|
||||||
for branch in "${branches[@]}"
|
|
||||||
do
|
|
||||||
echo "Searching for $hash in origin/$branch of $submodule"
|
|
||||||
(git -C $dir/$submodule branch -r --contains "$hash" | grep "origin/$branch") && true # needs init'ed submodules
|
|
||||||
if [ $? -eq 0 ]
|
|
||||||
then
|
|
||||||
all_names+=("$dir/$submodule $hash 0")
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
all_names+=("$dir/$submodule $hash 1")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
search () {
|
|
||||||
for submodule in "${submodules[@]}"
|
|
||||||
do
|
|
||||||
search_submodule
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
submodules=("cva6" "boom" "gemmini" "hwacha" "icenet" "nvdla" "rocket-chip" "sha3" "sifive-blocks" "sifive-cache" "testchipip" "riscv-sodor")
|
|
||||||
dir="generators"
|
|
||||||
if [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "dev" ]
|
|
||||||
then
|
|
||||||
branches=("master")
|
|
||||||
else
|
|
||||||
branches=("master" "dev")
|
|
||||||
fi
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("riscv-gnu-toolchain" "riscv-isa-sim" "riscv-pk" "riscv-tests")
|
|
||||||
dir="toolchains/esp-tools"
|
|
||||||
branches=("master")
|
|
||||||
search
|
|
||||||
|
|
||||||
|
|
||||||
submodules=("riscv-gnu-toolchain" "riscv-isa-sim" "riscv-pk" "riscv-tests")
|
|
||||||
dir="toolchains/riscv-tools"
|
|
||||||
branches=("master")
|
|
||||||
search
|
|
||||||
|
|
||||||
# riscv-openocd doesn't use its master branch
|
|
||||||
submodules=("riscv-openocd")
|
|
||||||
dir="toolchains/riscv-tools"
|
|
||||||
branches=("riscv")
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("qemu" "libgloss")
|
|
||||||
dir="toolchains"
|
|
||||||
branches=("master")
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("coremark" "firemarshal" "nvdla-workload" "spec2017")
|
|
||||||
dir="software"
|
|
||||||
if [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "dev" ]
|
|
||||||
then
|
|
||||||
branches=("master")
|
|
||||||
else
|
|
||||||
branches=("master" "dev")
|
|
||||||
fi
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("DRAMSim2" "axe" "barstools" "chisel-testers" "dsptools" "rocket-dsp-utils" "firrtl-interpreter" "torture" "treadle")
|
|
||||||
dir="tools"
|
|
||||||
if [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "dev" ]
|
|
||||||
then
|
|
||||||
branches=("master")
|
|
||||||
else
|
|
||||||
branches=("master" "dev")
|
|
||||||
fi
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("dromajo-src")
|
|
||||||
dir="tools/dromajo"
|
|
||||||
branches=("master")
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("firesim")
|
|
||||||
dir="sims"
|
|
||||||
if [ "$CIRCLE_BRANCH" == "master" ] || [ "$CIRCLE_BRANCH" == "dev" ]
|
|
||||||
then
|
|
||||||
branches=("master")
|
|
||||||
else
|
|
||||||
branches=("master" "dev")
|
|
||||||
fi
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("hammer")
|
|
||||||
dir="vlsi"
|
|
||||||
branches=("master")
|
|
||||||
search
|
|
||||||
|
|
||||||
submodules=("fpga-shells")
|
|
||||||
dir="fpga"
|
|
||||||
branches=("master")
|
|
||||||
search
|
|
||||||
|
|
||||||
# turn off verbose printing to make this easier to read
|
|
||||||
set +x
|
|
||||||
|
|
||||||
# print 0's
|
|
||||||
for str in "${all_names[@]}";
|
|
||||||
do
|
|
||||||
if [ 0 = $(echo "$str" | awk '{print$3}') ]; then
|
|
||||||
echo "$str"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
# check if there was a non-zero return code and print 1's
|
|
||||||
EXIT=0
|
|
||||||
for str in "${all_names[@]}";
|
|
||||||
do
|
|
||||||
if [ ! 0 = $(echo "$str" | awk '{print$3}') ]; then
|
|
||||||
echo "$str"
|
|
||||||
EXIT=1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Done checking all submodules"
|
|
||||||
exit $EXIT
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# clean directories that are older than 14 days
|
|
||||||
# argument is used as the directory to look in
|
|
||||||
|
|
||||||
age () {
|
|
||||||
local AGE_SEC
|
|
||||||
local CUR_SEC
|
|
||||||
local DIFF_SEC
|
|
||||||
local SEC_PER_DAY
|
|
||||||
|
|
||||||
SEC_PER_DAY=86400
|
|
||||||
|
|
||||||
CUR_SEC=$(date +%s)
|
|
||||||
AGE_SEC=$(stat -c %Y -- "$1")
|
|
||||||
DIFF_SEC=$(expr $CUR_SEC - $AGE_SEC)
|
|
||||||
|
|
||||||
echo $(expr $DIFF_SEC / $SEC_PER_DAY)
|
|
||||||
}
|
|
||||||
|
|
||||||
for d in $1/*/ ; do
|
|
||||||
DIR_AGE="$(age $d)"
|
|
||||||
if [ $DIR_AGE -ge 14 ]; then
|
|
||||||
echo "Deleting $d since is it $DIR_AGE old"
|
|
||||||
rm -rf $d
|
|
||||||
else
|
|
||||||
echo "Keep $d since it is $DIR_AGE old"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# get the hash of riscv-tools
|
|
||||||
|
|
||||||
# turn echo on and error on earliest command
|
|
||||||
set -ex
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# get shared variables
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
source $SCRIPT_DIR/defaults.sh
|
|
||||||
|
|
||||||
# enter bhd repo
|
|
||||||
cd $LOCAL_CHIPYARD_DIR
|
|
||||||
|
|
||||||
# Use normalized output of git-submodule status as hashfile
|
|
||||||
for tools in 'riscv-tools' 'esp-tools' ; do
|
|
||||||
git submodule status "toolchains/${tools}" 'toolchains/libgloss' 'toolchains/qemu' |
|
|
||||||
while read -r line ; do
|
|
||||||
echo "${line#[!0-9a-f]}"
|
|
||||||
done > "${HOME}/${tools}.hash"
|
|
||||||
done
|
|
||||||
echo "Hashfile for riscv-tools and esp-tools created in $HOME"
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
copy () {
|
|
||||||
rsync -avzp -e 'ssh' --exclude '.git' $1 $2
|
|
||||||
}
|
|
||||||
|
|
||||||
run () {
|
|
||||||
ssh -o "StrictHostKeyChecking no" -t $SERVER $@
|
|
||||||
}
|
|
||||||
|
|
||||||
run_script () {
|
|
||||||
ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
clean () {
|
|
||||||
# remove remote work dir
|
|
||||||
run "rm -rf $REMOTE_WORK_DIR"
|
|
||||||
}
|
|
||||||
|
|
||||||
# make parallelism
|
|
||||||
CI_MAKE_NPROC=8
|
|
||||||
# chosen based on a 24c system shared with 1 other project
|
|
||||||
REMOTE_MAKE_NPROC=4
|
|
||||||
|
|
||||||
# verilator version
|
|
||||||
VERILATOR_VERSION=v4.034
|
|
||||||
|
|
||||||
# remote variables
|
|
||||||
REMOTE_PREFIX=$CI_DIR/$CIRCLE_PROJECT_REPONAME-$CIRCLE_BRANCH
|
|
||||||
REMOTE_WORK_DIR=$REMOTE_PREFIX-$CIRCLE_SHA1-$CIRCLE_JOB
|
|
||||||
REMOTE_RISCV_DIR=$REMOTE_WORK_DIR/riscv-tools-install
|
|
||||||
REMOTE_ESP_DIR=$REMOTE_WORK_DIR/esp-tools-install
|
|
||||||
REMOTE_CHIPYARD_DIR=$REMOTE_WORK_DIR/chipyard
|
|
||||||
REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator
|
|
||||||
REMOTE_FIRESIM_DIR=$REMOTE_CHIPYARD_DIR/sims/firesim/sim
|
|
||||||
REMOTE_FPGA_DIR=$REMOTE_CHIPYARD_DIR/fpga
|
|
||||||
REMOTE_JAVA_OPTS="-Xmx10G -Xss8M"
|
|
||||||
# Disable the supershell to greatly improve the readability of SBT output when captured by Circle CI
|
|
||||||
REMOTE_SBT_OPTS="-Dsbt.ivy.home=$REMOTE_WORK_DIR/.ivy2 -Dsbt.supershell=false -Dsbt.global.base=$REMOTE_WORK_DIR/.sbt -Dsbt.boot.directory=$REMOTE_WORK_DIR/.sbt/boot"
|
|
||||||
REMOTE_VERILATOR_DIR=$REMOTE_PREFIX-$CIRCLE_SHA1-verilator-install
|
|
||||||
|
|
||||||
# local variables (aka within the docker container)
|
|
||||||
LOCAL_CHECKOUT_DIR=$HOME/project
|
|
||||||
LOCAL_RISCV_DIR=$HOME/riscv-tools-install
|
|
||||||
LOCAL_ESP_DIR=$HOME/esp-tools-install
|
|
||||||
LOCAL_CHIPYARD_DIR=$LOCAL_CHECKOUT_DIR
|
|
||||||
LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verilator
|
|
||||||
LOCAL_FIRESIM_DIR=$LOCAL_CHIPYARD_DIR/sims/firesim/sim
|
|
||||||
|
|
||||||
# key value store to get the build groups
|
|
||||||
declare -A grouping
|
|
||||||
grouping["group-cores"]="chipyard-cva6 chipyard-rocket chipyard-hetero chipyard-boom chipyard-sodor chipyard-digitaltop chipyard-multiclock-rocket"
|
|
||||||
grouping["group-peripherals"]="chipyard-dmirocket chipyard-blkdev chipyard-spiflashread chipyard-spiflashwrite chipyard-mmios chipyard-lbwif"
|
|
||||||
grouping["group-accels"]="chipyard-nvdla chipyard-sha3 chipyard-hwacha chipyard-gemmini chipyard-streaming-fir chipyard-streaming-passthrough"
|
|
||||||
grouping["group-tracegen"]="tracegen tracegen-boom"
|
|
||||||
grouping["group-other"]="icenet testchipip"
|
|
||||||
grouping["group-fpga"]="arty vcu118"
|
|
||||||
|
|
||||||
# key value store to get the build strings
|
|
||||||
declare -A mapping
|
|
||||||
mapping["chipyard-rocket"]=""
|
|
||||||
mapping["chipyard-dmirocket"]=" CONFIG=dmiRocketConfig"
|
|
||||||
mapping["chipyard-lbwif"]=" CONFIG=LBWIFRocketConfig"
|
|
||||||
mapping["chipyard-sha3"]=" CONFIG=Sha3RocketConfig"
|
|
||||||
mapping["chipyard-digitaltop"]=" TOP=DigitalTop"
|
|
||||||
mapping["chipyard-streaming-fir"]=" CONFIG=StreamingFIRRocketConfig"
|
|
||||||
mapping["chipyard-streaming-passthrough"]=" CONFIG=StreamingPassthroughRocketConfig"
|
|
||||||
mapping["chipyard-hetero"]=" CONFIG=LargeBoomAndRocketConfig"
|
|
||||||
mapping["chipyard-boom"]=" CONFIG=SmallBoomConfig"
|
|
||||||
mapping["chipyard-blkdev"]=" CONFIG=SimBlockDeviceRocketConfig"
|
|
||||||
mapping["chipyard-hwacha"]=" CONFIG=HwachaRocketConfig"
|
|
||||||
mapping["chipyard-gemmini"]=" CONFIG=GemminiRocketConfig"
|
|
||||||
mapping["chipyard-cva6"]=" CONFIG=CVA6Config"
|
|
||||||
mapping["chipyard-spiflashread"]=" CONFIG=LargeSPIFlashROMRocketConfig"
|
|
||||||
mapping["chipyard-spiflashwrite"]=" CONFIG=SmallSPIFlashRocketConfig"
|
|
||||||
mapping["chipyard-mmios"]=" CONFIG=MMIORocketConfig verilog"
|
|
||||||
mapping["tracegen"]=" CONFIG=NonBlockingTraceGenL2Config"
|
|
||||||
mapping["tracegen-boom"]=" CONFIG=BoomTraceGenConfig"
|
|
||||||
mapping["chipyard-nvdla"]=" CONFIG=SmallNVDLARocketConfig"
|
|
||||||
mapping["chipyard-sodor"]=" CONFIG=Sodor5StageConfig"
|
|
||||||
mapping["chipyard-multiclock-rocket"]=" CONFIG=MulticlockRocketConfig"
|
|
||||||
|
|
||||||
mapping["firesim"]="SCALA_TEST=firesim.firesim.RocketNICF1Tests"
|
|
||||||
mapping["firesim-multiclock"]="SCALA_TEST=firesim.firesim.RocketMulticlockF1Tests"
|
|
||||||
mapping["fireboom"]="SCALA_TEST=firesim.firesim.BoomF1Tests"
|
|
||||||
mapping["icenet"]="SUB_PROJECT=icenet"
|
|
||||||
mapping["testchipip"]="SUB_PROJECT=testchipip"
|
|
||||||
|
|
||||||
mapping["arty"]="SUB_PROJECT=arty verilog"
|
|
||||||
mapping["vcu118"]="SUB_PROJECT=vcu118 verilog"
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# run the different tests
|
|
||||||
|
|
||||||
# turn echo on and error on earliest command
|
|
||||||
set -ex
|
|
||||||
|
|
||||||
# get remote exec variables
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
source $SCRIPT_DIR/defaults.sh
|
|
||||||
|
|
||||||
run_bmark () {
|
|
||||||
make run-bmark-tests-fast -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $@
|
|
||||||
}
|
|
||||||
|
|
||||||
run_asm () {
|
|
||||||
make run-asm-tests-fast -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $@
|
|
||||||
}
|
|
||||||
|
|
||||||
run_both () {
|
|
||||||
run_bmark $@
|
|
||||||
run_asm $@
|
|
||||||
}
|
|
||||||
|
|
||||||
run_tracegen () {
|
|
||||||
make tracegen -C $LOCAL_SIM_DIR $@
|
|
||||||
}
|
|
||||||
|
|
||||||
# TODO BUG: the run-binary command forces a rebuild of the simulator in CI
|
|
||||||
# instead, directly run the simulator binary
|
|
||||||
case $1 in
|
|
||||||
chipyard-rocket)
|
|
||||||
run_bmark ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-dmirocket)
|
|
||||||
run_bmark ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-lbwif)
|
|
||||||
run_bmark ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-boom)
|
|
||||||
run_bmark ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-hetero)
|
|
||||||
run_bmark ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
rocketchip)
|
|
||||||
run_bmark ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-hwacha)
|
|
||||||
export RISCV=$LOCAL_ESP_DIR
|
|
||||||
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
|
||||||
export PATH=$RISCV/bin:$PATH
|
|
||||||
make run-rv64uv-p-asm-tests -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-gemmini)
|
|
||||||
export RISCV=$LOCAL_ESP_DIR
|
|
||||||
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
|
||||||
export PATH=$RISCV/bin:$PATH
|
|
||||||
GEMMINI_SOFTWARE_DIR=$LOCAL_SIM_DIR/../../generators/gemmini/software/gemmini-rocc-tests
|
|
||||||
rm -rf $GEMMINI_SOFTWARE_DIR/riscv-tests
|
|
||||||
cd $LOCAL_SIM_DIR
|
|
||||||
$LOCAL_SIM_DIR/simulator-chipyard-GemminiRocketConfig $GEMMINI_SOFTWARE_DIR/build/bareMetalC/aligned-baremetal
|
|
||||||
$LOCAL_SIM_DIR/simulator-chipyard-GemminiRocketConfig $GEMMINI_SOFTWARE_DIR/build/bareMetalC/raw_hazard-baremetal
|
|
||||||
$LOCAL_SIM_DIR/simulator-chipyard-GemminiRocketConfig $GEMMINI_SOFTWARE_DIR/build/bareMetalC/mvin_mvout-baremetal
|
|
||||||
;;
|
|
||||||
chipyard-sha3)
|
|
||||||
export RISCV=$LOCAL_ESP_DIR
|
|
||||||
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
|
||||||
export PATH=$RISCV/bin:$PATH
|
|
||||||
(cd $LOCAL_CHIPYARD_DIR/generators/sha3/software && ./build.sh)
|
|
||||||
$LOCAL_SIM_DIR/simulator-chipyard-Sha3RocketConfig $LOCAL_CHIPYARD_DIR/generators/sha3/software/tests/bare/sha3-rocc.riscv
|
|
||||||
;;
|
|
||||||
chipyard-streaming-passthrough)
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
|
||||||
$LOCAL_SIM_DIR/simulator-chipyard-StreamingPassthroughRocketConfig $LOCAL_CHIPYARD_DIR/tests/streaming-passthrough.riscv
|
|
||||||
;;
|
|
||||||
chipyard-streaming-fir)
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
|
||||||
$LOCAL_SIM_DIR/simulator-chipyard-StreamingFIRRocketConfig $LOCAL_CHIPYARD_DIR/tests/streaming-fir.riscv
|
|
||||||
;;
|
|
||||||
chipyard-spiflashread)
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
|
||||||
make -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/spiflashread.riscv SIM_FLAGS="+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img" run-binary
|
|
||||||
;;
|
|
||||||
chipyard-spiflashwrite)
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
|
||||||
make -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/spiflashwrite.riscv SIM_FLAGS="+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img" run-binary
|
|
||||||
[[ "`xxd $LOCAL_CHIPYARD_DIR/tests/spiflash.img | grep 1337\ 00ff\ aa55\ face | wc -l`" == "6" ]] || false
|
|
||||||
;;
|
|
||||||
tracegen)
|
|
||||||
run_tracegen ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
tracegen-boom)
|
|
||||||
run_tracegen ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-cva6)
|
|
||||||
make run-binary-fast -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/multiply.riscv
|
|
||||||
;;
|
|
||||||
chipyard-sodor)
|
|
||||||
run_asm ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
chipyard-nvdla)
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
|
||||||
make -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/nvdla.riscv run-binary
|
|
||||||
;;
|
|
||||||
icenet)
|
|
||||||
make run-binary-fast BINARY=none -C $LOCAL_SIM_DIR ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
testchipip)
|
|
||||||
make run-binary-fast BINARY=none -C $LOCAL_SIM_DIR ${mapping[$1]}
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "No set of tests for $1. Did you spell it right?"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
137
.github/README.md
vendored
Normal file
137
.github/README.md
vendored
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
Chipyard Continuous Integration (CI)
|
||||||
|
===========
|
||||||
|
|
||||||
|
Website: https://gihub.com/gh/ucb-bar/chipyard/actions
|
||||||
|
|
||||||
|
GitHub Actions Brief Explanation
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
CI is executed by Github Actions (GA). GA is controlled by `.yml` files in the `.github/workflows/` directory.
|
||||||
|
In our case we have just one workflow named `chipyard-rocket-run-tests.yml`.
|
||||||
|
It defines a number of `jobs` within it that do particular tasks.
|
||||||
|
All jobs in the workflow must pass for the CI run to be successful.
|
||||||
|
In general, a job is run in parallel with others unless it depends on some other job.
|
||||||
|
The dependency of one job on the completion of another is specified via the `needs` field.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
```yaml
|
||||||
|
prepare-chipyard-cores:
|
||||||
|
name: prepare-chipyard-cores
|
||||||
|
needs: [make-keys, setup-complete]
|
||||||
|
```
|
||||||
|
This specifies that the `prepare-chipyard-cores` job needs the both the `make-keys` and the `setup-complete` steps to
|
||||||
|
be completed before it can run.
|
||||||
|
|
||||||
|
Chipyard runs its CI using a docker image created from `dockerfiles/Dockerfile`.
|
||||||
|
See its [README](../dockerfiles/README.md) for more details.
|
||||||
|
|
||||||
|
Finally, within each job's `steps:` section, the steps are run sequentially and state persists throughout a job.
|
||||||
|
So when you run something like `checkout` the next step has the checked out code.
|
||||||
|
|
||||||
|
[Composite Actions](https://docs.github.com/en/actions/creating-actions) (CA) allow for limited subroutine like code re-use within GA.
|
||||||
|
We use both community created and our own Composite Actions in our CI process. CA capabilities are changing rapidly.
|
||||||
|
Nesting of composite actions was only recently unveiled. There is a lot of room for more code reuse, in particular
|
||||||
|
we specify things over and over like docker image tag and checkout commands.
|
||||||
|
|
||||||
|
One use of CA: our process relies on caching to avoid running time-consuming and intensive tasks more often than necessary.
|
||||||
|
|
||||||
|
The following is an example of using the cache@v2 composite action. A step `uses: actions/cache@v2` which take as parameters the
|
||||||
|
path that contains the data to be cached and a key. Paths can have multiple targets.
|
||||||
|
The following step can look at the result of the cache operation, if there was cache miss, then we run the command that
|
||||||
|
will generate the data to be cached. The caching of the generated data is implicit.
|
||||||
|
>Note: GA cache documentation suggests using the yml level `if: steps.cache-primes.outputs.cache-hit != 'true'` to
|
||||||
|
> determine whether to run the data generation command.
|
||||||
|
> At the time of this writing the if construct has a bug and will not run correctly within a composite action. The use
|
||||||
|
> of a bash based if is a hack found on stackoverflow
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: rtl-build-id
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
sims/verilator
|
||||||
|
sims/firesim/sim
|
||||||
|
generators/gemmini/software/gemmini-rocc-tests
|
||||||
|
key: ${{ inputs.group-key }}-${{ github.ref }}-${{ github.sha }}
|
||||||
|
- name: run rtl build script if not cached
|
||||||
|
run: |
|
||||||
|
if [[ "${{ steps.rtl-build-id.outputs.cache-hit }}" != 'true' ]]; then
|
||||||
|
echo "Cache miss on ${{ inputs.group-key }}-${{ github.ref }}-${{ github.sha }}"
|
||||||
|
./.github/scripts/${{ inputs.build-script }} ${{ inputs.group-key }} ${{ inputs.build-type }}
|
||||||
|
else
|
||||||
|
echo "cache hit do not prepare rtl"
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
```
|
||||||
|
|
||||||
|
Our own composite actions are defined in the `.github/actions/<ActionName>/action.yml`
|
||||||
|
|
||||||
|
.github/scripts directory
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
This directory contains most the collateral for the Chipyard CI to work.
|
||||||
|
The following is included in `.github/scripts/: directory
|
||||||
|
|
||||||
|
`build-toolchains.sh` # build either riscv-tools or esp-tools
|
||||||
|
`create-hash.sh` # create hashes of riscv-tools/esp-tools to use as hash keys
|
||||||
|
`do-rtl-build.sh` # use verilator to build a sim executable (remotely)
|
||||||
|
`defaults.sh` # default variables used
|
||||||
|
`check-commit.sh` # check that submodule commits are valid
|
||||||
|
`build-extra-tests.sh` # build default chipyard tests located in tests/
|
||||||
|
`clean-old-files.sh` # clean up build server files
|
||||||
|
`do-fpga-rtl-build.sh` # similar to `do-rtl-build` but using fpga/
|
||||||
|
`install-verilator.sh` # install verilator on build server
|
||||||
|
`run-firesim-scala-tests.sh` # run firesim scala tests
|
||||||
|
`run-tests.sh # run tests for a specific set of designs
|
||||||
|
|
||||||
|
How things are set up for Chipyard
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
The steps for CI to run are as follows.
|
||||||
|
1. Build the toolchains in parallel (note: `esp-tools` is currently not used in the run).
|
||||||
|
The docker image sets up the `PATH` and `RISCV` variable so that `riscv-tools` is the default (currently the `env.sh` script that is created at tool build is unused).
|
||||||
|
2. Create the simulator binary.
|
||||||
|
This requires the `riscv-tools` for `fesvr` and `verilator` to be able to build the binary.
|
||||||
|
This stores all collateral for the tests (srcs, generated-srcs, sim binary, etc) to run "out of the gate" in the next job (make needs everything or else it will run again).
|
||||||
|
3. Finally, run the desired tests.
|
||||||
|
|
||||||
|
Other CI Setup
|
||||||
|
--------------
|
||||||
|
|
||||||
|
To get the CI to work correctly you need to create the following GH Repository Secrets
|
||||||
|
|
||||||
|
| Secret | Value |
|
||||||
|
| -------| ------------- |
|
||||||
|
| BUILDSERVER | the hostname of the remote build server (likely be a millennium machine) |
|
||||||
|
| BUILDUSER | the login to use on the build server |
|
||||||
|
| BUILDDIR | the directory to use on the build server |
|
||||||
|
| SERVERKEY | a private key to access the build server |
|
||||||
|
|
||||||
|
The default.sh script defines the following,
|
||||||
|
```bash
|
||||||
|
CI_DIR = /path/to/where/you/want/to/store/remote/files
|
||||||
|
````
|
||||||
|
but in the future this should likely be a GH Secret too.
|
||||||
|
|
||||||
|
The scripts also construct (repeatedly) a SERVER env using the above secrets
|
||||||
|
```bash
|
||||||
|
SERVER = ${{ secrets.BUILDUSER }}@${{ secrets.BUILDSERVER }}
|
||||||
|
```
|
||||||
|
|
||||||
|
Additionally, you need to add under the "PERMISSIONS" "SSH Permissions" section a private key that is on the build server that you are using.
|
||||||
|
After adding a private key, it will show a fingerprint that should be added under the jobs that need to be run.
|
||||||
|
|
||||||
|
Note: On the remote server you need to have the `*.pub` key file added to the `authorized_keys` file.
|
||||||
|
|
||||||
|
Additional Work
|
||||||
|
---------------
|
||||||
|
- It would be nice to add the ability to re-run just parts of the workflow. [See Workflows Hacks](https://github.com/jaredpalmer/razzle/blob/f8305c26997bae8ef0f5dfa52540d842451b4090/.github/workflows/examples.yml)
|
||||||
|
|
||||||
|
|
||||||
|
Notes on CIRCLE CI
|
||||||
|
------------------
|
||||||
|
This code is heavily based on the origin [CircleCI]() work. There a quite a few differences
|
||||||
|
- CCI supports workflow level variables, in GA we must define thiing like `BUILDSERVER: ${{ secrets.BUILDSERVER }}` in every job
|
||||||
|
- CCI allows a much larger cache. The entire CY directory with toolchains and RTL could be cached, with GA there is a 5Gb total cache limit
|
||||||
|
- GA support more parallel jobs 20 vs 4
|
||||||
|
- GA seems to allow much longer run times
|
||||||
|
-
|
||||||
28
.github/actions/build-extra-tests/action.yml
vendored
Normal file
28
.github/actions/build-extra-tests/action.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: build-extra-tests
|
||||||
|
description: 'Builds extra test required for some flows'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
tools-version:
|
||||||
|
description: Which toolchain to build
|
||||||
|
required: false
|
||||||
|
default: 'riscv-tools'
|
||||||
|
cache-key:
|
||||||
|
description: Use this for caching
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: build-extra-tools-cache
|
||||||
|
with:
|
||||||
|
path: extra-tests-install
|
||||||
|
key: ${{ needs.make-keys.outputs.extra-tests-cache-key }}
|
||||||
|
restore-keys: ${{ needs.make-keys.outputs.extra-tests-cache-key }}
|
||||||
|
- name: Build extra tests if not cached
|
||||||
|
run: |
|
||||||
|
export RISCV="/__w/chipyard/chipyard/riscv-tools-install"
|
||||||
|
export LD_LIBRARY_PATH="$RISCV/lib"
|
||||||
|
export PATH="$RISCV/bin:$PATH"
|
||||||
|
.github/scripts/build-extra-tests.sh
|
||||||
|
shell: bash
|
||||||
|
|
||||||
25
.github/actions/prepare-rtl/action.yml
vendored
25
.github/actions/prepare-rtl/action.yml
vendored
@@ -2,13 +2,24 @@ name: prepare-rtl
|
|||||||
description: 'Builds RTL based on parameters, caches the entire chipyard root dir when done'
|
description: 'Builds RTL based on parameters, caches the entire chipyard root dir when done'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
tools-version:
|
||||||
|
description: Which toolchain to build
|
||||||
|
required: false
|
||||||
|
default: 'riscv-tools'
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
group-key:
|
group-key:
|
||||||
description: group key
|
description: group key
|
||||||
required: true
|
required: true
|
||||||
build-script:
|
build-script:
|
||||||
description: rtl build script to use
|
description: rtl build script to use
|
||||||
required: false
|
required: false
|
||||||
|
<<<<<<< HEAD
|
||||||
default: "remote-do-rtl-build.sh"
|
default: "remote-do-rtl-build.sh"
|
||||||
|
=======
|
||||||
|
default: "do-rtl-build.sh"
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
build-type:
|
build-type:
|
||||||
description: type of build
|
description: type of build
|
||||||
required: false
|
required: false
|
||||||
@@ -17,9 +28,12 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
<<<<<<< HEAD
|
||||||
- name: Build RISC-V toolchains
|
- name: Build RISC-V toolchains
|
||||||
uses: ./.github/actions/toolchain-build
|
uses: ./.github/actions/toolchain-build
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
id: rtl-build-id
|
id: rtl-build-id
|
||||||
with:
|
with:
|
||||||
@@ -28,13 +42,24 @@ runs:
|
|||||||
sims/firesim/sim
|
sims/firesim/sim
|
||||||
generators/gemmini/software/gemmini-rocc-tests
|
generators/gemmini/software/gemmini-rocc-tests
|
||||||
key: ${{ inputs.group-key }}-${{ github.ref }}-${{ github.sha }}
|
key: ${{ inputs.group-key }}-${{ github.ref }}-${{ github.sha }}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
- name: Run RTL build if not cached
|
- name: Run RTL build if not cached
|
||||||
|
=======
|
||||||
|
- name: run rtl build script if not cached
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ steps.rtl-build-id.outputs.cache-hit }}" != 'true' ]]; then
|
if [[ "${{ steps.rtl-build-id.outputs.cache-hit }}" != 'true' ]]; then
|
||||||
echo "Cache miss on ${{ inputs.group-key }}-${{ github.ref }}-${{ github.sha }}"
|
echo "Cache miss on ${{ inputs.group-key }}-${{ github.ref }}-${{ github.sha }}"
|
||||||
./.github/scripts/${{ inputs.build-script }} ${{ inputs.group-key }} ${{ inputs.build-type }}
|
./.github/scripts/${{ inputs.build-script }} ${{ inputs.group-key }} ${{ inputs.build-type }}
|
||||||
else
|
else
|
||||||
|
<<<<<<< HEAD
|
||||||
echo "Cache hit do not rebuild RTL for ${{ inputs.group-key }}"
|
echo "Cache hit do not rebuild RTL for ${{ inputs.group-key }}"
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
=======
|
||||||
|
echo "cache hit do not prepare rtl"
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
|
|||||||
18
.github/actions/run-tests/action.yml
vendored
18
.github/actions/run-tests/action.yml
vendored
@@ -2,6 +2,13 @@ name: run-tests
|
|||||||
description: 'Runs tests according to input parameters'
|
description: 'Runs tests according to input parameters'
|
||||||
|
|
||||||
inputs:
|
inputs:
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
tools-version:
|
||||||
|
description: Which toolchain to build
|
||||||
|
required: false
|
||||||
|
default: 'riscv-tools'
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
group-key:
|
group-key:
|
||||||
description: group key
|
description: group key
|
||||||
required: true
|
required: true
|
||||||
@@ -16,6 +23,7 @@ inputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
<<<<<<< HEAD
|
||||||
- name: Init submodules (since only the RTL is cached)
|
- name: Init submodules (since only the RTL is cached)
|
||||||
run: ./scripts/init-submodules-no-riscv-tools.sh
|
run: ./scripts/init-submodules-no-riscv-tools.sh
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -29,3 +37,13 @@ runs:
|
|||||||
- name: Run RTL tests
|
- name: Run RTL tests
|
||||||
run: ./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }}
|
run: ./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
=======
|
||||||
|
- name: run rtl build script cache of chipyard root should have been loaded by prepare-rtl
|
||||||
|
run: |
|
||||||
|
export RISCV="/__w/chipyard/chipyard/riscv-tools-install"
|
||||||
|
export LD_LIBRARY_PATH="$RISCV/lib"
|
||||||
|
export PATH="$RISCV/bin:$PATH"
|
||||||
|
./.github/scripts/${{ inputs.run-script }} ${{ inputs.project-key }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
|
|||||||
31
.github/actions/toolchain-build/action.yml
vendored
31
.github/actions/toolchain-build/action.yml
vendored
@@ -1,4 +1,5 @@
|
|||||||
name: toolchain-build
|
name: toolchain-build
|
||||||
|
<<<<<<< HEAD
|
||||||
description: 'Build/cache both toolchains'
|
description: 'Build/cache both toolchains'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
@@ -49,3 +50,33 @@ runs:
|
|||||||
- name: Build ESP RISC-V toolchain if not cached
|
- name: Build ESP RISC-V toolchain if not cached
|
||||||
run: ./.github/scripts/build-toolchains.sh esp-tools
|
run: ./.github/scripts/build-toolchains.sh esp-tools
|
||||||
shell: bash
|
shell: bash
|
||||||
|
=======
|
||||||
|
description: 'Builds the selected toolchain'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
tools-version:
|
||||||
|
description: Which toolchain to build
|
||||||
|
required: false
|
||||||
|
default: 'riscv-tools'
|
||||||
|
cache-key:
|
||||||
|
description: Use this for caching
|
||||||
|
required: true
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
id: toolchain-build-id
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.tools-version }}-install
|
||||||
|
key: ${{ inputs.cache-key }}
|
||||||
|
- name: run build toolchain if not cached
|
||||||
|
run: |
|
||||||
|
if [[ "${{ steps.toolchain-build-id.outputs.cache-hit }}" != 'true' ]]; then
|
||||||
|
echo "Cache miss on ${{ inputs.tools-version }}-install"
|
||||||
|
./.github/scripts/build-toolchains.sh ${{ inputs.tools-version }}
|
||||||
|
else
|
||||||
|
echo "cache hit do not generate build ${{ inputs.tools-version }}"
|
||||||
|
fi
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
>>>>>>> 52c752ba... Move Chipyard CI to Github Actions
|
||||||
|
|||||||
4
.github/scripts/build-extra-tests.sh
vendored
4
.github/scripts/build-extra-tests.sh
vendored
@@ -7,9 +7,5 @@ set -ex
|
|||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
source $SCRIPT_DIR/defaults.sh
|
source $SCRIPT_DIR/defaults.sh
|
||||||
|
|
||||||
export RISCV="$GITHUB_WORKSPACE/riscv-tools-install"
|
|
||||||
export LD_LIBRARY_PATH="$RISCV/lib"
|
|
||||||
export PATH="$RISCV/bin:$PATH"
|
|
||||||
|
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests clean
|
make -C $LOCAL_CHIPYARD_DIR/tests clean
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
make -C $LOCAL_CHIPYARD_DIR/tests
|
||||||
|
|||||||
3
.github/scripts/build-toolchains.sh
vendored
3
.github/scripts/build-toolchains.sh
vendored
@@ -15,7 +15,4 @@ if [ ! -d "$HOME/$1-install" ]; then
|
|||||||
|
|
||||||
# init all submodules including the tools
|
# init all submodules including the tools
|
||||||
CHIPYARD_DIR="$LOCAL_CHIPYARD_DIR" NPROC=$CI_MAKE_NPROC $LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1
|
CHIPYARD_DIR="$LOCAL_CHIPYARD_DIR" NPROC=$CI_MAKE_NPROC $LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1
|
||||||
|
|
||||||
# de-init the toolchain area to save on space (forced to ignore local changes)
|
|
||||||
git submodule deinit --force $LOCAL_CHIPYARD_DIR/toolchains/$1
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
1
.github/scripts/check-commit.sh
vendored
1
.github/scripts/check-commit.sh
vendored
@@ -9,6 +9,7 @@ set -ex
|
|||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
source $SCRIPT_DIR/defaults.sh
|
source $SCRIPT_DIR/defaults.sh
|
||||||
|
|
||||||
|
# enter bhd repo
|
||||||
cd $LOCAL_CHIPYARD_DIR
|
cd $LOCAL_CHIPYARD_DIR
|
||||||
|
|
||||||
# ignore the private vlsi submodules
|
# ignore the private vlsi submodules
|
||||||
|
|||||||
2
.github/scripts/create-hash.sh
vendored
2
.github/scripts/create-hash.sh
vendored
@@ -17,4 +17,4 @@ for tools in 'riscv-tools' 'esp-tools' ; do
|
|||||||
echo "${line#[!0-9a-f]}"
|
echo "${line#[!0-9a-f]}"
|
||||||
done > "${tools}.hash"
|
done > "${tools}.hash"
|
||||||
done
|
done
|
||||||
echo "Hashfile for riscv-tools and esp-tools created in $PWD"
|
echo "Hashfile for riscv-tools and esp-tools created in $HOME"
|
||||||
|
|||||||
32
.github/scripts/defaults.sh
vendored
32
.github/scripts/defaults.sh
vendored
@@ -1,24 +1,42 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
copy () {
|
||||||
|
rsync -azp -e 'ssh' --exclude '.git' $1 $2
|
||||||
|
}
|
||||||
|
|
||||||
|
run () {
|
||||||
|
ssh -o "ServerAliveInterval=60" -o "StrictHostKeyChecking no" -t $SERVER $@
|
||||||
|
}
|
||||||
|
|
||||||
|
run_script () {
|
||||||
|
ssh -o "ServerAliveInterval=60" -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2"
|
||||||
|
}
|
||||||
|
|
||||||
|
clean () {
|
||||||
|
# remove remote work dir
|
||||||
|
run "rm -rf $REMOTE_WORK_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
# make parallelism
|
# make parallelism
|
||||||
CI_MAKE_NPROC=8
|
CI_MAKE_NPROC=4
|
||||||
# chosen based on a 24c system shared with 1 other project
|
# chosen based on a 24c system shared with 1 other project
|
||||||
REMOTE_MAKE_NPROC=4
|
REMOTE_MAKE_NPROC=4
|
||||||
|
|
||||||
# verilator version
|
# verilator version
|
||||||
VERILATOR_VERSION=v4.034
|
VERILATOR_VERSION=v4.034
|
||||||
|
|
||||||
HOME=$GITHUB_WORKSPACE
|
# remote variables
|
||||||
|
|
||||||
CURRENT_BRANCH=$(git branch --show-current)
|
CURRENT_BRANCH=$(git branch --show-current)
|
||||||
|
|
||||||
# remote variables
|
|
||||||
# CI_DIR is defined externally based on the GH repository secret BUILDDIR
|
# CI_DIR is defined externally based on the GH repository secret BUILDDIR
|
||||||
|
|
||||||
|
HOME=`pwd`
|
||||||
REMOTE_PREFIX=$CI_DIR/${GITHUB_REPOSITORY#*/}-$CURRENT_BRANCH
|
REMOTE_PREFIX=$CI_DIR/${GITHUB_REPOSITORY#*/}-$CURRENT_BRANCH
|
||||||
REMOTE_WORK_DIR=$GITHUB_WORKSPACE
|
REMOTE_WORK_DIR=$REMOTE_PREFIX-$GITHUB_SHA-$GITHUB_JOB
|
||||||
REMOTE_RISCV_DIR=$GITHUB_WORKSPACE/riscv-tools-install
|
REMOTE_RISCV_DIR=$REMOTE_WORK_DIR/riscv-tools-install
|
||||||
REMOTE_ESP_DIR=$GITHUB_WORKSPACE/esp-tools-install
|
REMOTE_ESP_DIR=$REMOTE_WORK_DIR/esp-tools-install
|
||||||
REMOTE_CHIPYARD_DIR=$GITHUB_WORKSPACE
|
REMOTE_CHIPYARD_DIR=$REMOTE_WORK_DIR/chipyard
|
||||||
REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator
|
REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator
|
||||||
REMOTE_FIRESIM_DIR=$REMOTE_CHIPYARD_DIR/sims/firesim/sim
|
REMOTE_FIRESIM_DIR=$REMOTE_CHIPYARD_DIR/sims/firesim/sim
|
||||||
REMOTE_FPGA_DIR=$REMOTE_CHIPYARD_DIR/fpga
|
REMOTE_FPGA_DIR=$REMOTE_CHIPYARD_DIR/fpga
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# choose what make dir to use
|
# choose what make dir to use
|
||||||
|
|
||||||
case $2 in
|
case $2 in
|
||||||
"sim")
|
"sim")
|
||||||
REMOTE_MAKE_DIR=$REMOTE_SIM_DIR
|
REMOTE_MAKE_DIR=$REMOTE_SIM_DIR
|
||||||
@@ -10,7 +10,7 @@ SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|||||||
source $SCRIPT_DIR/defaults.sh
|
source $SCRIPT_DIR/defaults.sh
|
||||||
|
|
||||||
# clean older directories (delete prior directories related to this branch also)
|
# clean older directories (delete prior directories related to this branch also)
|
||||||
run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh $CI_DIR
|
run_script $LOCAL_CHIPYARD_DIR/.github/scripts/clean-old-files.sh $CI_DIR
|
||||||
run "rm -rf $REMOTE_PREFIX*"
|
run "rm -rf $REMOTE_PREFIX*"
|
||||||
|
|
||||||
# set stricthostkeychecking to no (must happen before rsync)
|
# set stricthostkeychecking to no (must happen before rsync)
|
||||||
40
.github/scripts/run-tests.sh
vendored
40
.github/scripts/run-tests.sh
vendored
@@ -9,18 +9,12 @@ set -ex
|
|||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||||
source $SCRIPT_DIR/defaults.sh
|
source $SCRIPT_DIR/defaults.sh
|
||||||
|
|
||||||
export RISCV="$GITHUB_WORKSPACE/riscv-tools-install"
|
|
||||||
export LD_LIBRARY_PATH="$RISCV/lib"
|
|
||||||
export PATH="$RISCV/bin:$PATH"
|
|
||||||
|
|
||||||
DISABLE_SIM_PREREQ="BREAK_SIM_PREREQ=1"
|
|
||||||
|
|
||||||
run_bmark () {
|
run_bmark () {
|
||||||
make run-bmark-tests-fast -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ $@
|
make run-bmark-tests-fast -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $@
|
||||||
}
|
}
|
||||||
|
|
||||||
run_asm () {
|
run_asm () {
|
||||||
make run-asm-tests-fast -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ $@
|
make run-asm-tests-fast -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $@
|
||||||
}
|
}
|
||||||
|
|
||||||
run_both () {
|
run_both () {
|
||||||
@@ -29,9 +23,11 @@ run_both () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_tracegen () {
|
run_tracegen () {
|
||||||
make tracegen -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ $@
|
make tracegen -C $LOCAL_SIM_DIR $@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO BUG: the run-binary command forces a rebuild of the simulator in CI
|
||||||
|
# instead, directly run the simulator binary
|
||||||
case $1 in
|
case $1 in
|
||||||
chipyard-rocket)
|
chipyard-rocket)
|
||||||
run_bmark ${mapping[$1]}
|
run_bmark ${mapping[$1]}
|
||||||
@@ -55,7 +51,7 @@ case $1 in
|
|||||||
export RISCV=$LOCAL_ESP_DIR
|
export RISCV=$LOCAL_ESP_DIR
|
||||||
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
||||||
export PATH=$RISCV/bin:$PATH
|
export PATH=$RISCV/bin:$PATH
|
||||||
make run-rv64uv-p-asm-tests -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]}
|
make run-rv64uv-p-asm-tests -j$CI_MAKE_NPROC -C $LOCAL_SIM_DIR ${mapping[$1]}
|
||||||
;;
|
;;
|
||||||
chipyard-gemmini)
|
chipyard-gemmini)
|
||||||
export RISCV=$LOCAL_ESP_DIR
|
export RISCV=$LOCAL_ESP_DIR
|
||||||
@@ -64,32 +60,32 @@ case $1 in
|
|||||||
GEMMINI_SOFTWARE_DIR=$LOCAL_SIM_DIR/../../generators/gemmini/software/gemmini-rocc-tests
|
GEMMINI_SOFTWARE_DIR=$LOCAL_SIM_DIR/../../generators/gemmini/software/gemmini-rocc-tests
|
||||||
rm -rf $GEMMINI_SOFTWARE_DIR/riscv-tests
|
rm -rf $GEMMINI_SOFTWARE_DIR/riscv-tests
|
||||||
cd $LOCAL_SIM_DIR
|
cd $LOCAL_SIM_DIR
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} run-binary-fast BINARY=$GEMMINI_SOFTWARE_DIR/build/bareMetalC/aligned-baremetal
|
$LOCAL_SIM_DIR/simulator-chipyard-GemminiRocketConfig $GEMMINI_SOFTWARE_DIR/build/bareMetalC/aligned-baremetal
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} run-binary-fast BINARY=$GEMMINI_SOFTWARE_DIR/build/bareMetalC/raw_hazard-baremetal
|
$LOCAL_SIM_DIR/simulator-chipyard-GemminiRocketConfig $GEMMINI_SOFTWARE_DIR/build/bareMetalC/raw_hazard-baremetal
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} run-binary-fast BINARY=$GEMMINI_SOFTWARE_DIR/build/bareMetalC/mvin_mvout-baremetal
|
$LOCAL_SIM_DIR/simulator-chipyard-GemminiRocketConfig $GEMMINI_SOFTWARE_DIR/build/bareMetalC/mvin_mvout-baremetal
|
||||||
;;
|
;;
|
||||||
chipyard-sha3)
|
chipyard-sha3)
|
||||||
export RISCV=$LOCAL_ESP_DIR
|
export RISCV=$LOCAL_ESP_DIR
|
||||||
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib
|
||||||
export PATH=$RISCV/bin:$PATH
|
export PATH=$RISCV/bin:$PATH
|
||||||
(cd $LOCAL_CHIPYARD_DIR/generators/sha3/software && ./build.sh)
|
(cd $LOCAL_CHIPYARD_DIR/generators/sha3/software && ./build.sh)
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} run-binary-fast BINARY=$LOCAL_CHIPYARD_DIR/generators/sha3/software/tests/bare/sha3-rocc.riscv
|
$LOCAL_SIM_DIR/simulator-chipyard-Sha3RocketConfig $LOCAL_CHIPYARD_DIR/generators/sha3/software/tests/bare/sha3-rocc.riscv
|
||||||
;;
|
;;
|
||||||
chipyard-streaming-passthrough)
|
chipyard-streaming-passthrough)
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
make -C $LOCAL_CHIPYARD_DIR/tests
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} run-binary-fast BINARY=$LOCAL_CHIPYARD_DIR/tests/streaming-passthrough.riscv
|
$LOCAL_SIM_DIR/simulator-chipyard-StreamingPassthroughRocketConfig $LOCAL_CHIPYARD_DIR/tests/streaming-passthrough.riscv
|
||||||
;;
|
;;
|
||||||
chipyard-streaming-fir)
|
chipyard-streaming-fir)
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
make -C $LOCAL_CHIPYARD_DIR/tests
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} run-binary-fast BINARY=$LOCAL_CHIPYARD_DIR/tests/streaming-fir.riscv
|
$LOCAL_SIM_DIR/simulator-chipyard-StreamingFIRRocketConfig $LOCAL_CHIPYARD_DIR/tests/streaming-fir.riscv
|
||||||
;;
|
;;
|
||||||
chipyard-spiflashread)
|
chipyard-spiflashread)
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
make -C $LOCAL_CHIPYARD_DIR/tests
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/spiflashread.riscv SIM_FLAGS="+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img" run-binary-fast
|
make -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/spiflashread.riscv SIM_FLAGS="+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img" run-binary
|
||||||
;;
|
;;
|
||||||
chipyard-spiflashwrite)
|
chipyard-spiflashwrite)
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
make -C $LOCAL_CHIPYARD_DIR/tests
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/spiflashwrite.riscv SIM_FLAGS="+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img" run-binary-fast
|
make -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/spiflashwrite.riscv SIM_FLAGS="+spiflash0=${LOCAL_CHIPYARD_DIR}/tests/spiflash.img" run-binary
|
||||||
[[ "`xxd $LOCAL_CHIPYARD_DIR/tests/spiflash.img | grep 1337\ 00ff\ aa55\ face | wc -l`" == "6" ]] || false
|
[[ "`xxd $LOCAL_CHIPYARD_DIR/tests/spiflash.img | grep 1337\ 00ff\ aa55\ face | wc -l`" == "6" ]] || false
|
||||||
;;
|
;;
|
||||||
tracegen)
|
tracegen)
|
||||||
@@ -99,20 +95,20 @@ case $1 in
|
|||||||
run_tracegen ${mapping[$1]}
|
run_tracegen ${mapping[$1]}
|
||||||
;;
|
;;
|
||||||
chipyard-cva6)
|
chipyard-cva6)
|
||||||
make run-binary-fast -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/multiply.riscv
|
make run-binary-fast -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/multiply.riscv
|
||||||
;;
|
;;
|
||||||
chipyard-sodor)
|
chipyard-sodor)
|
||||||
run_asm ${mapping[$1]}
|
run_asm ${mapping[$1]}
|
||||||
;;
|
;;
|
||||||
chipyard-nvdla)
|
chipyard-nvdla)
|
||||||
make -C $LOCAL_CHIPYARD_DIR/tests
|
make -C $LOCAL_CHIPYARD_DIR/tests
|
||||||
make -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/nvdla.riscv run-binary-fast
|
make -C $LOCAL_SIM_DIR ${mapping[$1]} BINARY=$LOCAL_CHIPYARD_DIR/tests/nvdla.riscv run-binary
|
||||||
;;
|
;;
|
||||||
icenet)
|
icenet)
|
||||||
make run-binary-fast BINARY=none -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]}
|
make run-binary-fast BINARY=none -C $LOCAL_SIM_DIR ${mapping[$1]}
|
||||||
;;
|
;;
|
||||||
testchipip)
|
testchipip)
|
||||||
make run-binary-fast BINARY=none -C $LOCAL_SIM_DIR $DISABLE_SIM_PREREQ ${mapping[$1]}
|
make run-binary-fast BINARY=none -C $LOCAL_SIM_DIR ${mapping[$1]}
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "No set of tests for $1. Did you spell it right?"
|
echo "No set of tests for $1. Did you spell it right?"
|
||||||
|
|||||||
1285
.github/workflows/chipyard-rocket-run-tests.yml
vendored
Normal file
1285
.github/workflows/chipyard-rocket-run-tests.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user