1 |
415 |
julius |
######################################################################
|
2 |
|
|
#### ####
|
3 |
|
|
#### ORPSoC Xilinx Synthesis Makefile ####
|
4 |
|
|
#### ####
|
5 |
|
|
#### Author(s): ####
|
6 |
|
|
#### - Julius Baxter, julius@opencores.org ####
|
7 |
|
|
#### ####
|
8 |
|
|
#### ####
|
9 |
|
|
######################################################################
|
10 |
|
|
#### ####
|
11 |
542 |
julius |
#### Copyright (C) 2009,2010,2011 Authors and OPENCORES.ORG ####
|
12 |
415 |
julius |
#### ####
|
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 |
542 |
julius |
# We don't want the usbhostslave module to be pulled in during synthesis because
|
40 |
|
|
# we haven't copied the headers to our RTL director
|
41 |
|
|
#COMMON_VERILOG_MODULES_EXCLUDE+= usbhostslave
|
42 |
|
|
|
43 |
|
|
|
44 |
415 |
julius |
# The root path of the board build
|
45 |
542 |
julius |
BOARD_ROOT ?=$(CUR_DIR)/../../..
|
46 |
|
|
include $(BOARD_ROOT)/Makefile.inc
|
47 |
415 |
julius |
|
48 |
435 |
julius |
RTL_TOP ?=$(DESIGN_NAME)_top
|
49 |
415 |
julius |
|
50 |
542 |
julius |
SYN_RUN_DIR=$(BOARD_SYN_DIR)/run
|
51 |
415 |
julius |
|
52 |
|
|
TIMESCALE_FILE=timescale.v
|
53 |
|
|
SYNDIR_TIMESCALE_FILE=$(SYN_RUN_DIR)/$(TIMESCALE_FILE)
|
54 |
|
|
$(SYNDIR_TIMESCALE_FILE):
|
55 |
|
|
$(Q)echo "" > $@
|
56 |
67 |
julius |
|
57 |
415 |
julius |
SYN_VERILOG_DEFINES=synthesis-defines.v
|
58 |
|
|
SYNDIR_SYN_VERILOG_DEFINES=$(SYN_RUN_DIR)/$(SYN_VERILOG_DEFINES)
|
59 |
|
|
$(SYNDIR_SYN_VERILOG_DEFINES):
|
60 |
|
|
$(Q)echo "\`define SYNTHESIS" > $@
|
61 |
|
|
$(Q)echo "\`define XILINX" >> $@
|
62 |
|
|
$(Q)echo "" >> $@
|
63 |
67 |
julius |
|
64 |
415 |
julius |
GENERATED_DEFINES = $(BOOTROM_VERILOG)
|
65 |
|
|
GENERATED_DEFINES += $(SYNDIR_TIMESCALE_FILE)
|
66 |
|
|
GENERATED_DEFINES += $(SYNDIR_SYN_VERILOG_DEFINES)
|
67 |
67 |
julius |
|
68 |
415 |
julius |
FPGA_PART ?=xc5vlx50-ff676-1
|
69 |
|
|
OPT_MODE ?=Speed
|
70 |
|
|
OPT_LEVEL ?=2
|
71 |
67 |
julius |
|
72 |
415 |
julius |
XILINX_FLAGS ?=-intstyle silent
|
73 |
655 |
julius |
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 yes -slice_utilization_ratio_maxmargin 5
|
74 |
67 |
julius |
|
75 |
415 |
julius |
XCF_FILE=$(DESIGN_NAME).xcf
|
76 |
|
|
XST_FILE=$(DESIGN_NAME).xst
|
77 |
|
|
PRJ_FILE=$(DESIGN_NAME).prj
|
78 |
|
|
NGC_FILE=$(DESIGN_NAME).ngc
|
79 |
|
|
NETLIST_FILE=$(DESIGN_NAME).v
|
80 |
67 |
julius |
|
81 |
439 |
julius |
|
82 |
415 |
julius |
XST_PRJ_FILE_SRC_DECLARE=verilog work
|
83 |
67 |
julius |
|
84 |
415 |
julius |
print-config:
|
85 |
|
|
$(Q)echo; echo "\t### Synthesis make configuration ###"; echo
|
86 |
|
|
$(Q)echo "\tFPGA_PART="$(FPGA_PART)
|
87 |
|
|
$(Q)echo "\tOPT_MODE="$(OPT_MODE)
|
88 |
|
|
$(Q)echo "\tOTP_LEVEL="$(OPT_LEVEL)
|
89 |
|
|
$(Q)echo "\tXILINX_XST_FLAGS="$(XILINX_XST_FLAGS)
|
90 |
|
|
$(Q)echo
|
91 |
67 |
julius |
|
92 |
415 |
julius |
all: $(NGC_FILE)
|
93 |
67 |
julius |
|
94 |
415 |
julius |
# Generate the .xst file
|
95 |
|
|
# See this page for information on options:
|
96 |
|
|
# http://www.xilinx.com/itp/xilinx4/data/docs/xst/command_line5.html
|
97 |
|
|
$(XST_FILE):
|
98 |
|
|
$(Q)echo; echo "\t#### Generating XST file ####"; echo
|
99 |
|
|
$(Q)echo "# XST Script for ORPSoC Synthesis" > $@
|
100 |
|
|
$(Q)echo "# This file is autogenerated - any changes will be overwritten" >> $@
|
101 |
|
|
$(Q)echo "# See the Makefile in syn/xst/bin to make changes" >> $@
|
102 |
|
|
$(Q)echo "run" >> $@
|
103 |
|
|
$(Q)echo "-ifn "$(PRJ_FILE) >> $@
|
104 |
|
|
$(Q)echo "-ifmt mixed" >> $@
|
105 |
435 |
julius |
$(Q)echo "-top "$(RTL_TOP) >> $@
|
106 |
415 |
julius |
$(Q)echo "-ofmt NGC" >> $@
|
107 |
|
|
$(Q)echo "-ofn "$(NGC_FILE) >> $@
|
108 |
|
|
$(Q)echo "-p "$(FPGA_PART) >> $@
|
109 |
|
|
$(Q)echo "-opt_level "$(OPT_LEVEL) >> $@
|
110 |
|
|
$(Q)echo "-opt_mode "$(OPT_MODE) >> $@
|
111 |
|
|
$(Q)echo "-uc "$(XCF_FILE) >> $@
|
112 |
|
|
# $(Q)echo "elaborate " >> $@
|
113 |
|
|
# $(Q)echo -n "-vlgpath \"" >> $@
|
114 |
|
|
# option missing from XST - wtf?! $(Q)for vlogpath in $(VERILOG_SRC_PATHS); do \
|
115 |
|
|
echo -n $$vlogpath" "; done >> $@
|
116 |
|
|
# $(Q)echo "\"" >> $@
|
117 |
542 |
julius |
# Give board then common verilog include paths, hoping xst does a sensible thing
|
118 |
|
|
# and searches them in order.
|
119 |
|
|
$(Q)echo "-vlgincdir { "$(BOARD_RTL_VERILOG_INCLUDE_DIR)" "$(COMMON_RTL_VERILOG_DIR)/include" "$(BOOTROM_SW_DIR) " }" >> $@
|
120 |
415 |
julius |
$(Q)echo >> $@
|
121 |
67 |
julius |
|
122 |
|
|
# Generate Xilinx project (.prj) file
|
123 |
415 |
julius |
$(PRJ_FILE): $(RTL_VERILOG_SRC)
|
124 |
|
|
$(Q)echo; echo "\t#### Generating Xilinx PRJ file ####";
|
125 |
|
|
# $(Q)echo "# Autogenerated XST .prj file" > $@
|
126 |
|
|
# $(Q)echo "# Any changes will be written over." >> $@
|
127 |
|
|
$(Q)for file in $(RTL_VERILOG_SRC); do \
|
128 |
67 |
julius |
echo $(XST_PRJ_FILE_SRC_DECLARE) $$file >> $@ ; \
|
129 |
|
|
done
|
130 |
415 |
julius |
$(Q)echo >> $@
|
131 |
|
|
$(Q)echo
|
132 |
67 |
julius |
|
133 |
415 |
julius |
# Constraints file
|
134 |
|
|
$(XCF_FILE):
|
135 |
530 |
julius |
$(Q)echo; echo "\t#### Generating Xilinx XCF file ####"; echo
|
136 |
415 |
julius |
$(Q)echo "# Autogenerated XST .prj file" > $@
|
137 |
|
|
$(Q)echo "#" >> $@
|
138 |
|
|
$(Q)echo "# Not much here, XST is smart enough to determine clocks through DCMs" >> $@
|
139 |
|
|
$(Q)echo "#" >> $@
|
140 |
|
|
$(Q)echo "# TODO: Potentially use the other XTAL for DDR RAM clocking" >> $@
|
141 |
|
|
$(Q)echo "#" >> $@
|
142 |
|
|
$(Q)echo "# 200MHz diff. XTAL used as main system clock" >> $@
|
143 |
|
|
$(Q)echo "NET \"sys_clk_in_p\" TNM_NET = \"sys_clk_in_p_grp\";" >> $@
|
144 |
|
|
$(Q)echo "NET \"sys_clk_in_n\" TNM_NET = \"sys_clk_in_n_grp\";" >> $@
|
145 |
|
|
$(Q)echo "TIMESPEC \"TS_sys_clk_in_p_grp\" = PERIOD \"sys_clk_in_p_grp\" 5 ns HIGH 50 %;" >> $@
|
146 |
|
|
$(Q)echo "TIMESPEC \"TS_sys_clk_in_n_grp\" = PERIOD \"sys_clk_in_n_grp\" 5 ns LOW 50 %;" >> $@
|
147 |
|
|
$(Q)echo "# 100 MHz user clock" >> $@
|
148 |
|
|
$(Q)echo "#NET \"sys_clk_in\" TNM_NET = \"sys_clk_in_grp\";" >> $@
|
149 |
|
|
$(Q)echo "#TIMESPEC \"TS_sys_clk_in\" = PERIOD \"sys_clk_in_grp\" 10 ns HIGH 50%;" >> $@
|
150 |
|
|
$(Q)echo "# Ignore the reset logic" >> $@
|
151 |
|
|
$(Q)echo "NET rst_n_pad_i* TIG;" >> $@
|
152 |
|
|
$(Q)echo "# SSRAM multicylce constraints:" >> $@
|
153 |
|
|
$(Q)echo "# Define the two clock domains as timespecs" >> $@
|
154 |
|
|
$(Q)echo "#NET dcm0_clkdv TNM_NET=\"wb_clk\";" >> $@
|
155 |
|
|
$(Q)echo "#TIMESPEC \"TS_wb_clk\" = PERIOD \"wb_clk\" 20 ns HIGH 10;" >> $@
|
156 |
|
|
$(Q)echo "#NET dcm0_clk0 TNM_NET = \"ssram_clk200\";" >> $@
|
157 |
|
|
$(Q)echo "#TIMESPEC \"TS_ssram_clk200\" = PERIOD \"ssram_clk200\" \"TS_wb_clk\" / 4;" >> $@
|
158 |
|
|
$(Q)echo "# Now define their relationship - logic should be configured so that there's" >> $@
|
159 |
|
|
$(Q)echo "# 1 WB cycle at all times before anything is sampled across domains" >> $@
|
160 |
|
|
$(Q)echo "#TIMESPEC \"TS_wb_clk_ssram_clk200\" = from \"wb_clk\" TO \"ssram_clk200\" 15 ns;" >> $@
|
161 |
|
|
$(Q)echo "#TIMESPEC \"TS_ssram_clk200_wb_clk\" = from \"ssram_clk200\" TO \"wb_clk\" 20 ns;" >> $@
|
162 |
67 |
julius |
|
163 |
415 |
julius |
# XST command
|
164 |
|
|
$(NGC_FILE): $(PRJ_FILE) $(XST_FILE) $(XCF_FILE) $(GENERATED_DEFINES)
|
165 |
|
|
$(Q)echo; echo "\t#### Running XST ####"; echo;
|
166 |
638 |
stekern |
$(Q)xst -ifn $(XST_FILE) $(XILINX_FLAGS) $(XST_FLAGS)
|
167 |
415 |
julius |
$(Q)echo
|
168 |
67 |
julius |
|
169 |
439 |
julius |
netlist: $(NETLIST_FILE)
|
170 |
|
|
|
171 |
415 |
julius |
# Netlist generation command
|
172 |
|
|
$(NETLIST_FILE): $(NGC_FILE)
|
173 |
|
|
$(Q)echo; echo "\t#### Generating verilog netlist ####"; echo;
|
174 |
638 |
stekern |
$(Q)netgen -sim -aka -dir . -ofmt verilog $< -w $@
|
175 |
67 |
julius |
|
176 |
|
|
|
177 |
415 |
julius |
clean:
|
178 |
|
|
$(Q)rm -rf *.* xst
|
179 |
|
|
|
180 |
67 |
julius |
clean-sw:
|
181 |
449 |
julius |
$(MAKE) -C $(PROJECT_ROOT)/sw/lib distclean
|
182 |
67 |
julius |
|
183 |
449 |
julius |
distclean: clean-sw clean
|
184 |
67 |
julius |
|
185 |
|
|
|
186 |
530 |
julius |
.PRECIOUS : $(NGC_FILE) $(XST_FILE) $(XCF_FILE)
|
187 |
|
|
|