blob: 305ea4c2b96b64626f814284b6e17414b5fab5ce [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:
Rupert Swarbrickdf237122021-04-20 14:43:48 +01009 #
10 # If updating VERILATOR_VERSION, OPENOCD_VERSION or TOOLCHAIN_VERSION, update
11 # the definitions in util/container/Dockerfile as well.
12 #
Philipp Wagnere8ade052020-11-16 11:18:49 +000013 VERILATOR_VERSION: 4.104
Philipp Wagnerb02d9c82021-02-24 15:00:54 +000014 OPENOCD_VERSION: 0.11.0
Miguel Osorio88179fc2019-09-19 23:37:48 -070015 TOOLCHAIN_PATH: /opt/buildcache/riscv
Michael Schaffnere66fc612020-12-15 10:47:57 -080016 VERIBLE_VERSION: v0.0-808-g1e17daa
Miguel Osorio88179fc2019-09-19 23:37:48 -070017 # Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
Philipp Wagnerca403532021-04-13 09:15:28 +010018 TOOLCHAIN_VERSION: 20210412-1
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -060019 # This controls where builds happen, and gets picked up by build_consts.sh.
20 BUILD_ROOT: $(Build.ArtifactStagingDirectory)
Philipp Wagner11d2dcb2020-09-29 16:27:46 +010021 VIVADO_VERSION: "2020.1"
lowRISC Contributors802543a2019-08-31 12:12:56 +010022
23trigger:
lowRISC Contributors802543a2019-08-31 12:12:56 +010024 batch: true
25 branches:
26 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010027 - "*"
Philipp Wagnerdd1706e2020-03-15 14:39:59 +000028 tags:
29 include:
30 - "*"
31pr:
32 branches:
33 include:
Philipp Wagnerf565b662020-07-22 14:04:40 +010034 - "*"
lowRISC Contributors802543a2019-08-31 12:12:56 +010035
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000036jobs:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060037- job: lint
Sam Elliott67e30fa2020-10-06 18:08:05 +010038 displayName: Run code quality checks (quick lint)
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000039 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010040 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000041 steps:
42 - bash: |
Garret Kellyf5608d02019-11-01 16:28:11 -040043 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 -060044 displayName: Remove existing Clang installation
45 - template: ci/install-package-dependencies.yml
Rupert Swarbrick105df012021-01-29 11:33:13 +000046 ## !!!
47 ##
48 ## The steps below here are duplicated in ci/jobs/quick-lint.sh
49 ## to allow developers to "run CI" locally. Keep them in sync.
50 ##
51 ## !!!
52 - bash: ci/scripts/show-env.sh
Philipp Wagner99862392020-07-22 13:32:34 +010053 displayName: Display environment information
Rupert Swarbrick105df012021-01-29 11:33:13 +000054 - bash: ci/scripts/lint-commits.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000055 condition: eq(variables['Build.Reason'], 'PullRequest')
56 displayName: Check commit metadata
Rupert Swarbrick105df012021-01-29 11:33:13 +000057 - bash: ci/scripts/check-licence-headers.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000058 condition: eq(variables['Build.Reason'], 'PullRequest')
59 displayName: Check Licence Headers
Rupert Swarbrickf0d5b0c2021-03-26 11:48:42 +000060 - bash: ci/scripts/exec-check.sh
61 condition: eq(variables['Build.Reason'], 'PullRequest')
62 displayName: Check executable bits
Rupert Swarbrick105df012021-01-29 11:33:13 +000063 - bash: ci/scripts/python-lint.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000064 condition: eq(variables['Build.Reason'], 'PullRequest')
Rupert Swarbrick746f9b12021-03-26 17:19:00 +000065 displayName: Run Python lint (flake8)
Rupert Swarbrick2d70c752020-03-24 17:23:40 +000066 continueOnError: true
Rupert Swarbrick746f9b12021-03-26 17:19:00 +000067 - bash: ci/scripts/mypy.sh
68 condition: eq(variables['Build.Reason'], 'PullRequest')
69 displayName: Run Python lint (mypy)
Rupert Swarbrick105df012021-01-29 11:33:13 +000070 - bash: ci/scripts/check-generated.sh
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060071 displayName: Ensure all generated files are clean and up-to-date
Rupert Swarbrick105df012021-01-29 11:33:13 +000072 - bash: ci/scripts/clang-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000073 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060074 displayName: Use clang-format to check C/C++ coding style
Rupert Swarbrick105df012021-01-29 11:33:13 +000075 - bash: ci/scripts/include-guard.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Miguel Young de la Sotab23dc8c2020-01-14 13:52:33 -050076 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060077 displayName: Check formatting on header guards
Rupert Swarbrick105df012021-01-29 11:33:13 +000078 - bash: ci/scripts/verible-lint.sh rtl
Michael Schaffnerde326062020-07-14 17:50:35 -070079 condition: eq(variables['Build.Reason'], 'PullRequest')
Michael Schaffnera94241f2020-08-03 15:50:14 -070080 displayName: Style-Lint RTL Verilog source files with Verible
Rupert Swarbrick105df012021-01-29 11:33:13 +000081 - bash: ci/scripts/verible-lint.sh dv
Michael Schaffnera94241f2020-08-03 15:50:14 -070082 condition: eq(variables['Build.Reason'], 'PullRequest')
83 displayName: Style-Lint DV Verilog source files with Verible
Rupert Swarbrick105df012021-01-29 11:33:13 +000084 - bash: ci/scripts/build-docs.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000085 displayName: Render documentation
Rupert Swarbrick105df012021-01-29 11:33:13 +000086 - bash: ci/scripts/build-site.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000087 displayName: Render landing site
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000088 - bash: ci/scripts/get-build-type.sh "$SYSTEM_PULLREQUEST_TARGETBRANCH" "$(Build.Reason)"
Greg Chadwick99fe0642020-08-04 15:42:45 +010089 displayName: Check what kinds of changes the PR contains
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000090 name: DetermineBuildType
Philipp Wagner1e643552019-09-04 15:39:14 +010091
Sam Elliott67e30fa2020-10-06 18:08:05 +010092- job: slow_lints
93 displayName: Run code quality checks (in-depth lint)
94 dependsOn: lint
95 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010096 vmImage: ubuntu-18.04
Sam Elliott67e30fa2020-10-06 18:08:05 +010097 steps:
98 - template: ci/install-package-dependencies.yml
Rupert Swarbrick2aff11b2021-02-16 17:11:37 +000099 - bash: ci/scripts/check-vendoring.sh
Sam Elliott67e30fa2020-10-06 18:08:05 +0100100 displayName: Check vendored directories are up-to-date
101
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600102- job: sw_build
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100103 displayName: Build Software for Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000104 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000105 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000106 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100107 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000108 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600109 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000110 - bash: |
111 set -x
112 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800113 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliotteb8ace42020-06-03 17:47:55 +0100114 --release-version="$TOOLCHAIN_VERSION" \
Philipp Wagner1c514412019-11-27 14:48:47 +0000115 --update
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600116 displayName: Install toolchain
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000117 - bash: |
Miguel Young de la Sota63793572019-11-13 14:18:51 -0600118 . util/build_consts.sh
Miguel Young de la Sota4a4946d2019-11-21 10:44:18 -0600119 ./meson_init.sh -A
Miguel Young de la Sota76526c32020-01-28 10:24:41 -0500120 ninja -C "$OBJ_DIR" all
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600121 displayName: Build embedded targets
Miguel Young de la Sota9d20b3d2020-02-03 16:35:31 -0500122 - bash: |
123 . util/build_consts.sh
124 ninja -C "$OBJ_DIR" test
Sam Elliotteb8ace42020-06-03 17:47:55 +0100125 displayName: Run unit tests
Philipp Wagner622ec3f2021-02-02 18:37:24 +0000126 - bash: |
127 . util/build_consts.sh
128 # Remove all Nexys Video-related build artifacts, which will be produced
129 # by the sw_build_nexysvideo job below (see comment there).
130 find "$BIN_DIR/sw/device" -name '*fpga_nexysvideo*' -type f -delete
131 displayName: Delete all Nexys Video build artifacts
Sam Elliotteb8ace42020-06-03 17:47:55 +0100132 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600133 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000134 includePatterns:
135 - "/sw/***"
lowRISC Contributors802543a2019-08-31 12:12:56 +0100136
Philipp Wagner622ec3f2021-02-02 18:37:24 +0000137# Software targeting the Nexys Video board is produced by patching the source
138# tree before building. This produces a full sw build tree, however only the
139# artifacts with "nexysvideo" in the name are actually the ones we're looking
140# for. Everything else will be discarded.
141# TODO: This is a rather ugly hack, which will go away once we properly support
142# building more than one top-level design with different parametrizations.
143# Work towards this goal is tracked in issue #4669.
Timothy Chenf835aa32021-01-08 16:27:50 -0800144- job: sw_build_nexysvideo
145 displayName: Build Software for Earl Grey toplevel design targeting the Nexys Video board
146 dependsOn: lint
147 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
148 pool:
149 vmImage: ubuntu-18.04
150 steps:
151 - template: ci/install-package-dependencies.yml
152 - bash: |
153 set -x
154 sudo util/get-toolchain.py \
155 --install-dir="$TOOLCHAIN_PATH" \
156 --release-version="$TOOLCHAIN_VERSION" \
157 --update
158 displayName: Install toolchain
159 - bash: |
160 . util/build_consts.sh
161 ./hw/top_earlgrey/util/top_earlgrey_reduce.py
162 ./meson_init.sh -A
163 ninja -C "$OBJ_DIR" all
Philipp Wagner622ec3f2021-02-02 18:37:24 +0000164
165 # Delete all build artifacts which are *not* for the Nexys Video board.
166 find "$BIN_DIR/sw/device" -not -name '*fpga_nexysvideo*' -type f -delete
Timothy Chenf835aa32021-01-08 16:27:50 -0800167 displayName: Build embedded targets
168 - bash: |
169 . util/build_consts.sh
170 ninja -C "$OBJ_DIR" test
171 displayName: Run unit tests
172 - template: ci/upload-artifacts-template.yml
173 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000174 includePatterns:
175 - "/sw/device/**/*nexysvideo*"
Timothy Chenf835aa32021-01-08 16:27:50 -0800176
Luís Marques5849cd12020-06-26 10:33:55 +0100177# We continue building with GCC, despite defaulting to Clang. This is a copy of
178# `sw_build` with `meson_init.sh` configured with the GCC toolchain, instead of
179# the default toolchain.
180- job: sw_build_gcc
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100181 displayName: Build Software for Earl Grey toplevel design (with GCC)
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100182 dependsOn: lint
183 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
184 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100185 vmImage: ubuntu-18.04
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100186 steps:
187 - template: ci/install-package-dependencies.yml
188 - bash: |
189 set -x
190 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800191 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100192 --release-version="$TOOLCHAIN_VERSION" \
193 --update
194 displayName: Install toolchain
195 - bash: |
196 . util/build_consts.sh
197 ./meson_init.sh -A \
Luís Marques5849cd12020-06-26 10:33:55 +0100198 -t "$TOOLCHAIN_PATH/meson-riscv32-unknown-elf-gcc.txt"
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100199 ninja -C "$OBJ_DIR" all
200 displayName: Build embedded targets
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100201 - bash: |
202 . util/build_consts.sh
203 ninja -C "$OBJ_DIR" test
204 displayName: Run unit tests
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100205
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700206- job: chip_earlgrey_verilator
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600207 displayName: Build Verilator simulation of the Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000208 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000209 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagner0907ca12020-04-21 12:04:32 +0100210 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100211 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000212 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600213 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000214 - bash: |
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000215 python3 --version
216 fusesoc --version
217 verilator --version
Michael Schaffneraa193f92020-12-16 11:16:17 -0800218 verible-verilog-lint --version
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600219 displayName: Display environment
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000220 - bash: |
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600221 . util/build_consts.sh
222 mkdir -p "$OBJ_DIR/hw"
223 mkdir -p "$BIN_DIR/hw/top_earlgrey"
224
Philipp Wagnerfa8c6922020-08-18 14:14:25 +0100225 # Compile the simulation without threading; the runners provided by
226 # Azure provide two virtual CPUs, which seems to equal one physical
227 # CPU (at most); the use of threading slows down the simulation.
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600228 fusesoc --cores-root=. \
Timothy Chenbe47dd72020-07-27 14:57:07 -0700229 run --flag=fileset_top --target=sim --setup --build \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600230 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700231 lowrisc:systems:chip_earlgrey_verilator \
Philipp Wagnerfa8c6922020-08-18 14:14:25 +0100232 --verilator_options="--no-threads"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600233
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700234 cp "$OBJ_DIR/hw/sim-verilator/Vchip_earlgrey_verilator" \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600235 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600236 displayName: Build simulation with Verilator
237 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600238 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000239 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700240 - "/hw/top_earlgrey/Vchip_earlgrey_verilator"
Philipp Wagnerf4655a12019-10-30 11:59:15 +0000241
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700242- job: chip_englishbreakfast_verilator
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100243 displayName: Build Verilator simulation of the English Breakfast toplevel design
244 dependsOn: lint
245 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
246 pool:
247 vmImage: ubuntu-18.04
248 steps:
249 - template: ci/install-package-dependencies.yml
250 - bash: |
251 python3 --version
252 fusesoc --version
253 verilator --version
254 verible-verilog-lint --version
255 displayName: Display environment
256 - bash: |
257 . util/build_consts.sh
258 mkdir -p "$OBJ_DIR/hw"
259 mkdir -p "$BIN_DIR/hw/top_englishbreakfast"
260
261 # Compile the simulation without threading; the runners provided by
262 # Azure provide two virtual CPUs, which seems to equal one physical
263 # CPU (at most); the use of threading slows down the simulation.
264 fusesoc --cores-root=. \
265 run --flag=fileset_topgen --target=sim --setup --build \
266 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700267 lowrisc:systems:chip_englishbreakfast_verilator \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100268 --verilator_options="--no-threads"
269
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700270 cp "$OBJ_DIR/hw/sim-verilator/Vchip_englishbreakfast_verilator" \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100271 "$BIN_DIR/hw/top_englishbreakfast"
272 displayName: Build simulation with Verilator
273 - template: ci/upload-artifacts-template.yml
274 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000275 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700276 - "/hw/top_englishbreakfast/Vchip_englishbreakfast_verilator"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100277
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600278- job: execute_verilated_tests
279 displayName: Execute tests on the Verilated system
Timothy Chenf7e85cb2019-12-10 16:24:39 -0800280 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100281 vmImage: ubuntu-18.04
Timothy Chen7d1436d2019-12-04 17:26:14 -0800282 dependsOn:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700283 - chip_earlgrey_verilator
Timothy Chen7d1436d2019-12-04 17:26:14 -0800284 - sw_build
285 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600286 - template: ci/install-package-dependencies.yml
287 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000288 parameters:
289 downloadPartialBuildBinFrom:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700290 - chip_earlgrey_verilator
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000291 - sw_build
Timothy Chen7d1436d2019-12-04 17:26:14 -0800292 - bash: |
Philipp Wagner33fadd02020-09-09 19:39:25 +0100293 # Install an additional pytest dependency for result upload.
294 pip3 install pytest-azurepipelines
295
Timothy Chen7d1436d2019-12-04 17:26:14 -0800296 . util/build_consts.sh
Philipp Wagner57418e72019-12-02 21:25:27 +0000297 pytest --version
Philipp Wagner03aaf322020-09-09 19:11:44 +0100298 pytest test/systemtest/earlgrey/test_sim_verilator.py \
Philipp Wagner33fadd02020-09-09 19:39:25 +0100299 --log-cli-level=DEBUG \
300 --test-run-title="Run system tests with Verilator simulation" \
301 --napoleon-docstrings
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600302 displayName: Execute tests
Timothy Chen7d1436d2019-12-04 17:26:14 -0800303
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100304- template: ci/run-riscv-compliance.yml
305 parameters:
306 rvc_test_suites:
307 - rv32i
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600308
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100309- template: ci/run-riscv-compliance.yml
310 parameters:
311 rvc_test_suites:
312 - rv32im
313 - rv32imc
314 - rv32Zicsr
Timothy Chen7d1436d2019-12-04 17:26:14 -0800315
Greg Chadwick99fe0642020-08-04 15:42:45 +0100316- job: otbn_standalone_tests
317 displayName: Run OTBN Smoke Test
318 dependsOn: lint
319 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.hasOTBNChanges'], '1'))
Philipp Wagner8d3e5632020-08-19 14:31:39 +0100320 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100321 vmImage: ubuntu-18.04
Philipp Wagnerbf0ab0a2020-12-15 12:03:42 +0000322 timeoutInMinutes: 10
Greg Chadwick99fe0642020-08-04 15:42:45 +0100323 steps:
324 - template: ci/install-package-dependencies.yml
325 - bash: |
326 set -x
327 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800328 --install-dir="$TOOLCHAIN_PATH" \
Greg Chadwick99fe0642020-08-04 15:42:45 +0100329 --release-version="$TOOLCHAIN_VERSION" \
330 --update
Rupert Swarbrick54278382020-08-25 12:45:47 +0100331 echo "##vso[task.prependpath]$TOOLCHAIN_PATH/bin"
Greg Chadwick99fe0642020-08-04 15:42:45 +0100332 displayName: Install toolchain
333 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100334 python3 --version
335 fusesoc --version
336 verilator --version
337 displayName: Display environment
338 - bash: |
Rupert Swarbrick7bd2a372020-10-02 12:36:12 +0100339 make -C hw/ip/otbn/dv/otbnsim test
340 displayName: OTBN ISS Test
341 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100342 ./hw/ip/otbn/dv/smoke/run_smoke.sh
343 displayName: OTBN Smoke Test
Rupert Swarbrick54278382020-08-25 12:45:47 +0100344 - bash: |
Rupert Swarbrick7087ed82020-11-13 18:16:46 +0000345 make -C hw/ip/otbn/util asm-check
Rupert Swarbrick54278382020-08-25 12:45:47 +0100346 displayName: Assemble and link code snippets
Greg Chadwick99fe0642020-08-04 15:42:45 +0100347
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700348- job: chip_earlgrey_nexysvideo
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600349 displayName: Build NexysVideo variant of the Earl Grey toplevel design using Vivado
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000350 dependsOn:
351 - lint
352 # The bootrom is built into the FPGA image at synthesis time.
Timothy Chenf835aa32021-01-08 16:27:50 -0800353 - sw_build_nexysvideo
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800354 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Philipp Wagnerc58f6a02020-10-07 19:57:09 +0100355 pool: ci-public
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000356 timeoutInMinutes: 120 # 2 hours
357 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600358 - template: ci/install-package-dependencies.yml
359 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000360 parameters:
361 downloadPartialBuildBinFrom:
362 - sw_build_nexysvideo
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000363 - bash: |
364 set -e
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600365 . util/build_consts.sh
Philipp Wagnerc58f6a02020-10-07 19:57:09 +0100366
367 module load "xilinx/vivado/$(VIVADO_VERSION)"
368
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600369 mkdir -p "$OBJ_DIR/hw"
370 mkdir -p "$BIN_DIR/hw/top_earlgrey"
371
Timothy Chenf835aa32021-01-08 16:27:50 -0800372 ./hw/top_earlgrey/util/top_earlgrey_reduce.py
373
Rupert Swarbrick830aac52021-03-19 17:00:18 +0000374 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.scr.40.vmem"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600375 test -f "$BOOTROM_VMEM"
Michael Schaffner20972a62021-02-24 18:53:46 -0800376 OTP_VMEM="$BIN_DIR/sw/device/otp_img/otp_img_fpga_nexysvideo.vmem"
377 test -f "$OTP_VMEM"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600378
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600379 fusesoc --cores-root=. \
Timothy Chenbe47dd72020-07-27 14:57:07 -0700380 run --flag=fileset_top --target=synth --setup --build \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600381 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700382 lowrisc:systems:chip_earlgrey_nexysvideo \
Michael Schaffner20972a62021-02-24 18:53:46 -0800383 --BootRomInitFile="$BOOTROM_VMEM" \
384 --OtpCtrlMemInitFile="$OTP_VMEM"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600385
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700386 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_earlgrey_nexysvideo_0.1.bit" \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600387 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600388 displayName: Build bitstream with Vivado
Philipp Wagnerf072c032020-12-08 17:16:30 +0000389 - bash: |
390 . util/build_consts.sh
391 echo Synthesis log
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700392 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 +0000393
394 echo Implementation log
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700395 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 +0000396 condition: always()
397 displayName: Display synthesis and implementation logs
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600398 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600399 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000400 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700401 - "/hw/top_earlgrey/lowrisc_systems_chip_earlgrey_nexysvideo_0.1.bit"
lowRISC Contributors802543a2019-08-31 12:12:56 +0100402
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700403- job: chip_englishbreakfast_cw305
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100404 displayName: Build CW305 variant of the English Breakfast toplevel design using Vivado
405 dependsOn:
406 - lint
407 # The bootrom is built into the FPGA image at synthesis time.
Pirmin Vogelc00e37f2020-12-23 21:35:47 +0100408 # Currently, we can't have different versions of binaries in $BIN_DIR. Consequently, we are
409 # using the NexysVideo bootrom here and the resulting CW305 bitstream is not functional.
410 # By generating the CW305 bootrom binary we would break execute_fpga_tests executed on the
411 # NexysVideo.
Philipp Wagner84bfe552021-02-02 18:48:07 +0000412 - sw_build_nexysvideo
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800413 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100414 pool: ci-public
415 timeoutInMinutes: 120 # 2 hours
416 steps:
417 - template: ci/install-package-dependencies.yml
418 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000419 parameters:
420 downloadPartialBuildBinFrom:
421 - sw_build_nexysvideo
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100422 - bash: |
423 set -e
424 . util/build_consts.sh
425
426 module load "xilinx/vivado/$(VIVADO_VERSION)"
427
428 mkdir -p "$OBJ_DIR/hw"
429 mkdir -p "$BIN_DIR/hw/top_englishbreakfast"
430
Rupert Swarbrick830aac52021-03-19 17:00:18 +0000431 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.scr.40.vmem"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100432 test -f "$BOOTROM_VMEM"
433
434 fusesoc --cores-root=. \
435 run --flag=fileset_topgen --target=synth --setup --build \
436 --build-root="$OBJ_DIR/hw" \
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700437 lowrisc:systems:chip_englishbreakfast_cw305 \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100438 --BootRomInitFile="$BOOTROM_VMEM"
439
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700440 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_chip_englishbreakfast_cw305_0.1.bit" \
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100441 "$BIN_DIR/hw/top_englishbreakfast"
442 displayName: Build bitstream with Vivado
443 - template: ci/upload-artifacts-template.yml
444 parameters:
Philipp Wagner5aa7ed32021-02-02 18:53:36 +0000445 includePatterns:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700446 - "/hw/top_englishbreakfast/lowrisc_systems_chip_englishbreakfast_cw305_0.1.bit"
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100447
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100448- job: execute_fpga_tests
449 displayName: Execute tests on FPGA
450 pool: FPGA
451 timeoutInMinutes: 30
452 dependsOn:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700453 - chip_earlgrey_nexysvideo
Timothy Chenf835aa32021-01-08 16:27:50 -0800454 - sw_build_nexysvideo
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000455 - sw_build
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100456 steps:
457 - template: ci/install-package-dependencies.yml
458 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000459 parameters:
460 downloadPartialBuildBinFrom:
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700461 - chip_earlgrey_nexysvideo
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000462 - sw_build_nexysvideo
463 - sw_build
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100464 - bash: |
465 set -e
466
467 module load "xilinx/vivado/$(VIVADO_VERSION)"
468
469 # Install an additional pytest dependency for result upload.
470 pip3 install pytest-azurepipelines
471
472 . util/build_consts.sh
473 pytest --version
474 pytest test/systemtest/earlgrey/test_fpga_nexysvideo.py \
475 --log-cli-level=DEBUG \
476 --test-run-title="Run system tests on Nexys Video FPGA board" \
477 --napoleon-docstrings
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100478 displayName: Execute tests
479
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600480- job: deploy_release_artifacts
481 displayName: Package and deploy release distribution
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000482 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100483 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000484 dependsOn:
485 - lint
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600486 - sw_build
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700487 - chip_earlgrey_verilator
488 - chip_earlgrey_nexysvideo
Timothy Chen64f6a5a2021-02-05 17:04:40 -0800489 condition: and(eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'), eq(dependencies.lint.outputs['DetermineBuildType.onlyDvChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000490 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600491 - template: ci/install-package-dependencies.yml
492 - template: ci/download-artifacts-template.yml
Philipp Wagnerbdfb9332021-02-02 18:10:06 +0000493 parameters:
494 downloadPartialBuildBinFrom:
495 - sw_build
496 - sw_build_nexysvideo
Michael Schaffner93fe50c2021-03-31 16:25:42 -0700497 - chip_earlgrey_verilator
498 - chip_earlgrey_nexysvideo
499 - chip_englishbreakfast_verilator
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600500 - bash: |
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600501 . util/build_consts.sh
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600502
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600503 util/make_distribution.sh
Philipp Wagner542e2202019-10-30 13:10:16 +0000504
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600505 tar --list -f $BIN_DIR/opentitan-*.tar.xz
506 # Put the resulting tar file into a directory the |publish| step below can reference.
507 mkdir "$BUILD_ROOT/dist-final"
508 mv $BIN_DIR/opentitan-*.tar.xz "$BUILD_ROOT/dist-final"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600509 displayName: Create final dist directory out of partial ones
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000510 - publish: $(Build.ArtifactStagingDirectory)/dist-final
511 artifact: opentitan-dist
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600512 displayName: Upload release artifacts as Azure artifact
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000513 - task: GithubRelease@0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600514 displayName: Upload to GitHub releases (only tags)
Philipp Wagner0b20f5d2019-11-01 16:24:52 +0000515 condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000516 inputs:
517 gitHubConnection: opentitan-release-upload
518 repositoryName: lowrisc/opentitan
519 addChangeLog: false
520 assets: |
521 $(Build.ArtifactStagingDirectory)/dist-final/*
Sam Elliotte257cd02020-09-10 13:49:38 +0100522
523
524- job: build_docker_containers
525 displayName: "Build Docker Containers"
526 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100527 vmImage: ubuntu-18.04
Sam Elliotte257cd02020-09-10 13:49:38 +0100528 dependsOn:
529 - lint
530 steps:
531 - task: Docker@2
532 displayName: Build Developer Utility Container
533 inputs:
534 command: build
535 Dockerfile: ./util/container/Dockerfile
536 buildContext: .
537 - task: Docker@2
538 displayName: Build Documentation Builder Container
539 inputs:
540 command: build
541 tags: gcr.io/active-premise-257318/builder
542 Dockerfile: ./site/docs/builder.Dockerfile
543 buildContext: .
544 - task: Docker@2
545 displayName: Build Documentation Redirector Container
546 inputs:
547 command: build
548 Dockerfile: ./site/redirector/Dockerfile
549 buildContext: ./site/redirector