DebugPlugin now support Bmb

This commit is contained in:
Dolu1990 2020-06-02 19:13:55 +02:00
parent 5e5c730959
commit 08189ee907
1 changed files with 47 additions and 0 deletions

View File

@ -9,6 +9,8 @@ import spinal.core._
import spinal.lib._ import spinal.lib._
import spinal.lib.bus.amba3.apb.{Apb3, Apb3Config} import spinal.lib.bus.amba3.apb.{Apb3, Apb3Config}
import spinal.lib.bus.avalon.{AvalonMM, AvalonMMConfig} import spinal.lib.bus.avalon.{AvalonMM, AvalonMMConfig}
import spinal.lib.bus.bmb.{Bmb, BmbAccessParameter, BmbParameter}
import spinal.lib.bus.simple.PipelinedMemoryBus
import scala.collection.mutable.ArrayBuffer import scala.collection.mutable.ArrayBuffer
@ -22,6 +24,16 @@ case class DebugExtensionRsp() extends Bundle{
val data = Bits(32 bit) val data = Bits(32 bit)
} }
object DebugExtensionBus{
def getBmbAccessParameter(source : BmbAccessParameter) = BmbAccessParameter(
addressWidth = 8,
dataWidth = 32,
lengthWidth = 2,
sourceWidth = source.sourceWidth,
contextWidth = source.contextWidth
)
}
case class DebugExtensionBus() extends Bundle with IMasterSlave{ case class DebugExtensionBus() extends Bundle with IMasterSlave{
val cmd = Stream(DebugExtensionCmd()) val cmd = Stream(DebugExtensionCmd())
val rsp = DebugExtensionRsp() //one cycle latency val rsp = DebugExtensionRsp() //one cycle latency
@ -63,6 +75,41 @@ case class DebugExtensionBus() extends Bundle with IMasterSlave{
bus bus
} }
def fromPipelinedMemoryBus(): PipelinedMemoryBus ={
val bus = PipelinedMemoryBus(32, 32)
cmd.arbitrationFrom(bus.cmd)
cmd.wr := bus.cmd.write
cmd.address := bus.cmd.address.resized
cmd.data := bus.cmd.data
bus.rsp.valid := RegNext(cmd.fire) init(False)
bus.rsp.data := rsp.data
bus
}
def fromBmb(): Bmb ={
val bus = Bmb(BmbParameter(
addressWidth = 8,
dataWidth = 32,
lengthWidth = 2,
sourceWidth = 0,
contextWidth = 0
))
cmd.arbitrationFrom(bus.cmd)
cmd.wr := bus.cmd.isWrite
cmd.address := bus.cmd.address
cmd.data := bus.cmd.data
bus.rsp.valid := RegNext(cmd.fire) init(False)
bus.rsp.data := rsp.data
bus.rsp.last := True
bus
}
def from(c : SystemDebuggerConfig) : SystemDebuggerMemBus = { def from(c : SystemDebuggerConfig) : SystemDebuggerMemBus = {
val mem = SystemDebuggerMemBus(c) val mem = SystemDebuggerMemBus(c)
cmd.valid := mem.cmd.valid cmd.valid := mem.cmd.valid