1*2102afb5SLinJiaweiimport os.Path 2*2102afb5SLinJiaweiimport mill._ 3*2102afb5SLinJiaweiimport mill.modules.Util 4*2102afb5SLinJiaweiimport scalalib._ 52905e463SZihao Yuimport coursier.maven.MavenRepository 6*2102afb5SLinJiaweiimport $file.`rocket-chip`.chisel3.build 7*2102afb5SLinJiaweiimport $file.`rocket-chip`.firrtl.build 82905e463SZihao Yu 92905e463SZihao Yuobject CustomZincWorkerModule extends ZincWorkerModule { 102905e463SZihao Yu def repositories() = super.repositories ++ Seq( 112905e463SZihao Yu MavenRepository("https://oss.sonatype.org/content/repositories/releases"), 122905e463SZihao Yu MavenRepository("https://oss.sonatype.org/content/repositories/snapshots") 132905e463SZihao Yu ) 142905e463SZihao Yu} 152905e463SZihao Yu 16*2102afb5SLinJiaweitrait CommonModule extends ScalaModule 17*2102afb5SLinJiawei{ 18*2102afb5SLinJiawei override def scalaVersion = "2.12.10" 19*2102afb5SLinJiawei override def scalacOptions = Seq("-Xsource:2.11") 20*2102afb5SLinJiawei override def zincWorker = CustomZincWorkerModule 21*2102afb5SLinJiawei private val macroParadise = ivy"org.scalamacros:::paradise:2.1.0" 22*2102afb5SLinJiawei override def compileIvyDeps = Agg(macroParadise) 23*2102afb5SLinJiawei override def scalacPluginIvyDeps = Agg(macroParadise) 242905e463SZihao Yu} 252905e463SZihao Yu 26*2102afb5SLinJiaweiobject `rocket-chip` extends SbtModule with CommonModule { 27*2102afb5SLinJiawei 28*2102afb5SLinJiawei override def ivyDeps = super.ivyDeps() ++ Agg( 29*2102afb5SLinJiawei ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}", 30*2102afb5SLinJiawei ivy"org.json4s::json4s-jackson:3.6.1" 31*2102afb5SLinJiawei ) 32*2102afb5SLinJiawei 33*2102afb5SLinJiawei object rocketFirrtl extends $file.`rocket-chip`.firrtl.build.firrtlCrossModule("2.12.11") { 34*2102afb5SLinJiawei override def millSourcePath = super.millSourcePath / 'firrtl 35*2102afb5SLinJiawei } 36*2102afb5SLinJiawei 37*2102afb5SLinJiawei object rocketChisel extends $file.`rocket-chip`.chisel3.build.chisel3CrossModule("2.12.11") { 38*2102afb5SLinJiawei override def millSourcePath = super.millSourcePath / 'chisel3 39*2102afb5SLinJiawei def firrtlModule: Option[PublishModule] = Some(rocketFirrtl) 40*2102afb5SLinJiawei } 41*2102afb5SLinJiawei 42*2102afb5SLinJiawei 43*2102afb5SLinJiawei object `api-config-chipsalliance` extends CommonModule { 44*2102afb5SLinJiawei override def millSourcePath = super.millSourcePath / 'design / 'craft 45*2102afb5SLinJiawei } 46*2102afb5SLinJiawei 47*2102afb5SLinJiawei object macros extends SbtModule with CommonModule 48*2102afb5SLinJiawei 49*2102afb5SLinJiawei object hardfloat extends SbtModule with CommonModule { 50*2102afb5SLinJiawei override def moduleDeps = super.moduleDeps ++ Seq(rocketChisel) 51*2102afb5SLinJiawei } 52*2102afb5SLinJiawei 53*2102afb5SLinJiawei override def moduleDeps = super.moduleDeps ++ Seq( 54*2102afb5SLinJiawei rocketChisel, `api-config-chipsalliance`, macros, hardfloat 55*2102afb5SLinJiawei ) 56*2102afb5SLinJiawei 57*2102afb5SLinJiawei} 58*2102afb5SLinJiawei 59*2102afb5SLinJiaweiobject XiangShan extends CommonModule with SbtModule { 60*2102afb5SLinJiawei override def millSourcePath = millOuterCtx.millSourcePath 61*2102afb5SLinJiawei override def forkArgs = Seq("-Xmx10G") 62*2102afb5SLinJiawei override def ivyDeps = super.ivyDeps() ++ Agg( 63ee54eb88SZihao Yu ivy"edu.berkeley.cs::chisel3:3.3.2" 642905e463SZihao Yu ) 65*2102afb5SLinJiawei override def moduleDeps = super.moduleDeps ++ Seq(`rocket-chip`) 662905e463SZihao Yu 672905e463SZihao Yu object test extends Tests { 68*2102afb5SLinJiawei override def ivyDeps = super.ivyDeps() ++ Agg( 696aea7ec5SLinJiawei ivy"org.scalatest::scalatest:3.0.4", 702209d540SLinJiawei ivy"edu.berkeley.cs::chisel-iotesters:1.2+", 712209d540SLinJiawei ivy"edu.berkeley.cs::chiseltest:0.2.1" 726aea7ec5SLinJiawei ) 73*2102afb5SLinJiawei 74*2102afb5SLinJiawei def testFrameworks = Seq( 75*2102afb5SLinJiawei "org.scalatest.tools.Framework" 76*2102afb5SLinJiawei ) 77*2102afb5SLinJiawei 78fc85214eSLinJiawei def testOnly(args: String*) = T.command { 79fc85214eSLinJiawei super.runMain("org.scalatest.tools.Runner", args: _*) 80fc85214eSLinJiawei } 812905e463SZihao Yu } 822905e463SZihao Yu 832905e463SZihao Yu} 842905e463SZihao Yu 85