Skip to content

Commit 91f6a31

Browse files
committed
ci: Add spyglass check
1 parent c2aac29 commit 91f6a31

6 files changed

Lines changed: 103 additions & 37 deletions

File tree

.github/actions/setup-python/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ runs:
2525
- name: Sync Python environment
2626
shell: sh
2727
run: |
28-
uv sync --all-extras --locked
28+
uv sync --extra all --locked

.gitlab-ci.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,20 @@ yosys-synthesis:
185185
- make sw -j
186186
- make vsim-run SN_BINARY=$PWD/sw/tests/build/simple.elf
187187

188-
################################
189-
# Non-free implementation flow #
190-
################################
188+
#################
189+
# Non-free jobs #
190+
#################
191191

192-
nonfree:
192+
# Non-free elaboration flow
193+
elab:
193194
script:
194195
- make nonfree
195196
- make elab
197+
198+
# Spyglass lint
199+
spyglass:
200+
script:
201+
- make nonfree
202+
- make spyglass
203+
- util/lint/check_spyglass_lint.py --threshold 3
204+
nonfree/lint/build/sg_projects/snitch_cluster/snitch_cluster/lint/lint_rtl/spyglass_reports/moresimple.rpt

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ docs = [
6262
all = [
6363
"snitch[kernels,docs]"
6464
]
65+
nonfree = [
66+
"pysynthutils @ git+ssh://git@iis-git.ee.ethz.ch/colluca/pysynthutils.git@b92ea41",
67+
]
6568

6669
[tool.uv.sources]
6770
torch = [

util/container/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
set -e
77

88
# We sync dependencies at Docker startup, so we don't have to bake them in in the build stage
9-
uv sync --all-extras --locked
9+
uv sync --extra all --locked
1010

1111
exec "$@"

util/lint/check_spyglass_lint.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env python3
2+
# Copyright 2026 ETH Zurich and University of Bologna.
3+
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
4+
# SPDX-License-Identifier: Apache-2.0
5+
import argparse
6+
import sys
7+
from pysynthutils import LintViolations
8+
9+
10+
def main():
11+
parser = argparse.ArgumentParser()
12+
parser.add_argument('report', help='Path to moresimple.rpt')
13+
parser.add_argument('--threshold', type=int, default=0)
14+
args = parser.parse_args()
15+
16+
lv = LintViolations(args.report)
17+
violations = lv.filter(exclude_files='.bender')
18+
n = len(violations)
19+
20+
for _, v in violations.iterrows():
21+
print(f'[{v.severity}] {v.rule} {v.file}:{v.line} {v.message}')
22+
print(f'\n{n} violation(s) outside .bender/ (threshold: {args.threshold})')
23+
24+
if n > args.threshold:
25+
print('FAIL: threshold exceeded')
26+
sys.exit(1)
27+
print('PASS')
28+
29+
30+
if __name__ == '__main__':
31+
main()

uv.lock

Lines changed: 54 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)