2012-12-04 07:04:26 -08:00
|
|
|
all: emulator
|
|
|
|
|
2013-05-01 02:58:53 -07:00
|
|
|
base_dir = ..
|
|
|
|
sim_dir = .
|
|
|
|
|
|
|
|
include $(base_dir)/Makefrag
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-06-14 00:27:52 -07:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -std=c++11 -I$(RISCV)/include
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2012-12-04 07:04:26 -08:00
|
|
|
CXXSRCS := emulator disasm mm mm_dramsim2
|
2013-08-19 19:54:41 -07:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -I$(base_dir)/csrc -I$(base_dir)/dramsim2
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-01-24 23:56:45 -08:00
|
|
|
LDFLAGS := $(LDFLAGS) -L$(RISCV)/lib -L. -ldramsim -lfesvr -lpthread
|
|
|
|
|
2012-10-18 18:59:37 -07:00
|
|
|
OBJS := $(addsuffix .o,$(CXXSRCS) $(MODEL))
|
|
|
|
DEBUG_OBJS := $(addsuffix -debug.o,$(CXXSRCS) $(MODEL))
|
2012-10-14 14:06:28 -07:00
|
|
|
|
2013-08-19 19:54:41 -07:00
|
|
|
CHISEL_ARGS := $(MODEL) --noIoDebug --backend c --targetDir emulator/generated-src
|
2012-11-25 04:40:46 -08:00
|
|
|
CHISEL_ARGS_DEBUG := $(CHISEL_ARGS)-debug --debug --vcd --ioDebug
|
2012-11-17 19:58:18 -08:00
|
|
|
|
2013-08-19 19:54:41 -07:00
|
|
|
generated-src/$(MODEL).cpp: $(base_dir)/rocket/$(src_path)/*.scala $(base_dir)/hwacha/$(src_path)/*.scala $(base_dir)/uncore/$(src_path)/*.scala $(base_dir)/$(src_path)/*.scala
|
2013-08-20 12:56:01 -07:00
|
|
|
cd $(base_dir) && $(SBT) "project referencechip" "elaborate $(CHISEL_ARGS)"
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-08-19 19:54:41 -07:00
|
|
|
generated-src-debug/$(MODEL).cpp: $(base_dir)/rocket/$(src_path)/*.scala $(base_dir)/hwacha/$(src_path)/*.scala $(base_dir)/uncore/$(src_path)/*.scala $(base_dir)/$(src_path)/*.scala
|
2013-08-20 12:56:01 -07:00
|
|
|
cd $(base_dir) && $(SBT) "project referencechip" "elaborate $(CHISEL_ARGS_DEBUG)"
|
2012-10-01 19:30:11 -07:00
|
|
|
|
|
|
|
$(MODEL).o: %.o: generated-src/%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src -c -o $@ $<
|
|
|
|
|
|
|
|
$(MODEL)-debug.o: %-debug.o: generated-src-debug/%.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src-debug -c -o $@ $<
|
|
|
|
|
2013-05-01 02:58:53 -07:00
|
|
|
$(addsuffix .o,$(CXXSRCS)): %.o: $(base_dir)/csrc/%.cc $(base_dir)/csrc/*.h generated-src/$(MODEL).cpp
|
2012-10-01 19:30:11 -07:00
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src -c -o $@ $<
|
|
|
|
|
2013-05-01 02:58:53 -07:00
|
|
|
$(addsuffix -debug.o,$(CXXSRCS)): %-debug.o: $(base_dir)/csrc/%.cc $(base_dir)/csrc/*.h generated-src-debug/$(MODEL).cpp
|
2012-10-01 19:30:11 -07:00
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src-debug -c -o $@ $<
|
|
|
|
|
2012-10-18 18:59:37 -07:00
|
|
|
emulator: $(OBJS) libdramsim.a
|
2013-01-24 23:56:45 -08:00
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS)
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2012-10-18 18:59:37 -07:00
|
|
|
emulator-debug: $(DEBUG_OBJS) libdramsim.a
|
2013-01-24 23:56:45 -08:00
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $(DEBUG_OBJS) $(LDFLAGS)
|
2012-10-01 19:30:11 -07:00
|
|
|
|
|
|
|
clean:
|
2012-11-04 16:43:02 -08:00
|
|
|
rm -rf *.o *.a emulator emulator-debug generated-src generated-src-debug DVEfiles output
|
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
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Run assembly tests and benchmarks
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2012-10-19 04:09:07 -07:00
|
|
|
%.hex:
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2012-10-19 04:09:07 -07:00
|
|
|
%.riscv.hex: %
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-04-24 01:59:14 -07:00
|
|
|
$(addprefix output/, $(addsuffix .hex, $(asm_p_tests) $(asm_v_tests) $(vecasm_p_tests) $(vecasm_v_tests) $(vecasm_pt_tests))): output/%.hex: $(tstdir)/%.hex
|
2012-10-19 04:09:07 -07:00
|
|
|
mkdir -p output
|
|
|
|
ln -fs ../$< $@
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-04-24 01:59:14 -07:00
|
|
|
$(addprefix output/, $(addsuffix .hex, $(bmarks))): output/%.hex: $(bmarkdir)/%.hex
|
2012-10-19 04:09:07 -07:00
|
|
|
mkdir -p output
|
|
|
|
ln -fs ../$< $@
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-06-13 15:34:15 -07:00
|
|
|
$(addprefix output/, $(addsuffix .hex, $(mt_bmarks))): output/%.hex: $(mt_bmarkdir)/%.hex
|
|
|
|
mkdir -p output
|
|
|
|
ln -fs ../$< $@
|
|
|
|
|
2012-10-19 04:09:07 -07:00
|
|
|
output:
|
|
|
|
mkdir -p $@
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2012-10-19 04:09:07 -07:00
|
|
|
output/%.run: output/%.hex emulator
|
2013-09-15 04:25:53 -07:00
|
|
|
./emulator +dramsim +max-cycles=30000000 +loadmem=$< none 2> /dev/null 2> $@
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2012-10-19 04:09:07 -07:00
|
|
|
output/%.out: output/%.hex emulator
|
2013-09-15 04:25:53 -07:00
|
|
|
./emulator +dramsim +max-cycles=30000000 +verbose +coremap-random +loadmem=$< none $(disasm) $@
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2012-10-19 04:09:07 -07:00
|
|
|
output/%.vpd: output/%.hex emulator-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 &
|
2013-04-04 15:51:24 -07:00
|
|
|
./emulator-debug +dramsim +max-cycles=30000000 +verbose -v$@.vcd +coremap-random +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@)
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-04-24 01:59:14 -07:00
|
|
|
run-asm-tests: $(addprefix output/, $(addsuffix .out, $(asm_p_tests) $(asm_v_tests)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
2013-04-24 01:59:14 -07:00
|
|
|
run-vecasm-tests: $(addprefix output/, $(addsuffix .out, $(vecasm_p_tests) $(vecasm_v_tests)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
2013-04-24 01:59:14 -07:00
|
|
|
run-vecasm-timer-tests: $(addprefix output/, $(addsuffix .out, $(vecasm_pt_tests)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
2013-04-24 01:59:14 -07:00
|
|
|
run-bmarks-test: $(addprefix output/, $(addsuffix .out, $(bmarks)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
2013-06-13 15:34:15 -07:00
|
|
|
run-mt-tests: $(addprefix output/, $(addsuffix .out, $(mt_bmarks)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
2012-10-19 04:09:07 -07:00
|
|
|
|
2013-04-24 01:59:14 -07:00
|
|
|
run-asm-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(asm_p_tests) $(asm_v_tests)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
2013-04-24 01:59:14 -07:00
|
|
|
run-vecasm-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(vecasm_p_tests) $(vecasm_v_tests)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
2013-04-24 01:59:14 -07:00
|
|
|
run-vecasm-timer-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(vecasm_pt_tests)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
2013-04-24 01:59:14 -07:00
|
|
|
run-bmarks-test-debug: $(addprefix output/, $(addsuffix .vpd, $(bmarks)))
|
2012-10-19 04:09:07 -07:00
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
2013-06-13 15:34:15 -07:00
|
|
|
run-mt-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(mt_bmarks)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
2012-10-01 19:30:11 -07:00
|
|
|
|
2013-09-12 17:03:38 -07:00
|
|
|
run: run-asm-tests run-bmarks-test #run-vecasm-tests run-vecasm-timer-tests
|
|
|
|
run-debug: run-asm-tests-debug run-bmarks-test-debug #run-vecasm-tests-debug run-vecasm-timer-tests-debug
|
2013-04-24 01:59:14 -07:00
|
|
|
run-fast: $(addprefix output/, $(addsuffix .run, $(asm_p_tests) $(asm_v_tests) $(bmarks)))
|