2015-07-30 02:57:02 +02:00
|
|
|
default: all
|
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
base_dir = $(abspath ..)
|
2015-07-30 02:57:02 +02:00
|
|
|
generated_dir = $(abspath ./generated-src)
|
2013-05-01 11:58:53 +02:00
|
|
|
sim_dir = .
|
2014-09-01 05:26:55 +02:00
|
|
|
output_dir = $(sim_dir)/output
|
2015-04-07 00:05:43 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
BACKEND = c
|
|
|
|
CONFIG ?= DefaultCPPConfig
|
2014-09-12 07:11:58 +02:00
|
|
|
|
2013-05-01 11:58:53 +02:00
|
|
|
include $(base_dir)/Makefrag
|
2015-07-30 02:57:02 +02:00
|
|
|
-include $(generated_dir)/$(MODEL).$(CONFIG).d
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2014-09-01 05:26:55 +02:00
|
|
|
CXXSRCS := emulator mm mm_dramsim2
|
2015-07-30 02:57:02 +02:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -std=c++11 -I$(RISCV)/include -I$(base_dir)/csrc -I$(base_dir)/dramsim2
|
2014-01-28 12:50:07 +01:00
|
|
|
LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -Wl,-rpath,$(RISCV)/lib -L. -ldramsim -lfesvr -lpthread
|
2014-09-12 07:11:58 +02:00
|
|
|
OBJS := $(addsuffix .o,$(CXXSRCS) $(MODEL).$(CONFIG))
|
2012-10-14 23:06:28 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(MODEL).$(CONFIG).o: %.o: $(generated_dir)/%.h
|
|
|
|
$(MAKE) -j $(patsubst %.cpp,%.o,$(shell ls $(generated_dir)/$(MODEL).$(CONFIG)-*.cpp))
|
|
|
|
$(LD) -r $(patsubst %.cpp,%.o,$(shell ls $(generated_dir)/$(MODEL).$(CONFIG)-*.cpp)) -o $@
|
2012-11-18 04:58:18 +01:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(generated_dir)/%.o: $(generated_dir)/%.cpp $(generated_dir)/%.h
|
|
|
|
$(CXX) $(CXXFLAGS) -I$(generated_dir) -c -o $@ $<
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(addsuffix .o,$(CXXSRCS)): %.o: $(base_dir)/csrc/%.cc $(base_dir)/csrc/*.h $(generated_dir)/$(MODEL).$(CONFIG).h
|
|
|
|
$(CXX) $(CXXFLAGS) -include $(generated_dir)/$(MODEL).$(CONFIG).h -I$(generated_dir) -c -o $@ $<
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(generated_dir)/nodebug.d $(generated_dir)/$(MODEL).$(CONFIG).d : $(chisel_srcs)
|
|
|
|
rm -f $(generated_dir)/debug.d $(shell ls $(generated_dir)/$(MODEL).$(CONFIG)*)
|
|
|
|
cd $(base_dir) && $(SBT) "project $(PROJECT)" "run $(CHISEL_ARGS) --noIoDebug"
|
|
|
|
touch $(generated_dir)/nodebug.d
|
2014-01-31 21:25:19 +01:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(generated_dir)/debug.d : $(chisel_srcs)
|
|
|
|
rm -f $(generated_dir)/nodebug.d $(shell ls $(generated_dir)/$(MODEL).$(CONFIG)*)
|
|
|
|
cd $(base_dir) && $(SBT) "project $(PROJECT)" "run $(CHISEL_ARGS) --debug --vcd --ioDebug"
|
|
|
|
touch $(generated_dir)/debug.d
|
2014-01-31 21:25:19 +01:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
emu = emulator-$(MODEL)-$(CONFIG)
|
|
|
|
$(emu): $(generated_dir)/nodebug.d $(OBJS) libdramsim.a
|
2013-01-25 08:56:45 +01:00
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS)
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
emu_debug = emulator-$(MODEL)-$(CONFIG)-debug
|
|
|
|
$(emu_debug): $(generated_dir)/debug.d $(OBJS) libdramsim.a
|
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS)
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
all: $(emu)
|
|
|
|
debug: $(emu_debug)
|
|
|
|
|
2012-10-02 04:30:11 +02:00
|
|
|
clean:
|
2015-07-30 02:57:02 +02:00
|
|
|
rm -rf *.o *.a emulator-* $(generated_dir) DVEfiles $(output_dir)
|
2012-10-19 13:09:07 +02:00
|
|
|
|
|
|
|
test:
|
2013-08-20 04:54:41 +02:00
|
|
|
cd $(base_dir) && $(SBT) "~make $(CURDIR) run-fast $(CHISEL_ARGS)"
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
.PHONY: default all debug clean test
|
|
|
|
|
2012-10-02 04:30:11 +02:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Run assembly tests and benchmarks
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(output_dir)/%.run: $(output_dir)/%.hex emulator-$(MODEL)-$(CONFIG)
|
|
|
|
./$(emu) +dramsim +max-cycles=$(timeout_cycles) +loadmem=$< none 2> /dev/null 2> $@ && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(output_dir)/%.out: $(output_dir)/%.hex emulator-$(MODEL)-$(CONFIG)
|
|
|
|
./$(emu) +dramsim +max-cycles=$(timeout_cycles) +verbose +loadmem=$< none $(disasm) $@ && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(output_dir)/%.vcd: $(output_dir)/%.hex emulator-$(MODEL)-$(CONFIG)-debug
|
|
|
|
./$(emu_debug) +dramsim +max-cycles=$(timeout_cycles) +verbose -v$@ +loadmem=$< none $(disasm) $(patsubst %.vcd,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
$(output_dir)/%.vpd: $(output_dir)/%.hex emulator-$(MODEL)-$(CONFIG)-debug
|
2013-03-26 00:19:19 +01:00
|
|
|
rm -rf $@.vcd && mkfifo $@.vcd
|
2013-03-26 01:01:13 +01:00
|
|
|
vcd2vpd $@.vcd $@ > /dev/null &
|
2015-07-30 02:57:02 +02:00
|
|
|
./$(emu_debug) +dramsim +max-cycles=$(timeout_cycles) +verbose -v$@.vcd +loadmem=$< none $(disasm) $(patsubst %.vpd,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2015-07-13 23:54:26 +02:00
|
|
|
run: run-asm-tests run-bmark-tests
|
|
|
|
run-debug: run-asm-tests-debug run-bmark-tests-debug
|
|
|
|
run-fast: run-asm-tests-fast run-bmark-tests-fast
|
|
|
|
|
|
|
|
.PHONY: run-asm-tests run-bmarks-test
|
|
|
|
.PHONY: run-asm-tests-debug run-bmark-tests-debug
|
2014-09-10 05:49:28 +02:00
|
|
|
.PHONY: run run-debug run-fast
|