1 |
2 |
jorisvr |
|
2 |
|
|
###############################################################################
|
3 |
|
|
## ##
|
4 |
|
|
## project-dependent variables ##
|
5 |
|
|
## ##
|
6 |
|
|
###############################################################################
|
7 |
|
|
|
8 |
|
|
# The project name. The bit-file that is generated in the end will be named
|
9 |
|
|
# "$(PROJ).bit"
|
10 |
|
|
|
11 |
|
|
PROJ = streamtest
|
12 |
|
|
|
13 |
|
|
# The top-level entity to be instantiated
|
14 |
|
|
|
15 |
|
|
TOPLEVEL = streamtest_top
|
16 |
|
|
|
17 |
|
|
# The VHDL sources that need to be compiled during synthesis
|
18 |
|
|
|
19 |
|
|
RTLDIR = ../../rtl/vhdl
|
20 |
|
|
VHDL_SOURCES = streamtest_top.vhd \
|
21 |
|
|
$(RTLDIR)/streamtest.vhd \
|
22 |
|
|
$(RTLDIR)/spwpkg.vhd \
|
23 |
|
|
$(RTLDIR)/spwstream.vhd \
|
24 |
|
|
$(RTLDIR)/spwlink.vhd \
|
25 |
|
|
$(RTLDIR)/spwram.vhd \
|
26 |
|
|
$(RTLDIR)/spwrecv.vhd \
|
27 |
|
|
$(RTLDIR)/spwxmit.vhd \
|
28 |
|
|
$(RTLDIR)/spwxmit_fast.vhd \
|
29 |
|
|
$(RTLDIR)/spwrecvfront_generic.vhd \
|
30 |
|
|
$(RTLDIR)/spwrecvfront_fast.vhd
|
31 |
|
|
|
32 |
|
|
# Device type: Spartan-3 200 on Digilent board
|
33 |
|
|
|
34 |
|
|
FPGA_TYPE = xc3s200-ft256-4
|
35 |
|
|
|
36 |
|
|
# The default target; recommended targets: "bitfile" or "upload"
|
37 |
|
|
|
38 |
|
|
default : bitfile
|
39 |
|
|
|
40 |
|
|
UCFFILE = streamtest.ucf
|
41 |
|
|
|
42 |
|
|
###############################################################################
|
43 |
|
|
## ##
|
44 |
|
|
## miscellaneous project-independent variables & rules ##
|
45 |
|
|
## ##
|
46 |
|
|
###############################################################################
|
47 |
|
|
|
48 |
|
|
# use this to make most tools quieter
|
49 |
|
|
OPT_INTSTYLE = -intstyle ise
|
50 |
|
|
|
51 |
|
|
# Phony (non file creating) targets
|
52 |
|
|
|
53 |
|
|
.PHONY : default clean bitfile
|
54 |
|
|
|
55 |
|
|
clean :
|
56 |
|
|
$(RM) -rf *~ work dump.xst _ngo 'file graph' xlnx_auto_0_xdb
|
57 |
|
|
$(RM) $(PROJ).xst-script
|
58 |
|
|
$(RM) $(PROJ).lso $(PROJ).prj
|
59 |
|
|
$(RM) $(PROJ).ngc $(PROJ).xst.log $(PROJ).syr $(PROJ).srp $(PROJ).ngr
|
60 |
|
|
$(RM) $(PROJ).ngd $(PROJ).bld
|
61 |
|
|
$(RM) $(PROJ).twx $(PROJ).twr
|
62 |
|
|
$(RM) $(PROJ).pcf $(PROJ)_map.mrp $(PROJ)_map.ncd $(PROJ)_map.ngm
|
63 |
|
|
$(RM) $(PROJ).ncd $(PROJ).pad $(PROJ).par $(PROJ).xpi $(PROJ)_pad.csv $(PROJ)_pad.txt
|
64 |
|
|
$(RM) $(PROJ).bit $(PROJ).bgn $(PROJ).drc
|
65 |
|
|
$(RM) $(PROJ).ptwx $(PROJ).unroutes *.xrpt $(PROJ)_summary.xml $(PROJ)_usage.xml $(PROJ)_map.map
|
66 |
|
|
|
67 |
|
|
bitfile : $(PROJ).bit
|
68 |
|
|
|
69 |
|
|
###############################################################################
|
70 |
|
|
# #
|
71 |
|
|
# STAGE 1: "xst" (Xilinx Synthesis Tool) #
|
72 |
|
|
# needs: #
|
73 |
|
|
# #
|
74 |
|
|
# $(PROJ).vhdl #
|
75 |
|
|
# $(PROJ).prj - Project file (created below) #
|
76 |
|
|
# $(PROJ).lso - Library Search Order file (created below) #
|
77 |
|
|
# #
|
78 |
|
|
# created files: #
|
79 |
|
|
# #
|
80 |
|
|
# $(PROJ).ngc - netlist #
|
81 |
|
|
# $(PROJ).ngr - XILINX-XDB 0.1 STUB 0.1 ASCII / XILINX-XDM V1.2e #
|
82 |
|
|
# (optional, depending on the '-rtlview' option) #
|
83 |
|
|
# $(PROJ).xst.log - human-readable synthesis report #
|
84 |
|
|
# (AKA .syr, .srp) #
|
85 |
|
|
# #
|
86 |
|
|
# created directories: #
|
87 |
|
|
# #
|
88 |
|
|
# work #
|
89 |
|
|
# dump.xst #
|
90 |
|
|
# #
|
91 |
|
|
###############################################################################
|
92 |
|
|
|
93 |
|
|
# Generate a "Library Search Order" file, containing just "work" for now.
|
94 |
|
|
|
95 |
|
|
$(PROJ).lso :
|
96 |
|
|
@echo "work" > $@
|
97 |
|
|
|
98 |
|
|
# Generate a "Project" file, consisting of lines containing each of the
|
99 |
|
|
# VHDL_SOURCES, preceded by "vhdl work".
|
100 |
|
|
|
101 |
|
|
$(PROJ).prj :
|
102 |
|
|
$(shell echo -n $(VHDL_SOURCES) | \
|
103 |
|
|
sed 's/\([^ ]\+\) */vhdl work \1\n/g' > $@)
|
104 |
|
|
|
105 |
|
|
$(PROJ).xst-script :
|
106 |
|
|
@echo "set -tmpdir /tmp" > $@
|
107 |
|
|
@echo "set -xsthdpdir ." >> $@
|
108 |
|
|
@echo "run" >> $@
|
109 |
|
|
@echo "-ifn $(PROJ).prj" >> $@
|
110 |
|
|
@echo "-ifmt mixed" >> $@
|
111 |
|
|
@echo "-ofn $(PROJ)" >> $@
|
112 |
|
|
@echo "-ofmt ngc" >> $@
|
113 |
|
|
@echo "-p $(FPGA_TYPE)" >> $@
|
114 |
|
|
@echo "-top $(TOPLEVEL)" >> $@
|
115 |
|
|
@echo "-opt_mode speed" >> $@
|
116 |
|
|
@echo "-opt_level 1" >> $@
|
117 |
|
|
@echo "-iuc no" >> $@
|
118 |
|
|
@echo "-lso $(PROJ).lso" >> $@
|
119 |
|
|
@echo "-keep_hierarchy no" >> $@
|
120 |
|
|
@echo "-glob_opt AllClockNets" >> $@
|
121 |
|
|
@echo "-rtlview no" >> $@
|
122 |
|
|
@echo "-read_cores yes" >> $@
|
123 |
|
|
# Note: write_timing_constraints is non-standard
|
124 |
|
|
@echo "-write_timing_constraints yes" >> $@
|
125 |
|
|
@echo "-cross_clock_analysis no" >> $@
|
126 |
|
|
# @echo "-hierarchy_separator _" >> $@
|
127 |
|
|
@echo "-bus_delimiter <>" >> $@
|
128 |
|
|
@echo "-case maintain" >> $@
|
129 |
|
|
@echo "-slice_utilization_ratio 100" >> $@
|
130 |
|
|
# @echo "-verilog2001 yes" >> $@
|
131 |
|
|
# @echo "-vlgincdir" >> $@
|
132 |
|
|
@echo "-fsm_extract yes" >> $@
|
133 |
|
|
@echo "-fsm_encoding auto" >> $@
|
134 |
|
|
@echo "-fsm_style lut" >> $@
|
135 |
|
|
# Note: safe_implementation is non-standard
|
136 |
|
|
@echo "-safe_implementation yes" >> $@
|
137 |
|
|
@echo "-ram_extract yes" >> $@
|
138 |
|
|
@echo "-ram_style auto" >> $@
|
139 |
|
|
@echo "-rom_extract yes" >> $@
|
140 |
|
|
@echo "-rom_style auto" >> $@
|
141 |
|
|
@echo "-mux_extract yes" >> $@
|
142 |
|
|
@echo "-mux_style auto" >> $@
|
143 |
|
|
@echo "-decoder_extract yes" >> $@
|
144 |
|
|
@echo "-priority_extract yes" >> $@
|
145 |
|
|
@echo "-shreg_extract yes" >> $@
|
146 |
|
|
@echo "-shift_extract yes" >> $@
|
147 |
|
|
@echo "-xor_collapse yes" >> $@
|
148 |
|
|
@echo "-resource_sharing yes" >> $@
|
149 |
|
|
@echo "-mult_style auto" >> $@
|
150 |
|
|
@echo "-iobuf yes" >> $@
|
151 |
|
|
@echo "-max_fanout 500" >> $@
|
152 |
|
|
@echo "-bufg 8" >> $@
|
153 |
|
|
@echo "-register_duplication yes" >> $@
|
154 |
|
|
@echo "-equivalent_register_removal yes" >> $@
|
155 |
|
|
@echo "-register_balancing no" >> $@
|
156 |
|
|
@echo "-slice_packing yes" >> $@
|
157 |
|
|
@echo "-optimize_primitives no" >> $@
|
158 |
|
|
@echo "-iob auto" >> $@
|
159 |
|
|
|
160 |
|
|
$(PROJ).ngc $(PROJ).xst.log : $(VHDL_SOURCES) $(PROJ).prj $(PROJ).lso $(PROJ).xst-script
|
161 |
|
|
rm -rf work dump.xst
|
162 |
|
|
xst $(OPT_INTSTYLE) -ifn $(PROJ).xst-script -ofn $(PROJ).xst.log
|
163 |
|
|
rm -rf work dump.xst
|
164 |
|
|
|
165 |
|
|
###############################################################################
|
166 |
|
|
# #
|
167 |
|
|
# STAGE 2: ngdbuild #
|
168 |
|
|
# needs: #
|
169 |
|
|
# #
|
170 |
|
|
# $(PROJ).ngc #
|
171 |
|
|
# #
|
172 |
|
|
# created files: #
|
173 |
|
|
# #
|
174 |
|
|
# $(PROJ).bld - human-readable build log #
|
175 |
|
|
# $(PROJ).ngd - XILINX-XDB 0.1 STUB 0.1 ASCII / XILINX-XDM V1.2e #
|
176 |
|
|
# #
|
177 |
|
|
# created dir: #
|
178 |
|
|
# _ngo #
|
179 |
|
|
# #
|
180 |
|
|
###############################################################################
|
181 |
|
|
|
182 |
|
|
$(PROJ).ngd $(PROJ).bld: $(PROJ).ngc $(UCFFILE)
|
183 |
|
|
rm -rf _ngo
|
184 |
|
|
ngdbuild $(OPT_INTSTYLE) -dd _ngo -aul -p $(FPGA_TYPE) $(if $(UCFFILE),-uc $(UCFFILE)) $(PROJ).ngc $(PROJ).ngd
|
185 |
|
|
rm -rf _ngo
|
186 |
|
|
|
187 |
|
|
###############################################################################
|
188 |
|
|
# #
|
189 |
|
|
# STAGE 3: Mapper #
|
190 |
|
|
# needs: #
|
191 |
|
|
# #
|
192 |
|
|
# $(PROJ).ngd #
|
193 |
|
|
# #
|
194 |
|
|
# created files: #
|
195 |
|
|
# #
|
196 |
|
|
# $(PROJ).pcf - ASCII file #
|
197 |
|
|
# $(PROJ)_map.mrp - human-readable mapping report #
|
198 |
|
|
# $(PROJ)_map.ncd - binary format #
|
199 |
|
|
# $(PROJ)_map.ngm - XILINX-XDB 0.1 STUB 0.1 ASCII / XILINX-XDM V1.2e #
|
200 |
|
|
# #
|
201 |
|
|
# NOTE: #
|
202 |
|
|
# #
|
203 |
|
|
# In order to prevent the make process from terminating on these spurious #
|
204 |
|
|
# problems, we precede the "map" invocation with a hyphen, instructing #
|
205 |
|
|
# make to ignore the return code from "map". #
|
206 |
|
|
# #
|
207 |
|
|
###############################################################################
|
208 |
|
|
|
209 |
|
|
$(PROJ).pcf $(PROJ)_map.mrp $(PROJ)_map.ncd $(PROJ)_map.ngm: $(PROJ).ngd
|
210 |
|
|
map $(OPT_INTSTYLE) -p $(FPGA_TYPE) -cm area -pr b -c 100 -o $(PROJ)_map.ncd $(PROJ).ngd $(PROJ).pcf
|
211 |
|
|
|
212 |
|
|
###############################################################################
|
213 |
|
|
# #
|
214 |
|
|
# STAGE 4: Place-and-Route #
|
215 |
|
|
# needs: #
|
216 |
|
|
# #
|
217 |
|
|
# $(PROJ).pcf #
|
218 |
|
|
# $(PROJ)_map.ncd #
|
219 |
|
|
# #
|
220 |
|
|
# created files: #
|
221 |
|
|
# #
|
222 |
|
|
# $(PROJ).ncd - binary file #
|
223 |
|
|
# $(PROJ).pad - ASCII file for import in spreadsheet #
|
224 |
|
|
# $(PROJ).par - human-readable place-and-route report #
|
225 |
|
|
# $(PROJ).xpi - ASCII file #
|
226 |
|
|
# $(PROJ)_pad.csv - human-readable CVS file #
|
227 |
|
|
# $(PROJ)_pad.txt - human-readable file #
|
228 |
|
|
# #
|
229 |
|
|
###############################################################################
|
230 |
|
|
|
231 |
|
|
$(PROJ).ncd $(PROJ).pad $(PROJ).par $(PROJ).xpi $(PROJ)_pad.csv $(PROJ)_pad.txt: $(PROJ).pcf $(PROJ)_map.ncd
|
232 |
|
|
par -w $(OPT_INTSTYLE) -t 1 $(PROJ)_map.ncd $(PROJ).ncd $(PROJ).pcf
|
233 |
|
|
|
234 |
|
|
###############################################################################
|
235 |
|
|
# #
|
236 |
|
|
# STAGE 4.5 (optional): trace #
|
237 |
|
|
# needs: #
|
238 |
|
|
# #
|
239 |
|
|
# created files: #
|
240 |
|
|
# #
|
241 |
|
|
###############################################################################
|
242 |
|
|
|
243 |
|
|
$(PROJ).twr $(PROJ).twx : $(PROJ).ncd $(PROJ).pcf
|
244 |
|
|
trce $(OPT_INTSTYLE) -e 5 -l 5 -u 5 -xml $(PROJ) $(PROJ).ncd -o $(PROJ).twr $(PROJ).pcf
|
245 |
|
|
|
246 |
|
|
###############################################################################
|
247 |
|
|
# #
|
248 |
|
|
# STAGE 5: Generate BIT-file #
|
249 |
|
|
# needs: #
|
250 |
|
|
# #
|
251 |
|
|
# $(PROJ).ncd #
|
252 |
|
|
# #
|
253 |
|
|
# created files: $(PROJ).bgn $(PROJ).bit $(PROJ).drc #
|
254 |
|
|
# #
|
255 |
|
|
# $(PROJ).bgn - human-readable BitGen report #
|
256 |
|
|
# $(PROJ).drc - human readable DRC report #
|
257 |
|
|
# $(PROJ).bit - binary image file #
|
258 |
|
|
# #
|
259 |
|
|
###############################################################################
|
260 |
|
|
|
261 |
|
|
# We omit "-g StartUpClk:JtagClk" ; this doesn't work if the image is loaded
|
262 |
|
|
# from a PROM.
|
263 |
|
|
|
264 |
|
|
# Note: LCK_cycle:3 is non-standard
|
265 |
|
|
OPT_BITGEN = -w \
|
266 |
|
|
-g DebugBitstream:No \
|
267 |
|
|
-g Binary:no \
|
268 |
|
|
-g CRC:Enable \
|
269 |
|
|
-g ConfigRate:6 \
|
270 |
|
|
-g CclkPin:PullUp \
|
271 |
|
|
-g M0Pin:PullUp \
|
272 |
|
|
-g M1Pin:PullUp \
|
273 |
|
|
-g M2Pin:PullUp \
|
274 |
|
|
-g ProgPin:PullUp \
|
275 |
|
|
-g DonePin:PullUp \
|
276 |
|
|
-g TckPin:PullUp \
|
277 |
|
|
-g TdiPin:PullUp \
|
278 |
|
|
-g TdoPin:PullUp \
|
279 |
|
|
-g TmsPin:PullUp \
|
280 |
|
|
-g UnusedPin:PullDown \
|
281 |
|
|
-g UserID:0xFFFFFFFF \
|
282 |
|
|
-g DCMShutDown:Disable \
|
283 |
|
|
-g DONE_cycle:4 \
|
284 |
|
|
-g GTS_cycle:5 \
|
285 |
|
|
-g GWE_cycle:6 \
|
286 |
|
|
-g LCK_cycle:3 \
|
287 |
|
|
-g Match_cycle:Auto \
|
288 |
|
|
-g Security:None \
|
289 |
|
|
-g DonePipe:No \
|
290 |
|
|
-g DriveDone:No
|
291 |
|
|
|
292 |
|
|
$(PROJ).bit $(PROJ).bgn $(PROJ).drc: $(PROJ).ncd
|
293 |
|
|
bitgen $(OPT_INTSTYLE) $(OPT_BITGEN) $(PROJ).ncd
|
294 |
|
|
|
295 |
|
|
###############################################################################
|
296 |
|
|
|