summaryrefslogtreecommitdiff
path: root/Makefile
blob: 607aa6a6f578ba6fa47a7c010cda2130f82d8966 (plain)
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
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.SUFFIXES:

all: led.fs

tangnano9k.cst:
	wget https://github.com/YosysHQ/apicula/raw/refs/heads/master/examples/tangnano9k.cst || \
	curl -LO https://github.com/YosysHQ/apicula/raw/refs/heads/master/examples/tangnano9k.cst

%.json: %.v
	yosys -p "read_verilog $<; synth_gowin -top $* -json $@"

%.pnr.json: %.json tangnano9k.cst
	nextpnr-himbaechel --json $< --write $@ \
	--device GW1NR-LV9QN88PC6/I5 --vopt family=GW1N-9C \
	--vopt cst=tangnano9k.cst \
	--placed-svg $*.plc.svg \
	--routed-svg $*.rt.svg \
	|| \
	nextpnr-gowin --json $< --write $@ \
	--device GW1NR-LV9QN88PC6/I5 --family GW1N-9C \
	--cst tangnano9k.cst

%.fs: %.pnr.json
	gowin_pack -d GW1N-9C -o $@ $<

flash: led.fs
	openFPGALoader -b tangnano9k -f led.fs

clean:
	rm -rf *.json *.fs *.svg *.log