aboutsummaryrefslogtreecommitdiff
path: root/pnr/makefile
blob: 163d92797f6ed022246a096a6b685fcf049c2c1b (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
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
# Makefile for Quartus Synthesis
# Be quiet
#.SILENT:

LOG_FILE = quartus.log
FAMILY = "Cyclone II"
DEVICE = EP2C20F484C7
PROGFILEEXT = sof

ECHO_TARGET := echo "$$@"  >> $(LOG_FILE) 2>&1
TIME_STAMP := echo "$$@ $$(date --iso=seconds)" >> $(LOG_FILE) 2>&1

help:
	@echo '"make" does intentionally nothing. Type:'
	@echo '  "make qproject" to create quartus project only'
	@echo '  "make compile" to synthesize the design'
	@echo '  "make prog" to configure programmable device'
	@echo '  "make warnings to list all warnings'
	@echo '  "make quartus" to start quartus graphical user interface'
	@echo '  "make clean" to remove all generated files'

qproject: $(PROJECT).qpf

$(PROJECT).qpf: $(SOURCE_FILES)
	@echo "Processing ..."
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)
	@# assign VHDL design files
	@rm -rf quartus_vhdl_source_files.tcl
	@(for source_file in $(SOURCE_FILES); \
	do \
	    echo set_global_assignment -name VHDL_FILE $$source_file >> quartus_vhdl_source_files.tcl; \
	done)
	@# create a default timing constraint file assuming CLOCK_50
	@echo "create_clock -period 20.000 -name CLOCK_50 CLOCK_50" > $(PROJECT).sdc
	@# just create a quartus project
	@quartus_sh -t ../../scripts/create_quartus_project_settings.tcl \
	-projectname $(PROJECT) -family $(FAMILY) -device $(DEVICE) >> $(LOG_FILE) 2>&1

compile: $(PROJECT).qpf flowsummary.log
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)

flowsummary.log: $(SOURCE_FILES)  
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)
	@(quartus_sh -t ../../scripts/quartus_project_flow.tcl \
	  -projectname $(PROJECT) -process compile  >> $(LOG_FILE) 2>&1 \
	  || (grep "Error (" $(LOG_FILE) && false))
	@grep "warnings" $(LOG_FILE)
	@echo
	@echo "To display all warnings use: make warnings"
	@echo

prog: $(PROJECT).qpf flowsummary.log
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)
	@quartus_pgm -c USB-Blaster --mode jtag --operation="p;$(PROJECT).$(PROGFILEEXT)" \
	  >> $(LOG_FILE) 2>&1

quartus: $(PROJECT).qpf
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)
	@quartus $(PROJECT).qpf &

warnings: $(LOG_FILE)
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)
	@grep "Warning (" $(LOG_FILE)

rtlview: $(PROJECT).qpf
	@echo "---- $@"  >> $(LOG_FILE) 2>&1
	@$(TIME_STAMP)
	@quartus_sh -t ../../scripts/quartus_project_flow.tcl -projectname $(PROJECT) \
	 -process compile  >> $(LOG_FILE) 2>&1 || (grep "Error (" $(LOG_FILE) && false)
	@quartus_map --read_settings_files=on --write_settings_files=off \
	  $(PROJECT) -c $(PROJECT) --analysis_and_elaboration >> $(LOG_FILE) 2>&1
	@quartus $(PROJECT).qpf &

clean:
	@rm -rf *.rpt *.chg *.log quartus_vhdl_source_files.tcl *.htm *.eqn *.pin *.sof *.pof db incremental_db *.qpf *.qsf *.summary $(PROJECT).* *.sdc