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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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