first crack at continuous compilation/testing flow
try it out: cd emulator; make test
This commit is contained in:
parent
1ad928cfe2
commit
367b5489d1
1
Makefrag
1
Makefrag
@ -493,6 +493,7 @@ global_bmarks = \
|
||||
towers.riscv \
|
||||
vvadd.riscv \
|
||||
dgemm.riscv \
|
||||
dhrystone.riscv \
|
||||
|
||||
global_vec_bmarkdir = $(basedir)/../../riscv-app/misc/build
|
||||
global_vec_bmarks = \
|
||||
|
2
chisel
2
chisel
@ -1 +1 @@
|
||||
Subproject commit c4a063aba7a39c937592946b45b8f189aaedfbbc
|
||||
Subproject commit da1d0bf1ea94ded2088d5812b53eac5eb379cdbb
|
@ -1,11 +1,11 @@
|
||||
basedir = ..
|
||||
include ../Makefrag
|
||||
|
||||
all: emulator
|
||||
|
||||
CXX := g++
|
||||
CXXFLAGS := -O1
|
||||
|
||||
all: emulator
|
||||
|
||||
CXXSRCS := emulator disasm
|
||||
CXXFLAGS := $(CXXFLAGS) -Itestbench -I$(basedir)/chisel/csrc -I../dramsim2
|
||||
|
||||
@ -13,10 +13,10 @@ OBJS := $(addsuffix .o,$(CXXSRCS) $(MODEL))
|
||||
DEBUG_OBJS := $(addsuffix -debug.o,$(CXXSRCS) $(MODEL))
|
||||
|
||||
generated-src/$(MODEL).cpp: $(basedir)/riscv-rocket/src/*.scala $(basedir)/riscv-hwacha/src/*.scala $(basedir)/chisel/src/main/scala/* $(basedir)/uncore/src/*.scala
|
||||
cd $(basedir)/sbt && $(SBT) "project referencechip" "run ReferenceChip.$(MODEL) --backend c --noIoDebug --targetDir ../emulator/generated-src"
|
||||
cd $(basedir)/sbt && $(SBT) "project referencechip" "run elaborate $(MODEL) c ../emulator/generated-src"
|
||||
|
||||
generated-src-debug/$(MODEL).cpp: $(basedir)/riscv-rocket/src/*.scala $(basedir)/riscv-hwacha/src/*.scala $(basedir)/chisel/src/main/scala/* $(basedir)/uncore/src/*.scala
|
||||
cd $(basedir)/sbt && $(SBT) "project referencechip" "run ReferenceChip.$(MODEL) --backend c --debug --vcd --targetDir ../emulator/generated-src-debug"
|
||||
cd $(basedir)/sbt && $(SBT) "project referencechip" "run elaborate $(MODEL) c ../emulator/generated-src-debug --debug --vcd"
|
||||
|
||||
$(MODEL).o: %.o: generated-src/%.cpp
|
||||
$(CXX) $(CXXFLAGS) -Igenerated-src -c -o $@ $<
|
||||
@ -41,80 +41,61 @@ emulator: $(OBJS) libdramsim.a
|
||||
|
||||
emulator-debug: $(DEBUG_OBJS) libdramsim.a
|
||||
$(CXX) $(CXXFLAGS) -o $@ $(DEBUG_OBJS) -L. -ldramsim
|
||||
|
||||
all: emulator
|
||||
|
||||
clean:
|
||||
rm -rf *.o emulator emulator-debug generated-src generated-src-debug DVEfiles
|
||||
rm -rf *.o emulator emulator-debug generated-src generated-src-debug DVEfiles output
|
||||
|
||||
test:
|
||||
cd $(basedir)/sbt && $(SBT) "project referencechip" "~run test $(MODEL) c ../emulator/generated-src"
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Run assembly tests and benchmarks
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
global_asm_tests_out = $(addsuffix .out, $(global_asm_tests) $(global_asm_vm_tests))
|
||||
global_vecasm_tests_out = $(addsuffix .out, $(global_vecasm_tests) $(global_vecasm_vm_tests))
|
||||
global_vecasm_timer_tests_out = $(addsuffix .out, $(global_vecasm_timer_tests))
|
||||
global_bmarks_out = $(addsuffix .out, $(global_bmarks))
|
||||
global_asm_tests_vpd = $(addsuffix .vpd, $(global_asm_tests))
|
||||
global_vecasm_tests_vpd = $(addsuffix .vpd, $(global_vecasm_tests))
|
||||
global_vecasm_timer_tests_vpd = $(addsuffix .vpd, $(global_vecasm_timer_tests))
|
||||
global_bmarks_vpd = $(addsuffix .vpd, $(global_bmarks))
|
||||
%.hex:
|
||||
$(MAKE) -C $(dir $@) $(notdir $@)
|
||||
|
||||
$(global_asm_tests_out): %.out: $(global_tstdir)/%.hex emulator
|
||||
fesvr -c -testrun -m2000000 -l +loadmem=$< none 2> $@
|
||||
%.riscv.hex: %
|
||||
$(MAKE) -C $(dir $@) $(notdir $@)
|
||||
|
||||
$(global_vecasm_tests_out): %.out: $(global_tstdir)/%.hex emulator
|
||||
fesvr -c -testrun -m2000000 -l +loadmem=$< none 2> $@
|
||||
$(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 ../$< $@
|
||||
|
||||
$(global_vecasm_timer_tests_out): %.out: $(global_tstdir)/%.hex emulator
|
||||
$(addprefix output/, $(addsuffix .hex, $(global_bmarks))): output/%.hex: $(global_bmarkdir)/%.hex
|
||||
mkdir -p output
|
||||
ln -fs ../$< $@
|
||||
|
||||
output:
|
||||
mkdir -p $@
|
||||
|
||||
output/%.run: output/%.hex emulator
|
||||
fesvr -c -testrun -m3000000 +loadmem=$< none 2> /dev/null
|
||||
|
||||
output/%.out: output/%.hex emulator
|
||||
fesvr -c -testrun -m3000000 -l +loadmem=$< none 2> $@
|
||||
|
||||
$(global_bmarks_out): %.out: $(global_bmarkdir)/%.hex emulator
|
||||
fesvr -c -testrun -m1000000 -l +loadmem=$< none 2> $@
|
||||
|
||||
$(global_asm_tests_vpd): %.vpd: $(global_tstdir)/%.hex emulator-debug
|
||||
fesvr -c./emulator-debug -testrun -m1000000 -l -v- +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@) | vcd2vpd - $@ > /dev/null
|
||||
|
||||
$(global_vecasm_tests_vpd): %.vpd: $(global_tstdir)/%.hex emulator-debug
|
||||
fesvr -c./emulator-debug -testrun -m1000000 -l -v- +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@) | vcd2vpd - $@ > /dev/null
|
||||
|
||||
$(global_vecasm_timer_tests_vpd): %.vpd: $(global_tstdir)/%.hex emulator-debug
|
||||
output/%.vpd: output/%.hex emulator-debug
|
||||
fesvr -c./emulator-debug -testrun -m3000000 -l -v- +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@) | vcd2vpd - $@ > /dev/null
|
||||
|
||||
$(global_bmarks_vpd): %.vpd: $(global_bmarkdir)/%.hex emulator-debug
|
||||
fesvr -c./emulator-debug -testrun -m1000000 -l -v- +loadmem=$< none 2> $(patsubst %.vpd,%.out,$@) | vcd2vpd - $@ > /dev/null
|
||||
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: $(global_asm_tests_out)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_asm_tests_out); echo;
|
||||
|
||||
run-vecasm-tests: $(global_vecasm_tests_out)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_vecasm_tests_out); echo;
|
||||
|
||||
run-vecasm-timer-tests: $(global_vecasm_timer_tests_out)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_vecasm_timer_tests_out); echo;
|
||||
|
||||
run-bmarks-test: $(global_bmarks_out)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_bmarks_out); echo;
|
||||
|
||||
run-asm-tests-debug: $(global_asm_tests_vpd)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_asm_tests_out); echo;
|
||||
|
||||
run-vecasm-tests-debug: $(global_vecasm_tests_vpd)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_vecasm_tests_out); echo;
|
||||
|
||||
run-vecasm-timer-tests-debug: $(global_vecasm_timer_tests_vpd)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_vecasm_timer_tests_out); echo;
|
||||
|
||||
run-bmarks-test-debug: $(global_bmarks_vpd)
|
||||
@echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
|
||||
$(global_bmarks_out); 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;
|
||||
|
||||
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
|
||||
run-fast: $(addprefix output/, $(addsuffix .run, $(global_asm_tests) $(global_asm_vm_tests) $(global_bmarks)))
|
||||
|
51
src/main/scala/Main.scala
Normal file
51
src/main/scala/Main.scala
Normal file
@ -0,0 +1,51 @@
|
||||
package ReferenceChip
|
||||
|
||||
import sys.process._
|
||||
import Chisel._
|
||||
|
||||
object Main
|
||||
{
|
||||
def classOf(x: String) = try {
|
||||
Class.forName(x)
|
||||
} catch {
|
||||
case _: ClassNotFoundException => {
|
||||
val myPackage = getClass.getName.reverse.dropWhile(_ != '.').reverse
|
||||
Class.forName(myPackage+x)
|
||||
}
|
||||
}
|
||||
|
||||
def main(allArgs: Array[String]): Unit = {
|
||||
require(allArgs.length >= 4, "syntax: run <command> <component> <backend> <dir> [args]")
|
||||
val cmd = allArgs(0)
|
||||
val compName = allArgs(1)
|
||||
val backendName = allArgs(2)
|
||||
val dir = allArgs(3)
|
||||
|
||||
val backend = try {
|
||||
classOf(backendName).getName
|
||||
} catch {
|
||||
case _ => backendName
|
||||
}
|
||||
|
||||
println("I'm gonna "+cmd+" component "+compName+" with backend "+backendName+"...")
|
||||
val comp = classOf(compName)
|
||||
|
||||
val chiselArgs = allArgs.drop(4) ++ Array("--targetDir", dir, "--backend", backend)
|
||||
|
||||
val makeDir = dir+"/.."
|
||||
val jobs = Runtime.getRuntime.availableProcessors
|
||||
val make = "make -C" + makeDir + " -j" + jobs
|
||||
val action = cmd match {
|
||||
case "elaborate" => () =>
|
||||
case "build" => () => make!
|
||||
case "test" => () => {
|
||||
if ((make+" run-fast"!) == 0) println("PASSED")
|
||||
else println("FAILED")
|
||||
}
|
||||
case _ => throw new IllegalArgumentException("unknown command "+cmd)
|
||||
}
|
||||
|
||||
chiselMain(chiselArgs, () => comp.newInstance.asInstanceOf[Component])
|
||||
action()
|
||||
}
|
||||
}
|
@ -239,20 +239,3 @@ class Top extends Component {
|
||||
io.mem <> uncore.io.mem
|
||||
io.debug.error_mode := error_mode
|
||||
}
|
||||
|
||||
object top_main {
|
||||
def main(args: Array[String]): Unit = {
|
||||
val top = args(0)
|
||||
val chiselArgs = ArrayBuffer[String]()
|
||||
|
||||
var i = 1
|
||||
while (i < args.length) {
|
||||
val arg = args(i)
|
||||
chiselArgs += arg
|
||||
i += 1
|
||||
}
|
||||
|
||||
chiselMain(chiselArgs.toArray, () => Class.forName(top).newInstance.asInstanceOf[Component])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user