1 |
5 |
ktt1 |
################################################################################
|
2 |
|
|
## _ _ __ ____ ##
|
3 |
|
|
## / / | | / _| | __| ##
|
4 |
|
|
## | |_| | _ _ / / | |_ ##
|
5 |
|
|
## | _ | | | | | | | | _| ##
|
6 |
|
|
## | | | | | |_| | \ \_ | |__ ##
|
7 |
|
|
## |_| |_| \_____| \__| |____| microLab ##
|
8 |
|
|
## ##
|
9 |
|
|
## Bern University of Applied Sciences (BFH) ##
|
10 |
|
|
## Quellgasse 21 ##
|
11 |
|
|
## Room HG 4.33 ##
|
12 |
|
|
## 2501 Biel/Bienne ##
|
13 |
|
|
## Switzerland ##
|
14 |
|
|
## ##
|
15 |
|
|
## http://www.microlab.ch ##
|
16 |
|
|
################################################################################
|
17 |
|
|
SYNTHESIZER=synplify_premier_dp
|
18 |
|
|
|
19 |
|
|
TOPLEVEL := $(shell cat $(REL_PATH)/$(PROJECT_TOP))
|
20 |
|
|
VHDL_FILES := $(shell cat $(REL_PATH)/$(PROJECT_LIST))
|
21 |
|
|
VHDL_FILES_EXTENDED = $(addprefix $(REL_PATH)/vhdl/,$(VHDL_FILES))
|
22 |
|
|
PROJECT_PRJ=$(TOPLEVEL).prj
|
23 |
|
|
PROJECT_EDF=$(TOPLEVEL).edf
|
24 |
|
|
PROJECT_NCF=$(TOPLEVEL).ncf
|
25 |
|
|
|
26 |
|
|
include $(REL_PATH)/$(PROJECT_DEVICE)
|
27 |
|
|
|
28 |
|
|
define create_prj
|
29 |
|
|
echo "Generating Synplify project:" $(PROJECT_PRJ)
|
30 |
|
|
echo -e "# Automatic generated project file.\n# DO NOT EDIT!\n# Edit options in the file $(PROJECT_OPTIONS)!\n" > $(PROJECT_PRJ)
|
31 |
|
|
echo -e $(foreach file, $(VHDL_FILES_EXTENDED),\
|
32 |
|
|
"add_file -vhdl -lib work \"../$(file)\"\n") >> $(PROJECT_PRJ)
|
33 |
|
|
echo "impl -add $(TOPLEVEL) -type fpga" >> $(PROJECT_PRJ)
|
34 |
|
|
echo "set_option -technology $(TECHNOLOGY)" >> $(PROJECT_PRJ)
|
35 |
|
|
echo "set_option -part $(PART)" >> $(PROJECT_PRJ)
|
36 |
|
|
echo "set_option -package $(PACKAGE)" >> $(PROJECT_PRJ)
|
37 |
|
|
echo "set_option -speed_grade $(SPEED_GRADE)" >> $(PROJECT_PRJ)
|
38 |
|
|
if test -f $(REL_PATH)/$(PROJECT_OPTIONS); then\
|
39 |
|
|
cat $(REL_PATH)/$(PROJECT_OPTIONS) >> $(PROJECT_PRJ); else\
|
40 |
|
|
echo "# You can add project options in $(PROJECT_OPTIONS)" >> $(PROJECT_PRJ);\
|
41 |
|
|
fi
|
42 |
|
|
echo "project -result_file \"./$(TOPLEVEL).edf\"" >> $(PROJECT_PRJ)
|
43 |
|
|
endef #create_prj
|
44 |
|
|
|
45 |
|
|
define run_synth
|
46 |
|
|
@echo "==========================================================="
|
47 |
|
|
@echo " Synthetizing with $(SYNTHESIZER)"
|
48 |
|
|
@echo "==========================================================="
|
49 |
|
|
rm -rf synth
|
50 |
|
|
rm -f $(PROJECT_EDF)
|
51 |
|
|
mkdir synth
|
52 |
|
|
cp $(PROJECT_PRJ) synth/$(PROJECT_PRJ)
|
53 |
|
|
cd synth; $(SYNTHESIZER) -log ./$(TOPLEVEL).log -batch ./$(PROJECT_PRJ) >& /dev/null
|
54 |
|
|
cp synth/$(PROJECT_EDF) .
|
55 |
|
|
cp synth/$(PROJECT_NCF) .
|
56 |
|
|
endef #run_synth
|
57 |
|
|
|
58 |
|
|
.PHONY: default
|
59 |
|
|
|
60 |
|
|
#rules
|
61 |
|
|
default : $(PROJECT_EDF)
|
62 |
|
|
|
63 |
|
|
force_synth :
|
64 |
|
|
@$(run_synth)
|
65 |
|
|
|
66 |
|
|
$(PROJECT_EDF) : $(PROJECT_PRJ)
|
67 |
|
|
@$(run_synth)
|
68 |
|
|
|
69 |
|
|
$(PROJECT_PRJ) : $(VHDL_FILES_EXTENDED) $(REL_PATH)/$(PROJECT_OPT)
|
70 |
|
|
@$(create_prj)
|
71 |
|
|
|
72 |
|
|
.PRECIOUS: %.prj
|