| 1 |
4 |
dgisselq |
################################################################################
|
| 2 |
|
|
##
|
| 3 |
|
|
## Filename: Makefile
|
| 4 |
|
|
##
|
| 5 |
|
|
## Project: A wishbone controlled DDR3 SDRAM memory controller.
|
| 6 |
|
|
##
|
| 7 |
|
|
## Purpose: This coordinates the build of the singular test bench C++
|
| 8 |
|
|
## program found in this directory: ddrsdram_tb.
|
| 9 |
|
|
##
|
| 10 |
|
|
## Creator: Dan Gisselquist, Ph.D.
|
| 11 |
|
|
## Gisselquist Technology, LLC
|
| 12 |
|
|
##
|
| 13 |
|
|
################################################################################
|
| 14 |
|
|
##
|
| 15 |
|
|
## Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
| 16 |
|
|
##
|
| 17 |
|
|
## This program is free software (firmware): you can redistribute it and/or
|
| 18 |
|
|
## modify it under the terms of the GNU General Public License as published
|
| 19 |
|
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
| 20 |
|
|
## your option) any later version.
|
| 21 |
|
|
##
|
| 22 |
|
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
| 23 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
| 24 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 25 |
|
|
## for more details.
|
| 26 |
|
|
##
|
| 27 |
|
|
## You should have received a copy of the GNU General Public License along
|
| 28 |
|
|
## with this program. (It's in the $(ROOT)/doc directory, run make with no
|
| 29 |
|
|
## target there if the PDF file isn't present.) If not, see
|
| 30 |
|
|
## for a copy.
|
| 31 |
|
|
##
|
| 32 |
|
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
| 33 |
|
|
## http://www.gnu.org/licenses/gpl.html
|
| 34 |
|
|
##
|
| 35 |
|
|
##
|
| 36 |
|
|
################################################################################
|
| 37 |
|
|
##
|
| 38 |
|
|
##
|
| 39 |
13 |
dgisselq |
OBJDIR := obj-pc
|
| 40 |
4 |
dgisselq |
CXX := g++
|
| 41 |
|
|
YYMMDD := `date +%Y%m%d`
|
| 42 |
|
|
RTLD := ../../rtl
|
| 43 |
|
|
VOBJDR := $(RTLD)/obj_dir
|
| 44 |
|
|
VROOT := /usr/share/verilator
|
| 45 |
|
|
VINC := -I$(VROOT)/include -I$(VOBJDR)
|
| 46 |
|
|
CFLAGS := -Wall -c -Og -g -I. $(VINC)
|
| 47 |
|
|
SOURCES := ddrsdramsim.cpp ddrsdram_tb.cpp
|
| 48 |
|
|
VOBJDR := $(RTLD)/obj_dir
|
| 49 |
|
|
VLIB := $(VROOT)/include/verilated.cpp
|
| 50 |
|
|
|
| 51 |
13 |
dgisselq |
all: $(OBJDIR)/ ddrsdram_tb
|
| 52 |
|
|
|
| 53 |
|
|
|
| 54 |
4 |
dgisselq |
$(OBJDIR)/:
|
| 55 |
|
|
@bash -c "if [ ! -e $(OBJDIR) ]; then mkdir -p $(OBJDIR); fi"
|
| 56 |
|
|
|
| 57 |
|
|
$(OBJDIR)/ddrsdramsim.o: ddrsdramsim.cpp ddrsdramsim.h $(VOBJDR)/Vwbddrsdram.h
|
| 58 |
|
|
$(CXX) $(CFLAGS) ddrsdramsim.cpp -o $@
|
| 59 |
|
|
$(OBJDIR)/verilated.o: $(VLIB) $(OBJDIR)/
|
| 60 |
|
|
$(CXX) $(CFLAGS) $(VLIB) -o $@
|
| 61 |
|
|
$(OBJDIR)/ddrsdram_tb.o: ddrsdram_tb.cpp ddrsdramsim.h $(VOBJDR)/Vwbddrsdram.h
|
| 62 |
|
|
$(CXX) $(CFLAGS) ddrsdram_tb.cpp -o $@
|
| 63 |
|
|
|
| 64 |
|
|
OBJECTS := ddrsdramsim.o ddrsdram_tb.o verilated.o
|
| 65 |
|
|
OBJECTSDR:= $(addprefix $(OBJDIR)/,$(OBJECTS))
|
| 66 |
|
|
ddrsdram_tb: $(OBJECTSDR) $(VOBJDR)/Vwbddrsdram__ALL.a
|
| 67 |
|
|
$(CXX) -Wall $(INCS) $^ -o $@
|
| 68 |
|
|
|
| 69 |
|
|
.PHONY: clean
|
| 70 |
|
|
clean:
|
| 71 |
|
|
rm -rf $(OBJDIR)/ ddrsdram_tb
|
| 72 |
|
|
|
| 73 |
13 |
dgisselq |
.PHONY: test
|
| 74 |
|
|
test: ddrsdram_tb
|
| 75 |
|
|
./ddrsdram_tb
|
| 76 |
|
|
|