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 415

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
DESIGN_NAME=orpsoc
44
 
45
SYN_DIR=$(BOARD_DIR)/syn/xst
46
SYN_RUN_DIR=$(SYN_DIR)/run
47
 
48
# Paths to other important parts of this test suite
49
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl
50
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog
51
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl
52
 
53
BOARD_RTL_DIR=$(BOARD_DIR)/rtl
54
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog
55
# Only 1 include path for board builds - their own!
56
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include
57
BOARD_DESIGN_VERILOG_DEFINES=$(BOARD_RTL_VERILOG_INCLUDE_DIR)/$(DESIGN_NAME)-defines.v
58
#BOARD_RTL_VHDL_DIR = $(BOARD_RTL_DIR)/vhdl
59
 
60
BACKEND_DIR=$(BOARD_DIR)/backend
61
BACKEND_BIN_DIR=$(BACKEND_DIR)/bin
62
 
63
# Set V=1 when calling make to enable verbose output
64
# mainly for debugging purposes.
65
ifeq ($(V), 1)
66
Q=
67
else
68
Q ?=@
69
endif
70
 
71
 
72
DEFINES_FILE_CUTOFF=$(shell grep -n "end of included module defines" $(BOARD_DESIGN_VERILOG_DEFINES) | cut -d ':' -f 1)
73
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 )
74
# Rule to look at what defines are being extracted from main file
75
print-defines:
76
        @echo; echo "\t### Design defines ###"; echo
77
        @echo "\tParsing "$(BOARD_DESIGN_VERILOG_DEFINES)" and exporting:"
78
        @echo $(DESIGN_DEFINES)
79
 
80
 
81
# Backend tool path
82
# Check that the XILINX_PATH variable is set
83
ifeq ($(XILINX_PATH),)
84
$(error XILINX_PATH environment variable not set. Set it and rerun)
85
endif
86
XILINX_SETTINGS_SCRIPT=$(XILINX_PATH)/settings32.sh
87
XILINX_SETTINGS_SCRIPT_EXISTS=$(shell if [ -e $(XILINX_SETTINGS_SCRIPT) ]; then echo 1; else echo 0; fi)
88
ifeq ($(XILINX_SETTINGS_SCRIPT_EXISTS),0)
89
$(error XILINX_PATH variable not set correctly. Cannot find $$XILINX_PATH/settings32.sh)
90
endif
91
 
92 67 julius
#
93 415 julius
# Verilog DUT source variables
94 67 julius
#
95 415 julius
# First we get a list of modules in the RTL path of the board's path.
96
# Next we check which modules not in the board's RTL path are in the root RTL
97
# path (modules which can be commonly instantiated, but over which board
98
# build-specific versions take precedence.)
99
 
100
# Paths under board/***/rtl/verilog we wish to exclude when getting modules
101
BOARD_VERILOG_MODULES_EXCLUDE= include
102
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR))
103
# Apply exclude to list of modules
104
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST))
105
 
106
# Rule for debugging this script
107
print-board-modules:
108
        $(Q)echo echo; echo "\t### Board verilog modules ###"; echo;
109
        $(Q)echo $(BOARD_RTL_VERILOG_MODULES)
110
 
111
# Now get list of modules that we don't have a version of in the board path
112
# List others that cause clahes (ie. source listed, due to utterly pathetic XST
113
# not supporting ability to specify search paths, and requiring includes but
114
# not used in this board build, hence its includes are not there and result
115
# in error.)
116
COMMON_VERILOG_MODULES_EXCLUDE= include usbhostslave
117
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES)
118
 
119
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR))
120
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST))
121
 
122
# Rule for debugging this script
123
print-common-modules-exclude:
124
        $(Q)echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo;
125
        $(Q)echo "$(COMMON_VERILOG_MODULES_EXCLUDE)"
126
 
127
print-common-modules:
128
        $(Q)echo echo; echo "\t###  Verilog modules from common RTL dir ###"; echo
129
        $(Q)echo $(COMMON_RTL_VERILOG_MODULES)
130
 
131
# List of verilog source files (only .v files!)
132
# Board RTL modules first
133
VERILOG_SRC_PATHS=$(addprefix $(BOARD_RTL_VERILOG_DIR)/,$(BOARD_RTL_VERILOG_MODULES))
134
VERILOG_SRC_PATHS +=$(addprefix $(COMMON_RTL_VERILOG_DIR)/,$(COMMON_RTL_VERILOG_MODULES))
135
RTL_VERILOG_SRC=$(shell for modulepath in $(VERILOG_SRC_PATHS); do \
136
        if [ -d $$modulepath ]; then \
137
                ls $$modulepath/*.v; \
138
        fi; done)
139
 
140
# List of verilog includes from board RTL path - only for rule sensitivity
141
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*)
142
 
143 67 julius
#
144 415 julius
# VHDL DUT source variables
145
#
146
# VHDL modules
147
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR))
148
# VHDL sources
149
#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)
150 67 julius
 
151
 
152 415 julius
#
153
# Dynamically created files included by different parts of the defines
154
#
155 67 julius
 
156 415 julius
BOARD_SW_DIR=$(BOARD_DIR)/sw
157 67 julius
 
158 415 julius
# BootROM code, which generates a verilog array select values
159
BOOTROM_FILE=bootrom.v
160
BOARD_BOOTROM_SW_DIR=$(BOARD_SW_DIR)/bootrom
161
BOOTROM_VERILOG=$(BOARD_BOOTROM_SW_DIR)/$(BOOTROM_FILE)
162
# Export BOARD_PATH for the software makefiles
163
BOARD_PATH=$(BOARD_DIR)
164
export BOARD_PATH
165
bootrom: $(BOOTROM_VERILOG)
166
$(BOOTROM_VERILOG):
167
        $(MAKE) -C $(BOARD_BOOTROM_SW_DIR) $(BOOTROM_FILE)
168 67 julius
 
169 415 julius
TIMESCALE_FILE=timescale.v
170
SYNDIR_TIMESCALE_FILE=$(SYN_RUN_DIR)/$(TIMESCALE_FILE)
171
$(SYNDIR_TIMESCALE_FILE):
172
        $(Q)echo "" > $@
173 67 julius
 
174 415 julius
SYN_VERILOG_DEFINES=synthesis-defines.v
175
SYNDIR_SYN_VERILOG_DEFINES=$(SYN_RUN_DIR)/$(SYN_VERILOG_DEFINES)
176
$(SYNDIR_SYN_VERILOG_DEFINES):
177
        $(Q)echo "\`define SYNTHESIS" > $@
178
        $(Q)echo "\`define XILINX" >> $@
179
        $(Q)echo "" >> $@
180 67 julius
 
181 415 julius
GENERATED_DEFINES = $(BOOTROM_VERILOG)
182
GENERATED_DEFINES += $(SYNDIR_TIMESCALE_FILE)
183
GENERATED_DEFINES += $(SYNDIR_SYN_VERILOG_DEFINES)
184 67 julius
 
185
 
186 415 julius
FPGA_PART ?=xc5vlx50-ff676-1
187
OPT_MODE ?=Speed
188
OPT_LEVEL ?=2
189 67 julius
 
190
 
191 415 julius
XILINX_FLAGS ?=-intstyle silent
192
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
193 67 julius
 
194 415 julius
XCF_FILE=$(DESIGN_NAME).xcf
195
XST_FILE=$(DESIGN_NAME).xst
196
PRJ_FILE=$(DESIGN_NAME).prj
197
NGC_FILE=$(DESIGN_NAME).ngc
198
NETLIST_FILE=$(DESIGN_NAME).v
199 67 julius
 
200 415 julius
XST_PRJ_FILE_SRC_DECLARE=verilog work
201 67 julius
 
202 415 julius
print-config:
203
        $(Q)echo; echo "\t### Synthesis make configuration ###"; echo
204
        $(Q)echo "\tFPGA_PART="$(FPGA_PART)
205
        $(Q)echo "\tOPT_MODE="$(OPT_MODE)
206
        $(Q)echo "\tOTP_LEVEL="$(OPT_LEVEL)
207
        $(Q)echo "\tXILINX_XST_FLAGS="$(XILINX_XST_FLAGS)
208
        $(Q)echo
209 67 julius
 
210 415 julius
all: $(NGC_FILE)
211 67 julius
 
212 415 julius
# Generate the .xst file
213
# See this page for information on options:
214
# http://www.xilinx.com/itp/xilinx4/data/docs/xst/command_line5.html
215
$(XST_FILE):
216
        $(Q)echo; echo "\t#### Generating XST file ####"; echo
217
        $(Q)echo "# XST Script for ORPSoC Synthesis" > $@
218
        $(Q)echo "# This file is autogenerated - any changes will be overwritten" >> $@
219
        $(Q)echo "# See the Makefile in syn/xst/bin to make changes" >> $@
220
        $(Q)echo "run" >> $@
221
        $(Q)echo "-ifn "$(PRJ_FILE) >> $@
222
        $(Q)echo "-ifmt mixed" >> $@
223
        $(Q)echo "-top "$(DESIGN_NAME)"_top" >> $@
224
        $(Q)echo "-ofmt NGC" >> $@
225
        $(Q)echo "-ofn "$(NGC_FILE) >> $@
226
        $(Q)echo "-p "$(FPGA_PART) >> $@
227
        $(Q)echo "-opt_level "$(OPT_LEVEL) >> $@
228
        $(Q)echo "-opt_mode "$(OPT_MODE) >> $@
229
        $(Q)echo "-uc "$(XCF_FILE) >> $@
230
#       $(Q)echo "elaborate " >> $@
231
#       $(Q)echo -n "-vlgpath \"" >> $@
232
# option missing from XST - wtf?!       $(Q)for vlogpath in $(VERILOG_SRC_PATHS); do \
233
                echo -n $$vlogpath" "; done >> $@
234
#       $(Q)echo "\"" >> $@
235
        $(Q)echo "-vlgincdir { "$(BOARD_RTL_VERILOG_INCLUDE_DIR)" "$(BOARD_BOOTROM_SW_DIR) " }" >> $@
236
        $(Q)echo >> $@
237 67 julius
 
238
# Generate Xilinx project (.prj) file
239 415 julius
$(PRJ_FILE): $(RTL_VERILOG_SRC)
240
        $(Q)echo; echo "\t#### Generating Xilinx PRJ file ####";
241
#       $(Q)echo "# Autogenerated XST .prj file" > $@
242
#       $(Q)echo "# Any changes will be written over." >> $@
243
        $(Q)for file in $(RTL_VERILOG_SRC); do \
244 67 julius
                echo $(XST_PRJ_FILE_SRC_DECLARE) $$file >> $@ ; \
245
        done
246 415 julius
        $(Q)echo >> $@
247
        $(Q)echo
248 67 julius
 
249 415 julius
# Constraints file
250
$(XCF_FILE):
251
        $(Q)echo; echo "\t#### Generating Xilinx PRJ file ####"; echo
252
        $(Q)echo "# Autogenerated XST .prj file" > $@
253
        $(Q)echo "#" >> $@
254
        $(Q)echo "# Not much here, XST is smart enough to determine clocks through DCMs" >> $@
255
        $(Q)echo "#" >> $@
256
        $(Q)echo "# TODO: Potentially use the other XTAL for DDR RAM clocking" >> $@
257
        $(Q)echo "#" >> $@
258
        $(Q)echo "# 200MHz diff. XTAL used as main system clock" >> $@
259
        $(Q)echo "NET \"sys_clk_in_p\" TNM_NET = \"sys_clk_in_p_grp\";" >> $@
260
        $(Q)echo "NET \"sys_clk_in_n\" TNM_NET = \"sys_clk_in_n_grp\";" >> $@
261
        $(Q)echo "TIMESPEC \"TS_sys_clk_in_p_grp\" = PERIOD \"sys_clk_in_p_grp\" 5 ns HIGH 50 %;" >> $@
262
        $(Q)echo "TIMESPEC \"TS_sys_clk_in_n_grp\" = PERIOD \"sys_clk_in_n_grp\" 5 ns LOW 50 %;" >> $@
263
        $(Q)echo "# 100 MHz user clock" >> $@
264
        $(Q)echo "#NET \"sys_clk_in\" TNM_NET = \"sys_clk_in_grp\";" >> $@
265
        $(Q)echo "#TIMESPEC \"TS_sys_clk_in\" = PERIOD \"sys_clk_in_grp\" 10 ns HIGH 50%;" >> $@
266
        $(Q)echo "# Ignore the reset logic" >> $@
267
        $(Q)echo "NET rst_n_pad_i* TIG;" >> $@
268
        $(Q)echo "# SSRAM multicylce constraints:" >> $@
269
        $(Q)echo "# Define the two clock domains as timespecs" >> $@
270
        $(Q)echo "#NET dcm0_clkdv TNM_NET=\"wb_clk\";" >> $@
271
        $(Q)echo "#TIMESPEC \"TS_wb_clk\" = PERIOD \"wb_clk\" 20 ns HIGH 10;" >> $@
272
        $(Q)echo "#NET dcm0_clk0 TNM_NET = \"ssram_clk200\";" >> $@
273
        $(Q)echo "#TIMESPEC \"TS_ssram_clk200\" = PERIOD \"ssram_clk200\" \"TS_wb_clk\" / 4;" >> $@
274
        $(Q)echo "# Now define their relationship - logic should be configured so that there's" >> $@
275
        $(Q)echo "# 1 WB cycle at all times before anything is sampled across domains" >> $@
276
        $(Q)echo "#TIMESPEC \"TS_wb_clk_ssram_clk200\" = from \"wb_clk\" TO \"ssram_clk200\" 15 ns;" >> $@
277
        $(Q)echo "#TIMESPEC \"TS_ssram_clk200_wb_clk\" = from \"ssram_clk200\" TO \"wb_clk\" 20 ns;" >> $@
278 67 julius
 
279 415 julius
# XST command
280
$(NGC_FILE): $(PRJ_FILE) $(XST_FILE) $(XCF_FILE) $(GENERATED_DEFINES)
281
        $(Q)echo; echo "\t#### Running XST ####"; echo;
282
        $(Q)(. $(XILINX_SETTINGS_SCRIPT) ; xst -ifn $(XST_FILE) $(XILINX_FLAGS) $(XST_FLAGS) )
283
        $(Q)echo
284 67 julius
 
285 415 julius
# Netlist generation command
286
$(NETLIST_FILE): $(NGC_FILE)
287
        $(Q)echo; echo "\t#### Generating verilog netlist ####"; echo;
288
        $(Q)(. $(XILINX_SETTINGS_SCRIPT) ; \
289
        netgen -sim -aka -dir . -ofmt verilog $< -w $@ )
290 67 julius
 
291
 
292 415 julius
clean:
293
        $(Q)rm -rf *.* xst
294
 
295 67 julius
clean-sw:
296 415 julius
        $(MAKE) -C $(PROJECT_ROOT)/sw/lib clean-all
297 67 julius
 
298 415 julius
clean-all: clean-sw clean
299 67 julius
 
300
 
301 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.