Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jiuyang/rocket t1 #715

Closed
wants to merge 132 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
05cf7d8
[build system] add rocketv build target
sequencer Jun 27, 2024
5304c01
[build system] implement the generic Elaborator trait
sequencer Jun 25, 2024
abb34a2
[build system] add rocketv to elaborator
sequencer Jun 27, 2024
c5be9ad
[rocketv] copy ALU into rocketv project
sequencer Jun 27, 2024
7d73773
[rocketv] migrate ALU
sequencer Jun 27, 2024
c068966
[rocketv] add elaborator for ALU
sequencer Jun 27, 2024
bea9b56
[rocketv] copy AMOALU into rocketv project
sequencer Jun 27, 2024
4ca216a
[rocketv] migrate AMOALU
sequencer Jun 27, 2024
533dd1f
[rocketv] add elaborator for AMOALU
sequencer Jun 27, 2024
3b14f41
[rocketv] copy Breakpoint into rocketv project
sequencer Jun 27, 2024
96fab65
[rocketv] migrate BreakpointUnit
sequencer Jun 27, 2024
b7fe21a
[rocketv] add elaborator for BreakpointUnit
sequencer Jun 27, 2024
357c852
[rocketv] copy BTB into rocketv project
sequencer Jun 27, 2024
e0e1489
[rocketv] migrate PopCountAtLeast
sequencer Jun 27, 2024
09a1f34
[rocketv] copy ReplacementPolicy into rocketv project
sequencer Jun 30, 2024
84cb057
[rocketv] migrate Replacement
sequencer Jun 30, 2024
87465bc
[rocketv] migrate BTB
sequencer Jun 27, 2024
9882898
[rocketv] add elaborator for BTB
sequencer Jun 27, 2024
45e251f
[rocketv] copy CSR into rocketv project
sequencer Jun 27, 2024
de38f18
[rocketv] migrate CSR
sequencer Jun 28, 2024
317b451
[rocketv] add elaborator for CSR
sequencer Jun 28, 2024
0c58a9e
[rocketv] migrate Decoder
sequencer Jun 29, 2024
dbc4d03
[rocketv] add elaborator for Decoder
sequencer Jun 29, 2024
d1c440b
[rocketv] copy RVCExpander into rocketv project
sequencer Jun 29, 2024
705c7ae
[rocketv] migrate RVCExpander
sequencer Jun 29, 2024
1e26979
[rocketv] add elaborator for RVCExpander
sequencer Jun 29, 2024
6b0cbe3
[rocketv] copy IBuf into rocketv project
sequencer Jun 29, 2024
8c5c01d
[rocketv] migrate IBuf
sequencer Jun 29, 2024
a92f82b
[rocketv] add elaborator for IBuf
sequencer Jun 29, 2024
9ef7a3e
[rocketv] copy Multipler into rocketv project
sequencer Jun 29, 2024
382cf67
[rocketv] migrate MulDiv and PipelinedMultiplier
sequencer Jun 29, 2024
562963c
[rocketv] add elaborator for MulDiv and PipelinedMultiplier
sequencer Jun 29, 2024
349a348
[rocketv] copy PMA into rocketv project
sequencer Jun 29, 2024
d46faa9
[rocketv] migrate PMAChecker
sequencer Jun 29, 2024
425f460
[rocketv] add elaborator for PMAChecker
sequencer Jun 29, 2024
1be221e
[rocketv] copy PMP into rocketv project
sequencer Jun 29, 2024
dbd514b
[rocketv] migrate PMPChecker
sequencer Jun 29, 2024
5643109
[rocketv] add elaborator for PMAChecker
sequencer Jun 29, 2024
7d095d1
[rocketv] copy PTW into rocketv project
sequencer Jun 29, 2024
eda7686
[rocketv] copy ECC into rocketv project
qinjun-li Jun 28, 2024
ab55464
[rocketv] migrate PTW
sequencer Jun 30, 2024
fda5a5c
[rocketv] add elaborator for PTW
sequencer Jun 30, 2024
f2e2b6f
[rocketv] copy ICache into rocketv project
qinjun-li Jun 28, 2024
27ebda5
[rocketv] migrate ICache
qinjun-li Jun 28, 2024
bb1eb36
[rocketv] add elaborator for ICache
qinjun-li Jun 28, 2024
be04b8c
[rocketv] copy FPU into rocketv project
sequencer Jun 30, 2024
238fb36
[rocketv] migrate FPU
sequencer Jul 1, 2024
f752663
[rocketv] add elaborator for FPU
sequencer Jul 1, 2024
e1c9a58
[rocketv] copy TLB into rocketv project
sequencer Jul 1, 2024
2a70b80
[rocketv] migrate TLB
sequencer Jul 1, 2024
b6fb6e5
[rocketv] add elaborator for TLB
sequencer Jul 1, 2024
1a80470
[rocketv] copy DCache into rocketv project
qinjun-li Jul 1, 2024
3ce70d7
[rocketv] migrate DCache
qinjun-li Jul 1, 2024
a88c3dc
[rocketv] add elaborator for DCache
qinjun-li Jul 1, 2024
5f96759
[rocketv] copy Frontend into rocketv project
sequencer Jul 1, 2024
45b7391
[rocketv] migrate Frontend
sequencer Jul 1, 2024
85bded4
[rocketv] add elaborator for Frontend
sequencer Jul 2, 2024
9948ab4
[rocketv] copy RocketCore into rocketv project
sequencer Jul 2, 2024
cd6cbb3
[rocketv] migrate Rocket
sequencer Jul 3, 2024
42dfc6a
[rocketv] add elaborator for Rocket
sequencer Jul 3, 2024
8786c24
[rocketv] copy RocketTile into rocketv project
sequencer Jul 3, 2024
a93be15
[rocketv] implementing RocketTile
sequencer Jul 4, 2024
5c78afd
[rocketv] add elaborator for RocketTile
sequencer Jul 4, 2024
e11eb9a
[rocketv] add t1 specific logic
sequencer Aug 6, 2024
6f95507
[nix]: add rocketv derivation
Avimitin Jul 7, 2024
637755a
[nix] add rocketv-mlirbc
Avimitin Jul 7, 2024
8aca619
[nix] add rocketv-rtl target
Avimitin Jul 7, 2024
abd0eb7
[nix] add new derivation rocketv-verilated-csrc
Avimitin Jul 7, 2024
4808513
[rocketemu] implement TestBench for RocketV Emulator
Avimitin Jul 8, 2024
c5eae3f
[nix] add rocketv into elaborator source
Avimitin Jul 8, 2024
630e69e
[nix] use elaborator for Rocket generate
Avimitin Jul 8, 2024
b188dfc
[rocketemu] expose AXI4 agent as C-API
Avimitin Jul 10, 2024
8f80272
[nix] add scope for rocketemu attribute
Avimitin Jul 10, 2024
dcf7d86
[rocketemu] implemented rocket driver
Avimitin Jul 10, 2024
45b76a4
[rocketemu] update TestBench implementation
Avimitin Jul 12, 2024
5929d7b
[rocketemu] update DPI C binding
Avimitin Jul 12, 2024
823dafa
[nix] add riscv-tests into overlay
Avimitin Jul 19, 2024
6c42d0e
[doc] add document about rocket emulator
Avimitin Jul 19, 2024
987b365
[rocketemu] migrate AXI from master
Avimitin Jul 19, 2024
cf9b990
[rocketemu] implement waveform generate
Avimitin Jul 19, 2024
f8e96f6
[rocketemu] add missing watchdog call
Clo91eaf Jul 22, 2024
4d183ef
[rocketemu] Requires a longer reset.
qinjun-li Jul 22, 2024
e9277fb
[rocketemu] fix wrong size
Clo91eaf Jul 22, 2024
9485a13
[rocketemu] refactor AXI read functions and remove the read alignment
Clo91eaf Jul 22, 2024
61ce1c0
[rocketemu] add axi read burst in TestBench
Clo91eaf Jul 23, 2024
2b9f1fd
[rocketv] fix DCache axi release.
qinjun-li Jul 23, 2024
c28d31d
[nix] use riscv32 embedded toolchain to compile riscv-tests
Avimitin Jul 23, 2024
f714059
[rocketemu] fix trace build for driver
Avimitin Jul 23, 2024
e4351fa
[rocketemu] cycle should equals to tick / 20
Clo91eaf Jul 23, 2024
66f53dc
[rocketemu] add riscv test env
Clo91eaf Jul 23, 2024
3ecd86c
[rocketemu] fix wrong exit macro
Clo91eaf Jul 23, 2024
582401c
[rocketemu] fix wrong sw format
Clo91eaf Jul 23, 2024
47f15e9
[nix] use t1-env for riscv-tests
Avimitin Jul 23, 2024
cf0783c
[tests] fix MMIO write when exit
Avimitin Jul 23, 2024
4abc621
[rocketemu] remove ecall
Clo91eaf Jul 24, 2024
0412573
[rocketemu] add quit functionality to terminate simulation
Clo91eaf Jul 24, 2024
e0a8881
[rocketemu] exit with right EXIT_CODE check
Clo91eaf Jul 24, 2024
ffaf0a4
[rocketv] fix for rvdecoderdb bump
sequencer Jul 25, 2024
aefc0db
[rocketemu] add reg write event probe
Clo91eaf Jul 25, 2024
f233e70
[rocketemu] Add spike_rs, offline and test_common crates with depende…
Clo91eaf Jul 26, 2024
5d9f40f
[nix] add difftest derivation for rocketv
Avimitin Jul 26, 2024
85e741f
[rocketemu] set the resetvector(width: 64) using information from an …
PorterLu Jul 24, 2024
ffd5a9f
[rocketemu] add rustfmt
Clo91eaf Jul 27, 2024
2086104
[rocketemu] build rocket offline difftest
Clo91eaf Jul 27, 2024
899a085
[rocketemu] catch watchdog timeout event in offline difftest
Clo91eaf Jul 29, 2024
051c789
[rocketemu] optimize difftest loop
Clo91eaf Jul 29, 2024
e249b6f
[rocketemu] should not soft link the nix result directly
Clo91eaf Jul 29, 2024
cf2d446
[rocketemu] spike event record reg write idx with hex
Clo91eaf Jul 29, 2024
f0322f0
[rocketemu] add support for msu priviledge
Clo91eaf Jul 29, 2024
5b046bd
[rocketemu] skip check when spike/rtl reg write idx == 0
Clo91eaf Jul 29, 2024
425b6f1
[nix] refactor the rocketv subattr
Avimitin Aug 6, 2024
dca9103
[nix] rename default config to "meowth"
Avimitin Aug 6, 2024
45456c9
[build system] add t1-rocketv in build system for link t1 with rocket
sequencer Jul 23, 2024
41913dc
[t1rocket] draft Tile
sequencer Jul 24, 2024
b6d389b
[t1rocket] draft Testbench
sequencer Aug 3, 2024
f8d8fca
[t1rocket] fix elaborate
Avimitin Aug 4, 2024
ff42710
[t1rocket] update TestBench.scala with memory driver configuration an…
Clo91eaf Aug 4, 2024
155fa7f
[t1rocket] update t1rocketemu TestBench.scala to build the config json
Clo91eaf Aug 4, 2024
95117d2
[t1rocket] migrate difftest framework from t1 and update dpi from roc…
Clo91eaf Aug 4, 2024
b7e3c60
[t1rocket] refactor load_from_payload function to improve readability…
Clo91eaf Aug 4, 2024
721e41f
[t1rocket] add elf crate dependency
Clo91eaf Aug 4, 2024
8a8faa5
[elaborator] fix formatting
Avimitin Aug 4, 2024
d24d7f2
[nix] add derivation for t1rocketemu
Avimitin Aug 4, 2024
e3c5c54
[t1rocket] add missing dependencies and fix some bugs
Clo91eaf Aug 4, 2024
3364f3e
[t1rocket] add timeout check
Clo91eaf Aug 5, 2024
f2caaa6
[t1rocket] use t1rocket_cosim_init instead of cosim_init to expose li…
Clo91eaf Aug 5, 2024
822776a
[t1rocketemu] fix wrong mlirbc
Avimitin Aug 5, 2024
47aab7f
[nix] fix wrong RTL reference
Avimitin Aug 5, 2024
12e78de
[t1rocket] rename axi_write_indexedAccessAXI to axi_write_highOutstan…
Clo91eaf Aug 5, 2024
81627ab
[t1rocket] fix wrong get_resetvector
Clo91eaf Aug 5, 2024
be6fcdd
[t1rocket] fix unsafe extern "C" function signatures in dpi.rs
Clo91eaf Aug 5, 2024
ec964e0
[t1rocket] update axi_read_load_store function to use correct size pa…
Clo91eaf Aug 5, 2024
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
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,43 @@ If using clion,
$ nix develop .#t1.<config-name>.ip.emu -c clion ipemu/csrc
```

#### Rocket emulator

Rocket emulator contains multiple build phrase: RTL -> MLIR Bytecode ->
system verilog -> verilated C sources -> Rust emulator.

Most of the developer doesn't need to care about MLIR, system verilog and verilate detail.
To develop the Rocket-chip RTL, run:

```bash
# This command provide a environment that contains mill, circt, espresso... development tools.
nix develop '.#t1.elaborator'
```

> Metals LSP users are recommended to switch to mill-bsp mode instead of the default bloop mode.

To elaborate the RTLs, run mill or use the nix chroot:

```bash
# for development
mill -i elaborator.runMain org.chipsalliance.t1.elaborator.Main
# for clean build
nix build .#t1.rocketv-mlirbc
```

To develop the emulator, use the below nix environment:

```bash
nix develop .#t1.rocketv-emu.driver.devShell
```

This will setup the verilated C src in environment, download rust-analyzer.

```bash
cd rocketemu/driver
cargo build --release
```

#### Developing Testcases
The `tests/` contains the testcases. There are four types of testcases:

Expand Down
64 changes: 63 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait Chisel

object arithmetic extends Arithmetic

trait Arithmetic
trait Arithmetic
extends millbuild.dependencies.arithmetic.common.ArithmeticModule {
override def millSourcePath = os.pwd / "dependencies" / "arithmetic" / "arithmetic"
def scalaVersion = T(v.scala)
Expand Down Expand Up @@ -118,6 +118,38 @@ trait ConfigGen
def mainargsIvy = v.mainargs
}

object rocketv extends RocketV

trait RocketV
extends millbuild.common.RocketVModule
with ScalafmtModule {
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 chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = 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 chiselModule = Some(chisel)
def chiselPluginJar = T(Some(chisel.pluginModule.jar()))
def chiselPluginIvy = None
def chiselIvy = None
}

object ipemu extends IPEmulator

trait IPEmulator
Expand All @@ -132,6 +164,32 @@ trait IPEmulator
def chiselIvy = None
}

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

def rocketVModule = rocketv

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

object t1rocketemu extends T1RocketEmulator

trait T1RocketEmulator
extends millbuild.common.T1RocketEmulatorModule {
def scalaVersion = T(v.scala)

def t1rocketModule = t1rocket

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

object panamaconverter extends PanamaConverter

trait PanamaConverter
Expand All @@ -157,6 +215,10 @@ trait Elaborator
def generators = Seq(
t1,
ipemu,
rocketv,
rocketemu,
t1rocket,
t1rocketemu,
)

def mainargsIvy = v.mainargs
Expand Down
48 changes: 48 additions & 0 deletions common.sc
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,54 @@ trait ConfigGenModule
override def ivyDeps = T(super.ivyDeps() ++ Seq(mainargsIvy))
}

// T1 forked version of RocketCore
trait RocketModule
extends ScalaModule
with HasChisel
with HasRVDecoderDB {
def rocketchipModule: ScalaModule
def moduleDeps = super.moduleDeps ++ Seq(rocketchipModule)
}

// The next generation of purely standalone Rocket Core w/ AXI/CHI.
trait RocketVModule
extends ScalaModule
with HasChisel
with HasRVDecoderDB {
def axi4Module: ScalaModule
def hardfloatModule: ScalaModule

def moduleDeps = super.moduleDeps ++ Seq(axi4Module, hardfloatModule)
}

// Link T1 example: RocketV+T1
trait T1RocketModule
extends ScalaModule
with HasChisel {
def rocketModule: ScalaModule
def t1Module: ScalaModule

def moduleDeps = super.moduleDeps ++ Seq(rocketModule, t1Module)
}

trait EmuHelperModule
extends ScalaModule
with HasChisel

trait IPEmulatorModule
extends ScalaModule
with HasChisel {
def t1Module: ScalaModule
def moduleDeps = super.moduleDeps ++ Seq(t1Module)
}

trait T1RocketEmulatorModule
extends ScalaModule
with HasChisel {
def t1rocketModule: ScalaModule
def moduleDeps = super.moduleDeps ++ Seq(t1rocketModule)
}

trait ElaboratorModule
extends ScalaModule
with HasChisel {
Expand Down Expand Up @@ -120,3 +161,10 @@ trait OMReaderModule
super.forkArgs() ++ Seq("--enable-native-access=ALL-UNNAMED", "--enable-preview", s"-Djava.library.path=${ circtInstallPath().path / "lib"}")
)
}

trait RocketEmulatorModule
extends ScalaModule
with HasChisel {
def rocketVModule: ScalaModule
def moduleDeps = super.moduleDeps ++ Seq(rocketVModule)
}
77 changes: 77 additions & 0 deletions elaborator/src/Elaborator.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2024 Jiuyang Liu <[email protected]>
package org.chipsalliance.t1.elaborator

import chisel3.RawModule
import chisel3.experimental.{SerializableModule, SerializableModuleGenerator, SerializableModuleParameter}
import mainargs.TokensReader

import scala.reflect.runtime.universe
import scala.reflect.runtime.universe.{runtimeMirror, typeOf}

// TODO: this will be upstreamed to Chisel
trait Elaborator {
implicit object PathRead extends TokensReader.Simple[os.Path] {
def shortName = "path"
def read(strs: Seq[String]) = Right(os.Path(strs.head, os.pwd))
}

def configImpl[P <: SerializableModuleParameter: universe.TypeTag](
parameter: P
)(implicit rwP: upickle.default.Writer[P]) = os.write.over(
os.pwd / s"${getClass.getSimpleName.replace("$", "")}.json",
upickle.default.write(parameter)
)

def designImpl[
M <: SerializableModule[P]: universe.TypeTag,
P <: SerializableModuleParameter: universe.TypeTag
](parameter: os.Path, runFirtool: Boolean)(implicit
rwP: upickle.default.Reader[P]
) = {
var fir: firrtl.ir.Circuit = null
val annos = Seq(
new chisel3.stage.phases.Elaborate,
new chisel3.stage.phases.Convert
).foldLeft(
Seq(
chisel3.stage.ChiselGeneratorAnnotation(() =>
SerializableModuleGenerator(
runtimeMirror(getClass.getClassLoader)
.runtimeClass(typeOf[M].typeSymbol.asClass)
.asInstanceOf[Class[M]],
upickle.default.read[P](os.read(parameter))
).module().asInstanceOf[RawModule]
)
): firrtl.AnnotationSeq
) { case (annos, stage) => stage.transform(annos) }
.flatMap {
case firrtl.stage.FirrtlCircuitAnnotation(circuit) =>
fir = circuit
None
case _: chisel3.stage.DesignAnnotation[_] => None
case _: chisel3.stage.ChiselCircuitAnnotation => None
case a => Some(a)
}
val annoJsonFile = os.pwd / s"${fir.main}.anno.json"
val firFile = os.pwd / s"${fir.main}.fir"
val svFile = os.pwd / s"${fir.main}.sv"
os.write.over(firFile, fir.serialize)
os.write.over(
annoJsonFile,
firrtl.annotations.JsonProtocol.serializeRecover(annos)
)
if (runFirtool) {
os.proc(
"firtool",
s"--annotation-file=${annoJsonFile}",
s"${firFile}",
s"-o",
s"${svFile}",
"--strip-debug-info",
"--verification-flavor=sva",
"--extract-test-code"
).call(os.pwd)
}
}
}
70 changes: 52 additions & 18 deletions elaborator/src/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ package org.chipsalliance.t1.elaborator

import mainargs._
import org.chipsalliance.t1.rtl.T1Parameter
import org.chipsalliance.rocketv.RocketTileParameter
import chisel3.panamalib.option._
import org.chipsalliance.t1.tile.T1RocketTileParameter

object Main {
implicit object PathRead extends TokensReader.Simple[os.Path] {
Expand All @@ -27,11 +29,15 @@ object Main {
).foldLeft(
Seq(
chisel3.stage.ChiselGeneratorAnnotation(gen),
chisel3.panamaconverter.stage.FirtoolOptionsAnnotation(FirtoolOptions(Set(
BuildMode(BuildModeDebug),
PreserveValues(PreserveValuesModeNamed),
DisableUnknownAnnotations(true)
))),
chisel3.panamaconverter.stage.FirtoolOptionsAnnotation(
FirtoolOptions(
Set(
BuildMode(BuildModeDebug),
PreserveValues(PreserveValuesModeNamed),
DisableUnknownAnnotations(true)
)
)
)
): firrtl.AnnotationSeq
) { case (annos, stage) => stage.transform(annos) }
.flatMap {
Expand All @@ -41,9 +47,9 @@ object Main {
case chisel3.panamaconverter.stage.PanamaCIRCTConverterAnnotation(converter) =>
if (binderMlirbcOut.nonEmpty) panamaCIRCTConverter = converter
None
case _: chisel3.panamaconverter.stage.FirtoolOptionsAnnotation => None
case _: chisel3.stage.DesignAnnotation[_] => None
case _: chisel3.stage.ChiselCircuitAnnotation => None
case _: chisel3.panamaconverter.stage.FirtoolOptionsAnnotation => None
case _: chisel3.stage.DesignAnnotation[_] => None
case _: chisel3.stage.ChiselCircuitAnnotation => None
case a => Some(a)
}

Expand All @@ -62,20 +68,48 @@ object Main {
case class IPConfig(
@arg(name = "ip-config", short = 'c') ipConfig: os.Path) {
def generator = upickle.default
.read[chisel3.experimental.SerializableModuleGenerator[org.chipsalliance.t1.rtl.T1, org.chipsalliance.t1.rtl.T1Parameter]](ujson.read(os.read(ipConfig)))
.read[chisel3.experimental.SerializableModuleGenerator[
org.chipsalliance.t1.rtl.T1,
org.chipsalliance.t1.rtl.T1Parameter
]](ujson.read(os.read(ipConfig)))
def parameter: T1Parameter = generator.parameter
}

implicit def ipConfig: ParserForClass[IPConfig] = ParserForClass[IPConfig]
case class RocketConfig(
@arg(name = "rocket-config", short = 'c') rocketConfig: os.Path) {
def generator = upickle.default
.read[chisel3.experimental.SerializableModuleGenerator[
org.chipsalliance.rocketv.RocketTile,
org.chipsalliance.rocketv.RocketTileParameter
]](ujson.read(os.read(rocketConfig)))
def parameter: RocketTileParameter = generator.parameter
}

case class T1RocketConfig(
@arg(name = "t1rocket-config", short = 'c') rocketConfig: os.Path) {
def generator = upickle.default
.read[chisel3.experimental.SerializableModuleGenerator[
org.chipsalliance.t1.tile.T1RocketTile,
org.chipsalliance.t1.tile.T1RocketTileParameter
]](ujson.read(os.read(rocketConfig)))
def parameter: T1RocketTileParameter = generator.parameter
}

implicit def ipConfig: ParserForClass[IPConfig] = ParserForClass[IPConfig]
implicit def rocketConfig: ParserForClass[RocketConfig] = ParserForClass[RocketConfig]
implicit def t1RocketConfig: ParserForClass[T1RocketConfig] = ParserForClass[T1RocketConfig]

@main def ip(elaborateConfig: ElaborateConfig, ipConfig: IPConfig): Unit =
elaborateConfig.elaborate(() => ipConfig.generator.module())

@main def ipemu(elaborateConfig: ElaborateConfig, ipConfig: IPConfig): Unit =
elaborateConfig.elaborate(() => new org.chipsalliance.t1.ipemu.TestBench(ipConfig.generator))

@main def rocketemu(elaborateConfig: ElaborateConfig, rocketConfig: RocketConfig): Unit =
elaborateConfig.elaborate(() => new org.chipsalliance.t1.rocketv.TestBench(rocketConfig.generator))

// format: off
@main def ip(elaborateConfig: ElaborateConfig, ipConfig: IPConfig): Unit = elaborateConfig.elaborate(() =>
ipConfig.generator.module()
)
@main def ipemu(elaborateConfig: ElaborateConfig, ipConfig: IPConfig): Unit = elaborateConfig.elaborate(() =>
new org.chipsalliance.t1.ipemu.TestBench(ipConfig.generator)
)
// format: on
@main def t1rocketemu(elaborateConfig: ElaborateConfig, t1rocketConfig: T1RocketConfig): Unit =
elaborateConfig.elaborate(() => new org.chipsalliance.t1.t1rocketemu.TestBench(t1rocketConfig.generator))

def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args)
}
Loading