1 |
3 |
rozpruwacz |
######################################################################
|
2 |
|
|
#### ####
|
3 |
|
|
#### WISHBONE SD Card Controller IP Core ####
|
4 |
|
|
#### ####
|
5 |
|
|
#### Makefile ####
|
6 |
|
|
#### ####
|
7 |
|
|
#### This file is part of the WISHBONE SD Card ####
|
8 |
|
|
#### Controller IP Core project ####
|
9 |
|
|
#### http://www.opencores.org/cores/xxx/ ####
|
10 |
|
|
#### ####
|
11 |
|
|
#### Description ####
|
12 |
|
|
#### Altera synthesis makefile ####
|
13 |
|
|
#### ####
|
14 |
|
|
#### Author(s): ####
|
15 |
|
|
#### - Marek Czerski, ma.czerski@gmail.com ####
|
16 |
|
|
#### ####
|
17 |
|
|
######################################################################
|
18 |
|
|
#### ####
|
19 |
|
|
#### Copyright (C) 2013 Authors ####
|
20 |
|
|
#### ####
|
21 |
|
|
#### Based on original work by ####
|
22 |
|
|
#### Stefan Kristiansson, stefan.kristiansson@saunalahti.fi ####
|
23 |
|
|
#### ####
|
24 |
|
|
#### Copyright (C) 2009,2010,2011 Authors and OPENCORES.ORG ####
|
25 |
|
|
#### ####
|
26 |
|
|
#### This source file may be used and distributed without ####
|
27 |
|
|
#### restriction provided that this copyright statement is not ####
|
28 |
|
|
#### removed from the file and that any derivative work contains ####
|
29 |
|
|
#### the original copyright notice and the associated disclaimer. ####
|
30 |
|
|
#### ####
|
31 |
|
|
#### This source file is free software; you can redistribute it ####
|
32 |
|
|
#### and/or modify it under the terms of the GNU Lesser General ####
|
33 |
|
|
#### Public License as published by the Free Software Foundation; ####
|
34 |
|
|
#### either version 2.1 of the License, or (at your option) any ####
|
35 |
|
|
#### later version. ####
|
36 |
|
|
#### ####
|
37 |
|
|
#### This source is distributed in the hope that it will be ####
|
38 |
|
|
#### useful, but WITHOUT ANY WARRANTY; without even the implied ####
|
39 |
|
|
#### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ####
|
40 |
|
|
#### PURPOSE. See the GNU Lesser General Public License for more ####
|
41 |
|
|
#### details. ####
|
42 |
|
|
#### ####
|
43 |
|
|
#### You should have received a copy of the GNU Lesser General ####
|
44 |
|
|
#### Public License along with this source; if not, download it ####
|
45 |
|
|
#### from http://www.opencores.org/lgpl.shtml ####
|
46 |
|
|
#### ####
|
47 |
|
|
######################################################################
|
48 |
|
|
|
49 |
|
|
V ?= @
|
50 |
|
|
|
51 |
|
|
QUARTUS_DIR ?= /opt/altera/11.0/quartus
|
52 |
|
|
|
53 |
|
|
QUARTUS = $(QUARTUS_DIR)/bin/quartus
|
54 |
|
|
SH = $(QUARTUS_DIR)/bin/quartus_sh
|
55 |
|
|
PGM = $(QUARTUS_DIR)/bin/quartus_pgm
|
56 |
|
|
STA = $(QUARTUS_DIR)/bin/quartus_sta
|
57 |
|
|
ASM = $(QUARTUS_DIR)/bin/quartus_asm
|
58 |
|
|
FIT = $(QUARTUS_DIR)/bin/quartus_fit
|
59 |
|
|
MAP = $(QUARTUS_DIR)/bin/quartus_map
|
60 |
|
|
|
61 |
|
|
RUN_DIR=$(shell pwd)
|
62 |
|
|
BIN_DIR=$(RUN_DIR)/../bin
|
63 |
|
|
|
64 |
|
|
RTL_TOP ?= sdc_controller_top
|
65 |
|
|
DESIGN_NAME ?= sdc_controller
|
66 |
|
|
FPGA_FAMILY ?= "Cyclone IV E"
|
67 |
|
|
FPGA_PART ?= EP4CE40F29C8
|
68 |
|
|
|
69 |
|
|
RTL_VERILOG_SRC = $(shell ls ../../../rtl/verilog/*.v ../src/*.v)
|
70 |
|
|
RTL_VERILOG_INCLUDE_DIR = ../../../rtl/verilog
|
71 |
|
|
|
72 |
|
|
TCL_FILE=$(DESIGN_NAME).tcl
|
73 |
|
|
SDC_FILE=$(DESIGN_NAME).sdc
|
74 |
|
|
QPF_FILE=$(DESIGN_NAME).qpf
|
75 |
|
|
|
76 |
|
|
all: sta
|
77 |
|
|
|
78 |
|
|
$(TCL_FILE): $(BIN_DIR)/pin_assignments.tcl $(RTL_VERILOG_SRC) $(BOARD_BACKEND_VERILOG_SRC) $(RTL_VHDL_SRC)
|
79 |
|
|
$(V)echo; echo "#### Generating TCL file ####"; echo
|
80 |
|
|
$(V)echo "# TCL Script for SD Controller Synthesis" > $@
|
81 |
|
|
$(V)echo "# This file is autogenerated - any changes will be overwritten" >> $@
|
82 |
|
|
$(V)echo "# See the Makefile in syn/quartus/bin to make changes" >> $@
|
83 |
|
|
$(V)echo "project_new $(DESIGN_NAME) -overwrite" >> $@
|
84 |
|
|
$(V)echo "set_global_assignment -name FAMILY \"$(FPGA_FAMILY)\"" >> $@
|
85 |
|
|
$(V)echo "set_global_assignment -name DEVICE $(FPGA_PART)" >> $@
|
86 |
|
|
$(V)echo "set_global_assignment -name TOP_LEVEL_ENTITY $(RTL_TOP)" >> $@
|
87 |
|
|
|
88 |
|
|
$(V)for file in $(RTL_VERILOG_SRC); do \
|
89 |
|
|
echo "set_global_assignment -name VERILOG_FILE $$file" >> $@ ; \
|
90 |
|
|
done
|
91 |
|
|
$(V)for file in $(BOARD_BACKEND_VERILOG_SRC); do \
|
92 |
|
|
echo "set_global_assignment -name VERILOG_FILE $$file" >> $@ ; \
|
93 |
|
|
done
|
94 |
|
|
$(V)for file in $(RTL_VHDL_SRC); do \
|
95 |
|
|
echo "set_global_assignment -name VHDL_FILE $$file" >> $@ ; \
|
96 |
|
|
done
|
97 |
|
|
$(V)echo "set_global_assignment -name SEARCH_PATH $(RTL_VERILOG_INCLUDE_DIR)" >> $@
|
98 |
|
|
$(V)echo "set_global_assignment -name SDC_FILE $(DESIGN_NAME).sdc" >> $@
|
99 |
|
|
# Do pin assignments
|
100 |
|
|
$(V)if [ -f $(BIN_DIR)/pin_assignments.tcl ]; then \
|
101 |
|
|
cat $(BIN_DIR)/pin_assignments.tcl >> $@ ; \
|
102 |
|
|
fi;
|
103 |
|
|
$(V)echo "project_close" >> $@
|
104 |
|
|
$(V)echo
|
105 |
|
|
|
106 |
|
|
$(SDC_FILE): $(BIN_DIR)/constraints.sdc
|
107 |
|
|
$(V)echo; echo "#### Generating SDC file ####"; echo
|
108 |
|
|
$(V)echo "# SDC file for SD Controller" > $@
|
109 |
|
|
$(V)echo "# This file is autogenerated - any changes will be overwritten" >> $@
|
110 |
|
|
$(V)echo "# See the Makefile in syn/quartus/bin to make changes" >> $@
|
111 |
|
|
$(V)if [ -f $(BIN_DIR)/constraints.sdc ]; then \
|
112 |
|
|
cat $(BIN_DIR)/constraints.sdc >> $@ ; \
|
113 |
|
|
fi;
|
114 |
|
|
$(V)echo
|
115 |
|
|
|
116 |
|
|
$(QPF_FILE): $(TCL_FILE) $(SDC_FILE)
|
117 |
|
|
$(V) echo "#### Generating project files ####"
|
118 |
|
|
$(V)$(SH) -t $(TCL_FILE)
|
119 |
|
|
|
120 |
|
|
project: $(QPF_FILE)
|
121 |
|
|
|
122 |
|
|
quartus: $(QPF_FILE)
|
123 |
|
|
$(V)$(QUARTUS) $(QPF_FILE)
|
124 |
|
|
|
125 |
|
|
pgm:
|
126 |
|
|
$(V)$(PGM) --mode=jtag -o p\;$(DESIGN_NAME).sof
|
127 |
|
|
|
128 |
|
|
sta: asm
|
129 |
|
|
$(V)$(STA) $(DESIGN_NAME)
|
130 |
|
|
|
131 |
|
|
asm: fit
|
132 |
|
|
$(V)$(ASM) $(DESIGN_NAME)
|
133 |
|
|
|
134 |
|
|
fit: map
|
135 |
|
|
$(V)$(FIT) $(DESIGN_NAME)
|
136 |
|
|
|
137 |
|
|
map: project
|
138 |
|
|
$(V)$(MAP) $(DESIGN_NAME)
|
139 |
|
|
|
140 |
|
|
print_config:
|
141 |
|
|
$(V)echo; echo "### Synthesis make configuration ###"; echo
|
142 |
|
|
$(V)echo "FPGA_FAMILY="$(FPGA_FAMILY)
|
143 |
|
|
$(V)echo "FPGA_PART="$(FPGA_PART)
|
144 |
|
|
$(V)echo
|
145 |
|
|
|
146 |
|
|
print_rtl_sources:
|
147 |
|
|
$(V)echo $(RTL_VERILOG_SRC)
|
148 |
|
|
|
149 |
|
|
clean:
|
150 |
|
|
rm -rf *.* db incremental_db
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
|