From 0e59371e516a6f58f224f8608aeb4501063b1583 Mon Sep 17 00:00:00 2001 From: Jiuyang Liu Date: Mon, 2 Oct 2023 08:39:56 +0800 Subject: [PATCH] add support to build chisel from source --- .gitmodules | 3 +++ build.sc | 31 ++++++++++++++++++++++--------- dependencies/chisel | 1 + 3 files changed, 26 insertions(+), 9 deletions(-) create mode 160000 dependencies/chisel diff --git a/.gitmodules b/.gitmodules index b2c07ea2978..fa1f58748ff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "dependencies/cde"] path = dependencies/cde url = https://github.com/chipsalliance/cde.git +[submodule "dependencies/chisel"] + path = dependencies/chisel + url = https://github.com/chipsalliance/chisel.git diff --git a/build.sc b/build.sc index 98934755296..c4537a452d1 100644 --- a/build.sc +++ b/build.sc @@ -4,20 +4,33 @@ import mill.scalalib.publish._ import coursier.maven.MavenRepository import $file.dependencies.hardfloat.common import $file.dependencies.cde.common +import $file.dependencies.chisel.build import $file.common object v { - val scala = "2.13.10" + val scala = "2.13.12" // the first version in this Map is the mainly supported version which will be used to run tests val chiselCrossVersions = Map( "3.6.0" -> (ivy"edu.berkeley.cs::chisel3:3.6.0", ivy"edu.berkeley.cs:::chisel3-plugin:3.6.0"), "5.0.0" -> (ivy"org.chipsalliance::chisel:5.0.0", ivy"org.chipsalliance:::chisel-plugin:5.0.0"), + // build from project from source + "source" -> (ivy"org.chipsalliance::chisel:99", ivy"org.chipsalliance:::chisel-plugin:99"), ) val mainargs = ivy"com.lihaoyi::mainargs:0.5.0" val json4sJackson = ivy"org.json4s::json4s-jackson:4.0.5" val scalaReflect = ivy"org.scala-lang:scala-reflect:${scala}" } +// Build form source only for dev +object chisel extends Chisel + +trait Chisel + extends millbuild.dependencies.chisel.build.Chisel { + def crossValue = v.scala + override def millSourcePath = os.pwd / "dependencies" / "chisel" + def scalaVersion = T(v.scala) +} + object macros extends Macros trait Macros @@ -41,13 +54,13 @@ trait Hardfloat override def millSourcePath = os.pwd / "dependencies" / "hardfloat" / "hardfloat" - def chiselModule = None + def chiselModule = Option.when(crossValue == "source")(chisel) - def chiselPluginJar = None + def chiselPluginJar = T(Option.when(crossValue == "source")(chisel.pluginModule.jar())) - def chiselIvy = Some(v.chiselCrossVersions(crossValue)._1) + def chiselIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._1) - def chiselPluginIvy = Some(v.chiselCrossVersions(crossValue)._2) + def chiselPluginIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._2) } object cde extends CDE @@ -73,13 +86,13 @@ trait RocketChip override def millSourcePath = super.millSourcePath / os.up - def chiselModule = None + def chiselModule = Option.when(crossValue == "source")(chisel) - def chiselPluginJar = None + def chiselPluginJar = T(Option.when(crossValue == "source")(chisel.pluginModule.jar())) - def chiselIvy = Some(v.chiselCrossVersions(crossValue)._1) + def chiselIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._1) - def chiselPluginIvy = Some(v.chiselCrossVersions(crossValue)._2) + def chiselPluginIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._2) def macrosModule = macros diff --git a/dependencies/chisel b/dependencies/chisel new file mode 160000 index 00000000000..4474816179a --- /dev/null +++ b/dependencies/chisel @@ -0,0 +1 @@ +Subproject commit 4474816179a9e8c6f4cb46bbc7241d12f7bddc4e