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 = spwstream
|
12 |
|
|
|
13 |
|
|
# The top-level entity to be instantiated
|
14 |
|
|
|
15 |
|
|
TOPLEVEL = spwstream_top
|
16 |
|
|
|
17 |
|
|
# The VHDL sources that need to be compiled during synthesis
|
18 |
|
|
|
19 |
|
|
RTLDIR = ../../rtl/vhdl
|
20 |
|
|
VHDL_SOURCES = spwstream_top.vhd \
|
21 |
|
|
$(RTLDIR)/spwpkg.vhd \
|
22 |
|
|
$(RTLDIR)/spwstream.vhd \
|
23 |
|
|
$(RTLDIR)/spwlink.vhd \
|
24 |
|
|
$(RTLDIR)/spwram.vhd \
|
25 |
|
|
$(RTLDIR)/spwrecv.vhd \
|
26 |
|
|
$(RTLDIR)/spwxmit.vhd \
|
27 |
|
|
$(RTLDIR)/spwxmit_fast.vhd \
|
28 |
|
|
$(RTLDIR)/spwrecvfront_generic.vhd \
|
29 |
7 |
jorisvr |
$(RTLDIR)/spwrecvfront_fast.vhd \
|
30 |
|
|
$(RTLDIR)/syncdff.vhd
|
31 |
2 |
jorisvr |
|
32 |
|
|
# Device type: Spartan-3 on Pender XC3S1500 board
|
33 |
|
|
|
34 |
|
|
FPGA_TYPE = xc3s1500-fg456-4
|
35 |
|
|
|
36 |
|
|
# The default target; recommended targets: "bitfile" or "upload"
|
37 |
|
|
|
38 |
|
|
default : bitfile
|
39 |
|
|
|
40 |
|
|
UCFFILE = spwstream.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 |
3 |
jorisvr |
$(RM) $(PROJ).bit $(PROJ).bgn $(PROJ).drc
|
65 |
2 |
jorisvr |
$(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 |
|
|
@echo "-write_timing_constraints yes" >> $@
|
124 |
|
|
@echo "-cross_clock_analysis no" >> $@
|
125 |
|
|
# @echo "-hierarchy_separator _" >> $@
|
126 |
|
|
@echo "-bus_delimiter <>" >> $@
|
127 |
|
|
@echo "-case maintain" >> $@
|
128 |
|
|
@echo "-slice_utilization_ratio 100" >> $@
|
129 |
|
|
# @echo "-verilog2001 yes" >> $@
|
130 |
|
|
# @echo "-vlgincdir" >> $@
|
131 |
|
|
@echo "-fsm_extract yes" >> $@
|
132 |
|
|
@echo "-fsm_encoding auto" >> $@
|
133 |
|
|
@echo "-fsm_style lut" >> $@
|
134 |
|
|
@echo "-ram_extract yes" >> $@
|
135 |
|
|
@echo "-ram_style auto" >> $@
|
136 |
|
|
@echo "-rom_extract yes" >> $@
|
137 |
|
|
@echo "-rom_style auto" >> $@
|
138 |
|
|
@echo "-mux_extract yes" >> $@
|
139 |
|
|
@echo "-mux_style auto" >> $@
|
140 |
|
|
@echo "-decoder_extract yes" >> $@
|
141 |
|
|
@echo "-priority_extract yes" >> $@
|
142 |
|
|
@echo "-shreg_extract yes" >> $@
|
143 |
|
|
@echo "-shift_extract yes" >> $@
|
144 |
|
|
@echo "-xor_collapse yes" >> $@
|
145 |
|
|
@echo "-resource_sharing yes" >> $@
|
146 |
|
|
@echo "-mult_style auto" >> $@
|
147 |
|
|
@echo "-iobuf yes" >> $@
|
148 |
|
|
@echo "-max_fanout 500" >> $@
|
149 |
|
|
@echo "-bufg 8" >> $@
|
150 |
|
|
@echo "-register_duplication yes" >> $@
|
151 |
|
|
@echo "-equivalent_register_removal yes" >> $@
|
152 |
|
|
@echo "-register_balancing no" >> $@
|
153 |
|
|
@echo "-slice_packing yes" >> $@
|
154 |
|
|
@echo "-optimize_primitives no" >> $@
|
155 |
|
|
@echo "-iob auto" >> $@
|
156 |
|
|
|
157 |
|
|
$(PROJ).ngc $(PROJ).xst.log : $(VHDL_SOURCES) $(PROJ).prj $(PROJ).lso $(PROJ).xst-script
|
158 |
|
|
rm -rf work dump.xst
|
159 |
|
|
xst $(OPT_INTSTYLE) -ifn $(PROJ).xst-script -ofn $(PROJ).xst.log
|
160 |
|
|
rm -rf work dump.xst
|
161 |
|
|
|
162 |
|
|
###############################################################################
|
163 |
|
|
# #
|
164 |
|
|
# STAGE 2: ngdbuild #
|
165 |
|
|
# needs: #
|
166 |
|
|
# #
|
167 |
|
|
# $(PROJ).ngc #
|
168 |
|
|
# #
|
169 |
|
|
# created files: #
|
170 |
|
|
# #
|
171 |
|
|
# $(PROJ).bld - human-readable build log #
|
172 |
|
|
# $(PROJ).ngd - XILINX-XDB 0.1 STUB 0.1 ASCII / XILINX-XDM V1.2e #
|
173 |
|
|
# #
|
174 |
|
|
# created dir: #
|
175 |
|
|
# _ngo #
|
176 |
|
|
# #
|
177 |
|
|
###############################################################################
|
178 |
|
|
|
179 |
|
|
$(PROJ).ngd $(PROJ).bld: $(PROJ).ngc $(UCFFILE)
|
180 |
|
|
rm -rf _ngo
|
181 |
|
|
ngdbuild $(OPT_INTSTYLE) -dd _ngo -aul -p $(FPGA_TYPE) $(if $(UCFFILE),-uc $(UCFFILE)) $(PROJ).ngc $(PROJ).ngd
|
182 |
|
|
rm -rf _ngo
|
183 |
|
|
|
184 |
|
|
###############################################################################
|
185 |
|
|
# #
|
186 |
|
|
# STAGE 3: Mapper #
|
187 |
|
|
# needs: #
|
188 |
|
|
# #
|
189 |
|
|
# $(PROJ).ngd #
|
190 |
|
|
# #
|
191 |
|
|
# created files: #
|
192 |
|
|
# #
|
193 |
|
|
# $(PROJ).pcf - ASCII file #
|
194 |
|
|
# $(PROJ)_map.mrp - human-readable mapping report #
|
195 |
|
|
# $(PROJ)_map.ncd - binary format #
|
196 |
|
|
# $(PROJ)_map.ngm - XILINX-XDB 0.1 STUB 0.1 ASCII / XILINX-XDM V1.2e #
|
197 |
|
|
# #
|
198 |
|
|
# NOTE: #
|
199 |
|
|
# #
|
200 |
|
|
# In order to prevent the make process from terminating on these spurious #
|
201 |
|
|
# problems, we precede the "map" invocation with a hyphen, instructing #
|
202 |
|
|
# make to ignore the return code from "map". #
|
203 |
|
|
# #
|
204 |
|
|
###############################################################################
|
205 |
|
|
|
206 |
|
|
$(PROJ).pcf $(PROJ)_map.mrp $(PROJ)_map.ncd $(PROJ)_map.ngm: $(PROJ).ngd
|
207 |
|
|
map $(OPT_INTSTYLE) -p $(FPGA_TYPE) -cm area -pr b -c 100 -o $(PROJ)_map.ncd $(PROJ).ngd $(PROJ).pcf
|
208 |
|
|
|
209 |
|
|
###############################################################################
|
210 |
|
|
# #
|
211 |
|
|
# STAGE 4: Place-and-Route #
|
212 |
|
|
# needs: #
|
213 |
|
|
# #
|
214 |
|
|
# $(PROJ).pcf #
|
215 |
|
|
# $(PROJ)_map.ncd #
|
216 |
|
|
# #
|
217 |
|
|
# created files: #
|
218 |
|
|
# #
|
219 |
|
|
# $(PROJ).ncd - binary file #
|
220 |
|
|
# $(PROJ).pad - ASCII file for import in spreadsheet #
|
221 |
|
|
# $(PROJ).par - human-readable place-and-route report #
|
222 |
|
|
# $(PROJ).xpi - ASCII file #
|
223 |
|
|
# $(PROJ)_pad.csv - human-readable CVS file #
|
224 |
|
|
# $(PROJ)_pad.txt - human-readable file #
|
225 |
|
|
# #
|
226 |
|
|
###############################################################################
|
227 |
|
|
|
228 |
|
|
$(PROJ).ncd $(PROJ).pad $(PROJ).par $(PROJ).xpi $(PROJ)_pad.csv $(PROJ)_pad.txt: $(PROJ).pcf $(PROJ)_map.ncd
|
229 |
|
|
par -w $(OPT_INTSTYLE) -t 1 $(PROJ)_map.ncd $(PROJ).ncd $(PROJ).pcf
|
230 |
|
|
|
231 |
|
|
###############################################################################
|
232 |
|
|
# #
|
233 |
|
|
# STAGE 4.5 (optional): trace #
|
234 |
|
|
# needs: #
|
235 |
|
|
# #
|
236 |
|
|
# created files: #
|
237 |
|
|
# #
|
238 |
|
|
###############################################################################
|
239 |
|
|
|
240 |
|
|
$(PROJ).twr $(PROJ).twx : $(PROJ).ncd $(PROJ).pcf
|
241 |
|
|
trce $(OPT_INTSTYLE) -e 5 -l 5 -u 5 -xml $(PROJ) $(PROJ).ncd -o $(PROJ).twr $(PROJ).pcf
|
242 |
|
|
|
243 |
|
|
###############################################################################
|
244 |
|
|
# #
|
245 |
|
|
# STAGE 5: Generate BIT-file #
|
246 |
|
|
# needs: #
|
247 |
|
|
# #
|
248 |
|
|
# $(PROJ).ncd #
|
249 |
|
|
# #
|
250 |
|
|
# created files: $(PROJ).bgn $(PROJ).bit $(PROJ).drc #
|
251 |
|
|
# #
|
252 |
|
|
# $(PROJ).bgn - human-readable BitGen report #
|
253 |
|
|
# $(PROJ).drc - human readable DRC report #
|
254 |
|
|
# $(PROJ).bit - binary image file #
|
255 |
|
|
# #
|
256 |
|
|
###############################################################################
|
257 |
|
|
|
258 |
|
|
# We omit "-g StartUpClk:JtagClk" ; this doesn't work if the image is loaded
|
259 |
|
|
# from a PROM.
|
260 |
|
|
|
261 |
|
|
OPT_BITGEN = -w \
|
262 |
|
|
-g DebugBitstream:No \
|
263 |
|
|
-g Binary:no \
|
264 |
|
|
-g CRC:Enable \
|
265 |
|
|
-g ConfigRate:6 \
|
266 |
|
|
-g CclkPin:PullUp \
|
267 |
|
|
-g M0Pin:PullUp \
|
268 |
|
|
-g M1Pin:PullUp \
|
269 |
|
|
-g M2Pin:PullUp \
|
270 |
|
|
-g ProgPin:PullUp \
|
271 |
|
|
-g DonePin:PullUp \
|
272 |
|
|
-g TckPin:PullUp \
|
273 |
|
|
-g TdiPin:PullUp \
|
274 |
|
|
-g TdoPin:PullUp \
|
275 |
|
|
-g TmsPin:PullUp \
|
276 |
|
|
-g UnusedPin:PullDown \
|
277 |
|
|
-g UserID:0xFFFFFFFF \
|
278 |
|
|
-g DCMShutDown:Disable \
|
279 |
|
|
-g DONE_cycle:4 \
|
280 |
|
|
-g GTS_cycle:5 \
|
281 |
|
|
-g GWE_cycle:6 \
|
282 |
|
|
-g LCK_cycle:NoWait \
|
283 |
|
|
-g Match_cycle:Auto \
|
284 |
|
|
-g Security:None \
|
285 |
|
|
-g DonePipe:No \
|
286 |
|
|
-g DriveDone:No
|
287 |
|
|
|
288 |
|
|
$(PROJ).bit $(PROJ).bgn $(PROJ).drc: $(PROJ).ncd
|
289 |
|
|
bitgen $(OPT_INTSTYLE) $(OPT_BITGEN) $(PROJ).ncd
|
290 |
|
|
|
291 |
|
|
###############################################################################
|