Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
[submodule "hardfloat"]
path = hardfloat
[submodule "dependencies/hardfloat"]
path = dependencies/hardfloat
url = https://github.com/ucb-bar/berkeley-hardfloat.git
[submodule "torture"]
path = torture
url = https://github.com/ucb-bar/riscv-torture.git
[submodule "cde"]
path = cde
[submodule "dependencies/cde"]
path = dependencies/cde
url = https://github.com/chipsalliance/cde.git
[submodule "dependencies/chisel"]
path = dependencies/chisel
url = https://github.com/chipsalliance/chisel.git
[submodule "dependencies/rvdecoderdb"]
path = dependencies/rvdecoderdb
url = https://github.com/sequencer/rvdecoderdb.git
[submodule "dependencies/riscv-opcodes"]
path = dependencies/riscv-opcodes
url = https://github.com/riscv/riscv-opcodes.git
80 changes: 58 additions & 22 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,37 @@ import mill._
import mill.scalalib._
import mill.scalalib.publish._
import coursier.maven.MavenRepository
import $file.hardfloat.common
import $file.cde.common
import $file.dependencies.hardfloat.common
import $file.dependencies.cde.common
import $file.dependencies.chisel.build
import $file.dependencies.rvdecoderdb.common
import $file.common

object v {
val scala = "2.13.10"
val scala = "2.13.12"
// the first version in this Map is the mainly supported version which will be used to run tests
val chiselCrossVersions = Map(
"3.6.0" -> (ivy"edu.berkeley.cs::chisel3:3.6.0", ivy"edu.berkeley.cs:::chisel3-plugin:3.6.0"),
"5.0.0" -> (ivy"org.chipsalliance::chisel:5.0.0", ivy"org.chipsalliance:::chisel-plugin:5.0.0"),
// "5.0.0" -> (ivy"org.chipsalliance::chisel:5.0.0", ivy"org.chipsalliance:::chisel-plugin:5.0.0"),
// build from project from source
"source" -> (ivy"org.chipsalliance::chisel:99", ivy"org.chipsalliance:::chisel-plugin:99"),
)
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.1.3"
val json4sJackson = ivy"org.json4s::json4s-jackson:4.0.5"
val scalaReflect = ivy"org.scala-lang:scala-reflect:${scala}"
}

// Build form source only for dev
object chisel extends Chisel

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

object macros extends Macros

trait Macros
Expand All @@ -33,35 +48,52 @@ trait Macros
object hardfloat extends mill.define.Cross[Hardfloat](v.chiselCrossVersions.keys.toSeq)

trait Hardfloat
extends millbuild.hardfloat.common.HardfloatModule
extends millbuild.dependencies.hardfloat.common.HardfloatModule
with RocketChipPublishModule
with Cross.Module[String] {

def scalaVersion: T[String] = T(v.scala)

override def millSourcePath = os.pwd / "hardfloat" / "hardfloat"
override def millSourcePath = os.pwd / "dependencies" / "hardfloat" / "hardfloat"

def chiselModule = None
def chiselModule = Option.when(crossValue == "source")(chisel)

def chiselPluginJar = None
def chiselPluginJar = T(Option.when(crossValue == "source")(chisel.pluginModule.jar()))

def chiselIvy = Some(v.chiselCrossVersions(crossValue)._1)
def chiselIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._1)

def chiselPluginIvy = Some(v.chiselCrossVersions(crossValue)._2)
def chiselPluginIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._2)
}

object cde extends CDE

trait CDE
extends millbuild.cde.common.CDEModule
extends millbuild.dependencies.cde.common.CDEModule
with RocketChipPublishModule
with ScalaModule {

def scalaVersion: T[String] = T(v.scala)

override def millSourcePath = os.pwd / "cde" / "cde"
override def millSourcePath = os.pwd / "dependencies" / "cde" / "cde"
}

object rvdecoderdb extends RVDecoderDB

trait RVDecoderDB
extends millbuild.dependencies.rvdecoderdb.common.RVDecoderDBJVMModule
with RocketChipPublishModule
with ScalaModule {

def scalaVersion: T[String] = T(v.scala)

def osLibIvy = v.oslib

def upickleIvy = v.upickle

override def millSourcePath = os.pwd / "dependencies" / "rvdecoderdb" / "rvdecoderdb"
}


object rocketchip extends Cross[RocketChip](v.chiselCrossVersions.keys.toSeq)

trait RocketChip
Expand All @@ -73,20 +105,22 @@ trait RocketChip

override def millSourcePath = super.millSourcePath / os.up

def chiselModule = None
def chiselModule = Option.when(crossValue == "source")(chisel)

def chiselPluginJar = None
def chiselPluginJar = T(Option.when(crossValue == "source")(chisel.pluginModule.jar()))

def chiselIvy = Some(v.chiselCrossVersions(crossValue)._1)
def chiselIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._1)

def chiselPluginIvy = Some(v.chiselCrossVersions(crossValue)._2)
def chiselPluginIvy = Option.when(crossValue != "source")(v.chiselCrossVersions(crossValue)._2)

def macrosModule = macros

def hardfloatModule = hardfloat(crossValue)

def cdeModule = cde

def rvdecoderdbModule = rvdecoderdb

def mainargsIvy = v.mainargs

def json4sJacksonIvy = v.json4sJackson
Expand Down Expand Up @@ -119,7 +153,7 @@ trait Emulator extends Cross.Module2[String, String] {
os.proc(
mill.util.Jvm.javaExe,
"-jar",
rocketchip(v.chiselCrossVersions.keys.head).assembly().path,
rocketchip(v.chiselCrossVersions.keys.last).assembly().path,
"--dir", T.dest.toString,
"--top", top,
config.split('_').flatMap(c => Seq("--config", c)),
Expand Down Expand Up @@ -219,6 +253,7 @@ trait Emulator extends Cross.Module2[String, String] {
| ${mfccompiler.rtls().map(_.path.toString).mkString("\n")}
| TOP_MODULE TestHarness
| PREFIX VTestHarness
| TRACE
| VERILATOR_ARGS ${verilatorArgs().mkString(" ")}
|)
|""".stripMargin
Expand All @@ -229,10 +264,11 @@ trait Emulator extends Cross.Module2[String, String] {
Seq(
// format: off
"-Wno-UNOPTTHREADS", "-Wno-STMTDLY", "-Wno-LATCH", "-Wno-WIDTH", "--no-timing",
"--x-assign unique",
"--x-assign 0",
"--x-initial 0",
"""+define+PRINTF_COND=\$c\(\"verbose\",\"&&\",\"done_reset\"\)""",
"""+define+STOP_COND=\$c\(\"done_reset\"\)""",
"+define+RANDOMIZE_GARBAGE_ASSIGN",
"+define+RANDOM=0",
"--output-split 20000",
"--output-split-cfuncs 20000",
"--max-num-width 1048576",
Expand Down Expand Up @@ -294,8 +330,8 @@ object emulator extends Cross[Emulator](
//
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultRV32Config"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.DefaultFP16Config"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCryptoConfig"),
("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCrypto32Config"),
// ("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCryptoConfig"),
// ("freechips.rocketchip.system.TestHarness", "freechips.rocketchip.system.BitManipCrypto32Config"),
)

object `runnable-riscv-test` extends mill.Cross[RiscvTest](
Expand Down
5 changes: 4 additions & 1 deletion common.sc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ trait RocketChipModule
// should be cde/common.sc#CDEModule
def cdeModule: ScalaModule

// should be dependencies/rvdecoderdb/common.sc#RVDecoderDB
def rvdecoderdbModule: ScalaModule

def mainargsIvy: Dep

def json4sJacksonIvy: Dep

override def moduleDeps = super.moduleDeps ++ Seq(macrosModule, hardfloatModule, cdeModule)
override def moduleDeps = super.moduleDeps ++ Seq(macrosModule, hardfloatModule, cdeModule, rvdecoderdbModule)

override def ivyDeps = T(
super.ivyDeps() ++ Agg(
Expand Down
1 change: 1 addition & 0 deletions dependencies/chisel
Submodule chisel added at 447481
1 change: 1 addition & 0 deletions dependencies/riscv-opcodes
Submodule riscv-opcodes added at 2c457d
1 change: 1 addition & 0 deletions dependencies/rvdecoderdb
Submodule rvdecoderdb added at 2b322c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package freechips.rocketchip.rocket

import chisel3.util._
import freechips.rocketchip.rocket._

object CustomInstructions {
def MNRET = BitPat("b01110000001000000000000001110011")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package freechips.rocketchip.rocket
import chisel3._
import chisel3.util.BitPat
import chisel3.util.experimental.decode._
import freechips.rocketchip.rocket._

object DecodeLogic
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import chisel3._
import chisel3.util._
import org.chipsalliance.cde.config.Parameters
import freechips.rocketchip.util._
import freechips.rocketchip.rocket._
import Instructions._
import CustomInstructions._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package freechips.rocketchip.rocket

import chisel3.util._
import freechips.rocketchip.rocket._

/* make EXTENSIONS="rv_* rv64*" inst.chisel */

Expand Down
Loading