forked from OpenXiangShan/XiangShan
-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.sc
205 lines (142 loc) · 5.27 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
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/***************************************************************************************
* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
* Copyright (c) 2020-2021 Peng Cheng Laboratory
*
* XiangShan is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
***************************************************************************************/
import mill._
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("-Ytasty-reader", "-Ymacro-annotations")
}
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"
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")}"
}
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))
}
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"
}
}
object difftest extends SbtModule with ScalafmtModule with CommonModule {
override def ivyDeps = Agg(getVersion("chisel"))
override def millSourcePath = os.pwd / "difftest"
}
object fudian extends SbtModule with ScalafmtModule with CommonModule {
override def ivyDeps = Agg(getVersion("chisel"))
override def millSourcePath = os.pwd / "fudian"
}
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
)
}
object huancun extends SbtModule with ScalafmtModule with CommonModule {
override def ivyDeps = Agg(getVersion("chisel"))
override def millSourcePath = os.pwd / "huancun"
override def moduleDeps = super.moduleDeps ++ Seq(rocketchip, xsutils)
}
object axi2tl extends CommonModule with SbtModule {
override def millSourcePath = os.pwd / "coupledL2" / "AXItoTL"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip,
xsutils
)
}
object coupledL2 extends SbtModule with ScalafmtModule with CommonModule {
override def ivyDeps = Agg(getVersion("chisel"))
override def millSourcePath = os.pwd / "coupledL2"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip,
huancun,
xsutils,
axi2tl
)
}
object XiangShan extends SbtModule with ScalafmtModule with CommonModule {
override def millSourcePath = millOuterCtx.millSourcePath
override def forkArgs = Seq("-Xmx64G", "-Xss256m")
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("chisel"),
getVersion("chiseltest", "edu.berkeley.cs"),
)
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip,
xsutils,
huancun,
difftest,
coupledL2,
fudian,
axi2tl
)
object test extends SbtModuleTests with TestModule.ScalaTest {
override def ivyDeps = super.ivyDeps() ++ Agg(
getVersion("scalatest","org.scalatest")
)
def testFramework = "org.scalatest.tools.Framework"
}
}