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)
|
2015-09-12 04:07:33 +02:00
|
|
|
generated_dir_debug = $(abspath ./generated-src-debug)
|
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
|
|
|
|
2013-05-01 11:58:53 +02:00
|
|
|
include $(base_dir)/Makefrag
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2016-08-16 07:03:03 +02:00
|
|
|
CXXSRCS := emulator SimDTM
|
|
|
|
CXXFLAGS := $(CXXFLAGS) -std=c++11 -I$(RISCV)/include -I$(base_dir)/csrc
|
|
|
|
LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -Wl,-rpath,$(RISCV)/lib -L$(abspath $(sim_dir)) -lfesvr -lpthread
|
2014-01-31 21:25:19 +01:00
|
|
|
|
2015-07-30 02:57:02 +02:00
|
|
|
emu = emulator-$(MODEL)-$(CONFIG)
|
|
|
|
emu_debug = emulator-$(MODEL)-$(CONFIG)-debug
|
2016-06-08 10:39:40 +02:00
|
|
|
|
|
|
|
include $(sim_dir)/Makefrag-verilator
|
2015-09-11 02:14:23 +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-09-12 04:07:33 +02:00
|
|
|
rm -rf *.o *.a emulator-* $(generated_dir) $(generated_dir_debug) 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
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2016-08-25 23:42:04 +02:00
|
|
|
ifneq ($(filter run% %.run %.out %.vpd %.vcd,$(MAKECMDGOALS)),)
|
2016-09-19 22:23:17 +02:00
|
|
|
-include $(generated_dir)/$(long_name).d
|
2015-11-12 09:41:55 +01:00
|
|
|
endif
|
2015-09-12 04:07:33 +02:00
|
|
|
|
2016-06-08 10:39:40 +02:00
|
|
|
$(output_dir)/%.run: $(output_dir)/% $(emu)
|
2016-08-16 07:03:03 +02:00
|
|
|
./$(emu) +max-cycles=$(timeout_cycles) $< 2> /dev/null 2> $@ && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2016-06-08 10:39:40 +02:00
|
|
|
$(output_dir)/%.out: $(output_dir)/% $(emu)
|
2016-08-16 07:03:03 +02:00
|
|
|
./$(emu) +max-cycles=$(timeout_cycles) +verbose $< $(disasm) $@ && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2016-06-08 10:39:40 +02:00
|
|
|
$(output_dir)/%.vcd: $(output_dir)/% $(emu_debug)
|
2016-08-16 07:03:03 +02:00
|
|
|
./$(emu_debug) +max-cycles=$(timeout_cycles) +verbose -v$@ $< $(disasm) $(patsubst %.vcd,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2016-06-08 10:39:40 +02:00
|
|
|
$(output_dir)/%.vpd: $(output_dir)/% $(emu_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 &
|
2016-08-16 07:03:03 +02:00
|
|
|
./$(emu_debug) +max-cycles=$(timeout_cycles) +verbose -v$@.vcd $< $(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
|