-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.sc
59 lines (47 loc) · 1.96 KB
/
common.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
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]>
import mill._
import mill.scalalib._
trait HasChisel extends ScalaModule {
// Define these for building chisel from source
def chiselModule: Option[ScalaModule]
override def moduleDeps = super.moduleDeps ++ chiselModule
def chiselPluginJar: T[Option[PathRef]]
override def scalacOptions = T(
super.scalacOptions() ++ chiselPluginJar().map(path => s"-Xplugin:${path.path}") ++ Seq("-Ymacro-annotations")
)
override def scalacPluginClasspath: T[Agg[PathRef]] = T(super.scalacPluginClasspath() ++ chiselPluginJar())
// Define these for building chisel from ivy
def chiselIvy: Option[Dep]
override def ivyDeps = T(super.ivyDeps() ++ chiselIvy)
def chiselPluginIvy: Option[Dep]
override def scalacPluginIvyDeps: T[Agg[Dep]] = T(
super.scalacPluginIvyDeps() ++ chiselPluginIvy.map(Agg(_)).getOrElse(Agg.empty[Dep])
)
}
trait SDRAMControllerModule extends HasChisel {
// Use for elaboration.
def mainargsIvy: Dep
def dwbbModule: ScalaModule
def axi4Module: ScalaModule
def sdramModule: ScalaModule
override def moduleDeps: Seq[JavaModule] =
super.moduleDeps ++ Seq(sdramModule, axi4Module, dwbbModule)
override def ivyDeps = T(super.ivyDeps() ++ Some(mainargsIvy))
}
trait ElaboratorModule extends ScalaModule with HasChisel {
def generators: Seq[ScalaModule]
def panamaconverterModule: ScalaModule
def circtInstallPath: T[PathRef]
override def moduleDeps = super.moduleDeps ++ Seq(panamaconverterModule) ++ generators
def mainargsIvy: Dep
override def ivyDeps = T(super.ivyDeps() ++ Seq(mainargsIvy))
override def javacOptions = T(super.javacOptions() ++ Seq("--enable-preview", "--release", "21"))
override def forkArgs: T[Seq[String]] = T(
super.forkArgs() ++ Seq(
"--enable-native-access=ALL-UNNAMED",
"--enable-preview",
s"-Djava.library.path=${circtInstallPath().path / "lib"}"
)
)
}