From 209fc719e8a0921ea3fcacc8566b6c6ff887e772 Mon Sep 17 00:00:00 2001 From: Dolu1990 Date: Tue, 24 May 2022 10:19:35 +0200 Subject: [PATCH] VexRiscvBmbGenerator export more info --- .../scala/vexriscv/VexRiscvBmbGenerator.scala | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/main/scala/vexriscv/VexRiscvBmbGenerator.scala b/src/main/scala/vexriscv/VexRiscvBmbGenerator.scala index 3ff3334..a30b751 100644 --- a/src/main/scala/vexriscv/VexRiscvBmbGenerator.scala +++ b/src/main/scala/vexriscv/VexRiscvBmbGenerator.scala @@ -1,11 +1,11 @@ package vexriscv import spinal.core._ -import spinal.lib.bus.bmb.{Bmb, BmbAccessCapabilities, BmbAccessParameter, BmbImplicitDebugDecoder, BmbInvalidationParameter, BmbParameter, BmbInterconnectGenerator} +import spinal.lib.bus.bmb.{Bmb, BmbAccessCapabilities, BmbAccessParameter, BmbImplicitDebugDecoder, BmbInterconnectGenerator, BmbInvalidationParameter, BmbParameter} import spinal.lib.bus.misc.AddressMapping import spinal.lib.com.jtag.{Jtag, JtagTapInstructionCtrl} import spinal.lib.generator._ -import spinal.lib.slave +import spinal.lib.{sexport, slave} import vexriscv.plugin._ import spinal.core.fiber._ @@ -93,12 +93,33 @@ case class VexRiscvBmbGenerator()(implicit interconnectSmp: BmbInterconnectGener } val cpu = new VexRiscv(config) + def doExport(value : => Any, postfix : String) = { + sexport(Handle(value).setCompositeName(VexRiscvBmbGenerator.this, postfix)) + } + + doExport(cpu.plugins.exists(_.isInstanceOf[CfuPlugin]), "cfu") + doExport(cpu.plugins.exists(_.isInstanceOf[FpuPlugin]), "fpu") for (plugin <- cpu.plugins) plugin match { case plugin: IBusSimplePlugin => iBus.load(plugin.iBus.toBmb()) case plugin: DBusSimplePlugin => dBus.load(plugin.dBus.toBmb()) - case plugin: IBusCachedPlugin => iBus.load(plugin.iBus.toBmb()) - case plugin: DBusCachedPlugin => dBus.load(plugin.dBus.toBmb()) + case plugin: IBusCachedPlugin => { + iBus.load(plugin.iBus.toBmb()) + doExport(plugin.config.wayCount, "icacheWays") + doExport(plugin.config.cacheSize, "icacheSize") + } + case plugin: DBusCachedPlugin => { + dBus.load(plugin.dBus.toBmb()) + doExport(plugin.config.wayCount, "dcacheWays") + doExport(plugin.config.cacheSize, "dcacheSize") + } + case plugin: MmuPlugin => { + doExport(true, "mmu") + } + case plugin: StaticMemoryTranslatorPlugin => { + doExport(false, "mmu") + } case plugin: CsrPlugin => { + doExport(plugin.config.supervisorGen, "supervisor") externalInterrupt load plugin.externalInterrupt timerInterrupt load plugin.timerInterrupt softwareInterrupt load plugin.softwareInterrupt