From e5d9f539c56db9111bb44e4c58ef9fee61427567 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 17:16:32 -0700 Subject: [PATCH] initial ci commit --- .circleci/build-toolchains.sh | 22 +++++ .circleci/build-verilator.sh | 18 ++++ .circleci/config.yml | 154 ++++++++++++++++++++++++++++++++++ .circleci/create-hash.sh | 17 ++++ .circleci/do-rtl-build.sh | 13 +++ 5 files changed, 224 insertions(+) create mode 100755 .circleci/build-toolchains.sh create mode 100755 .circleci/build-verilator.sh create mode 100644 .circleci/config.yml create mode 100755 .circleci/create-hash.sh create mode 100755 .circleci/do-rtl-build.sh diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh new file mode 100755 index 00000000..32560b27 --- /dev/null +++ b/.circleci/build-toolchains.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# create the riscv tools binaries from riscv-boom/boom-template with rocket-chip hash given by riscv-boom + +# turn echo on and error on earliest command +set -ex + +if [ ! -d "$HOME/esp-tools-install" ]; then + + cd $HOME/ + + # init all submodules including the tools + ./project/scripts/build-toolchains.sh esp-tools +fi + +if [ ! -d "$HOME/riscv-tools-install" ]; then + + cd $HOME/ + + # init all submodules including the tools + ./project/scripts/build-toolchains.sh riscv-tools +fi diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh new file mode 100755 index 00000000..ae41be3a --- /dev/null +++ b/.circleci/build-verilator.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# build verilator and init submodules with rocket-chip hash given by riscv-boom + +# turn echo on and error on earliest command +set -ex + +cd $HOME/project + +# init all submodules (according to what boom-template wants) +./scripts/init-submodules-no-riscv-tools.sh + +cd sims/verisim + +if [ ! -d "$HOME/project/sims/verisim/verilator" ]; then + # make boom-template verilator version + make verilator_install +fi diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..45ad274e --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,154 @@ +# CircleCI Configuration File + +# version of circleci +version: 2 + +# set of jobs to run +jobs: + install-toolchains: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} + + - run: + name: Building toolchains + command: | + .circleci/build-toolchains.sh + no_output_timeout: 120m + + - save_cache: + key: riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + paths: + - "/home/riscvuser/riscv-tools-install" + + - save_cache: + key: esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} + paths: + - "/home/riscvuser/esp-tools-install" + + install-verilator: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - restore_cache: + keys: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Build Verilator + command: | + .circleci/build-verilator.sh + no_output_timeout: 120m + + - save_cache: + key: verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + paths: + - "/home/riscvuser/project/sims/verisim/verilator" + + prepare-example: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - restore_cache: + keys: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building BoomConfig using Verilator + command: .circleci/do-rtl-build.sh example + no_output_timeout: 120m + + - save_cache: + key: example-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project/sims/verisim" + + example-run-benchmark-tests: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} + + - restore_cache: + keys: + - example-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run example benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example + +# Order and dependencies of jobs to run +workflows: + version: 2 + build-and-test-boom-configs: + jobs: + # Make the toolchain + - install-toolchains + + # Build verilator + - install-verilator: + requires: + - install-toolchains + + # Prepare the verilator builds + - prepare-example: + requires: + - install-verilator + + # Run the respective tests + + # Run the example tests + - example-run-benchmark-tests: + requires: + - prepare-example diff --git a/.circleci/create-hash.sh b/.circleci/create-hash.sh new file mode 100755 index 00000000..2aff9727 --- /dev/null +++ b/.circleci/create-hash.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# get the hash of riscv-tools + +# turn echo on and error on earliest command +set -ex + +# enter bhd repo +cd $HOME/project + +# get the version of riscv-tools from the git submodule hash +git submodule status | grep "riscv-tools" | awk '{print$1}' | grep -o "[[:alnum:]]*" >> $HOME/riscv-tools.hash +git submodule status | grep "esp-tools" | awk '{print$1}' | grep -o "[[:alnum:]]*" >> $HOME/esp-tools.hash + +echo "Hashfile for riscv-tools and esp-tools created in $HOME" +echo "Contents: riscv-tools:$(cat $HOME/riscv-tools.hash)" +echo "Contents: esp-tools:$(cat $HOME/esp-tools.hash)" diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh new file mode 100755 index 00000000..dcfaa8db --- /dev/null +++ b/.circleci/do-rtl-build.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# create the different verilator builds of BOOM based on arg + +# turn echo on and error on earliest command +set -ex + +# this file assumes cache is updated correctly + +# enter the verisim directory and build the specific config +cd $HOME/project/sims/verisim +make clean +make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M"