-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
32 lines (24 loc) · 831 Bytes
/
Makefile
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
BOARD=tangnano9k
FAMILY=GW1N-9C
DEVICE=GW1NR-LV9QN88PC6/I5
all: out.fs
# Synthesis
synthesis.json: src/*.v
yosys -p "read_verilog src/*.v; synth_gowin -top cpu -json synthesis.json"
# Place and Route
bitstream.json: synthesis.json
nextpnr-gowin --json synthesis.json --freq 27 --write bitstream.json --device ${DEVICE} --family ${FAMILY} --cst ${BOARD}.cst
# Generate Bitstream
out.fs: bitstream.json
gowin_pack -d ${FAMILY} -o out.fs bitstream.json
# Program Board
load: out.fs
openFPGALoader -b ${BOARD} out.fs -f
# Remove build files
clean:
rm -rf out.fs bitstream.json synthesis.json
test:
iverilog -o test.out src/*.v tests/programcounter_tb.v; vvp ./test.out; rm test.out
iverilog -o test.out src/*.v tests/clock_tb.v; vvp ./test.out; rm test.out
.PHONY: load clean
.INTERMEDIATE: bitstream.json synthesis.json