OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [rtl/] [make_ise/] [generic_xflow.mk] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 wfjm
# $Id: generic_xflow.mk 672 2015-05-02 21:58:28Z mueller $
2 2 wfjm
#
3 29 wfjm
# Copyright 2007-2015 by Walter F.J. Mueller 
4
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
5
#
6 2 wfjm
#  Revision History:
7
# Date         Rev Version  Comment
8 30 wfjm
# 2015-05-02   672   1.11   ucf_cpp handling: remove -C (gcc 4.8 stdc-predef.h)
9 29 wfjm
# 2015-02-06   643   1.10   use make_ise; rename xise_msg_filter <- isemsg_filter
10
#                           drop --ise_path from vbomconv;
11 22 wfjm
# 2013-10-12   539   1.9    use xtwi; support trce tsi file; use -C for cpp
12 19 wfjm
# 2013-01-27   477   1.8    remove defaults for ISE_(BOARD|PATH) and XFLOWOPT_*
13
#                           use dontincdep.mk to suppress .dep include on clean
14 18 wfjm
# 2013-01-05   470   1.7.6  remove '-r' from all non-dir clean rm's
15 17 wfjm
# 2012-02-05   456   1.7.5  use vbomvonv --get_top for xflow calls
16
# 2012-01-08   451   1.7.4  use xilinx_ghdl_sdf_filter
17
# 2012-01-04   450   1.7.3  display isemsg_filter for ncd and bit targets too
18
# 2011-12-29   446   1.7.2  add fx2load_wrapper in jconfig target
19 12 wfjm
# 2011-08-14   406   1.7.1  use isemsg_filter; new %.mfsum target
20
# 2011-08-13   405   1.7    renamed, moved to rtl/make;
21
# 2011-07-17   394   1.6.2  add rm *.svf to ise_clean rule
22
# 2011-07-11   392   1.6.1  use config_wrapper, support jtag via svf generation
23
# 2011-06-26   385   1.6    use ISE_PATH for vbomconv -xst_prj
24 8 wfjm
# 2010-11-26   340   1.5.8  fix path for .opt defaults (now rtl/vlib)
25 2 wfjm
# 2010-05-06   289   1.5.7  add xilinx_tsim_xon support
26
# 2010-04-24   282   1.5.6  add %.impact rule to run impact_wrapper
27
# 2010-04-17   278   1.4.5  add '|| true' after grep in diag summary to prevent
28
#                           a make abort in case no diags are seen
29
# 2010-04-02   273   1.4.4  add -I{RETROBASE} to ucf_cpp processing rules
30
# 2010-03-14   268   1.4.3  add XFLOWOPT_SYN and XFLOWOPT_IMP
31
# 2009-11-21   252   1.4.2  use bitgen directly, use ISE_USERID
32
# 2007-12-17   102   1.4.1  fix %.dep_ucf_cpp : %.ucf_cpp rule
33
# 2007-12-16   101   1.4    add ucf_cpp rules
34
# 2007-12-09   100   1.3.7  ifndef define ISE_PATH to xc3s1000-ft256-4
35
# 2007-11-02    94   1.3.6  use .SECONDARY to keep intermediate files
36
# 2007-10-28    93   1.3.5  call xst_count_bels -xsts when _ssim is generated
37
# 2007-10-12    88   1.3.4  support .xcf files, if provided
38
# 2007-10-06    87   1.3.3  remove *_twr.log in clean
39
# 2007-07-20    67   1.3.2  handle local/global xst_vhdl.opt
40
# 2007-07-15    66   1.3.1  add rule "%.ngc: ../%.vbom" to support _*sim in ./tb
41
#                           add XST diagnostics summary at end of listing
42
# 2007-07-06    64   1.3    all vbom based now
43
# 2007-06-16    57   1.2.1  cleanup ghdl_clean handling (rm _[sft]sim)
44
# 2007-06-10    52   1.2    reorganized svn directory structure
45
# 2007-06-10    51   1.1    consolidate test bench generation
46
# 2007-06-03    45   1.0    Initial version
47
#---
48
#
49
# setup default board (for impact), device and userid (for bitgen)
50
#
51
ifndef ISE_BOARD
52 19 wfjm
$(error ISE_BOARD is not defined)
53 2 wfjm
endif
54
#
55
ifndef ISE_PATH
56 19 wfjm
$(error ISE_PATH is not defined)
57 2 wfjm
endif
58
#
59
ifndef ISE_USERID
60
ISE_USERID = 0xffffffff
61
endif
62
#
63
# setup defaults for xflow option files for synthesis and implementation
64
#
65
ifndef XFLOWOPT_SYN
66 19 wfjm
$(error XFLOWOPT_SYN is not defined)
67 2 wfjm
endif
68
#
69
ifndef XFLOWOPT_IMP
70 19 wfjm
$(error XFLOWOPT_IMP is not defined)
71 2 wfjm
endif
72
#
73
XFLOW    = xflow -p ${ISE_PATH}
74
#
75
# $@ first target
76
# $< first dependency
77
# $* stem in rule match
78
#
79
# when chaining, don't delete 'expensive' intermediate files:
80
.SECONDARY :
81
#
82
# Synthesize (xst)
83
#   input:   %.vbom     vbom project description
84
#   output:  %.ngc
85
#            %_xst.log  xst log file
86
#
87
%.ngc: %.vbom
88
        if [ ! -d ./ise ]; then mkdir ./ise; fi
89 29 wfjm
        (cd ./ise; vbomconv --xst_prj ../$< > $*.prj)
90 2 wfjm
        (cd ./ise; touch $*.xcf)
91
        if [ -r  $*.xcf ]; then cp $*.xcf ./ise; fi
92 29 wfjm
        if [ -r ${RETROBASE}/rtl/make_ise/${XFLOWOPT_SYN} ]; then \
93
                cp ${RETROBASE}/rtl/make_ise/${XFLOWOPT_SYN} ./ise; fi
94 2 wfjm
        if [ -r ${XFLOWOPT_SYN} ]; then cp ${XFLOWOPT_SYN} ./ise; fi
95 22 wfjm
        xtwi ${XFLOW} -wd ise -synth ${XFLOWOPT_SYN} \
96 17 wfjm
          -g top_entity:`vbomconv --get_top $<` $*.prj
97 2 wfjm
        (cd ./ise; chmod -x *.* )
98
        if [ -r ./ise/$*.ngc ]; then cp -p ./ise/$*.ngc .; fi
99
        if [ -r ./ise/$*_xst.log ]; then cp -p ./ise/$*_xst.log .; fi
100
        @ echo "==============================================================="
101 12 wfjm
        @ echo "*     XST Diagnostic Summary                                  *"
102 2 wfjm
        @ echo "==============================================================="
103 29 wfjm
        @ if [ -r $*.mfset ]; then xise_msg_filter xst $*.mfset $*_xst.log; fi
104 12 wfjm
        @ if [ ! -r $*.mfset ]; then grep -i -A 1 ":.*:" $*_xst.log || true; fi
105 2 wfjm
        @ echo "==============================================================="
106
#
107
# the following rule needed to generate an %_*sim.vhd in a ./tb sub-directory
108
# it will look for a matching vbom in the parent directory
109
%.ngc: ../%.vbom
110
        if [ ! -d ./ise ]; then mkdir ./ise; fi
111
        (cd ./ise; vbomconv --xst_prj ../$< > $*.prj)
112
        (cd ./ise; touch $*.xcf)
113
        if [ -r  $*.xcf ]; then cp $*.xcf ./ise; fi
114 29 wfjm
        if [ -r ${RETROBASE}/rtl/make_ise/${XFLOWOPT_SYN} ]; then \
115
                cp ${RETROBASE}/rtl/make_ise/${XFLOWOPT_SYN} ./ise; fi
116 2 wfjm
        if [ -r ${XFLOWOPT_SYN} ]; then cp ${XFLOWOPT_SYN} ./ise; fi
117 22 wfjm
        xtwi ${XFLOW} -wd ise -synth ${XFLOWOPT_SYN} \
118 17 wfjm
          -g top_entity:`vbomconv --get_top $<` $*.prj
119 2 wfjm
        (cd ./ise; chmod -x *.* )
120
        if [ -r ./ise/$*.ngc ]; then cp -p ./ise/$*.ngc .; fi
121
        if [ -r ./ise/$*_xst.log ]; then cp -p ./ise/$*_xst.log .; fi
122
        @ echo "==============================================================="
123 12 wfjm
        @ echo "*     XST Diagnostic Summary                                  *"
124 2 wfjm
        @ echo "==============================================================="
125 29 wfjm
        @ if [ -r $*.mfset ]; then xise_msg_filter xst $*.mfset $*_xst.log; fi
126 12 wfjm
        @ if [ ! -r $*.mfset ]; then grep -i -A 1 ":.*:" $*_xst.log || true; fi
127 2 wfjm
        @ echo "==============================================================="
128
#
129 12 wfjm
# Implement 1 (map+par)
130 2 wfjm
#   input:   %.ngc
131
#            %.ucf      constraint file (if available)
132
#   output:  %.ncd
133
#            %.pcf
134
#            %_tra.log  translate (ngdbuild) log file (renamed %.bld)
135
#            %_map.log  map log file                  (renamed %_map.mrp)
136
#            %_par.log  par log file                  (renamed %.par)
137
#            %_pad.log  pad file                      (renamed %_pad.txt)
138 22 wfjm
#            %_tsi.log  trce tsi file                 (renamed %.tsi)
139 5 wfjm
#            %_twr.log  trce log file                 (renamed %.twr)
140 2 wfjm
#
141
%.ncd %.pcf: %.ngc
142
        if [ ! -d ./ise ]; then mkdir ./ise; fi
143
        if [ -r $*.ngc ]; then cp -p $*.ngc ./ise; fi
144
        if [ -r $*.ucf ]; then cp -p $*.ucf ./ise; fi
145 29 wfjm
        if [ -r ${RETROBASE}/rtl/make_ise/${XFLOWOPT_IMP} ]; then \
146
                cp ${RETROBASE}/rtl/make_ise/${XFLOWOPT_IMP} ./ise; fi
147 2 wfjm
        if [ -r ${XFLOWOPT_IMP} ]; then cp -p ${XFLOWOPT_IMP} ./ise; fi
148 22 wfjm
        xtwi ${XFLOW} -wd ise -implement ${XFLOWOPT_IMP} $<
149 2 wfjm
        (cd ./ise; chmod -x *.* )
150
        if [ -r ./ise/$*.ncd ]; then cp -p ./ise/$*.ncd .; fi
151
        if [ -r ./ise/$*.pcf ]; then cp -p ./ise/$*.pcf .; fi
152
        if [ -r ./ise/$*.bld ]; then cp -p ./ise/$*.bld ./$*_tra.log; fi
153
        if [ -r ./ise/$*_map.mrp ]; then cp -p ./ise/$*_map.mrp ./$*_map.log; fi
154
        if [ -r ./ise/$*.par ]; then cp -p ./ise/$*.par ./$*_par.log; fi
155
        if [ -r ./ise/$*_pad.txt ]; then cp -p ./ise/$*_pad.txt ./$*_pad.log; fi
156
        if [ -r ./ise/$*.twr ]; then cp -p ./ise/$*.twr ./$*_twr.log; fi
157 22 wfjm
        if [ -r ./ise/$*.tsi ]; then cp -p ./ise/$*.tsi ./$*_tsi.log; fi
158 17 wfjm
        @ if [ -r $*.mfset ]; then \
159
          echo "=============================================================";\
160
          echo "*     Translate Diagnostic Summary                          *";\
161
          echo "=============================================================";\
162 29 wfjm
          xise_msg_filter tra $*.mfset $*_tra.log;\
163 17 wfjm
          echo "=============================================================";\
164
          echo "*     MAP Diagnostic Summary                                *";\
165
          echo "=============================================================";\
166 29 wfjm
          xise_msg_filter map $*.mfset $*_map.log;\
167 17 wfjm
          echo "=============================================================";\
168
          echo "*     PAR Diagnostic Summary                                *";\
169
          echo "=============================================================";\
170 29 wfjm
          xise_msg_filter par $*.mfset $*_par.log;\
171 17 wfjm
          echo "=============================================================";\
172
          fi
173 2 wfjm
#
174 12 wfjm
# Implement 2 (bitgen)
175 2 wfjm
#   input:   %.ncd
176
#   output:  %.bit
177
#            %.msk
178
#            %_bgn.log  bitgen log file    (renamed %.bgn)
179
#
180
%.bit: %.ncd
181
        if [ ! -d ./ise ]; then mkdir ./ise; fi
182
        if [ -r $*.ncd ]; then cp -p $*.ncd ./ise; fi
183 22 wfjm
        (cd ./ise; xtwi bitgen -l -w -m -g ReadBack -g UserId:${ISE_USERID} -intstyle xflow $*.ncd)
184 2 wfjm
        (cd ./ise; chmod -x *.* )
185
        if [ -r ./ise/$*.bit ]; then cp -p ./ise/$*.bit .; fi
186
        if [ -r ./ise/$*.msk ]; then cp -p ./ise/$*.msk .; fi
187
        if [ -r ./ise/$*.bgn ]; then cp -p ./ise/$*.bgn ./$*_bgn.log; fi
188 17 wfjm
        @ if [ -r $*.mfset ]; then \
189
          echo "=============================================================";\
190
          echo "*     Bitgen Diagnostic Summary                             *";\
191
          echo "=============================================================";\
192 29 wfjm
          xise_msg_filter bgn $*.mfset $*_bgn.log;\
193 17 wfjm
          echo "=============================================================";\
194
          fi
195 2 wfjm
#
196 12 wfjm
# Create svf from bitstream
197 2 wfjm
#   input:   %.bit
198 12 wfjm
#   output:  %.svf
199 2 wfjm
#
200 12 wfjm
%.svf: %.bit
201 22 wfjm
        xtwi config_wrapper --board=${ISE_BOARD} --path=${ISE_PATH} bit2svf $*.bit
202 2 wfjm
 
203
#
204 12 wfjm
# Configure FPGA with impact
205
#   input:   %.bit
206
#   output:  .PHONY
207
#
208
%.iconfig: %.bit
209 22 wfjm
        xtwi config_wrapper --board=${ISE_BOARD} --path=${ISE_PATH} iconfig $*.bit
210 12 wfjm
 
211
#
212
# Configure FPGA with jtag
213
#   input:   %.svf
214
#   output:  .PHONY
215
#
216 17 wfjm
ifneq "$(origin FX2_FILE)" "undefined"
217
FX2LOAD_OPT = --file=${FX2_FILE}
218
endif
219
#
220 12 wfjm
%.jconfig: %.svf
221 17 wfjm
        fx2load_wrapper --board=${ISE_BOARD} ${FX2LOAD_OPT}
222 22 wfjm
        xtwi config_wrapper --board=${ISE_BOARD} --path=${ISE_PATH} jconfig $*.svf
223 12 wfjm
 
224
#
225
# Print log file summary
226
#   input:   %_*.log (not depended)
227
#   output:  .PHONY
228
%.mfsum: %.mfset
229
        @ echo "=== XST summary ============================================="
230 29 wfjm
        @ if [ -r $*_xst.log ]; then xise_msg_filter xst $*.mfset $*_xst.log; fi
231 12 wfjm
        @ echo "=== Translate summary ======================================="
232 29 wfjm
        @ if [ -r $*_tra.log ]; then xise_msg_filter tra $*.mfset $*_tra.log; fi
233 12 wfjm
        @ echo "=== MAP summary ============================================="
234 29 wfjm
        @ if [ -r $*_map.log ]; then xise_msg_filter map $*.mfset $*_map.log; fi
235 12 wfjm
        @ echo "=== PAR summary ============================================="
236 29 wfjm
        @ if [ -r $*_par.log ]; then xise_msg_filter par $*.mfset $*_par.log; fi
237 12 wfjm
        @ echo "=== Bitgen summary =========================================="
238 29 wfjm
        @ if [ -r $*_bgn.log ]; then xise_msg_filter bgn $*.mfset $*_bgn.log; fi
239 12 wfjm
 
240
#
241
#
242
#
243 2 wfjm
# Post-XST simulation model (netgen -sim; UNISIM based)
244
#   input:   %.ngc
245
#   output:  %_ssim.vhd
246
#            %_ngn_ssim.log  netgen log file    (renamed %.nlf)
247
#
248
%_ssim.vhd: %.ngc
249
        if [ ! -d ./ise ]; then mkdir ./ise; fi
250
        if [ -r $*.ngc ]; then cp -p $*.ngc ./ise; fi
251 22 wfjm
        (cd ise; xtwi netgen -sim  -intstyle xflow -ofmt vhdl -w $*.ngc)
252 2 wfjm
        (cd ./ise; chmod -x *.* )
253
        if [ -r ./ise/$*.vhd ]; then cp -p ./ise/$*.vhd ./$*_ssim.vhd; fi
254
        if [ -r ./ise/$*.nlf ]; then cp -p ./ise/$*.nlf ./$*_ngn_ssim.log; fi
255
        if [ -r $*_ssim.vhd ]; then xst_count_bels -xsts $*_ssim.vhd; fi
256
#
257
# Post-XST simulation model (netgen -sim; SIMPRIM based)
258
#   input:   %.ngc
259
#   output:  %_fsim.vhd
260
#            %_ngn_fsim.log  netgen log file    (renamed %.nlf)
261
#
262
%_fsim.vhd: %.ngc
263
        if [ ! -d ./ise ]; then mkdir ./ise; fi
264
        if [ -r $*.ngc ]; then cp -p $*.ngc ./ise; fi
265 22 wfjm
        (cd ise; xtwi ngdbuild -p ${ISE_PATH} -nt timestamp -intstyle xflow \
266 2 wfjm
        $*.ngc $*.ngd)
267
        (cd ise; netgen -sim -intstyle xflow -ofmt vhdl -w $*.ngd)
268
        (cd ./ise; chmod -x *.* )
269
        if [ -r ./ise/$*.vhd ]; then cp -p ./ise/$*.vhd ./$*_fsim.vhd; fi
270
        if [ -r ./ise/$*.nlf ]; then cp -p ./ise/$*.nlf ./$*_ngn_fsim.log; fi
271
#
272
# Post-par timing simulation model (netgen -sim)
273 17 wfjm
#   input:   %.ncd
274
#            %.tsim_xon_dat     xon disable descriptor file (optional)
275 2 wfjm
#   output:  %_tsim.vhd
276 17 wfjm
#            %_ngn_tsim.log     netgen log file    (renamed time_sim.nlf)
277
#            %_tsim.sdf         delay annotation
278
#            %_tsim.sdf_ghdl    delay annotation with ghdl patches
279 2 wfjm
#
280
#!! use netgen directly because xflow 8.1 goes mad when -tsim used a 2nd time
281
#!! see blog_xilinx_webpack.txt 2007-06-10
282
#
283
%_tsim.vhd %_tsim.sdf: %.ncd
284
        if [ ! -d ./ise ]; then mkdir ./ise; fi
285
        if [ -r $*.ncd ]; then cp -p $*.ncd ./ise; fi
286
        if [ -r $*.pcf ]; then cp -p $*.pcf ./ise; fi
287 22 wfjm
        (cd ise; xtwi netgen -ofmt vhdl -sim -w -intstyle xflow -pcf \
288 2 wfjm
        $*.pcf $*.ncd $*_tsim.vhd )
289
        (cd ./ise; chmod -x *.* )
290
        if [ -r ./ise/$*_tsim.vhd ]; then cp -p ./ise/$*_tsim.vhd .; fi
291
        if [ -r ./ise/$*_tsim.sdf ]; then cp -p ./ise/$*_tsim.sdf .; fi
292
        if [ -r ./ise/$*_tsim.nlf ]; then cp -p ./ise/$*_tsim.nlf ./$*_ngn_tsim.log; fi
293
        if [ -r $*_tsim.vhd -a -r $*.tsim_xon_dat ]; then xilinx_tsim_xon $*; fi
294 17 wfjm
        if [ -r $*_tsim.sdf ]; then xilinx_ghdl_sdf_filter $*_tsim.sdf > $*_tsim.sdf_ghdl ; fi
295 2 wfjm
#
296
# generate dep_xst files from vbom
297
#
298
%.dep_xst: %.vbom
299
        vbomconv --dep_xst $< > $@
300
#
301
# generate cpp'ed ucf files from ucf_cpp
302
#
303
%.ucf : %.ucf_cpp
304 30 wfjm
        cpp -I${RETROBASE}/rtl $*.ucf_cpp $*.ucf
305 2 wfjm
#
306
# generate nested dependency rules for cpp'ed ucf files from ucf_cpp
307
#
308
%.dep_ucf_cpp : %.ucf_cpp
309 30 wfjm
        cpp -I${RETROBASE}/rtl -MM $*.ucf_cpp |\
310 2 wfjm
            sed 's/\.o:/\.ucf:/' > $*.dep_ucf_cpp
311
#
312 29 wfjm
# Cleanup
313 19 wfjm
#
314 29 wfjm
include $(RETROBASE)/rtl/make_ise/dontincdep.mk
315
#
316 12 wfjm
.PHONY : ise_clean ise_tmp_clean
317 2 wfjm
#
318
ise_clean: ise_tmp_clean
319 18 wfjm
        rm -f *.ngc
320
        rm -f *.ncd
321
        rm -f *.pcf
322
        rm -f *.bit
323
        rm -f *.msk
324
        rm -f *.svf
325
        rm -f *_[sft]sim.vhd
326
        rm -f *_tsim.sdf
327
        rm -f *_tsim.sdf_ghdl
328
        rm -f *_xst.log
329
        rm -f *_tra.log
330
        rm -f *_map.log
331
        rm -f *_par.log
332
        rm -f *_pad.log
333
        rm -f *_twr.log
334 22 wfjm
        rm -f *_tsi.log
335 18 wfjm
        rm -f *_bgn.log
336
        rm -f *_ngn_[sft]sim.log
337
        rm -f *_svn.log
338
        rm -f *_sum.log
339 2 wfjm
#
340
ise_tmp_clean:
341
        rm -rf ./ise
342
#

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.