blob: 8fb96d1ccaedade9b2d44d9b950436472a16c7fc [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
Miguel Osorio88179fc2019-09-19 23:37:48 -070010 TOOLCHAIN_PATH: /opt/buildcache/riscv
Michael Schaffnere66fc612020-12-15 10:47:57 -080011 VERIBLE_VERSION: v0.0-808-g1e17daa
Miguel Osorio88179fc2019-09-19 23:37:48 -070012 # Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
Sam Elliott00881552020-05-04 16:46:55 +010013 # if you update this, update the definition in util/container/Dockerfile
Philipp Wagner1500b402020-10-14 11:50:24 +020014 TOOLCHAIN_VERSION: 20200904-1
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -060015 # This controls where builds happen, and gets picked up by build_consts.sh.
16 BUILD_ROOT: $(Build.ArtifactStagingDirectory)
Philipp Wagner11d2dcb2020-09-29 16:27:46 +010017 VIVADO_VERSION: "2020.1"
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
Sam Elliott67e30fa2020-10-06 18:08:05 +010034 displayName: Run code quality checks (quick lint)
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000035 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010036 vmImage: ubuntu-18.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
Rupert Swarbrick105df012021-01-29 11:33:13 +000042 ## !!!
43 ##
44 ## The steps below here are duplicated in ci/jobs/quick-lint.sh
45 ## to allow developers to "run CI" locally. Keep them in sync.
46 ##
47 ## !!!
48 - bash: ci/scripts/show-env.sh
Philipp Wagner99862392020-07-22 13:32:34 +010049 displayName: Display environment information
Rupert Swarbrick105df012021-01-29 11:33:13 +000050 - bash: ci/scripts/lint-commits.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000051 condition: eq(variables['Build.Reason'], 'PullRequest')
52 displayName: Check commit metadata
Rupert Swarbrick105df012021-01-29 11:33:13 +000053 - bash: ci/scripts/check-licence-headers.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagner93cdcef2021-01-19 14:31:47 +000054 condition: eq(variables['Build.Reason'], 'PullRequest')
55 displayName: Check Licence Headers
Rupert Swarbrick105df012021-01-29 11:33:13 +000056 - bash: ci/scripts/python-lint.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000057 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060058 displayName: Run Python lint
Rupert Swarbrick2d70c752020-03-24 17:23:40 +000059 continueOnError: true
Rupert Swarbrick105df012021-01-29 11:33:13 +000060 - bash: ci/scripts/check-generated.sh
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060061 displayName: Ensure all generated files are clean and up-to-date
Rupert Swarbrick105df012021-01-29 11:33:13 +000062 - bash: ci/scripts/clang-format.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000063 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060064 displayName: Use clang-format to check C/C++ coding style
Rupert Swarbrick105df012021-01-29 11:33:13 +000065 - bash: ci/scripts/include-guard.sh $SYSTEM_PULLREQUEST_TARGETBRANCH
Miguel Young de la Sotab23dc8c2020-01-14 13:52:33 -050066 condition: eq(variables['Build.Reason'], 'PullRequest')
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -060067 displayName: Check formatting on header guards
Rupert Swarbrick105df012021-01-29 11:33:13 +000068 - bash: ci/scripts/verible-lint.sh rtl
Michael Schaffnerde326062020-07-14 17:50:35 -070069 condition: eq(variables['Build.Reason'], 'PullRequest')
Michael Schaffnera94241f2020-08-03 15:50:14 -070070 displayName: Style-Lint RTL Verilog source files with Verible
Rupert Swarbrick105df012021-01-29 11:33:13 +000071 - bash: ci/scripts/verible-lint.sh dv
Michael Schaffnera94241f2020-08-03 15:50:14 -070072 condition: eq(variables['Build.Reason'], 'PullRequest')
73 displayName: Style-Lint DV Verilog source files with Verible
Rupert Swarbrick105df012021-01-29 11:33:13 +000074 - bash: ci/scripts/build-docs.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000075 displayName: Render documentation
Rupert Swarbrick105df012021-01-29 11:33:13 +000076 - bash: ci/scripts/build-site.sh
Philipp Wagner93cdcef2021-01-19 14:31:47 +000077 displayName: Render landing site
Rupert Swarbrickfb9fdb62021-02-01 17:30:48 +000078 - bash: ci/scripts/get-build-type.sh "$SYSTEM_PULLREQUEST_TARGETBRANCH" "$(Build.Reason)"
Greg Chadwick99fe0642020-08-04 15:42:45 +010079 displayName: Check what kinds of changes the PR contains
Philipp Wagnerbd9ae432019-11-01 14:33:30 +000080 name: DetermineBuildType
Philipp Wagner1e643552019-09-04 15:39:14 +010081
Sam Elliott67e30fa2020-10-06 18:08:05 +010082- job: slow_lints
83 displayName: Run code quality checks (in-depth lint)
84 dependsOn: lint
85 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +010086 vmImage: ubuntu-18.04
Sam Elliott67e30fa2020-10-06 18:08:05 +010087 steps:
88 - template: ci/install-package-dependencies.yml
89 - bash: |
90 # Here we look for all *.vendor.hjson files in the repo to re-vendor them.
91 # We exclude the following:
92 # - Any in 'hw/vendor/lowrisc_ibex', because that directory is vendored.
93 find . \
94 -not \( -path './hw/vendor/lowrisc_ibex' -prune \) \
95 -name '*.vendor.hjson' \
96 | xargs -n1 util/vendor.py --verbose \
97 && git diff --exit-code
98 if [[ $? != 0 ]]; then
99 echo -n "##vso[task.logissue type=error]"
100 echo "Vendored repositories not up-to-date. Run util/vendor.py to fix."
101 exit 1
102 fi
103 condition: always()
104 displayName: Check vendored directories are up-to-date
105
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600106- job: sw_build
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100107 displayName: Build Software for Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000108 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000109 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000110 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100111 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000112 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600113 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000114 - bash: |
115 set -x
116 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800117 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliotteb8ace42020-06-03 17:47:55 +0100118 --release-version="$TOOLCHAIN_VERSION" \
Philipp Wagner1c514412019-11-27 14:48:47 +0000119 --update
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600120 displayName: Install toolchain
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000121 - bash: |
Miguel Young de la Sota63793572019-11-13 14:18:51 -0600122 . util/build_consts.sh
Miguel Young de la Sota4a4946d2019-11-21 10:44:18 -0600123 ./meson_init.sh -A
Miguel Young de la Sota76526c32020-01-28 10:24:41 -0500124 ninja -C "$OBJ_DIR" all
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600125 displayName: Build embedded targets
Miguel Young de la Sota9d20b3d2020-02-03 16:35:31 -0500126 - bash: |
127 . util/build_consts.sh
128 ninja -C "$OBJ_DIR" test
Sam Elliotteb8ace42020-06-03 17:47:55 +0100129 displayName: Run unit tests
130 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600131 parameters:
132 artifact: sw_build
lowRISC Contributors802543a2019-08-31 12:12:56 +0100133
Timothy Chenf835aa32021-01-08 16:27:50 -0800134- job: sw_build_nexysvideo
135 displayName: Build Software for Earl Grey toplevel design targeting the Nexys Video board
136 dependsOn: lint
137 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
138 pool:
139 vmImage: ubuntu-18.04
140 steps:
141 - template: ci/install-package-dependencies.yml
142 - bash: |
143 set -x
144 sudo util/get-toolchain.py \
145 --install-dir="$TOOLCHAIN_PATH" \
146 --release-version="$TOOLCHAIN_VERSION" \
147 --update
148 displayName: Install toolchain
149 - bash: |
150 . util/build_consts.sh
151 ./hw/top_earlgrey/util/top_earlgrey_reduce.py
152 ./meson_init.sh -A
153 ninja -C "$OBJ_DIR" all
154 displayName: Build embedded targets
155 - bash: |
156 . util/build_consts.sh
157 ninja -C "$OBJ_DIR" test
158 displayName: Run unit tests
159 - template: ci/upload-artifacts-template.yml
160 parameters:
161 artifact: sw_build_nexysvideo
162
Luís Marques5849cd12020-06-26 10:33:55 +0100163# We continue building with GCC, despite defaulting to Clang. This is a copy of
164# `sw_build` with `meson_init.sh` configured with the GCC toolchain, instead of
165# the default toolchain.
166- job: sw_build_gcc
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100167 displayName: Build Software for Earl Grey toplevel design (with GCC)
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100168 dependsOn: lint
169 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
170 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100171 vmImage: ubuntu-18.04
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100172 steps:
173 - template: ci/install-package-dependencies.yml
174 - bash: |
175 set -x
176 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800177 --install-dir="$TOOLCHAIN_PATH" \
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100178 --release-version="$TOOLCHAIN_VERSION" \
179 --update
180 displayName: Install toolchain
181 - bash: |
182 . util/build_consts.sh
183 ./meson_init.sh -A \
Luís Marques5849cd12020-06-26 10:33:55 +0100184 -t "$TOOLCHAIN_PATH/meson-riscv32-unknown-elf-gcc.txt"
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100185 ninja -C "$OBJ_DIR" all
186 displayName: Build embedded targets
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100187 - bash: |
188 . util/build_consts.sh
189 ninja -C "$OBJ_DIR" test
190 displayName: Run unit tests
Sam Elliott7a00a4b2020-06-03 17:48:10 +0100191
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600192- job: top_earlgrey_verilator
193 displayName: Build Verilator simulation of the Earl Grey toplevel design
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000194 dependsOn: lint
Philipp Wagner9d20ee62019-11-29 14:27:28 +0000195 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagner0907ca12020-04-21 12:04:32 +0100196 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100197 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000198 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600199 - template: ci/install-package-dependencies.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000200 - bash: |
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000201 python3 --version
202 fusesoc --version
203 verilator --version
Michael Schaffneraa193f92020-12-16 11:16:17 -0800204 verible-verilog-lint --version
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600205 displayName: Display environment
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000206 - bash: |
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600207 . util/build_consts.sh
208 mkdir -p "$OBJ_DIR/hw"
209 mkdir -p "$BIN_DIR/hw/top_earlgrey"
210
Philipp Wagnerfa8c6922020-08-18 14:14:25 +0100211 # Compile the simulation without threading; the runners provided by
212 # Azure provide two virtual CPUs, which seems to equal one physical
213 # CPU (at most); the use of threading slows down the simulation.
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600214 fusesoc --cores-root=. \
Timothy Chenbe47dd72020-07-27 14:57:07 -0700215 run --flag=fileset_top --target=sim --setup --build \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600216 --build-root="$OBJ_DIR/hw" \
Philipp Wagnerfa8c6922020-08-18 14:14:25 +0100217 lowrisc:systems:top_earlgrey_verilator \
218 --verilator_options="--no-threads"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600219
220 cp "$OBJ_DIR/hw/sim-verilator/Vtop_earlgrey_verilator" \
221 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600222 displayName: Build simulation with Verilator
223 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600224 parameters:
225 artifact: top_earlgrey_verilator
Philipp Wagnerf4655a12019-10-30 11:59:15 +0000226
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100227- job: top_englishbreakfast_verilator
228 displayName: Build Verilator simulation of the English Breakfast toplevel design
229 dependsOn: lint
230 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
231 pool:
232 vmImage: ubuntu-18.04
233 steps:
234 - template: ci/install-package-dependencies.yml
235 - bash: |
236 python3 --version
237 fusesoc --version
238 verilator --version
239 verible-verilog-lint --version
240 displayName: Display environment
241 - bash: |
242 . util/build_consts.sh
243 mkdir -p "$OBJ_DIR/hw"
244 mkdir -p "$BIN_DIR/hw/top_englishbreakfast"
245
246 # Compile the simulation without threading; the runners provided by
247 # Azure provide two virtual CPUs, which seems to equal one physical
248 # CPU (at most); the use of threading slows down the simulation.
249 fusesoc --cores-root=. \
250 run --flag=fileset_topgen --target=sim --setup --build \
251 --build-root="$OBJ_DIR/hw" \
252 lowrisc:systems:top_englishbreakfast_verilator \
253 --verilator_options="--no-threads"
254
255 cp "$OBJ_DIR/hw/sim-verilator/Vtop_englishbreakfast_verilator" \
256 "$BIN_DIR/hw/top_englishbreakfast"
257 displayName: Build simulation with Verilator
258 - template: ci/upload-artifacts-template.yml
259 parameters:
260 artifact: top_englishbreakfast_verilator
261
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600262- job: execute_verilated_tests
263 displayName: Execute tests on the Verilated system
Timothy Chenf7e85cb2019-12-10 16:24:39 -0800264 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100265 vmImage: ubuntu-18.04
Timothy Chen7d1436d2019-12-04 17:26:14 -0800266 dependsOn:
267 - top_earlgrey_verilator
268 - sw_build
269 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600270 - template: ci/install-package-dependencies.yml
271 - template: ci/download-artifacts-template.yml
Timothy Chen7d1436d2019-12-04 17:26:14 -0800272 - bash: |
Philipp Wagner33fadd02020-09-09 19:39:25 +0100273 # Install an additional pytest dependency for result upload.
274 pip3 install pytest-azurepipelines
275
Timothy Chen7d1436d2019-12-04 17:26:14 -0800276 . util/build_consts.sh
Philipp Wagner57418e72019-12-02 21:25:27 +0000277 pytest --version
Philipp Wagner03aaf322020-09-09 19:11:44 +0100278 pytest test/systemtest/earlgrey/test_sim_verilator.py \
Philipp Wagner33fadd02020-09-09 19:39:25 +0100279 --log-cli-level=DEBUG \
280 --test-run-title="Run system tests with Verilator simulation" \
281 --napoleon-docstrings
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600282 displayName: Execute tests
Timothy Chen7d1436d2019-12-04 17:26:14 -0800283
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100284- template: ci/run-riscv-compliance.yml
285 parameters:
286 rvc_test_suites:
287 - rv32i
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600288
Greg Chadwickbf9dc382020-04-17 09:30:40 +0100289- template: ci/run-riscv-compliance.yml
290 parameters:
291 rvc_test_suites:
292 - rv32im
293 - rv32imc
294 - rv32Zicsr
Timothy Chen7d1436d2019-12-04 17:26:14 -0800295
Greg Chadwick99fe0642020-08-04 15:42:45 +0100296- job: otbn_standalone_tests
297 displayName: Run OTBN Smoke Test
298 dependsOn: lint
299 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.hasOTBNChanges'], '1'))
Philipp Wagner8d3e5632020-08-19 14:31:39 +0100300 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100301 vmImage: ubuntu-18.04
Philipp Wagnerbf0ab0a2020-12-15 12:03:42 +0000302 timeoutInMinutes: 10
Greg Chadwick99fe0642020-08-04 15:42:45 +0100303 steps:
304 - template: ci/install-package-dependencies.yml
305 - bash: |
306 set -x
307 sudo util/get-toolchain.py \
Srikrishna Iyer98333ba2020-11-16 23:12:29 -0800308 --install-dir="$TOOLCHAIN_PATH" \
Greg Chadwick99fe0642020-08-04 15:42:45 +0100309 --release-version="$TOOLCHAIN_VERSION" \
310 --update
Rupert Swarbrick54278382020-08-25 12:45:47 +0100311 echo "##vso[task.prependpath]$TOOLCHAIN_PATH/bin"
Greg Chadwick99fe0642020-08-04 15:42:45 +0100312 displayName: Install toolchain
313 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100314 python3 --version
315 fusesoc --version
316 verilator --version
317 displayName: Display environment
318 - bash: |
Rupert Swarbrick7bd2a372020-10-02 12:36:12 +0100319 make -C hw/ip/otbn/dv/otbnsim test
320 displayName: OTBN ISS Test
321 - bash: |
Greg Chadwick99fe0642020-08-04 15:42:45 +0100322 ./hw/ip/otbn/dv/smoke/run_smoke.sh
323 displayName: OTBN Smoke Test
Rupert Swarbrick54278382020-08-25 12:45:47 +0100324 - bash: |
Rupert Swarbrick7087ed82020-11-13 18:16:46 +0000325 make -C hw/ip/otbn/util asm-check
Rupert Swarbrick54278382020-08-25 12:45:47 +0100326 displayName: Assemble and link code snippets
Greg Chadwick99fe0642020-08-04 15:42:45 +0100327
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600328- job: top_earlgrey_nexysvideo
329 displayName: Build NexysVideo variant of the Earl Grey toplevel design using Vivado
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000330 dependsOn:
331 - lint
332 # The bootrom is built into the FPGA image at synthesis time.
Timothy Chenf835aa32021-01-08 16:27:50 -0800333 - sw_build_nexysvideo
Philipp Wagnerd0ac8622021-02-01 22:03:29 +0000334 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Philipp Wagnerc58f6a02020-10-07 19:57:09 +0100335 pool: ci-public
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000336 timeoutInMinutes: 120 # 2 hours
337 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600338 - template: ci/install-package-dependencies.yml
339 - template: ci/download-artifacts-template.yml
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000340 - bash: |
341 set -e
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600342 . util/build_consts.sh
Philipp Wagnerc58f6a02020-10-07 19:57:09 +0100343
344 module load "xilinx/vivado/$(VIVADO_VERSION)"
345
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600346 mkdir -p "$OBJ_DIR/hw"
347 mkdir -p "$BIN_DIR/hw/top_earlgrey"
348
Timothy Chenf835aa32021-01-08 16:27:50 -0800349 ./hw/top_earlgrey/util/top_earlgrey_reduce.py
350
Greg Chadwick12871042020-04-20 13:42:56 +0100351 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.32.vmem"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600352 test -f "$BOOTROM_VMEM"
353
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600354 fusesoc --cores-root=. \
Timothy Chenbe47dd72020-07-27 14:57:07 -0700355 run --flag=fileset_top --target=synth --setup --build \
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600356 --build-root="$OBJ_DIR/hw" \
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000357 lowrisc:systems:top_earlgrey_nexysvideo \
Philipp Wagnera37bcfa2020-05-19 22:46:41 +0100358 --BootRomInitFile="$BOOTROM_VMEM"
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600359
360 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_top_earlgrey_nexysvideo_0.1.bit" \
361 "$BIN_DIR/hw/top_earlgrey"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600362 displayName: Build bitstream with Vivado
Philipp Wagnerf072c032020-12-08 17:16:30 +0000363 - bash: |
364 . util/build_consts.sh
365 echo Synthesis log
366 cat $OBJ_DIR/hw/synth-vivado/lowrisc_systems_top_earlgrey_nexysvideo_0.1.runs/synth_1/runme.log || true
367
368 echo Implementation log
369 cat $OBJ_DIR/hw/synth-vivado/lowrisc_systems_top_earlgrey_nexysvideo_0.1.runs/impl_1/runme.log || true
370 condition: always()
371 displayName: Display synthesis and implementation logs
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600372 - template: ci/upload-artifacts-template.yml
Miguel Young de la Sotab4df8602019-11-21 12:44:11 -0600373 parameters:
374 artifact: top_earlgrey_nexysvideo
lowRISC Contributors802543a2019-08-31 12:12:56 +0100375
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100376- job: top_englishbreakfast_cw305
377 displayName: Build CW305 variant of the English Breakfast toplevel design using Vivado
378 dependsOn:
379 - lint
380 # The bootrom is built into the FPGA image at synthesis time.
Pirmin Vogelc00e37f2020-12-23 21:35:47 +0100381 # Currently, we can't have different versions of binaries in $BIN_DIR. Consequently, we are
382 # using the NexysVideo bootrom here and the resulting CW305 bitstream is not functional.
383 # By generating the CW305 bootrom binary we would break execute_fpga_tests executed on the
384 # NexysVideo.
Philipp Wagner84bfe552021-02-02 18:48:07 +0000385 - sw_build_nexysvideo
Philipp Wagnerd0ac8622021-02-01 22:03:29 +0000386 condition: and(succeeded(), eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0'))
Pirmin Vogel2f42ccd2020-12-22 20:19:30 +0100387 pool: ci-public
388 timeoutInMinutes: 120 # 2 hours
389 steps:
390 - template: ci/install-package-dependencies.yml
391 - template: ci/download-artifacts-template.yml
392 - bash: |
393 set -e
394 . util/build_consts.sh
395
396 module load "xilinx/vivado/$(VIVADO_VERSION)"
397
398 mkdir -p "$OBJ_DIR/hw"
399 mkdir -p "$BIN_DIR/hw/top_englishbreakfast"
400
401 BOOTROM_VMEM="$BIN_DIR/sw/device/boot_rom/boot_rom_fpga_nexysvideo.32.vmem"
402 test -f "$BOOTROM_VMEM"
403
404 fusesoc --cores-root=. \
405 run --flag=fileset_topgen --target=synth --setup --build \
406 --build-root="$OBJ_DIR/hw" \
407 lowrisc:systems:top_englishbreakfast_cw305 \
408 --BootRomInitFile="$BOOTROM_VMEM"
409
410 cp "$OBJ_DIR/hw/synth-vivado/lowrisc_systems_top_englishbreakfast_cw305_0.1.bit" \
411 "$BIN_DIR/hw/top_englishbreakfast"
412 displayName: Build bitstream with Vivado
413 - template: ci/upload-artifacts-template.yml
414 parameters:
415 artifact: top_englishbreakfast_cw305
416
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100417- job: execute_fpga_tests
418 displayName: Execute tests on FPGA
419 pool: FPGA
420 timeoutInMinutes: 30
421 dependsOn:
422 - top_earlgrey_nexysvideo
Timothy Chenf835aa32021-01-08 16:27:50 -0800423 - sw_build_nexysvideo
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100424 steps:
425 - template: ci/install-package-dependencies.yml
426 - template: ci/download-artifacts-template.yml
427 - bash: |
428 set -e
429
430 module load "xilinx/vivado/$(VIVADO_VERSION)"
431
432 # Install an additional pytest dependency for result upload.
433 pip3 install pytest-azurepipelines
434
435 . util/build_consts.sh
436 pytest --version
437 pytest test/systemtest/earlgrey/test_fpga_nexysvideo.py \
438 --log-cli-level=DEBUG \
439 --test-run-title="Run system tests on Nexys Video FPGA board" \
440 --napoleon-docstrings
Philipp Wagner1d0f0c42021-02-01 10:29:33 +0000441 # Temporary workaround, see
442 # https://github.com/lowRISC/opentitan/issues/5029 for details.
443 continueOnError: true
Philipp Wagner11d2dcb2020-09-29 16:27:46 +0100444 displayName: Execute tests
445
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600446- job: deploy_release_artifacts
447 displayName: Package and deploy release distribution
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000448 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100449 vmImage: ubuntu-18.04
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000450 dependsOn:
451 - lint
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600452 - sw_build
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000453 - top_earlgrey_verilator
454 - top_earlgrey_nexysvideo
455 condition: eq(dependencies.lint.outputs['DetermineBuildType.onlyDocChanges'], '0')
456 steps:
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600457 - template: ci/install-package-dependencies.yml
458 - template: ci/download-artifacts-template.yml
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600459 - bash: |
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600460 . util/build_consts.sh
Miguel Young de la Sotab5be8c62019-11-20 10:01:09 -0600461
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600462 util/make_distribution.sh
Philipp Wagner542e2202019-10-30 13:10:16 +0000463
Miguel Young de la Sotad42948c2019-11-18 13:56:55 -0600464 tar --list -f $BIN_DIR/opentitan-*.tar.xz
465 # Put the resulting tar file into a directory the |publish| step below can reference.
466 mkdir "$BUILD_ROOT/dist-final"
467 mv $BIN_DIR/opentitan-*.tar.xz "$BUILD_ROOT/dist-final"
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600468 displayName: Create final dist directory out of partial ones
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000469 - publish: $(Build.ArtifactStagingDirectory)/dist-final
470 artifact: opentitan-dist
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600471 displayName: Upload release artifacts as Azure artifact
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000472 - task: GithubRelease@0
Miguel Young de la Sotaa68e3072020-01-02 13:59:54 -0600473 displayName: Upload to GitHub releases (only tags)
Philipp Wagner0b20f5d2019-11-01 16:24:52 +0000474 condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
Philipp Wagnerbd9ae432019-11-01 14:33:30 +0000475 inputs:
476 gitHubConnection: opentitan-release-upload
477 repositoryName: lowrisc/opentitan
478 addChangeLog: false
479 assets: |
480 $(Build.ArtifactStagingDirectory)/dist-final/*
Sam Elliotte257cd02020-09-10 13:49:38 +0100481
482
483- job: build_docker_containers
484 displayName: "Build Docker Containers"
485 pool:
Philipp Wagner5d1450c2020-10-06 12:26:36 +0100486 vmImage: ubuntu-18.04
Sam Elliotte257cd02020-09-10 13:49:38 +0100487 dependsOn:
488 - lint
489 steps:
490 - task: Docker@2
491 displayName: Build Developer Utility Container
492 inputs:
493 command: build
494 Dockerfile: ./util/container/Dockerfile
495 buildContext: .
496 - task: Docker@2
497 displayName: Build Documentation Builder Container
498 inputs:
499 command: build
500 tags: gcr.io/active-premise-257318/builder
501 Dockerfile: ./site/docs/builder.Dockerfile
502 buildContext: .
503 - task: Docker@2
504 displayName: Build Documentation Redirector Container
505 inputs:
506 command: build
507 Dockerfile: ./site/redirector/Dockerfile
508 buildContext: ./site/redirector