blob: b2b11743211c5865589ef06deac630dc0135f696 [file] [log] [blame]
Sam Elliottd2028282020-06-02 18:18:54 +01001# Copyright lowRISC contributors.
2# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3# SPDX-License-Identifier: Apache-2.0
4#
lowRISC Contributors802543a2019-08-31 12:12:56 +01005# Azure Pipelines CI build configuration
6# Documentation at https://aka.ms/yaml
7
8variables:
Pirmin Vogeleaf8b4b2020-03-03 14:51:03 +01009 VERILATOR_VERSION: 4.028
lowRISC Contributors802543a2019-08-31 12:12:56 +010010 VERILATOR_PATH: /opt/buildcache/verilator/$(VERILATOR_VERSION)
Miguel Osorio88179fc2019-09-19 23:37:48 -070011 TOOLCHAIN_PATH: /opt/buildcache/riscv
Michael Schaffnerde326062020-07-14 17:50:35 -070012 VERIBLE_VERSION: v0.0-469-gb458ff6
Miguel Osorio88179fc2019-09-19 23:37:48 -070013 # Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
Sam Elliott00881552020-05-04 16:46:55 +010014 # if you update this, update the definition in util/container/Dockerfile
Luís Marques5849cd12020-06-26 10:33:55 +010015 TOOLCHAIN_VERSION: 20200626-1
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -060016 # This controls where builds happen, and gets picked up by build_consts.sh.
17 BUILD_ROOT: $(Build.ArtifactStagingDirectory)
lowRISC Contributors802543a2019-08-31 12:12:56 +010018
19trigger:
lowRISC Contributors802543a2019-08-31 12:12:56 +010020 batch: true
21 branches:
22 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010023 - "*"
Philipp Wagnerdd1706e2020-03-15 14:39:59 +000024 tags:
25 include:
26 - "*"
27pr:
28 branches:
29 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010030 - "*"
lowRISC Contributors802543a2019-08-31 12:12:56 +010031
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000032jobs:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060033- job: lint
34 displayName: Run code quality checks (lint)
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000035 pool:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060036 vmImage: ubuntu-16.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000037 steps:
38 - bash: |
Garret Kellyf5608d02019-11-01 16:28:11 -040039 sudo apt-get remove -y clang-6.0 libclang-common-6.0-dev libclang1-6.0 libllvm6.0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060040 displayName: Remove existing Clang installation
41 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000042 - bash: |
Michael Schaffnerde326062020-07-14 17:50:35 -070043 set -e
44 mkdir -p build/verible
45 cd build/verible
46 curl -Ls -o verible.tar.gz https://github.com/google/verible/releases/download/$(VERIBLE_VERSION)/verible-$(VERIBLE_VERSION)-Ubuntu-16.04-xenial-x86_64.tar.gz
47 sudo mkdir -p /tools/verible && sudo chmod 777 /tools/verible
48 tar -C /tools/verible -xf verible.tar.gz --strip-components=1
49 echo "##vso[task.setvariable variable=PATH]/tools/verible/bin:$PATH"
50 displayName: Install Verible
51 - bash: |
Philipp Wagner99862392020-07-22 13:32:34 +010052 set -x
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000053 python3 --version
54 yapf --version
55 isort --version
56 clang-format -version
Rupert Swarbrick2d70c752020-03-24 17:23:40 +000057 flake8 --version
Philipp Wagnerb52cee62020-03-30 15:40:43 +010058 ninja --version
59 meson --version
Sam Elliottb6745d32020-04-08 21:46:28 +010060 doxygen --version
Greg Chadwickfe07c7c2020-02-11 11:24:09 +000061 echo "PATH=$PATH"
Philipp Wagner99862392020-07-22 13:32:34 +010062 printenv
63 displayName: Display environment information
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060064 - bash: |
Philipp Wagner112875b2020-07-22 13:52:09 +010065 fork_origin="$(git merge-base --fork-point origin/$SYSTEM_PULLREQUEST_TARGETBRANCH)"
Sam Elliott60ff08a2020-07-17 17:31:02 +010066 changed_files="$(git diff --name-only --diff-filter=ACMRTUXB "$fork_origin" | grep -v /vendor/ | grep -v /lowrisc_misc-linters/ | grep -E '.py$')"
67 if [[ -n "$changed_files" ]]; then
68 set -e
69 xargs util/lintpy.py --tools flake8 -f <<< "$changed_files" | tee lintpy-output
70 fi
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060071 displayName: Run Python lint
Rupert Swarbrick2d70c752020-03-24 17:23:40 +000072 continueOnError: true
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000073 - bash: |
74 make -C hw regs && git diff --exit-code
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060075 if [[ $? != 0 ]]; then
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000076 echo -n "##vso[task.logissue type=error]"
77 echo "Register headers not up-to-date. Regenerate them with 'make -C hw regs'."
78 exit 1
79 fi
80 condition: always()
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060081 displayName: Ensure all generated files are clean and up-to-date
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000082 - bash: |
Sam Elliott24398ab2020-07-17 17:02:05 +010083 set -e
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060084 util/build_docs.py
Sam Elliottc8fa5582020-04-08 21:02:05 +010085 # Upload Doxygen Warnings if Present
86 if [[ -f "build/docs-generated/sw/doxygen_warnings.log" ]]; then
87 echo -n "##vso[task.uploadfile]"
88 echo "${PWD}/build/docs-generated/sw/doxygen_warnings.log"
89 # Doxygen currently generates lots of warnings.
90 # echo -n "##vso[task.issue type=warning]"
91 # echo "Doxygen generated warnings. Use 'util/build_docs.py' to generate warning logfile."
92 fi
Garret Kelly889bf6a2019-11-03 13:02:27 -050093 condition: always()
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060094 displayName: Render documentation
Garret Kelly889bf6a2019-11-03 13:02:27 -050095 - bash: |
Garret Kelly8d7da7c2019-11-08 14:09:34 -050096 cd site/landing
97 ../../build/docs-hugo/hugo
98 condition: always()
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060099 displayName: Render landing site
Garret Kelly8d7da7c2019-11-08 14:09:34 -0500100 - bash: |
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000101 # XXX: As of today, task.logissue comments with 'sourcepath' set don't
102 # get reported to GitHub Checks annotations. Upstream bug report:
103 # https://developercommunity.visualstudio.com/content/problem/689794/pipelines-logging-command-logissue-does-not-report.html
104 #echo "##vso[task.issue type=error;sourcepath=/azure-pipelines.yml;linenumber=45;columnnumber=1;code=100;]Found something that could be a problem."
Philipp Wagner112875b2020-07-22 13:52:09 +0100105 fork_origin="$(git merge-base --fork-point origin/$SYSTEM_PULLREQUEST_TARGETBRANCH)"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600106 changed_files="$(git diff --name-only "$fork_origin" | grep -v /vendor/ | grep -E '\.(cpp|cc|c|h)$')"
Greg Chadwickffa126f2020-04-07 11:36:31 +0100107 if [[ -n "$changed_files" ]]; then
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600108 xargs git diff -U0 "$fork_origin" <<< "$changed_files" \
109 | clang-format-diff -p1 \
110 | tee clang-format-output
111 if [[ -s clang-format-output ]]; then
112 echo -n "##vso[task.logissue type=error]"
113 echo "C/C++ lint failed. Use 'git clang-format' with appropriate options to reformat the changed code."
114 exit 1
115 fi
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000116 fi
117 # This check is not idempotent, but checks changes to a base branch.
Michael Schaffner823a2582020-05-11 15:39:15 -0700118 # Run it only on pull requests. Note that the git diff filter (ACMRTUXB) omits
119 # files that are deleted in a PR, since those break the checker script below.
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000120 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600121 displayName: Use clang-format to check C/C++ coding style
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000122 - bash: |
Philipp Wagner112875b2020-07-22 13:52:09 +0100123 fork_origin="$(git merge-base --fork-point origin/$SYSTEM_PULLREQUEST_TARGETBRANCH)"
Michael Schaffner823a2582020-05-11 15:39:15 -0700124 changed_files="$(git diff --name-only --diff-filter=ACMRTUXB "$fork_origin")"
Greg Chadwickffa126f2020-04-07 11:36:31 +0100125 if [[ -n "$changed_files" ]]; then
Miguel Young de la Sotab23dc8c2020-01-14 13:52:33 -0500126 xargs util/fix_include_guard.py --dry-run <<< "$changed_files" | tee fix-include-guard-output
127 if [[ -s fix-include-guard-output ]]; then
128 echo -n "##vso[task.logissue type=error]"
129 echo "Include guard check failed. Please run util/fix_include_guard.py on the above files."
130 exit 1
131 fi
132 fi
133 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600134 displayName: Check formatting on header guards
Miguel Young de la Sotab23dc8c2020-01-14 13:52:33 -0500135 - bash: |
Michael Schaffnerde326062020-07-14 17:50:35 -0700136 util/dvsim/dvsim.py hw/top_earlgrey/lint/top_earlgrey_lint_cfgs.hjson \
137 --tool=veriblelint
138 if [ $? != 0 ]; then
139 echo -n "##vso[task.logissue type=error]"
Michael Schaffnera94241f2020-08-03 15:50:14 -0700140 echo "Verilog style lint of RTL sources with Verible failed. Run 'util/dvsim/dvsim.py -t veriblelint hw/top_earlgrey/lint/top_earlgrey_lint_cfgs.hjson' to check and fix all errors."
Michael Schaffnerde326062020-07-14 17:50:35 -0700141 exit 1
142 fi
143 condition: eq(variables['Build.Reason'], 'PullRequest')
Michael Schaffnera94241f2020-08-03 15:50:14 -0700144 displayName: Style-Lint RTL Verilog source files with Verible
145 - bash: |
146 util/dvsim/dvsim.py hw/top_earlgrey/lint/top_earlgrey_dv_lint_cfgs.hjson \
147 --tool=veriblelint
148 if [ $? != 0 ]; then
149 echo -n "##vso[task.logissue type=error]"
150 echo "Verilog style lint of DV sources with Verible failed. Run 'util/dvsim/dvsim.py -t veriblelint hw/top_earlgrey/lint/top_earlgrey_dv_lint_cfgs.hjson' to check and fix all errors."
151 exit 1
152 fi
153 condition: eq(variables['Build.Reason'], 'PullRequest')
154 displayName: Style-Lint DV Verilog source files with Verible
Michael Schaffnerde326062020-07-14 17:50:35 -0700155 - bash: |
Philipp Wagner112875b2020-07-22 13:52:09 +0100156 commit_range="$(git merge-base --fork-point origin/$SYSTEM_PULLREQUEST_TARGETBRANCH)..HEAD"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000157 # Notes:
158 # * Merge commits are not checked. We always use rebases instead of
159 # merges to keep a linear history, which makes merge commits disappear
160 # ultimately, making them only a CI artifact which should not be
161 # checked.
162 # * 'type=error' is used even for warnings. Only "errors" are shown in
163 # the GitHub checks API. However, warnings don't return a non-zero
164 # error code and don't fail the build step.
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600165 util/lint_commits.py \
166 --no-merges \
167 --error-msg-prefix="##vso[task.logissue type=error]" \
168 --warning-msg-prefix="##vso[task.logissue type=error]" \
169 "$commit_range"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000170 # Only run on pull requests to check new commits only
171 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600172 displayName: Check commit metadata
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000173 - bash: |
Sam Elliott898321f2020-05-28 15:26:24 +0100174 # Here we look for all *.vendor.hjson files in the repo to re-vendor them.
175 # We exclude the following:
176 # - Any in 'hw/vendor/lowrisc_ibex', because that directory is vendored.
177 # - `./sw/vendor/riscv_compliance.vendor.hjson`, because it has whitespace
178 # issues in the repository that we cannot easily solve.
179 find . \
180 -not \( -path './hw/vendor/lowrisc_ibex' -prune \) \
181 -not \( -name 'riscv_compliance.vendor.hjson' \) \
182 -name '*.vendor.hjson' \
183 | xargs -n1 util/vendor.py --verbose \
184 && git diff --exit-code
185 if [[ $? != 0 ]]; then
186 echo -n "##vso[task.logissue type=error]"
187 echo "Vendored repositories not up-to-date. Run util/vendor.py to fix."
188 exit 1
189 fi
190 condition: always()
191 displayName: Check vendored directories are up-to-date
192 - bash: |
Philipp Wagnerda48ed22020-07-22 13:33:30 +0100193 set -e
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000194 only_doc_changes=0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600195 if [[ "$(Build.Reason)" = "PullRequest" ]]; then
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000196 # Conservative way of checking for documentation-only changes.
197 # Only relevant for pipelines triggered from pull requests
198 echo "Checking for doc-only changes in this pull request"
Philipp Wagner112875b2020-07-22 13:52:09 +0100199 fork_origin="$(git merge-base --fork-point origin/$SYSTEM_PULLREQUEST_TARGETBRANCH)"
Philipp Wagnerda48ed22020-07-22 13:33:30 +0100200 echo "Using $fork_origin as fork point from the target branch."
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600201 only_doc_changes="$(git diff --name-only "$fork_origin" | grep -v '\.md$' -q; echo $?)"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000202 fi
203 echo "##vso[task.setvariable variable=onlyDocChanges;isOutput=true]${only_doc_changes}"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600204 displayName: Check if the commit only contains documentation changes
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000205 name: DetermineBuildType
Sam Elliottd2028282020-06-02 18:18:54 +0100206 - bash: |
Philipp Wagner112875b2020-07-22 13:52:09 +0100207 fork_origin="$(git merge-base --fork-point origin/$SYSTEM_PULLREQUEST_TARGETBRANCH)"
Sam Elliottd2028282020-06-02 18:18:54 +0100208 changed_files="$(git diff --name-only --diff-filter=ACMRTUXB "$fork_origin")"
Rupert Swarbricka2d4d132020-07-20 16:23:08 +0100209 licence_checker=util/lowrisc_misc-linters/licence-checker/licence-checker.py
Sam Elliottd2028282020-06-02 18:18:54 +0100210 if [[ -n "$changed_files" ]]; then
211 set -o pipefail
Rupert Swarbricka2d4d132020-07-20 16:23:08 +0100212 xargs "$licence_checker" --config util/licence-checker.hjson <<< "$changed_files" | tee licence-checker-output
Sam Elliottd2028282020-06-02 18:18:54 +0100213 if [[ $? != 0 ]]; then
214 echo -n "##vso[task.logissue type=error]"
Rupert Swarbricka2d4d132020-07-20 16:23:08 +0100215 echo "Licence header check failed. Please check output of $licence_checker on the noted failures."
Sam Elliottd2028282020-06-02 18:18:54 +0100216 exit 1
217 fi
218 fi
219 condition: eq(variables['Build.Reason'], 'PullRequest')
220 displayName: Check Licence Headers
Philipp Wagner1e643552019-09-04 15:39:14 +0100221
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600222- job: sw_build
223 displayName: Build Software
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000224 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000225 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000226 pool:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600227 vmImage: ubuntu-16.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000228 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600229 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000230 - bash: |
231 set -x
232 sudo util/get-toolchain.py \
Sam Elliotteb8ace42020-06-03 17:47:55 +0100233 --target-dir="$TOOLCHAIN_PATH" \
234 --release-version="$TOOLCHAIN_VERSION" \
Philipp Wagner1c514412019-11-27 14:48:47 +0000235 --update
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600236 displayName: Install toolchain
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000237 - bash: |
Miguel Young de la Sota63793572019-11-13 14:18:51 -0600238 . util/build_consts.sh
Miguel Young de la Sota4a4946d2019-11-21 10:44:18 -0600239 ./meson_init.sh -A
Miguel Young de la Sota76526c32020-01-28 10:24:41 -0500240 ninja -C "$OBJ_DIR" all
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600241 displayName: Build embedded targets
Miguel Young de la Sota9d20b3d2020-02-03 16:35:31 -0500242 - bash: |
243 . util/build_consts.sh
244 ninja -C "$OBJ_DIR" test
Sam Elliotteb8ace42020-06-03 17:47:55 +0100245 displayName: Run unit tests
246 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600247 parameters:
248 artifact: sw_build
lowRISC Contributors802543a2019-08-31 12:12:56 +0100249
Luís Marques5849cd12020-06-26 10:33:55 +0100250# We continue building with GCC, despite defaulting to Clang. This is a copy of
251# `sw_build` with `meson_init.sh` configured with the GCC toolchain, instead of
252# the default toolchain.
253- job: sw_build_gcc
254 displayName: Build Software (with GCC)
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100255 dependsOn: lint
256 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
257 pool:
258 vmImage: ubuntu-16.04
259 steps:
260 - template: ci/install-package-dependencies.yml
261 - bash: |
262 set -x
263 sudo util/get-toolchain.py \
264 --target-dir="$TOOLCHAIN_PATH" \
265 --release-version="$TOOLCHAIN_VERSION" \
266 --update
267 displayName: Install toolchain
268 - bash: |
269 . util/build_consts.sh
270 ./meson_init.sh -A \
Luís Marques5849cd12020-06-26 10:33:55 +0100271 -t "$TOOLCHAIN_PATH/meson-riscv32-unknown-elf-gcc.txt"
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100272 ninja -C "$OBJ_DIR" all
273 displayName: Build embedded targets
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100274 - bash: |
275 . util/build_consts.sh
276 ninja -C "$OBJ_DIR" test
277 displayName: Run unit tests
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100278 - template: ci/upload-artifacts-template.yml
279 parameters:
Luís Marques5849cd12020-06-26 10:33:55 +0100280 artifact: sw_build_gcc
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100281
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600282- job: top_earlgrey_verilator
283 displayName: Build Verilator simulation of the Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000284 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000285 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000286 pool: Default
287 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600288 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000289 - bash: |
290 set -e
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600291 if [[ ! -d "$(VERILATOR_PATH)" ]]; then
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000292 echo "Building verilator (no cached build found)"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600293
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000294 mkdir -p build/verilator
295 cd build/verilator
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600296 curl -Ls -o verilator.tgz \
297 "https://www.veripool.org/ftp/verilator-$(VERILATOR_VERSION).tgz"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000298 tar -xf verilator.tgz
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600299
300 cd "verilator-$(VERILATOR_VERSION)"
301 ./configure --prefix="$(VERILATOR_PATH)"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000302 make -j$(nproc)
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600303 mkdir -p "$VERILATOR_PATH"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000304 make install
305 else
306 echo "Re-using cached verilator build"
307 fi
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600308 displayName: Build and install Verilator
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000309 - bash: |
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600310 export PATH="$VERILATOR_PATH/bin:$PATH"
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000311 python3 --version
312 fusesoc --version
313 verilator --version
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600314 displayName: Display environment
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000315 - bash: |
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600316 . util/build_consts.sh
317 mkdir -p "$OBJ_DIR/hw"
318 mkdir -p "$BIN_DIR/hw/top_earlgrey"
319
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600320 export PATH="$VERILATOR_PATH/bin:$PATH"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600321 fusesoc --cores-root=. \
322 run --target=sim --setup --build \
323 --build-root="$OBJ_DIR/hw" \
324 lowrisc:systems:top_earlgrey_verilator
325
326 cp "$OBJ_DIR/hw/sim-verilator/Vtop_earlgrey_verilator" \
327 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600328 displayName: Build simulation with Verilator
329 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600330 parameters:
331 artifact: top_earlgrey_verilator
Philipp Wagnerf4655a12019-10-30 11:59:15 +0000332
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600333- job: execute_verilated_tests
334 displayName: Execute tests on the Verilated system
Timothy Chenf7e85cb2019-12-10 16:24:39 -0800335 pool:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600336 vmImage: ubuntu-16.04
Timothy Chen7d1436d2019-12-04 17:26:14 -0800337 dependsOn:
338 - top_earlgrey_verilator
339 - sw_build
340 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600341 - template: ci/install-package-dependencies.yml
342 - template: ci/download-artifacts-template.yml
Timothy Chen7d1436d2019-12-04 17:26:14 -0800343 - bash: |
344 . util/build_consts.sh
345 export VERILATED_SYSTEM_PATH="$BIN_DIR/hw/top_earlgrey/Vtop_earlgrey_verilator"
Philipp Wagner57418e72019-12-02 21:25:27 +0000346 pytest --version
Timothy Chen7d1436d2019-12-04 17:26:14 -0800347 ci/run_verilator_pytest.sh
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600348 displayName: Execute tests
Timothy Chen7d1436d2019-12-04 17:26:14 -0800349
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100350- template: ci/run-riscv-compliance.yml
351 parameters:
352 rvc_test_suites:
353 - rv32i
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600354
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100355- template: ci/run-riscv-compliance.yml
356 parameters:
357 rvc_test_suites:
358 - rv32im
359 - rv32imc
360 - rv32Zicsr
Timothy Chen7d1436d2019-12-04 17:26:14 -0800361
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600362- job: top_earlgrey_nexysvideo
363 displayName: Build NexysVideo variant of the Earl Grey toplevel design using Vivado
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000364 dependsOn:
365 - lint
366 # The bootrom is built into the FPGA image at synthesis time.
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600367 - sw_build
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000368 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000369 pool: Default
370 timeoutInMinutes: 120 # 2 hours
371 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600372 - template: ci/install-package-dependencies.yml
373 - template: ci/download-artifacts-template.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000374 - bash: |
375 set -e
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600376 . util/build_consts.sh
377 mkdir -p "$OBJ_DIR/hw"
378 mkdir -p "$BIN_DIR/hw/top_earlgrey"
379
Greg Chadwick12871042020-04-20 13:42:56 +0100380 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.32.vmem"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600381 test -f "$BOOTROM_VMEM"
382
383 . /opt/xilinx/Vivado/2018.3/settings64.sh
384 fusesoc --cores-root=. \
385 run --target=synth --setup --build \
386 --build-root="$OBJ_DIR/hw" \
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000387 lowrisc:systems:top_earlgrey_nexysvideo \
Philipp Wagnera37bcfa2020-05-19 22:46:41 +0100388 --BootRomInitFile="$BOOTROM_VMEM"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600389
390 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_top_earlgrey_nexysvideo_0.1.bit" \
391 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600392 displayName: Build bitstream with Vivado
393 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600394 parameters:
395 artifact: top_earlgrey_nexysvideo
lowRISC Contributors802543a2019-08-31 12:12:56 +0100396
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600397- job: deploy_release_artifacts
398 displayName: Package and deploy release distribution
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000399 pool:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600400 vmImage: ubuntu-16.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000401 dependsOn:
402 - lint
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600403 - sw_build
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000404 - top_earlgrey_verilator
405 - top_earlgrey_nexysvideo
406 condition: eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0')
407 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600408 - template: ci/install-package-dependencies.yml
409 - template: ci/download-artifacts-template.yml
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600410 - bash: |
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600411 . util/build_consts.sh
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600412
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600413 util/make_distribution.sh
Philipp Wagner542e2202019-10-30 13:10:16 +0000414
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600415 tar --list -f $BIN_DIR/opentitan-*.tar.xz
416 # Put the resulting tar file into a directory the |publish| step below can reference.
417 mkdir "$BUILD_ROOT/dist-final"
418 mv $BIN_DIR/opentitan-*.tar.xz "$BUILD_ROOT/dist-final"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600419 displayName: Create final dist directory out of partial ones
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000420 - publish: $(Build.ArtifactStagingDirectory)/dist-final
421 artifact: opentitan-dist
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600422 displayName: Upload release artifacts as Azure artifact
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000423 - task: GithubRelease@0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600424 displayName: Upload to GitHub releases (only tags)
Philipp Wagner0b20f5d2019-11-01 16:24:52 +0000425 condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000426 inputs:
427 gitHubConnection: opentitan-release-upload
428 repositoryName: lowrisc/opentitan
429 addChangeLog: false
430 assets: |
431 $(Build.ArtifactStagingDirectory)/dist-final/*