1 |
568 |
julius |
######################################################################
|
2 |
|
|
#### ####
|
3 |
|
|
#### ORPSoC Xilinx backend Makefile ####
|
4 |
|
|
#### ####
|
5 |
|
|
#### Author(s): ####
|
6 |
|
|
#### - Julius Baxter, julius@opencores.org ####
|
7 |
|
|
#### ####
|
8 |
|
|
#### ####
|
9 |
|
|
######################################################################
|
10 |
|
|
#### ####
|
11 |
|
|
#### Copyright (C) 2009,2010,2011 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_ROOT ?=$(CUR_DIR)/../../..
|
41 |
|
|
include $(BOARD_ROOT)/Makefile.inc
|
42 |
|
|
|
43 |
|
|
#
|
44 |
|
|
# Options for Xilinx PAR tools
|
45 |
|
|
#
|
46 |
|
|
FPGA_PART=xc3sd1800a-fg676-4
|
47 |
|
|
XILINX_FLAGS=-intstyle silent
|
48 |
|
|
XILINX_MAP_FLAGS=-logic_opt off
|
49 |
|
|
XILINX_AREA_TARGET = speed
|
50 |
|
|
TIMING_REPORT_OPTIONS = -u 1000 -e 1000
|
51 |
|
|
SPI_FLASH_SIZE_KBYTES ?=8192
|
52 |
|
|
SPI_BOOTLOADER_SW_OFFSET_HEX ?=7c0000
|
53 |
|
|
|
54 |
|
|
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 |
|
|
NGC_FILE=$(BOARD_SYN_RUN_DIR)/$(DESIGN_NAME).ngc
|
65 |
|
|
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 |
|
|
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) $(DESIGN_NAME).ngc
|
77 |
|
|
|
78 |
|
|
$(NGD_FILE): $(UCF_FILE) $(NGC_FILE)
|
79 |
|
|
@echo; echo "\t#### Running NGDBuild ####";
|
80 |
638 |
stekern |
$(Q)ngdbuild -p $(FPGA_PART) -sd $(BOARD_BACKEND_BIN_DIR) \
|
81 |
|
|
-uc $(UCF_FILE) $(NGC_FILE) $@
|
82 |
568 |
julius |
|
83 |
|
|
#This target uses Xilinx tools to perform Mapping
|
84 |
|
|
$(MAPPED_NCD): $(NGD_FILE)
|
85 |
|
|
@echo; echo "\t#### Mapping ####";
|
86 |
638 |
stekern |
$(Q) export XIL_MAP_NO_DSP_AUTOREG=1 && \
|
87 |
568 |
julius |
export XIL_MAP_ALLOW_ANY_DLL_INPUT=1 && \
|
88 |
|
|
map -p $(FPGA_PART) -detail -pr b -cm ${XILINX_AREA_TARGET} \
|
89 |
638 |
stekern |
-timing -ol high -w $(XILINX_FLAGS) -o $@ -xe n $(NGD_FILE) $(PCF_FILE)
|
90 |
568 |
julius |
|
91 |
|
|
#This target uses Xilinx tools to Place & Route the design
|
92 |
|
|
$(PARRED_NCD): $(MAPPED_NCD)
|
93 |
|
|
@echo; echo "\t#### PAR'ing ####";
|
94 |
638 |
stekern |
$(Q)par -w -ol high $(XILINX_FLAGS) $< $@ $(PCD_FILE)
|
95 |
568 |
julius |
|
96 |
|
|
#This target uses Xilinx tools to generate a bitstream for download
|
97 |
|
|
$(BIT_FILE): $(PARRED_NCD)
|
98 |
|
|
@echo; echo "\t#### Generating .bit file ####";
|
99 |
638 |
stekern |
$(Q)bitgen -w $(XILINX_FLAGS) -g StartUpClk:JtagClk $< $@
|
100 |
568 |
julius |
|
101 |
|
|
$(BIT_FILE_FOR_SPI): $(PARRED_NCD)
|
102 |
|
|
@echo; echo "\t#### Generating .bit file for SPI load ####";
|
103 |
638 |
stekern |
$(Q)bitgen -w $(XILINX_FLAGS) -g StartUpClk:CClk $< $@
|
104 |
568 |
julius |
|
105 |
|
|
# Generate MCS with bootloader specified by user, if BOOTLOADER_BIN defined.
|
106 |
|
|
ifeq ($(BOOTLOADER_BIN),)
|
107 |
|
|
$(MCS_FILE): $(BIT_FILE_FOR_SPI)
|
108 |
|
|
@echo; echo "\t#### Generating .mcs file for SPI load ####";
|
109 |
638 |
stekern |
$(Q)promgen -spi -p mcs -w -o $@ -s $(SPI_FLASH_SIZE_KBYTES) -u 0 $<
|
110 |
568 |
julius |
else
|
111 |
|
|
$(MCS_FILE): $(BIT_FILE_FOR_SPI)
|
112 |
|
|
@echo; echo "\t#### Generating .mcs file with bootloader for SPI load ####";
|
113 |
638 |
stekern |
$(Q)promgen -spi -p mcs -w -o $@ -s $(SPI_FLASH_SIZE_KBYTES) -u 0 $< \
|
114 |
|
|
-data_file up $(SPI_BOOTLOADER_SW_OFFSET_HEX) $(BOOTLOADER_BIN)
|
115 |
568 |
julius |
endif
|
116 |
|
|
|
117 |
|
|
#this target downloads the bitstream to the target fpga
|
118 |
|
|
download: $(BIT_FILE) $(BATCH_FILE)
|
119 |
638 |
stekern |
$(Q)impact -batch $(BATCH_FILE)
|
120 |
568 |
julius |
|
121 |
|
|
#This target uses netgen to make a simulation netlist
|
122 |
|
|
netlist: $(PARRED_NCD)
|
123 |
|
|
@echo; echo "\t#### Generating netlist ####";
|
124 |
638 |
stekern |
$(Q)netgen -ofmt verilog -sim -dir netlist -pcf $(PCF_FILE) $<
|
125 |
568 |
julius |
|
126 |
|
|
#This one uses TRCE to make a timing report
|
127 |
|
|
timingreport: $(PARRED_NCD)
|
128 |
|
|
@echo; echo "\t#### Generating timing report ####";
|
129 |
638 |
stekern |
$(Q)trce $(TIMING_REPORT_OPTIONS) $<
|
130 |
568 |
julius |
|
131 |
|
|
|
132 |
|
|
clean:
|
133 |
|
|
$(Q)rm -rf *.* xlnx_auto* _xmsgs
|
134 |
|
|
|
135 |
|
|
clean-syn:
|
136 |
|
|
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) distclean
|
137 |
|
|
|
138 |
|
|
distclean: clean-syn clean
|
139 |
|
|
|
140 |
|
|
.PRECIOUS : $(PARRED_NCD) $(MAPPED_NCD) $(NGC_FILE) $(NGD_FILE) $(BIT_FILE) $(BIT_FILE_FOR_SPI)
|