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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [boards/] [actel/] [ordb1a3pe1500/] [syn/] [synplify/] [bin/] [Makefile] - Blame information for rev 408

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

Line No. Rev Author Line
1 408 julius
#
2
# Makefile for synthesis
3
#
4
# To generate the EDIF, just do "# make all"
5
#
6
# To synthesize for older ORSoC board with A3P1000, do:
7
#       # make clean all FPGA_FAMILY=ProASIC3 FPGA_PART=A3P1000
8
#
9
# Note: correct pll model must be linked in backend path.
10
#
11
 
12
# Name of the directory we're currently in
13
CUR_DIR=$(shell pwd)
14
 
15
# The root path of the board build
16
BOARD_DIR ?=$(CUR_DIR)/../../..
17
PROJECT_ROOT=$(BOARD_DIR)/../../..
18
 
19
# Export BOARD_PATH for the software makefiles
20
BOARD_PATH=$(BOARD_DIR)
21
export BOARD_PATH
22
 
23
DESIGN_NAME=orpsoc
24
 
25
# Paths to other important parts of this test suite
26
 
27
# Paths to other important parts of this test suite
28
COMMON_RTL_DIR = $(PROJECT_ROOT)/rtl
29
COMMON_RTL_VERILOG_DIR = $(COMMON_RTL_DIR)/verilog
30
#COMMON_RTL_VHDL_DIR = $(COMMON_RTL_DIR)/vhdl
31
 
32
BOARD_RTL_DIR=$(BOARD_DIR)/rtl
33
BOARD_RTL_VERILOG_DIR=$(BOARD_RTL_DIR)/verilog
34
# Only 1 include path for board builds - their own!
35
BOARD_RTL_VERILOG_INCLUDE_DIR=$(BOARD_RTL_VERILOG_DIR)/include
36
#BOARD_RTL_VHDL_DIR = $(BOARD_RTL_DIR)/vhdl
37
 
38
 
39
BACKEND_DIR=$(BOARD_DIR)/backend
40
BACKEND_VERILOG_DIR=$(BACKEND_DIR)/rtl/verilog
41
 
42
# Set V=1 when calling make to enable verbose output
43
# mainly for debugging purposes.
44
ifeq ($(V), 1)
45
Q=
46
else
47
Q ?=@
48
endif
49
 
50
 
51
#
52
# Verilog DUT source variables
53
#
54
# First we get a list of modules in the RTL path of the board's path.
55
# Next we check which modules not in the board's RTL path are in the root RTL
56
# path (modules which can be commonly instantiated, but over which board
57
# build-specific versions take precedence.)
58
 
59
# Paths under board/***/rtl/verilog we wish to exclude when getting modules
60
BOARD_VERILOG_MODULES_EXCLUDE= include
61
BOARD_VERILOG_MODULES_DIR_LIST=$(shell ls $(BOARD_RTL_VERILOG_DIR))
62
# Apply exclude to list of modules
63
BOARD_RTL_VERILOG_MODULES=$(filter-out $(BOARD_VERILOG_MODULES_EXCLUDE),$(BOARD_VERILOG_MODULES_DIR_LIST))
64
 
65
# Rule for debugging this script
66
print-board-modules:
67
        @echo echo; echo "\t### Board verilog modules ###"; echo;
68
        @echo $(BOARD_RTL_VERILOG_MODULES)
69
 
70
# Now get list of modules that we don't have a version of in the board path
71
COMMON_VERILOG_MODULES_EXCLUDE= include
72
COMMON_VERILOG_MODULES_EXCLUDE += $(BOARD_RTL_VERILOG_MODULES)
73
 
74
COMMON_RTL_VERILOG_MODULES_DIR_LIST=$(shell ls $(COMMON_RTL_VERILOG_DIR))
75
COMMON_RTL_VERILOG_MODULES=$(filter-out $(COMMON_VERILOG_MODULES_EXCLUDE), $(COMMON_RTL_VERILOG_MODULES_DIR_LIST))
76
 
77
# Rule for debugging this script
78
print-common-modules-exclude:
79
        @echo echo; echo "\t### Common verilog modules being excluded due to board versions ###"; echo;
80
        @echo "$(COMMON_VERILOG_MODULES_EXCLUDE)"
81
 
82
print-common-modules:
83
        @echo echo; echo "\t###  Verilog modules from common RTL dir ###"; echo
84
        @echo $(COMMON_RTL_VERILOG_MODULES)
85
 
86
# List of verilog source files (only .v files!)
87
# Board RTL modules first
88
RTL_VERILOG_SRC=$(shell for module in $(BOARD_RTL_VERILOG_MODULES); do if [ -d $(BOARD_RTL_VERILOG_DIR)/$$module ]; then ls $(BOARD_RTL_VERILOG_DIR)/$$module/*.v; fi; done)
89
# Common RTL module source
90
RTL_VERILOG_SRC +=$(shell for module in $(COMMON_RTL_VERILOG_MODULES); do if [ -d $(COMMON_RTL_VERILOG_DIR)/$$module ]; then ls $(COMMON_RTL_VERILOG_DIR)/$$module/*.v; fi; done)
91
 
92
# List of verilog includes from board RTL path - only for rule sensitivity
93
RTL_VERILOG_INCLUDES=$(shell ls $(BOARD_RTL_VERILOG_INCLUDE_DIR)/*.*)
94
 
95
#
96
# Add backend files here, except for the proasic3 library
97
#
98
RTL_VERILOG_SRC+=$(shell ls $(BACKEND_VERILOG_DIR)/*.v)
99
 
100
#
101
# VHDL DUT source variables
102
#
103
# VHDL modules
104
#RTL_VHDL_MODULES=$(shell ls $(RTL_VHDL_DIR))
105
# VHDL sources
106
#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)
107
 
108
# Tool settings
109
# For Linux, the Actel licenses only support Synplify Pro
110
SYN_WORK_DIR            ?=synplify_work
111
SYN_SCRIPT              ?=synplify.prj  # We will generate this
112
SYN_LOG                 ?=syn.log
113
SYN_TOOL                ?=synplify_pro  # Name of the executable to call
114
# Options passed after the executable.
115
SYN_LICENSE_OPTS        ?=-licensetype synplifypro_acteloem
116
SYN_TOOL_OPTS           ?=$(SYN_SCRIPT) $(SYN_LICENSE_OPTS) -batch -log $(SYN_LOG)
117
 
118
 
119
SYN_PROJ_NAME ?= $(DESIGN_NAME)
120
RTL_TOP ?= $(DESIGN_NAME)_top
121
EDIF_FILE ?=$(RTL_TOP).edn
122
EDIF_FILE_OUT ?= ../out/$(EDIF_FILE)
123
# Synthesis params
124
#FREQ ?= 50.0000
125
FREQ ?= 125.000
126
FPGA_FAMILY ?=ProASIC3E
127
#FPGA_PART ?=A3P1000
128
FPGA_PART ?=A3PE1500
129
FPGA_PACKAGE ?=PQFP208
130
#FPGA_SPEED_GRADE ?=-2
131
FPGA_SPEED_GRADE ?=Std
132
MAXFAN ?=50
133
MAXFAN_HARD ?=0
134
RETIMING ?=1
135
GLOBALTHRESH ?=50
136
DISABLE_IO_INSERTION ?= 0
137
RESOURCE_SHARING ?=1
138
 
139
# Time reporting variable
140
NUM_PATHS=50
141
NUM_ENDPOINTS=50
142
 
143
SDC_FILE=$(DESIGN_NAME)_top.sdc
144
 
145
# Rule to print out current config of current session
146
print-config:
147
        @echo; echo "\t### Synthesis make configuration ###"; echo
148
        @echo "\tRTL_TOP="$(RTL_TOP)
149
        @echo "\tFPGA_FAMILY="$(FPGA_FAMILY)
150
        @echo "\tFPGA_PART="$(FPGA_PART)
151
        @echo "\tFPGA_PACKAGE="$(FPGA_PACKAGE)
152
        @echo "\tFPGA_SPEED_GRADE="$(FPGA_SPEED_GRADE)
153
        @echo "\tFREQ="$(FREQ)
154
        @echo "\tMAXFAN="$(MAXFAN)
155
        @echo "\tMAXFAN_HARD="$(MAXFAN_HARD)
156
        @echo "\tRETIMING="$(RETIMING)
157
        @echo "\tGLOBALTHRESH="$(GLOBALTHRESH)
158
        @echo "\tDISABLE_IO_INSERTION="$(DISABLE_IO_INSERTION)
159
        @echo "\tRESOURCE_SHARING="$(RESOURCE_SHARING)
160
        @echo
161
 
162
 
163
 
164
all: print-config $(EDIF_FILE_OUT)
165
 
166
#create the work dir
167
$(SYN_WORK_DIR):
168
        mkdir $(SYN_WORK_DIR)
169
 
170
#
171
# Dynamically created files included by different parts of the defines
172
#
173
 
174
BOOTROM_FILE=bootrom.v
175
SW_DIR=$(BOARD_DIR)/sw
176
BOOTROM_SW_DIR=$(SW_DIR)/bootrom
177
BOOTROM_SRC=$(shell ls $(BOOTROM_SW_DIR)/* | grep -v $(BOOTROM_FILE))
178
BOOTROM_VERILOG=$(BOOTROM_SW_DIR)/$(BOOTROM_FILE)
179
bootrom: $(BOOTROM_VERILOG)
180
$(BOOTROM_VERILOG): $(BOOTROM_SRC)
181
        $(MAKE) -C $(BOOTROM_SW_DIR) $(BOOTROM_FILE)
182
 
183
SYNDIR_BOOTROM_VERILOG=$(SYN_WORK_DIR)/$(BOOTROM_FILE)
184
$(SYNDIR_BOOTROM_VERILOG): $(BOOTROM_VERILOG)
185
        cp $^ $@
186
 
187
TIMESCALE_FILE=timescale.v
188
SYNDIR_TIMESCALE_FILE=$(SYN_WORK_DIR)/$(TIMESCALE_FILE)
189
$(SYNDIR_TIMESCALE_FILE):
190
        $(Q)echo "" > $@
191
 
192
SYN_VERILOG_DEFINES=synthesis-defines.v
193
SYNDIR_SYN_VERILOG_DEFINES=$(SYN_WORK_DIR)/$(SYN_VERILOG_DEFINES)
194
$(SYNDIR_SYN_VERILOG_DEFINES):
195
        $(Q)echo "\`define SYNTHESIS" > $@
196
        $(Q)echo "\`define ACTEL" >> $@
197
        $(Q)echo "" >> $@
198
 
199
GENERATED_DEFINES = $(SYNDIR_BOOTROM_VERILOG)
200
GENERATED_DEFINES += $(SYNDIR_TIMESCALE_FILE)
201
GENERATED_DEFINES += $(SYNDIR_SYN_VERILOG_DEFINES)
202
 
203
# Generate the prj file
204
.PHONY: $(SYN_WORK_DIR)/$(SYN_SCRIPT)
205
$(SYN_WORK_DIR)/$(SYN_SCRIPT): $(SYN_WORK_DIR) $(RTL_VERILOG_SRC) $(RTL_VERILOG_INCLUDES) $(GENERATED_DEFINES) $(SYN_WORK_DIR)/$(SDC_FILE)
206
        $(Q)echo; echo "\t### Generating Synplify project file ###"; echo
207
        $(Q)echo -n "# Autogenerated synthesis script " > $@
208
        $(Q)date >> $@
209
        $(Q)for file in $(RTL_VERILOG_SRC); do \
210
                echo "add_file -verilog "$$file >> $@; \
211
        done
212
        $(Q)for file in $(RTL_VHDL_SRC); do \
213
                echo "add_file -vhdl "$$file >> $@; \
214
        done
215
        $(Q)echo "add_file -constraint "$(SDC_FILE) >> $@
216
        $(Q)echo "set_option -include_path "$(BOARD_RTL_VERILOG_INCLUDE_DIR) >> $@
217
        $(Q)echo "set_option -include_path ." >> $@
218
        $(Q)echo "impl -add "$(SYN_PROJ_NAME)" -type fpga" >> $@
219
        $(Q)echo "set_option -technology "$(FPGA_FAMILY) >> $@
220
        $(Q)echo "set_option -part "$(FPGA_PART) >> $@
221
        $(Q)echo "set_option -package "$(FPGA_PACKAGE) >> $@
222
        $(Q)echo "set_option -speed_grade "$(FPGA_SPEED_GRADE) >> $@
223
        $(Q)echo "set_option -part_companion \"\"" >> $@
224
        $(Q)echo "set_option -use_fsm_explorer 0" >> $@
225
        $(Q)echo "set_option -top_module \""$(RTL_TOP)"\"" >> $@
226
        $(Q)echo "set_option -symbolic_fsm_compiler 1" >> $@
227
        $(Q)echo "set_option -compiler_compatible 0" >> $@
228
        $(Q)echo "set_option -resource_sharing "$(RESOURCE_SHARING) >> $@
229
        $(Q)echo "set_option -frequency "$(FREQ) >> $@
230
        $(Q)echo "set_option -write_verilog 1" >> $@
231
        $(Q)echo "set_option -write_vhdl 0" >> $@
232
        $(Q)echo "set_option -run_prop_extract 1" >> $@
233
        $(Q)echo "set_option -maxfan "$(MAXFAN) >> $@
234
        $(Q)echo "set_option -maxfan_hard "$(MAXFAN_HARD) >> $@
235
        $(Q)echo "set_option -disable_io_insertion "$(DISABLE_IO_INSERTION) >> $@
236
        $(Q)echo "set_option -retiming "$(RETIMING) >> $@
237
        $(Q)echo "set_option -report_path 4000" >> $@
238
        $(Q)echo "set_option -opcond COMWC" >> $@
239
        $(Q)echo "set_option -update_models_cp 0" >> $@
240
        $(Q)echo "set_option -preserve_registers 0" >> $@
241
        $(Q)echo "set_option -globalthreshold "$(GLOBALTHRESH) >> $@
242
        $(Q)echo "set_option -syn_global_buffers 18" >> $@
243
        $(Q)echo "set_option -reporting_filter {-from {*} -to {*}}" >> $@
244
        $(Q)echo "set_option -reporting_filename "$(RTL_TOP)".ta" >> $@
245
        $(Q)echo "set_option -reporting_output_srm 0" >> $@
246
        $(Q)echo "set_option -write_apr_constraint 1" >> $@
247
        $(Q)echo "project -result_format \"edif\"" >> $@
248
        $(Q)echo "project -result_file \""$(EDIF_FILE)"\"" >> $@
249
        $(Q)echo "set_option -vlog_std v2001" >> $@
250
        $(Q)echo "set_option -num_startend_points "$(NUM_ENDPOINTS) >> $@
251
        $(Q)echo "set_option -num_critical_paths "$(NUM_PATHS) >> $@
252
        $(Q)echo "set_option -project_relative_includes 1" >> $@
253
        $(Q)echo "impl -active \""$(SYN_PROJ_NAME)"\"" >> $@
254
 
255
#
256
# Constraint script generation
257
#
258
IN_CLK_PERIOD_NS = 15.625 # 64 MHz
259
WB_CLK_PERIOD_NS = 31.25 # 32 MHz
260
#
261
# Timing (SDC)
262
#
263
# I can't figure out how to get these constraints into synplify properly..
264
# but doesn't really appear to matter, we simply overconstrain the whole
265
# thing to fastest frequency we need, which is currently:
266
# SMII @ 125MHz
267
#
268
$(SYN_WORK_DIR)/$(SDC_FILE):
269
        $(Q)echo; echo "\t### Generating SDC file ###"; echo
270
        $(Q)rm -f $@
271
        $(Q)echo >> $@
272
#       $(Q)echo "create_clock  -name { sys_clk } -period "$(IN_CLK_PERIOD_NS)" { p:sys_clk  } " >> $@
273
#       $(Q)echo "create_clock  -name { tck_pad_i } -period 100.000 -waveform { 0.000 50.000  }  { p:tck_pad_i  } " >> $@
274
#       $(Q)echo "create_generated_clock  -name { clkgen0/pll0/Core:GLA } -divide_by 72  -multiply_by 36  -source { clkgen0/pll0/Core:CLKA } { clkgen0/pll0/Core:GLA  }" >> $@
275
#       $(Q)echo "create_generated_clock  -name { clkgen0/pll0/Core:GLB } -divide_by 36  -multiply_by 36  -source { clkgen0/pll0/Core:CLKA } { clkgen0/pll0/Core:GLB  } " >> $@
276
#       $(Q)echo "create_generated_clock  -name { clkgen0.pll0.wb_clk_i } -divide_by 72  -multiply_by 36  -source { t:clkgen0.pll0.wb_clk_i } { t:clkgen0.pll0.wb_clk_i  }" >> $@
277
 
278
 
279
# change into work dir, call synplify, hopefully create the edif
280
$(SYN_WORK_DIR)/$(SYN_PROJ_NAME)/$(EDIF_FILE): $(SYN_WORK_DIR)/$(SYN_SCRIPT)
281
        cd $(SYN_WORK_DIR) && time $(SYN_TOOL) $(SYN_TOOL_OPTS)
282
 
283
##
284
# Generate a report for each module, and for whole thing
285
##
286
MODULES ?=arbiter_ibus arbiter_dbus arbiter_bytebus jtag_tap or1200_top dbg_if rom ram_wb uart16550 spacewire_wb_if mp2_top simple_spi i2c_core_wb_if usbslave scet gpio versatile_mem_ctrl urtu_top
287
MODULES_SRR=$(shell for mod in $(MODULES); do echo $(SYN_WORK_DIR)"/"$(SYN_PROJ_NAME)"/"$$mod".srr"; done)
288
 
289
syn-report: $(MODULES_SRR)
290
        rm -f $@
291
        for srrfile in $^; do \
292
                echo `echo $$srrfile | xargs basename | cut -d '.' -f 1`>> $@; \
293
                grep "Core Cells" $$srrfile >> $@; \
294
                grep "Block Rams" $$srrfile >> $@; \
295
                grep -B 1 -A 5 "Starting Clock" $$srrfile >> $@; \
296
                echo >> $@; echo >> $@; \
297
        done
298
 
299
%.srr:
300
        @echo; echo "\tGenerating "$@; echo
301
        export RTL_TOP=$(shell echo $@ | xargs basename | cut -d '.' -f 1); \
302
        $(MAKE) $(SYN_WORK_DIR)/$(SYN_PROJ_NAME)/$$RTL_TOP.edn
303
 
304
 
305
$(EDIF_FILE_OUT): $(SYN_WORK_DIR)/$(SYN_PROJ_NAME)/$(EDIF_FILE)
306
        cp $^ $@
307
 
308
clean-all: clean-sw clean clean-edifs
309
 
310
clean-sw:
311
        $(MAKE) -C $(PROJECT_ROOT)/sw/lib clean-all
312
 
313
clean: clean-build
314
 
315
clean-edifs:
316
        rm -f *.edn ../out/*
317
 
318
clean-build:
319
        rm -rf $(SYN_WORK_DIR) *.edn
320
 
321
clean-srr:
322
        rm $(MODULES_SRR)

powered by: WebSVN 2.1.0

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