1 |
628 |
stekern |
######################################################################
|
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=xc6slx45-2-csg324
|
47 |
|
|
ifeq ($(V), 1)
|
48 |
|
|
XILINX_FLAGS ?=
|
49 |
|
|
else
|
50 |
|
|
XILINX_FLAGS ?=-intstyle silent
|
51 |
|
|
endif
|
52 |
|
|
XILINX_MAP_FLAGS=-logic_opt off
|
53 |
|
|
XILINX_AREA_TARGET = speed
|
54 |
|
|
TIMING_REPORT_OPTIONS = -u 1000 -e 1000
|
55 |
|
|
SPI_FLASH_SIZE_KBYTES ?=16384
|
56 |
|
|
SPI_BOOTLOADER_SW_OFFSET_HEX ?=1c0000
|
57 |
|
|
|
58 |
|
|
print-config:
|
59 |
|
|
$(Q)echo; echo "\t### Backend make configuration ###"; echo
|
60 |
|
|
$(Q)echo "\tFPGA_PART="$(FPGA_PART)
|
61 |
|
|
$(Q)echo "\tXILINX_FLAGS="$(XILINX_FLAGS)
|
62 |
|
|
$(Q)echo "\tXILINX_MAP_FLAGS="$(XILINX_MAP_FLAGS)
|
63 |
|
|
$(Q)echo "\tXILINX_AREA_TARGET="$(XILINX_AREA_TARGET)
|
64 |
|
|
$(Q)echo "\tTIMING_REPORT_OPTIONS="$(TIMING_REPORT_OPTIONS)
|
65 |
|
|
$(Q)echo "\tSPI_FLASH_SIZE_KBYTES="$(SPI_FLASH_SIZE_KBYTES)
|
66 |
|
|
$(Q)echo "\tSPI_BOOTLOADER_SW_OFFSET_HEX="$(SPI_BOOTLOADER_SW_OFFSET_HEX)
|
67 |
|
|
|
68 |
|
|
NGC_FILE=$(BOARD_SYN_RUN_DIR)/$(DESIGN_NAME).ngc
|
69 |
|
|
NGD_FILE=$(DESIGN_NAME).ngd
|
70 |
|
|
UCF_FILE=../bin/$(BOARD_NAME).ucf
|
71 |
|
|
MAPPED_NCD=$(DESIGN_NAME)_mapped.ncd
|
72 |
|
|
PARRED_NCD=$(DESIGN_NAME).ncd
|
73 |
|
|
PCF_FILE=$(DESIGN_NAME).pcf
|
74 |
|
|
BIT_FILE=$(DESIGN_NAME).bit
|
75 |
|
|
BIT_FILE_FOR_SPI=$(DESIGN_NAME)_spiboot.bit
|
76 |
|
|
BATCH_FILE=$(DESIGN_NAME).batch
|
77 |
|
|
MCS_FILE=$(DESIGN_NAME).mcs
|
78 |
|
|
|
79 |
|
|
$(NGC_FILE):
|
80 |
|
|
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) $(DESIGN_NAME).ngc
|
81 |
|
|
|
82 |
|
|
$(NGD_FILE): $(UCF_FILE) $(NGC_FILE)
|
83 |
|
|
@echo; echo "\t#### Running NGDBuild ####";
|
84 |
638 |
stekern |
$(Q)ngdbuild -p $(FPGA_PART) -sd $(BOARD_BACKEND_BIN_DIR) \
|
85 |
|
|
-uc $(UCF_FILE) $(NGC_FILE) $@
|
86 |
628 |
stekern |
|
87 |
|
|
#This target uses Xilinx tools to perform Mapping
|
88 |
|
|
$(MAPPED_NCD): $(NGD_FILE)
|
89 |
|
|
@echo; echo "\t#### Mapping ####";
|
90 |
638 |
stekern |
$(Q)map -p $(FPGA_PART) -detail -pr b \
|
91 |
|
|
-timing -ol high -w $(XILINX_FLAGS) -o $@ -xe n $(NGD_FILE) $(PCF_FILE)
|
92 |
628 |
stekern |
|
93 |
|
|
#This target uses Xilinx tools to Place & Route the design
|
94 |
|
|
$(PARRED_NCD): $(MAPPED_NCD)
|
95 |
|
|
@echo; echo "\t#### PAR'ing ####";
|
96 |
638 |
stekern |
$(Q)par -w -ol high -xe n $(XILINX_FLAGS) $< $@ $(PCD_FILE)
|
97 |
628 |
stekern |
|
98 |
|
|
#This target uses Xilinx tools to generate a bitstream for download
|
99 |
|
|
$(BIT_FILE): $(PARRED_NCD)
|
100 |
|
|
@echo; echo "\t#### Generating .bit file ####";
|
101 |
638 |
stekern |
$(Q)bitgen -w $(XILINX_FLAGS) -g StartUpClk:JtagClk $< $@
|
102 |
628 |
stekern |
|
103 |
|
|
$(BIT_FILE_FOR_SPI): $(PARRED_NCD)
|
104 |
|
|
@echo; echo "\t#### Generating .bit file for SPI load ####";
|
105 |
638 |
stekern |
$(Q)bitgen -w $(XILINX_FLAGS) -g StartUpClk:CClk $< $@
|
106 |
628 |
stekern |
|
107 |
|
|
# Generate MCS with bootloader specified by user, if BOOTLOADER_BIN defined.
|
108 |
|
|
ifeq ($(BOOTLOADER_BIN),)
|
109 |
|
|
$(MCS_FILE): $(BIT_FILE_FOR_SPI)
|
110 |
|
|
@echo; echo "\t#### Generating .mcs file for SPI load ####";
|
111 |
638 |
stekern |
$(Q)promgen -spi -p mcs -w -o $@ -s $(SPI_FLASH_SIZE_KBYTES) -u 0 $<
|
112 |
628 |
stekern |
else
|
113 |
|
|
$(MCS_FILE): $(BIT_FILE_FOR_SPI)
|
114 |
|
|
@echo; echo "\t#### Generating .mcs file with bootloader for SPI load ####";
|
115 |
638 |
stekern |
$(Q)promgen -spi -p mcs -w -o $@ -s $(SPI_FLASH_SIZE_KBYTES) -u 0 $< \
|
116 |
|
|
-data_file up $(SPI_BOOTLOADER_SW_OFFSET_HEX) $(BOOTLOADER_BIN)
|
117 |
628 |
stekern |
endif
|
118 |
|
|
|
119 |
|
|
#this target downloads the bitstream to the target fpga
|
120 |
|
|
download: $(BIT_FILE) $(BATCH_FILE)
|
121 |
638 |
stekern |
$(Q)impact -batch $(BATCH_FILE)
|
122 |
628 |
stekern |
|
123 |
|
|
#This target uses netgen to make a simulation netlist
|
124 |
|
|
netlist: $(PARRED_NCD)
|
125 |
|
|
@echo; echo "\t#### Generating netlist ####";
|
126 |
638 |
stekern |
$(Q)netgen -ofmt verilog -sim -dir netlist -pcf $(PCF_FILE) $<
|
127 |
628 |
stekern |
|
128 |
|
|
#This one uses TRCE to make a timing report
|
129 |
|
|
timingreport: $(PARRED_NCD)
|
130 |
|
|
@echo; echo "\t#### Generating timing report ####";
|
131 |
638 |
stekern |
$(Q)trce $(TIMING_REPORT_OPTIONS) $<
|
132 |
628 |
stekern |
|
133 |
|
|
|
134 |
|
|
clean:
|
135 |
|
|
$(Q)rm -rf *.* xlnx_auto*
|
136 |
|
|
|
137 |
|
|
clean-syn:
|
138 |
|
|
$(Q)$(MAKE) -C $(BOARD_SYN_RUN_DIR) distclean
|
139 |
|
|
|
140 |
|
|
distclean: clean-syn clean
|
141 |
|
|
|
142 |
|
|
.PRECIOUS : $(PARRED_NCD) $(MAPPED_NCD) $(NGC_FILE) $(NGD_FILE) $(BIT_FILE) $(BIT_FILE_FOR_SPI)
|