forked from OpenXiangShan/XiangShan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sc
179 lines (131 loc) · 4.95 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
/***************************************************************************************
* 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 os.Path
import mill._
import scalalib._
import publish._
import coursier.maven.MavenRepository
import $file.`rocket-chip`.common
import $file.`rocket-chip`.`api-config-chipsalliance`.`build-rules`.mill.build
import $file.`rocket-chip`.hardfloat.build
object ivys {
val sv = "2.12.13"
val chisel3 = ivy"edu.berkeley.cs::chisel3:3.5.0"
val chisel3Plugin = ivy"edu.berkeley.cs:::chisel3-plugin:3.5.0"
val chiseltest = ivy"edu.berkeley.cs::chiseltest:0.5.2"
val chiselCirct = ivy"com.sifive::chisel-circt:0.6.0"
val scalatest = ivy"org.scalatest::scalatest:3.2.2"
val macroParadise = ivy"org.scalamacros:::paradise:2.1.1"
}
trait XSModule extends ScalaModule with PublishModule {
// override this to use chisel from source
def chiselOpt: Option[PublishModule] = None
override def scalaVersion = ivys.sv
override def compileIvyDeps = Agg(ivys.macroParadise)
override def scalacPluginIvyDeps = Agg(ivys.macroParadise, ivys.chisel3Plugin)
override def scalacOptions = Seq("-Xsource:2.11")
override def ivyDeps = (if(chiselOpt.isEmpty) Agg(ivys.chisel3) else Agg.empty[Dep]) ++ Agg(ivys.chiselCirct)
override def moduleDeps = Seq() ++ chiselOpt
def publishVersion = "0.0.1"
// TODO: fix this
def pomSettings = PomSettings(
description = "XiangShan",
organization = "",
url = "https://github.com/OpenXiangShan/XiangShan",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("OpenXiangShan", "XiangShan"),
developers = Seq.empty
)
}
object rocketchip extends `rocket-chip`.common.CommonRocketChip {
val rcPath = os.pwd / "rocket-chip"
override def scalaVersion = ivys.sv
override def scalacOptions = Seq("-Xsource:2.11")
override def millSourcePath = rcPath
object configRocket extends `rocket-chip`.`api-config-chipsalliance`.`build-rules`.mill.build.config with PublishModule {
override def millSourcePath = rcPath / "api-config-chipsalliance" / "design" / "craft"
override def scalaVersion = T {
rocketchip.scalaVersion()
}
override def pomSettings = T {
rocketchip.pomSettings()
}
override def publishVersion = T {
rocketchip.publishVersion()
}
}
object hardfloatRocket extends `rocket-chip`.hardfloat.build.hardfloat {
override def millSourcePath = rcPath / "hardfloat"
override def scalaVersion = T {
rocketchip.scalaVersion()
}
def chisel3IvyDeps = if(chisel3Module.isEmpty) Agg(
common.getVersion("chisel3")
) else Agg.empty[Dep]
def chisel3PluginIvyDeps = Agg(common.getVersion("chisel3-plugin", cross=true))
}
def hardfloatModule = hardfloatRocket
def configModule = configRocket
}
object huancun extends XSModule with SbtModule {
override def millSourcePath = os.pwd / "huancun"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip,
utility
)
}
object difftest extends XSModule with SbtModule {
override def millSourcePath = os.pwd / "difftest"
}
object fudian extends XSModule with SbtModule
object utility extends XSModule with SbtModule {
override def millSourcePath = os.pwd / "utility"
override def moduleDeps = super.moduleDeps ++ Seq(
rocketchip
)
}
// extends this trait to use XiangShan in other projects
trait CommonXiangShan extends XSModule with SbtModule { m =>
// module deps
def rocketModule: PublishModule
def difftestModule: PublishModule
def huancunModule: PublishModule
def fudianModule: PublishModule
def utilityModule: PublishModule
override def millSourcePath = os.pwd
override def forkArgs = Seq("-Xmx64G", "-Xss256m")
override def ivyDeps = super.ivyDeps() ++ Seq(ivys.chiseltest)
override def moduleDeps = super.moduleDeps ++ Seq(
rocketModule,
difftestModule,
huancunModule,
fudianModule,
utilityModule
)
object test extends Tests with TestModule.ScalaTest {
override def forkArgs = m.forkArgs
override def ivyDeps = super.ivyDeps() ++ Agg(
ivys.scalatest
)
}
}
object XiangShan extends CommonXiangShan {
override def rocketModule = rocketchip
override def difftestModule = difftest
override def huancunModule = huancun
override def fudianModule = fudian
override def utilityModule = utility
}