summaryrefslogtreecommitdiffstats
path: root/tool_makefile/Makefile.synthesis.digilent_s3e
blob: ace90abff2fda95d611ff7e3ddcea1568cccf88c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#
# $HeadURL: https://svn.fzd.de/repo/concast/FWF_Projects/FWKE/beam_position_monitor/hardware/board_sp601_amba/synthese/Makefile $
# $Date: 2011-11-18 08:42:44 +0100 (Fr, 18. Nov 2011) $
# $Author: lange $
# $Revision: 1257 $
#

MODULE = top
SPEEDGRADE = 4
DEVICE = xc3s500e-fg320-$(SPEEDGRADE)
UCF_FILE = s3estarter.ucf
CORES = ../cores/
SOFTWARE = ../software
BMM_FILE = zpu_i0_memory.bmm

BUILDDIR = isebuild
DATE = $(shell date +"%Y-%m-%d__%H_%M")
LOGFILE = synthesis_log_$(DATE).txt
export XST_LOGFILE := $(LOGFILE)


all:	
	@echo "check     - look for timing and other synthesis issues"
	@echo "xst       - generate ngc file (netlist, replaces edif and netlist constrains)"
	@echo "translate - generate ngd file (native generic database [reduced to primitives])"
	@echo "map       - generate ncd file (native ciruit description)"
	@echo "par       - place&route ncd file (design implementation)"
	@echo "trace     - generate timing report"
	@echo "bitgen    - generate bit file (ncd -> bit)"
	@echo "update    - update bitstream with elf file"
	@echo "program   - program fpga with bit file"
	@echo "genmcs    - genrate mcs file"
	@echo "progspi   - program spi flash with mcs file"
	@echo "clean"
	@echo "..."
	@echo "testflow  - update bitgen update program check"
	@echo "finalflow - update bitgen update progspi check"

testflow: 
	time $(MAKE) software bitgen update program check     2>&1 | tee $(XST_LOGFILE)

finalflow:
	time $(MAKE) software bitgen update progspi check     2>&1 | tee $(XST_LOGFILE)


check:
	@echo -e "Timing score: "
	@grep --with-filename "Timing Score"                $(BUILDDIR)/*.par
	@echo -e "\nUnwanted Latches (737): "            
	@grep --with-filename "WARNING:Xst:737"             $(BUILDDIR)/*.syr || echo -n
	@echo -e "\nUnassigned signals (653): "          
	@grep --with-filename "WARNING:Xst:653"             $(BUILDDIR)/*.syr || echo -n
	@echo -e "\nCombinatoric loops (2170): "         
	@grep --with-filename "WARNING:Xst:2170"            $(BUILDDIR)/*.syr || echo -n
	@echo -e "\nGated clocks (372): "
	@grep --with-filename "WARNING:PhysDesignRules:372" $(BUILDDIR)/*.bgn || echo -n


software: 
	###
	#############################################################################
	### (re)compile software
	###
	test ! -d $(SOFTWARE) || make all --directory $(SOFTWARE)


update: $(BUILDDIR)/$(MODULE).bit
	###
	#############################################################################
	### update the bitfile
	###
	test ! -d $(SOFTWARE) || data2mem -bm $(BMM_FILE) -bd $(SOFTWARE)/*.elf -bt $(BUILDDIR)/$(MODULE).bit -o b $(MODULE)_update.bit
	test   -d $(SOFTWARE) || cp $(BUILDDIR)/$(MODULE).bit $(MODULE)_update.bit


program:
	###
	#############################################################################
	### configure FPGA
	###
	impact -batch program_fpga.cmd


genmcs: $(MODULE)_update.mcs

$(MODULE)_update.mcs: $(MODULE)_update.bit
	###
	#############################################################################
	### generate flash file
	###
	promgen -spi -p mcs -w -o $(MODULE)_update.mcs -s 8192 -u 0 $(MODULE)_update.bit


progspi: genmcs
	###
	#############################################################################
	### program flash
	###
	impact -batch program_spi.cmd


clean:
	rm -f $(MODULE).prj
	rm -f *.log
	rm -f _impact.cmd
	rm -f *.cfi
	rm -f *.prm
	rm -rf $(BUILDDIR)


dir: $(MODULE).prj	
	###
	#############################################################################
	### generate build directory
	###
	mkdir -p $(BUILDDIR)
	mkdir -p $(BUILDDIR)/projnav.tmp



$(MODULE).prj: ../simulation/vhdl_files.txt
	###
	#############################################################################
	### generate project file
	###
	grep --invert rtl_tb ../simulation/vhdl_files.txt | grep --invert "^$$" | awk '{printf "vhdl %s %s\n",$$1,$$2}' > $(MODULE).prj


xst:    $(MODULE).ngc
translate: $(MODULE).ngd
map:    $(MODULE)_map.ncd
par:    $(MODULE).ncd


hw_timestamp:
	###
	#############################################################################
	#### update hw timestamp
	###
	test ! -f ../rtl/Makefile || make --directory ../rtl

$(MODULE).ngc: dir hw_timestamp
	###
	#############################################################################
	### synthesis
	###
	cd $(BUILDDIR) ; xst -ifn ../$(MODULE).xst -ofn $(MODULE).syr


$(MODULE).ngd: $(MODULE).ngc $(UCF_FILE)
	###
	#############################################################################
	### translate
	###
	cd $(BUILDDIR) ; ngdbuild -dd _ngo -nt timestamp -uc ../$(UCF_FILE) -p $(DEVICE) -sd ../$(CORES) $(MODULE).ngc $(MODULE).ngd

$(MODULE)_map.ncd: $(MODULE).ngd
	###
	#############################################################################
	### map
	###
	@# explanation of map parameters:
	@# -p                    part number
	@# -mt                   multi-threading
	@# -w                    overwrite existing files
	@# -logic_opt            logic optimization
	@# -ol                   overall effor level (std|high)
	@# -t	                placer cost table
	@# -xt                   extra placer cost table
	@# -register_duplication duplicate registers
	@# -global_opt	        Global Optimization (off|speed|area|power)
	@# -ir                   ignore RLOCs
	@# -pr			pack registers in IO (off|i|o|b)
	@# -lc                   lut combining (auto|area|off)
	@# -power		Virtex 6 Power Optimization (on|off|high|xe)
	@# -detail		Generate Detailed MAP Report
	@# -o			Output File Name
	@# -bp                   enables block RAM mapping
	cd $(BUILDDIR) ; export XIL_PAR_DESIGN_CHECK_VERBOSE=1; map -p $(DEVICE) -cm speed -detail -ir off -pr off -c 100 -o $(MODULE)_map.ncd $(MODULE).ngd $(MODULE).pcf


$(MODULE).ncd: $(MODULE)_map.ncd
	###
	#############################################################################
	### place & route
	###
	cd $(BUILDDIR) ; par -w -ol high -t 1 $(MODULE)_map.ncd $(MODULE).ncd $(MODULE).pcf

trace:
	cd $(BUILDDIR) ; trce -e -a -u -s $(SPEEDGRADE) -xml $(MODULE).twx $(MODULE).ncd -o $(MODULE).twr $(MODULE).pcf

tracefast:
	cd $(BUILDDIR) ; trce -v 12 -s $(SPEEDGRADE) -fastpaths -xml $(MODULE).twx -o $(MODULE).twr $(MODULE).ncd $(MODULE).pcf


bitgen: $(MODULE).ncd
	###
	#############################################################################
	### generate bitfile
	###
	cd $(BUILDDIR) ; bitgen -f ../$(MODULE).ut $(MODULE).ncd


OpenPOWER on IntegriCloud