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