Skip to content

Commit

Permalink
[script] fix outdated script
Browse files Browse the repository at this point in the history
Signed-off-by: Avimitin <[email protected]>
  • Loading branch information
Avimitin committed Sep 3, 2024
1 parent ebc9bd1 commit e7c0b81
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 504 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ __pycache__
test-results
target
.ccls-cache
t1-sim-result/
131 changes: 53 additions & 78 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,30 @@ import $file.dependencies.rvdecoderdb.common
import $file.common

object v {
val scala = "2.13.14"
val scala = "2.13.14"
val mainargs = ivy"com.lihaoyi::mainargs:0.5.0"
val oslib = ivy"com.lihaoyi::os-lib:0.9.1"
val upickle = ivy"com.lihaoyi::upickle:3.3.1"
val spire = ivy"org.typelevel::spire:latest.integration"
val oslib = ivy"com.lihaoyi::os-lib:0.9.1"
val upickle = ivy"com.lihaoyi::upickle:3.3.1"
val spire = ivy"org.typelevel::spire:latest.integration"
val evilplot = ivy"io.github.cibotech::evilplot:latest.integration"
}

object chisel extends Chisel

trait Chisel extends millbuild.dependencies.chisel.build.Chisel {
def crossValue = v.scala
def crossValue = v.scala
override def millSourcePath = os.pwd / "dependencies" / "chisel"
}

object arithmetic extends Arithmetic

trait Arithmetic extends millbuild.dependencies.arithmetic.common.ArithmeticModule {
override def millSourcePath = os.pwd / "dependencies" / "arithmetic" / "arithmetic"
def scalaVersion = T(v.scala)
def scalaVersion = T(v.scala)

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselIvy = None
def chiselIvy = None
def chiselPluginIvy = None

def spireIvy: T[Dep] = v.spire
Expand All @@ -51,34 +51,34 @@ object axi4 extends AXI4

trait AXI4 extends millbuild.dependencies.`chisel-interface`.common.AXI4Module {
override def millSourcePath = os.pwd / "dependencies" / "chisel-interface" / "axi4"
def scalaVersion = v.scala
def scalaVersion = v.scala

def mainargsIvy = v.mainargs

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselIvy = None
def chiselIvy = None
def chiselPluginIvy = None
}

object hardfloat extends Hardfloat

trait Hardfloat extends millbuild.dependencies.`berkeley-hardfloat`.common.HardfloatModule {
override def millSourcePath = os.pwd / "dependencies" / "berkeley-hardfloat" / "hardfloat"
def scalaVersion = T(v.scala)
def scalaVersion = T(v.scala)

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselIvy = None
def chiselIvy = None
def chiselPluginIvy = None
}

object rvdecoderdb extends RVDecoderDB

trait RVDecoderDB extends millbuild.dependencies.rvdecoderdb.common.RVDecoderDBJVMModule with ScalaModule {
def scalaVersion = T(v.scala)
def osLibIvy = v.oslib
def upickleIvy = v.upickle
def scalaVersion = T(v.scala)
def osLibIvy = v.oslib
def upickleIvy = v.upickle
override def millSourcePath = os.pwd / "dependencies" / "rvdecoderdb" / "rvdecoderdb"
}

Expand All @@ -87,15 +87,15 @@ object t1 extends T1
trait T1 extends millbuild.common.T1Module with ScalafmtModule {
def scalaVersion = T(v.scala)

def arithmeticModule = arithmetic
def axi4Module = axi4
def hardfloatModule = hardfloat
def arithmeticModule = arithmetic
def axi4Module = axi4
def hardfloatModule = hardfloat
def rvdecoderdbModule = rvdecoderdb
def riscvOpcodesPath = T.input(PathRef(os.pwd / "dependencies" / "riscv-opcodes"))
def riscvOpcodesPath = T.input(PathRef(os.pwd / "dependencies" / "riscv-opcodes"))

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselIvy = None
def chiselIvy = None
def chiselPluginIvy = None
}

Expand All @@ -112,29 +112,29 @@ trait ConfigGen extends millbuild.common.ConfigGenModule with ScalafmtModule {
object rocketv extends RocketV

trait RocketV extends millbuild.common.RocketVModule with ScalafmtModule {
def scalaVersion = T(v.scala)
def scalaVersion = T(v.scala)
def rvdecoderdbModule = rvdecoderdb
def riscvOpcodesPath = T.input(PathRef(os.pwd / "dependencies" / "riscv-opcodes"))
def hardfloatModule = hardfloat
def axi4Module = axi4
def riscvOpcodesPath = T.input(PathRef(os.pwd / "dependencies" / "riscv-opcodes"))
def hardfloatModule = hardfloat
def axi4Module = axi4

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object t1rocket extends T1Rocket

trait T1Rocket extends millbuild.common.T1RocketModule with ScalafmtModule {
def scalaVersion = T(v.scala)
def rocketModule = rocketv
def t1Module = t1
def t1Module = t1

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object ipemu extends IPEmulator
Expand All @@ -144,22 +144,22 @@ trait IPEmulator extends millbuild.common.IPEmulatorModule {

def t1Module = t1

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object rocketemu extends RocketEmulator
object rocketemu extends RocketEmulator
trait RocketEmulator extends millbuild.common.RocketEmulatorModule {
def scalaVersion = T(v.scala)

def rocketVModule = rocketv

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object t1rocketemu extends T1RocketEmulator
Expand All @@ -169,10 +169,10 @@ trait T1RocketEmulator extends millbuild.common.T1RocketEmulatorModule {

def t1rocketModule = t1rocket

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object panamaconverter extends PanamaConverter
Expand Down Expand Up @@ -206,10 +206,10 @@ trait Elaborator extends millbuild.common.ElaboratorModule {

def mainargsIvy = v.mainargs

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object omreaderlib extends OMReaderLib
Expand All @@ -223,10 +223,10 @@ trait OMReaderLib extends millbuild.common.OMReaderLibModule {

def mainargsIvy = v.mainargs

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

object omreader extends OMReader
Expand All @@ -235,34 +235,28 @@ trait OMReader extends millbuild.common.OMReaderModule {
def scalaVersion = T(v.scala)

def panamaconverterModule = panamaconverter
def omreaderlibModule = omreaderlib
def omreaderlibModule = omreaderlib

def circtInstallPath = T.input(PathRef(os.Path(T.ctx().env("CIRCT_INSTALL_PATH"))))

def mainargsIvy = v.mainargs

def chiselModule = Some(chisel)
def chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
def chiselIvy = None
}

/** A simple release flow for T1 generator:
* package required dependency to flat jar.
* usage:
* mill t1package.{sourceJar,jar}
* out/t1package/sourceJar.dest/out.jar -> t1package-sources.jar
* out/t1package/jar.dest/out.jar -> t1package.jar
* out/t1package/chiselPluginJar.dest/out.jar -> chiselPlugin.jar
* these two jar is enough for this usages:
* object somepackagethatdependsont1 extends ScalaModule {
* def unmanagedClasspath = T(Seq(PathRef(os.pwd / "t1package.jar"), PathRef(os.pwd / "t1package-sources.jar")))
* }
* For Jiuyang's Team, this is used for link T1 to NDA Blackboxes that cannot be open-sourced
/** A simple release flow for T1 generator: package required dependency to flat jar. usage: mill
* t1package.{sourceJar,jar} out/t1package/sourceJar.dest/out.jar -> t1package-sources.jar
* out/t1package/jar.dest/out.jar -> t1package.jar out/t1package/chiselPluginJar.dest/out.jar -> chiselPlugin.jar these
* two jar is enough for this usages: object somepackagethatdependsont1 extends ScalaModule { def unmanagedClasspath =
* T(Seq(PathRef(os.pwd / "t1package.jar"), PathRef(os.pwd / "t1package-sources.jar"))) } For Jiuyang's Team, this is
* used for link T1 to NDA Blackboxes that cannot be open-sourced
*/
object t1package extends ScalaModule {
def scalaVersion = T(v.scala)
def moduleDeps = super.moduleDeps ++ Seq(t1, ipemu, panamaconverter, omreaderlib)
def moduleDeps = super.moduleDeps ++ Seq(t1, ipemu, panamaconverter, omreaderlib)
override def sourceJar: T[PathRef] = T(
Jvm.createJar(
T.traverse(transitiveModuleDeps)(dep => T.sequence(Seq(dep.allSources, dep.resources, dep.compileResources)))()
Expand All @@ -279,22 +273,3 @@ object t1package extends ScalaModule {
PathRef(jar)
}
}

trait ScriptModule extends ScalaModule {
val scala3 = "3.3.3"
val mainargs = ivy"com.lihaoyi::mainargs:0.5.0"
val oslib = ivy"com.lihaoyi::os-lib:0.10.0"
val upickle = ivy"com.lihaoyi::upickle:3.3.1"

def scalaVersion = scala3
def scalacOptions = Seq("-new-syntax")
override def ivyDeps = Agg(mainargs, oslib, upickle)
override def millSourcePath = os.pwd / "script"
}

object emuHelper extends ScriptModule {
override def millSourcePath = super.millSourcePath / "emu"
}
object ciHelper extends ScriptModule {
override def millSourcePath = super.millSourcePath / "ci"
}
2 changes: 1 addition & 1 deletion nix/t1/mill-modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ let
./../../common.sc
];
};
millDepsHash = "sha256-Wkp2nLl6941F2ja3uQOpjB3S79vbDTAXStnDU1C6u3s=";
millDepsHash = "sha256-DQeKTqf+MES5ubORu+SMJEiqpOCXsS7VgxUnSqG12Bs=";
nativeBuildInputs = [ dependencies.setupHook ];
};

Expand Down
2 changes: 1 addition & 1 deletion nix/t1/omreader.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let
./../../common.sc
];
};
millDepsHash = "sha256-Wkp2nLl6941F2ja3uQOpjB3S79vbDTAXStnDU1C6u3s=";
millDepsHash = "sha256-DQeKTqf+MES5ubORu+SMJEiqpOCXsS7VgxUnSqG12Bs=";
nativeBuildInputs = [ dependencies.setupHook ];
};

Expand Down
22 changes: 22 additions & 0 deletions script/build.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import mill._
import mill.scalalib._
import mill.define.{Command, TaskModule}
import mill.scalalib.publish._
import mill.scalalib.scalafmt._
import mill.scalalib.TestModule.Utest
import mill.util.Jvm
import coursier.maven.MavenRepository

trait ScriptModule extends ScalaModule {
val scala3 = "3.3.3"
val mainargs = ivy"com.lihaoyi::mainargs:0.5.0"
val oslib = ivy"com.lihaoyi::os-lib:0.10.0"
val upickle = ivy"com.lihaoyi::upickle:3.3.1"

def scalaVersion = scala3
def scalacOptions = Seq("-new-syntax", "-deprecation")
override def ivyDeps = Agg(mainargs, oslib, upickle)
}

object emu extends ScriptModule {}
object ci extends ScriptModule {}
2 changes: 1 addition & 1 deletion script/ci/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ object Main:
Logger.info("Fetching CI results")
val emuResultPath = os.Path(
nixResolvePath(
s".#t1.$config.ip.run._all${buildType}EmuResult",
s".#t1.$config.ip.run._all${emuType}EmuResult",
if emuType.toLowerCase() == "vcs" then Seq("--impure")
else Seq()
)
Expand Down
Loading

0 comments on commit e7c0b81

Please sign in to comment.