Repository navigation
Expand file tree
/
Copy pathbuild.sc
More file actions
183 lines (152 loc) · 6.18 KB
/
Copy pathbuild.sc
File metadata and controls
183 lines (152 loc) · 6.18 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// def ammoniteVersion = "2.5.11"
// import Mill dependency
import mill._
import mill.define.Sources
import mill.modules.Util
import mill.scalalib.scalafmt.ScalafmtModule
import mill.scalalib.TestModule.ScalaTest
import scalalib._
// Hack
import publish._
// support BSP
import mill.bsp._
// input build.sc from each repositories.
import $file.dependencies.chisel.build
import $file.dependencies.cde.build
import $file.dependencies.`berkeley-hardfloat`.build
import $file.dependencies.`rocket-chip`.common
// Global Scala Version
object ivys {
val sv = "2.13.11"
val upickle = ivy"com.lihaoyi::upickle:1.3.15"
val oslib = ivy"com.lihaoyi::os-lib:0.7.8"
val pprint = ivy"com.lihaoyi::pprint:0.6.6"
val utest = ivy"com.lihaoyi::utest:0.7.10"
val jline = ivy"org.scala-lang.modules:scala-jline:2.12.1"
val scalatest = ivy"org.scalatest::scalatest:3.2.2"
val scalatestplus = ivy"org.scalatestplus::scalacheck-1-14:3.1.1.1"
val scalacheck = ivy"org.scalacheck::scalacheck:1.14.3"
val scopt = ivy"com.github.scopt::scopt:3.7.1"
val playjson =ivy"com.typesafe.play::play-json:2.9.4"
val breeze = ivy"org.scalanlp::breeze:1.1"
val parallel = ivy"org.scala-lang.modules:scala-parallel-collections_3:1.0.4"
val mainargs = ivy"com.lihaoyi::mainargs:0.4.0"
}
// For modules not support mill yet, need to have a ScalaModule depend on our own repositories.
trait CommonModule extends ScalaModule {
override def scalaVersion = ivys.sv
override def scalacPluginClasspath = T { super.scalacPluginClasspath() ++ Agg(
mychisel.pluginModule.jar()
) }
override def scalacOptions = T {
super.scalacOptions() ++ Agg(s"-Xplugin:${mychisel.pluginModule.jar().path}", "-Ymacro-annotations", "-Ytasty-reader")
}
override def moduleDeps: Seq[ScalaModule] = Seq(mychisel)
}
object mychisel extends dependencies.chisel.build.Chisel(ivys.sv) {
override def millSourcePath = os.pwd / "dependencies" / "chisel"
}
object mycde extends dependencies.cde.build.cde(ivys.sv) with PublishModule {
override def millSourcePath = os.pwd / "dependencies" / "cde" / "cde"
}
object myrocketchip extends dependencies.`rocket-chip`.common.CommonRocketChip {
override def scalacPluginClasspath = T { super.scalacPluginClasspath() ++ Agg(
mychisel.pluginModule.jar()
) }
override def scalacOptions = T {
super.scalacOptions() ++ Agg(s"-Xplugin:${mychisel.pluginModule.jar().path}", "-Ymacro-annotations")
}
override def millSourcePath = os.pwd / "dependencies" / "rocket-chip"
override def scalaVersion = ivys.sv
def chisel3Module: Option[PublishModule] = Some(mychisel)
def hardfloatModule: PublishModule = myhardfloat
def cdeModule: PublishModule = mycde
}
object inclusivecache extends CommonModule {
override def millSourcePath = os.pwd / "dependencies" / "rocket-chip-inclusive-cache" / 'design / 'craft / "inclusivecache"
override def moduleDeps = super.moduleDeps ++ Seq(myrocketchip)
}
object blocks extends CommonModule with SbtModule {
override def millSourcePath = os.pwd / "dependencies" / "rocket-chip-blocks"
override def moduleDeps = super.moduleDeps ++ Seq(myrocketchip)
}
object shells extends CommonModule with SbtModule {
override def millSourcePath = os.pwd / "dependencies" / "rocket-chip-fpga-shells"
override def moduleDeps = super.moduleDeps ++ Seq(myrocketchip, blocks)
}
// UCB
object myhardfloat extends ScalaModule with SbtModule with PublishModule {
override def millSourcePath = os.pwd / "dependencies" / "berkeley-hardfloat"
def scalaVersion = ivys.sv
def chiselModule: Option[PublishModule] = Some(mychisel)
def chiselPluginJar: T[Option[PathRef]] = T(Some(mychisel.pluginModule.jar()))
// remove test dep
override def allSourceFiles = T(super.allSourceFiles().filterNot(_.path.last.contains("Tester")).filterNot(_.path.segments.contains("test")))
override def scalacPluginClasspath = T(super.scalacPluginClasspath() ++ chiselPluginJar())
override def moduleDeps = Seq() ++ chiselModule
override def scalacOptions = T(super.scalacOptions() ++ chiselPluginJar().map(path => s"-Xplugin:${path.path}"))
def publishVersion = de.tobiasroeser.mill.vcs.version.VcsVersion.vcsState().format()
def pomSettings = PomSettings(
description = artifactName(),
organization = "edu.berkeley.cs",
url = "http://chisel.eecs.berkeley.edu",
licenses = Seq(License.`BSD-3-Clause`),
versionControl = VersionControl.github("ucb-bar", "berkeley-hardfloat"),
developers = Seq(
Developer("jhauser-ucberkeley", "John Hauser", "https://www.colorado.edu/faculty/hauser/about/"),
Developer("aswaterman", "Andrew Waterman", "https://aspire.eecs.berkeley.edu/author/waterman/"),
Developer("yunsup", "Yunsup Lee", "https://aspire.eecs.berkeley.edu/author/yunsup/")
)
)
}
// Dummy
object playground extends CommonModule {
override def millSourcePath = os.pwd / "playground"
override def moduleDeps = super.moduleDeps ++ Seq(myrocketchip, inclusivecache, blocks, shells)
// add some scala ivy module you like here.
override def ivyDeps = Agg(
ivys.oslib,
ivys.pprint,
ivys.mainargs
)
def lazymodule: String = "tinygpu.GpuLazyModule"
def configs: String = "tinygpu.GpuConfig"
def elaborate = T {
mill.modules.Jvm.runSubprocess(
finalMainClass(),
runClasspath().map(_.path),
forkArgs(),
forkEnv(),
Seq(
"--dir", T.dest.toString,
"--lm", lazymodule,
"--configs", configs
),
workingDir = os.pwd,
)
PathRef(T.dest)
}
def verilog = T {
os.proc("firtool",
elaborate().path / s"${lazymodule.split('.').last}.fir",
"--disable-annotation-unknown",
"-dedup",
"-O=debug",
"--split-verilog",
"--preserve-values=named",
"--output-annotation-file=mfc.anno.json",
s"-o=${T.dest}"
).call(T.dest)
PathRef(T.dest)
}
object test extends Tests with TestModule.ScalaTest with ScalafmtModule {
def moduleDeps = Seq(playground)
override def ivyDeps = super.ivyDeps() ++ Agg(
// ivy"org.scalatest::scalatest::3.2.19",
// for formal flow in future
ivy"edu.berkeley.cs::chiseltest:6.0.0"
// ivy"org.chipsalliance::chisel-config:6.0.0"
)
override def testFramework = "org.scalatest.tools.Framework"
}
}