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

Subversion Repositories amber

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

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

powered by: WebSVN 2.1.0

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