2012-10-02 04:30:11 +02:00
|
|
|
basedir = ..
|
|
|
|
include ../Makefrag
|
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
all: emulator
|
|
|
|
|
2012-10-02 04:30:11 +02:00
|
|
|
CXX := g++
|
|
|
|
CXXFLAGS := -O1
|
|
|
|
|
|
|
|
CXXSRCS := emulator disasm
|
2012-10-19 03:59:37 +02:00
|
|
|
CXXFLAGS := $(CXXFLAGS) -Itestbench -I$(basedir)/chisel/csrc -I../dramsim2
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 03:59:37 +02:00
|
|
|
OBJS := $(addsuffix .o,$(CXXSRCS) $(MODEL))
|
|
|
|
DEBUG_OBJS := $(addsuffix -debug.o,$(CXXSRCS) $(MODEL))
|
2012-10-14 23:06:28 +02:00
|
|
|
|
2012-10-02 04:30:11 +02:00
|
|
|
generated-src/$(MODEL).cpp: $(basedir)/riscv-rocket/src/*.scala $(basedir)/riscv-hwacha/src/*.scala $(basedir)/chisel/src/main/scala/* $(basedir)/uncore/src/*.scala
|
2012-10-23 21:51:37 +02:00
|
|
|
cd $(basedir)/sbt && $(SBT) "project referencechip" "elaborate $(MODEL) --backend c --targetDir ../emulator/generated-src"
|
2012-10-02 04:30:11 +02:00
|
|
|
|
|
|
|
generated-src-debug/$(MODEL).cpp: $(basedir)/riscv-rocket/src/*.scala $(basedir)/riscv-hwacha/src/*.scala $(basedir)/chisel/src/main/scala/* $(basedir)/uncore/src/*.scala
|
2012-10-23 21:51:37 +02:00
|
|
|
cd $(basedir)/sbt && $(SBT) "project referencechip" "elaborate $(MODEL) --backend c --targetDir ../emulator/generated-src-debug --debug --vcd"
|
2012-10-02 04:30:11 +02: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 $@ $<
|
|
|
|
|
|
|
|
$(addsuffix .o,$(CXXSRCS)): %.o: testbench/%.cc testbench/* generated-src/$(MODEL).cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src -c -o $@ $<
|
|
|
|
|
|
|
|
$(addsuffix -debug.o,$(CXXSRCS)): %-debug.o: testbench/%.cc testbench/* generated-src-debug/$(MODEL).cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src-debug -c -o $@ $<
|
|
|
|
|
2012-10-19 03:59:37 +02:00
|
|
|
DRAMSIM_OBJS := $(patsubst %.cpp,%.o,$(wildcard ../dramsim2/*.cpp))
|
|
|
|
$(DRAMSIM_OBJS): %.o: %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -DNO_STORAGE -Dmain=nomain -c -o $@ $<
|
|
|
|
libdramsim.a: $(DRAMSIM_OBJS)
|
|
|
|
ar rcs $@ $^
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 03:59:37 +02:00
|
|
|
emulator: $(OBJS) libdramsim.a
|
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $(OBJS) -L. -ldramsim
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 03:59:37 +02:00
|
|
|
emulator-debug: $(DEBUG_OBJS) libdramsim.a
|
|
|
|
$(CXX) $(CXXFLAGS) -o $@ $(DEBUG_OBJS) -L. -ldramsim
|
2012-10-02 04:30:11 +02:00
|
|
|
|
|
|
|
clean:
|
2012-10-19 13:09:07 +02:00
|
|
|
rm -rf *.o emulator emulator-debug generated-src generated-src-debug DVEfiles output
|
|
|
|
|
|
|
|
test:
|
2012-10-23 21:51:37 +02:00
|
|
|
cd $(basedir)/sbt && $(SBT) "project referencechip" "~make ../emulator run-fast"
|
2012-10-02 04:30:11 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
# Run assembly tests and benchmarks
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
%.hex:
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
%.riscv.hex: %
|
|
|
|
$(MAKE) -C $(dir $@) $(notdir $@)
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
$(addprefix output/, $(addsuffix .hex, $(global_asm_tests) $(global_asm_vm_tests) $(global_vecasm_tests) $(global_vecasm_timer_tests))): output/%.hex: $(global_tstdir)/%.hex
|
|
|
|
mkdir -p output
|
|
|
|
ln -fs ../$< $@
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
$(addprefix output/, $(addsuffix .hex, $(global_bmarks))): output/%.hex: $(global_bmarkdir)/%.hex
|
|
|
|
mkdir -p output
|
|
|
|
ln -fs ../$< $@
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
output:
|
|
|
|
mkdir -p $@
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
output/%.run: output/%.hex emulator
|
|
|
|
fesvr -c -testrun -m3000000 +loadmem=$< none 2> /dev/null
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
output/%.out: output/%.hex emulator
|
|
|
|
fesvr -c -testrun -m3000000 -l +loadmem=$< none 2> $@
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
output/%.vpd: output/%.hex emulator-debug
|
2012-10-02 04:30:11 +02:00
|
|
|
fesvr -c./emulator-debug -testrun -m3000000 -l -v- +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@) | vcd2vpd - $@ > /dev/null
|
|
|
|
|
2012-10-19 13:09:07 +02:00
|
|
|
run-asm-tests: $(addprefix output/, $(addsuffix .out, $(global_asm_tests) $(global_asm_vm_tests)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
|
|
|
run-vecasm-tests: $(addprefix output/, $(addsuffix .out, $(global_vecasm_tests)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
|
|
|
run-vecasm-timer-tests: $(addprefix output/, $(addsuffix .out, $(global_vecasm_timer_tests)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
|
|
|
run-bmarks-test: $(addprefix output/, $(addsuffix .out, $(global_bmarks)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $^; echo;
|
|
|
|
|
|
|
|
run-asm-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(global_asm_tests) $(global_asm_vm_tests)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
|
|
|
run-vecasm-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(global_vecasm_tests)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
|
|
|
run-vecasm-timer-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(global_vecasm_timer_tests)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
|
|
|
run-bmarks-test-debug: $(addprefix output/, $(addsuffix .vpd, $(global_bmarks)))
|
|
|
|
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' $(patsubst %.vpd,%.out,$^); echo;
|
2012-10-02 04:30:11 +02:00
|
|
|
|
|
|
|
run: run-asm-tests run-vecasm-tests run-vecasm-timer-tests run-bmarks-test
|
|
|
|
run-debug: run-asm-tests-debug run-vecasm-tests-debug run-vecasm-timer-tests-debug run-bmarks-test-debug
|
2012-10-19 13:09:07 +02:00
|
|
|
run-fast: $(addprefix output/, $(addsuffix .run, $(global_asm_tests) $(global_asm_vm_tests) $(global_bmarks)))
|