1
0

first crack at continuous compilation/testing flow

try it out: cd emulator; make test
This commit is contained in:
Andrew Waterman
2012-10-19 04:09:07 -07:00
parent 1ad928cfe2
commit 367b5489d1
5 changed files with 97 additions and 81 deletions

51
src/main/scala/Main.scala Normal file
View 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()
}
}

View File

@ -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])
}
}