-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sc
129 lines (107 loc) · 3.51 KB
/
build.sc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import mill._
import mill.bsp._
import scalalib._
import scalafmt._
import os.Path
import publish._
import $file.`rocket-chip`.common
import $file.`rocket-chip`.cde.common
import $file.`rocket-chip`.hardfloat.build
val defaultVersions = Map(
"chisel" -> "6.1.0",
"chisel-plugin" -> "6.1.0",
"chiseltest" -> "5.0.0",
"scala" -> "2.13.10",
"scalatest" -> "3.2.7"
)
def getVersion(dep: String, org: String = "org.chipsalliance", cross: Boolean = false) = {
val version = sys.env.getOrElse(dep + "Version", defaultVersions(dep))
if (cross)
ivy"$org:::$dep:$version"
else
ivy"$org::$dep:$version"
}
trait CommonModule extends ScalaModule {
override def scalaVersion = defaultVersions("scala")
override def scalacPluginIvyDeps = Agg(getVersion("chisel-plugin", cross = true))
override def scalacOptions = super.scalacOptions() ++ Agg("-Ymacro-annotations", "-Ytasty-reader")
}
//
// rocket-chip
//
object rocketchip extends RocketChip
trait RocketChip
extends millbuild.`rocket-chip`.common.RocketChipModule
with SbtModule {
def scalaVersion: T[String] = T(defaultVersions("scala"))
override def millSourcePath = os.pwd / "rocket-chip"
def chiselModule = None
def chiselPluginJar = None
def chiselIvy = Some(getVersion("chisel"))
def chiselPluginIvy = Some(getVersion("chisel-plugin", cross=true))
def macrosModule = macros
def hardfloatModule = hardfloat
def cdeModule = cde
def mainargsIvy = ivy"com.lihaoyi::mainargs:0.5.0"
def json4sJacksonIvy = ivy"org.json4s::json4s-jackson:4.0.5"
//
// macros
//
object macros extends Macros
trait Macros
extends millbuild.`rocket-chip`.common.MacrosModule
with SbtModule {
def scalaVersion: T[String] = T(defaultVersions("scala"))
def scalaReflectIvy = ivy"org.scala-lang:scala-reflect:${defaultVersions("scala")}"
}
//
// hardfloat
//
object hardfloat extends Hardfloat
trait Hardfloat
extends millbuild.`rocket-chip`.hardfloat.common.HardfloatModule {
def scalaVersion: T[String] = T(defaultVersions("scala"))
override def millSourcePath = os.pwd / "rocket-chip" / "hardfloat" / "hardfloat"
def chiselModule = None
def chiselPluginJar = None
def chiselIvy = Some(getVersion("chisel"))
def chiselPluginIvy = Some(getVersion("chisel-plugin", cross=true))
}
//
// CDE
//
object cde extends CDE
trait CDE
extends millbuild.`rocket-chip`.cde.common.CDEModule
with ScalaModule {
def scalaVersion: T[String] = T(defaultVersions("scala"))
override def millSourcePath = os.pwd / "rocket-chip" / "cde" / "cde"
}
}
//
// xs-utils
//
object xsutils extends SbtModule with ScalafmtModule with CommonModule {
override def ivyDeps = Agg(getVersion("chisel"))
override def millSourcePath = os.pwd / "xs-utils"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip
)
}
//
// NHL2
//
object NHL2Project extends SbtModule with ScalafmtModule with CommonModule {
override def millSourcePath = os.pwd
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chisel"),
getVersion("chiseltest", "edu.berkeley.cs"),
)
override def moduleDeps = super.moduleDeps ++ Seq(rocketchip, xsutils)
object test extends SbtModuleTests with ScalafmtModule with TestModule.ScalaTest {
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("scalatest","org.scalatest")
)
def testFramework = "org.scalatest.tools.Framework"
}
}