1 |
415 |
julius |
######################################################################
|
2 |
|
|
#### ####
|
3 |
|
|
#### ORPSoC Xilinx backend 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 |
67 |
julius |
|
36 |
415 |
julius |
# Name of the directory we're currently in
|
37 |
|
|
CUR_DIR=$(shell pwd)
|
38 |
67 |
julius |
|
39 |
415 |
julius |
# The root path of the board build
|
40 |
542 |
julius |
BOARD_ROOT ?=$(CUR_DIR)/../../..
|
41 |
|
|
include $(BOARD_ROOT)/Makefile.inc
|
42 |
67 |
julius |
|
43 |
415 |
julius |
#
|
44 |
|
|
# Options for Xilinx PAR tools
|
45 |
|
|
#
|
46 |
|
|
FPGA_PART=xc5vlx50-ff676-1
|
47 |
67 |
julius |
XILINX_FLAGS=-intstyle silent
|
48 |
|
|
XILINX_MAP_FLAGS=-logic_opt off
|
49 |
415 |
julius |
XILINX_AREA_TARGET = speed
|
50 |
|
|
TIMING_REPORT_OPTIONS = -u 1000 -e 1000
|
51 |
|
|
SPI_FLASH_SIZE_KBYTES ?=2048
|
52 |
|
|
SPI_BOOTLOADER_SW_OFFSET_HEX ?=1c0000
|
53 |
67 |
julius |
|
54 |
415 |
julius |
print-config:
|
55 |
|
|
$(Q)echo; echo "\t### Backend make configuration ###"; echo
|
56 |
|
|
$(Q)echo "\tFPGA_PART="$(FPGA_PART)
|
57 |
|
|
$(Q)echo "\tXILINX_FLAGS="$(XILINX_FLAGS)
|
58 |
|
|
$(Q)echo "\tXILINX_MAP_FLAGS="$(XILINX_MAP_FLAGS)
|
59 |
|
|
$(Q)echo "\tXILINX_AREA_TARGET="$(XILINX_AREA_TARGET)
|
60 |
|
|
$(Q)echo "\tTIMING_REPORT_OPTIONS="$(TIMING_REPORT_OPTIONS)
|
61 |
|
|
$(Q)echo "\tSPI_FLASH_SIZE_KBYTES="$(SPI_FLASH_SIZE_KBYTES)
|
62 |
|
|
$(Q)echo "\tSPI_BOOTLOADER_SW_OFFSET_HEX="$(SPI_BOOTLOADER_SW_OFFSET_HEX)
|
63 |
|
|
|
64 |
542 |
julius |
NGC_FILE=$(BOARD_SYN_RUN_DIR)/$(DESIGN_NAME).ngc
|
65 |
415 |
julius |
NGD_FILE=$(DESIGN_NAME).ngd
|
66 |
|
|
UCF_FILE=../bin/$(BOARD_NAME).ucf
|
67 |
|
|
MAPPED_NCD=$(DESIGN_NAME)_mapped.ncd
|
68 |
|
|
PARRED_NCD=$(DESIGN_NAME).ncd
|
69 |
|
|
PCF_FILE=$(DESIGN_NAME).pcf
|
70 |
|
|
BIT_FILE=$(DESIGN_NAME).bit
|
71 |
|
|
BIT_FILE_FOR_SPI=$(DESIGN_NAME)_spiboot.bit
|
72 |
|
|
BATCH_FILE=$(DESIGN_NAME).batch
|
73 |
|
|
MCS_FILE=$(DESIGN_NAME).mcs
|
74 |
|
|
|
75 |
|
|
$(NGC_FILE):
|
76 |
542 |
julius |
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) $(DESIGN_NAME).ngc
|
77 |
415 |
julius |
|
78 |
|
|
$(NGD_FILE): $(UCF_FILE) $(NGC_FILE)
|
79 |
67 |
julius |
@echo; echo "\t#### Running NGDBuild ####";
|
80 |
|
|
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
81 |
542 |
julius |
ngdbuild -p $(FPGA_PART) -sd $(BOARD_BACKEND_BIN_DIR) -uc $(UCF_FILE) \
|
82 |
415 |
julius |
$(NGC_FILE) $@ )
|
83 |
67 |
julius |
|
84 |
|
|
#This target uses Xilinx tools to perform Mapping
|
85 |
415 |
julius |
$(MAPPED_NCD): $(NGD_FILE)
|
86 |
67 |
julius |
@echo; echo "\t#### Mapping ####";
|
87 |
|
|
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
88 |
|
|
export XIL_MAP_NO_DSP_AUTOREG=1 && \
|
89 |
|
|
export XIL_MAP_ALLOW_ANY_DLL_INPUT=1 && \
|
90 |
415 |
julius |
map -p $(FPGA_PART) -detail -pr b -cm ${XILINX_AREA_TARGET} \
|
91 |
|
|
-timing -ol high -w $(XILINX_FLAGS) -o $@ -xe n $(NGD_FILE) $(PCF_FILE))
|
92 |
67 |
julius |
|
93 |
|
|
#This target uses Xilinx tools to Place & Route the design
|
94 |
415 |
julius |
$(PARRED_NCD): $(MAPPED_NCD)
|
95 |
67 |
julius |
@echo; echo "\t#### PAR'ing ####";
|
96 |
|
|
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
97 |
530 |
julius |
par -w -ol high $(XILINX_FLAGS) $< $@ $(PCD_FILE) )
|
98 |
67 |
julius |
|
99 |
415 |
julius |
#This target uses Xilinx tools to generate a bitstream for download
|
100 |
|
|
$(BIT_FILE): $(PARRED_NCD)
|
101 |
67 |
julius |
@echo; echo "\t#### Generating .bit file ####";
|
102 |
|
|
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
103 |
415 |
julius |
bitgen -w $(XILINX_FLAGS) -g StartUpClk:JtagClk $< $@ )
|
104 |
67 |
julius |
|
105 |
415 |
julius |
$(BIT_FILE_FOR_SPI): $(PARRED_NCD)
|
106 |
|
|
@echo; echo "\t#### Generating .bit file for SPI load ####";
|
107 |
|
|
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
108 |
|
|
bitgen -w $(XILINX_FLAGS) -g StartUpClk:CClk $< $@ )
|
109 |
478 |
julius |
|
110 |
|
|
# Generate MCS with bootloader specified by user, if BOOTLOADER_BIN defined.
|
111 |
415 |
julius |
ifeq ($(BOOTLOADER_BIN),)
|
112 |
|
|
$(MCS_FILE): $(BIT_FILE_FOR_SPI)
|
113 |
|
|
@echo; echo "\t#### Generating .mcs file for SPI load ####";
|
114 |
|
|
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
115 |
478 |
julius |
promgen -spi -p mcs -w -o $@ -s $(SPI_FLASH_SIZE_KBYTES) -u 0 $< )
|
116 |
415 |
julius |
else
|
117 |
|
|
$(MCS_FILE): $(BIT_FILE_FOR_SPI)
|
118 |
478 |
julius |
@echo; echo "\t#### Generating .mcs file with bootloader for SPI load ####";
|
119 |
415 |
julius |
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
120 |
478 |
julius |
promgen -spi -p mcs -w -o $@ -s $(SPI_FLASH_SIZE_KBYTES) -u 0 $< \
|
121 |
415 |
julius |
-data_file up $(SPI_BOOTLOADER_SW_OFFSET_HEX) $(BOOTLOADER_BIN) \
|
122 |
|
|
)
|
123 |
|
|
endif
|
124 |
|
|
|
125 |
67 |
julius |
#this target downloads the bitstream to the target fpga
|
126 |
415 |
julius |
download: $(BIT_FILE) $(BATCH_FILE)
|
127 |
560 |
julius |
$(Q)( . $(XILINX_SETTINGS_SCRIPT) && \
|
128 |
415 |
julius |
impact -batch $(BATCH_FILE) )
|
129 |
67 |
julius |
|
130 |
|
|
#This target uses netgen to make a simulation netlist
|
131 |
415 |
julius |
netlist: $(PARRED_NCD)
|
132 |
67 |
julius |
@echo; echo "\t#### Generating netlist ####";
|
133 |
|
|
$(Q)(. $(XILINX_SETTINGS_SCRIPT) && \
|
134 |
415 |
julius |
netgen -ofmt verilog -sim -dir netlist -pcf $(PCF_FILE) $<)
|
135 |
67 |
julius |
|
136 |
|
|
#This one uses TRCE to make a timing report
|
137 |
415 |
julius |
timingreport: $(PARRED_NCD)
|
138 |
67 |
julius |
@echo; echo "\t#### Generating timing report ####";
|
139 |
|
|
$(Q)(. $(XILINX_SETTINGS_SCRIPT) && \
|
140 |
415 |
julius |
trce $(TIMING_REPORT_OPTIONS) $< )
|
141 |
67 |
julius |
|
142 |
|
|
|
143 |
|
|
clean:
|
144 |
479 |
julius |
$(Q)rm -rf *.* xlnx_auto*
|
145 |
67 |
julius |
|
146 |
415 |
julius |
clean-syn:
|
147 |
542 |
julius |
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) distclean
|
148 |
415 |
julius |
|
149 |
449 |
julius |
distclean: clean-syn clean
|
150 |
415 |
julius |
|
151 |
|
|
.PRECIOUS : $(PARRED_NCD) $(MAPPED_NCD) $(NGC_FILE) $(NGD_FILE) $(BIT_FILE) $(BIT_FILE_FOR_SPI)
|