summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Lawson2015-05-12 15:19:55 -0700
committerJim Lawson2015-07-24 15:50:53 -0700
commite74cce036a7e9f8a08a020f1e007b22098db890d (patch)
treef15f841da5deb4ba6cbbad581ae7db35a809d461
parent2ae50411cbc5e2cd5fdc9ca4069b9c5f64919bc4 (diff)
Use CHISEL_BIN, CX, generalize generated/targetDir, convert filter to python, cd into targetDir before launching simulator (via Driver).
-rw-r--r--.gitignore1
-rw-r--r--Makefile28
-rwxr-xr-xbin/appall.sh2
-rwxr-xr-xbin/buildtest.sh4
-rwxr-xr-xbin/filter14
-rwxr-xr-xbin/fir2flo.sh4
-rwxr-xr-xbin/flo2app.sh2
-rwxr-xr-xbin/floall.sh2
-rw-r--r--src/main/scala/Chisel/Tester.scala8
9 files changed, 45 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..9ab870da
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+generated/
diff --git a/Makefile b/Makefile
index db3b6a3d..3371163f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,5 @@
SBT ?= sbt
SBT_FLAGS ?= -Dsbt.log.noformat=true
-RM_DIRS := test-outputs test-reports
-#CLEAN_DIRS := doc
# If a chiselVersion is defined, use that.
# Otherwise, use the snapshot.
@@ -15,12 +13,18 @@ SRC_DIR ?= .
SYSTEMC ?= $(SRC_DIR)/../../systemc/systemc-2.3.1
CHISEL_JAR ?= $(SRC_DIR)/target/scala-2.11/chisel_2.11-3.0-SNAPSHOT.jar
DRIVER ?= $(SRC_DIR)/src/test/resources/AddFilterSysCdriver.cpp
+# The targetDir will be rm -rf'ed when "make clean"
+targetDir ?= ./generated
+# The TEST_OUTPUT_DIR will be rm -rf'ed when "make clean"
TEST_OUTPUT_DIR ?= ./test-outputs
+RM_DIRS := $(TEST_OUTPUT_DIR) test-reports $(targetDir)
+#CLEAN_DIRS := doc
test_src_dir := src/test/scala/ChiselTests
-test_results := $(notdir $(basename $(filter-out main,$(wildcard $(test_src_dir)/*.scala))))
+test_results := $(filter-out main,$(notdir $(basename $(wildcard $(test_src_dir)/*.scala))))
+c_resources_dir := src/main/resources
-test_outs := $(addprefix generated/, $(addsuffix .out, $(test_results)))
+test_outs := $(addprefix $(targetDir)/, $(addsuffix .out, $(test_results)))
.PHONY: smoke publish-local check clean jenkins-build sysctest coverage scaladoc test
@@ -81,11 +85,17 @@ AddFilter.cpp AddFilter.h: AddFilter.class
AddFilter.class: $(CHISEL_JAR) ../src/test/scala/AddFilter.scala
scalac -cp $(CHISEL_JAR) ../src/test/scala/AddFilter.scala
-generated/%.fir: $(test_src_dir)/%.scala
+$(targetDir)/%.fir: $(test_src_dir)/%.scala
$(SBT) $(SBT_FLAGS) "test:runMain ChiselTests.MiniChisel $(notdir $(basename $<)) $(CHISEL_FLAGS)"
-generated/%.flo: generated/%.fir
- ./bin/fir2flo.sh $< > $@
+$(targetDir)/%.flo: $(targetDir)/%.fir
+ $(CHISEL_BIN)/fir2flo.sh $(targetDir)/$*
+
+$(targetDir)/%: $(targetDir)/%.flo $(targetDir)/emulator.h $(targetDir)/emulator_mod.h $(targetDir)/emulator_api.h
+ (cd $(targetDir); $(CHISEL_BIN)/flo2app.sh $*)
+
+$(targetDir)/%.h: $(c_resources_dir)/%.h
+ cp $< $@
-generated/%.out: generated/%.flo
- ./bin/flo-app.sh $< > $@
+$(targetDir)/%.out: $(targetDir)/%
+ $(SBT) $(SBT_FLAGS) "test:runMain ChiselTests.MiniChisel $(notdir $(basename $<)) $(CHISEL_FLAGS) --test --targetDir $(targetDir)"
diff --git a/bin/appall.sh b/bin/appall.sh
index 3c9054f1..32f1c118 100755
--- a/bin/appall.sh
+++ b/bin/appall.sh
@@ -3,5 +3,5 @@ shift 1
for file in "$@"; do
echo $file
- (cd generated; ../chisel3/bin/flo2app.sh $file >& $file.appout)
+ (cd generated; $CHISEL_BIN/flo2app.sh $file >& $file.appout)
done
diff --git a/bin/buildtest.sh b/bin/buildtest.sh
index 67d50252..1dd96ecb 100755
--- a/bin/buildtest.sh
+++ b/bin/buildtest.sh
@@ -1,4 +1,4 @@
#!/bin/bash
-build.sh $1
-test.sh $1
+$CHISEL_BIN/build.sh $1
+$CHISEL_BIN/test.sh $1
diff --git a/bin/filter b/bin/filter
new file mode 100755
index 00000000..0038ba47
--- /dev/null
+++ b/bin/filter
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+import fileinput
+import sys
+
+for line in fileinput.input():
+ for ch in line:
+ och = ch
+ if ch == '#':
+ och = '_'
+ elif ch == '$':
+ och = "::"
+ sys.stdout.write(och)
+
+
diff --git a/bin/fir2flo.sh b/bin/fir2flo.sh
index 57dd8e74..481f4418 100755
--- a/bin/fir2flo.sh
+++ b/bin/fir2flo.sh
@@ -1,4 +1,4 @@
#!/bin/bash
-$HOME/bar/firrtl/utils/bin/firrtl -i $1.fir -o $1.flo -X flo # -x X # -p c # tkwTgc
-$HOME/bar/chisel3/bin/filter < $1.flo > tmp; mv tmp $1.flo
+$CHISEL_BIN/firrtl -i $1.fir -o $1.flo -X flo # -x X # -p c # tkwTgc
+$CHISEL_BIN/filter < $1.flo > tmp; mv tmp $1.flo
diff --git a/bin/flo2app.sh b/bin/flo2app.sh
index 44326dd0..c13701ba 100755
--- a/bin/flo2app.sh
+++ b/bin/flo2app.sh
@@ -5,5 +5,5 @@ echo FLO-LLVM DONE
echo FLO-LLVM DONE
flo-llvm-release $1.flo --harness > $1-harness.cpp
echo FLO-LLVM-RELEASE DONE
-g++ -o $1 $1-harness.cpp $1.o
+$CXX -o $1 $1-harness.cpp $1.o
echo GPP DONE
diff --git a/bin/floall.sh b/bin/floall.sh
index 872b78a5..31dca1e2 100755
--- a/bin/floall.sh
+++ b/bin/floall.sh
@@ -2,5 +2,5 @@
shift 1
for file in "$@"; do
echo -n $file "-> "
- (cd generated; ../chisel3/bin/fir2flo.sh $file > $file.out; grep "res = " $file.out)
+ (cd generated; $CHISEL_BIN/fir2flo.sh $file > $file.out; grep "res = " $file.out)
done
diff --git a/src/main/scala/Chisel/Tester.scala b/src/main/scala/Chisel/Tester.scala
index bdeb0f68..cf7c7b1c 100644
--- a/src/main/scala/Chisel/Tester.scala
+++ b/src/main/scala/Chisel/Tester.scala
@@ -357,9 +357,9 @@ class ManualTester[+T <: Module]
def start(): Process = {
val n = Driver.appendString(Some(c.name),Driver.chiselConfigClassName)
- val target = Driver.targetDir + "/" + n
+ val target = "cd " + Driver.targetDir + " && ./" + n
val cmd = target
- println("OPENING " + cmd)
+ println("RUNNING " + cmd)
/*
(if (Driver.backend.isInstanceOf[FloBackend]) {
val dir = Driver.backend.asInstanceOf[FloBackend].floDir
@@ -373,8 +373,8 @@ class ManualTester[+T <: Module]
})
*/
println("SEED " + Driver.testerSeed)
- println("STARTING " + cmd)
- val processBuilder = Process(cmd)
+ println("STARTING " + n)
+ val processBuilder = Process(Seq("bash", "-c", cmd))
val pio = new ProcessIO(in => testOut = in, out => testIn = out, err => testErr = err)
process = processBuilder.run(pio)
waitForStreams()