1
0

Initial version of sbt tasks (elaborate task with no parameters)

This commit is contained in:
Henry Cook 2012-10-20 17:27:49 -07:00
parent 3edc1f42aa
commit 17d2bd8926
2 changed files with 29 additions and 7 deletions

2
chisel

@ -1 +1 @@
Subproject commit da1d0bf1ea94ded2088d5812b53eac5eb379cdbb
Subproject commit bc4e7688efe1630c50a06aa114a4e827f367a04e

View File

@ -1,21 +1,38 @@
import sbt._
import Keys._
object BuildSettings {
object BuildSettings extends Build {
val buildOrganization = "berkeley"
val buildVersion = "1.1"
val buildScalaVersion = "2.9.2"
val packageDependencies = TaskKey[Seq[java.io.File]]("package-dependencies", "get package deps")
val elaborateTask = TaskKey[Unit]("elaborate", "convert chisel components into backend source code")
val buildSettings = Defaults.defaultSettings ++ Seq (
//unmanagedBase <<= baseDirectory { base => base / ".." / custom_lib" },
organization := buildOrganization,
version := buildVersion,
scalaVersion := buildScalaVersion
)
scalaVersion := buildScalaVersion,
elaborateTask <<= fullClasspath in Runtime map {
(cp: Classpath) => {
val projName = "ReferenceChip"
val dir = "../emulator/generated-src"
val backend = "c"
val chiselArgs = Array[String]( "--targetDir", dir, "--backend", backend)
val classLoader = new java.net.URLClassLoader(cp.map(_.data.toURL).toArray, cp.getClass.getClassLoader)
val chiselMainClass = classLoader.loadClass("Chisel.chiselMain$")
val chiselMainObject = chiselMainClass.getDeclaredFields.head.get(null)
val chiselMain = chiselMainClass.getMethod("run", classOf[Array[String]], classOf[Function0[_]])
val component = classLoader.loadClass(projName+".Top")
val generator = () => component.newInstance()
chiselMain.invoke(chiselMainObject, Array(chiselArgs, generator):_*)
}
}
object ChiselBuild extends Build{
import BuildSettings._
)
lazy val chisel = Project("chisel", file("chisel"), settings = buildSettings)
lazy val hardfloat = Project("hardfloat", file("hardfloat"), settings = buildSettings) dependsOn(chisel)
@ -23,4 +40,9 @@ object ChiselBuild extends Build{
lazy val uncore = Project("uncore", file("uncore"), settings = buildSettings) dependsOn(chisel)
lazy val rocket = Project("rocket", file("rocket"), settings = buildSettings) dependsOn(uncore,hwacha,hardfloat,chisel)
lazy val referencechip = Project("referencechip", file("referencechip"), settings = buildSettings) dependsOn(chisel,rocket)
}