From b2d46037a59e29924d5333fd2f0c2d54137d4d93 Mon Sep 17 00:00:00 2001 From: Abraham Gonzalez Date: Sun, 12 May 2019 12:16:10 -0700 Subject: [PATCH] add status badge for master | add ci readme | add more benchmark tests --- .circleci/README.md | 54 ++++++++ .circleci/config.yml | 290 ++++++++++++++++++++++++++++++++++++++++++- README.md | 2 +- 3 files changed, 344 insertions(+), 2 deletions(-) create mode 100644 .circleci/README.md diff --git a/.circleci/README.md b/.circleci/README.md new file mode 100644 index 00000000..50ede340 --- /dev/null +++ b/.circleci/README.md @@ -0,0 +1,54 @@ +REBAR CI +======== + +Website: https://circleci.com/gh/ucb-bar/project-template + +CircleCI Brief Explanation +--------------------------- + +CircleCI is controlled by the `config.yml` script. +It consists of a *workflow* which has a series of *jobs* within it that do particular tasks. +All jobs in the workflow must pass for the CI run to be successful. + +At the bottom of the `config.yml` there is a `workflows:` section that specifies the order in which the jobs of the workflow should run. +For example: + + - prepare-rocketchip: + requires: + - install-riscv-toolchain + - install-verilator + +This specifies that the `prepare-rocketchip` job needs the `install-riscv-toolchain` and `install-verilator` steps to run before it can run. + +All jobs in the CI workflow are specified at the top of `config.yml` +They specify a docker image to use (in this case a riscv-boom image since that is already available and works nicely) and an environment. +Finally, in the `steps:` section, the steps are run sequentially and state persists throughout a job. +So when you run something like `checkout` the next step has the checked out code. +Caching in the job is done by giving a file to cache on. +`restore_cache:` loads the cache into the environment if the key matches while `save_cache:` writes to the cache with the key IF IT IS NOT PRESENT. +Note, if the cache is already present for that key, the write to it is ignored. +Here the key is built from a string where the `checksum` portion converts the file given into a hash. + +.circleci directory +------------------- + +This directory contains all the collateral for the REBAR CI to work. +The following is included: + + build-toolchains.sh # build either riscv-tools or esp-tools + build-verilator.sh # build verilator + create-hash.sh # create hashes of riscv-tools/esp-tools so circleci caching can work + do-rtl-build.sh # use verilator to build a sim executable + config.yml # main circleci config script to enumerate jobs/workflows + +How things are setup for REBAR +------------------------------ + +The steps for CI to run are as follows. +1st, build the toolchains in parallel (note: `esp-tools` is currently not used in the run). +The docker image sets up the `PATH` and `RISCV` variable so that `riscv-tools` is the default (currently the `env.sh` script that is created at tool build is unused). +2nd, install verilator using the `*.mk` to cache unique versions of verilator (mainly for if verilator is bumped). +3rd, create the simulator binary. +This requires the `riscv-tools` for `fesvr` and `verilator` to be able to build the binary. +This stores all collateral for the tests (srcs, generated-srcs, sim binary, etc) to run "out of the gate" in the next job (make needs everything or else it will run again). +4th, finally run the tests that were wanted. diff --git a/.circleci/config.yml b/.circleci/config.yml index 63db649e..4a1d063b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -127,6 +127,142 @@ jobs: paths: - "/home/riscvuser/project" + prepare-boomexample: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the boomexample subproject using Verilator + command: .circleci/do-rtl-build.sh boomexample + no_output_timeout: 120m + + - save_cache: + key: boomexample-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + + prepare-boom: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the boom subproject using Verilator + command: .circleci/do-rtl-build.sh boom + no_output_timeout: 120m + + - save_cache: + key: boom-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + + prepare-rocketchip: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the rocketchip subproject using Verilator + command: .circleci/do-rtl-build.sh rocketchip + no_output_timeout: 120m + + - save_cache: + key: rocketchip-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + + prepare-hwacha: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - verilator-installed-v1-{{ checksum "sims/verisim/verilator.mk" }} + + - run: + name: Building the hwacha subproject using Verilator + command: .circleci/do-rtl-build.sh hwacha + no_output_timeout: 120m + + - save_cache: + key: hwacha-{{ .Branch }}-{{ .Revision }} + paths: + - "/home/riscvuser/project" + example-run-benchmark-tests: docker: - image: riscvboom/riscvboom-images:0.0.5 @@ -155,6 +291,118 @@ jobs: name: Run example benchmark tests command: make run-bmark-tests -C sims/verisim SUB_PROJECT=example + boomexample-run-benchmark-tests: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - boomexample-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run boomexample benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boomexample + + boom-run-benchmark-tests: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - boom-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run boom benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=boom + + rocketchip-run-benchmark-tests: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - rocketchip-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run rocketchip benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=rocketchip + + hwacha-run-benchmark-tests: + docker: + - image: riscvboom/riscvboom-images:0.0.5 + environment: + JVM_OPTS: -Xmx3200m # Customize the JVM maximum heap limit + TERM: dumb + + steps: + # Checkout the code + - checkout + + - run: + name: Create hash of toolchains + command: | + .circleci/create-hash.sh + + - restore_cache: + keys: + - riscv-tools-installed-v1-{{ checksum "../riscv-tools.hash" }} + + - restore_cache: + keys: + - hwacha-{{ .Branch }}-{{ .Revision }} + + - run: + name: Run hwacha benchmark tests + command: make run-bmark-tests -C sims/verisim SUB_PROJECT=hwacha + # Order and dependencies of jobs to run workflows: version: 2 @@ -172,7 +420,27 @@ workflows: - prepare-example: requires: - install-riscv-toolchain - - install-verilator + - install-verilator + + - prepare-boomexample: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-boom: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-rocketchip: + requires: + - install-riscv-toolchain + - install-verilator + + - prepare-hwacha: + requires: + - install-riscv-toolchain + - install-verilator # Run the respective tests @@ -181,3 +449,23 @@ workflows: requires: - install-riscv-toolchain - prepare-example + + - boomexample-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-boomexample + + - boom-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-boom + + - rocketchip-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-rocketchip + + - hwacha-run-benchmark-tests: + requires: + - install-riscv-toolchain + - prepare-hwacha diff --git a/README.md b/README.md index 7748e53e..9e2b31fa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# RISC-V Project Template +# RISC-V Project Template [![CircleCI](https://circleci.com/gh/ucb-bar/project-template/tree/master.svg?style=svg)](https://circleci.com/gh/ucb-bar/project-template/tree/master) **This branch is under development** **It currently has many submodules**