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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [fpga/] [bin/] [Makefile] - Blame information for rev 78

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

Line No. Rev Author Line
1 2 csantifort
# ----------------------------------------------------------------
2
#                                                               //
3
#   FPGA synthesis Makefile                                     //
4
#                                                               //
5
#   This file is part of the Amber project                      //
6
#   http://www.opencores.org/project,amber                      //
7
#                                                               //
8
#   Description                                                 //
9
#   Runs a full FPGA synthesis of the Amber system.             //
10
#                                                               //
11
#   Author(s):                                                  //
12
#       - Conor Santifort, csantifort.amber@gmail.com           //
13
#                                                               //
14
#/ ///////////////////////////////////////////////////////////////
15
#                                                               //
16
#  Copyright (C) 2010 Authors and OPENCORES.ORG                 //
17
#                                                               //
18
#  This source file may be used and distributed without         //
19
#  restriction provided that this copyright statement is not    //
20
#  removed from the file and that any derivative work contains  //
21
#  the original copyright notice and the associated disclaimer. //
22
#                                                               //
23
#  This source file is free software; you can redistribute it   //
24
#  and/or modify it under the terms of the GNU Lesser General   //
25
#  Public License as published by the Free Software Foundation; //
26
#  either version 2.1 of the License, or (at your option) any   //
27
#  later version.                                               //
28
#                                                               //
29
#  This source is distributed in the hope that it will be       //
30
#  useful, but WITHOUT ANY WARRANTY; without even the implied   //
31
#  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
32
#  PURPOSE.  See the GNU Lesser General Public License for more //
33
#  details.                                                     //
34
#                                                               //
35
#  You should have received a copy of the GNU Lesser General    //
36
#  Public License along with this source; if not, download it   //
37
#  from http://www.opencores.org/lgpl.shtml                     //
38
#                                                               //
39
# ----------------------------------------------------------------
40
 
41 78 csantifort
# ----------------------------------------------------
42 2 csantifort
# Environment Configuration
43 78 csantifort
# ----------------------------------------------------
44 2 csantifort
 
45
# Directories
46
BIN_FOLDER              = ../bin
47
LOG_FOLDER              = ../logs
48
BITFILE_FOLDER          = ../bitfiles
49 61 csantifort
BOOT_LOADER_ETHMAC      = 1
50 2 csantifort
 
51
# Can supply different work directories
52
# for multiple runs in parallel
53
ifdef WORK
54
    WORK_FOLDER             = ../$(WORK)
55
else
56
    WORK_FOLDER             = ../work0
57
endif
58
 
59 61 csantifort
ifdef BOOT_LOADER_ETHMAC
60
        BOOT_LOADER_DIR         = ../../../sw/boot-loader-ethmac
61
        BOOT_LOADER_DEF         = BOOT_LOADER_ETHMAC
62
else
63 75 csantifort
        BOOT_LOADER_DIR         = ../../../sw/boot-loader-serial
64 78 csantifort
        BOOT_LOADER_DEF         =
65 61 csantifort
endif
66 2 csantifort
 
67 64 csantifort
VERILOG_INCLUDE_PATH    = ../../vlog/lib ../../vlog/tb $(BOOT_LOADER_DIR)
68 61 csantifort
 
69 2 csantifort
# Name of top level verilog file (must be the same as its module name)
70
RTL_TOP         = system
71
 
72
 
73
 
74 78 csantifort
# ----------------------------------------------------
75 2 csantifort
# Build Configuration
76 78 csantifort
# ----------------------------------------------------
77 2 csantifort
 
78
# AMBER_CLK_DIVIDER
79
# Sets the system clock frequency
80
# For Spartan-6 divide 800MHz by this number to get the frequency
81
#   e.g. AMBER_CLK_DIVIDER=24
82
#   800 MHz / 24 = 33.33 MHz
83 43 csantifort
# For Virtex-6 divide 1200MHz by this number to get the frequency
84 2 csantifort
 
85 15 csantifort
# Select either the A23 or A25 core
86
ifdef A25
87
    AMBER_CORE = AMBER_A25_CORE
88
else
89 78 csantifort
    AMBER_CORE = AMBER_A23_CORE
90 15 csantifort
endif
91
 
92
 
93 2 csantifort
 
94 63 csantifort
# The spartan6 device used on SP605 Development board
95
XILINX_FPGA     = xc6slx45tfgg484-3
96 78 csantifort
XST_DEFINES     = XILINX_FPGA XILINX_SPARTAN6_FPGA $(AMBER_CORE) AMBER_CLK_DIVIDER=21 $(BOOT_LOADER_DEF)
97 63 csantifort
# Xilinx placement and timing constraints
98
XST_CONST_FILE  = xs6_constraints.ucf
99
# List of verilog source files for Xilinx Spartan-6 device
100
XST_PROJ_FILE   = xs6_source_files.prj
101 2 csantifort
 
102 63 csantifort
 
103
 
104 78 csantifort
# ----------------------------------------------------
105
# Focus on speed or area
106
# ----------------------------------------------------
107 2 csantifort
#OPT = area
108
OPT = speed
109
 
110
 
111 78 csantifort
# ----------------------------------------------------
112 2 csantifort
# Xilinx XST Compile Options
113
# ----------------------------------------------------
114
 
115
XST_OPTIONS   =  -vlgincdir {$(VERILOG_INCLUDE_PATH)}  \
116
                 -ifmt mixed                           \
117
                 -ofmt NGC                             \
118
                 -p $(XILINX_FPGA)                     \
119
                 -opt_mode $(OPT)                      \
120
                 -opt_level 2                          \
121
                 -power NO                             \
122
                 -iuc NO                               \
123
                 -keep_hierarchy NO                    \
124
                 -rtlview Yes                          \
125
                 -glob_opt AllClockNets                \
126
                 -read_cores YES                       \
127
                 -write_timing_constraints NO          \
128
                 -cross_clock_analysis NO              \
129
                 -hierarchy_separator /                \
130
                 -bus_delimiter \<\>                   \
131
                 -case maintain                        \
132
                 -slice_utilization_ratio 100          \
133
                 -bram_utilization_ratio 100           \
134
                 -dsp_utilization_ratio 100            \
135
                 -fsm_extract YES                      \
136
                 -fsm_encoding Auto                    \
137
                 -safe_implementation No               \
138
                 -fsm_style lut                        \
139
                 -ram_extract Yes                      \
140
                 -ram_style Auto                       \
141
                 -rom_extract Yes                      \
142
                 -shreg_extract YES                    \
143
                 -rom_style Auto                       \
144
                 -auto_bram_packing NO                 \
145
                 -resource_sharing YES                 \
146
                 -async_to_sync NO                     \
147
                 -max_fanout 10000                     \
148
                 -bufg 32                              \
149
                 -register_duplication YES             \
150
                 -register_balancing No                \
151
                 -optimize_primitives NO               \
152
                 -use_clock_enable Auto                \
153
                 -use_sync_set Auto                    \
154
                 -use_sync_reset Auto                  \
155
                 -iob auto                             \
156
                 -equivalent_register_removal YES      \
157
                 -slice_utilization_ratio_maxmargin 5
158
 
159
# ----------------------------------------------------
160
 
161
RUN_ID      = $(shell cat $(WORK_FOLDER)/run_id.txt)
162
MAP_SEED    = $(shell $(BIN_FOLDER)/increment_seed.sh $(WORK_FOLDER)/seed.txt)
163
# ----------------------------------------------------
164
 
165
 
166
all : bitgen trce
167
 
168
new : clean all
169
 
170
map : cleanmap all
171
 
172
help :
173
        @echo ""
174
        @echo "Valid targets:"
175
        @echo "              new        Start a new run with a new ID"
176
        @echo "              all        Continue last run from where ever it left off"
177
        @echo "              map        Rerun the map and par with a new seed"
178
        @echo "              clean      Delete all temporary files"
179
        @echo "              bitgen     Create a bitfile. Don't run trce"
180
        @echo "              trce       Running timing analysis. Don't run buitgen"
181
        @echo "              help       Print this message"
182
        @echo ""
183 63 csantifort
        @echo "Optional switches: A25=1 WORK="
184
        @echo "e.g. > make A25=1 WORK=work1 map"
185 2 csantifort
 
186
clean :
187
        rm -Rf   $(WORK_FOLDER)/*
188
 
189
cleanmap :
190
        if [ -f $(WORK_FOLDER)/$(RTL_TOP).map.ncd ]; then rm $(WORK_FOLDER)/$(RTL_TOP).map.ncd; fi
191
 
192
bitgen : $(WORK_FOLDER)/$(RTL_TOP).bit
193
 
194
trce : $(WORK_FOLDER)/$(RTL_TOP).trc.twr
195
 
196
 
197
# ----------------------------------------------------
198
# trce
199
# ----------------------------------------------------
200
# Can be done before or after bitgen
201
$(WORK_FOLDER)/$(RTL_TOP).trc.twr : $(WORK_FOLDER)/$(RTL_TOP).ncd
202
        \
203
        cd $(WORK_FOLDER); \
204 35 csantifort
        trce -v 5 -l 5 -n 5 -xml $(RTL_TOP) $(RTL_TOP).ncd \
205 2 csantifort
          -o $(WORK_FOLDER)/$(RTL_TOP).trc.twr \
206 78 csantifort
          $(RTL_TOP).pcf
207 2 csantifort
        cp $(WORK_FOLDER)/$(RTL_TOP).trc.twr $(LOG_FOLDER)/$(RTL_TOP).trc.$(RUN_ID).twr
208
 
209 78 csantifort
 
210 2 csantifort
# ----------------------------------------------------
211
# bitgen
212
# ----------------------------------------------------
213
$(WORK_FOLDER)/$(RTL_TOP).bit : $(WORK_FOLDER)/$(RTL_TOP).ncd
214
        \
215
        cd $(WORK_FOLDER); \
216
        bitgen -intstyle xflow -f $(BIN_FOLDER)/bitfile_config.ut $(RTL_TOP).ncd
217
        cp $(WORK_FOLDER)/$(RTL_TOP).bit $(BITFILE_FOLDER)/$(RTL_TOP).$(RUN_ID).bit
218
        mv $(WORK_FOLDER)/$(RTL_TOP).bgn $(LOG_FOLDER)/$(RTL_TOP).bit.$(RUN_ID).bgn
219
 
220
 
221
# ----------------------------------------------------
222
# par
223
# ----------------------------------------------------
224
# -xe c  = Extra Effort, continue on Impossible
225
# -p means don't run the placer. We use map as the placer
226
# -k =  Re-entrant route. Keep the current placement. Continue the routing
227
#       using the existing routing as a starting point.
228
$(WORK_FOLDER)/$(RTL_TOP).ncd : $(WORK_FOLDER)/$(RTL_TOP).map.ncd
229
        \
230
        cd $(WORK_FOLDER); \
231
        par  -intstyle xflow -w -k -ol high $(RTL_TOP).map.ncd $(RTL_TOP).ncd $(RTL_TOP).pcf
232
        cp $(WORK_FOLDER)/$(RTL_TOP)_pad.txt $(LOG_FOLDER)/$(RTL_TOP).pad.$(RUN_ID).txt
233
 
234
# ----------------------------------------------------
235
# map
236
# ----------------------------------------------------
237
$(WORK_FOLDER)/$(RTL_TOP).map.ncd : $(WORK_FOLDER)/$(RTL_TOP).ngd
238
        cd $(WORK_FOLDER); \
239 43 csantifort
        map -intstyle xflow        \
240
          -p $(XILINX_FPGA)        \
241
          -ol high                 \
242
          -t $(MAP_SEED)           \
243
          -w                       \
244
          -ignore_keep_hierarchy   \
245 61 csantifort
          -timing                  \
246 43 csantifort
          -detail                  \
247
          -register_duplication on \
248
          -lc auto                 \
249
          -xe c -mt off -ir off    \
250
          -pr off  -power off      \
251
          -o $(RTL_TOP).map.ncd    \
252
          $(RTL_TOP).ngd           \
253 2 csantifort
          $(RTL_TOP).pcf
254
        cp $(WORK_FOLDER)/$(RTL_TOP).map.mrp $(LOG_FOLDER)/$(RTL_TOP).map.$(RUN_ID).mrp
255
 
256 78 csantifort
 
257 2 csantifort
# ----------------------------------------------------
258
# ngdbuild
259
# ----------------------------------------------------
260
$(WORK_FOLDER)/$(RTL_TOP).ngd : $(WORK_FOLDER)/$(RTL_TOP).ngc $(BIN_FOLDER)/$(XST_CONST_FILE)
261
        cd $(WORK_FOLDER); \
262
        ngdbuild -intstyle xflow -verbose -p $(XILINX_FPGA) \
263
          -dd _ngo  -nt on \
264 78 csantifort
          -uc $(BIN_FOLDER)/$(XST_CONST_FILE) $(RTL_TOP).ngc $(RTL_TOP).ngd
265 2 csantifort
 
266
 
267
# ----------------------------------------------------
268
# xst
269
# ----------------------------------------------------
270
 
271
# Note -iobuf YES is needed for the top-level verilog
272
# module synthesis
273
 
274 21 csantifort
$(WORK_FOLDER)/$(RTL_TOP).ngc : $(WORK_FOLDER)/run_id.txt $(XST_PROJ_FILE)
275
        @echo "work: $(WORK_FOLDER)" > $(LOG_FOLDER)/$(RTL_TOP).cfg.$(RUN_ID).txt
276
        @echo "$(XST_DEFINES)" >> $(LOG_FOLDER)/$(RTL_TOP).cfg.$(RUN_ID).txt
277 2 csantifort
        export XST_DESIGN=$(RTL_TOP)
278
        export XST_OFN=$(RTL_TOP)
279
        rm -Rf $(WORK_FOLDER)/$(RTL_TOP)xst $(WORK_FOLDER)/_ngo
280
        mkdir -p $(WORK_FOLDER)/$(RTL_TOP)xst/tmp $(WORK_FOLDER)/_ngo
281
        echo "work"                                         > $(WORK_FOLDER)/$(RTL_TOP).lso
282
        echo "set -tmpdir     ./$(RTL_TOP)xst/tmp"          > $(WORK_FOLDER)/$(RTL_TOP).xst
283
        echo "set -xsthdpdir  ./$(RTL_TOP)xst"             >> $(WORK_FOLDER)/$(RTL_TOP).xst
284
        echo "run -ifn $(BIN_FOLDER)/$(XST_PROJ_FILE)"     >> $(WORK_FOLDER)/$(RTL_TOP).xst
285
        echo "-ofn $(RTL_TOP) -top $(RTL_TOP)"             >> $(WORK_FOLDER)/$(RTL_TOP).xst
286
        echo "-lso ./$(RTL_TOP).lso"                       >> $(WORK_FOLDER)/$(RTL_TOP).xst
287
        echo $(XST_OPTIONS)                                >> $(WORK_FOLDER)/$(RTL_TOP).xst
288
        echo "-iobuf YES"                                  >> $(WORK_FOLDER)/$(RTL_TOP).xst
289 61 csantifort
        echo "-define { $(XST_DEFINES) }"                  >> $(WORK_FOLDER)/$(RTL_TOP).xst
290 2 csantifort
        cd $(WORK_FOLDER); \
291
        xst -intstyle xflow -ifn ./$(RTL_TOP).xst -ofn $(LOG_FOLDER)/$(RTL_TOP).xst.$(RUN_ID).srp
292
 
293
 
294
# ----------------------------------------------------
295
# Generate the Run ID, initial Map seed
296
# Recompile the boot-loader program - it gets build
297
# into the FPGA's RamBlocks and uses the run_id as
298
# the version number
299
# ----------------------------------------------------
300
$(WORK_FOLDER)/run_id.txt :
301
        test -e $(WORK_FOLDER) || mkdir $(WORK_FOLDER)
302
        test -e $(LOG_FOLDER) || mkdir $(LOG_FOLDER)
303
        test -e $(BITFILE_FOLDER) || mkdir $(BITFILE_FOLDER)
304
        echo 0 > $(WORK_FOLDER)/seed.txt
305
        date +%Y%m%d%H%M%S > $(WORK_FOLDER)/run_id.txt
306
        $(BIN_FOLDER)/set_fpga_version.sh $(WORK_FOLDER)/run_id.txt
307 61 csantifort
        $(MAKE) -C $(BOOT_LOADER_DIR) clean
308
        $(MAKE) -C $(BOOT_LOADER_DIR)
309 19 csantifort
 

powered by: WebSVN 2.1.0

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