SNES emulator
1# Run basic linting.
2check:
3 # Check all vhdl files, in isolation.
4 ghdl -a --std=08 -Wall -Werror hdl/**/*.vhd
5 # Lint python.
6 ruff check
7 # Check python formatting.
8 ruff format --check
9
10# Fix formatting.
11fmt:
12 # VHDL formatting.
13 find hdl -name '*.vhd' -print0 | while IFS= read -r -d '' f; do \
14 ghdl fmt --std=08 "$f" > "$f".fmt && mv "$f".fmt "$f"; \
15 done
16 # Python formatting.
17 ruff format
18
19# Run tests
20test:
21 just check
22 pytest hdl/test_suite.py
23
24# Build a bitstream for a target board.
25# Usage: just build ulx3s-12f
26build target:
27 if [ "{{target}}" != "ulx3s-12f" ]; then \
28 echo "Unsupported target: {{target}}"; \
29 echo "Supported targets: ulx3s-12f"; \
30 exit 1; \
31 fi
32 mkdir -p target/ulx3s
33 yosys -p "ghdl --std=08 hdl/src/Test.vhd platform/ulx3s/Top.vhd -e Top; synth_ecp5 -top Top -json target/ulx3s/top.json"
34 nextpnr-ecp5 --json target/ulx3s/top.json --lpf platform/ulx3s/ulx3s_v20_min.lpf --textcfg target/ulx3s/top.config --12k --package CABGA381 --freq 25
35 ecppack target/ulx3s/top.config target/ulx3s/Top.bit
36
37# Build + load a bitstream onto a target board.
38# Usage: just load ulx3s-12f
39load target:
40 if [ "{{target}}" != "ulx3s-12f" ]; then \
41 echo "Unsupported target: {{target}}"; \
42 echo "Supported targets: ulx3s-12f"; \
43 exit 1; \
44 fi
45 just build ulx3s-12f
46 openFPGALoader -b ulx3s target/ulx3s/Top.bit