1/*************************************************************************************** 2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3* 4* XiangShan is licensed under Mulan PSL v2. 5* You can use this software according to the terms and conditions of the Mulan PSL v2. 6* You may obtain a copy of Mulan PSL v2 at: 7* http://license.coscl.org.cn/MulanPSL2 8* 9* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 10* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 11* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 12* 13* See the Mulan PSL v2 for more details. 14***************************************************************************************/ 15 16import os.Path 17import mill._ 18import scalalib._ 19 20trait CommonModule extends ScalaModule { 21 override def scalaVersion = "2.12.10" 22 23 override def scalacOptions = Seq("-Xsource:2.11") 24 25 private val macroParadise = ivy"org.scalamacros:::paradise:2.1.0" 26 27 override def compileIvyDeps = Agg(macroParadise) 28 29 override def scalacPluginIvyDeps = Agg(macroParadise) 30} 31 32val chisel = Agg( 33 ivy"edu.berkeley.cs::chisel3:3.4.3" 34) 35 36object `api-config-chipsalliance` extends CommonModule { 37 override def millSourcePath = super.millSourcePath / "design" / "craft" 38} 39 40object hardfloat extends SbtModule with CommonModule { 41 override def millSourcePath = os.pwd / "berkeley-hardfloat" 42 override def ivyDeps = super.ivyDeps() ++ chisel 43} 44 45object `rocket-chip` extends SbtModule with CommonModule { 46 47 override def ivyDeps = super.ivyDeps() ++ Agg( 48 ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}", 49 ivy"org.json4s::json4s-jackson:3.6.1" 50 ) ++ chisel 51 52 object macros extends SbtModule with CommonModule 53 54 override def moduleDeps = super.moduleDeps ++ Seq( 55 `api-config-chipsalliance`, macros, hardfloat 56 ) 57 58} 59 60object `block-inclusivecache-sifive` extends CommonModule { 61 override def ivyDeps = super.ivyDeps() ++ chisel 62 63 override def millSourcePath = super.millSourcePath / 'design / 'craft / 'inclusivecache 64 65 override def moduleDeps = super.moduleDeps ++ Seq(`rocket-chip`) 66} 67 68object chiseltest extends CommonModule with SbtModule { 69 override def ivyDeps = super.ivyDeps() ++ Agg( 70 ivy"edu.berkeley.cs::treadle:1.3.0", 71 ivy"org.scalatest::scalatest:3.2.0", 72 ivy"com.lihaoyi::utest:0.7.4" 73 ) ++ chisel 74 object test extends Tests { 75 def ivyDeps = Agg(ivy"org.scalacheck::scalacheck:1.14.3") 76 def testFrameworks = Seq("org.scalatest.tools.Framework") 77 } 78} 79 80 81object XiangShan extends CommonModule with SbtModule { 82 override def millSourcePath = millOuterCtx.millSourcePath 83 84 override def forkArgs = Seq("-Xmx10G") 85 86 override def ivyDeps = super.ivyDeps() ++ chisel 87 override def moduleDeps = super.moduleDeps ++ Seq( 88 `rocket-chip`, 89 `block-inclusivecache-sifive`, 90 chiseltest 91 ) 92 93 object test extends Tests { 94 override def ivyDeps = super.ivyDeps() ++ Agg( 95 ivy"org.scalatest::scalatest:3.2.0" 96 ) 97 98 def testFrameworks = Seq( 99 "org.scalatest.tools.Framework" 100 ) 101 102 def testOnly(args: String*) = T.command { 103 super.runMain("org.scalatest.tools.Runner", args: _*) 104 } 105 } 106 107} 108