From e5d9f539c56db9111bb44e4c58ef9fee61427567 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 17:16:32 -0700 Subject: [PATCH 01/18] 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" From 2dbe087fce3ae436175a211f4632d0ce283d6ef0 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 17:29:10 -0700 Subject: [PATCH 02/18] have toolchain script point to rebar correctly --- .circleci/build-toolchains.sh | 4 ++-- scripts/build-toolchains.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh index 32560b27..1305617f 100755 --- a/.circleci/build-toolchains.sh +++ b/.circleci/build-toolchains.sh @@ -10,7 +10,7 @@ if [ ! -d "$HOME/esp-tools-install" ]; then cd $HOME/ # init all submodules including the tools - ./project/scripts/build-toolchains.sh esp-tools + REBAR_DIR=$HOME/project ./project/scripts/build-toolchains.sh esp-tools fi if [ ! -d "$HOME/riscv-tools-install" ]; then @@ -18,5 +18,5 @@ if [ ! -d "$HOME/riscv-tools-install" ]; then cd $HOME/ # init all submodules including the tools - ./project/scripts/build-toolchains.sh riscv-tools + REBAR_DIR=$HOME/project ./project/scripts/build-toolchains.sh riscv-tools fi diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index ddf9b462..3cc25c6a 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -6,6 +6,7 @@ set -o pipefail unamestr=$(uname) RDIR=$(pwd) +: ${REBAR_DIR:=$(pwd)} #default value is the PWD unless overridden if [ $# -ne 0 ]; then TOOLCHAIN=$1 @@ -25,7 +26,7 @@ RISCV="$(pwd)/$INSTALL_DIR" # install risc-v tools export RISCV="$RISCV" -git submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 +git -C $REBAR_DIR submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 cd "toolchains/$TOOLCHAIN" export MAKEFLAGS="-j16" ./build.sh From 22599520874c378a710225a6134fec2d9a0a7473 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 17:33:06 -0700 Subject: [PATCH 03/18] rename the workflow --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 45ad274e..50466a24 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -131,7 +131,7 @@ jobs: # Order and dependencies of jobs to run workflows: version: 2 - build-and-test-boom-configs: + build-and-test-rebar-integration: jobs: # Make the toolchain - install-toolchains From 1ef687605d057c2a6b85169a5f9a744e809d64e5 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 17:43:20 -0700 Subject: [PATCH 04/18] remove old boom references | build-toolchain rebar directory fix --- .circleci/config.yml | 2 +- scripts/build-toolchains.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 50466a24..e0274023 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,7 +87,7 @@ jobs: - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Building BoomConfig using Verilator + name: Building the example subproject using Verilator command: .circleci/do-rtl-build.sh example no_output_timeout: 120m diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 3cc25c6a..9b659109 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -27,7 +27,7 @@ RISCV="$(pwd)/$INSTALL_DIR" # install risc-v tools export RISCV="$RISCV" git -C $REBAR_DIR submodule update --init --recursive toolchains/$TOOLCHAIN #--jobs 8 -cd "toolchains/$TOOLCHAIN" +cd "$REBAR_DIR/toolchains/$TOOLCHAIN" export MAKEFLAGS="-j16" ./build.sh cd $RDIR From e109831b0b5b15fa7d750a3ea7a0e0567201e4ef Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 18:23:38 -0700 Subject: [PATCH 05/18] more renaming | proper place to git submodule update --- .circleci/build-toolchains.sh | 2 +- .circleci/build-verilator.sh | 7 ++----- .circleci/do-rtl-build.sh | 8 +++++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh index 1305617f..a2e37381 100755 --- a/.circleci/build-toolchains.sh +++ b/.circleci/build-toolchains.sh @@ -1,6 +1,6 @@ #!/bin/bash -# create the riscv tools binaries from riscv-boom/boom-template with rocket-chip hash given by riscv-boom +# create the riscv tools/esp tools binaries # turn echo on and error on earliest command set -ex diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh index ae41be3a..00cd7217 100755 --- a/.circleci/build-verilator.sh +++ b/.circleci/build-verilator.sh @@ -1,18 +1,15 @@ #!/bin/bash -# build verilator and init submodules with rocket-chip hash given by riscv-boom +# build verilator # 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 make verilator_install fi diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index dcfaa8db..e8336ae2 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -1,13 +1,15 @@ #!/bin/bash -# create the different verilator builds of BOOM based on arg +# create the different verilator builds arg (subproject) # turn echo on and error on earliest command set -ex -# this file assumes cache is updated correctly +# init all submodules +cd $HOME/project +./scripts/init-submodules-no-riscv-tools.sh # enter the verisim directory and build the specific config -cd $HOME/project/sims/verisim +cd sims/verisim make clean make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M" From 9f7f94b6f979ecb9f39a5e796516c95c359ec0b9 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 18:35:34 -0700 Subject: [PATCH 06/18] parallelize toolchain builds with verilator --- .circleci/build-toolchains.sh | 13 +++------- .circleci/config.yml | 47 ++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh index a2e37381..28b87caa 100755 --- a/.circleci/build-toolchains.sh +++ b/.circleci/build-toolchains.sh @@ -1,22 +1,15 @@ #!/bin/bash # create the riscv tools/esp tools binaries +# passed in as # turn echo on and error on earliest command set -ex -if [ ! -d "$HOME/esp-tools-install" ]; then +if [ ! -d "$HOME/$1-install" ]; then cd $HOME/ # init all submodules including the tools - REBAR_DIR=$HOME/project ./project/scripts/build-toolchains.sh esp-tools -fi - -if [ ! -d "$HOME/riscv-tools-install" ]; then - - cd $HOME/ - - # init all submodules including the tools - REBAR_DIR=$HOME/project ./project/scripts/build-toolchains.sh riscv-tools + REBAR_DIR=$HOME/project ./project/scripts/build-toolchains.sh $1 fi diff --git a/.circleci/config.yml b/.circleci/config.yml index e0274023..26a162e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ version: 2 # set of jobs to run jobs: - install-toolchains: + install-riscv-toolchain: docker: - image: riscvboom/riscvboom-images:0.0.5 environment: @@ -25,14 +25,10 @@ jobs: keys: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - - restore_cache: - keys: - - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} - - run: - name: Building toolchains + name: Building riscv-tools toolchain command: | - .circleci/build-toolchains.sh + .circleci/build-toolchains.sh riscv-tools no_output_timeout: 120m - save_cache: @@ -40,6 +36,32 @@ jobs: paths: - "/home/riscvuser/riscv-tools-install" + install-esp-toolchain: + 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: + - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} + + - run: + name: Building esp-tools toolchain + command: | + .circleci/build-toolchains.sh esp-tools + no_output_timeout: 120m + - save_cache: key: esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} paths: @@ -133,13 +155,13 @@ workflows: version: 2 build-and-test-rebar-integration: jobs: - # Make the toolchain - - install-toolchains + # Make the toolchains + - install-riscv-toolchain + + - install-esp-toolchain # Build verilator - - install-verilator: - requires: - - install-toolchains + - install-verilator # Prepare the verilator builds - prepare-example: @@ -152,3 +174,4 @@ workflows: - example-run-benchmark-tests: requires: - prepare-example + - install-riscv-toolchain From 8f3426362dff2613ab3f680bde0c4bff84e9dd53 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 18:52:13 -0700 Subject: [PATCH 07/18] need riscv-tools for verilator build --- .circleci/config.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 26a162e0..be9c6372 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -104,6 +104,15 @@ jobs: # 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: - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} @@ -138,10 +147,6 @@ jobs: 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 }} From 1a6a5ea875164312ff6bc1b583729f1c62bcfa86 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 18:55:04 -0700 Subject: [PATCH 08/18] correct dependencies for runs --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index be9c6372..a93642d8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -171,6 +171,7 @@ workflows: # Prepare the verilator builds - prepare-example: requires: + - install-riscv-toolchain - install-verilator # Run the respective tests @@ -178,5 +179,5 @@ workflows: # Run the example tests - example-run-benchmark-tests: requires: - - prepare-example - install-riscv-toolchain + - prepare-example From e35d299ad413e1b1d89aff2da7d9f4f7be383334 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sat, 11 May 2019 20:31:00 -0700 Subject: [PATCH 09/18] store all source/collateral when moving to test run --- .circleci/config.yml | 2 +- .circleci/do-rtl-build.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a93642d8..63db649e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -125,7 +125,7 @@ jobs: - save_cache: key: example-{{ .Branch }}-{{ .Revision }} paths: - - "/home/riscvuser/project/sims/verisim" + - "/home/riscvuser/project" example-run-benchmark-tests: docker: diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index e8336ae2..02d02984 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -13,3 +13,5 @@ cd $HOME/project cd sims/verisim make clean make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M" + +rm -rf ../../project From b2d46037a59e29924d5333fd2f0c2d54137d4d93 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sun, 12 May 2019 12:16:10 -0700 Subject: [PATCH 10/18] add status badge for master | add ci readme | add more benchmark tests --- .circleci/README.md | 54 ++++++++ .circleci/config.yml | 290 ++++++++++++++++++++++++++++++++++++++++++- README.md | 2 +- 3 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 .circleci/README.md diff --git a/.circleci/README.md b/.circleci/README.md new file mode 100644 index 00000000..50ede340 --- /dev/null +++ b/.circleci/README.md @@ -0,0 +1,54 @@ +REBAR CI +======== + +Website: https://circleci.com/gh/ucb-bar/project-template + +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 + - install-verilator + +This specifies that the `prepare-rocketchip` job needs the `install-riscv-toolchain` and `install-verilator` 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 REBAR CI to work. +The following is included: + + build-toolchains.sh # build either riscv-tools or esp-tools + build-verilator.sh # build verilator + 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 + config.yml # main circleci config script to enumerate jobs/workflows + +How things are setup for REBAR +------------------------------ + +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, install verilator using the `*.mk` to cache unique versions of verilator (mainly for if verilator is bumped). +3rd, 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). +4th, finally run the tests that were wanted. diff --git a/.circleci/config.yml b/.circleci/config.yml index 63db649e..4a1d063b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -127,6 +127,142 @@ jobs: paths: - "/home/riscvuser/project" + prepare-boomexample: + 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: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the boomexample subproject using Verilator + command: .circleci/do-rtl-build.sh boomexample + no_output_timeout: 120m + + - save_cache: + key: boomexample-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + + prepare-boom: + 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: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the boom subproject using Verilator + command: .circleci/do-rtl-build.sh boom + no_output_timeout: 120m + + - save_cache: + key: boom-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + + prepare-rocketchip: + 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: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the rocketchip subproject using Verilator + command: .circleci/do-rtl-build.sh rocketchip + no_output_timeout: 120m + + - save_cache: + key: rocketchip-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + + prepare-hwacha: + 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: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the hwacha subproject using Verilator + command: .circleci/do-rtl-build.sh hwacha + no_output_timeout: 120m + + - save_cache: + key: hwacha-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + example-run-benchmark-tests: docker: - image: riscvboom/riscvboom-images:0.0.5 @@ -155,6 +291,118 @@ jobs: name: Run example benchmark tests command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example + boomexample-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: + - boomexample-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run boomexample benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boomexample + + boom-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: + - boom-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run boom benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boom + + rocketchip-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: + - rocketchip-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run rocketchip benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=rocketchip + + hwacha-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: + - hwacha-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run hwacha benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha + # Order and dependencies of jobs to run workflows: version: 2 @@ -172,7 +420,27 @@ workflows: - prepare-example: requires: - install-riscv-toolchain - - install-verilator + - install-verilator + + - prepare-boomexample: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-boom: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-rocketchip: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-hwacha: + requires: + - install-riscv-toolchain + - install-verilator # Run the respective tests @@ -181,3 +449,23 @@ workflows: requires: - install-riscv-toolchain - prepare-example + + - boomexample-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-boomexample + + - boom-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-boom + + - rocketchip-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-rocketchip + + - hwacha-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-hwacha diff --git a/README.md b/README.md index 7748e53e..9e2b31fa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RISC-V Project Template +# RISC-V Project Template [![CircleCI](https://circleci.com/gh/ucb-bar/project-template/tree/master.svg?style=svg)](https://circleci.com/gh/ucb-bar/project-template/tree/master) **This branch is under development** **It currently has many submodules** From e1292fdfa86f2164bd68327e1d0e80fd0e616988 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sun, 12 May 2019 13:11:06 -0700 Subject: [PATCH 11/18] revert to smaller boom config and support in ci --- .circleci/config.yml | 2 +- .circleci/do-rtl-build.sh | 18 ++++++++++++++++-- .../example/src/main/scala/Configs.scala | 8 ++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a1d063b..c9d75d98 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -153,7 +153,7 @@ jobs: - run: name: Building the boomexample subproject using Verilator - command: .circleci/do-rtl-build.sh boomexample + command: .circleci/do-rtl-build.sh boomexample SmallDefaultBoomConfig no_output_timeout: 120m - save_cache: diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 02d02984..e7056e53 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -1,6 +1,8 @@ #!/bin/bash -# create the different verilator builds arg (subproject) +# create the different verilator builds +# 1st argument is the subproject +# 2nd argument is the config (can be unspecified) # turn echo on and error on earliest command set -ex @@ -12,6 +14,18 @@ cd $HOME/project # enter the verisim directory and build the specific config cd sims/verisim make clean -make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M" + +# run the particular build command +if [ $# -ne 0 ]; then + if [ $# -eq 1 ]; then + make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M" + elif [ $# -eq 2 ]; then + make SUB_PROJECT=$1 CONFIG=$2 JAVA_ARGS="-Xmx2G -Xss8M" + else + exit 1 # wrong amount of args + fi +else + exit 1 # need to provide at least the arg +fi rm -rf ../../project diff --git a/generators/example/src/main/scala/Configs.scala b/generators/example/src/main/scala/Configs.scala index 4b6f1dcb..dc0a07ba 100644 --- a/generators/example/src/main/scala/Configs.scala +++ b/generators/example/src/main/scala/Configs.scala @@ -68,10 +68,18 @@ class BaseBoomConfig extends Config( new WithBootROM ++ new boom.system.BoomConfig) +class SmallBaseBoomConfig extends Config( + new WithBootROM ++ + new boom.system.SmallBoomConfig) + class DefaultBoomConfig extends Config( new WithNormalBoomTop ++ new BaseBoomConfig) +class SmallDefaultBoomConfig extends Config( + new WithNormalBoomTop ++ + new SmallBaseBoomConfig) + class HwachaBoomConfig extends Config( new hwacha.DefaultHwachaConfig ++ new DefaultBoomConfig) From 2697cdc29b4c7fd16cd15282ab0d6fd47a5c6d22 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sun, 12 May 2019 14:09:12 -0700 Subject: [PATCH 12/18] add small config string to config.yml --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9d75d98..b0e8cf8b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -317,7 +317,7 @@ jobs: - run: name: Run boomexample benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boomexample + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boomexample CONFIG=SmallDefaultBoomConfig boom-run-benchmark-tests: docker: From 2d644f1352666ba4de2617ac246553c295c14bc0 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 13 May 2019 09:50:55 -0700 Subject: [PATCH 13/18] make hwacha smaller --- .circleci/config.yml | 6 +++--- .circleci/do-rtl-build.sh | 7 ++++--- generators/example/src/main/scala/Configs.scala | 5 +++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b0e8cf8b..5eda3c15 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -153,7 +153,7 @@ jobs: - run: name: Building the boomexample subproject using Verilator - command: .circleci/do-rtl-build.sh boomexample SmallDefaultBoomConfig + command: .circleci/do-rtl-build.sh boomexample example SmallDefaultBoomConfig no_output_timeout: 120m - save_cache: @@ -255,7 +255,7 @@ jobs: - run: name: Building the hwacha subproject using Verilator - command: .circleci/do-rtl-build.sh hwacha + command: .circleci/do-rtl-build.sh hwacha example SmallHwachaConfig no_output_timeout: 120m - save_cache: @@ -401,7 +401,7 @@ jobs: - run: name: Run hwacha benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha CONFIG_PACKAGE=example CONFIG=SmallHwachaConfig # Order and dependencies of jobs to run workflows: diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index e7056e53..eabce7c1 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -2,7 +2,8 @@ # create the different verilator builds # 1st argument is the subproject -# 2nd argument is the config (can be unspecified) +# 2nd argument is the config package (can be unspecified) +# 3nd argument is the config (can be unspecified) # turn echo on and error on earliest command set -ex @@ -19,8 +20,8 @@ make clean if [ $# -ne 0 ]; then if [ $# -eq 1 ]; then make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M" - elif [ $# -eq 2 ]; then - make SUB_PROJECT=$1 CONFIG=$2 JAVA_ARGS="-Xmx2G -Xss8M" + elif [ $# -eq 3 ]; then + make SUB_PROJECT=$1 CONFIG_PACKAGE=$2 CONFIG=$3 JAVA_ARGS="-Xmx2G -Xss8M" else exit 1 # wrong amount of args fi diff --git a/generators/example/src/main/scala/Configs.scala b/generators/example/src/main/scala/Configs.scala index dc0a07ba..90b6cf89 100644 --- a/generators/example/src/main/scala/Configs.scala +++ b/generators/example/src/main/scala/Configs.scala @@ -21,6 +21,11 @@ class HwachaConfig extends Config( new hwacha.DefaultHwachaConfig ++ new DefaultRocketConfig) +class SmallHwachaConfig extends Config( + new hwacha.WithNBanks(1) ++ + new hwacha.DefaultHwachaConfig ++ + new DefaultConfig) + class RoccRocketConfig extends Config( new WithRoccExample ++ new DefaultRocketConfig) From 12265912311b6f0e645fb9edd7cbbfe1ffd115a3 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 13 May 2019 10:27:36 -0700 Subject: [PATCH 14/18] use example config for hwacha (otherwise use other hwacha params) --- .circleci/config.yml | 12 ++++++------ .circleci/do-rtl-build.sh | 16 ++-------------- generators/example/src/main/scala/Configs.scala | 6 +++--- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5eda3c15..61b62e17 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -119,7 +119,7 @@ jobs: - run: name: Building the example subproject using Verilator - command: .circleci/do-rtl-build.sh example + command: .circleci/do-rtl-build.sh SUB_PROJECT=example no_output_timeout: 120m - save_cache: @@ -153,7 +153,7 @@ jobs: - run: name: Building the boomexample subproject using Verilator - command: .circleci/do-rtl-build.sh boomexample example SmallDefaultBoomConfig + command: .circleci/do-rtl-build.sh SUB_PROJECT=boomexample CONFIG=SmallDefaultBoomConfig no_output_timeout: 120m - save_cache: @@ -187,7 +187,7 @@ jobs: - run: name: Building the boom subproject using Verilator - command: .circleci/do-rtl-build.sh boom + command: .circleci/do-rtl-build.sh SUB_PROJECT=boom no_output_timeout: 120m - save_cache: @@ -221,7 +221,7 @@ jobs: - run: name: Building the rocketchip subproject using Verilator - command: .circleci/do-rtl-build.sh rocketchip + command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip no_output_timeout: 120m - save_cache: @@ -255,7 +255,7 @@ jobs: - run: name: Building the hwacha subproject using Verilator - command: .circleci/do-rtl-build.sh hwacha example SmallHwachaConfig + command: .circleci/do-rtl-build.sh SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallHwachaConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem no_output_timeout: 120m - save_cache: @@ -401,7 +401,7 @@ jobs: - run: name: Run hwacha benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha CONFIG_PACKAGE=example CONFIG=SmallHwachaConfig + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallHwachaConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem # Order and dependencies of jobs to run workflows: diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index eabce7c1..51ad760b 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -1,9 +1,7 @@ #!/bin/bash # create the different verilator builds -# 1st argument is the subproject -# 2nd argument is the config package (can be unspecified) -# 3nd argument is the config (can be unspecified) +# argument is the make command string # turn echo on and error on earliest command set -ex @@ -17,16 +15,6 @@ cd sims/verisim make clean # run the particular build command -if [ $# -ne 0 ]; then - if [ $# -eq 1 ]; then - make SUB_PROJECT=$1 JAVA_ARGS="-Xmx2G -Xss8M" - elif [ $# -eq 3 ]; then - make SUB_PROJECT=$1 CONFIG_PACKAGE=$2 CONFIG=$3 JAVA_ARGS="-Xmx2G -Xss8M" - else - exit 1 # wrong amount of args - fi -else - exit 1 # need to provide at least the arg -fi +make JAVA_ARGS="-Xmx2G -Xss8M" $@ rm -rf ../../project diff --git a/generators/example/src/main/scala/Configs.scala b/generators/example/src/main/scala/Configs.scala index 90b6cf89..aa9e6e3f 100644 --- a/generators/example/src/main/scala/Configs.scala +++ b/generators/example/src/main/scala/Configs.scala @@ -2,7 +2,7 @@ package example import chisel3._ import freechips.rocketchip.config.{Config} -import freechips.rocketchip.subsystem.{WithRoccExample, WithNMemoryChannels, WithNBigCores, WithRV32, WithExtMemSize} +import freechips.rocketchip.subsystem.{WithRoccExample, WithNMemoryChannels, WithNBigCores, WithRV32, WithExtMemSize, WithNBanks} import testchipip._ // -------------- @@ -22,9 +22,9 @@ class HwachaConfig extends Config( new DefaultRocketConfig) class SmallHwachaConfig extends Config( - new hwacha.WithNBanks(1) ++ + new WithNBanks(1) ++ new hwacha.DefaultHwachaConfig ++ - new DefaultConfig) + new freechips.rocketchip.system.DefaultConfig) class RoccRocketConfig extends Config( new WithRoccExample ++ From a377c520a6c453ea8ce10ba1dbcbf8732ff24891 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 13 May 2019 13:34:29 -0700 Subject: [PATCH 15/18] smaller rocket For hwacha ci --- .circleci/config.yml | 4 +- .../example/src/main/scala/ConfigMixins.scala | 37 ++++++++++++++++++- .../example/src/main/scala/Configs.scala | 5 ++- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 61b62e17..b6273995 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -255,7 +255,7 @@ jobs: - run: name: Building the hwacha subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallHwachaConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem + command: .circleci/do-rtl-build.sh SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallRocketForHwachaCIConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem no_output_timeout: 120m - save_cache: @@ -401,7 +401,7 @@ jobs: - run: name: Run hwacha benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallHwachaConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallRocketForHwachaCIConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem # Order and dependencies of jobs to run workflows: diff --git a/generators/example/src/main/scala/ConfigMixins.scala b/generators/example/src/main/scala/ConfigMixins.scala index e9b113b1..0b168868 100644 --- a/generators/example/src/main/scala/ConfigMixins.scala +++ b/generators/example/src/main/scala/ConfigMixins.scala @@ -2,10 +2,11 @@ package example import chisel3._ import freechips.rocketchip.config.{Parameters, Config} -import freechips.rocketchip.subsystem.{WithRoccExample, WithNMemoryChannels, WithNBigCores, WithRV32} +import freechips.rocketchip.subsystem.{SystemBusKey, RocketTilesKey, CacheBlockBytes, WithRoccExample, WithNMemoryChannels, WithNBigCores, WithRV32} import freechips.rocketchip.diplomacy.{LazyModule, ValName} import freechips.rocketchip.devices.tilelink.BootROMParams -import freechips.rocketchip.tile.XLen +import freechips.rocketchip.tile.{XLen, RocketTileParams} +import freechips.rocketchip.rocket.{RocketCoreParams, DCacheParams, ICacheParams, MulDivParams} import testchipip._ import sifive.blocks.devices.gpio._ @@ -168,3 +169,35 @@ class WithGPIOBoomTop extends Config((site, here, up) => { top } }) + +// ------------- +// Mixins for CI +// ------------- + +/** + * Class to specify a smaller Rocket core for Hwacha CI + */ +class WithNHwachaSmallCores(n: Int) extends Config((site, here, up) => { + case RocketTilesKey => { + val small = RocketTileParams( + core = RocketCoreParams(mulDiv = Some(MulDivParams( + mulUnroll = 8, + mulEarlyOut = true, + divEarlyOut = true))), + btb = None, + dcache = Some(DCacheParams( + rowBits = site(SystemBusKey).beatBits, + nSets = 32, + nWays = 1, + nTLBEntries = 4, + nMSHRs = 0, + blockBytes = site(CacheBlockBytes))), + icache = Some(ICacheParams( + rowBits = site(SystemBusKey).beatBits, + nSets = 32, + nWays = 1, + nTLBEntries = 4, + blockBytes = site(CacheBlockBytes)))) + List.tabulate(n)(i => small.copy(hartId = i)) + } +}) diff --git a/generators/example/src/main/scala/Configs.scala b/generators/example/src/main/scala/Configs.scala index aa9e6e3f..544ac27f 100644 --- a/generators/example/src/main/scala/Configs.scala +++ b/generators/example/src/main/scala/Configs.scala @@ -21,10 +21,11 @@ class HwachaConfig extends Config( new hwacha.DefaultHwachaConfig ++ new DefaultRocketConfig) -class SmallHwachaConfig extends Config( +class SmallRocketForHwachaCIConfig extends Config( new WithNBanks(1) ++ + new WithNHwachaSmallCores(1) ++ new hwacha.DefaultHwachaConfig ++ - new freechips.rocketchip.system.DefaultConfig) + new DefaultRocketConfig) class RoccRocketConfig extends Config( new WithRoccExample ++ From 7ba56b58d35ec4802bf7cfa7b2293b214c475c52 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 13 May 2019 14:15:05 -0700 Subject: [PATCH 16/18] for now just support verilog build of hwacha (no tests run on it) --- .circleci/config.yml | 64 +++++++++---------- .../example/src/main/scala/ConfigMixins.scala | 37 +---------- .../example/src/main/scala/Configs.scala | 6 -- 3 files changed, 34 insertions(+), 73 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b6273995..dfc39518 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -255,7 +255,7 @@ jobs: - run: name: Building the hwacha subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallRocketForHwachaCIConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem + command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha verilog no_output_timeout: 120m - save_cache: @@ -375,33 +375,33 @@ jobs: name: Run rocketchip benchmark tests command: make run-bmark-tests -C sims/verisim SUB_PROJECT=rocketchip - hwacha-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: - - hwacha-{{ .Branch }}-{{ .Revision }} - - - run: - name: Run hwacha benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example MODEL=TestHarness MODEL_PACKAGE=freechips.rocketchip.system CONFIG=SmallRocketForHwachaCIConfig CONFIG_PACKAGE=example GENERATOR_PACKAGE=hwacha TOP=ExampleRocketSystem +# hwacha-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: +# - hwacha-{{ .Branch }}-{{ .Revision }} +# +# - run: +# name: Run hwacha benchmark tests +# command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha # Order and dependencies of jobs to run workflows: @@ -465,7 +465,7 @@ workflows: - install-riscv-toolchain - prepare-rocketchip - - hwacha-run-benchmark-tests: - requires: - - install-riscv-toolchain - - prepare-hwacha +# - hwacha-run-benchmark-tests: +# requires: +# - install-riscv-toolchain +# - prepare-hwacha diff --git a/generators/example/src/main/scala/ConfigMixins.scala b/generators/example/src/main/scala/ConfigMixins.scala index 0b168868..5551a66d 100644 --- a/generators/example/src/main/scala/ConfigMixins.scala +++ b/generators/example/src/main/scala/ConfigMixins.scala @@ -2,11 +2,10 @@ package example import chisel3._ import freechips.rocketchip.config.{Parameters, Config} -import freechips.rocketchip.subsystem.{SystemBusKey, RocketTilesKey, CacheBlockBytes, WithRoccExample, WithNMemoryChannels, WithNBigCores, WithRV32} +import freechips.rocketchip.subsystem.{WithRoccExample, WithNMemoryChannels, WithNBigCores, WithRV32} import freechips.rocketchip.diplomacy.{LazyModule, ValName} import freechips.rocketchip.devices.tilelink.BootROMParams -import freechips.rocketchip.tile.{XLen, RocketTileParams} -import freechips.rocketchip.rocket.{RocketCoreParams, DCacheParams, ICacheParams, MulDivParams} +import freechips.rocketchip.tile.{XLen} import testchipip._ import sifive.blocks.devices.gpio._ @@ -169,35 +168,3 @@ class WithGPIOBoomTop extends Config((site, here, up) => { top } }) - -// ------------- -// Mixins for CI -// ------------- - -/** - * Class to specify a smaller Rocket core for Hwacha CI - */ -class WithNHwachaSmallCores(n: Int) extends Config((site, here, up) => { - case RocketTilesKey => { - val small = RocketTileParams( - core = RocketCoreParams(mulDiv = Some(MulDivParams( - mulUnroll = 8, - mulEarlyOut = true, - divEarlyOut = true))), - btb = None, - dcache = Some(DCacheParams( - rowBits = site(SystemBusKey).beatBits, - nSets = 32, - nWays = 1, - nTLBEntries = 4, - nMSHRs = 0, - blockBytes = site(CacheBlockBytes))), - icache = Some(ICacheParams( - rowBits = site(SystemBusKey).beatBits, - nSets = 32, - nWays = 1, - nTLBEntries = 4, - blockBytes = site(CacheBlockBytes)))) - List.tabulate(n)(i => small.copy(hartId = i)) - } -}) diff --git a/generators/example/src/main/scala/Configs.scala b/generators/example/src/main/scala/Configs.scala index 544ac27f..68ca289c 100644 --- a/generators/example/src/main/scala/Configs.scala +++ b/generators/example/src/main/scala/Configs.scala @@ -21,12 +21,6 @@ class HwachaConfig extends Config( new hwacha.DefaultHwachaConfig ++ new DefaultRocketConfig) -class SmallRocketForHwachaCIConfig extends Config( - new WithNBanks(1) ++ - new WithNHwachaSmallCores(1) ++ - new hwacha.DefaultHwachaConfig ++ - new DefaultRocketConfig) - class RoccRocketConfig extends Config( new WithRoccExample ++ new DefaultRocketConfig) From 59acd688e62970d5130a7cd4b2ebbd6d28888feb Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 13 May 2019 14:16:11 -0700 Subject: [PATCH 17/18] clearer job naming for verilog only hwacha --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index dfc39518..7b1ed7a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -229,7 +229,7 @@ jobs: paths: - "/home/riscvuser/project" - prepare-hwacha: + prepare-hwacha-verilog-only: docker: - image: riscvboom/riscvboom-images:0.0.5 environment: @@ -437,7 +437,7 @@ workflows: - install-riscv-toolchain - install-verilator - - prepare-hwacha: + - prepare-hwacha-verilog-only: requires: - install-riscv-toolchain - install-verilator From deccae4959350fbb820c30032b358ac95f306dc6 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 13 May 2019 17:17:32 -0700 Subject: [PATCH 18/18] hwacha depends on esp-tools | support java args --- .circleci/config.yml | 6 ++++-- variables.mk | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b1ed7a9..1e5146bb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -439,7 +439,8 @@ workflows: - prepare-hwacha-verilog-only: requires: - - install-riscv-toolchain + - install-riscv-toolchain # TODO: Remove when esp-tools is used + - install-esp-toolchain - install-verilator # Run the respective tests @@ -467,5 +468,6 @@ workflows: # - hwacha-run-benchmark-tests: # requires: -# - install-riscv-toolchain +# - install-riscv-toolchain # TODO: Remove when esp-tools is used +# - install-esp-toolchain # - prepare-hwacha diff --git a/variables.mk b/variables.mk index 15839578..94709245 100644 --- a/variables.mk +++ b/variables.mk @@ -122,13 +122,18 @@ sim_dotf ?= $(build_dir)/sim_files.f sim_harness_blackboxes ?= $(build_dir)/firrtl_black_box_resource_files.harness.f sim_top_blackboxes ?= $(build_dir)/firrtl_black_box_resource_files.top.f +######################################################################################### +# java arguments used in sbt +######################################################################################### +JAVA_ARGS ?= -Xmx8G -Xss8M -XX:MaxPermSize=256M + ######################################################################################### # default sbt launch command ######################################################################################### SCALA_VERSION=2.12.4 SCALA_VERSION_MAJOR=$(basename $(SCALA_VERSION)) -SBT ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar $(ROCKETCHIP_DIR)/sbt-launch.jar ++$(SCALA_VERSION) +SBT ?= java $(JAVA_ARGS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar ++$(SCALA_VERSION) ######################################################################################### # output directory for tests