1 |
5 |
wfjm |
# $Id: Makefile.xflow 317 2010-07-22 19:36:56Z mueller $
|
2 |
2 |
wfjm |
#
|
3 |
|
|
# Revision History:
|
4 |
|
|
# Date Rev Version Comment
|
5 |
|
|
# 2010-05-06 289 1.5.7 add xilinx_tsim_xon support
|
6 |
|
|
# 2010-04-24 282 1.5.6 add %.impact rule to run impact_wrapper
|
7 |
|
|
# 2010-04-17 278 1.4.5 add '|| true' after grep in diag summary to prevent
|
8 |
|
|
# a make abort in case no diags are seen
|
9 |
|
|
# 2010-04-02 273 1.4.4 add -I{RETROBASE} to ucf_cpp processing rules
|
10 |
|
|
# 2010-03-14 268 1.4.3 add XFLOWOPT_SYN and XFLOWOPT_IMP
|
11 |
|
|
# 2009-11-21 252 1.4.2 use bitgen directly, use ISE_USERID
|
12 |
|
|
# 2007-12-17 102 1.4.1 fix %.dep_ucf_cpp : %.ucf_cpp rule
|
13 |
|
|
# 2007-12-16 101 1.4 add ucf_cpp rules
|
14 |
|
|
# 2007-12-09 100 1.3.7 ifndef define ISE_PATH to xc3s1000-ft256-4
|
15 |
|
|
# 2007-11-02 94 1.3.6 use .SECONDARY to keep intermediate files
|
16 |
|
|
# 2007-10-28 93 1.3.5 call xst_count_bels -xsts when _ssim is generated
|
17 |
|
|
# 2007-10-12 88 1.3.4 support .xcf files, if provided
|
18 |
|
|
# 2007-10-06 87 1.3.3 remove *_twr.log in clean
|
19 |
|
|
# 2007-07-20 67 1.3.2 handle local/global xst_vhdl.opt
|
20 |
|
|
# 2007-07-15 66 1.3.1 add rule "%.ngc: ../%.vbom" to support _*sim in ./tb
|
21 |
|
|
# add XST diagnostics summary at end of listing
|
22 |
|
|
# 2007-07-06 64 1.3 all vbom based now
|
23 |
|
|
# 2007-06-16 57 1.2.1 cleanup ghdl_clean handling (rm _[sft]sim)
|
24 |
|
|
# 2007-06-10 52 1.2 reorganized svn directory structure
|
25 |
|
|
# 2007-06-10 51 1.1 consolidate test bench generation
|
26 |
|
|
# 2007-06-03 45 1.0 Initial version
|
27 |
|
|
#---
|
28 |
|
|
#
|
29 |
|
|
# setup default board (for impact), device and userid (for bitgen)
|
30 |
|
|
#
|
31 |
|
|
ifndef ISE_BOARD
|
32 |
|
|
ISE_BOARD = s3board
|
33 |
|
|
endif
|
34 |
|
|
#
|
35 |
|
|
ifndef ISE_PATH
|
36 |
|
|
ISE_PATH = xc3s1000-ft256-4
|
37 |
|
|
endif
|
38 |
|
|
#
|
39 |
|
|
ifndef ISE_USERID
|
40 |
|
|
ISE_USERID = 0xffffffff
|
41 |
|
|
endif
|
42 |
|
|
#
|
43 |
|
|
# setup defaults for xflow option files for synthesis and implementation
|
44 |
|
|
#
|
45 |
|
|
ifndef XFLOWOPT_SYN
|
46 |
|
|
XFLOWOPT_SYN = xst_vhdl.opt
|
47 |
|
|
endif
|
48 |
|
|
#
|
49 |
|
|
ifndef XFLOWOPT_IMP
|
50 |
|
|
XFLOWOPT_IMP = balanced.opt
|
51 |
|
|
endif
|
52 |
|
|
#
|
53 |
|
|
XFLOW = xflow -p ${ISE_PATH}
|
54 |
|
|
#
|
55 |
|
|
# $@ first target
|
56 |
|
|
# $< first dependency
|
57 |
|
|
# $* stem in rule match
|
58 |
|
|
#
|
59 |
|
|
# when chaining, don't delete 'expensive' intermediate files:
|
60 |
|
|
.SECONDARY :
|
61 |
|
|
#
|
62 |
|
|
# Synthesize (xst)
|
63 |
|
|
# input: %.vbom vbom project description
|
64 |
|
|
# output: %.ngc
|
65 |
|
|
# %_xst.log xst log file
|
66 |
|
|
#
|
67 |
|
|
%.ngc: %.vbom
|
68 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
69 |
|
|
(cd ./ise; vbomconv --xst_prj ../$< > $*.prj)
|
70 |
|
|
(cd ./ise; touch $*.xcf)
|
71 |
|
|
if [ -r $*.xcf ]; then cp $*.xcf ./ise; fi
|
72 |
|
|
if [ -r ${RETROBASE}/vlib/${XFLOWOPT_SYN} ]; then \
|
73 |
|
|
cp ${RETROBASE}/vlib/${XFLOWOPT_SYN} ./ise; fi
|
74 |
|
|
if [ -r ${XFLOWOPT_SYN} ]; then cp ${XFLOWOPT_SYN} ./ise; fi
|
75 |
|
|
${XFLOW} -wd ise -synth ${XFLOWOPT_SYN} $*.prj
|
76 |
|
|
(cd ./ise; chmod -x *.* )
|
77 |
|
|
if [ -r ./ise/$*.ngc ]; then cp -p ./ise/$*.ngc .; fi
|
78 |
|
|
if [ -r ./ise/$*_xst.log ]; then cp -p ./ise/$*_xst.log .; fi
|
79 |
|
|
@ echo "==============================================================="
|
80 |
|
|
@ echo "* Makefile.xflow: XST Diagnostic Summary *"
|
81 |
|
|
@ echo "==============================================================="
|
82 |
|
|
@ grep -i -A 1 ":.*:" $*_xst.log || true
|
83 |
|
|
@ echo "==============================================================="
|
84 |
|
|
#
|
85 |
|
|
# the following rule needed to generate an %_*sim.vhd in a ./tb sub-directory
|
86 |
|
|
# it will look for a matching vbom in the parent directory
|
87 |
|
|
%.ngc: ../%.vbom
|
88 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
89 |
|
|
(cd ./ise; vbomconv --xst_prj ../$< > $*.prj)
|
90 |
|
|
(cd ./ise; touch $*.xcf)
|
91 |
|
|
if [ -r $*.xcf ]; then cp $*.xcf ./ise; fi
|
92 |
|
|
if [ -r ${RETROBASE}/vlib/${XFLOWOPT_SYN} ]; then \
|
93 |
|
|
cp ${RETROBASE}/vlib/${XFLOWOPT_SYN} ./ise; fi
|
94 |
|
|
if [ -r ${XFLOWOPT_SYN} ]; then cp ${XFLOWOPT_SYN} ./ise; fi
|
95 |
|
|
${XFLOW} -wd ise -synth ${XFLOWOPT_SYN} $*.prj
|
96 |
|
|
(cd ./ise; chmod -x *.* )
|
97 |
|
|
if [ -r ./ise/$*.ngc ]; then cp -p ./ise/$*.ngc .; fi
|
98 |
|
|
if [ -r ./ise/$*_xst.log ]; then cp -p ./ise/$*_xst.log .; fi
|
99 |
|
|
@ echo "==============================================================="
|
100 |
|
|
@ echo "* Makefile.xflow: XST Diagnostic Summary *"
|
101 |
|
|
@ echo "==============================================================="
|
102 |
|
|
@ grep -i -A 1 ":.*:" $*_xst.log || true
|
103 |
|
|
@ echo "==============================================================="
|
104 |
|
|
#
|
105 |
|
|
# Implement (map+par)
|
106 |
|
|
# input: %.ngc
|
107 |
|
|
# %.ucf constraint file (if available)
|
108 |
|
|
# output: %.ncd
|
109 |
|
|
# %.pcf
|
110 |
|
|
# %_tra.log translate (ngdbuild) log file (renamed %.bld)
|
111 |
|
|
# %_map.log map log file (renamed %_map.mrp)
|
112 |
|
|
# %_par.log par log file (renamed %.par)
|
113 |
|
|
# %_pad.log pad file (renamed %_pad.txt)
|
114 |
5 |
wfjm |
# %_twr.log trce log file (renamed %.twr)
|
115 |
2 |
wfjm |
#
|
116 |
|
|
%.ncd %.pcf: %.ngc
|
117 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
118 |
|
|
if [ -r $*.ngc ]; then cp -p $*.ngc ./ise; fi
|
119 |
|
|
if [ -r $*.ucf ]; then cp -p $*.ucf ./ise; fi
|
120 |
|
|
if [ -r ${RETROBASE}/vlib/${XFLOWOPT_IMP} ]; then \
|
121 |
|
|
cp ${RETROBASE}/vlib/${XFLOWOPT_IMP} ./ise; fi
|
122 |
|
|
if [ -r ${XFLOWOPT_IMP} ]; then cp -p ${XFLOWOPT_IMP} ./ise; fi
|
123 |
|
|
${XFLOW} -wd ise -implement ${XFLOWOPT_IMP} $<
|
124 |
|
|
(cd ./ise; chmod -x *.* )
|
125 |
|
|
if [ -r ./ise/$*.ncd ]; then cp -p ./ise/$*.ncd .; fi
|
126 |
|
|
if [ -r ./ise/$*.pcf ]; then cp -p ./ise/$*.pcf .; fi
|
127 |
|
|
if [ -r ./ise/$*.bld ]; then cp -p ./ise/$*.bld ./$*_tra.log; fi
|
128 |
|
|
if [ -r ./ise/$*_map.mrp ]; then cp -p ./ise/$*_map.mrp ./$*_map.log; fi
|
129 |
|
|
if [ -r ./ise/$*.par ]; then cp -p ./ise/$*.par ./$*_par.log; fi
|
130 |
|
|
if [ -r ./ise/$*_pad.txt ]; then cp -p ./ise/$*_pad.txt ./$*_pad.log; fi
|
131 |
|
|
if [ -r ./ise/$*.twr ]; then cp -p ./ise/$*.twr ./$*_twr.log; fi
|
132 |
|
|
#
|
133 |
|
|
# Configure (bitgen)
|
134 |
|
|
# input: %.ncd
|
135 |
|
|
# output: %.bit
|
136 |
|
|
# %.msk
|
137 |
|
|
# %_bgn.log bitgen log file (renamed %.bgn)
|
138 |
|
|
#
|
139 |
|
|
%.bit: %.ncd
|
140 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
141 |
|
|
if [ -r $*.ncd ]; then cp -p $*.ncd ./ise; fi
|
142 |
|
|
(cd ./ise; bitgen -l -w -m -g ReadBack -g UserId:${ISE_USERID} -intstyle xflow $*.ncd)
|
143 |
|
|
(cd ./ise; chmod -x *.* )
|
144 |
|
|
if [ -r ./ise/$*.bit ]; then cp -p ./ise/$*.bit .; fi
|
145 |
|
|
if [ -r ./ise/$*.msk ]; then cp -p ./ise/$*.msk .; fi
|
146 |
|
|
if [ -r ./ise/$*.bgn ]; then cp -p ./ise/$*.bgn ./$*_bgn.log; fi
|
147 |
|
|
#
|
148 |
|
|
# Program FPGA with impact
|
149 |
|
|
# input: %.bit
|
150 |
|
|
# output: .phony
|
151 |
|
|
#
|
152 |
|
|
%.impact: %.bit
|
153 |
|
|
impact_wrapper --board=${ISE_BOARD} --path=${ISE_PATH} $*.bit
|
154 |
|
|
|
155 |
|
|
#
|
156 |
|
|
# Post-XST simulation model (netgen -sim; UNISIM based)
|
157 |
|
|
# input: %.ngc
|
158 |
|
|
# output: %_ssim.vhd
|
159 |
|
|
# %_ngn_ssim.log netgen log file (renamed %.nlf)
|
160 |
|
|
#
|
161 |
|
|
%_ssim.vhd: %.ngc
|
162 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
163 |
|
|
if [ -r $*.ngc ]; then cp -p $*.ngc ./ise; fi
|
164 |
|
|
(cd ise; netgen -sim -intstyle xflow -ofmt vhdl -w $*.ngc)
|
165 |
|
|
(cd ./ise; chmod -x *.* )
|
166 |
|
|
if [ -r ./ise/$*.vhd ]; then cp -p ./ise/$*.vhd ./$*_ssim.vhd; fi
|
167 |
|
|
if [ -r ./ise/$*.nlf ]; then cp -p ./ise/$*.nlf ./$*_ngn_ssim.log; fi
|
168 |
|
|
if [ -r $*_ssim.vhd ]; then xst_count_bels -xsts $*_ssim.vhd; fi
|
169 |
|
|
#
|
170 |
|
|
# Post-XST simulation model (netgen -sim; SIMPRIM based)
|
171 |
|
|
# input: %.ngc
|
172 |
|
|
# output: %_fsim.vhd
|
173 |
|
|
# %_ngn_fsim.log netgen log file (renamed %.nlf)
|
174 |
|
|
#
|
175 |
|
|
%_fsim.vhd: %.ngc
|
176 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
177 |
|
|
if [ -r $*.ngc ]; then cp -p $*.ngc ./ise; fi
|
178 |
|
|
(cd ise; ngdbuild -p ${ISE_PATH} -nt timestamp -intstyle xflow \
|
179 |
|
|
$*.ngc $*.ngd)
|
180 |
|
|
(cd ise; netgen -sim -intstyle xflow -ofmt vhdl -w $*.ngd)
|
181 |
|
|
(cd ./ise; chmod -x *.* )
|
182 |
|
|
if [ -r ./ise/$*.vhd ]; then cp -p ./ise/$*.vhd ./$*_fsim.vhd; fi
|
183 |
|
|
if [ -r ./ise/$*.nlf ]; then cp -p ./ise/$*.nlf ./$*_ngn_fsim.log; fi
|
184 |
|
|
#
|
185 |
|
|
# Post-par timing simulation model (netgen -sim)
|
186 |
|
|
# input: %.ncd
|
187 |
|
|
# output: %_tsim.vhd
|
188 |
|
|
# %_ngn_tsim.log netgen log file (renamed time_sim.nlf)
|
189 |
|
|
#
|
190 |
|
|
#!! use netgen directly because xflow 8.1 goes mad when -tsim used a 2nd time
|
191 |
|
|
#!! see blog_xilinx_webpack.txt 2007-06-10
|
192 |
|
|
#
|
193 |
|
|
%_tsim.vhd %_tsim.sdf: %.ncd
|
194 |
|
|
if [ ! -d ./ise ]; then mkdir ./ise; fi
|
195 |
|
|
if [ -r $*.ncd ]; then cp -p $*.ncd ./ise; fi
|
196 |
|
|
if [ -r $*.pcf ]; then cp -p $*.pcf ./ise; fi
|
197 |
|
|
(cd ise; netgen -ofmt vhdl -sim -w -intstyle xflow -pcf \
|
198 |
|
|
$*.pcf $*.ncd $*_tsim.vhd )
|
199 |
|
|
(cd ./ise; chmod -x *.* )
|
200 |
|
|
if [ -r ./ise/$*_tsim.vhd ]; then cp -p ./ise/$*_tsim.vhd .; fi
|
201 |
|
|
if [ -r ./ise/$*_tsim.sdf ]; then cp -p ./ise/$*_tsim.sdf .; fi
|
202 |
|
|
if [ -r ./ise/$*_tsim.nlf ]; then cp -p ./ise/$*_tsim.nlf ./$*_ngn_tsim.log; fi
|
203 |
|
|
if [ -r $*_tsim.vhd -a -r $*.tsim_xon_dat ]; then xilinx_tsim_xon $*; fi
|
204 |
|
|
#
|
205 |
|
|
# generate dep_xst files from vbom
|
206 |
|
|
#
|
207 |
|
|
%.dep_xst: %.vbom
|
208 |
|
|
vbomconv --dep_xst $< > $@
|
209 |
|
|
#
|
210 |
|
|
# generate cpp'ed ucf files from ucf_cpp
|
211 |
|
|
#
|
212 |
|
|
%.ucf : %.ucf_cpp
|
213 |
|
|
cpp -I${RETROBASE}/rtl $*.ucf_cpp $*.ucf
|
214 |
|
|
#
|
215 |
|
|
# generate nested dependency rules for cpp'ed ucf files from ucf_cpp
|
216 |
|
|
#
|
217 |
|
|
%.dep_ucf_cpp : %.ucf_cpp
|
218 |
|
|
cpp -I${RETROBASE}/rtl -MM $*.ucf_cpp |\
|
219 |
|
|
sed 's/\.o:/\.ucf:/' > $*.dep_ucf_cpp
|
220 |
|
|
#
|
221 |
|
|
.phony : ise_clean ise_tmp_clean
|
222 |
|
|
#
|
223 |
|
|
ise_clean: ise_tmp_clean
|
224 |
|
|
rm -rf *.ngc
|
225 |
|
|
rm -rf *.ncd
|
226 |
|
|
rm -rf *.pcf
|
227 |
|
|
rm -rf *.bit
|
228 |
|
|
rm -rf *.msk
|
229 |
|
|
rm -rf *_[sft]sim.vhd
|
230 |
|
|
rm -rf *_tsim.sdf
|
231 |
|
|
rm -rf *_xst.log
|
232 |
|
|
rm -rf *_tra.log
|
233 |
|
|
rm -rf *_map.log
|
234 |
|
|
rm -rf *_par.log
|
235 |
|
|
rm -rf *_pad.log
|
236 |
|
|
rm -rf *_twr.log
|
237 |
|
|
rm -rf *_bgn.log
|
238 |
|
|
rm -rf *_ngn_[sft]sim.log
|
239 |
|
|
rm -rf *_svn.log
|
240 |
|
|
rm -rf *_sum.log
|
241 |
|
|
#
|
242 |
|
|
ise_tmp_clean:
|
243 |
|
|
rm -rf ./ise
|
244 |
|
|
#
|