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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [xilinx/] [ml501/] [syn/] [xst/] [bin/] [Makefile] - Blame information for rev 439

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

Line No. Rev Author Line
1 415 julius
######################################################################
2
####                                                              ####
3
####  ORPSoC Xilinx Synthesis Makefile                            ####
4
####                                                              ####
5
####  Author(s):                                                  ####
6
####      - Julius Baxter, julius@opencores.org                   ####
7
####                                                              ####
8
####                                                              ####
9
######################################################################
10
####                                                              ####
11
#### Copyright (C) 2009,2010 Authors and OPENCORES.ORG            ####
12
####                                                              ####
13
#### This source file may be used and distributed without         ####
14
#### restriction provided that this copyright statement is not    ####
15
#### removed from the file and that any derivative work contains  ####
16
#### the original copyright notice and the associated disclaimer. ####
17
####                                                              ####
18
#### This source file is free software; you can redistribute it   ####
19
#### and/or modify it under the terms of the GNU Lesser General   ####
20
#### Public License as published by the Free Software Foundation; ####
21
#### either version 2.1 of the License, or (at your option) any   ####
22
#### later version.                                               ####
23
####                                                              ####
24
#### This source is distributed in the hope that it will be       ####
25
#### useful, but WITHOUT ANY WARRANTY; without even the implied   ####
26
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ####
27
#### PURPOSE.  See the GNU Lesser General Public License for more ####
28
#### details.                                                     ####
29
####                                                              ####
30
#### You should have received a copy of the GNU Lesser General    ####
31
#### Public License along with this source; if not, download it   ####
32
#### from http://www.opencores.org/lgpl.shtml                     ####
33
####                                                              ####
34
######################################################################
35
 
36
# Name of the directory we're currently in
37
CUR_DIR=$(shell pwd)
38
 
39
# The root path of the board build
40
BOARD_DIR ?=$(CUR_DIR)/../../..
41
PROJECT_ROOT=$(BOARD_DIR)/../../..
42
 
43 435 julius
DESIGN_NAME ?=orpsoc
44
RTL_TOP ?=$(DESIGN_NAME)_top
45 415 julius
 
46
SYN_DIR=$(BOARD_DIR)/syn/xst
47
SYN_RUN_DIR=$(SYN_DIR)/run
48
 
49
# Paths to other important parts of this test suite
50
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl
51
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog
52
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl
53
 
54
BOARD_RTL_DIR=$(BOARD_DIR)/rtl
55
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog
56
# Only 1 include path for board builds - their own!
57
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include
58
BOARD_DESIGN_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v
59
#BOARD_RTL_VHDL_DIR = $(BOARD_RTL_DIR)/vhdl
60
 
61
BACKEND_DIR=$(BOARD_DIR)/backend
62
BACKEND_BIN_DIR=$(BACKEND_DIR)/bin
63
 
64
# Set V=1 when calling make to enable verbose output
65
# mainly for debugging purposes.
66
ifeq ($(V), 1)
67
Q=
68
else
69
Q ?=@
70
endif
71
 
72
 
73
DEFINES_FILE_CUTOFF=$(shell grep -n "end of included module defines" $(BOARD_DESIGN_VERILOG_DEFINES) | cut -d ':' -f 1)
74
DESIGN_DEFINES=$(shell cat $(BOARD_DESIGN_VERILOG_DEFINES) | sed s://.*::g | sed s:\`:\#:g | sed 's:^[ ]*::' | awk '{print};/^\#define/{printf "_%s=%s\n",$$2,$$2}' | grep -v PERIOD | cpp -P | sed s:^_::g | sed s:=$$::g )
75
# Rule to look at what defines are being extracted from main file
76
print-defines:
77
        @echo; echo "\t### Design defines ###"; echo
78
        @echo "\tParsing "$(BOARD_DESIGN_VERILOG_DEFINES)" and exporting:"
79
        @echo $(DESIGN_DEFINES)
80
 
81
 
82
# Backend tool path
83
# Check that the XILINX_PATH variable is set
84
ifeq ($(XILINX_PATH),)
85
$(error XILINX_PATH environment variable not set. Set it and rerun)
86
endif
87
XILINX_SETTINGS_SCRIPT=$(XILINX_PATH)/settings32.sh
88
XILINX_SETTINGS_SCRIPT_EXISTS=$(shell if [ -e $(XILINX_SETTINGS_SCRIPT) ]; then echo 1; else echo 0; fi)
89
ifeq ($(XILINX_SETTINGS_SCRIPT_EXISTS),0)
90
$(error XILINX_PATH variable not set correctly. Cannot find $$XILINX_PATH/settings32.sh)
91
endif
92
 
93 67 julius
#
94 415 julius
# Verilog DUT source variables
95 67 julius
#
96 415 julius
# First we get a list of modules in the RTL path of the board's path.
97
# Next we check which modules not in the board's RTL path are in the root RTL
98
# path (modules which can be commonly instantiated, but over which board
99
# build-specific versions take precedence.)
100
 
101
# Paths under board/***/rtl/verilog we wish to exclude when getting modules
102
BOARD_VERILOG_MODULES_EXCLUDE= include
103
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR))
104
# Apply exclude to list of modules
105
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST))
106
 
107
# Rule for debugging this script
108
print-board-modules:
109
        $(Q)echo echo; echo "\t### Board verilog modules ###"; echo;
110
        $(Q)echo $(BOARD_RTL_VERILOG_MODULES)
111
 
112
# Now get list of modules that we don't have a version of in the board path
113
# List others that cause clahes (ie. source listed, due to utterly pathetic XST
114
# not supporting ability to specify search paths, and requiring includes but
115
# not used in this board build, hence its includes are not there and result
116
# in error.)
117
COMMON_VERILOG_MODULES_EXCLUDE= include usbhostslave
118
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES)
119
 
120
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR))
121
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST))
122
 
123
# Rule for debugging this script
124
print-common-modules-exclude:
125
        $(Q)echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo;
126
        $(Q)echo "$(COMMON_VERILOG_MODULES_EXCLUDE)"
127
 
128
print-common-modules:
129
        $(Q)echo echo; echo "\t###  Verilog modules from common RTL dir ###"; echo
130
        $(Q)echo $(COMMON_RTL_VERILOG_MODULES)
131
 
132
# List of verilog source files (only .v files!)
133
# Board RTL modules first
134
VERILOG_SRC_PATHS=$(addprefix $(BOARD_RTL_VERILOG_DIR)/,$(BOARD_RTL_VERILOG_MODULES))
135
VERILOG_SRC_PATHS +=$(addprefix $(COMMON_RTL_VERILOG_DIR)/,$(COMMON_RTL_VERILOG_MODULES))
136
RTL_VERILOG_SRC=$(shell for modulepath in $(VERILOG_SRC_PATHS); do \
137
        if [ -d $$modulepath ]; then \
138
                ls $$modulepath/*.v; \
139
        fi; done)
140
 
141
# List of verilog includes from board RTL path - only for rule sensitivity
142
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*)
143
 
144 67 julius
#
145 415 julius
# VHDL DUT source variables
146
#
147
# VHDL modules
148
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR))
149
# VHDL sources
150
#RTL_VHDL_SRC=$(shell for module in $(RTL_VHDL_MODULES); do if [ -d $(RTL_VHDL_DIR)/$$module ]; then ls $(RTL_VHDL_DIR)/$$module/*.vhd; fi; done)
151 67 julius
 
152
 
153 415 julius
#
154
# Dynamically created files included by different parts of the defines
155
#
156 67 julius
 
157 415 julius
BOARD_SW_DIR=$(BOARD_DIR)/sw
158 67 julius
 
159 415 julius
# BootROM code, which generates a verilog array select values
160
BOOTROM_FILE=bootrom.v
161
BOARD_BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom
162
BOOTROM_VERILOG=$(BOARD_BOOTROM_SW_DIR)/$(BOOTROM_FILE)
163
# Export BOARD_PATH for the software makefiles
164
BOARD_PATH=$(BOARD_DIR)
165
export BOARD_PATH
166
bootrom: $(BOOTROM_VERILOG)
167
$(BOOTROM_VERILOG):
168
        $(MAKE) -C $(BOARD_BOOTROM_SW_DIR) $(BOOTROM_FILE)
169 67 julius
 
170 415 julius
TIMESCALE_FILE=timescale.v
171
SYNDIR_TIMESCALE_FILE=$(SYN_RUN_DIR)/$(TIMESCALE_FILE)
172
$(SYNDIR_TIMESCALE_FILE):
173
        $(Q)echo "" > $@
174 67 julius
 
175 415 julius
SYN_VERILOG_DEFINES=synthesis-defines.v
176
SYNDIR_SYN_VERILOG_DEFINES=$(SYN_RUN_DIR)/$(SYN_VERILOG_DEFINES)
177
$(SYNDIR_SYN_VERILOG_DEFINES):
178
        $(Q)echo "\`define SYNTHESIS" > $@
179
        $(Q)echo "\`define XILINX" >> $@
180
        $(Q)echo "" >> $@
181 67 julius
 
182 415 julius
GENERATED_DEFINES = $(BOOTROM_VERILOG)
183
GENERATED_DEFINES += $(SYNDIR_TIMESCALE_FILE)
184
GENERATED_DEFINES += $(SYNDIR_SYN_VERILOG_DEFINES)
185 67 julius
 
186
 
187 415 julius
FPGA_PART ?=xc5vlx50-ff676-1
188
OPT_MODE ?=Speed
189
OPT_LEVEL ?=2
190 67 julius
 
191
 
192 415 julius
XILINX_FLAGS ?=-intstyle silent
193
XILINX_XST_FLAGS ?= -power NO -glob_opt AllClockNets -write_timing_constraints NO -cross_clock_analysis NO -slice_utilization_ratio 100 -bram_utilization_ratio 100 -dsp_utilization_ratio 100 -safe_implementation No -fsm_style lut -ram_extract Yes -ram_style Auto -rom_extract Yes -rom_style Auto -auto_bram_packing NO -mux_extract YES -mux_style Auto -decoder_extract YES -priority_extract YES -shreg_extract YES -shift_extract YES -xor_collapse YES -resource_sharing YES -async_to_sync NO -use_dsp48 auto -iobuf YES -max_fanout 100000 -bufg 32 -register_duplication YES -equivalent_register_removal YES -register_balancing No -slice_packing YES -optimize_primitives NO -use_clock_enable Auto -use_sync_set Auto -use_sync_reset Auto -iob Auto -slice_utilization_ratio_maxmargin 5
194 67 julius
 
195 415 julius
XCF_FILE=$(DESIGN_NAME).xcf
196
XST_FILE=$(DESIGN_NAME).xst
197
PRJ_FILE=$(DESIGN_NAME).prj
198
NGC_FILE=$(DESIGN_NAME).ngc
199
NETLIST_FILE=$(DESIGN_NAME).v
200 67 julius
 
201 439 julius
 
202 415 julius
XST_PRJ_FILE_SRC_DECLARE=verilog work
203 67 julius
 
204 415 julius
print-config:
205
        $(Q)echo; echo "\t### Synthesis make configuration ###"; echo
206
        $(Q)echo "\tFPGA_PART="$(FPGA_PART)
207
        $(Q)echo "\tOPT_MODE="$(OPT_MODE)
208
        $(Q)echo "\tOTP_LEVEL="$(OPT_LEVEL)
209
        $(Q)echo "\tXILINX_XST_FLAGS="$(XILINX_XST_FLAGS)
210
        $(Q)echo
211 67 julius
 
212 415 julius
all: $(NGC_FILE)
213 67 julius
 
214 415 julius
# Generate the .xst file
215
# See this page for information on options:
216
# http://www.xilinx.com/itp/xilinx4/data/docs/xst/command_line5.html
217
$(XST_FILE):
218
        $(Q)echo; echo "\t#### Generating XST file ####"; echo
219
        $(Q)echo "# XST Script for ORPSoC Synthesis" > $@
220
        $(Q)echo "# This file is autogenerated - any changes will be overwritten" >> $@
221
        $(Q)echo "# See the Makefile in syn/xst/bin to make changes" >> $@
222
        $(Q)echo "run" >> $@
223
        $(Q)echo "-ifn "$(PRJ_FILE) >> $@
224
        $(Q)echo "-ifmt mixed" >> $@
225 435 julius
        $(Q)echo "-top "$(RTL_TOP) >> $@
226 415 julius
        $(Q)echo "-ofmt NGC" >> $@
227
        $(Q)echo "-ofn "$(NGC_FILE) >> $@
228
        $(Q)echo "-p "$(FPGA_PART) >> $@
229
        $(Q)echo "-opt_level "$(OPT_LEVEL) >> $@
230
        $(Q)echo "-opt_mode "$(OPT_MODE) >> $@
231
        $(Q)echo "-uc "$(XCF_FILE) >> $@
232
#       $(Q)echo "elaborate " >> $@
233
#       $(Q)echo -n "-vlgpath \"" >> $@
234
# option missing from XST - wtf?!       $(Q)for vlogpath in $(VERILOG_SRC_PATHS); do \
235
                echo -n $$vlogpath" "; done >> $@
236
#       $(Q)echo "\"" >> $@
237
        $(Q)echo "-vlgincdir { "$(BOARD_RTL_VERILOG_INCLUDE_DIR)" "$(BOARD_BOOTROM_SW_DIR) " }" >> $@
238
        $(Q)echo >> $@
239 67 julius
 
240
# Generate Xilinx project (.prj) file
241 415 julius
$(PRJ_FILE): $(RTL_VERILOG_SRC)
242
        $(Q)echo; echo "\t#### Generating Xilinx PRJ file ####";
243
#       $(Q)echo "# Autogenerated XST .prj file" > $@
244
#       $(Q)echo "# Any changes will be written over." >> $@
245
        $(Q)for file in $(RTL_VERILOG_SRC); do \
246 67 julius
                echo $(XST_PRJ_FILE_SRC_DECLARE) $$file >> $@ ; \
247
        done
248 415 julius
        $(Q)echo >> $@
249
        $(Q)echo
250 67 julius
 
251 415 julius
# Constraints file
252
$(XCF_FILE):
253
        $(Q)echo; echo "\t#### Generating Xilinx PRJ file ####"; echo
254
        $(Q)echo "# Autogenerated XST .prj file" > $@
255
        $(Q)echo "#" >> $@
256
        $(Q)echo "# Not much here, XST is smart enough to determine clocks through DCMs" >> $@
257
        $(Q)echo "#" >> $@
258
        $(Q)echo "# TODO: Potentially use the other XTAL for DDR RAM clocking" >> $@
259
        $(Q)echo "#" >> $@
260
        $(Q)echo "# 200MHz diff. XTAL used as main system clock" >> $@
261
        $(Q)echo "NET \"sys_clk_in_p\" TNM_NET = \"sys_clk_in_p_grp\";" >> $@
262
        $(Q)echo "NET \"sys_clk_in_n\" TNM_NET = \"sys_clk_in_n_grp\";" >> $@
263
        $(Q)echo "TIMESPEC \"TS_sys_clk_in_p_grp\" = PERIOD \"sys_clk_in_p_grp\" 5 ns HIGH 50 %;" >> $@
264
        $(Q)echo "TIMESPEC \"TS_sys_clk_in_n_grp\" = PERIOD \"sys_clk_in_n_grp\" 5 ns LOW 50 %;" >> $@
265
        $(Q)echo "# 100 MHz user clock" >> $@
266
        $(Q)echo "#NET \"sys_clk_in\" TNM_NET = \"sys_clk_in_grp\";" >> $@
267
        $(Q)echo "#TIMESPEC \"TS_sys_clk_in\" = PERIOD \"sys_clk_in_grp\" 10 ns HIGH 50%;" >> $@
268
        $(Q)echo "# Ignore the reset logic" >> $@
269
        $(Q)echo "NET rst_n_pad_i* TIG;" >> $@
270
        $(Q)echo "# SSRAM multicylce constraints:" >> $@
271
        $(Q)echo "# Define the two clock domains as timespecs" >> $@
272
        $(Q)echo "#NET dcm0_clkdv TNM_NET=\"wb_clk\";" >> $@
273
        $(Q)echo "#TIMESPEC \"TS_wb_clk\" = PERIOD \"wb_clk\" 20 ns HIGH 10;" >> $@
274
        $(Q)echo "#NET dcm0_clk0 TNM_NET = \"ssram_clk200\";" >> $@
275
        $(Q)echo "#TIMESPEC \"TS_ssram_clk200\" = PERIOD \"ssram_clk200\" \"TS_wb_clk\" / 4;" >> $@
276
        $(Q)echo "# Now define their relationship - logic should be configured so that there's" >> $@
277
        $(Q)echo "# 1 WB cycle at all times before anything is sampled across domains" >> $@
278
        $(Q)echo "#TIMESPEC \"TS_wb_clk_ssram_clk200\" = from \"wb_clk\" TO \"ssram_clk200\" 15 ns;" >> $@
279
        $(Q)echo "#TIMESPEC \"TS_ssram_clk200_wb_clk\" = from \"ssram_clk200\" TO \"wb_clk\" 20 ns;" >> $@
280 67 julius
 
281 415 julius
# XST command
282
$(NGC_FILE): $(PRJ_FILE) $(XST_FILE) $(XCF_FILE) $(GENERATED_DEFINES)
283
        $(Q)echo; echo "\t#### Running XST ####"; echo;
284
        $(Q)(. $(XILINX_SETTINGS_SCRIPT) ; xst -ifn $(XST_FILE) $(XILINX_FLAGS) $(XST_FLAGS) )
285
        $(Q)echo
286 67 julius
 
287 439 julius
netlist: $(NETLIST_FILE)
288
 
289 415 julius
# Netlist generation command
290
$(NETLIST_FILE): $(NGC_FILE)
291
        $(Q)echo; echo "\t#### Generating verilog netlist ####"; echo;
292
        $(Q)(. $(XILINX_SETTINGS_SCRIPT) ; \
293
        netgen -sim -aka -dir . -ofmt verilog $< -w $@ )
294 67 julius
 
295
 
296 415 julius
clean:
297
        $(Q)rm -rf *.* xst
298
 
299 67 julius
clean-sw:
300 415 julius
        $(MAKE) -C $(PROJECT_ROOT)/sw/lib clean-all
301 67 julius
 
302 415 julius
clean-all: clean-sw clean
303 67 julius
 
304
 
305 415 julius
.PRECIOUS : $(NGC_FILE) $(XST_FILE) $(XCF_FILE)

powered by: WebSVN 2.1.0

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