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

Subversion Repositories dblclockfft

[/] [dblclockfft/] [trunk/] [sw/] [Makefile] - Diff between revs 35 and 36

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 35 Rev 36
Line 1... Line 1...
############################################################################/
############################################################################/
##
##
## Filename:    Makefile
## Filename:    Makefile
##
##
## Project:     A Doubletime Pipelined FFT
## Project:     A Generic Pipelined FFT Implementation
##
##
## Purpose:     This is the main Makefile for the FFT core generator.
## Purpose:     This is the main Makefile for the FFT core generator.
##              It is very simple in its construction, the most complicated
##              It is very simple in its construction, the most complicated
##              parts being the building of the Verilator simulation--a
##      parts being the building of the Verilator simulation--a step that may
##              step that may not be required for your project.
##      not be required for your project.
##
##
##              To build the FFT generator, just type 'make' on a line
##      To build the FFT generator, just type 'make' on a line by itself.  For
##              by itself.  For a quick tutorial in how to run the
##      a quick tutorial in how to run the generator, just type './fftgen -h'
##              generator, just type './fftgen -h' to read the usage()
##      to read the usage() statement.
##              statement.
 
##
##
## Creator:     Dan Gisselquist, Ph.D.
## Creator:     Dan Gisselquist, Ph.D.
##              Gisselquist Technology, LLC
##              Gisselquist Technology, LLC
##
##
##########################################################################/
##########################################################################/
##
##
## Copyright (C) 2015, Gisselquist Technology, LLC
## Copyright (C) 2015,2018, Gisselquist Technology, LLC
##
##
## This program is free software (firmware): you can redistribute it and/or
## This program is free software (firmware): you can redistribute it and/or
## modify it under the terms of  the GNU General Public License as published
## modify it under the terms of  the GNU General Public License as published
## by the Free Software Foundation, either version 3 of the License, or (at
## by the Free Software Foundation, either version 3 of the License, or (at
## your option) any later version.
## your option) any later version.
Line 43... Line 42...
##########################################################################/
##########################################################################/
##
##
##
##
# This is really simple ...
# This is really simple ...
all: fftgen
all: fftgen
CORED := fft-core
CORED := ../rtl
OBJDR := $(CORED)/obj_dir
VOBJDR  := $(CORED)/obj_dir
TESTSZ := 2048
OBJDIR   := obj-pc
BENCHD := ../bench/cpp
BENCHD := ../bench/cpp
 
SOURCES := bitreverse.cpp bldstage.cpp butterfly.cpp fftgen.cpp fftlib.cpp \
 
                legal.cpp rounding.cpp softmpy.cpp
 
TESTSZ  := -f 2048
 
# CKPCE   := -k 1
 
CKPCE   := -2
 
MPYS    := -p 0
 
IWID    := -n 15
 
FFTPARAMS := -d $(CORED) $(TESTSZ) $(CKPCE) $(MPYS) $(IWID)
 
OBJECTS := $(addprefix $(OBJDIR)/,$(subst .cpp,.o,$(SOURCES)))
 
HEADERS := $(wildcard *.h)
ifneq ($(VERILATOR_ROOT),)
ifneq ($(VERILATOR_ROOT),)
VERILATOR:=$(VERILATOR_ROOT)/bin/verilator
VERILATOR:=$(VERILATOR_ROOT)/bin/verilator
else
else
VERILATOR:=verilator
VERILATOR:=verilator
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
VERILATOR_ROOT ?= $(shell bash -c 'verilator -V|grep VERILATOR_ROOT | head -1 | sed -e " s/^.*=\s*//"')
endif
endif
export  $(VERILATOR)
export  $(VERILATOR)
VROOT   := $(VERILATOR_ROOT)
VROOT   := $(VERILATOR_ROOT)
VFLAGS  := -Wall -MMD --trace -cc
VFLAGS  := -Wall -O3 -MMD --trace -cc
 
CFLAGS  := -g -Wall
 
 
fftgen: fftgen.o
$(OBJDIR)/%.o: %.cpp
        $(CXX) $< -o $@
        $(mk-objdir)
 
        $(CXX) -c $(CFLAGS) $< -o $@
 
 
%.o: %.cpp
fftgen: $(OBJECTS)
        $(CXX) -c $< -o $@
        $(CXX) $(CFLAGS) $^ -o $@
 
 
.PHONY: test
.PHONY: test
test: fft ifft butterfly dblreverse qtrstage dblstage fftstage_o2048
test: fft ifft butterfly fftstage hwbfly shiftaddmpy longbimpy qtrstage
test: hwbfly shiftaddmpy longbimpy
test: bitreverse laststage
 
 
#
#
# Although these parameters, a 2048 point FFT of 16 bits input, aren't
# Although these parameters, a 2048 point FFT of 16 bits input, aren't
# the only parameters the FFT can do, they are the ones that the test
# the only parameters the FFT can do, they are the ones that the test
# benches depend upon.  If you change these, and you are welcome to do so,
# benches depend upon.  If you change these, and you are welcome to do so,
# you may need to adjust the test benches if you wish to prove that your
# you may need to adjust the test benches if you wish to prove that your
# changes work.
# changes work.
#
#
.PHONY: fft
.PHONY: fft forcedfft
fft: fftgen
fft: $(VOBJDR)/Vfftmain__ALL.so
        ./fftgen -f $(TESTSZ) -n 16 -p 6 -a $(BENCHD)/fftsize.h
$(CORED)/fftmain.v: fftgen
 
        ./fftgen -v $(FFTPARAMS) -a $(BENCHD)/fftsize.h
 
forcedfft: fftgen
 
        ./fftgen -v $(FFTPARAMS) -a $(BENCHD)/fftsize.h
 
$(VOBJDR)/Vfftmain.h: $(CORED)/fftmain.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) fftmain.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) fftmain.v
        cd $(OBJDR); make -f Vfftmain.mk
$(VOBJDR)/Vfftmain__ALL.so: $(VOBJDR)/Vfftmain.h
 
        cd $(VOBJDR); make -f Vfftmain.mk
 
 
 
.PHONY: dblfft
 
dblfft: $(VOBJDR)/Vdblfftmain__ALL.so
 
$(CORED)/dblfftmain.v: fftgen
 
        ./fftgen -v $(FFTPARAMS) -a $(BENCHD)/fftsize.h
 
$(VOBJDR)/Vdblfftmain.h: $(CORED)/dblfftmain.v
 
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) dblfftmain.v
 
$(VOBJDR)/Vdblfftmain__ALL.so: $(VOBJDR)/Vdblfftmain.h
 
        cd $(VOBJDR); make -f Vdblfftmain.mk
 
 
 
.PHONY: idblfft
 
idblfft: $(VOBJDR)/Vidblfftmain__ALL.so
 
$(CORED)/idblfftmain.v: fftgen
 
        ./fftgen -i $(FFTPARAMS) -a $(BENCHD)/ifftsize.h
 
$(VOBJDR)/Vidblfftmain.h: $(CORED)/idblfftmain.v
 
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) idblfftmain.v
 
$(VOBJDR)/Vidblfftmain__ALL.so: $(VOBJDR)/Vidblfftmain.h
 
        cd $(VOBJDR); make -f Vidblfftmain.mk
 
 
.PHONY: ifft
.PHONY: ifft
ifft: fftgen
ifft: $(VOBJDR)/Vifftmain__ALL.so
        ./fftgen -f $(TESTSZ) -i -n 22  -p 6 -a $(BENCHD)/ifftsize.h
$(CORED)/ifftmain.v: fftgen
 
        ./fftgen -i $(FFTPARAMS) -a $(BENCHD)/ifftsize.h
 
$(VOBJDR)/Vifftmain.h: $(CORED)/ifftmain.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) ifftmain.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) ifftmain.v
        cd $(OBJDR); make -f Vifftmain.mk
$(VOBJDR)/Vifftmain__ALL.so: $(VOBJDR)/Vifftmain.h
 
        cd $(VOBJDR); make -f Vifftmain.mk
 
 
.PHONY: shiftaddmpy
.PHONY: shiftaddmpy
shiftaddmpy: $(OBJDR)/Vshiftaddmpy__ALL.a
shiftaddmpy: $(VOBJDR)/Vshiftaddmpy__ALL.a
 
 
$(CORED)/shiftaddmpy.v: fft
$(CORED)/shiftaddmpy.v: fft
$(OBJDR)/Vshiftaddmpy.cpp $(OBJDR)/Vshiftaddmpy.h: $(CORED)/shiftaddmpy.v
$(VOBJDR)/Vshiftaddmpy.cpp $(VOBJDR)/Vshiftaddmpy.h: $(CORED)/shiftaddmpy.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) shiftaddmpy.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) shiftaddmpy.v
$(OBJDR)/Vshiftaddmpy__ALL.a: $(OBJDR)/Vshiftaddmpy.h
$(VOBJDR)/Vshiftaddmpy__ALL.a: $(VOBJDR)/Vshiftaddmpy.h
$(OBJDR)/Vshiftaddmpy__ALL.a: $(OBJDR)/Vshiftaddmpy.cpp
$(VOBJDR)/Vshiftaddmpy__ALL.a: $(VOBJDR)/Vshiftaddmpy.cpp
        cd $(OBJDR)/; make -f Vshiftaddmpy.mk
        cd $(VOBJDR)/; make -f Vshiftaddmpy.mk
 
 
.PHONY: longbimpy
.PHONY: longbimpy
longbimpy: $(OBJDR)/Vlongbimpy__ALL.a
longbimpy: $(VOBJDR)/Vlongbimpy__ALL.a
 
 
$(CORED)/longbimpy.v: fft
$(CORED)/longbimpy.v: fft
$(OBJDR)/Vlongbimpy.cpp $(OBJDR)/Vlongbimpy.h: $(CORED)/longbimpy.v
$(VOBJDR)/Vlongbimpy.cpp $(VOBJDR)/Vlongbimpy.h: $(CORED)/longbimpy.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) longbimpy.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) longbimpy.v
$(OBJDR)/Vlongbimpy__ALL.a: $(OBJDR)/Vlongbimpy.h
$(VOBJDR)/Vlongbimpy__ALL.a: $(VOBJDR)/Vlongbimpy.h
$(OBJDR)/Vlongbimpy__ALL.a: $(OBJDR)/Vlongbimpy.cpp
$(VOBJDR)/Vlongbimpy__ALL.a: $(VOBJDR)/Vlongbimpy.cpp
        cd $(OBJDR)/; make -f Vlongbimpy.mk
        cd $(VOBJDR)/; make -f Vlongbimpy.mk
 
 
.PHONY: butterfly
.PHONY: butterfly
butterfly: $(OBJDR)/Vbutterfly__ALL.a
butterfly: $(VOBJDR)/Vbutterfly__ALL.a
 
 
$(CORED)/butterfly.v: fft
$(CORED)/butterfly.v: fft
$(OBJDR)/Vbutterfly.cpp $(OBJDR)/Vbutterfly.h: $(CORED)/butterfly.v
$(VOBJDR)/Vbutterfly.cpp $(VOBJDR)/Vbutterfly.h: $(CORED)/butterfly.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) butterfly.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) butterfly.v
$(OBJDR)/Vbutterfly__ALL.a: $(OBJDR)/Vbutterfly.h
$(VOBJDR)/Vbutterfly__ALL.a: $(VOBJDR)/Vbutterfly.h
$(OBJDR)/Vbutterfly__ALL.a: $(OBJDR)/Vbutterfly.cpp
$(VOBJDR)/Vbutterfly__ALL.a: $(VOBJDR)/Vbutterfly.cpp
        cd $(OBJDR)/; make -f Vbutterfly.mk
        cd $(VOBJDR)/; make -f Vbutterfly.mk
 
 
.PHONY: hwbfly
.PHONY: hwbfly
hwbfly: $(OBJDR)/Vhwbfly__ALL.a
hwbfly: $(VOBJDR)/Vhwbfly__ALL.a
 
 
$(CORED)/hwbfly.v: fft
$(CORED)/hwbfly.v: fft
$(OBJDR)/Vhwbfly.cpp $(OBJDR)/Vhwbfly.h: $(CORED)/hwbfly.v
$(VOBJDR)/Vhwbfly.cpp $(VOBJDR)/Vhwbfly.h: $(CORED)/hwbfly.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) hwbfly.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) hwbfly.v
$(OBJDR)/Vhwbfly__ALL.a: $(OBJDR)/Vhwbfly.h
$(VOBJDR)/Vhwbfly__ALL.a: $(VOBJDR)/Vhwbfly.h
$(OBJDR)/Vhwbfly__ALL.a: $(OBJDR)/Vhwbfly.cpp
$(VOBJDR)/Vhwbfly__ALL.a: $(VOBJDR)/Vhwbfly.cpp
        cd $(OBJDR)/; make -f Vhwbfly.mk
        cd $(VOBJDR)/; make -f Vhwbfly.mk
 
 
.PHONY: dblreverse
.PHONY: bitreverse
dblreverse: $(OBJDR)/Vdblreverse__ALL.a
bitreverse: $(VOBJDR)/Vbitreverse__ALL.a
 
 
$(CORED)/dblreverse.v: fft
$(CORED)/bitreverse.v: fft
$(OBJDR)/Vdblreverse.cpp $(OBJDR)/Vdblreverse.h: $(CORED)/dblreverse.v
$(VOBJDR)/Vbitreverse.cpp $(VOBJDR)/Vbitreverse.h: $(CORED)/bitreverse.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) dblreverse.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) bitreverse.v
$(OBJDR)/Vdblreverse__ALL.a: $(OBJDR)/Vdblreverse.h
$(VOBJDR)/Vbitreverse__ALL.a: $(VOBJDR)/Vbitreverse.h
$(OBJDR)/Vdblreverse__ALL.a: $(OBJDR)/Vdblreverse.cpp
$(VOBJDR)/Vbitreverse__ALL.a: $(VOBJDR)/Vbitreverse.cpp
        cd $(OBJDR)/; make -f Vdblreverse.mk
        cd $(VOBJDR)/; make -f Vbitreverse.mk
 
 
.PHONY: qtrstage
.PHONY: qtrstage
qtrstage: $(OBJDR)/Vqtrstage__ALL.a
qtrstage: $(VOBJDR)/Vqtrstage__ALL.a
 
 
$(CORED)/qtrstage.v: fft
$(CORED)/qtrstage.v: fft
$(OBJDR)/Vqtrstage.cpp $(OBJDR)/Vqtrstage.h: $(CORED)/qtrstage.v
$(VOBJDR)/Vqtrstage.cpp $(VOBJDR)/Vqtrstage.h: $(CORED)/qtrstage.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) qtrstage.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) qtrstage.v
$(OBJDR)/Vqtrstage__ALL.a: $(OBJDR)/Vqtrstage.h
$(VOBJDR)/Vqtrstage__ALL.a: $(VOBJDR)/Vqtrstage.h
$(OBJDR)/Vqtrstage__ALL.a: $(OBJDR)/Vqtrstage.cpp
$(VOBJDR)/Vqtrstage__ALL.a: $(VOBJDR)/Vqtrstage.cpp
        cd $(OBJDR)/; make -f Vqtrstage.mk
        cd $(VOBJDR)/; make -f Vqtrstage.mk
 
 
.PHONY: dblstage
.PHONY: dblstage
dblstage: $(OBJDR)/Vdblstage__ALL.a
dblstage: $(VOBJDR)/Vdblstage__ALL.a
 
 
$(CORED)/dblstage.v: fft
$(CORED)/dblstage.v: fft
$(OBJDR)/Vdblstage.cpp $(OBJDR)/Vdblstage.h: $(CORED)/dblstage.v
$(VOBJDR)/Vdblstage.cpp $(VOBJDR)/Vdblstage.h: $(CORED)/dblstage.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) dblstage.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) dblstage.v
$(OBJDR)/Vdblstage__ALL.a: $(OBJDR)/Vdblstage.h
$(VOBJDR)/Vdblstage__ALL.a: $(VOBJDR)/Vdblstage.h
$(OBJDR)/Vdblstage__ALL.a: $(OBJDR)/Vdblstage.cpp
$(VOBJDR)/Vdblstage__ALL.a: $(VOBJDR)/Vdblstage.cpp
        cd $(OBJDR)/; make -f Vdblstage.mk
        cd $(VOBJDR)/; make -f Vdblstage.mk
 
 
.PHONY: fftstage_o2048
.PHONY: laststage
dblstage: $(OBJDR)/Vfftstage_o2048__ALL.a
laststage: $(VOBJDR)/Vlaststage__ALL.a
 
 
$(CORED)/fftstage_o2048.v: fft
$(CORED)/laststage.v: fft
$(OBJDR)/Vfftstage_o2048.cpp $(OBJDR)/Vfftstage_o2048.h: $(CORED)/fftstage_o2048.v
$(VOBJDR)/Vlaststage.cpp $(VOBJDR)/Vlaststage.h: $(CORED)/laststage.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) fftstage_o2048.v
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) laststage.v
$(OBJDR)/Vfftstage_o2048__ALL.a: $(OBJDR)/Vfftstage_o2048.h
$(VOBJDR)/Vlaststage__ALL.a: $(VOBJDR)/Vlaststage.h
$(OBJDR)/Vfftstage_o2048__ALL.a: $(OBJDR)/Vfftstage_o2048.cpp
$(VOBJDR)/Vlaststage__ALL.a: $(VOBJDR)/Vlaststage.cpp
        cd $(OBJDR)/; make -f Vfftstage_o2048.mk
        cd $(VOBJDR)/; make -f Vlaststage.mk
 
 
 
.PHONY: fftstage
 
fftstage: $(VOBJDR)/Vfftstage__ALL.a
 
 
 
$(CORED)/fftstage.v: fft
 
$(VOBJDR)/Vfftstage.cpp $(VOBJDR)/Vfftstage.h: $(CORED)/fftstage.v
 
        cd $(CORED)/; $(VERILATOR) $(VFLAGS) fftstage.v
 
$(VOBJDR)/Vfftstage__ALL.a: $(VOBJDR)/Vfftstage.h
 
$(VOBJDR)/Vfftstage__ALL.a: $(VOBJDR)/Vfftstage.cpp
 
        cd $(VOBJDR)/; make -f Vfftstage.mk
 
 
 
 
.PHONY: clean
.PHONY: clean
clean:
clean:
        rm fftgen fftgen.o
        rm fftgen fftgen.o
        rm -rf $(CORED)
        rm -rf $(CORED)/obj_dir
 
        rm -rf $(CORED)/fftmain.v $(CORED)/fftstage.v
 
        rm -rf $(CORED)/qtrstage.v $(CORED)/laststage.v $(CORED)/bitreverse.v
 
        rm -rf $(CORED)/butterfly.v $(CORED)/hwbfly.v
 
        rm -rf $(CORED)/longbimpy.v $(CORED)/bimpy.v
 
        rm -rf $(CORED)/convround.v
 
 
 
#
 
# The "depends" target, to know what files things depend upon.  The depends
 
# file itself is kept in $(OBJDIR)/depends.txt
 
#
 
define  build-depends
 
        $(mk-objdir)
 
        @echo "Building dependency file"
 
        @$(CXX) $(CFLAGS) $(INCS) -MM $(SOURCES) > $(OBJDIR)/xdepends.txt
 
@sed -e 's/^.*.o: /$(OBJDIR)\/&/' < $(OBJDIR)/xdepends.txt > $(OBJDIR)/depends.txt
 
        @rm $(OBJDIR)/xdepends.txt
 
endef
 
 
 
.PHONY: depends
 
depends: tags
 
        $(build-depends)
 
 
 
$(OBJDIR)/depends.txt: depends
 
 
 
#
 
# Make a directory to hold all of the FFT-gen (i.e. the C++) build products
 
# (object files)
 
#
 
define  mk-objdir
 
        @bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
 
endef
 
 
 
#
 
# The "tags" target
 
#
 
tags:   $(SOURCES) $(HEADERS)
 
        @echo "Generating tags"
 
        @ctags $(SOURCES) $(HEADERS)
 
 
 
-include $(OBJDIR)/depends.txt

powered by: WebSVN 2.1.0

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