Skip to content

Commit 7ab079d

Browse files
committed
fpga_diff: expose extra IO with difftest createTopIOs
1 parent c347b0a commit 7ab079d

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
TOP = TopMain
22
SIM_TOP = SimTop
3-
FPGA_DIFF_TOP = FpgaDiffTop
43
FPGATOP = Top
54
# REAL_TOP selection:
6-
# - if BOARD is exactly "fpgadiff" -> use FPGA_DIFF_TOP
7-
# - else if BOARD starts with "sim" -> use SIM_TOP
5+
# - if BOARD is exactly "fpgadiff" or "sim" -> use FPGA_DIFF_TOP
86
# - otherwise use FPGATOP
9-
REAL_TOP = $(if $(filter fpgadiff,$(BOARD)),$(FPGA_DIFF_TOP),$(if $(filter sim,$(BOARD)),$(SIM_TOP),$(FPGATOP)))
7+
REAL_TOP = $(if $(filter fpgadiff sim,$(BOARD)),$(SIM_TOP),$(FPGATOP))
108

119
BUILD_DIR = $(abspath ./build)
1210

src/main/scala/sim/NutShellSim.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class NutShellSim extends Module with HasDiffTestInterfaces {
4545

4646
val uart = IO(new UARTIO)
4747
uart <> mmio.io.uart
48-
override def connectTopIOs(difftest: DifftestTopIO): Unit = {
48+
override def connectTopIOs(difftest: DifftestTopIO): Seq[Data] = {
4949
difftest.uart <> uart
50+
Seq.empty
5051
}
5152
}

src/test/scala/TopMain.scala

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,11 @@ class Top extends Module {
3636
dontTouch(vga.io)
3737
}
3838

39-
class FpgaDiffTop extends Module with HasDiffTestInterfaces {
40-
lazy val config = NutCoreConfig(FPGADifftest = true)
41-
val soc = Module(new NutShell()(config))
42-
val io = IO(soc.io.cloneType)
43-
soc.io <> io
44-
39+
class FpgaDiffTop extends NutShell()(NutCoreConfig(FPGADifftest = true)) with HasDiffTestInterfaces {
40+
override def desiredName: String = "NutShell"
4541
override def cpuName: Option[String] = Some("NutShell")
46-
override def connectTopIOs(difftest: DifftestTopIO): Unit = {
47-
val io = IO(chiselTypeOf(this.io))
48-
io <> this.io
42+
override def connectTopIOs(difftest: DifftestTopIO): Seq[Data] = {
43+
Seq(io)
4944
}
5045
}
5146

0 commit comments

Comments
 (0)