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 |
|
|
TOPLEVEL := $(shell cat $(REL_PATH)/$(PROJECT_TOP))
|
18 |
|
|
PROJECT_NGD=$(TOPLEVEL).ngd
|
19 |
|
|
PROJECT_EDF=$(TOPLEVEL).edf
|
20 |
|
|
PROJECT_NCF=$(TOPLEVEL).ncf
|
21 |
|
|
PROJECT_MAP=$(TOPLEVEL)-map.ncd
|
22 |
|
|
PROJECT_MAP_PCF=$(TOPLEVEL)-map.pcf
|
23 |
|
|
PROJECT_PAR=$(TOPLEVEL)-par.ncd
|
24 |
|
|
PROJECT_TRACE=$(TOPLEVEL).twr
|
25 |
|
|
PROJECT_BIT=$(TOPLEVEL).bit
|
26 |
|
|
|
27 |
|
|
include $(REL_PATH)/$(PROJECT_DEVICE)
|
28 |
|
|
include $(REL_PATH)/$(PROJECT_XILINX)
|
29 |
|
|
|
30 |
|
|
define run_translate
|
31 |
|
|
@echo "==========================================================="
|
32 |
|
|
@echo " Translating "
|
33 |
|
|
@echo "==========================================================="
|
34 |
|
|
rm -rf ngdbuild
|
35 |
|
|
rm -f $(PROJECT_NGD)
|
36 |
|
|
mkdir ngdbuild
|
37 |
|
|
cd ngdbuild && ngdbuild -intstyle ise -dd temp -nt timestamp \
|
38 |
|
|
-uc ../$(REL_PATH)/$(PROJECT_UCF)\
|
39 |
|
|
../$(PROJECT_EDF) $(PROJECT_NGD) >& /dev/null
|
40 |
|
|
cp ngdbuild/$(PROJECT_NGD) $(PROJECT_NGD)
|
41 |
|
|
endef #run_translate
|
42 |
|
|
|
43 |
|
|
define run_map
|
44 |
|
|
@echo "==========================================================="
|
45 |
|
|
@echo " Mapping "
|
46 |
|
|
@echo "==========================================================="
|
47 |
|
|
rm -rf map
|
48 |
|
|
rm -f $(PROJECT_MAP)
|
49 |
|
|
mkdir map
|
50 |
|
|
cd map && map -intstyle ise -ol $(MAP_EFFORT) $(MAP_OPTIONS) -cm $(MAP_COVER_MODE) \
|
51 |
|
|
-pr b -c 100 -tx off \
|
52 |
|
|
-o $(PROJECT_MAP) ../$(PROJECT_NGD) >& /dev/null
|
53 |
|
|
cp map/$(PROJECT_MAP) $(PROJECT_MAP)
|
54 |
|
|
cp map/$(PROJECT_MAP_PCF) $(PROJECT_MAP_PCF)
|
55 |
|
|
endef #run_map
|
56 |
|
|
|
57 |
|
|
define run_guided_par
|
58 |
|
|
@echo "==========================================================="
|
59 |
|
|
@echo " Guided Placing and Routing "
|
60 |
|
|
@echo "==========================================================="
|
61 |
|
|
if test ! -f $(PROJECT_PAR) ; then \
|
62 |
|
|
echo "INFO: No previous placement run found. Running normal PAR"; \
|
63 |
|
|
rm -rf par; \
|
64 |
|
|
rm -f $(PROJECT_PAR); \
|
65 |
|
|
mkdir par; \
|
66 |
|
|
cd par && par -w -intstyle ise -ol high ../$(PROJECT_MAP) \
|
67 |
|
|
$(PROJECT_PAR) ../$(PROJECT_MAP_PCF) >& \dev\null;\
|
68 |
|
|
cp $(PROJECT_PAR) .. \
|
69 |
|
|
; \
|
70 |
|
|
else \
|
71 |
|
|
rm -rf par; \
|
72 |
|
|
mkdir par; \
|
73 |
|
|
mv -f $(PROJECT_PAR) par/$(PROJECT_PAR).guide.ncd; \
|
74 |
|
|
cd par && par -w -intstyle ise -ol high -gf $(PROJECT_PAR).guide.ncd -gm leverage ../$(PROJECT_MAP) \
|
75 |
|
|
$(PROJECT_PAR) ../$(PROJECT_MAP_PCF) >& \dev\null;\
|
76 |
|
|
cp $(PROJECT_PAR) .. \
|
77 |
|
|
; \
|
78 |
|
|
fi
|
79 |
|
|
endef #run_guided_par
|
80 |
|
|
|
81 |
|
|
define run_par
|
82 |
|
|
@echo "==========================================================="
|
83 |
|
|
@echo " Placing and Routing "
|
84 |
|
|
@echo "==========================================================="
|
85 |
|
|
rm -rf par
|
86 |
|
|
rm -f $(PROJECT_PAR)
|
87 |
|
|
mkdir par
|
88 |
|
|
cd par && par -w -intstyle ise -ol $(PAR_EFFORT) ../$(PROJECT_MAP) \
|
89 |
|
|
$(PROJECT_PAR) ../$(PROJECT_MAP_PCF) >& /dev/null
|
90 |
|
|
cp par/$(PROJECT_PAR) $(PROJECT_PAR)
|
91 |
|
|
endef #run_par
|
92 |
|
|
|
93 |
|
|
define run_gentimsim
|
94 |
|
|
@echo "==========================================================="
|
95 |
|
|
@echo " Generating Full Timing Simulation Netlist "
|
96 |
|
|
@echo " ... "
|
97 |
|
|
rm -rf timsim
|
98 |
|
|
mkdir timsim
|
99 |
|
|
netgen -sim -ofmt vhdl -dir timsim -w $(PROJECT_PAR) >& timsim/netgen.log
|
100 |
|
|
@echo vlib work > timsim/$(TOPLEVEL)-par.do
|
101 |
|
|
@echo vcom -work work $(TOPLEVEL)-par.vhd >> timsim/$(TOPLEVEL)-par.do
|
102 |
|
|
@echo vsim -t ps -sdftyp $(TOPLEVEL)=./$(TOPLEVEL)-par.sdf -sdfnoerror work.$(TOPLEVEL) >> timsim/$(TOPLEVEL)-par.do
|
103 |
|
|
@echo " Full Timing Simulation Netlist available in sandbox/timsim"
|
104 |
|
|
@echo "==========================================================="
|
105 |
|
|
endef #run_gentimsim
|
106 |
|
|
|
107 |
|
|
define run_trace
|
108 |
|
|
@echo "==========================================================="
|
109 |
|
|
@echo " Generating Timing Report "
|
110 |
|
|
@echo " ... "
|
111 |
|
|
rm -rf trace
|
112 |
|
|
mkdir trace
|
113 |
|
|
rm -f $(PROJECT_TRACE)
|
114 |
|
|
cd trace && trce -intstyle ise -e $(NR_OF_TIMING_TRACES) -s $(subst -,,$(SPEED_GRADE)) ../$(PROJECT_PAR)\
|
115 |
|
|
-o $(PROJECT_TRACE) ../$(PROJECT_MAP_PCF) -ucf ../$(REL_PATH)/$(PROJECT_UCF) >& trace.log
|
116 |
|
|
cp trace/$(PROJECT_TRACE) .
|
117 |
|
|
@echo " Full Timing trace available in sandbox/$(PROJECT_TRACE)"
|
118 |
|
|
@echo "==========================================================="
|
119 |
|
|
endef #run_trace
|
120 |
|
|
|
121 |
|
|
define run_bitgen
|
122 |
|
|
@echo "==========================================================="
|
123 |
|
|
@echo " Generating Bitfile "
|
124 |
|
|
@echo " ... "
|
125 |
|
|
rm -rf bitgen
|
126 |
|
|
mkdir bitgen
|
127 |
|
|
rm -f $(PROJECT_BIT)
|
128 |
|
|
cd bitgen && bitgen -w -g UnusedPin:$(UNUSED_PINS) ../$(PROJECT_PAR) $(PROJECT_BIT) >& bitgen.log
|
129 |
|
|
cp bitgen/$(PROJECT_BIT) ../bitfile/$(PROJECT_BIT)
|
130 |
|
|
@echo " Xilinx bitfile available in bitfile/$(PROJECT_BIT)"
|
131 |
|
|
@echo "==========================================================="
|
132 |
|
|
endef #run_bitgen
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
default: $(PROJECT_NGD) $(PROJECT_MAP) $(PROJECT_MAP_PCF) $(PROJECT_PAR) $(PROJECT_BIT)
|
138 |
|
|
|
139 |
|
|
force_translate:
|
140 |
|
|
@$(run_translate)
|
141 |
|
|
force_map:
|
142 |
|
|
@$(run_map)
|
143 |
|
|
|
144 |
|
|
$(PROJECT_NGD): $(PROJECT_EDF) $(PROJECT_NCF) $(REL_PATH)/$(PROJECT_UCF)
|
145 |
|
|
@$(run_translate)
|
146 |
|
|
|
147 |
|
|
$(PROJECT_MAP) $(PROJECT_MAP_PCF): $(PROJECT_NGD) $(REL_PATH)/$(PROJECT_XILINX)
|
148 |
|
|
@$(run_map)
|
149 |
|
|
$(PROJECT_PAR): $(PROJECT_MAP) $(PROJECT_MAP_PCF) $(REL_PATH)/$(PROJECT_XILINX)
|
150 |
|
|
ifeq ($(GUIDED_PAR),1)
|
151 |
|
|
@$(run_guided_par)
|
152 |
|
|
else
|
153 |
|
|
@$(run_par)
|
154 |
|
|
endif
|
155 |
|
|
ifeq ($(GENERATE_SIMULATION_FILES),1)
|
156 |
|
|
@$(run_gentimsim)
|
157 |
|
|
else
|
158 |
|
|
@echo "==========================================================="
|
159 |
|
|
@echo " Timing Simulation netlist NOT generated "
|
160 |
|
|
@echo "==========================================================="
|
161 |
|
|
endif
|
162 |
|
|
ifeq ($(GENERATE_TIMING_TRACE_FILE),1)
|
163 |
|
|
@$(run_trace)
|
164 |
|
|
else
|
165 |
|
|
@echo "==========================================================="
|
166 |
|
|
@echo " Timing Trace File NOT generated "
|
167 |
|
|
@echo "==========================================================="
|
168 |
|
|
endif
|
169 |
|
|
|
170 |
|
|
$(PROJECT_BIT) : $(PROJECT_PAR) $(REL_PATH)/$(PROJECT_XILINX)
|
171 |
|
|
@$(run_bitgen)
|
172 |
|
|
|
173 |
|
|
.PRECIOUS: %.prj %.bit %.edf %.ngd %-map.ncd %-par.ncd %.twr
|