-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
86 lines (72 loc) · 1.84 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ifeq ($(VGA_BOARD),tinyfpgabx)
# TinyFPGA-BX
DEVICE = lp8k
PACKAGE = cm81
CONSTRAINTS_NAME = TinyFPGA-BX
BOARD_TOP = TinyFPGABX_Top
BOARD_FILES = board/$(VGA_BOARD)/TinyFPGABX_PLL_config_pkg.vhd
else
# Icestick
VGA_BOARD = icestick
DEVICE = hx1k
PACKAGE = tq144
CONSTRAINTS_NAME = IceStick
BOARD_TOP = Icestick_Top
BOARD_FILES = board/$(VGA_BOARD)/Icestick_PLL_config_pkg.vhd
$(info Default VGA_BOARD value: 'icestick' (allowed: 'tinyfpgabx' or 'icestick'))
endif
#--
GHDL ?= ghdl
GHDL_SYNTH ?= ghdl
YOSYS ?= yosys
YOSYS_SYNTH ?= synth_ice40
NEXTPNR ?= nextpnr-ice40
ICEPACK ?= icepack
GHDL_FLAGS += --std=08
YOSYS_FLAGS += -q
NEXTPNR_FLAGS += -q
VHDL_SYN_FILES = \
src/VGA_config_pkg.vhd \
src/VGA_sync_gen_idx.vhd \
src/VGA_sync_gen.vhd \
src/VGA_sync_gen_cfg.vhd \
src/Design_Top.vhd \
src/demo.vhd \
device/ICE40/ICE40_components_pkg.vhd \
device/ICE40/ICE40_PLL_config_pkg.vhd \
$(BOARD_FILES) \
board/$(VGA_BOARD)/$(BOARD_TOP).vhd
all: vgatest.bin
@true
.DEFAULT: all
vgatest.json: $(VHDL_SYN_FILES) $(VERILOG_SYN_FILES)
$(YOSYS) $(YOSYS_FLAGS) \
-p \
"$(GHDL_SYNTH) $(GHDL_FLAGS) $(VHDL_SYN_FILES) -e; \
$(YOSYS_SYNTH) \
-top $(BOARD_TOP) \
-json $@" 2>&1 | tee yosys-report.txt
# To be drawn with netlistsvg
vganet.json: $(VHDL_SYN_FILES) $(VERILOG_SYN_FILES)
$(YOSYS) $(YOSYS_FLAGS) \
-p \
"$(GHDL_SYNTH) $(GHDL_FLAGS) $(VHDL_SYN_FILES) -e; \
prep \
-top $(BOARD_TOP); \
write_json $@;" 2>&1 | tee yosys-report.txt
vgatest.asc: vgatest.json
$(NEXTPNR) \
$(NEXTPNR_FLAGS) \
--$(DEVICE) --package "$(PACKAGE)" \
--pcf "../constraints/boards/$(CONSTRAINTS_NAME)/constraints.pcf" \
--json $< \
--asc $@
vgatest.bin: vgatest.asc
$(ICEPACK) $< $@
load: vgatest.bin
iceprog $<
# tinyprog -p $<
.PHONY: load
clean:
rm -fr *.cf *.json *-report.txt *.asc *.bin abc.history
.PHONY: clean