Skip to content

Commit

Permalink
add support to build chisel from source
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Oct 17, 2023
1 parent 5a02896 commit 0e59371
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 22 additions & 9 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions dependencies/chisel
Submodule chisel added at 447481

0 comments on commit 0e59371

Please sign in to comment.