Skip to content

Commit

Permalink
More BmbGenerator peripherals
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed May 30, 2020
1 parent 97abd55 commit 4fa6be3
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
18 changes: 18 additions & 0 deletions lib/src/main/scala/spinal/lib/bus/bmb/BmbCc.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package spinal.lib.bus.bmb

import spinal.core._
import spinal.lib._

case class BmbCcFifo(p: BmbParameter,
cmdDepth : Int,
rspDepth : Int,
inputCd: ClockDomain,
outputCd: ClockDomain) extends Component{
val io = new Bundle {
val input = slave(Bmb(p))
val output = master(Bmb(p))
}

io.output.cmd << io.input.cmd.queue(cmdDepth, inputCd, outputCd)
io.input.rsp << io.output.rsp.queue(rspDepth, outputCd, inputCd)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package spinal.lib.com.spi.ddr

import spinal.core._
import spinal.lib.bus.bmb.{Bmb, BmbAccessParameter, BmbParameter, BmbSlaveFactory}
import spinal.lib.com.spi.ddr.SpiXdrMasterCtrl.{Cmd, Config, Rsp}
import spinal.lib.{Flow, Stream, master, slave}



object BmbSpiXdrMasterCtrl{
def getBmbCapabilities(accessSource : BmbAccessParameter) = BmbSlaveFactory.getBmbCapabilities(
accessSource,
addressWidth = addressWidth,
dataWidth = 32
)
def addressWidth = 12
}


case class BmbSpiXdrMasterCtrl(p : SpiXdrMasterCtrl.MemoryMappingParameters, ctrlParameter : BmbParameter) extends Component{
val io = new Bundle {
val ctrl = slave(Bmb(ctrlParameter))
val xip = ifGen(p.xip != null) (slave(SpiXdrMasterCtrl.XipBus(p.xip)))
val spi = master(SpiXdrMaster(p.ctrl.spi))
val interrupt = out Bool()
}

val ctrl = SpiXdrMasterCtrl(p.ctrl)
val mapping = SpiXdrMasterCtrl.driveFrom(ctrl, BmbSlaveFactory(io.ctrl))(p)
if(p.xip != null) io.xip <> mapping.xip.xipBus
io.spi <> ctrl.io.spi
io.interrupt <> mapping.interruptCtrl.interrupt
}
19 changes: 18 additions & 1 deletion lib/src/main/scala/spinal/lib/io/Gpio.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package spinal.lib.io
import spinal.core._
import spinal.lib._
import spinal.lib.bus.amba3.apb.{Apb3, Apb3Config, Apb3SlaveFactory}
import spinal.lib.bus.bmb.{Bmb, BmbAccessParameter, BmbParameter, BmbSlaveFactory}
import spinal.lib.bus.misc.BusSlaveFactory

object Gpio {
Expand Down Expand Up @@ -64,6 +65,8 @@ object Gpio {
}
}
}

def addressWidth = 8
}


Expand All @@ -73,4 +76,18 @@ case class Apb3Gpio2( parameter: Gpio.Parameter,
parameter,
Apb3(busConfig),
Apb3SlaveFactory(_)
) { val dummy = 0 }
)
object BmbGpio2{
def getBmbCapabilities(accessSource : BmbAccessParameter) = BmbSlaveFactory.getBmbCapabilities(
accessSource,
addressWidth = Gpio.addressWidth,
dataWidth = 32
)
}
case class BmbGpio2( parameter: Gpio.Parameter,
busConfig: BmbParameter
) extends Gpio.Ctrl[Bmb] (
parameter,
Bmb(busConfig),
BmbSlaveFactory(_)
)

0 comments on commit 4fa6be3

Please sign in to comment.