-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (163 loc) · 6.71 KB
/
ci.yml
File metadata and controls
199 lines (163 loc) · 6.71 KB
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
# SPDX-License-Identifier: MIT
# Commons Clause v1.0 applies — commercial use requires written permission. Contact: hello@bard0.com
# Copyright (c) 2026 Leonardo Capossio — bard0 design
#
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
# ---------------------------------------------------------------------------
# Python verification tests (no Vivado needed)
# ---------------------------------------------------------------------------
verify:
name: Python verification (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y --no-install-recommends ffmpeg
pip install numpy scipy Pillow
- name: Verify Huffman ROM tables
run: python python/verify_huffman_rom.py
- name: Verify LITE_QUALITY tables
run: python python/verify_lite_quality.py
- name: Python reference encoder test (PSNR check)
run: python python/test_encoder.py
- name: Visual quality comparison (mandrill encode/decode, Q=50/75/95)
continue-on-error: true
run: |
python python/mandrill_compare.py --quality 50 --out mandrill_compare_Q50.png
python python/mandrill_compare.py --quality 75 --out mandrill_compare_Q75.png
python python/mandrill_compare.py --quality 95 --out mandrill_compare_Q95.png
- name: Upload quality comparison images
if: always()
uses: actions/upload-artifact@v4
with:
name: mandrill-comparison-py${{ matrix.python-version }}
path: mandrill_compare_Q*.png
# ---------------------------------------------------------------------------
# RTL lint — Verilator (no Vivado needed, available on ubuntu-latest)
# ---------------------------------------------------------------------------
rtl-lint:
name: RTL lint (Verilator)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Verilator
run: sudo apt-get install -y --no-install-recommends verilator
- name: Lint core RTL modules
run: |
set -e
for f in \
rtl/dct_1d.v \
rtl/zigzag_reorder.v \
rtl/bitstream_packer.v \
rtl/axi4_lite_regs.v \
rtl/rgb_to_ycbcr.v; do
echo "--- lint: $f"
verilator --lint-only -Wall --bbox-unsup "$f"
done
echo "--- lint: rtl/dct_2d.v (with dct_1d)"
verilator --lint-only -Wall --bbox-unsup rtl/dct_1d.v rtl/dct_2d.v
echo "--- lint: rtl/input_buffer.v (with bram_sdp)"
verilator --lint-only -Wall --bbox-unsup rtl/vendor/sim/bram_sdp.v rtl/input_buffer.v
- name: Lint quantizer (LITE_MODE=0)
run: verilator --lint-only -Wall --bbox-unsup -DLITE_MODE=0 rtl/quantizer.v
- name: Lint quantizer (LITE_MODE=1)
run: verilator --lint-only -Wall --bbox-unsup -DLITE_MODE=1 rtl/quantizer.v
- name: Lint huffman_encoder
run: verilator --lint-only -Wall --bbox-unsup rtl/huffman_encoder.v
- name: Lint jfif_writer
run: verilator --lint-only -Wall --bbox-unsup rtl/jfif_writer.v
- name: Lint top-level (LITE_MODE=0)
run: |
verilator --lint-only -Wall --bbox-unsup -DLITE_MODE=0 \
rtl/vendor/sim/bram_sdp.v \
rtl/dct_1d.v \
rtl/dct_2d.v \
rtl/input_buffer.v \
rtl/quantizer.v \
rtl/zigzag_reorder.v \
rtl/huffman_encoder.v \
rtl/bitstream_packer.v \
rtl/jfif_writer.v \
rtl/axi4_lite_regs.v \
rtl/mjpegzero_enc_top.v
- name: Lint top-level (LITE_MODE=1)
run: |
verilator --lint-only -Wall --bbox-unsup -DLITE_MODE=1 \
rtl/vendor/sim/bram_sdp.v \
rtl/dct_1d.v \
rtl/dct_2d.v \
rtl/input_buffer.v \
rtl/quantizer.v \
rtl/zigzag_reorder.v \
rtl/huffman_encoder.v \
rtl/bitstream_packer.v \
rtl/jfif_writer.v \
rtl/axi4_lite_regs.v \
rtl/mjpegzero_enc_top.v
# ---------------------------------------------------------------------------
# RTL simulation — iverilog + golden coefficient comparison
# ---------------------------------------------------------------------------
rtl-sim:
name: RTL simulation (iverilog)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
sudo apt-get install -y --no-install-recommends iverilog ffmpeg
pip install numpy Pillow
- name: Generate test image (download mandrill or synthetic fallback)
run: python python/test_encoder.py
- name: RTL simulation + golden verification (full mode, Q=50/75/95)
run: python python/verify_rtl_sim.py
- name: RTL simulation + golden verification (lite mode, Q=50/75/95)
run: python python/verify_rtl_sim.py --lite
- name: Upload simulation artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: rtl-sim-output
path: build/sim_iverilog/sim_output_*.jpg
if-no-files-found: ignore
# ---------------------------------------------------------------------------
# FuseSoC — core descriptor validation + lint via FuseSoC/Verilator
# ---------------------------------------------------------------------------
fusesoc:
name: FuseSoC (core validation + lint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install FuseSoC and Verilator
run: |
pip install fusesoc
sudo apt-get install -y --no-install-recommends verilator make
- name: Register core library
run: fusesoc library add mjpegzero .
- name: Validate core descriptor (core-info)
run: fusesoc core-info bard0-design:mjpegzero:mjpegzero_enc
- name: Lint via FuseSoC (Verilator, LITE_MODE=1 default)
run: fusesoc run --target lint bard0-design:mjpegzero:mjpegzero_enc
- name: Lint via FuseSoC (Verilator, LITE_MODE=0)
run: fusesoc run --target lint bard0-design:mjpegzero:mjpegzero_enc --LITE_MODE 0