From 00d59bd25d0202548720f742209dd2ba28c827be Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 16:03:25 -0700 Subject: [PATCH 01/30] use remote build server --- .circleci/build-toolchains.sh | 3 +- .circleci/build-verilator.sh | 26 +++- .circleci/config.yml | 224 ++++++++++------------------------ .circleci/defaults.sh | 28 +++++ .circleci/do-rtl-build.sh | 35 ++++-- 5 files changed, 141 insertions(+), 175 deletions(-) create mode 100755 .circleci/defaults.sh diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh index 9b5477f6..6965da30 100755 --- a/.circleci/build-toolchains.sh +++ b/.circleci/build-toolchains.sh @@ -7,8 +7,7 @@ set -ex if [ ! -d "$HOME/$1-install" ]; then - - cd $HOME/ + cd $HOME # init all submodules including the tools CHIPYARD_DIR=$HOME/project ./project/scripts/build-toolchains.sh $1 diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh index 00cd7217..5a837e1f 100755 --- a/.circleci/build-verilator.sh +++ b/.circleci/build-verilator.sh @@ -5,11 +5,27 @@ # turn echo on and error on earliest command set -ex -cd $HOME/project +# get shared variables +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +source $SCRIPT_DIR/defaults.sh -cd sims/verisim +# call clean on exit +trap clean EXIT -if [ ! -d "$HOME/project/sims/verisim/verilator" ]; then - # make verilator - make verilator_install +if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then + # set stricthostkeychecking to no (must happen before rsync) + run "echo \"Ping $SERVER\"" + + clean + + run "mkdir -p $REMOTE_CHIPYARD_DIR" + copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR + + run "make -C $REMOTE_CHIPYARD_DIR/sims/verisim VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR verilator_install" + + # copy so that circleci can cache + mkdir -p $LOCAL_CHIPYARD_DIR + mkdir -p $LOCAL_VERILATOR_DIR + copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR + copy $SERVER:$REMOTE_VERILATOR_DIR/ $LOCAL_VERILATOR_DIR fi diff --git a/.circleci/config.yml b/.circleci/config.yml index 61e73e54..0e971f74 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,479 +7,387 @@ version: 2 jobs: commit-on-master-check: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code - checkout - - run: name: Check commits of each submodule command: | .circleci/check-commit.sh - install-riscv-toolchain: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 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" }} - - run: name: Building riscv-tools toolchain command: | .circleci/build-toolchains.sh riscv-tools no_output_timeout: 120m - - save_cache: key: riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} paths: - "/home/riscvuser/riscv-tools-install" - install-esp-toolchain: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 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: - "/home/riscvuser/esp-tools-install" - install-verilator: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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" - + - "/home/riscvuser/verilator" prepare-example: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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 example subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example no_output_timeout: 120m - - save_cache: key: example-{{ .Branch }}-{{ .Revision }} paths: - "/home/riscvuser/project" - prepare-boomexample: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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 SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig no_output_timeout: 120m - - save_cache: key: boomexample-{{ .Branch }}-{{ .Revision }} paths: - "/home/riscvuser/project" - prepare-boomrocketexample: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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 boomrocketexample subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig no_output_timeout: 120m - - save_cache: key: boomrocketexample-{{ .Branch }}-{{ .Revision }} paths: - "/home/riscvuser/project" - prepare-boom: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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 SUB_PROJECT=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 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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 SUB_PROJECT=rocketchip no_output_timeout: 120m - - save_cache: key: rocketchip-{{ .Branch }}-{{ .Revision }} paths: - "/home/riscvuser/project" - - prepare-hwacha-verilog-only: + prepare-hwacha: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 environment: JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit TERM: dumb - steps: - # Checkout the code + - add_ssh_keys: + fingerprints: + - "3e:c3:02:5b:ed:64:8c:b7:b0:04:43:bc:83:43:73:1e" - 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 SUB_PROJECT=hwacha verilog + command: .circleci/do-rtl-build.sh SUB_PROJECT=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 + - image: riscvboom/riscvboom-images:0.0.10 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: - example-{{ .Branch }}-{{ .Revision }} - - run: 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 + - image: riscvboom/riscvboom-images:0.0.10 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=example CONFIG=SmallDefaultBoomConfig - boomrocketexample-run-benchmark-tests: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 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: - boomrocketexample-{{ .Branch }}-{{ .Revision }} - - run: name: Run boomrocketexample benchmark tests command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig - boom-run-benchmark-tests: docker: - - image: riscvboom/riscvboom-images:0.0.5 + - image: riscvboom/riscvboom-images:0.0.10 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 + - image: riscvboom/riscvboom-images:0.0.10 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 + hwacha-run-benchmark-tests: + docker: + - image: riscvboom/riscvboom-images:0.0.10 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + steps: + - checkout + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + - restore_cache: + keys: + - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} + - restore_cache: + keys: + - hwacha-{{ .Branch }}-{{ .Revision }} + - run: + name: Run hwacha benchmark tests + command: export RISCV=/home/riscvuser/esp-tools-install; export LD_LIBRARY_PATH=$RISCV/lib; make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha # Order and dependencies of jobs to run workflows: @@ -523,9 +431,8 @@ workflows: - install-riscv-toolchain - install-verilator - - prepare-hwacha-verilog-only: + - prepare-hwacha: requires: - - install-riscv-toolchain # TODO: Remove when esp-tools is used - install-esp-toolchain - install-verilator @@ -557,8 +464,7 @@ workflows: - install-riscv-toolchain - prepare-rocketchip -# - hwacha-run-benchmark-tests: -# requires: -# - install-riscv-toolchain # TODO: Remove when esp-tools is used -# - install-esp-toolchain -# - prepare-hwacha + - hwacha-run-benchmark-tests: + requires: + - install-esp-toolchain + - prepare-hwacha diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh new file mode 100755 index 00000000..78c4a350 --- /dev/null +++ b/.circleci/defaults.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +copy () { + rsync -avzp -e 'ssh' $1 $2 +} + +run () { + ssh -o "StrictHostKeyChecking no" -t $SERVER $1 +} + +clean () { + # remove remote work dir + run "rm -rf $REMOTE_WORK_DIR" +} + +# remote variables +REMOTE_WORK_DIR=$CI_DIR/$CIRCLE_PROJECT_REPONAME-$CIRCLE_BRANCH-$CIRCLE_SHA1-$CIRCLE_JOB +REMOTE_RISCV_DIR=$REMOTE_WORK_DIR/riscv-tools-install +REMOTE_CHIPYARD_DIR=$REMOTE_WORK_DIR/chipyard +REMOTE_VERILATOR_DIR=$REMOTE_WORK_DIR/verilator +REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verisim + +# local variables (aka within the docker container) +LOCAL_CHECKOUT_DIR=$HOME/project +LOCAL_RISCV_DIR=$HOME/riscv-tools-install +LOCAL_CHIPYARD_DIR=$HOME/chipyard +LOCAL_VERILATOR_DIR=$HOME/verilator +LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verisim diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 51ad760b..af46dbcb 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -6,15 +6,32 @@ # turn echo on and error on earliest command set -ex -# init all submodules -cd $HOME/project -./scripts/init-submodules-no-riscv-tools.sh +# get shared variables +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +source $SCRIPT_DIR/defaults.sh -# enter the verisim directory and build the specific config -cd sims/verisim -make clean +# call clean on exit +trap clean EXIT -# run the particular build command -make JAVA_ARGS="-Xmx2G -Xss8M" $@ +# set stricthostkeychecking to no (must happen before rsync) +run "echo \"Ping $SERVER\"" -rm -rf ../../project +clean + +# copy over riscv-tools, verilator, and chipyard to remote +run "mkdir -p $REMOTE_RISCV_DIR" +run "mkdir -p $REMOTE_CHIPYARD_DIR" +run "mkdir -p $REMOTE_VERILATOR_DIR" +copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR +copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR +copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR + +# enter the verisim directory and build the specific config on remote server +run "cd $REMOTE_CHIPYARD_DIR && ./scripts/init-submodules-no-riscv-tools.sh" +run "make -C $REMOTE_SIM_DIR clean" +run "export RISCV=\"$REMOTE_RISCV_DIR\"; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" SUB_PROJECT=boom CONFIG=$1 TOP=BoomRocketSystem" +run "rm -rf $REMOTE_CHIPYARD_DIR/project" + +# copy back the final build +mkdir -p $LOCAL_CHIPYARD_DIR +copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR From 3e59bc07251ee93db2845fcc5665eda2693c55a2 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 16:15:04 -0700 Subject: [PATCH 02/30] update the readme --- .circleci/README.md | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/.circleci/README.md b/.circleci/README.md index 018b4b57..83fd3264 100644 --- a/.circleci/README.md +++ b/.circleci/README.md @@ -1,7 +1,7 @@ Chipyard CI =========== -Website: https://circleci.com/gh/ucb-bar/project-template +Website: https://circleci.com/gh/ucb-bar/chipyard CircleCI Brief Explanation --------------------------- @@ -35,11 +35,12 @@ Here the key is built from a string where the `checksum` portion converts the fi 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 - 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 + `build-toolchains.sh` # build either riscv-tools or esp-tools + `build-verilator.sh` # build verilator (remotely) + `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 How things are setup for Chipyard --------------------------------- @@ -52,3 +53,18 @@ The docker image sets up the `PATH` and `RISCV` variable so that `riscv-tools` i 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. + +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. From 4963b607e1533a4a65476cc9e17e95f766385104 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 16:22:29 -0700 Subject: [PATCH 03/30] remove extra dependencies --- .circleci/config.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e971f74..ad81f5fc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -441,30 +441,24 @@ workflows: # Run the example tests - example-run-benchmark-tests: requires: - - install-riscv-toolchain - prepare-example - boomexample-run-benchmark-tests: requires: - - install-riscv-toolchain - prepare-boomexample - boomrocketexample-run-benchmark-tests: requires: - - install-riscv-toolchain - prepare-boomrocketexample - 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-esp-toolchain - prepare-hwacha From f5a3ff3ac542591afa01a7d3458a11f3df72d8b8 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 16:31:36 -0700 Subject: [PATCH 04/30] update variables | add more repos to commit check --- .circleci/build-toolchains.sh | 6 +++++- .circleci/check-commit.sh | 8 ++++++-- .circleci/create-hash.sh | 6 +++++- .circleci/defaults.sh | 4 +++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.circleci/build-toolchains.sh b/.circleci/build-toolchains.sh index 6965da30..d0be57c2 100755 --- a/.circleci/build-toolchains.sh +++ b/.circleci/build-toolchains.sh @@ -6,9 +6,13 @@ # 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=$HOME/project ./project/scripts/build-toolchains.sh $1 + CHIPYARD_DIR=$LOCAL_CHIPYARD_DIR .$LOCAL_CHIPYARD_DIR/scripts/build-toolchains.sh $1 fi diff --git a/.circleci/check-commit.sh b/.circleci/check-commit.sh index ea7e30f5..4ad48ed5 100755 --- a/.circleci/check-commit.sh +++ b/.circleci/check-commit.sh @@ -5,8 +5,12 @@ # 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 $HOME/project +cd $LOCAL_CHIPYARD_DIR # initialize submodules and get the hashes git submodule update --init @@ -22,7 +26,7 @@ search () { done } -submodules=("boom" "hwacha" "rocket-chip" "sifive-blocks" "testchipip") +submodules=("boom" "firechip" "hwacha" "icenet" "rocket-chip" "sifive-blocks" "sifive-cache" "testchipip") dir="generators" search diff --git a/.circleci/create-hash.sh b/.circleci/create-hash.sh index 2aff9727..84a75244 100755 --- a/.circleci/create-hash.sh +++ b/.circleci/create-hash.sh @@ -5,8 +5,12 @@ # 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 $HOME/project +cd $LOCAL_CHIPYARD_DIR # 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 diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index 78c4a350..b639009e 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -16,6 +16,7 @@ clean () { # remote variables REMOTE_WORK_DIR=$CI_DIR/$CIRCLE_PROJECT_REPONAME-$CIRCLE_BRANCH-$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_VERILATOR_DIR=$REMOTE_WORK_DIR/verilator REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verisim @@ -23,6 +24,7 @@ REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verisim # local variables (aka within the docker container) LOCAL_CHECKOUT_DIR=$HOME/project LOCAL_RISCV_DIR=$HOME/riscv-tools-install -LOCAL_CHIPYARD_DIR=$HOME/chipyard +LOCAL_ESP_DIR=$HOME/esp-tools-install +LOCAL_CHIPYARD_DIR=$LOCAL_CHECKOUT_DIR LOCAL_VERILATOR_DIR=$HOME/verilator LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verisim From 1094b5723e3c4f171e66d471cacb7077e6c2fb69 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 16:50:02 -0700 Subject: [PATCH 05/30] bump verilator cache --- .circleci/config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ad81f5fc..94584c8a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -78,14 +78,14 @@ jobs: - checkout - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ 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" }} + key: verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} paths: - "/home/riscvuser/verilator" prepare-example: @@ -108,7 +108,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the example subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example @@ -137,7 +137,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomexample subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig @@ -166,7 +166,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomrocketexample subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig @@ -195,7 +195,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boom subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=boom @@ -224,7 +224,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the rocketchip subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip @@ -253,7 +253,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the hwacha subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha From 64daa500a057962e073ff6b0c6abbbb78be41baf Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 17:31:04 -0700 Subject: [PATCH 06/30] pass in all args for rtl build --- .circleci/do-rtl-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index af46dbcb..30790e38 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -29,7 +29,7 @@ copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR # enter the verisim directory and build the specific config on remote server run "cd $REMOTE_CHIPYARD_DIR && ./scripts/init-submodules-no-riscv-tools.sh" run "make -C $REMOTE_SIM_DIR clean" -run "export RISCV=\"$REMOTE_RISCV_DIR\"; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" SUB_PROJECT=boom CONFIG=$1 TOP=BoomRocketSystem" +run "export RISCV=\"$REMOTE_RISCV_DIR\"; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $@" run "rm -rf $REMOTE_CHIPYARD_DIR/project" # copy back the final build From 847a874762ecfbbc30cc62f7652df90c823a06df Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 18:26:37 -0700 Subject: [PATCH 07/30] pass correct verilator root --- .circleci/do-rtl-build.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 30790e38..85bbc3ec 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -13,6 +13,9 @@ source $SCRIPT_DIR/defaults.sh # call clean on exit trap clean EXIT +cd $LOCAL_CHIPYARD_DIR +./scripts/init-submodules-no-riscv-tools.sh + # set stricthostkeychecking to no (must happen before rsync) run "echo \"Ping $SERVER\"" @@ -27,9 +30,8 @@ copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR # enter the verisim directory and build the specific config on remote server -run "cd $REMOTE_CHIPYARD_DIR && ./scripts/init-submodules-no-riscv-tools.sh" run "make -C $REMOTE_SIM_DIR clean" -run "export RISCV=\"$REMOTE_RISCV_DIR\"; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $@" +run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $@" run "rm -rf $REMOTE_CHIPYARD_DIR/project" # copy back the final build From 72f4941d4bce1b8352c3d6cc3d11488dfdef62ce Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 18:43:22 -0700 Subject: [PATCH 08/30] update verilator_root --- .circleci/do-rtl-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 85bbc3ec..8ead657b 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -31,7 +31,7 @@ copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR # enter the verisim directory and build the specific config on remote server run "make -C $REMOTE_SIM_DIR clean" -run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $@" +run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $@" run "rm -rf $REMOTE_CHIPYARD_DIR/project" # copy back the final build From 82e781420550592703e880766f5fcbfef1e38eec Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 23:38:25 -0700 Subject: [PATCH 09/30] add cleanup script | fix verilator unknown bin --- .circleci/build-verilator.sh | 4 ++++ .circleci/clean-old-files.sh | 30 ++++++++++++++++++++++++++++++ .circleci/config.yml | 16 ++++++++-------- .circleci/defaults.sh | 4 ++++ 4 files changed, 46 insertions(+), 8 deletions(-) create mode 100755 .circleci/clean-old-files.sh diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh index 5a837e1f..673ae527 100755 --- a/.circleci/build-verilator.sh +++ b/.circleci/build-verilator.sh @@ -12,6 +12,8 @@ source $SCRIPT_DIR/defaults.sh # call clean on exit trap clean EXIT +run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh + if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then # set stricthostkeychecking to no (must happen before rsync) run "echo \"Ping $SERVER\"" @@ -28,4 +30,6 @@ if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then mkdir -p $LOCAL_VERILATOR_DIR copy $SERVER:$REMOTE_CHIPYARD_DIR/ $LOCAL_CHIPYARD_DIR copy $SERVER:$REMOTE_VERILATOR_DIR/ $LOCAL_VERILATOR_DIR + + cp -r $LOCAL_VERILATOR_DIR/install/bin/* $LOCAL_VERILATOR_DIR/install/share/verilator/bin/. fi diff --git a/.circleci/clean-old-files.sh b/.circleci/clean-old-files.sh new file mode 100755 index 00000000..0fe4f429 --- /dev/null +++ b/.circleci/clean-old-files.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# clean directories that are older than 30 days + +# get shared variables +SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" +source $SCRIPT_DIR/defaults.sh + +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 $CI_DIR/*/ ; do + DIR_AGE="$(age $d)" + if [ $DIR_AGE -ge 30 ]; then + echo "Deleting $d since is it $DIR_AGE old" + rm -rf $d + fi +done diff --git a/.circleci/config.yml b/.circleci/config.yml index 94584c8a..600cc998 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -78,14 +78,14 @@ jobs: - checkout - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Build Verilator command: | .circleci/build-verilator.sh no_output_timeout: 120m - save_cache: - key: verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + key: verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} paths: - "/home/riscvuser/verilator" prepare-example: @@ -108,7 +108,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the example subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example @@ -137,7 +137,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomexample subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig @@ -166,7 +166,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomrocketexample subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig @@ -195,7 +195,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boom subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=boom @@ -224,7 +224,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the rocketchip subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip @@ -253,7 +253,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v2-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the hwacha subproject using Verilator command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index b639009e..c4d7eb6f 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -8,6 +8,10 @@ run () { ssh -o "StrictHostKeyChecking no" -t $SERVER $1 } +run_script () { + ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 +} + clean () { # remove remote work dir run "rm -rf $REMOTE_WORK_DIR" From fdf0edf8e01afec05d6e7300286bb3bcf6bdd8f6 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Tue, 9 Jul 2019 23:42:04 -0700 Subject: [PATCH 10/30] fix cleanup script --- .circleci/build-verilator.sh | 2 +- .circleci/clean-old-files.sh | 9 ++++----- .circleci/defaults.sh | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh index 673ae527..2c0b6a13 100755 --- a/.circleci/build-verilator.sh +++ b/.circleci/build-verilator.sh @@ -12,7 +12,7 @@ source $SCRIPT_DIR/defaults.sh # call clean on exit trap clean EXIT -run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh +run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh $CI_DIR if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then # set stricthostkeychecking to no (must happen before rsync) diff --git a/.circleci/clean-old-files.sh b/.circleci/clean-old-files.sh index 0fe4f429..96fcf8d7 100755 --- a/.circleci/clean-old-files.sh +++ b/.circleci/clean-old-files.sh @@ -1,10 +1,7 @@ #!/bin/bash # clean directories that are older than 30 days - -# get shared variables -SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" -source $SCRIPT_DIR/defaults.sh +# argument is used as the directory to look in age () { local AGE_SEC @@ -21,10 +18,12 @@ age () { echo $(expr $DIFF_SEC / $SEC_PER_DAY) } -for d in $CI_DIR/*/ ; do +for d in $1/*/ ; do DIR_AGE="$(age $d)" if [ $DIR_AGE -ge 30 ]; 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 diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index c4d7eb6f..accf4ff9 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -9,7 +9,7 @@ run () { } run_script () { - ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 + ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2" } clean () { From 64690459895b2774c29f9415287d1624b60e6772 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 09:29:06 -0700 Subject: [PATCH 11/30] wrap variables in runtest --- .circleci/config.yml | 54 ++++++++++++++++++++++++++++-------------- .circleci/run-tests.sh | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 18 deletions(-) create mode 100755 .circleci/run-tests.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 600cc998..91fd44ca 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -262,7 +262,7 @@ jobs: key: hwacha-{{ .Branch }}-{{ .Revision }} paths: - "/home/riscvuser/project" - example-run-benchmark-tests: + example-run-tests: docker: - image: riscvboom/riscvboom-images:0.0.10 environment: @@ -280,10 +280,13 @@ jobs: - restore_cache: keys: - example-{{ .Branch }}-{{ .Revision }} + - restore_cache: + keys: + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run example benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example - boomexample-run-benchmark-tests: + command: .circleci/run-tests.sh example + boomexample-run-tests: docker: - image: riscvboom/riscvboom-images:0.0.10 environment: @@ -301,10 +304,13 @@ jobs: - restore_cache: keys: - boomexample-{{ .Branch }}-{{ .Revision }} + - restore_cache: + keys: + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run boomexample benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig - boomrocketexample-run-benchmark-tests: + command: .circleci/run-tests.sh boomexample + boomrocketexample-run-tests: docker: - image: riscvboom/riscvboom-images:0.0.10 environment: @@ -322,10 +328,13 @@ jobs: - restore_cache: keys: - boomrocketexample-{{ .Branch }}-{{ .Revision }} + - restore_cache: + keys: + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run boomrocketexample benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig - boom-run-benchmark-tests: + command: .circleci/run-tests.sh boomrocketexample + boom-run-tests: docker: - image: riscvboom/riscvboom-images:0.0.10 environment: @@ -343,10 +352,13 @@ jobs: - restore_cache: keys: - boom-{{ .Branch }}-{{ .Revision }} + - restore_cache: + keys: + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run boom benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boom - rocketchip-run-benchmark-tests: + command: .circleci/run-tests.sh boom + rocketchip-run-tests: docker: - image: riscvboom/riscvboom-images:0.0.10 environment: @@ -364,10 +376,13 @@ jobs: - restore_cache: keys: - rocketchip-{{ .Branch }}-{{ .Revision }} + - restore_cache: + keys: + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run rocketchip benchmark tests - command: make run-bmark-tests -C sims/verisim SUB_PROJECT=rocketchip - hwacha-run-benchmark-tests: + command: .circleci/run-tests.sh rocketchip + hwacha-run-tests: docker: - image: riscvboom/riscvboom-images:0.0.10 environment: @@ -385,9 +400,12 @@ jobs: - restore_cache: keys: - hwacha-{{ .Branch }}-{{ .Revision }} + - restore_cache: + keys: + - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run hwacha benchmark tests - command: export RISCV=/home/riscvuser/esp-tools-install; export LD_LIBRARY_PATH=$RISCV/lib; make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha + command: export RISCV=/home/riscvuser/esp-tools-install; export LD_LIBRARY_PATH=$RISCV/lib; .circleci/run-tests.sh hwacha # Order and dependencies of jobs to run workflows: @@ -439,26 +457,26 @@ workflows: # Run the respective tests # Run the example tests - - example-run-benchmark-tests: + - example-run-tests: requires: - prepare-example - - boomexample-run-benchmark-tests: + - boomexample-run-tests: requires: - prepare-boomexample - - boomrocketexample-run-benchmark-tests: + - boomrocketexample-run-tests: requires: - prepare-boomrocketexample - - boom-run-benchmark-tests: + - boom-run-tests: requires: - prepare-boom - - rocketchip-run-benchmark-tests: + - rocketchip-run-tests: requires: - prepare-rocketchip - - hwacha-run-benchmark-tests: + - hwacha-run-tests: requires: - prepare-hwacha diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh new file mode 100755 index 00000000..a2b63f01 --- /dev/null +++ b/.circleci/run-tests.sh @@ -0,0 +1,50 @@ +#!/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 () { + export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR/install/share/verilator + make run-bmark-tests-fast -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $@ +} + +run_asm () { + export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR/install/share/verilator + make run-asm-tests-fast -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $@ +} + +run_both () { + run_bmark $@ + run_asm $@ +} + +case $1 in + example) + run_bmark SUB_PROJECT=example + ;; + boomexample) + run_bmark SUB_PROJECT=example CONFIG=DefaultBoomConfig + ;; + boomrocketexample) + run_bmark SUB_PROJECT=example CONFIG=DefaultBoomAndRocketConfig + ;; + boom) + run_bmark SUB_PROJECT=boom + ;; + rocketchip) + run_bmark SUB_PROJECT=rocketchip + ;; + hwacha) + run_bmark SUB_PROJECT=hwacha + ;; + *) + echo "No set of tests for $1. Did you spell it right?" + exit 1 + ;; +esac From 06b45c01ed43445c7fcc1bd789421f3fde403390 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 09:52:44 -0700 Subject: [PATCH 12/30] use large boom configs everywhere --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 91fd44ca..0c2121a5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -140,7 +140,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomexample subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomConfig + command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=DefaultBoomConfig no_output_timeout: 120m - save_cache: key: boomexample-{{ .Branch }}-{{ .Revision }} @@ -169,7 +169,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomrocketexample subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=SmallDefaultBoomAndRocketConfig + command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=DefaultBoomAndRocketConfig no_output_timeout: 120m - save_cache: key: boomrocketexample-{{ .Branch }}-{{ .Revision }} From 8e529e86bc20855e261cf2defc5a1faeaf60c923 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 11:06:49 -0700 Subject: [PATCH 13/30] ensure all args are passed to run --- .circleci/defaults.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index accf4ff9..39a0c9a3 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -5,7 +5,7 @@ copy () { } run () { - ssh -o "StrictHostKeyChecking no" -t $SERVER $1 + ssh -o "StrictHostKeyChecking no" -t $SERVER $@ } run_script () { From 1abde25fd679bb94f5fc7ad08c98801c97840ff8 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 15:39:50 -0700 Subject: [PATCH 14/30] use key/value store for build strings | run simple hwacha tests --- .circleci/config.yml | 24 ++++++++++++------------ .circleci/defaults.sh | 9 +++++++++ .circleci/do-rtl-build.sh | 2 +- .circleci/run-tests.sh | 16 ++++++++-------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0c2121a5..73fe147d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -111,7 +111,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the example subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example + command: .circleci/do-rtl-build.sh example no_output_timeout: 120m - save_cache: key: example-{{ .Branch }}-{{ .Revision }} @@ -140,7 +140,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomexample subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=DefaultBoomConfig + command: .circleci/do-rtl-build.sh boomexample no_output_timeout: 120m - save_cache: key: boomexample-{{ .Branch }}-{{ .Revision }} @@ -169,7 +169,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boomrocketexample subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=example CONFIG=DefaultBoomAndRocketConfig + command: .circleci/do-rtl-build.sh boomrocketexample no_output_timeout: 120m - save_cache: key: boomrocketexample-{{ .Branch }}-{{ .Revision }} @@ -198,7 +198,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the boom subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=boom + command: .circleci/do-rtl-build.sh boom no_output_timeout: 120m - save_cache: key: boom-{{ .Branch }}-{{ .Revision }} @@ -227,7 +227,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the rocketchip subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=rocketchip + command: .circleci/do-rtl-build.sh rocketchip no_output_timeout: 120m - save_cache: key: rocketchip-{{ .Branch }}-{{ .Revision }} @@ -256,7 +256,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Building the hwacha subproject using Verilator - command: .circleci/do-rtl-build.sh SUB_PROJECT=hwacha + command: .circleci/do-rtl-build.sh hwacha no_output_timeout: 120m - save_cache: key: hwacha-{{ .Branch }}-{{ .Revision }} @@ -284,7 +284,7 @@ jobs: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Run example benchmark tests + name: Run example tests command: .circleci/run-tests.sh example boomexample-run-tests: docker: @@ -308,7 +308,7 @@ jobs: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Run boomexample benchmark tests + name: Run boomexample tests command: .circleci/run-tests.sh boomexample boomrocketexample-run-tests: docker: @@ -332,7 +332,7 @@ jobs: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Run boomrocketexample benchmark tests + name: Run boomrocketexample tests command: .circleci/run-tests.sh boomrocketexample boom-run-tests: docker: @@ -356,7 +356,7 @@ jobs: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Run boom benchmark tests + name: Run boom tests command: .circleci/run-tests.sh boom rocketchip-run-tests: docker: @@ -380,7 +380,7 @@ jobs: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Run rocketchip benchmark tests + name: Run rocketchip tests command: .circleci/run-tests.sh rocketchip hwacha-run-tests: docker: @@ -404,7 +404,7 @@ jobs: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: - name: Run hwacha benchmark tests + name: Run hwacha tests command: export RISCV=/home/riscvuser/esp-tools-install; export LD_LIBRARY_PATH=$RISCV/lib; .circleci/run-tests.sh hwacha # Order and dependencies of jobs to run diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index 39a0c9a3..a17dca78 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -32,3 +32,12 @@ LOCAL_ESP_DIR=$HOME/esp-tools-install LOCAL_CHIPYARD_DIR=$LOCAL_CHECKOUT_DIR LOCAL_VERILATOR_DIR=$HOME/verilator LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verisim + +# key value store to get the build strings +declare -A mapping +mapping["example"]="SUB_PROJECT=example" +mapping["boomexample"]="SUB_PROJECT=example CONFIG=DefaultBoomConfig" +mapping["boomrocketexample"]="SUB_PROJECT=example CONFIG=DefaultBoomAndRocketConfig" +mapping["boom"]="SUB_PROJECT=boom" +mapping["rocketchip"]="SUB_PROJECT=rocketchip" +mapping["hwacha"]="SUB_PROJECT=hwacha" diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 8ead657b..c99c490e 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -31,7 +31,7 @@ copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR # enter the verisim directory and build the specific config on remote server run "make -C $REMOTE_SIM_DIR clean" -run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $@" +run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $mapping[$1]" run "rm -rf $REMOTE_CHIPYARD_DIR/project" # copy back the final build diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index a2b63f01..bd49f17a 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -9,13 +9,13 @@ set -ex SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" source $SCRIPT_DIR/defaults.sh +export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR/install/share/verilator + run_bmark () { - export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR/install/share/verilator make run-bmark-tests-fast -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $@ } run_asm () { - export VERILATOR_ROOT=$LOCAL_VERILATOR_DIR/install/share/verilator make run-asm-tests-fast -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $@ } @@ -26,22 +26,22 @@ run_both () { case $1 in example) - run_bmark SUB_PROJECT=example + run_bmark $mapping[$1] ;; boomexample) - run_bmark SUB_PROJECT=example CONFIG=DefaultBoomConfig + run_bmark $mapping[$1] ;; boomrocketexample) - run_bmark SUB_PROJECT=example CONFIG=DefaultBoomAndRocketConfig + run_bmark $mapping[$1] ;; boom) - run_bmark SUB_PROJECT=boom + run_bmark $mapping[$1] ;; rocketchip) - run_bmark SUB_PROJECT=rocketchip + run_bmark $mapping[$1] ;; hwacha) - run_bmark SUB_PROJECT=hwacha + make run-rv64uv-p-asm-tests-fst -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $mapping[$1] ;; *) echo "No set of tests for $1. Did you spell it right?" From 9f9b7087ed88ee7fe1bb81243b210f3f99444a8f Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 15:50:22 -0700 Subject: [PATCH 15/30] fix key/value store access --- .circleci/do-rtl-build.sh | 2 +- .circleci/run-tests.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index c99c490e..40975108 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -31,7 +31,7 @@ copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR # enter the verisim directory and build the specific config on remote server run "make -C $REMOTE_SIM_DIR clean" -run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" $mapping[$1]" +run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" ${mapping[$1]}" run "rm -rf $REMOTE_CHIPYARD_DIR/project" # copy back the final build diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index bd49f17a..e0587e03 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -26,22 +26,22 @@ run_both () { case $1 in example) - run_bmark $mapping[$1] + run_bmark ${mapping[$1]} ;; boomexample) - run_bmark $mapping[$1] + run_bmark ${mapping[$1]} ;; boomrocketexample) - run_bmark $mapping[$1] + run_bmark ${mapping[$1]} ;; boom) - run_bmark $mapping[$1] + run_bmark ${mapping[$1]} ;; rocketchip) - run_bmark $mapping[$1] + run_bmark ${mapping[$1]} ;; hwacha) - make run-rv64uv-p-asm-tests-fst -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR $mapping[$1] + make run-rv64uv-p-asm-tests-fst -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR ${mapping[$1]} ;; *) echo "No set of tests for $1. Did you spell it right?" From 5414df40f029cdb420d21d7e1c2971d08ad25557 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 17:51:46 -0700 Subject: [PATCH 16/30] setup esp-tools path --- .circleci/config.yml | 4 ++-- .circleci/do-rtl-build.sh | 18 ++++++++++++++---- .circleci/run-tests.sh | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 73fe147d..de58be12 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -250,7 +250,7 @@ jobs: .circleci/create-hash.sh - restore_cache: keys: - - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + - esp-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} @@ -405,7 +405,7 @@ jobs: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} - run: name: Run hwacha tests - command: export RISCV=/home/riscvuser/esp-tools-install; export LD_LIBRARY_PATH=$RISCV/lib; .circleci/run-tests.sh hwacha + command: .circleci/run-tests.sh hwacha # Order and dependencies of jobs to run workflows: diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 40975108..2c7242cc 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -21,17 +21,27 @@ run "echo \"Ping $SERVER\"" clean -# copy over riscv-tools, verilator, and chipyard to remote -run "mkdir -p $REMOTE_RISCV_DIR" +# copy over riscv/esp-tools, verilator, and chipyard to remote run "mkdir -p $REMOTE_CHIPYARD_DIR" run "mkdir -p $REMOTE_VERILATOR_DIR" -copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR copy $LOCAL_VERILATOR_DIR/ $SERVER:$REMOTE_VERILATOR_DIR +TOOLS_DIR=$REMOTE_RISCV_DIR +LD_LIB_DIR=$REMOTE_RISCV_DIR/lib +if [ $1 = "hwacha" ]; then + TOOLS_DIR=$REMOTE_ESP_DIR + LD_LIB_DIR=$REMOTE_ESP_DIR/lib + run "mkdir -p $REMOTE_ESP_DIR" + copy $LOCAL_ESP_DIR/ $SERVER:$REMOTE_ESP_DIR +else + run "mkdir -p $REMOTE_RISCV_DIR" + copy $LOCAL_RISCV_DIR/ $SERVER:$REMOTE_RISCV_DIR +fi + # enter the verisim directory and build the specific config on remote server run "make -C $REMOTE_SIM_DIR clean" -run "export RISCV=\"$REMOTE_RISCV_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" ${mapping[$1]}" +run "export RISCV=\"$TOOLS_DIR\"; export LD_LIBRARY_PATH=\"$LD_LIB_DIR\"; export VERILATOR_ROOT=$REMOTE_VERILATOR_DIR/install/share/verilator; make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR JAVA_ARGS=\"-Xmx8G -Xss8M\" ${mapping[$1]}" run "rm -rf $REMOTE_CHIPYARD_DIR/project" # copy back the final build diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index e0587e03..445278ee 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -41,6 +41,8 @@ case $1 in run_bmark ${mapping[$1]} ;; hwacha) + export RISCV=$REMOTE_ESP_DIR + export LD_LIBRARY_PATH=$REMOTE_ESP_DIR/lib make run-rv64uv-p-asm-tests-fst -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR ${mapping[$1]} ;; *) From 66443175dc61bb3d01b1f8076ffddff8bf197555 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 20:09:24 -0700 Subject: [PATCH 17/30] pass the right hash --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index de58be12..42397ea8 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -250,7 +250,7 @@ jobs: .circleci/create-hash.sh - restore_cache: keys: - - esp-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} - restore_cache: keys: - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} From cf4e383805bc7b63cd85474e2befb7e0ca2d244c Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 21:52:00 -0700 Subject: [PATCH 18/30] update esp tools to local dir --- .circleci/run-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index 445278ee..0f6ef18f 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -41,8 +41,8 @@ case $1 in run_bmark ${mapping[$1]} ;; hwacha) - export RISCV=$REMOTE_ESP_DIR - export LD_LIBRARY_PATH=$REMOTE_ESP_DIR/lib + export RISCV=$LOCAL_ESP_DIR + export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib make run-rv64uv-p-asm-tests-fst -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR ${mapping[$1]} ;; *) From ff945e38e5a81e9e77ae77688b78aaf84c808f49 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Wed, 10 Jul 2019 23:27:19 -0700 Subject: [PATCH 19/30] run normal tests (not fast) for hwacha --- .circleci/run-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index 0f6ef18f..99fd42dd 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -43,7 +43,8 @@ case $1 in hwacha) export RISCV=$LOCAL_ESP_DIR export LD_LIBRARY_PATH=$LOCAL_ESP_DIR/lib - make run-rv64uv-p-asm-tests-fst -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR ${mapping[$1]} + export PATH=$RISCV/bin:$PATH + make run-rv64uv-p-asm-tests -C $LOCAL_SIM_DIR VERILATOR_INSTALL_DIR=$LOCAL_VERILATOR_DIR ${mapping[$1]} ;; *) echo "No set of tests for $1. Did you spell it right?" From 0c5e3736e1fde3bb1cf5a08e239c01c293dc654d Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Thu, 11 Jul 2019 11:26:51 -0700 Subject: [PATCH 20/30] Fix stupid rst title underlining warnings --- docs/Simulation/Commercial-Simulators.rst | 2 +- docs/Simulation/Open-Source-Simulators.rst | 2 +- docs/index.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Simulation/Commercial-Simulators.rst b/docs/Simulation/Commercial-Simulators.rst index 0e971d51..30d6f7ab 100644 --- a/docs/Simulation/Commercial-Simulators.rst +++ b/docs/Simulation/Commercial-Simulators.rst @@ -1,5 +1,5 @@ Commercial Software RTL Simulators -============================== +================================== VCS ----------------------- diff --git a/docs/Simulation/Open-Source-Simulators.rst b/docs/Simulation/Open-Source-Simulators.rst index bc8a0dcc..bd8d9534 100644 --- a/docs/Simulation/Open-Source-Simulators.rst +++ b/docs/Simulation/Open-Source-Simulators.rst @@ -1,5 +1,5 @@ Open Source Software RTL Simulators -============================== +=================================== Verilator ----------------------- diff --git a/docs/index.rst b/docs/index.rst index 019a6991..b2fa001a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,7 +4,7 @@ contain the root `toctree` directive. Welcome to Chipyard's documentation! -================================= +==================================== Chipyard is a a framework for designing and evaluating full-system hardware using agile teams. It is composed of a collection of tools and libraries designed to provide an intergration between open-source and commercial tools for the development of systems-on-chip. From 7b43b3e951d54db0d1e9a5a46cc50cbaa9b8389c Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Thu, 11 Jul 2019 12:25:34 -0700 Subject: [PATCH 21/30] Rework simulation splash page --- ...rs.rst => FPGA-Accelerated-Simulators.rst} | 2 +- docs/Simulation/Open-Source-Simulators.rst | 35 ---------------- ...l-Simulators.rst => SW-RTL-Simulators.rst} | 40 +++++++++++++++++-- docs/Simulation/index.rst | 19 +++++---- 4 files changed, 50 insertions(+), 46 deletions(-) rename docs/Simulation/{FPGA-Based-Simulators.rst => FPGA-Accelerated-Simulators.rst} (97%) delete mode 100644 docs/Simulation/Open-Source-Simulators.rst rename docs/Simulation/{Commercial-Simulators.rst => SW-RTL-Simulators.rst} (50%) diff --git a/docs/Simulation/FPGA-Based-Simulators.rst b/docs/Simulation/FPGA-Accelerated-Simulators.rst similarity index 97% rename from docs/Simulation/FPGA-Based-Simulators.rst rename to docs/Simulation/FPGA-Accelerated-Simulators.rst index 1180b470..4fcc6668 100644 --- a/docs/Simulation/FPGA-Based-Simulators.rst +++ b/docs/Simulation/FPGA-Accelerated-Simulators.rst @@ -1,4 +1,4 @@ -FPGA-Based Simulators +FPGA-Accelerated Simulators ============================== FireSim diff --git a/docs/Simulation/Open-Source-Simulators.rst b/docs/Simulation/Open-Source-Simulators.rst deleted file mode 100644 index bd8d9534..00000000 --- a/docs/Simulation/Open-Source-Simulators.rst +++ /dev/null @@ -1,35 +0,0 @@ -Open Source Software RTL Simulators -=================================== - -Verilator ------------------------ - -`Verilator `__ is an open-source LGPL-Licensed simulator maintained by `Veripool `__. -The Chipyard framework can download, build, and execute simulations using Verilator. - -To run a simulation using Verilator, perform the following steps: - -To compile the example design, run ``make`` in the ``sims/verisim`` directory. -This will elaborate the ``DefaultRocketConfig`` in the example project. - -An executable called ``simulator-example-DefaultRocketConfig`` will be produced. -This executable is a simulator that has been compiled based on the design that was built. -You can then use this executable to run any compatible RV64 code. -For instance, to run one of the riscv-tools assembly tests. - -.. code-block:: shell - - ./simulator-example-DefaultRocketConfig $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple - -If you later create your own project, you can use environment variables to build an alternate configuration. - -.. code-block:: shell - - make SUB_PROJECT=yourproject - ./simulator-- ... - -If you would like to extract waveforms from the simulation, run the command ``make debug`` instead of just ``make``. -This will generate a vcd file (vcd is a standard waveform representation file format) that can be loaded to any common waveform viewer. -An open-source vcd-capable waveform viewer is `GTKWave `__. - -Please refer to :ref:`Running A Simulation` for a step by step tutorial on how to get a simulator up and running. diff --git a/docs/Simulation/Commercial-Simulators.rst b/docs/Simulation/SW-RTL-Simulators.rst similarity index 50% rename from docs/Simulation/Commercial-Simulators.rst rename to docs/Simulation/SW-RTL-Simulators.rst index 30d6f7ab..9df94d52 100644 --- a/docs/Simulation/Commercial-Simulators.rst +++ b/docs/Simulation/SW-RTL-Simulators.rst @@ -1,9 +1,43 @@ -Commercial Software RTL Simulators -================================== +Software RTL Simulators +=================================== -VCS +Verilator (Open-Source) ----------------------- +`Verilator `__ is an open-source LGPL-Licensed simulator maintained by `Veripool `__. +The Chipyard framework can download, build, and execute simulations using Verilator. + +To run a simulation using Verilator, perform the following steps: + +To compile the example design, run ``make`` in the ``sims/verisim`` directory. +This will elaborate the ``DefaultRocketConfig`` in the example project. + +An executable called ``simulator-example-DefaultRocketConfig`` will be produced. +This executable is a simulator that has been compiled based on the design that was built. +You can then use this executable to run any compatible RV64 code. +For instance, to run one of the riscv-tools assembly tests. + +.. code-block:: shell + + ./simulator-example-DefaultRocketConfig $RISCV/riscv64-unknown-elf/share/riscv-tests/isa/rv64ui-p-simple + +If you later create your own project, you can use environment variables to build an alternate configuration. + +.. code-block:: shell + + make SUB_PROJECT=yourproject + ./simulator-- ... + +If you would like to extract waveforms from the simulation, run the command ``make debug`` instead of just ``make``. +This will generate a vcd file (vcd is a standard waveform representation file format) that can be loaded to any common waveform viewer. +An open-source vcd-capable waveform viewer is `GTKWave `__. + +Please refer to :ref:`Running A Simulation` for a step by step tutorial on how to get a simulator up and running. +Commercial Software RTL Simulators + +Synopsys VCS (License Required) +-------------------------------- + `VCS `__ is a commercial RTL simulator developed by Synopsys. It requires commercial licenses. The Chipyard framework can compile and execute simulations using VCS. diff --git a/docs/Simulation/index.rst b/docs/Simulation/index.rst index 339960bd..f8ff7e46 100644 --- a/docs/Simulation/index.rst +++ b/docs/Simulation/index.rst @@ -1,15 +1,20 @@ Simulators ======================= -Chipyard provides support and integration for multiple simulation flows, for various user levels and requirements. -In the majority of cases during a digital design development process, a simple software RTL simulation will do. -When more advanced full-system evaluation is required, with long running workloads, FPGA-accelerated simulation will then become a preferable solution. -The following pages provide detailed information about the simulation possibilities within the Chipyard framework. +Chipyard supports two classes of simulation: + +#. Software RTL simulation using commercial or open-source (Verilator) RTL simulators +#. FPGA-accelerated full-system simulation using FireSim + +Software RTL simulators of Chipyard designs run at O(1 KHz), but compile +quickly and provide full waveforms. Conversly, FPGA-accelerated simulators run +at O(100 MHz), making them appropriate for booting an operating system and +running a complete workload, but have long compile time and poorer debug +visability. .. toctree:: :maxdepth: 2 :caption: Simulators: - Open-Source-Simulators - Commercial-Simulators - FPGA-Based-Simulators + SW-RTL-Simulators + FPGA-Accelerated-Simulators From 9f83b3a3d2ef84665e48dae516fb7410c2661768 Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Thu, 11 Jul 2019 18:23:53 -0700 Subject: [PATCH 22/30] Update FireSim instructions --- .../FPGA-Accelerated-Simulators.rst | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/docs/Simulation/FPGA-Accelerated-Simulators.rst b/docs/Simulation/FPGA-Accelerated-Simulators.rst index 4fcc6668..a3bbbe19 100644 --- a/docs/Simulation/FPGA-Accelerated-Simulators.rst +++ b/docs/Simulation/FPGA-Accelerated-Simulators.rst @@ -9,9 +9,56 @@ FireSim allows RTL-level simulation at orders-of-magnitude faster speeds than so FireSim also provides additional device models to allow full-system simulation, including memory models and network models. FireSim currently supports running only on Amazon EC2 F1 FPGA-enabled virtual instances on the public cloud. -In order to simulate your Chipyard design using FireSim, you should follow the following steps: +In order to simulate your Chipyard design using FireSim, if you have not +already, follow the initial EC2 setup instructions as detailed in the `FireSim +documentation `__. +Then clone your full Chipyard repository onto your Amazon EC2 FireSim manager +instance, and setup your Chipyard repository as you would normally. -Follow the initial EC2 setup instructions as detailed in the `FireSim documentation `__. -Then clone your full Chipyard repository onto your Amazon EC2 FireSim manager instance. +When you are ready to use FireSim, initalize it as library in Chipyard by running: -Enter the ``sims/FireSim`` directory, and follow the FireSim instructions for `running a simulation `__. +.. code-block:: shell + + # At the root of your chipyard repo + ./scripts/firesim-setup.sh --fast + + +``firesim-setup.sh`` initializes additional submodules and then invokes +firesim's ``build-setup.sh`` script. ``firesim-setup.sh`` accepts all of the same arguments and +passes them through to ``build-setup.sh``, adding ``--library`` to properly +initialize FireSim as a library submodule in chipyard. You may run +``./sims/firesim/build-setup.sh --help`` to see more options. + +In order to build bitstreams, run simulations, or to generate MIDAS-transformed RTL for your +simulator, you'll need to source one of the following three environments: + +.. code-block:: shell + + cd sims/firesim + # (Recommended) The default manager environment (includes env.sh) + source sourceme-f1-manager.sh + + # OR A minimal environment to run recipes out of sim/ (to invoke MIDAS; run MIDAS-level RTL simulation)generate RTL; transform At the root of your chipyard repo + source env.sh + + # OR A complete environment to run local FPGA builds with Vivado + source sourceme-f1-full.sh + +At this point you're ready to use FireSim with Chipyard. If you're not already +familiar with FireSim, please refer to the `FireSim Docs `__, and proceed +through the rest of the tutorial. + + +Current Limitations: +++++++++++++++++++++ + +FireSim integration in chipyard is still a work in progress. Presently, you +cannot build a FireSim simulator from any generator project in Chipyard except ``firechip``, +which properly invokes MIDAS on the target RTL. + +In the interim, workaround this limitation by importing Config and Module +classes from other generator projects into FireChip. You should then be able to +refer to those classes or an alias of them in your ``DESIGN`` or ``TARGET_CONFIG`` +variables. Note that if your target machine has I/O not provided in the default +FireChip targets (see ``generators/firechip/src/main/scala/Targets.scala``) you may need +to write a custom endpoint. From 0e80a6b6bcb65ce9912ecdbd74ef32b3b077a4a0 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Fri, 12 Jul 2019 11:52:44 -0700 Subject: [PATCH 23/30] bump testchipip to master --- generators/testchipip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generators/testchipip b/generators/testchipip index 532d4a42..cd9d53c3 160000 --- a/generators/testchipip +++ b/generators/testchipip @@ -1 +1 @@ -Subproject commit 532d4a42914286548179f3893ab6349a0aedb5e3 +Subproject commit cd9d53c3611b075d0cb580e051cb3ae38864148b From fd5a00a0ab9d2fa8635e6a9566afd6662417c2a3 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 15 Jul 2019 10:58:41 -0700 Subject: [PATCH 24/30] rename sim dirs | add "fast" helper target | re-add -q flag --- common.mk | 5 ++++- sims/{vsim => vcs}/.gitignore | 0 sims/{vsim => vcs}/Makefile | 1 + sims/{verisim => verilator}/.gitignore | 0 sims/{verisim => verilator}/Makefile | 0 sims/{verisim => verilator}/verilator.mk | 0 6 files changed, 5 insertions(+), 1 deletion(-) rename sims/{vsim => vcs}/.gitignore (100%) rename sims/{vsim => vcs}/Makefile (99%) rename sims/{verisim => verilator}/.gitignore (100%) rename sims/{verisim => verilator}/Makefile (100%) rename sims/{verisim => verilator}/verilator.mk (100%) diff --git a/common.mk b/common.mk index 5f9d04cb..0c94a669 100644 --- a/common.mk +++ b/common.mk @@ -73,11 +73,14 @@ $(HARNESS_SMEMS_FILE) $(HARNESS_SMEMS_FIR): $(HARNESS_SMEMS_CONF) verilog: $(sim_vsrcs) ######################################################################################### -# helper rules to run simulator +# helper rules to run simulations ######################################################################################### +.PHONY: run-binary run-fast run-binary: $(sim) (set -o pipefail && $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) +run-fast: run-asm-tests-fast run-bmark-tests-fast + ######################################################################################### # run assembly/benchmarks rules ######################################################################################### diff --git a/sims/vsim/.gitignore b/sims/vcs/.gitignore similarity index 100% rename from sims/vsim/.gitignore rename to sims/vcs/.gitignore diff --git a/sims/vsim/Makefile b/sims/vcs/Makefile similarity index 99% rename from sims/vsim/Makefile rename to sims/vcs/Makefile index 88aaed1e..fcf6ed7c 100644 --- a/sims/vsim/Makefile +++ b/sims/vcs/Makefile @@ -54,6 +54,7 @@ VCS_NONCC_OPTS = \ -error=PCWM-L \ -timescale=1ns/10ps \ -quiet \ + -q \ +rad \ +v2k \ +vcs+lic+wait \ diff --git a/sims/verisim/.gitignore b/sims/verilator/.gitignore similarity index 100% rename from sims/verisim/.gitignore rename to sims/verilator/.gitignore diff --git a/sims/verisim/Makefile b/sims/verilator/Makefile similarity index 100% rename from sims/verisim/Makefile rename to sims/verilator/Makefile diff --git a/sims/verisim/verilator.mk b/sims/verilator/verilator.mk similarity index 100% rename from sims/verisim/verilator.mk rename to sims/verilator/verilator.mk From c784fdc658642162a2a7d655bf86a4a03f14b0e2 Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 15 Jul 2019 16:53:37 -0700 Subject: [PATCH 25/30] rename ci --- .circleci/build-verilator.sh | 2 +- .circleci/config.yml | 28 ++++++++++++++-------------- .circleci/defaults.sh | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.circleci/build-verilator.sh b/.circleci/build-verilator.sh index 2c0b6a13..acd038fb 100755 --- a/.circleci/build-verilator.sh +++ b/.circleci/build-verilator.sh @@ -23,7 +23,7 @@ if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then run "mkdir -p $REMOTE_CHIPYARD_DIR" copy $LOCAL_CHIPYARD_DIR/ $SERVER:$REMOTE_CHIPYARD_DIR - run "make -C $REMOTE_CHIPYARD_DIR/sims/verisim VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR verilator_install" + run "make -C $REMOTE_SIM_DIR VERILATOR_INSTALL_DIR=$REMOTE_VERILATOR_DIR verilator_install" # copy so that circleci can cache mkdir -p $LOCAL_CHIPYARD_DIR diff --git a/.circleci/config.yml b/.circleci/config.yml index 42397ea8..e03f2a9c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -78,14 +78,14 @@ jobs: - checkout - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Build Verilator command: | .circleci/build-verilator.sh no_output_timeout: 120m - save_cache: - key: verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + key: verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} paths: - "/home/riscvuser/verilator" prepare-example: @@ -108,7 +108,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Building the example subproject using Verilator command: .circleci/do-rtl-build.sh example @@ -137,7 +137,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Building the boomexample subproject using Verilator command: .circleci/do-rtl-build.sh boomexample @@ -166,7 +166,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Building the boomrocketexample subproject using Verilator command: .circleci/do-rtl-build.sh boomrocketexample @@ -195,7 +195,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Building the boom subproject using Verilator command: .circleci/do-rtl-build.sh boom @@ -224,7 +224,7 @@ jobs: - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Building the rocketchip subproject using Verilator command: .circleci/do-rtl-build.sh rocketchip @@ -253,7 +253,7 @@ jobs: - esp-tools-installed-v1-{{ checksum "../esp-tools.hash" }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Building the hwacha subproject using Verilator command: .circleci/do-rtl-build.sh hwacha @@ -282,7 +282,7 @@ jobs: - example-{{ .Branch }}-{{ .Revision }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Run example tests command: .circleci/run-tests.sh example @@ -306,7 +306,7 @@ jobs: - boomexample-{{ .Branch }}-{{ .Revision }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Run boomexample tests command: .circleci/run-tests.sh boomexample @@ -330,7 +330,7 @@ jobs: - boomrocketexample-{{ .Branch }}-{{ .Revision }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Run boomrocketexample tests command: .circleci/run-tests.sh boomrocketexample @@ -354,7 +354,7 @@ jobs: - boom-{{ .Branch }}-{{ .Revision }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Run boom tests command: .circleci/run-tests.sh boom @@ -378,7 +378,7 @@ jobs: - rocketchip-{{ .Branch }}-{{ .Revision }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Run rocketchip tests command: .circleci/run-tests.sh rocketchip @@ -402,7 +402,7 @@ jobs: - hwacha-{{ .Branch }}-{{ .Revision }} - restore_cache: keys: - - verilator-installed-v3-{{ checksum "sims/verisim/verilator.mk" }} + - verilator-installed-v3-{{ checksum "sims/verilator/verilator.mk" }} - run: name: Run hwacha tests command: .circleci/run-tests.sh hwacha diff --git a/.circleci/defaults.sh b/.circleci/defaults.sh index a17dca78..91b8f589 100755 --- a/.circleci/defaults.sh +++ b/.circleci/defaults.sh @@ -23,7 +23,7 @@ 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_VERILATOR_DIR=$REMOTE_WORK_DIR/verilator -REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verisim +REMOTE_SIM_DIR=$REMOTE_CHIPYARD_DIR/sims/verilator # local variables (aka within the docker container) LOCAL_CHECKOUT_DIR=$HOME/project @@ -31,7 +31,7 @@ LOCAL_RISCV_DIR=$HOME/riscv-tools-install LOCAL_ESP_DIR=$HOME/esp-tools-install LOCAL_CHIPYARD_DIR=$LOCAL_CHECKOUT_DIR LOCAL_VERILATOR_DIR=$HOME/verilator -LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verisim +LOCAL_SIM_DIR=$LOCAL_CHIPYARD_DIR/sims/verilator # key value store to get the build strings declare -A mapping From 02e76f343e57f1ba3d85fdbcbacea1519685ed4c Mon Sep 17 00:00:00 2001 From: abejgonzalez Date: Mon, 15 Jul 2019 17:16:23 -0700 Subject: [PATCH 26/30] remove commit check on firechip --- .circleci/check-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/check-commit.sh b/.circleci/check-commit.sh index 4ad48ed5..630bbd08 100755 --- a/.circleci/check-commit.sh +++ b/.circleci/check-commit.sh @@ -26,7 +26,7 @@ search () { done } -submodules=("boom" "firechip" "hwacha" "icenet" "rocket-chip" "sifive-blocks" "sifive-cache" "testchipip") +submodules=("boom" "hwacha" "icenet" "rocket-chip" "sifive-blocks" "sifive-cache" "testchipip") dir="generators" search From 26a67fdbad606fa610bb880a292e566f19eb652f Mon Sep 17 00:00:00 2001 From: Colin Schmidt Date: Mon, 15 Jul 2019 22:15:57 -0700 Subject: [PATCH 27/30] Add verbose to debug runs (#148) * Add verbose to debug runs * Reorg simulator flags for consistency, extensibility, and ease of use --- common.mk | 18 +++++++++++++++--- sims/verisim/Makefile | 10 +++------- sims/vsim/Makefile | 10 +++------- variables.mk | 3 ++- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/common.mk b/common.mk index 5f9d04cb..68a7e632 100644 --- a/common.mk +++ b/common.mk @@ -76,7 +76,19 @@ verilog: $(sim_vsrcs) # helper rules to run simulator ######################################################################################### run-binary: $(sim) - (set -o pipefail && $(sim) $(PERMISSIVE_ON) $(SIM_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) + (set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) + +######################################################################################### +# helper rules to run simulator as fast as possible +######################################################################################### +run-binary-fast: $(sim) + (set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) + +######################################################################################### +# helper rules to run simulator with as much debug info as possible +######################################################################################### +run-binary-debug: $(sim_debug) + (set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAG) $(WAVEFORM_FLAG) $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) ######################################################################################### # run assembly/benchmarks rules @@ -86,10 +98,10 @@ $(output_dir)/%: $(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa/% ln -sf $< $@ $(output_dir)/%.run: $(output_dir)/% $(sim) - $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< && touch $@ + $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(PERMISSIVE_OFF) $< && touch $@ $(output_dir)/%.out: $(output_dir)/% $(sim) - (set -o pipefail && $(sim) $(PERMISSIVE_ON) +verbose +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< 3>&1 1>&2 2>&3 | spike-dasm > $@) + (set -o pipefail && $(sim) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(VERBOSE_FLAGS) $(PERMISSIVE_OFF) $< 3>&1 1>&2 2>&3 | spike-dasm > $@) ######################################################################################### # include build/project specific makefrags made from the generator diff --git a/sims/verisim/Makefile b/sims/verisim/Makefile index 629373c8..801a521c 100644 --- a/sims/verisim/Makefile +++ b/sims/verisim/Makefile @@ -28,6 +28,8 @@ sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug PERMISSIVE_ON= PERMISSIVE_OFF= +WAVEFORM_FLAG=-v$(sim_out_name).vcd + .PHONY: default debug default: $(sim) debug: $(sim_debug) @@ -80,19 +82,13 @@ $(sim): $(model_mk) $(sim_debug): $(model_mk_debug) $(MAKE) VM_PARALLEL_BUILDS=1 -C $(build_dir)/$(long_name).debug -f V$(VLOG_MODEL).mk -######################################################################################### -# helper rules to run simulator with debug -######################################################################################### -run-binary-debug: $(sim_debug) - (set -o pipefail && $(sim_debug) $(SIM_FLAGS) -v$(sim_out_name).vcd $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) - ######################################################################################### # create a verisim vpd rule ######################################################################################### $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) rm -f $@.vcd && mkfifo $@.vcd vcd2vpd $@.vcd $@ > /dev/null & - $(sim_debug) -v$@.vcd +max-cycles=$(timeout_cycles) $< + $(sim_debug) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) -v$@.vcd $(PERMISSIVE_OFF) $< ######################################################################################### # general cleanup rule diff --git a/sims/vsim/Makefile b/sims/vsim/Makefile index 88aaed1e..6364d2f8 100644 --- a/sims/vsim/Makefile +++ b/sims/vsim/Makefile @@ -28,6 +28,8 @@ sim_debug = $(sim_dir)/$(sim_prefix)-$(MODEL_PACKAGE)-$(CONFIG)-debug PERMISSIVE_ON=+permissive PERMISSIVE_OFF=+permissive-off +WAVEFORM_FLAG=+vcdplusfile=$(sim_out_name).vpd + .PHONY: default debug default: $(sim) debug: $(sim_debug) @@ -93,17 +95,11 @@ $(sim_debug) : $(sim_vsrcs) $(sim_dotf) $(sim_vcs_blackboxes) rm -rf csrc && $(VCS) $(VCS_OPTS) -o $@ \ +define+DEBUG -debug_pp -######################################################################################### -# helper rules to run simulator with debug -######################################################################################### -run-binary-debug: $(sim_debug) - (set -o pipefail && $(sim_debug) $(PERMISSIVE_ON) $(SIM_FLAGS) +vcdplusfile=$(sim_out_name).vpd $(PERMISSIVE_OFF) $(BINARY) 3>&1 1>&2 2>&3 | spike-dasm > $(sim_out_name).out) - ######################################################################################### # create a vcs vpd rule ######################################################################################### $(output_dir)/%.vpd: $(output_dir)/% $(sim_debug) - $(sim_debug) $(PERMISSIVE_ON) +vcdplusfile=$@ +max-cycles=$(timeout_cycles) $(PERMISSIVE_OFF) $< + $(sim_debug) $(PERMISSIVE_ON) +max-cycles=$(timeout_cycles) $(SIM_FLAGS) $(VERBOSE_FLAGS) +vcdplusfile=$@ $(PERMISSIVE_OFF) $< ######################################################################################### # general cleanup rule diff --git a/variables.mk b/variables.mk index d9ce7781..7aefdd18 100644 --- a/variables.mk +++ b/variables.mk @@ -148,7 +148,8 @@ output_dir=$(sim_dir)/output/$(long_name) # helper variables to run binaries ######################################################################################### BINARY ?= -SIM_FLAGS ?= +max-cycles=$(timeout_cycles) +SIM_FLAGS ?= +VERBOSE_FLAGS ?= +verbose sim_out_name = $(notdir $(basename $(BINARY))).$(long_name) ######################################################################################### From 870c7d53d32503884c0a229f160bbd7297c4a277 Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Tue, 16 Jul 2019 07:43:27 -0700 Subject: [PATCH 28/30] Address PR comments for FireSim docs --- .../FPGA-Accelerated-Simulators.rst | 27 +++++++------------ ...lators.rst => Software-RTL-Simulators.rst} | 0 docs/Simulation/index.rst | 4 +-- 3 files changed, 12 insertions(+), 19 deletions(-) rename docs/Simulation/{SW-RTL-Simulators.rst => Software-RTL-Simulators.rst} (100%) diff --git a/docs/Simulation/FPGA-Accelerated-Simulators.rst b/docs/Simulation/FPGA-Accelerated-Simulators.rst index a3bbbe19..6dab6378 100644 --- a/docs/Simulation/FPGA-Accelerated-Simulators.rst +++ b/docs/Simulation/FPGA-Accelerated-Simulators.rst @@ -8,29 +8,26 @@ FireSim FireSim allows RTL-level simulation at orders-of-magnitude faster speeds than software RTL simulators. FireSim also provides additional device models to allow full-system simulation, including memory models and network models. -FireSim currently supports running only on Amazon EC2 F1 FPGA-enabled virtual instances on the public cloud. +FireSim currently supports running only on Amazon EC2 F1 FPGA-enabled virtual instances. In order to simulate your Chipyard design using FireSim, if you have not already, follow the initial EC2 setup instructions as detailed in the `FireSim documentation `__. -Then clone your full Chipyard repository onto your Amazon EC2 FireSim manager +Then clone Chipyard onto your FireSim manager instance, and setup your Chipyard repository as you would normally. -When you are ready to use FireSim, initalize it as library in Chipyard by running: +Next, initalize FireSim as library in Chipyard by running: .. code-block:: shell # At the root of your chipyard repo ./scripts/firesim-setup.sh --fast - ``firesim-setup.sh`` initializes additional submodules and then invokes -firesim's ``build-setup.sh`` script. ``firesim-setup.sh`` accepts all of the same arguments and -passes them through to ``build-setup.sh``, adding ``--library`` to properly +firesim's ``build-setup.sh`` script adding ``--library`` to properly initialize FireSim as a library submodule in chipyard. You may run ``./sims/firesim/build-setup.sh --help`` to see more options. -In order to build bitstreams, run simulations, or to generate MIDAS-transformed RTL for your -simulator, you'll need to source one of the following three environments: +Finally, source the following environment at the root of the firesim directory: .. code-block:: shell @@ -38,21 +35,17 @@ simulator, you'll need to source one of the following three environments: # (Recommended) The default manager environment (includes env.sh) source sourceme-f1-manager.sh - # OR A minimal environment to run recipes out of sim/ (to invoke MIDAS; run MIDAS-level RTL simulation)generate RTL; transform At the root of your chipyard repo - source env.sh - - # OR A complete environment to run local FPGA builds with Vivado - source sourceme-f1-full.sh +`Every time you want to use FireSim with a fresh shell, you must source this sourceme.sh` At this point you're ready to use FireSim with Chipyard. If you're not already -familiar with FireSim, please refer to the `FireSim Docs `__, and proceed -through the rest of the tutorial. - +familiar with FireSim, please return to the `FireSim Docs +`__, +and proceed with the rest of the tutorial. Current Limitations: ++++++++++++++++++++ -FireSim integration in chipyard is still a work in progress. Presently, you +FireSim integration in Chipyard is still a work in progress. Presently, you cannot build a FireSim simulator from any generator project in Chipyard except ``firechip``, which properly invokes MIDAS on the target RTL. diff --git a/docs/Simulation/SW-RTL-Simulators.rst b/docs/Simulation/Software-RTL-Simulators.rst similarity index 100% rename from docs/Simulation/SW-RTL-Simulators.rst rename to docs/Simulation/Software-RTL-Simulators.rst diff --git a/docs/Simulation/index.rst b/docs/Simulation/index.rst index f8ff7e46..50dbb57e 100644 --- a/docs/Simulation/index.rst +++ b/docs/Simulation/index.rst @@ -9,12 +9,12 @@ Chipyard supports two classes of simulation: Software RTL simulators of Chipyard designs run at O(1 KHz), but compile quickly and provide full waveforms. Conversly, FPGA-accelerated simulators run at O(100 MHz), making them appropriate for booting an operating system and -running a complete workload, but have long compile time and poorer debug +running a complete workload, but have multi-hour compile times and poorer debug visability. .. toctree:: :maxdepth: 2 :caption: Simulators: - SW-RTL-Simulators + Software-RTL-Simulators FPGA-Accelerated-Simulators From c6a5a333088457cf55eedc31043e8f0f5f8ce08f Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Tue, 16 Jul 2019 15:03:28 -0700 Subject: [PATCH 29/30] Update README.md with proper CI/readthedocs links --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e59f5af5..fd6e723f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Chipyard Framework [![CircleCI](https://circleci.com/gh/ucb-bar/project-template/tree/master.svg?style=svg)](https://circleci.com/gh/ucb-bar/chipyard/tree/master) +# Chipyard Framework [![CircleCI](https://circleci.com/gh/ucb-bar/chipyard/tree/master.svg?style=svg)](https://circleci.com/gh/ucb-bar/chipyard/tree/master) ## Using Chipyard -To get started using Chipyard, see the documentation on the Chipyard documentation site: https://bar-project-template.readthedocs.io/en/latest/ +To get started using Chipyard, see the documentation on the Chipyard documentation site: https://chipyard.readthedocs.io/en/latest/ ## What is Chipyard @@ -14,7 +14,7 @@ Chipyard is actively developed in the [Berkeley Architecture Research Group][ucb ## Resources * Chipyard Website: ...TBD at a later date... -* Chipyard Documentation: https://bar-project-template.readthedocs.io/ +* Chipyard Documentation: https://chipyard.readthedocs.io/ [hwacha]:http://hwacha.org [hammer]:https://github.com/ucb-bar/hammer From d5f9f1e94e666895dfa58d6dfacc0201c4d6eef5 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Tue, 16 Jul 2019 15:26:44 -0700 Subject: [PATCH 30/30] Make verilator wget safe --- sims/verilator/verilator.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/verilator/verilator.mk b/sims/verilator/verilator.mk index 80abd869..9954aa4d 100644 --- a/sims/verilator/verilator.mk +++ b/sims/verilator/verilator.mk @@ -36,7 +36,7 @@ $(VERILATOR_SRCDIR)/configure: $(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VE $(VERILATOR_INSTALL_DIR)/verilator-$(VERILATOR_VERSION).tar.gz: mkdir -p $(dir $@) - wget http://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz -O $@ + wget https://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz -O $@ ######################################################################################### # verilator binary and flags