2015-07-29 17:57:02 -07:00
|
|
|
default: all
|
|
|
|
|
2014-08-31 20:26:55 -07:00
|
|
|
base_dir = $(abspath ..)
|
2015-07-29 17:57:02 -07:00
|
|
|
generated_dir = $(abspath ./generated-src)
|
2015-09-11 19:07:33 -07:00
|
|
|
generated_dir_debug = $(abspath ./generated-src-debug)
|
2013-05-01 02:58:53 -07:00
|
|
|
sim_dir = .
|
2014-08-31 20:26:55 -07:00
|
|
|
output_dir = $(sim_dir)/output
|
2015-04-06 15:05:43 -07:00
|
|
|
|
2015-07-29 17:57:02 -07:00
|
|
|
BACKEND = c
|
2016-05-25 11:08:11 -07:00
|
|
|
CONFIG ?= DefaultConfig
|
2014-09-11 22:11:58 -07:00
|
|
|
|
2013-05-01 02:58:53 -07:00
|
|
|
include $(base_dir)/Makefrag
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2014-08-31 20:26:55 -07:00
|
|
|
CXXSRCS := emulator mm mm_dramsim2
|
2015-07-29 17:57:02 -07:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -std=c++11 -I$(RISCV)/include -I$(base_dir)/csrc -I$(base_dir)/dramsim2
|
2016-06-08 01:39:40 -07:00
|
|
|
LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -Wl,-rpath,$(RISCV)/lib -L$(abspath $(sim_dir)) -ldramsim -lfesvr -lpthread
|
2014-01-31 12:25:19 -08:00
|
|
|
|
2015-07-29 17:57:02 -07:00
|
|
|
emu = emulator-$(MODEL)-$(CONFIG)
|
|
|
|
emu_debug = emulator-$(MODEL)-$(CONFIG)-debug
|
2016-06-08 01:39:40 -07:00
|
|
|
|
|
|
|
ifeq ($(CHISEL_VERSION),2)
|
|
|
|
include $(sim_dir)/Makefrag-emulator
|
|
|
|
else
|
|
|
|
include $(sim_dir)/Makefrag-verilator
|
|
|
|
endif
|
2015-09-10 17:14:23 -07:00
|
|
|
|
2015-07-29 17:57:02 -07:00
|
|
|
all: $(emu)
|
|
|
|
debug: $(emu_debug)
|
|
|
|
|
2012-10-01 19:30:11 -07:00
|
|
|
clean:
|
2015-09-11 19:07:33 -07:00
|
|
|
rm -rf *.o *.a emulator-* $(generated_dir) $(generated_dir_debug) DVEfiles $(output_dir)
|
2012-10-19 04:09:07 -07:00
|
|
|
|
|
|
|
test:
|
2013-08-19 19:54:41 -07:00
|
|
|
cd $(base_dir) && $(SBT) "~make $(CURDIR) run-fast $(CHISEL_ARGS)"
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2015-07-29 17:57:02 -07:00
|
|
|
.PHONY: default all debug clean test
|
|
|
|
|
2012-10-01 19:30:11 -07:00
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Run assembly tests and benchmarks
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2015-11-12 00:41:55 -08:00
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
2015-09-11 19:07:33 -07:00
|
|
|
-include $(generated_dir)/$(MODEL).$(CONFIG).d
|
2015-11-12 00:41:55 -08:00
|
|
|
endif
|
2015-09-11 19:07:33 -07:00
|
|
|
|
2016-06-08 01:39:40 -07:00
|
|
|
$(output_dir)/%.run: $(output_dir)/% $(emu)
|
2016-04-30 20:59:36 -07:00
|
|
|
./$(emu) +dramsim +max-cycles=$(timeout_cycles) $< 2> /dev/null 2> $@ && [ $$PIPESTATUS -eq 0 ]
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2016-06-08 01:39:40 -07:00
|
|
|
$(output_dir)/%.out: $(output_dir)/% $(emu)
|
2016-04-30 20:59:36 -07:00
|
|
|
./$(emu) +dramsim +max-cycles=$(timeout_cycles) +verbose $< $(disasm) $@ && [ $$PIPESTATUS -eq 0 ]
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2016-06-08 01:39:40 -07:00
|
|
|
$(output_dir)/%.vcd: $(output_dir)/% $(emu_debug)
|
2016-04-30 20:59:36 -07:00
|
|
|
./$(emu_debug) +dramsim +max-cycles=$(timeout_cycles) +verbose -v$@ $< $(disasm) $(patsubst %.vcd,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2016-06-08 01:39:40 -07:00
|
|
|
$(output_dir)/%.vpd: $(output_dir)/% $(emu_debug)
|
2013-03-25 16:19:19 -07:00
|
|
|
rm -rf $@.vcd && mkfifo $@.vcd
|
2013-03-25 17:01:13 -07:00
|
|
|
vcd2vpd $@.vcd $@ > /dev/null &
|
2016-04-30 20:59:36 -07:00
|
|
|
./$(emu_debug) +dramsim +max-cycles=$(timeout_cycles) +verbose -v$@.vcd $< $(disasm) $(patsubst %.vpd,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2015-07-13 14:54:26 -07: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-09 20:49:28 -07:00
|
|
|
.PHONY: run run-debug run-fast
|