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

Subversion Repositories dblclockfft

[/] [dblclockfft/] [trunk/] [sw/] [Makefile] - Blame information for rev 37

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 37 dgisselq
################################################################################
2 16 dgisselq
##
3 30 dgisselq
## Filename:    Makefile
4 16 dgisselq
##
5 37 dgisselq
## Project:     A General Purpose Pipelined FFT Implementation
6 16 dgisselq
##
7
## Purpose:     This is the main Makefile for the FFT core generator.
8
##              It is very simple in its construction, the most complicated
9 36 dgisselq
##      parts being the building of the Verilator simulation--a step that may
10
##      not be required for your project.
11 16 dgisselq
##
12 36 dgisselq
##      To build the FFT generator, just type 'make' on a line by itself.  For
13
##      a quick tutorial in how to run the generator, just type './fftgen -h'
14
##      to read the usage() statement.
15 16 dgisselq
##
16
## Creator:     Dan Gisselquist, Ph.D.
17 30 dgisselq
##              Gisselquist Technology, LLC
18 16 dgisselq
##
19 37 dgisselq
################################################################################
20 16 dgisselq
##
21 36 dgisselq
## Copyright (C) 2015,2018, Gisselquist Technology, LLC
22 16 dgisselq
##
23
## This program is free software (firmware): you can redistribute it and/or
24
## modify it under the terms of  the GNU General Public License as published
25
## by the Free Software Foundation, either version 3 of the License, or (at
26
## your option) any later version.
27
##
28
## This program is distributed in the hope that it will be useful, but WITHOUT
29
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
30
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31
## for more details.
32
##
33
## You should have received a copy of the GNU General Public License along
34 37 dgisselq
## with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
35 16 dgisselq
## target there if the PDF file isn't present.)  If not, see
36 37 dgisselq
##  for a copy.
37 16 dgisselq
##
38
## License:     GPL, v3, as defined and found on www.gnu.org,
39 37 dgisselq
##              http://www.gnu.org/licenses/gpl.html
40 16 dgisselq
##
41
##
42 37 dgisselq
################################################################################
43 16 dgisselq
##
44
##
45 2 dgisselq
# This is really simple ...
46
all: fftgen
47 36 dgisselq
CORED := ../rtl
48
VOBJDR  := $(CORED)/obj_dir
49
OBJDIR   := obj-pc
50
BENCHD  := ../bench/cpp
51
SOURCES := bitreverse.cpp bldstage.cpp butterfly.cpp fftgen.cpp fftlib.cpp \
52
                legal.cpp rounding.cpp softmpy.cpp
53
TESTSZ  := -f 2048
54 37 dgisselq
CKPCE   := -1 -k 1
55
# CKPCE   := -2
56 36 dgisselq
MPYS    := -p 0
57
IWID    := -n 15
58
FFTPARAMS := -d $(CORED) $(TESTSZ) $(CKPCE) $(MPYS) $(IWID)
59
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
60
HEADERS := $(wildcard *.h)
61 35 dgisselq
ifneq ($(VERILATOR_ROOT),)
62
VERILATOR:=$(VERILATOR_ROOT)/bin/verilator
63
else
64
VERILATOR:=verilator
65
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
66
endif
67
export  $(VERILATOR)
68
VROOT   := $(VERILATOR_ROOT)
69 36 dgisselq
VFLAGS  := -Wall -O3 -MMD --trace -cc
70
CFLAGS  := -g -Wall
71 2 dgisselq
 
72 36 dgisselq
$(OBJDIR)/%.o: %.cpp
73
        $(mk-objdir)
74
        $(CXX) -c $(CFLAGS) $< -o $@
75 2 dgisselq
 
76 36 dgisselq
fftgen: $(OBJECTS)
77
        $(CXX) $(CFLAGS) $^ -o $@
78 2 dgisselq
 
79 5 dgisselq
.PHONY: test
80 36 dgisselq
test: fft ifft butterfly fftstage hwbfly shiftaddmpy longbimpy qtrstage
81
test: bitreverse laststage
82 3 dgisselq
 
83 16 dgisselq
#
84
# Although these parameters, a 2048 point FFT of 16 bits input, aren't
85
# the only parameters the FFT can do, they are the ones that the test
86
# benches depend upon.  If you change these, and you are welcome to do so,
87
# you may need to adjust the test benches if you wish to prove that your
88
# changes work.
89
#
90 36 dgisselq
.PHONY: fft forcedfft
91
fft: $(VOBJDR)/Vfftmain__ALL.so
92
$(CORED)/fftmain.v: fftgen
93
        ./fftgen -v $(FFTPARAMS) -a $(BENCHD)/fftsize.h
94
forcedfft: fftgen
95
        ./fftgen -v $(FFTPARAMS) -a $(BENCHD)/fftsize.h
96
$(VOBJDR)/Vfftmain.h: $(CORED)/fftmain.v
97 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) fftmain.v
98 36 dgisselq
$(VOBJDR)/Vfftmain__ALL.so: $(VOBJDR)/Vfftmain.h
99
        cd $(VOBJDR); make -f Vfftmain.mk
100 3 dgisselq
 
101 36 dgisselq
.PHONY: dblfft
102
dblfft: $(VOBJDR)/Vdblfftmain__ALL.so
103
$(CORED)/dblfftmain.v: fftgen
104
        ./fftgen -v $(FFTPARAMS) -a $(BENCHD)/fftsize.h
105
$(VOBJDR)/Vdblfftmain.h: $(CORED)/dblfftmain.v
106
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) dblfftmain.v
107
$(VOBJDR)/Vdblfftmain__ALL.so: $(VOBJDR)/Vdblfftmain.h
108
        cd $(VOBJDR); make -f Vdblfftmain.mk
109
 
110
.PHONY: idblfft
111
idblfft: $(VOBJDR)/Vidblfftmain__ALL.so
112
$(CORED)/idblfftmain.v: fftgen
113
        ./fftgen -i $(FFTPARAMS) -a $(BENCHD)/ifftsize.h
114
$(VOBJDR)/Vidblfftmain.h: $(CORED)/idblfftmain.v
115
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) idblfftmain.v
116
$(VOBJDR)/Vidblfftmain__ALL.so: $(VOBJDR)/Vidblfftmain.h
117
        cd $(VOBJDR); make -f Vidblfftmain.mk
118
 
119 5 dgisselq
.PHONY: ifft
120 36 dgisselq
ifft: $(VOBJDR)/Vifftmain__ALL.so
121
$(CORED)/ifftmain.v: fftgen
122
        ./fftgen -i $(FFTPARAMS) -a $(BENCHD)/ifftsize.h
123
$(VOBJDR)/Vifftmain.h: $(CORED)/ifftmain.v
124 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) ifftmain.v
125 36 dgisselq
$(VOBJDR)/Vifftmain__ALL.so: $(VOBJDR)/Vifftmain.h
126
        cd $(VOBJDR); make -f Vifftmain.mk
127 2 dgisselq
 
128 3 dgisselq
.PHONY: shiftaddmpy
129 36 dgisselq
shiftaddmpy: $(VOBJDR)/Vshiftaddmpy__ALL.a
130 3 dgisselq
 
131 6 dgisselq
$(CORED)/shiftaddmpy.v: fft
132 36 dgisselq
$(VOBJDR)/Vshiftaddmpy.cpp $(VOBJDR)/Vshiftaddmpy.h: $(CORED)/shiftaddmpy.v
133 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) shiftaddmpy.v
134 36 dgisselq
$(VOBJDR)/Vshiftaddmpy__ALL.a: $(VOBJDR)/Vshiftaddmpy.h
135
$(VOBJDR)/Vshiftaddmpy__ALL.a: $(VOBJDR)/Vshiftaddmpy.cpp
136
        cd $(VOBJDR)/; make -f Vshiftaddmpy.mk
137 2 dgisselq
 
138 29 dgisselq
.PHONY: longbimpy
139 36 dgisselq
longbimpy: $(VOBJDR)/Vlongbimpy__ALL.a
140 29 dgisselq
 
141
$(CORED)/longbimpy.v: fft
142 36 dgisselq
$(VOBJDR)/Vlongbimpy.cpp $(VOBJDR)/Vlongbimpy.h: $(CORED)/longbimpy.v
143 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) longbimpy.v
144 36 dgisselq
$(VOBJDR)/Vlongbimpy__ALL.a: $(VOBJDR)/Vlongbimpy.h
145
$(VOBJDR)/Vlongbimpy__ALL.a: $(VOBJDR)/Vlongbimpy.cpp
146
        cd $(VOBJDR)/; make -f Vlongbimpy.mk
147 29 dgisselq
 
148 3 dgisselq
.PHONY: butterfly
149 36 dgisselq
butterfly: $(VOBJDR)/Vbutterfly__ALL.a
150 3 dgisselq
 
151 5 dgisselq
$(CORED)/butterfly.v: fft
152 36 dgisselq
$(VOBJDR)/Vbutterfly.cpp $(VOBJDR)/Vbutterfly.h: $(CORED)/butterfly.v
153 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) butterfly.v
154 36 dgisselq
$(VOBJDR)/Vbutterfly__ALL.a: $(VOBJDR)/Vbutterfly.h
155
$(VOBJDR)/Vbutterfly__ALL.a: $(VOBJDR)/Vbutterfly.cpp
156
        cd $(VOBJDR)/; make -f Vbutterfly.mk
157 2 dgisselq
 
158 22 dgisselq
.PHONY: hwbfly
159 36 dgisselq
hwbfly: $(VOBJDR)/Vhwbfly__ALL.a
160 22 dgisselq
 
161
$(CORED)/hwbfly.v: fft
162 36 dgisselq
$(VOBJDR)/Vhwbfly.cpp $(VOBJDR)/Vhwbfly.h: $(CORED)/hwbfly.v
163 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) hwbfly.v
164 36 dgisselq
$(VOBJDR)/Vhwbfly__ALL.a: $(VOBJDR)/Vhwbfly.h
165
$(VOBJDR)/Vhwbfly__ALL.a: $(VOBJDR)/Vhwbfly.cpp
166
        cd $(VOBJDR)/; make -f Vhwbfly.mk
167 22 dgisselq
 
168 36 dgisselq
.PHONY: bitreverse
169
bitreverse: $(VOBJDR)/Vbitreverse__ALL.a
170 3 dgisselq
 
171 36 dgisselq
$(CORED)/bitreverse.v: fft
172
$(VOBJDR)/Vbitreverse.cpp $(VOBJDR)/Vbitreverse.h: $(CORED)/bitreverse.v
173
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) bitreverse.v
174
$(VOBJDR)/Vbitreverse__ALL.a: $(VOBJDR)/Vbitreverse.h
175
$(VOBJDR)/Vbitreverse__ALL.a: $(VOBJDR)/Vbitreverse.cpp
176
        cd $(VOBJDR)/; make -f Vbitreverse.mk
177 2 dgisselq
 
178 3 dgisselq
.PHONY: qtrstage
179 36 dgisselq
qtrstage: $(VOBJDR)/Vqtrstage__ALL.a
180 3 dgisselq
 
181 5 dgisselq
$(CORED)/qtrstage.v: fft
182 36 dgisselq
$(VOBJDR)/Vqtrstage.cpp $(VOBJDR)/Vqtrstage.h: $(CORED)/qtrstage.v
183 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) qtrstage.v
184 36 dgisselq
$(VOBJDR)/Vqtrstage__ALL.a: $(VOBJDR)/Vqtrstage.h
185
$(VOBJDR)/Vqtrstage__ALL.a: $(VOBJDR)/Vqtrstage.cpp
186
        cd $(VOBJDR)/; make -f Vqtrstage.mk
187 2 dgisselq
 
188 3 dgisselq
.PHONY: dblstage
189 36 dgisselq
dblstage: $(VOBJDR)/Vdblstage__ALL.a
190 3 dgisselq
 
191 5 dgisselq
$(CORED)/dblstage.v: fft
192 36 dgisselq
$(VOBJDR)/Vdblstage.cpp $(VOBJDR)/Vdblstage.h: $(CORED)/dblstage.v
193 35 dgisselq
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) dblstage.v
194 36 dgisselq
$(VOBJDR)/Vdblstage__ALL.a: $(VOBJDR)/Vdblstage.h
195
$(VOBJDR)/Vdblstage__ALL.a: $(VOBJDR)/Vdblstage.cpp
196
        cd $(VOBJDR)/; make -f Vdblstage.mk
197 2 dgisselq
 
198 36 dgisselq
.PHONY: laststage
199
laststage: $(VOBJDR)/Vlaststage__ALL.a
200 6 dgisselq
 
201 36 dgisselq
$(CORED)/laststage.v: fft
202
$(VOBJDR)/Vlaststage.cpp $(VOBJDR)/Vlaststage.h: $(CORED)/laststage.v
203
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) laststage.v
204
$(VOBJDR)/Vlaststage__ALL.a: $(VOBJDR)/Vlaststage.h
205
$(VOBJDR)/Vlaststage__ALL.a: $(VOBJDR)/Vlaststage.cpp
206
        cd $(VOBJDR)/; make -f Vlaststage.mk
207 6 dgisselq
 
208 36 dgisselq
.PHONY: fftstage
209
fftstage: $(VOBJDR)/Vfftstage__ALL.a
210
 
211
$(CORED)/fftstage.v: fft
212
$(VOBJDR)/Vfftstage.cpp $(VOBJDR)/Vfftstage.h: $(CORED)/fftstage.v
213
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) fftstage.v
214
$(VOBJDR)/Vfftstage__ALL.a: $(VOBJDR)/Vfftstage.h
215
$(VOBJDR)/Vfftstage__ALL.a: $(VOBJDR)/Vfftstage.cpp
216
        cd $(VOBJDR)/; make -f Vfftstage.mk
217
 
218
 
219 5 dgisselq
.PHONY: clean
220 2 dgisselq
clean:
221 37 dgisselq
        rm -rf fft-core/
222
        rm -rf fftgen $(OBJDIR)/
223 36 dgisselq
        rm -rf $(CORED)/obj_dir
224
        rm -rf $(CORED)/fftmain.v $(CORED)/fftstage.v
225 37 dgisselq
        rm -rf $(CORED)/ifftmain.v $(CORED)/ifftstage.v
226 36 dgisselq
        rm -rf $(CORED)/qtrstage.v $(CORED)/laststage.v $(CORED)/bitreverse.v
227
        rm -rf $(CORED)/butterfly.v $(CORED)/hwbfly.v
228
        rm -rf $(CORED)/longbimpy.v $(CORED)/bimpy.v
229
        rm -rf $(CORED)/convround.v
230 37 dgisselq
        rm -rf $(CORED)/*cmem_*.hex
231 2 dgisselq
 
232 36 dgisselq
#
233
# The "depends" target, to know what files things depend upon.  The depends
234
# file itself is kept in $(OBJDIR)/depends.txt
235
#
236
define  build-depends
237
        $(mk-objdir)
238
        @echo "Building dependency file"
239
        @$(CXX) $(CFLAGS) $(INCS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
240
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
241
        @rm $(OBJDIR)/xdepends.txt
242
endef
243 2 dgisselq
 
244 36 dgisselq
.PHONY: depends
245
depends: tags
246
        $(build-depends)
247
 
248
$(OBJDIR)/depends.txt: depends
249
 
250
#
251
# Make a directory to hold all of the FFT-gen (i.e. the C++) build products
252
# (object files)
253
#
254
define  mk-objdir
255
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
256
endef
257
 
258
#
259
# The "tags" target
260
#
261
tags:   $(SOURCES) $(HEADERS)
262
        @echo "Generating tags"
263
        @ctags $(SOURCES) $(HEADERS)
264
 
265 37 dgisselq
ifneq ($(MAKECMDGOALS),clean)
266 36 dgisselq
-include $(OBJDIR)/depends.txt
267 37 dgisselq
endif

powered by: WebSVN 2.1.0

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