-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile.tmpl
More file actions
59 lines (47 loc) · 1.46 KB
/
Makefile.tmpl
File metadata and controls
59 lines (47 loc) · 1.46 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
# Package Name
PACKNAME = !package_name!
MODULES =
# Use local tools
#GHDL = ghdl
#GHDLSYNTH = ghdl.so
#YOSYS = yosys
#NEXTPNR = nextpnr-ice40
#ICEPACK = icepack
#ICEPROG = iceprog
# Use Docker images
DOCKER=docker
#DOCKER=podman
#
PWD = $(shell pwd)
DOCKERARGS = run --rm -v $(PWD):/src -w /src
#
GHDL = $(DOCKER) $(DOCKERARGS) ghdl/synth:beta ghdl
GHDLSYNTH = ghdl
YOSYS = $(DOCKER) $(DOCKERARGS) ghdl/synth:beta yosys
NEXTPNR = $(DOCKER) $(DOCKERARGS) ghdl/synth:nextpnr-ice40 nextpnr-ice40
ICEPACK = $(DOCKER) $(DOCKERARGS) hdlc/icestorm icepack
ICEPROG = iceprog
#### DO NOT MODIFY ANYTHING BELOW THIS LINE ###
# GO BOARD GENERICS
GHDL_GENERICS= #-gCLK_FREQUENCY=25000000
PCF=constraints/goboard.pcf
PACKAGE=vq100
DEVICE=--hx1k
FREQ=--freq 25
all: $(PACKNAME).bin
# Take all out modules and append .vhdl to the module name
# As an example, Foo will turn into Foo.vhdl
SOURCES = $(MODULES:%=%.vhdl) $(PACKNAME).vhdl
$(PACKNAME).json: $(SOURCES)
$(GHDL) -a --std=08 $^ $(PACKNAME).vhdl
$(YOSYS) -m $(GHDLSYNTH) -p "ghdl --std=08 $(GHDL_GENERICS) $(SOURCES) -e $(PACKNAME); synth_ice40 -json $@"
$(PACKNAME).asc: $(PACKNAME).json $(LPF)
$(NEXTPNR) --hx1k --json $< $(FREQ) --pcf $(PCF) --pcf-allow-unconstrained --package $(PACKAGE) --asc $@
$(PACKNAME).bin: $(PACKNAME).asc
$(ICEPACK) $< $@
prog: $(PACKNAME).bin
$(ICEPROG) $<
clean:
@rm -f work-obj08.cf *.bit *.json *.svf *.config
.PHONY: clean prog
.PRECIOUS: *.json *.asc *.bin