summaryrefslogtreecommitdiff
path: root/Makefile
blob: e7433aad744c0cb73ec3ba143143f23798109f7c (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
33
34
35
36
37
38
39
40
41
42
TOP = top
OBJS = top.v blink.v

FREQ_MHZ = 65
DEVICE_TYPE = 25k
PACKAGE = CABGA256
SPEED_GRADE = 6

.PHONY: all clean program
all: lint $(TOP).svf

clean:
	rm -f *.svf *.bit *.json

lint:
	verilator --lint-only $(OBJS)
	iverilog -tnull $(OBJS)

program: $(TOP).svf
	# probably not very useful to anyone without more configurable paths
	openocd -f /usr/share/openocd/scripts/interface/ftdi/dp_busblaster_kt-link.cfg \
	        -f ~/jtag/5a-75e.cfg \
	        -c "init; svf $^; shutdown"

%.json: $(OBJS)
	yosys -e ".*" -p "synth_ecp5 -json $@" $(OBJS)

%.config: %.json %.lpf
	nextpnr-ecp5 \
		--$(DEVICE_TYPE) \
		--package $(PACKAGE) \
		--speed $(SPEED_GRADE) \
		--freq $(FREQ_MHZ) \
		--json $< \
		--textcfg $@ \
		--lpf $(word 2,$^)

%.bit %.svf: %.config
	ecppack \
		--bit "$*.bit" \
		--svf "$*.svf" \
		--input "$^"