Skip to content

Commit

Permalink
Merge pull request #3507 from chipsalliance/chisel_source
Browse files Browse the repository at this point in the history
Support RocketChip build Chisel from source
  • Loading branch information
sequencer authored Nov 15, 2023
2 parents 180e4bc + 7b01955 commit 11f0119
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
14 changes: 7 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "hardfloat"]
path = hardfloat
[submodule "dependencies/hardfloat"]
path = dependencies/hardfloat
url = https://github.com/ucb-bar/berkeley-hardfloat.git
[submodule "torture"]
path = torture
url = https://github.com/ucb-bar/riscv-torture.git
[submodule "cde"]
path = cde
[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
43 changes: 28 additions & 15 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import mill._
import mill.scalalib._
import mill.scalalib.publish._
import coursier.maven.MavenRepository
import $file.hardfloat.common
import $file.cde.common
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(
"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"
Expand All @@ -20,6 +23,16 @@ object v {
)
}

// 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
Expand All @@ -35,35 +48,35 @@ trait Macros
object hardfloat extends mill.define.Cross[Hardfloat](v.chiselCrossVersions.keys.toSeq)

trait Hardfloat
extends millbuild.hardfloat.common.HardfloatModule
extends millbuild.dependencies.hardfloat.common.HardfloatModule
with RocketChipPublishModule
with Cross.Module[String] {

def scalaVersion: T[String] = T(v.scala)

override def millSourcePath = os.pwd / "hardfloat" / "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)

def repositoriesTask = T.task(super.repositoriesTask() ++ v.sonatypesSnapshots)
}

object cde extends CDE

trait CDE
extends millbuild.cde.common.CDEModule
extends millbuild.dependencies.cde.common.CDEModule
with RocketChipPublishModule
with ScalaModule {

def scalaVersion: T[String] = T(v.scala)

override def millSourcePath = os.pwd / "cde" / "cde"
override def millSourcePath = os.pwd / "dependencies" / "cde" / "cde"
}

object rocketchip extends Cross[RocketChip](v.chiselCrossVersions.keys.toSeq)
Expand All @@ -77,13 +90,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

Expand Down
Submodule cde updated from 000000 to 52768c
1 change: 1 addition & 0 deletions dependencies/chisel
Submodule chisel added at e3bcc9
1 change: 0 additions & 1 deletion torture
Submodule torture deleted from 99d8b2

0 comments on commit 11f0119

Please sign in to comment.