blob: 8b22dd7c4f9e70ecf83c25e78435b1747b1bc03a [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:
Philipp Wagnere8ade052020-11-16 11:18:49 +00009 VERILATOR_VERSION: 4.104
Philipp Wagnerb02d9c82021-02-24 15:00:54 +000010 OPENOCD_VERSION: 0.11.0
Miguel Osorio88179fc2019-09-19 23:37:48 -070011 TOOLCHAIN_PATH: /opt/buildcache/riscv
Michael Schaffnere66fc612020-12-15 10:47:57 -080012 VERIBLE_VERSION: v0.0-808-g1e17daa
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
Philipp Wagnerca403532021-04-13 09:15:28 +010015 TOOLCHAIN_VERSION: 20210412-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)
Philipp Wagner11d2dcb2020-09-29 16:27:46 +010018 VIVADO_VERSION: "2020.1"
lowRISC Contributors802543a2019-08-31 12:12:56 +010019
20trigger:
lowRISC Contributors802543a2019-08-31 12:12:56 +010021 batch: true
22 branches:
23 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010024 - "*"
Philipp Wagnerdd1706e2020-03-15 14:39:59 +000025 tags:
26 include:
27 - "*"
28pr:
29 branches:
30 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010031 - "*"
lowRISC Contributors802543a2019-08-31 12:12:56 +010032
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000033jobs:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060034- job: lint
Sam Elliott67e30fa2020-10-06 18:08:05 +010035 displayName: Run code quality checks (quick lint)
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000036 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010037 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000038 steps:
39 - bash: |
Garret Kellyf5608d02019-11-01 16:28:11 -040040 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 -060041 displayName: Remove existing Clang installation
42 - template: ci/install-package-dependencies.yml
Rupert Swarbrick105df012021-01-29 11:33:13 +000043 ## !!!
44 ##
45 ## The steps below here are duplicated in ci/jobs/quick-lint.sh
46 ## to allow developers to "run CI" locally. Keep them in sync.
47 ##
48 ## !!!
49 - bash: ci/scripts/show-env.sh
Philipp Wagner99862392020-07-22 13:32:34 +010050 displayName: Display environment information
Rupert Swarbrick105df012021-01-29 11:33:13 +000051 - bash: ci/scripts/lint-commits.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000052 condition: eq(variables['Build.Reason'], 'PullRequest')
53 displayName: Check commit metadata
Rupert Swarbrick105df012021-01-29 11:33:13 +000054 - bash: ci/scripts/check-licence-headers.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000055 condition: eq(variables['Build.Reason'], 'PullRequest')
56 displayName: Check Licence Headers
Rupert Swarbrickf0d5b0c2021-03-26 11:48:42 +000057 - bash: ci/scripts/exec-check.sh
58 condition: eq(variables['Build.Reason'], 'PullRequest')
59 displayName: Check executable bits
Rupert Swarbrick105df012021-01-29 11:33:13 +000060 - bash: ci/scripts/python-lint.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000061 condition: eq(variables['Build.Reason'], 'PullRequest')
Rupert Swarbrick746f9b12021-03-26 17:19:00 +000062 displayName: Run Python lint (flake8)
Rupert Swarbrick2d70c752020-03-24 17:23:40 +000063 continueOnError: true
Rupert Swarbrick746f9b12021-03-26 17:19:00 +000064 - bash: ci/scripts/mypy.sh
65 condition: eq(variables['Build.Reason'], 'PullRequest')
66 displayName: Run Python lint (mypy)
Rupert Swarbrick105df012021-01-29 11:33:13 +000067 - bash: ci/scripts/check-generated.sh
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060068 displayName: Ensure all generated files are clean and up-to-date
Rupert Swarbrick105df012021-01-29 11:33:13 +000069 - bash: ci/scripts/clang-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000070 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060071 displayName: Use clang-format to check C/C++ coding style
Rupert Swarbrick105df012021-01-29 11:33:13 +000072 - bash: ci/scripts/include-guard.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Miguel Young de la Sotab23dc8c2020-01-14 13:52:33 -050073 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060074 displayName: Check formatting on header guards
Rupert Swarbrick105df012021-01-29 11:33:13 +000075 - bash: ci/scripts/verible-lint.sh rtl
Michael Schaffnerde326062020-07-14 17:50:35 -070076 condition: eq(variables['Build.Reason'], 'PullRequest')
Michael Schaffnera94241f2020-08-03 15:50:14 -070077 displayName: Style-Lint RTL Verilog source files with Verible
Rupert Swarbrick105df012021-01-29 11:33:13 +000078 - bash: ci/scripts/verible-lint.sh dv
Michael Schaffnera94241f2020-08-03 15:50:14 -070079 condition: eq(variables['Build.Reason'], 'PullRequest')
80 displayName: Style-Lint DV Verilog source files with Verible
Rupert Swarbrick105df012021-01-29 11:33:13 +000081 - bash: ci/scripts/build-docs.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000082 displayName: Render documentation
Rupert Swarbrick105df012021-01-29 11:33:13 +000083 - bash: ci/scripts/build-site.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000084 displayName: Render landing site
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000085 - bash: ci/scripts/get-build-type.sh "$SYSTEM_PULLREQUEST_TARGETBRANCH" "$(Build.Reason)"
Greg Chadwick99fe0642020-08-04 15:42:45 +010086 displayName: Check what kinds of changes the PR contains
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000087 name: DetermineBuildType
Philipp Wagner1e643552019-09-04 15:39:14 +010088
Sam Elliott67e30fa2020-10-06 18:08:05 +010089- job: slow_lints
90 displayName: Run code quality checks (in-depth lint)
91 dependsOn: lint
92 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010093 vmImage: ubuntu-18.04
Sam Elliott67e30fa2020-10-06 18:08:05 +010094 steps:
95 - template: ci/install-package-dependencies.yml
Rupert Swarbrick2aff11b2021-02-16 17:11:37 +000096 - bash: ci/scripts/check-vendoring.sh
Sam Elliott67e30fa2020-10-06 18:08:05 +010097 displayName: Check vendored directories are up-to-date
98
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060099- job: sw_build
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100100 displayName: Build Software for Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000101 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000102 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000103 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100104 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000105 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600106 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000107 - bash: |
108 set -x
109 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800110 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliotteb8ace42020-06-03 17:47:55 +0100111 --release-version="$TOOLCHAIN_VERSION" \
Philipp Wagner1c514412019-11-27 14:48:47 +0000112 --update
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600113 displayName: Install toolchain
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000114 - bash: |
Miguel Young de la Sota63793572019-11-13 14:18:51 -0600115 . util/build_consts.sh
Miguel Young de la Sota4a4946d2019-11-21 10:44:18 -0600116 ./meson_init.sh -A
Miguel Young de la Sota76526c32020-01-28 10:24:41 -0500117 ninja -C "$OBJ_DIR" all
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600118 displayName: Build embedded targets
Miguel Young de la Sota9d20b3d2020-02-03 16:35:31 -0500119 - bash: |
120 . util/build_consts.sh
121 ninja -C "$OBJ_DIR" test
Sam Elliotteb8ace42020-06-03 17:47:55 +0100122 displayName: Run unit tests
Philipp Wagner622ec3f2021-02-02 18:37:24 +0000123 - bash: |
124 . util/build_consts.sh
125 # Remove all Nexys Video-related build artifacts, which will be produced
126 # by the sw_build_nexysvideo job below (see comment there).
127 find "$BIN_DIR/sw/device" -name '*fpga_nexysvideo*' -type f -delete
128 displayName: Delete all Nexys Video build artifacts
Sam Elliotteb8ace42020-06-03 17:47:55 +0100129 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600130 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000131 includePatterns:
132 - "/sw/***"
lowRISC Contributors802543a2019-08-31 12:12:56 +0100133
Philipp Wagner622ec3f2021-02-02 18:37:24 +0000134# Software targeting the Nexys Video board is produced by patching the source
135# tree before building. This produces a full sw build tree, however only the
136# artifacts with "nexysvideo" in the name are actually the ones we're looking
137# for. Everything else will be discarded.
138# TODO: This is a rather ugly hack, which will go away once we properly support
139# building more than one top-level design with different parametrizations.
140# Work towards this goal is tracked in issue #4669.
Timothy Chenf835aa32021-01-08 16:27:50 -0800141- job: sw_build_nexysvideo
142 displayName: Build Software for Earl Grey toplevel design targeting the Nexys Video board
143 dependsOn: lint
144 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
145 pool:
146 vmImage: ubuntu-18.04
147 steps:
148 - template: ci/install-package-dependencies.yml
149 - bash: |
150 set -x
151 sudo util/get-toolchain.py \
152 --install-dir="$TOOLCHAIN_PATH" \
153 --release-version="$TOOLCHAIN_VERSION" \
154 --update
155 displayName: Install toolchain
156 - bash: |
157 . util/build_consts.sh
158 ./hw/top_earlgrey/util/top_earlgrey_reduce.py
159 ./meson_init.sh -A
160 ninja -C "$OBJ_DIR" all
Philipp Wagner622ec3f2021-02-02 18:37:24 +0000161
162 # Delete all build artifacts which are *not* for the Nexys Video board.
163 find "$BIN_DIR/sw/device" -not -name '*fpga_nexysvideo*' -type f -delete
Timothy Chenf835aa32021-01-08 16:27:50 -0800164 displayName: Build embedded targets
165 - bash: |
166 . util/build_consts.sh
167 ninja -C "$OBJ_DIR" test
168 displayName: Run unit tests
169 - template: ci/upload-artifacts-template.yml
170 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000171 includePatterns:
172 - "/sw/device/**/*nexysvideo*"
Timothy Chenf835aa32021-01-08 16:27:50 -0800173
Luís Marques5849cd12020-06-26 10:33:55 +0100174# We continue building with GCC, despite defaulting to Clang. This is a copy of
175# `sw_build` with `meson_init.sh` configured with the GCC toolchain, instead of
176# the default toolchain.
177- job: sw_build_gcc
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100178 displayName: Build Software for Earl Grey toplevel design (with GCC)
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100179 dependsOn: lint
180 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
181 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100182 vmImage: ubuntu-18.04
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100183 steps:
184 - template: ci/install-package-dependencies.yml
185 - bash: |
186 set -x
187 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800188 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100189 --release-version="$TOOLCHAIN_VERSION" \
190 --update
191 displayName: Install toolchain
192 - bash: |
193 . util/build_consts.sh
194 ./meson_init.sh -A \
Luís Marques5849cd12020-06-26 10:33:55 +0100195 -t "$TOOLCHAIN_PATH/meson-riscv32-unknown-elf-gcc.txt"
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100196 ninja -C "$OBJ_DIR" all
197 displayName: Build embedded targets
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100198 - bash: |
199 . util/build_consts.sh
200 ninja -C "$OBJ_DIR" test
201 displayName: Run unit tests
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100202
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700203- job: chip_earlgrey_verilator
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600204 displayName: Build Verilator simulation of the Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000205 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000206 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagner0907ca12020-04-21 12:04:32 +0100207 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100208 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000209 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600210 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000211 - bash: |
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000212 python3 --version
213 fusesoc --version
214 verilator --version
Michael Schaffneraa193f92020-12-16 11:16:17 -0800215 verible-verilog-lint --version
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600216 displayName: Display environment
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000217 - bash: |
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600218 . util/build_consts.sh
219 mkdir -p "$OBJ_DIR/hw"
220 mkdir -p "$BIN_DIR/hw/top_earlgrey"
221
Philipp Wagnerfa8c6922020-08-18 14:14:25 +0100222 # Compile the simulation without threading; the runners provided by
223 # Azure provide two virtual CPUs, which seems to equal one physical
224 # CPU (at most); the use of threading slows down the simulation.
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600225 fusesoc --cores-root=. \
Timothy Chenbe47dd72020-07-27 14:57:07 -0700226 run --flag=fileset_top --target=sim --setup --build \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600227 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700228 lowrisc:systems:chip_earlgrey_verilator \
Philipp Wagnerfa8c6922020-08-18 14:14:25 +0100229 --verilator_options="--no-threads"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600230
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700231 cp "$OBJ_DIR/hw/sim-verilator/Vchip_earlgrey_verilator" \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600232 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600233 displayName: Build simulation with Verilator
234 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600235 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000236 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700237 - "/hw/top_earlgrey/Vchip_earlgrey_verilator"
Philipp Wagnerf4655a12019-10-30 11:59:15 +0000238
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700239- job: chip_englishbreakfast_verilator
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100240 displayName: Build Verilator simulation of the English Breakfast toplevel design
241 dependsOn: lint
242 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
243 pool:
244 vmImage: ubuntu-18.04
245 steps:
246 - template: ci/install-package-dependencies.yml
247 - bash: |
248 python3 --version
249 fusesoc --version
250 verilator --version
251 verible-verilog-lint --version
252 displayName: Display environment
253 - bash: |
254 . util/build_consts.sh
255 mkdir -p "$OBJ_DIR/hw"
256 mkdir -p "$BIN_DIR/hw/top_englishbreakfast"
257
258 # Compile the simulation without threading; the runners provided by
259 # Azure provide two virtual CPUs, which seems to equal one physical
260 # CPU (at most); the use of threading slows down the simulation.
261 fusesoc --cores-root=. \
262 run --flag=fileset_topgen --target=sim --setup --build \
263 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700264 lowrisc:systems:chip_englishbreakfast_verilator \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100265 --verilator_options="--no-threads"
266
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700267 cp "$OBJ_DIR/hw/sim-verilator/Vchip_englishbreakfast_verilator" \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100268 "$BIN_DIR/hw/top_englishbreakfast"
269 displayName: Build simulation with Verilator
270 - template: ci/upload-artifacts-template.yml
271 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000272 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700273 - "/hw/top_englishbreakfast/Vchip_englishbreakfast_verilator"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100274
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600275- job: execute_verilated_tests
276 displayName: Execute tests on the Verilated system
Timothy Chenf7e85cb2019-12-10 16:24:39 -0800277 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100278 vmImage: ubuntu-18.04
Timothy Chen7d1436d2019-12-04 17:26:14 -0800279 dependsOn:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700280 - chip_earlgrey_verilator
Timothy Chen7d1436d2019-12-04 17:26:14 -0800281 - sw_build
282 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600283 - template: ci/install-package-dependencies.yml
284 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000285 parameters:
286 downloadPartialBuildBinFrom:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700287 - chip_earlgrey_verilator
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000288 - sw_build
Timothy Chen7d1436d2019-12-04 17:26:14 -0800289 - bash: |
Philipp Wagner33fadd02020-09-09 19:39:25 +0100290 # Install an additional pytest dependency for result upload.
291 pip3 install pytest-azurepipelines
292
Timothy Chen7d1436d2019-12-04 17:26:14 -0800293 . util/build_consts.sh
Philipp Wagner57418e72019-12-02 21:25:27 +0000294 pytest --version
Philipp Wagner03aaf322020-09-09 19:11:44 +0100295 pytest test/systemtest/earlgrey/test_sim_verilator.py \
Philipp Wagner33fadd02020-09-09 19:39:25 +0100296 --log-cli-level=DEBUG \
297 --test-run-title="Run system tests with Verilator simulation" \
298 --napoleon-docstrings
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600299 displayName: Execute tests
Timothy Chen7d1436d2019-12-04 17:26:14 -0800300
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100301- template: ci/run-riscv-compliance.yml
302 parameters:
303 rvc_test_suites:
304 - rv32i
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600305
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100306- template: ci/run-riscv-compliance.yml
307 parameters:
308 rvc_test_suites:
309 - rv32im
310 - rv32imc
311 - rv32Zicsr
Timothy Chen7d1436d2019-12-04 17:26:14 -0800312
Greg Chadwick99fe0642020-08-04 15:42:45 +0100313- job: otbn_standalone_tests
314 displayName: Run OTBN Smoke Test
315 dependsOn: lint
316 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.hasOTBNChanges'], '1'))
Philipp Wagner8d3e5632020-08-19 14:31:39 +0100317 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100318 vmImage: ubuntu-18.04
Philipp Wagnerbf0ab0a2020-12-15 12:03:42 +0000319 timeoutInMinutes: 10
Greg Chadwick99fe0642020-08-04 15:42:45 +0100320 steps:
321 - template: ci/install-package-dependencies.yml
322 - bash: |
323 set -x
324 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800325 --install-dir="$TOOLCHAIN_PATH" \
Greg Chadwick99fe0642020-08-04 15:42:45 +0100326 --release-version="$TOOLCHAIN_VERSION" \
327 --update
Rupert Swarbrick54278382020-08-25 12:45:47 +0100328 echo "##vso[task.prependpath]$TOOLCHAIN_PATH/bin"
Greg Chadwick99fe0642020-08-04 15:42:45 +0100329 displayName: Install toolchain
330 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100331 python3 --version
332 fusesoc --version
333 verilator --version
334 displayName: Display environment
335 - bash: |
Rupert Swarbrick7bd2a372020-10-02 12:36:12 +0100336 make -C hw/ip/otbn/dv/otbnsim test
337 displayName: OTBN ISS Test
338 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100339 ./hw/ip/otbn/dv/smoke/run_smoke.sh
340 displayName: OTBN Smoke Test
Rupert Swarbrick54278382020-08-25 12:45:47 +0100341 - bash: |
Rupert Swarbrick7087ed82020-11-13 18:16:46 +0000342 make -C hw/ip/otbn/util asm-check
Rupert Swarbrick54278382020-08-25 12:45:47 +0100343 displayName: Assemble and link code snippets
Greg Chadwick99fe0642020-08-04 15:42:45 +0100344
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700345- job: chip_earlgrey_nexysvideo
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600346 displayName: Build NexysVideo variant of the Earl Grey toplevel design using Vivado
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000347 dependsOn:
348 - lint
349 # The bootrom is built into the FPGA image at synthesis time.
Timothy Chenf835aa32021-01-08 16:27:50 -0800350 - sw_build_nexysvideo
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800351 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Philipp Wagnerc58f6a02020-10-07 19:57:09 +0100352 pool: ci-public
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000353 timeoutInMinutes: 120 # 2 hours
354 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600355 - template: ci/install-package-dependencies.yml
356 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000357 parameters:
358 downloadPartialBuildBinFrom:
359 - sw_build_nexysvideo
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000360 - bash: |
361 set -e
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600362 . util/build_consts.sh
Philipp Wagnerc58f6a02020-10-07 19:57:09 +0100363
364 module load "xilinx/vivado/$(VIVADO_VERSION)"
365
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600366 mkdir -p "$OBJ_DIR/hw"
367 mkdir -p "$BIN_DIR/hw/top_earlgrey"
368
Timothy Chenf835aa32021-01-08 16:27:50 -0800369 ./hw/top_earlgrey/util/top_earlgrey_reduce.py
370
Greg Chadwick12871042020-04-20 13:42:56 +0100371 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.32.vmem"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600372 test -f "$BOOTROM_VMEM"
Michael Schaffner20972a62021-02-24 18:53:46 -0800373 OTP_VMEM="$BIN_DIR/sw/device/otp_img/otp_img_fpga_nexysvideo.vmem"
374 test -f "$OTP_VMEM"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600375
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600376 fusesoc --cores-root=. \
Timothy Chenbe47dd72020-07-27 14:57:07 -0700377 run --flag=fileset_top --target=synth --setup --build \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600378 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700379 lowrisc:systems:chip_earlgrey_nexysvideo \
Michael Schaffner20972a62021-02-24 18:53:46 -0800380 --BootRomInitFile="$BOOTROM_VMEM" \
381 --OtpCtrlMemInitFile="$OTP_VMEM"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600382
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700383 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_earlgrey_nexysvideo_0.1.bit" \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600384 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600385 displayName: Build bitstream with Vivado
Philipp Wagnerf072c032020-12-08 17:16:30 +0000386 - bash: |
387 . util/build_consts.sh
388 echo Synthesis log
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700389 cat $OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_earlgrey_nexysvideo_0.1.runs/synth_1/runme.log || true
Philipp Wagnerf072c032020-12-08 17:16:30 +0000390
391 echo Implementation log
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700392 cat $OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_earlgrey_nexysvideo_0.1.runs/impl_1/runme.log || true
Philipp Wagnerf072c032020-12-08 17:16:30 +0000393 condition: always()
394 displayName: Display synthesis and implementation logs
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600395 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600396 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000397 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700398 - "/hw/top_earlgrey/lowrisc_systems_chip_earlgrey_nexysvideo_0.1.bit"
lowRISC Contributors802543a2019-08-31 12:12:56 +0100399
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700400- job: chip_englishbreakfast_cw305
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100401 displayName: Build CW305 variant of the English Breakfast toplevel design using Vivado
402 dependsOn:
403 - lint
404 # The bootrom is built into the FPGA image at synthesis time.
Pirmin Vogelc00e37f2020-12-23 21:35:47 +0100405 # Currently, we can't have different versions of binaries in $BIN_DIR. Consequently, we are
406 # using the NexysVideo bootrom here and the resulting CW305 bitstream is not functional.
407 # By generating the CW305 bootrom binary we would break execute_fpga_tests executed on the
408 # NexysVideo.
Philipp Wagner84bfe552021-02-02 18:48:07 +0000409 - sw_build_nexysvideo
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800410 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100411 pool: ci-public
412 timeoutInMinutes: 120 # 2 hours
413 steps:
414 - template: ci/install-package-dependencies.yml
415 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000416 parameters:
417 downloadPartialBuildBinFrom:
418 - sw_build_nexysvideo
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100419 - bash: |
420 set -e
421 . util/build_consts.sh
422
423 module load "xilinx/vivado/$(VIVADO_VERSION)"
424
425 mkdir -p "$OBJ_DIR/hw"
426 mkdir -p "$BIN_DIR/hw/top_englishbreakfast"
427
428 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.32.vmem"
429 test -f "$BOOTROM_VMEM"
430
431 fusesoc --cores-root=. \
432 run --flag=fileset_topgen --target=synth --setup --build \
433 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700434 lowrisc:systems:chip_englishbreakfast_cw305 \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100435 --BootRomInitFile="$BOOTROM_VMEM"
436
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700437 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_englishbreakfast_cw305_0.1.bit" \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100438 "$BIN_DIR/hw/top_englishbreakfast"
439 displayName: Build bitstream with Vivado
440 - template: ci/upload-artifacts-template.yml
441 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000442 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700443 - "/hw/top_englishbreakfast/lowrisc_systems_chip_englishbreakfast_cw305_0.1.bit"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100444
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100445- job: execute_fpga_tests
446 displayName: Execute tests on FPGA
447 pool: FPGA
448 timeoutInMinutes: 30
449 dependsOn:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700450 - chip_earlgrey_nexysvideo
Timothy Chenf835aa32021-01-08 16:27:50 -0800451 - sw_build_nexysvideo
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000452 - sw_build
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100453 steps:
454 - template: ci/install-package-dependencies.yml
455 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000456 parameters:
457 downloadPartialBuildBinFrom:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700458 - chip_earlgrey_nexysvideo
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000459 - sw_build_nexysvideo
460 - sw_build
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100461 - bash: |
462 set -e
463
464 module load "xilinx/vivado/$(VIVADO_VERSION)"
465
466 # Install an additional pytest dependency for result upload.
467 pip3 install pytest-azurepipelines
468
469 . util/build_consts.sh
470 pytest --version
471 pytest test/systemtest/earlgrey/test_fpga_nexysvideo.py \
472 --log-cli-level=DEBUG \
473 --test-run-title="Run system tests on Nexys Video FPGA board" \
474 --napoleon-docstrings
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100475 displayName: Execute tests
476
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600477- job: deploy_release_artifacts
478 displayName: Package and deploy release distribution
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000479 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100480 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000481 dependsOn:
482 - lint
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600483 - sw_build
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700484 - chip_earlgrey_verilator
485 - chip_earlgrey_nexysvideo
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800486 condition: and(eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000487 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600488 - template: ci/install-package-dependencies.yml
489 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000490 parameters:
491 downloadPartialBuildBinFrom:
492 - sw_build
493 - sw_build_nexysvideo
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700494 - chip_earlgrey_verilator
495 - chip_earlgrey_nexysvideo
496 - chip_englishbreakfast_verilator
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600497 - bash: |
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600498 . util/build_consts.sh
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600499
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600500 util/make_distribution.sh
Philipp Wagner542e2202019-10-30 13:10:16 +0000501
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600502 tar --list -f $BIN_DIR/opentitan-*.tar.xz
503 # Put the resulting tar file into a directory the |publish| step below can reference.
504 mkdir "$BUILD_ROOT/dist-final"
505 mv $BIN_DIR/opentitan-*.tar.xz "$BUILD_ROOT/dist-final"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600506 displayName: Create final dist directory out of partial ones
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000507 - publish: $(Build.ArtifactStagingDirectory)/dist-final
508 artifact: opentitan-dist
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600509 displayName: Upload release artifacts as Azure artifact
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000510 - task: GithubRelease@0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600511 displayName: Upload to GitHub releases (only tags)
Philipp Wagner0b20f5d2019-11-01 16:24:52 +0000512 condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000513 inputs:
514 gitHubConnection: opentitan-release-upload
515 repositoryName: lowrisc/opentitan
516 addChangeLog: false
517 assets: |
518 $(Build.ArtifactStagingDirectory)/dist-final/*
Sam Elliotte257cd02020-09-10 13:49:38 +0100519
520
521- job: build_docker_containers
522 displayName: "Build Docker Containers"
523 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100524 vmImage: ubuntu-18.04
Sam Elliotte257cd02020-09-10 13:49:38 +0100525 dependsOn:
526 - lint
527 steps:
528 - task: Docker@2
529 displayName: Build Developer Utility Container
530 inputs:
531 command: build
532 Dockerfile: ./util/container/Dockerfile
533 buildContext: .
534 - task: Docker@2
535 displayName: Build Documentation Builder Container
536 inputs:
537 command: build
538 tags: gcr.io/active-premise-257318/builder
539 Dockerfile: ./site/docs/builder.Dockerfile
540 buildContext: .
541 - task: Docker@2
542 displayName: Build Documentation Redirector Container
543 inputs:
544 command: build
545 Dockerfile: ./site/redirector/Dockerfile
546 buildContext: ./site/redirector