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

Subversion Repositories amber

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

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
# ----------------------------------------------------
42
# Environment Configuration
43
# ----------------------------------------------------
44
 
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
        BOOT_LOADER_DIR         = ../../../sw/boot-loader
64
        BOOT_LOADER_DEF         =
65
endif
66 2 csantifort
 
67 61 csantifort
VERILOG_INCLUDE_PATH    = ../../vlog/lib $(BOOT_LOADER_DIR)
68
 
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
# ----------------------------------------------------
75
# Build Configuration
76
# ----------------------------------------------------
77
 
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 19 csantifort
    AMBER_CORE = AMBER_A23_CORE
90 15 csantifort
endif
91
 
92
 
93 2 csantifort
## FPGA type
94
ifdef VIRTEX6
95
    # Virtex-6 device
96
    XILINX_FPGA     = xc6vlx75tff784-3
97 61 csantifort
    XST_DEFINES     = XILINX_FPGA XILINX_VIRTEX6_FPGA  $(AMBER_CORE) AMBER_CLK_DIVIDER=15 $(BOOT_LOADER_DEF)
98 2 csantifort
    # Xilinx placement and timing constraints
99
    XST_CONST_FILE  = xv6_constraints.ucf
100 23 csantifort
    # List of verilog source files for Xilinx Virtex-6 device
101
    XST_PROJ_FILE   = xv6_source_files.prj
102 2 csantifort
else
103
    # The spartan6 device used on SP605 Development board
104
    XILINX_FPGA     = xc6slx45tfgg484-3
105 61 csantifort
    XST_DEFINES     = XILINX_FPGA XILINX_SPARTAN6_FPGA $(AMBER_CORE) AMBER_CLK_DIVIDER=20 $(BOOT_LOADER_DEF)
106 2 csantifort
    # Xilinx placement and timing constraints
107
    XST_CONST_FILE  = xs6_constraints.ucf
108 23 csantifort
    # List of verilog source files for Xilinx Spartan-6 device
109
    XST_PROJ_FILE   = xs6_source_files.prj
110 2 csantifort
endif
111
 
112
 
113
# ----------------------------------------------------
114
# Focus on speed or area
115
# ----------------------------------------------------
116
#OPT = area
117
OPT = speed
118
 
119
 
120
# ----------------------------------------------------
121
# Xilinx XST Compile Options
122
# ----------------------------------------------------
123
 
124
XST_OPTIONS   =  -vlgincdir {$(VERILOG_INCLUDE_PATH)}  \
125
                 -ifmt mixed                           \
126
                 -ofmt NGC                             \
127
                 -p $(XILINX_FPGA)                     \
128
                 -opt_mode $(OPT)                      \
129
                 -opt_level 2                          \
130
                 -power NO                             \
131
                 -iuc NO                               \
132
                 -keep_hierarchy NO                    \
133
                 -rtlview Yes                          \
134
                 -glob_opt AllClockNets                \
135
                 -read_cores YES                       \
136
                 -write_timing_constraints NO          \
137
                 -cross_clock_analysis NO              \
138
                 -hierarchy_separator /                \
139
                 -bus_delimiter \<\>                   \
140
                 -case maintain                        \
141
                 -slice_utilization_ratio 100          \
142
                 -bram_utilization_ratio 100           \
143
                 -dsp_utilization_ratio 100            \
144
                 -fsm_extract YES                      \
145
                 -fsm_encoding Auto                    \
146
                 -safe_implementation No               \
147
                 -fsm_style lut                        \
148
                 -ram_extract Yes                      \
149
                 -ram_style Auto                       \
150
                 -rom_extract Yes                      \
151
                 -shreg_extract YES                    \
152
                 -rom_style Auto                       \
153
                 -auto_bram_packing NO                 \
154
                 -resource_sharing YES                 \
155
                 -async_to_sync NO                     \
156
                 -max_fanout 10000                     \
157
                 -bufg 32                              \
158
                 -register_duplication YES             \
159
                 -register_balancing No                \
160
                 -optimize_primitives NO               \
161
                 -use_clock_enable Auto                \
162
                 -use_sync_set Auto                    \
163
                 -use_sync_reset Auto                  \
164
                 -iob auto                             \
165
                 -equivalent_register_removal YES      \
166
                 -slice_utilization_ratio_maxmargin 5
167
 
168
# ----------------------------------------------------
169
 
170
RUN_ID      = $(shell cat $(WORK_FOLDER)/run_id.txt)
171
MAP_SEED    = $(shell $(BIN_FOLDER)/increment_seed.sh $(WORK_FOLDER)/seed.txt)
172
# ----------------------------------------------------
173
 
174
 
175
all : bitgen trce
176
 
177
new : clean all
178
 
179
map : cleanmap all
180
 
181
help :
182
        @echo ""
183
        @echo "Valid targets:"
184
        @echo "              new        Start a new run with a new ID"
185
        @echo "              all        Continue last run from where ever it left off"
186
        @echo "              map        Rerun the map and par with a new seed"
187
        @echo "              clean      Delete all temporary files"
188
        @echo "              bitgen     Create a bitfile. Don't run trce"
189
        @echo "              trce       Running timing analysis. Don't run buitgen"
190
        @echo "              help       Print this message"
191
        @echo ""
192 15 csantifort
        @echo "Optional switches: VIRTEX6=1 A25=1 WORK="
193 2 csantifort
        @echo "e.g. > make VIRTEX6=1 WORK=work1 map"
194
 
195
clean :
196
        rm -Rf   $(WORK_FOLDER)/*
197
 
198
cleanmap :
199
        if [ -f $(WORK_FOLDER)/$(RTL_TOP).map.ncd ]; then rm $(WORK_FOLDER)/$(RTL_TOP).map.ncd; fi
200
 
201
bitgen : $(WORK_FOLDER)/$(RTL_TOP).bit
202
 
203
trce : $(WORK_FOLDER)/$(RTL_TOP).trc.twr
204
 
205
 
206
# ----------------------------------------------------
207
# trce
208
# ----------------------------------------------------
209
# Can be done before or after bitgen
210
$(WORK_FOLDER)/$(RTL_TOP).trc.twr : $(WORK_FOLDER)/$(RTL_TOP).ncd
211
        \
212
        cd $(WORK_FOLDER); \
213 35 csantifort
        trce -v 5 -l 5 -n 5 -xml $(RTL_TOP) $(RTL_TOP).ncd \
214 2 csantifort
          -o $(WORK_FOLDER)/$(RTL_TOP).trc.twr \
215
          $(RTL_TOP).pcf
216
        cp $(WORK_FOLDER)/$(RTL_TOP).trc.twr $(LOG_FOLDER)/$(RTL_TOP).trc.$(RUN_ID).twr
217
 
218
 
219
# ----------------------------------------------------
220
# bitgen
221
# ----------------------------------------------------
222
$(WORK_FOLDER)/$(RTL_TOP).bit : $(WORK_FOLDER)/$(RTL_TOP).ncd
223
        \
224
        cd $(WORK_FOLDER); \
225
        bitgen -intstyle xflow -f $(BIN_FOLDER)/bitfile_config.ut $(RTL_TOP).ncd
226
        cp $(WORK_FOLDER)/$(RTL_TOP).bit $(BITFILE_FOLDER)/$(RTL_TOP).$(RUN_ID).bit
227
        mv $(WORK_FOLDER)/$(RTL_TOP).bgn $(LOG_FOLDER)/$(RTL_TOP).bit.$(RUN_ID).bgn
228
 
229
 
230
# ----------------------------------------------------
231
# par
232
# ----------------------------------------------------
233
# -xe c  = Extra Effort, continue on Impossible
234
# -p means don't run the placer. We use map as the placer
235
# -k =  Re-entrant route. Keep the current placement. Continue the routing
236
#       using the existing routing as a starting point.
237
$(WORK_FOLDER)/$(RTL_TOP).ncd : $(WORK_FOLDER)/$(RTL_TOP).map.ncd
238
        \
239
        cd $(WORK_FOLDER); \
240
        par  -intstyle xflow -w -k -ol high $(RTL_TOP).map.ncd $(RTL_TOP).ncd $(RTL_TOP).pcf
241
        cp $(WORK_FOLDER)/$(RTL_TOP)_pad.txt $(LOG_FOLDER)/$(RTL_TOP).pad.$(RUN_ID).txt
242
 
243
# ----------------------------------------------------
244
# map
245
# ----------------------------------------------------
246
$(WORK_FOLDER)/$(RTL_TOP).map.ncd : $(WORK_FOLDER)/$(RTL_TOP).ngd
247
        cd $(WORK_FOLDER); \
248 43 csantifort
        map -intstyle xflow        \
249
          -p $(XILINX_FPGA)        \
250
          -ol high                 \
251
          -t $(MAP_SEED)           \
252
          -w                       \
253
          -ignore_keep_hierarchy   \
254 61 csantifort
          -timing                  \
255 43 csantifort
          -detail                  \
256
          -register_duplication on \
257
          -lc auto                 \
258
          -xe c -mt off -ir off    \
259
          -pr off  -power off      \
260
          -o $(RTL_TOP).map.ncd    \
261
          $(RTL_TOP).ngd           \
262 2 csantifort
          $(RTL_TOP).pcf
263
        cp $(WORK_FOLDER)/$(RTL_TOP).map.mrp $(LOG_FOLDER)/$(RTL_TOP).map.$(RUN_ID).mrp
264
 
265
 
266
# ----------------------------------------------------
267
# ngdbuild
268
# ----------------------------------------------------
269
$(WORK_FOLDER)/$(RTL_TOP).ngd : $(WORK_FOLDER)/$(RTL_TOP).ngc $(BIN_FOLDER)/$(XST_CONST_FILE)
270
        cd $(WORK_FOLDER); \
271
        ngdbuild -intstyle xflow -verbose -p $(XILINX_FPGA) \
272
          -dd _ngo  -nt on \
273
          -uc $(BIN_FOLDER)/$(XST_CONST_FILE) $(RTL_TOP).ngc $(RTL_TOP).ngd
274
 
275
 
276
# ----------------------------------------------------
277
# xst
278
# ----------------------------------------------------
279
 
280
# Note -iobuf YES is needed for the top-level verilog
281
# module synthesis
282
 
283 21 csantifort
$(WORK_FOLDER)/$(RTL_TOP).ngc : $(WORK_FOLDER)/run_id.txt $(XST_PROJ_FILE)
284
        @echo "work: $(WORK_FOLDER)" > $(LOG_FOLDER)/$(RTL_TOP).cfg.$(RUN_ID).txt
285
        @echo "$(XST_DEFINES)" >> $(LOG_FOLDER)/$(RTL_TOP).cfg.$(RUN_ID).txt
286 2 csantifort
        export XST_DESIGN=$(RTL_TOP)
287
        export XST_OFN=$(RTL_TOP)
288
        rm -Rf $(WORK_FOLDER)/$(RTL_TOP)xst $(WORK_FOLDER)/_ngo
289
        mkdir -p $(WORK_FOLDER)/$(RTL_TOP)xst/tmp $(WORK_FOLDER)/_ngo
290
        echo "work"                                         > $(WORK_FOLDER)/$(RTL_TOP).lso
291
        echo "set -tmpdir     ./$(RTL_TOP)xst/tmp"          > $(WORK_FOLDER)/$(RTL_TOP).xst
292
        echo "set -xsthdpdir  ./$(RTL_TOP)xst"             >> $(WORK_FOLDER)/$(RTL_TOP).xst
293
        echo "run -ifn $(BIN_FOLDER)/$(XST_PROJ_FILE)"     >> $(WORK_FOLDER)/$(RTL_TOP).xst
294
        echo "-ofn $(RTL_TOP) -top $(RTL_TOP)"             >> $(WORK_FOLDER)/$(RTL_TOP).xst
295
        echo "-lso ./$(RTL_TOP).lso"                       >> $(WORK_FOLDER)/$(RTL_TOP).xst
296
        echo $(XST_OPTIONS)                                >> $(WORK_FOLDER)/$(RTL_TOP).xst
297
        echo "-iobuf YES"                                  >> $(WORK_FOLDER)/$(RTL_TOP).xst
298 61 csantifort
        echo "-define { $(XST_DEFINES) }"                  >> $(WORK_FOLDER)/$(RTL_TOP).xst
299 2 csantifort
        cd $(WORK_FOLDER); \
300
        xst -intstyle xflow -ifn ./$(RTL_TOP).xst -ofn $(LOG_FOLDER)/$(RTL_TOP).xst.$(RUN_ID).srp
301
 
302
 
303
# ----------------------------------------------------
304
# Generate the Run ID, initial Map seed
305
# Recompile the boot-loader program - it gets build
306
# into the FPGA's RamBlocks and uses the run_id as
307
# the version number
308
# ----------------------------------------------------
309
$(WORK_FOLDER)/run_id.txt :
310
        test -e $(WORK_FOLDER) || mkdir $(WORK_FOLDER)
311
        test -e $(LOG_FOLDER) || mkdir $(LOG_FOLDER)
312
        test -e $(BITFILE_FOLDER) || mkdir $(BITFILE_FOLDER)
313
        echo 0 > $(WORK_FOLDER)/seed.txt
314
        date +%Y%m%d%H%M%S > $(WORK_FOLDER)/run_id.txt
315
        $(BIN_FOLDER)/set_fpga_version.sh $(WORK_FOLDER)/run_id.txt
316 61 csantifort
        $(MAKE) -C $(BOOT_LOADER_DIR) clean
317
        $(MAKE) -C $(BOOT_LOADER_DIR)
318 19 csantifort
 

powered by: WebSVN 2.1.0

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