2012-12-04 16:04:26 +01:00
|
|
|
all: emulator
|
|
|
|
|
2012-10-02 04:30:11 +02:00
|
|
|
basedir = ..
|
|
|
|
include ../Makefrag
|
|
|
|
|
|
|
|
CXX := g++
|
2012-12-04 16:04:26 +01:00
|
|
|
CXXFLAGS := -O1 -std=c++0x
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2012-12-04 16:04:26 +01:00
|
|
|
CXXSRCS := emulator disasm mm mm_dramsim2
|
|
|
|
CXXFLAGS := $(CXXFLAGS) -I$(basedir)/csrc -I$(basedir)/chisel/csrc -I$(basedir)/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-12-04 16:04:26 +01:00
|
|
|
CHISEL_ARGS := $(MODEL) --noIoDebug --backend c --targetDir $(basedir)/emulator/generated-src
|
2012-11-25 13:40:46 +01:00
|
|
|
CHISEL_ARGS_DEBUG := $(CHISEL_ARGS)-debug --debug --vcd --ioDebug
|
2012-11-18 04:58:18 +01:00
|
|
|
|
2013-01-23 10:39:47 +01:00
|
|
|
generated-src/$(MODEL).cpp: $(basedir)/riscv-rocket/src/*.scala $(basedir)/riscv-hwacha/src/*.scala $(basedir)/chisel/src/main/scala/* $(basedir)/uncore/src/*.scala $(basedir)/src/*.scala
|
2012-11-18 04:58:18 +01:00
|
|
|
cd $(basedir)/sbt && $(SBT) "project referencechip" "elaborate $(CHISEL_ARGS)"
|
2012-10-02 04:30:11 +02:00
|
|
|
|
2013-01-23 10:39:47 +01: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 $(basedir)/src/*.scala
|
2012-11-18 04:58:18 +01:00
|
|
|
cd $(basedir)/sbt && $(SBT) "project referencechip" "elaborate $(CHISEL_ARGS_DEBUG)"
|
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 $@ $<
|
|
|
|
|
2012-12-04 16:04:26 +01:00
|
|
|
$(addsuffix .o,$(CXXSRCS)): %.o: $(basedir)/csrc/%.cc $(basedir)/csrc/*.h generated-src/$(MODEL).cpp
|
2012-10-02 04:30:11 +02:00
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src -c -o $@ $<
|
|
|
|
|
2012-12-04 16:04:26 +01:00
|
|
|
$(addsuffix -debug.o,$(CXXSRCS)): %-debug.o: $(basedir)/csrc/%.cc $(basedir)/csrc/*.h generated-src-debug/$(MODEL).cpp
|
2012-10-02 04:30:11 +02:00
|
|
|
$(CXX) $(CXXFLAGS) -Igenerated-src-debug -c -o $@ $<
|
|
|
|
|
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-11-05 01:43:02 +01:00
|
|
|
rm -rf *.o *.a emulator emulator-debug generated-src generated-src-debug DVEfiles output
|
2012-10-19 13:09:07 +02:00
|
|
|
|
|
|
|
test:
|
2012-12-04 16:04:26 +01:00
|
|
|
cd $(basedir)/sbt && $(SBT) "project referencechip" "~make $(CURDIR) run-fast $(CHISEL_ARGS)"
|
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-11-05 04:29:47 +01:00
|
|
|
$(addprefix output/, $(addsuffix .hex, $(global_asm_tests) $(global_asm_vm_tests) $(global_vecasm_tests) $(global_vecasm_vm_tests) $(global_vecasm_timer_tests))): output/%.hex: $(global_tstdir)/%.hex
|
2012-10-19 13:09:07 +02:00
|
|
|
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
|
2012-12-04 16:04:26 +01:00
|
|
|
fesvr +dramsim -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
|
2012-12-04 16:04:26 +01:00
|
|
|
fesvr +dramsim -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-12-04 16:04:26 +01:00
|
|
|
fesvr +dramsim -c./emulator-debug -testrun -m3000000 -l -v- +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@) | vcd2vpd - $@ > /dev/null && [ $$PIPESTATUS -eq 0 ]
|
2012-10-02 04:30:11 +02:00
|
|
|
|
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;
|
2012-11-05 04:29:47 +01:00
|
|
|
run-vecasm-tests: $(addprefix output/, $(addsuffix .out, $(global_vecasm_tests) $(global_vecasm_vm_tests)))
|
2012-10-19 13:09:07 +02:00
|
|
|
@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;
|
2012-11-05 04:29:47 +01:00
|
|
|
run-vecasm-tests-debug: $(addprefix output/, $(addsuffix .vpd, $(global_vecasm_tests) $(global_vecasm_vm_tests)))
|
2012-10-19 13:09:07 +02:00
|
|
|
@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)))
|