-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathMakefile
61 lines (46 loc) · 1.45 KB
/
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
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
60
61
include ../../board.mk
include ../../ghdl-prefix.mk
DESIGN = blink
TOP = Fomu_Blink
# VHDL top with instantiated Verilog
VHDL_SYN_FILES = ../../sb_ice40_components.vhd blink.vhd
VERILOG_SYN_FILES = clkgen.v
# Verilog top with instantiated VHDL
#VHDL_SYN_FILES = ../../sb_ice40_components.vhd clkgen.vhd
#VERILOG_SYN_FILES = blink.v
GHDL_FLAGS += --std=08
GHDL ?= ghdl
GHDLSYNTH ?= ghdl
YOSYS ?= yosys
NEXTPNR ?= nextpnr-ice40
ICEPACK ?= icepack
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -c
QUIET = @
# If ghdl-yosys-plugin is built as a module (not the case with fomu-toolchain)
ifdef GHDL_PLUGIN_MODULE
YOSYSFLAGS += -m $(GHDL_PLUGIN_MODULE)
endif
# If a container engine is used, each tool is executed in a separated container
ifdef CONTAINER_ENGINE
include ../../container.mk
endif
# Default target: run all required targets to build the DFU image.
all: $(DESIGN).dfu
$(QUIET) echo "Built '$(DESIGN)' for Fomu $(FOMU_REV)"
.DEFAULT: all
# Use *Yosys* to generate the synthesized netlist.
# This is called the **synthesis** and **tech mapping** step.
$(DESIGN).json: $(VHDL_SYN_FILES) $(VERILOG_SYN_FILES)
$(QUIET) $(YOSYS) $(YOSYSFLAGS) \
-p \
"$(GHDLSYNTH) $(GHDL_FLAGS) $(VHDL_SYN_FILES) -e; \
synth_ice40 \
-top $(TOP) \
-json $@" $(VERILOG_SYN_FILES) 2>&1 | tee yosys-report.txt
include ../../PnR_Prog.mk
.PHONY: load
# Cleanup the generated files.
clean:
rm -fr *.cf *.json *-report.txt *.asc *.bit *.dfu
.PHONY: clean