-
Notifications
You must be signed in to change notification settings - Fork 2
201 lines (193 loc) · 8.51 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
on:
push:
branches-ignore:
- update-yosys-*
- renovate/*
pull_request:
name: CI
# TODO: Print outputs on failing steps. This can be done with something like:
# gzip -c cover.vcd | base64 | base64 -d | gunzip > cover-out.vcd
jobs:
ci-quickstart:
name: Minimal Dependencies Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11
cache: false
- uses: dtolnay/rust-toolchain@stable
with:
targets: riscv32i-unknown-none-elf
# Simulate installing Amaranth with builtin-yosys outside of PDM.
- name: Install Minimal Deps
run: |
pdm run python -m ensurepip
pdm run python -m pip install amaranth[builtin-yosys]
pdm install --prod
# Test code gen both within and outside a PDM script.
- name: Test Generate Verilog with Minimal Deps
run: |
pdm run python -m sentinel.gen -o sentinel-direct.v
pdm gen -o sentinel-pdm.v
- name: Test Import
run: pdm run python -c 'from sentinel.top import Top'
- name: Install PDM Demo Groups and Prepare YoWASP
run: |
pdm install -G examples -G yowasp
pdm use-yowasp
- name: Check Demo Bitstream Generation with Minimal Deps
run: |
pdm demo -i csr -p ice40_hx8k_b_evn
pdm demo-rust -i csr -p ice40_hx8k_b_evn
ci-basic:
name: Basic CI Check
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11
cache: true
- uses: dtolnay/rust-toolchain@stable
with:
targets: riscv32i-unknown-none-elf
# GCC already installed.
# - name: Install riscv64 GCC (for tests) and x64 GCC Linker Driver (for Rust)
# run: sudo apt install -y gcc-riscv64-unknown-elf gcc
- name: Install riscv64 GCC (for tests)
run: sudo apt install -y gcc-riscv64-unknown-elf
- name: Set oss-cad-suite vars (for cache)
run: |
echo >> $GITHUB_ENV OSS_CAD_SUITE_DATE=$(cat ci/oss-cad-suite-version)
- name: Cache OSS CAD Suite
id: cache-oss-cad-suite
uses: actions/cache@v4
with:
path: ~/cache/
key: ${{ runner.os }}-${{ env.OSS_CAD_SUITE_DATE }}
- name: Download OSS CAD Suite
if: steps.cache-oss-cad-suite.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/oss-cad-suite-linux-x64
wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$OSS_CAD_SUITE_DATE/oss-cad-suite-linux-x64-$(echo $OSS_CAD_SUITE_DATE | sed s/-//g).tgz -nv -O oss-cad-suite-linux-x64.tar.gz
tar -xzf oss-cad-suite-linux-x64.tar.gz -C ~/cache/oss-cad-suite-linux-x64
- name: Set OSS CAD Suite path
run: echo >> $GITHUB_PATH `echo ~/cache/oss-cad-suite-linux-x64/*/bin`
- name: Install PDM dependencies
run: pdm install -G lint -G examples -G dev
- name: Lint
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
run: |
pdm run lint
- name: Run Pytest Tests
run: |
pdm test-quick
- name: Test Generate Verilog
# LD_PRELOAD, which GHA seems to set by default, interferes with
# oss-cad-suite setup by mixing incompatible libcs, so unset it
# for any commands requiring yosys/nextpnr.
run: |
LD_PRELOAD="" pdm gen -o sentinel.v
# Test that the following generates correctly:
# 1. IceStick, Wishbone Periphs, Default demo. This is also
# benchmarked in the next step separately.
# 2. HX8K Eval, CSR Periphs, Rust demo
- name: Check Gateware Generation
run: |
LD_PRELOAD="" pdm demo -n
LD_PRELOAD="" pdm demo-rust -n -p ice40_hx8k_b_evn -i csr
# Get an idea of whether the full default prime-counting firmware
# demo fits into 1280 LUTs or exceeds it a bit. This also
# checks whether a demo bitstream build was successful.
#
# I will remove continue-on-error once I'm confident the demo
# fits into 1280 LUTs on more than just my machines (*nix/Win).
# HINT: abc compiled with clang seems to optimize worse than abc
# compiled with gcc, regardless of OS.
- name: Benchmark Demo Bitstream
continue-on-error: true
run: |
LD_PRELOAD="" pdm bench-luts
ci-riscof:
name: RISCOF Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11
cache: true
- name: Install riscv64 GCC (for tests)
run: sudo apt install -y gcc-riscv64-unknown-elf
- name: Set oss-cad-suite vars (for cache)
run: |
echo >> $GITHUB_ENV OSS_CAD_SUITE_DATE=$(cat ci/oss-cad-suite-version)
- name: Cache OSS CAD Suite
id: cache-oss-cad-suite
uses: actions/cache@v4
with:
path: ~/cache/
key: ${{ runner.os }}-${{ env.OSS_CAD_SUITE_DATE }}
- name: Download OSS CAD Suite
if: steps.cache-oss-cad-suite.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/oss-cad-suite-linux-x64
wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$OSS_CAD_SUITE_DATE/oss-cad-suite-linux-x64-$(echo $OSS_CAD_SUITE_DATE | sed s/-//g).tgz -nv -O oss-cad-suite-linux-x64.tar.gz
tar -xzf oss-cad-suite-linux-x64.tar.gz -C ~/cache/oss-cad-suite-linux-x64
- name: Set OSS CAD Suite path
run: echo >> $GITHUB_PATH `echo ~/cache/oss-cad-suite-linux-x64/*/bin`
- name: Install PDM dependencies
run: pdm install -G dev -G riscof
- name: Run RISCOF Suite
run: |
LD_PRELOAD="" pdm riscof-all
ci-rvformal:
name: RISC-V Formal Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11
cache: true
- name: Install riscv64 GCC (for tests)
run: sudo apt install -y gcc-riscv64-unknown-elf
- name: Set oss-cad-suite vars (for cache)
run: |
echo >> $GITHUB_ENV OSS_CAD_SUITE_DATE=$(cat ci/oss-cad-suite-version)
- name: Cache OSS CAD Suite
id: cache-oss-cad-suite
uses: actions/cache@v4
with:
path: ~/cache/
key: ${{ runner.os }}-${{ env.OSS_CAD_SUITE_DATE }}
- name: Download OSS CAD Suite
if: steps.cache-oss-cad-suite.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/oss-cad-suite-linux-x64
wget https://github.com/YosysHQ/oss-cad-suite-build/releases/download/$OSS_CAD_SUITE_DATE/oss-cad-suite-linux-x64-$(echo $OSS_CAD_SUITE_DATE | sed s/-//g).tgz -nv -O oss-cad-suite-linux-x64.tar.gz
tar -xzf oss-cad-suite-linux-x64.tar.gz -C ~/cache/oss-cad-suite-linux-x64
- name: Set OSS CAD Suite path
run: echo >> $GITHUB_PATH `echo ~/cache/oss-cad-suite-linux-x64/*/bin`
- name: Install PDM dependencies
run: pdm install -G dev
- name: Run RISC-V Formal
run: |
LD_PRELOAD="" pdm rvformal-all